public async Task <Transaction> GetTransaction(KeyPair sourceKeyPair, string destinationAddress, double amount, string marketPlaceOrderId = null) { KeyPair destinationKeyPair = KeyPair.FromAccountId(destinationAddress); AccountResponse sourceAccount = await GetAccount(sourceKeyPair); AccountResponse destinationAccount = await GetAccount(destinationKeyPair); Transaction response = await GetTransaction(sourceKeyPair, destinationKeyPair, sourceAccount, amount / 100, marketPlaceOrderId).ConfigureAwait(false); return(response); }
private Task <Transaction> GetTransaction(KeyPair sourceKeyPair, KeyPair destinationKeyPair, AccountResponse sourceAccount, double amount, string marketPlaceOrderId = null) { PaymentOperation.Builder paymentOperationBuilder = new PaymentOperation.Builder(destinationKeyPair, _kinAsset, amount.ToString(CultureInfo.InvariantCulture)) .SetSourceAccount(sourceKeyPair); PaymentOperation paymentOperation = paymentOperationBuilder.Build(); Transaction.Builder paymentTransaction = new Transaction.Builder(new Account(sourceKeyPair, sourceAccount.SequenceNumber)).AddOperation( paymentOperation); string toAppend = string.IsNullOrEmpty(marketPlaceOrderId) ? "p2p" : marketPlaceOrderId; paymentTransaction.AddMemo(new MemoText($"1-{_appId}-{toAppend}")); Transaction transaction = paymentTransaction.Build(); transaction.Sign(sourceKeyPair); return(Task.FromResult(transaction)); }
private async Task <SubmitTransactionResponse> SendPaymentOperation(Transaction transaction) { return(await _server.SubmitTransaction(transaction).ConfigureAwait(false)); }