Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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);
        }