Add pagination support for query ledger API