コード例 #1
0
        public void CanDetectInvalidAddress()
        {
            PrepareNetworks.EnsureLiteCoinPrepared();

            var invalidAddress   = "invalid";
            var addressValidator = new AddressValidator(NBitcoin.Litecoin.Networks.Testnet);

            Assert.False(addressValidator.IsValid(invalidAddress));
        }
コード例 #2
0
        public async Task CanCalculateFeeForTx()
        {
            PrepareNetworks.EnsureLiteCoinPrepared();

            var feePerByte     = 100;
            var feeRateService = CreateFeeRateFacade(feePerByte);

            var feeFacade = new FeeService(feeRateService.Object);

            var txBuilder = GetTestTx(Network.RegTest);

            await feeFacade.CalcFeeForTransaction(txBuilder.BuildTransaction(true));
        }
コード例 #3
0
        public async Task ReturnsFeeMaxValueIfCalculatedFeeBiggerThanMaxValue()
        {
            PrepareNetworks.EnsureLiteCoinPrepared();

            var feePerByte     = 9999;
            var feeRateService = CreateFeeRateFacade(feePerByte);

            var feeMaxValue = 1000;
            var feeFacade   = new FeeService(feeRateService.Object, 100, feeMaxValue);

            var txBuilder = GetTestTx(Network.RegTest);

            var fee = await feeFacade.CalcFeeForTransaction(txBuilder.BuildTransaction(true));

            Assert.True(fee.Satoshi == feeMaxValue);
        }
コード例 #4
0
        public void DoNotPassBTCAddress()
        {
            PrepareNetworks.EnsureLiteCoinPrepared();


            var addresses = new[]
            {
                "LLgJTbzZMsRTCUF1NtvvL9SR1a4pVieW89",
                "Le6rZj8bLTbUATVhcZBxd3Z1u8b542C63T"
            };
            var addressValidator = new AddressValidator(NBitcoin.Litecoin.Networks.Mainnet);

            foreach (var address in addresses)
            {
                Assert.True(addressValidator.IsValid(address));
            }
        }
コード例 #5
0
        public void PassTestNetLTCAddress()
        {
            PrepareNetworks.EnsureLiteCoinPrepared();


            var addresses = new[]
            {
                "mu5a17UQDh2hsRk9ZJzFkTfCbzZhMVBHY3",
                "mifUh8hTMomrQL1dyVykffhcsYAfExzdxa",
                "msiJHQf1BVXD6fuUyLn9D8mD6gMbPibiDV"
            };
            var addressValidator = new AddressValidator(NBitcoin.Litecoin.Networks.Testnet);

            foreach (var address in addresses)
            {
                Assert.True(addressValidator.IsValid(address));
            }
        }
コード例 #6
0
        public void PassMainNetLTCAddress()
        {
            PrepareNetworks.EnsureLiteCoinPrepared();


            var addresses = new[]
            {
                "13xWF5cWE1Byyvq8FiKUafTHTX4kx3MD7p",
                "1Q7Jmho4FixWBiTVcZ5aKXv4rTMMp6CjiD",
                "1LU4xEKf7SFnQ3GX8CDfDHvWkszaKrYRcD"
            };
            var addressValidator = new AddressValidator(NBitcoin.Litecoin.Networks.Mainnet);

            foreach (var address in addresses)
            {
                Assert.False(addressValidator.IsValid(address));
            }
        }