Skip to main content
The 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.
The proxy itself is plain HTTPS. If you want to call it without the SDK, or from outside the browser, see the HTTP API.

Making a request

Parameters

Result

The 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.
Access tokens are short-lived. When a token has expired, a ledgerApi call throws providerErrors.unauthorized. Recover by calling connect again to refresh the session, then retry the request.

Proxy origin

The wallet names the proxy host in its connect response. The SDK checks that host before attaching the token: by default it allows the wallet origin, an https sibling subdomain (walley.cc to api.walley.cc), and loopback in development. Narrow it with allowedApiOrigins, either an origin list or a predicate. Pass a list if your wallet host sits on a multi-label public suffix such as example.co.uk, which the default reads as two labels.

Errors

When to use it