ledger_entry - XRPL.
Example code for the ledger_entry JSON RPC method. Complete guide to using ledger_entry JSON-RPC in the GetBlock Web3 documentation.
This method returns a single ledger entry from the XRP Ledger in its raw format.
Parameters
index
string
No
Object ID
account_root
string
No
Account address
directory
object
No
Directory specification
offer
object
No
Offer specification
ripple_state
object
No
Trust line specification
check
string
No
Check ID
escrow
object
No
Escrow specification
payment_channel
string
No
Channel ID
deposit_preauth
object
No
Preauth specification
ticket
object
No
Ticket specification
ledger_hash
string
No
Ledger hash
ledger_index
string/number
No
Ledger index
Request Examples
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "ledger_entry",
"params": [{
"account_root": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
"ledger_index": "validated"
}],
"id": "getblock.io"
}'const axios = require('axios');
const url = 'https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/';
const headers = {
'x-api-key': 'YOUR-API-KEY',
'Content-Type': 'application/json'
};
const payload = {
jsonrpc: '2.0',
method: 'ledger_entry',
params: [{
account_root: 'rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH',
ledger_index: 'validated'
}],
id: 'getblock.io'
};
axios.post(url, payload, { headers })
.then(response => console.log(response.data))
.catch(error => console.error(error));Response Example
Response Parameters
index
string
Object identifier
node
object
Entry data
ledger_index
integer
Ledger index
Use Cases
Get specific entry
Check account state
Verify offers/escrows
Error Handling
entryNotFound
Entry not found
invalidParams
Invalid parameters
SDK Integration
Last updated
Was this helpful?