ledgerApi method lets your dApp read ledger state on behalf of the connected user. It forwards a Canton JSON Ledger API request through Walley’s authenticated, read-only proxy and returns the upstream response. This implements the CIP-0103 ledgerApi provider method.
Unlike prepareExecute, ledgerApi does not open a popup and does not submit transactions — it’s a read path that runs against the user’s existing session token.
Making a request
Parameters
Result
response is the raw upstream body as a string. Parse it with JSON.parse for JSON endpoints.
Example with a body
Authentication & tokens
The proxy authenticates with the short-lived access token issued when the user connected. You don’t manage the token directly — the SDK attaches it automatically — but you do need to handle expiry.Errors
When to use it
- Use
ledgerApito read contracts and ledger state — no popup, no fee. - Use
prepareExecute/prepareExecuteAndWaitto write — these require user approval in a popup.