Closed prodevcn closed 3 years ago
Your request is formatted correctly, but the server you're asking doesn't have ledger 60897667.
Unlike many other blockchains, servers in the XRP Ledger don't need to have full history to keep up with current events, so by default a server only stores a chunk of recent ledgers (blocks), starting from when it came online. If you want to get data from an older ledger version, you need to either query another server that has that data, or configure your server to store data that far back. You can read more about ledger history for details.
Both xrpl.ws
and s2.ripple.com
provide full history, so you can get the data by asking one of those instead of whatever RPC URL you're using.
If you want to see what ledger versions your server has available, you can get that from the server_info's complete_ledgers
field. For example:
const RippleAPI = require('ripple-lib').RippleAPI;
const api = new RippleAPI({
server: conf.rpc_url
});
async function main() {
r = await api.request("server_info");
console.log("Complete ledgers:", r.info.complete_ledgers);
}
api.connect().then(main).catch( err => { console.error(err); });
I need to get ledger from specific ledger version with ripple-lib API. I did like follows :
But, response is like :
How can I fix it ? Especially, where can I refer to use ripple-lib API with optional parameters I can't find them any where. The official guide provides only simple e.g