getLedger method

Future<LedgerData> getLedger({
  1. bool queue = false,
  2. bool full = false,
  3. bool accounts = false,
  4. bool transactions = false,
  5. bool expand = false,
  6. bool ownerFunds = false,
  7. bool binary = false,
  8. String? ledgerHash,
  9. XRPLLedgerIndex? ledgerIndex = XRPLLedgerIndex.validated,
  10. LedgerEntryType? type,
})

Retrieve information about the public ledger. See ledger

Implementation

Future<LedgerData> getLedger(
    {bool queue = false,
    bool full = false,
    bool accounts = false,
    bool transactions = false,
    bool expand = false,
    bool ownerFunds = false,
    bool binary = false,
    String? ledgerHash,
    XRPLLedgerIndex? ledgerIndex = XRPLLedgerIndex.validated,
    LedgerEntryType? type}) async {
  final Map<String, dynamic> configParams = {};
  _createRpcConfig(configParams, "full", full);
  _createRpcConfig(configParams, "queue", queue);
  _createRpcConfig(configParams, "accounts", accounts);
  _createRpcConfig(configParams, "transactions", transactions);
  _createRpcConfig(configParams, "expand", expand);
  _createRpcConfig(configParams, "owner_funds", ownerFunds);
  _createRpcConfig(configParams, "binary", false);
  _createRpcConfig(configParams, "type", type?.name);
  _createRpcConfig(configParams, "ledger_index", ledgerIndex?.value);
  _createRpcConfig(configParams, "ledger_hash", ledgerHash);
  final response = await makeCustomCall<Map<String, dynamic>>(
      "ledger", configParams.isEmpty ? [] : [configParams]);

  return LedgerData.fromJson(response);
}