Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(toAddressBox.Text))
            {
                MessageBox.Show("Please insert destination address");
                return;
            }

            var symbol = assetComboBox.SelectedItem.ToString();

            int amount = int.Parse(amountBox.Text);

            if (amount <= 0)
            {
                MessageBox.Show("Please insert a valid amount of " + symbol);
                return;
            }

            if (!balances.ContainsKey(symbol) || balances[symbol] < amount)
            {
                MessageBox.Show("You dont have enough " + symbol);
                return;
            }

            if (api.IsAsset(symbol))
            {
                api.SendAsset(keyPair, toAddressBox.Text, symbol, amount);
            }
            else
            {
                var token = api.GetToken(symbol);
                token.Transfer(keyPair, toAddressBox.Text, amount);
            }
        }