Wallet API Server
The Wallet API Server is a bi-directional JSON‑RPC 2.0 server that bridges a dApp (or service) with a Wallet (e.g., Ledger Wallet) over a trusted channel. It provides a structured way to exchange requests/responses and notifications while enforcing capability-based permissions.
Why use a server?
- Separation of concerns: your application logic stays in your process; the Wallet handles sensitive operations (accounts, signatures, device flows).
- Trust and permissions: the server formalizes capability requests and enforces what the dApp is allowed to do.
- Transport-agnostic RPC: JSON‑RPC 2.0 allows clear contracts and consistent error handling across transports (e.g., window.postMessage, WebSocket).
When to use it?
- You need a secure, permissioned bridge to a wallet (Ledger Wallet) from a dApp or integration.
- You want a consistent RPC contract across environments and transports.
- You prefer capability-based access over ad‑hoc messaging.
Where to start?
- Visual introduction
- API reference
- Constructor overview
- React hook (optional, useful if using react)
- Example using constructor
- Example within Ledger Wallet
External resources
- Source code: https://github.com/LedgerHQ/wallet-api/tree/main/packages/server
- Main file: https://github.com/LedgerHQ/wallet-api/blob/main/packages/server/src/WalletAPIServer.ts
- Wallet API README: https://github.com/LedgerHQ/wallet-api/blob/main/README.md
- Spec: https://github.com/LedgerHQ/wallet-api/blob/main/spec/server/README.md
- Package: @ledgerhq/wallet-api-server