public async void TestPayments() { PaymentCallBuilder builder = new PaymentCallBuilder(horizon_url); builder.accountId("GBLQWS2KU3GW67KXQKAWWAML33465ZDVOWCEVV5TU2PHXMZUA3PFQM5C"); builder.order("desc").limit(2); var payments = await builder.Call(); Assert.Equal(2, payments.Embedded.Records.Length); }
public async Task <Payments> GetPayments(string address, string order = StellarSdkConstants.OrderAsc, string cursor = "") { try { var builder = new PaymentCallBuilder(_horizonUrl); builder.accountId(address); builder.order(order).cursor(cursor); var payments = await builder.Call(); return(payments); } catch (ResourceNotFoundException) { // address not found return(null); } }
public async Task <long> GetLedgerNoOfLastPayment(string address) { var builder = new PaymentCallBuilder(_horizonUrl); builder.accountId(address); builder.order(StellarSdkConstants.OrderDesc).limit(1); var payments = await builder.Call(); if (payments?.Embedded?.Records == null || payments?.Embedded?.Records.Length < 1) { throw new HorizonApiException($"Latest ledger missing from query result."); } var hash = payments.Embedded.Records[0].TransactionHash; var tx = await GetTransactionDetails(hash); if (tx == null) { throw new HorizonApiException($"Transaction not found. hash={hash}"); } return(tx.Ledger); }