Skip to Content
We're improving our docs. Share your experience and help shape what comes next.
DocumentationLedger WalletDiscoverIntegration walkthroughsWallet APICoreModulesUsing the Wallet Module in Wallet API Core Client

Using the Wallet Module in Wallet API Core Client

☞ The renaming of “Ledger Live” to “Ledger Wallet” and “wallet” (in the hardware sense) to “signer” is still in progress. This page may contain legacy references that will be updated.

The Wallet Module allows you to interact with the user’s wallet. This includes retrieving the user’s ID, fetching wallet information, and listing the capabilities of the wallet.

Wallet Module Overview

Access the Wallet module via walletApiClient.wallet.

Methods:

1. Get User ID

Retrieve the user ID of the connected wallet.

walletApiClient.wallet.userId(): Promise<string>
  • Returns: A promise that resolves with the user ID as a string.

Required permission: wallet.userId

Example:
async function getUserId(walletApiClient) { try { const userId = await walletApiClient.wallet.userId(); console.log("User ID:", userId); } catch (error) { console.error("Error retrieving user ID:", error); } }

2. Get Wallet Info

Retrieve information about the connected wallet.

walletApiClient.wallet.info(): Promise<WalletInfo["result"]>

Returns: A promise that resolves with an object containing information about the connected wallet.

Required permission: wallet.info

Example:
async function getWalletInfo(walletApiClient) { try { const walletInfo = await walletApiClient.wallet.info(); console.log("Wallet Info:", walletInfo); } catch (error) { console.error("Error retrieving wallet info:", error); } }

3. List Wallet Capabilities

List the method IDs that are implemented by the wallet.

walletApiClient.wallet.capabilities(): Promise<string[]>
  • Returns: A promise that resolves with an array of strings representing the method IDs.

Required permission: wallet.capabilities

Example:
async function listWalletCapabilities(walletApiClient) { try { const capabilities = await walletApiClient.wallet.capabilities(); console.log("Wallet Capabilities:", capabilities); } catch (error) { console.error("Error listing wallet capabilities:", error); } }

Handling Errors

Make sure to handle errors gracefully and provide appropriate feedback to the user. Additionally, always remember to disconnect the WindowMessageTransport when you’re done interacting with the Ledger Wallet API to free up resources.

Last updated on
Ledger
Copyright © Ledger SAS. All rights reserved. Ledger, Ledger Stax, Ledger Flex, Ledger Nano, Ledger Nano S, Ledger OS, Ledger Wallet, [LEDGER] (logo), [L] (logo) are trademarks owned by Ledger SAS.