protected async Task FundAccountAsync(ulong amount, string address) { var request = await IndyPayments.BuildMintRequestAsync(Context.Wallet, Trustee.Did, new[] { new { recipient = address, amount = amount } }.ToJson(), null); await TrusteeMultiSignAndSubmitRequestAsync(request.Result); }
protected async Task FundDefaultAccountAsync(ulong amount) { var record = await provisioningService.GetProvisioningAsync(Context.Wallet); var addressRecord = await recordService.GetAsync <PaymentAddressRecord>(Context.Wallet, record.DefaultPaymentAddressId); // Mint tokens to the address to fund initially var request = await IndyPayments.BuildMintRequestAsync(Context.Wallet, Trustee.Did, new[] { new { recipient = addressRecord.Address, amount = amount } }.ToJson(), null); await TrusteeMultiSignAndSubmitRequestAsync(request.Result); await paymentService.RefreshBalanceAsync(Context, addressRecord); }
//[Fact(DisplayName = "Transfer funds between Sovrin addresses with ledger fees")] public async Task TransferFundsAsync() { // Generate from address var addressFrom = await paymentService.CreatePaymentAddressAsync(Context); await SetFeesForPublicXferTransactionsAsync(2); // Mint tokens to the address to fund initially var request = await IndyPayments.BuildMintRequestAsync(Context.Wallet, Trustee.Did, new[] { new { recipient = addressFrom.Address, amount = 15 } }.ToJson(), null); await TrusteeMultiSignAndSubmitRequestAsync(request.Result); // Generate destination address var addressTo = await paymentService.CreatePaymentAddressAsync(Context); // Create payment record and make payment var paymentRecord = new PaymentRecord { Address = addressTo.Address, Amount = 10 }; await recordService.AddAsync(Context.Wallet, paymentRecord); await paymentService.MakePaymentAsync(Context, paymentRecord, addressFrom); var fee = await paymentService.GetTransactionFeeAsync(Context, TransactionTypes.XFER_PUBLIC); Assert.Equal(2UL, fee); await paymentService.RefreshBalanceAsync(Context, addressFrom); await paymentService.RefreshBalanceAsync(Context, addressTo); Assert.Equal(10UL, addressTo.Balance); Assert.Equal(3UL, addressFrom.Balance); await UnsetFeesForPublicXferTransactionsAsync(); }