diff --git a/lib/src/responses/ledger_response.dart b/lib/src/responses/ledger_response.dart index 27d3c6a..3a8aab5 100644 --- a/lib/src/responses/ledger_response.dart +++ b/lib/src/responses/ledger_response.dart @@ -62,9 +62,9 @@ class LedgerResponse extends Response { json['total_coins'] as String, json['fee_pool'] as String, convertInt(json['base_fee']), - json['base_fee_in_stroops'] as String, + json['base_fee_in_stroops'].toString(), json['base_reserve'] as String, - json['base_reserve_in_stroops'] as String, + json['base_reserve_in_stroops'].toString(), convertInt(json['max_tx_set_size']), convertInt(json['protocol_version']), json['header_xdr'] as String, diff --git a/test/query_test.dart b/test/query_test.dart index ac84593..b8c3073 100644 --- a/test/query_test.dart +++ b/test/query_test.dart @@ -119,4 +119,65 @@ void main() { "num accounts:${asset.numAccounts}"); } }); + + test('test query effects', () async { + Page assetsPage = await sdk.assets + .assetCode("USD") + .limit(5) + .order(RequestBuilderOrder.DESC) + .execute(); + List assets = assetsPage.records; + assert(assets.length > 0 && assets.length < 6); + + String assetIssuer = assets.last.assetIssuer; + + Page effectsPage = await sdk.effects + .forAccount(assetIssuer) + .limit(3) + .order(RequestBuilderOrder.ASC) + .execute(); + List effects = effectsPage.records; + assert(effects.length > 0 && effects.length < 4); + assert(effects.first is AccountCreatedEffectResponse); + + Page ledgersPage = + await sdk.ledgers.limit(1).order(RequestBuilderOrder.DESC).execute(); + assert(ledgersPage.records.length == 1); + LedgerResponse ledger = ledgersPage.records.first; + effectsPage = await sdk.effects + .forLedger(ledger.sequence) + .limit(3) + .order(RequestBuilderOrder.ASC) + .execute(); + effects = effectsPage.records; + assert(effects.length > 0); + + Page transactionsPage = await sdk.transactions + .forLedger(ledger.sequence) + .limit(1) + .order(RequestBuilderOrder.DESC) + .execute(); + assert(transactionsPage.records.length == 1); + TransactionResponse transaction = transactionsPage.records.first; + effectsPage = await sdk.effects + .forTransaction(transaction.hash) + .limit(3) + .order(RequestBuilderOrder.ASC) + .execute(); + assert(effects.length > 0); + + Page operationsPage = await sdk.operations + .forTransaction(transaction.hash) + .limit(1) + .order(RequestBuilderOrder.DESC) + .execute(); + assert(operationsPage.records.length == 1); + OperationResponse operation = operationsPage.records.first; + effectsPage = await sdk.effects + .forOperation(operation.id) + .limit(3) + .order(RequestBuilderOrder.ASC) + .execute(); + assert(effects.length > 0); + }); }