public async Task <WebCallResult <SendCoinResult> > SendCoinsAsync(
            string coin,
            string walletId,
            SendCoinsRequestData request,
            CancellationToken cancellationToken = default)
        {
            var resp = await this.PostAsync <SendCoinResult>($"{this.EndpointUrl}/{coin}/wallet/{walletId}/sendcoins", request, cancellationToken);

            if (resp.Data != null)
            {
                resp.Data.IsRequireApproval = resp.ResponseStatusCode == HttpStatusCode.Accepted;
            }

            return(resp);
        }
        public Task <WebCallResult <SendCoinResult> > SendCoinsAsync(
            string coin, string walletId, string walletPassphrase,
            string sequenceId, string amount,
            string address, MemoType memo       = null,
            CancellationToken cancellationToken = default)
        {
            var request = new SendCoinsRequestData()
            {
                WalletPassphrase = walletPassphrase,
                Address          = address,
                Amount           = amount,
                SequenceId       = sequenceId,
                Memo             = memo
            };

            return(SendCoinsAsync(coin, walletId, request, cancellationToken));
        }
Ejemplo n.º 3
0
        static async Task TestExpress2(IBitGoApi api, string coin, string fromWalletId, string toWalletId, string toUser, string amount)
        {
            Console.Clear();

            var ping = await api.PingExpressAsync();

            Console.WriteLine($"Ping result: {ping.Data.Status}");

            //var address = await client.CreateAddressAsync(coin, toWalletId, toUser);
            //var addr = address.Data.Address;

            var address = await api.GetAddressesAsync(coin, toWalletId, labelContains : toUser);

            if (address.Data.Addresses.Length != 1)
            {
                Console.WriteLine($"[ERROR] User {toUser} on the wallet {toWalletId} has {address.Data.Addresses.Length} addresses");
                return;
            }

            var addr = address.Data.Addresses.Last().Address;

            var verifyResult = await api.VerifyAddressAsync(coin, addr);

            Console.WriteLine($"Address [{addr}] verify: {verifyResult.Data.IsValid}");

            var sid = $"st_{DateTime.UtcNow:O}";


            var request = new SendCoinsRequestData()
            {
                WalletPassphrase = _walletPassphrase1,
                Address          = addr,
                Amount           = amount,
                SequenceId       = sid,
            };


            var sendResult = await api.SendCoinsAsync(coin, fromWalletId, request);

            Console.WriteLine($"Send coin. Pending Approval: {sendResult.Data.IsRequireApproval}, Tx: {sendResult.Data.Transfer.TxId}");
            Console.WriteLine($"rid: {sendResult.Data.Transfer.TransferId}");

            Console.WriteLine();
            Console.WriteLine("Press to continue");
            Console.ReadLine();
        }