Exemple #1
0
        public async void Unarchive_BadAddress_ServerApiException()
        {
            ServerApiException apiException = await Assert.ThrowsAsync <ServerApiException>(async() => {
                using (BlockchainApiHelper apiHelper = new BlockchainApiHelper())
                {
                    WalletHelper walletHelper = apiHelper.CreateWalletHelper(WalletTests.WALLET_ID, WalletTests.WALLET_PASSWORD, WalletTests.WALLET_PASSWORD2);
                    await walletHelper.UnarchiveAddress("BadAddress");
                }
            });

            Assert.Contains("Checksum", apiException.Message);
        }
Exemple #2
0
        public async void GetAddresses_Valid()
        {
            using (BlockchainApiHelper apiHelper = new BlockchainApiHelper())
            {
                WalletHelper   walletHelper = apiHelper.CreateWalletHelper(WalletTests.WALLET_ID, WalletTests.WALLET_PASSWORD, WalletTests.WALLET_PASSWORD2);
                List <Address> addresses    = await walletHelper.ListAddressesAsync();

                Assert.NotNull(addresses);
                Assert.NotEmpty(addresses);
                Assert.True(addresses.Any(a => string.Equals(a.AddressStr, WalletTests.FIRST_ADDRESS)));
            }
        }
Exemple #3
0
        public async void SendPayment_SendBtc_NoFreeOutputs()
        {
            ServerApiException apiException = await Assert.ThrowsAsync <ServerApiException>(async() => {
                using (BlockchainApiHelper apiHelper = new BlockchainApiHelper())
                {
                    WalletHelper walletHelper = apiHelper.CreateWalletHelper(WalletTests.WALLET_ID, WalletTests.WALLET_PASSWORD, WalletTests.WALLET_PASSWORD2);
                    await walletHelper.SendAsync(WalletTests.FIRST_ADDRESS, BitcoinValue.FromBtc(1));
                }
            });

            Assert.Contains("No free", apiException.Message);
        }
Exemple #4
0
        public async void SendPayment_SendMultiBtc_NoFreeOutputs()
        {
            ServerApiException apiException = await Assert.ThrowsAsync <ServerApiException>(async() => {
                using (BlockchainApiHelper apiHelper = new BlockchainApiHelper())
                {
                    WalletHelper walletHelper = apiHelper.CreateWalletHelper(WalletTests.WALLET_ID, WalletTests.WALLET_PASSWORD, WalletTests.WALLET_PASSWORD2);
                    Dictionary <string, BitcoinValue> recipients = new Dictionary <string, BitcoinValue>()
                    {
                        { "17VYDFsDxBMovM1cKGEytgeqdijNcr4L5", BitcoinValue.FromBtc(1) }
                    };
                    await walletHelper.SendManyAsync(recipients);
                }
            });

            Assert.Contains("No free", apiException.Message);
        }
Exemple #5
0
        public async void NewAddress_ArchiveThenConsolidate_Valid()
        {
            using (BlockchainApiHelper apiHelper = new BlockchainApiHelper())
            {
                WalletHelper walletHelper = apiHelper.CreateWalletHelper(WalletTests.WALLET_ID, WalletTests.WALLET_PASSWORD, WalletTests.WALLET_PASSWORD2);
                Address      address      = await walletHelper.NewAddress("Test");

                Assert.NotNull(address);

                string archivedAddress = await walletHelper.ArchiveAddress(address.AddressStr);

                Assert.NotNull(archivedAddress);


                string unarchivedAddress = await walletHelper.UnarchiveAddress(archivedAddress);

                Assert.NotNull(unarchivedAddress);
            }
        }
Exemple #6
0
 private WalletHelper GetWalletHelper(BlockchainApiHelper apiHelper)
 {
     return(apiHelper.CreateWalletHelper("Test", "Test"));
 }
Exemple #7
0
 /// <summary>
 /// Method for set your wallet
 /// </summary>
 /// <param name="idwallet">Specific identifier current wallet</param>
 /// <param name="pass">Decrypted first password</param>
 /// <param name="passtwo">Decrypted second password</param>
 public WalletHelper GetWallet(string idwallet, string pass, string passtwo = null)
 {
     return(_blockchainApi.CreateWalletHelper(identifier: idwallet, password: pass, secondPassword: passtwo));
 }