Skip to Content
📢 Breaking change: Applications using LedgerJS for transport implementation should migrate to the Device Management Kit (DMK). Learn more.

Currency handlers

The currency handlers let a Live App list the cryptocurrencies and tokens that the connected wallet supports. The Wallet API server forwards each request to the wallet, which decides what to return.

Method IDs

Method IDDirectionWallet handler required?Purpose
currency.listLive App → WalletyesList the currencies that the wallet supports, optionally filtered by ID.

The Live App must declare currency.list in the permissions of its manifest. The server rejects calls to methods that are not in the permission list.

currency.list

Returns the currencies that the wallet handler provides.

Parameters

The params object is optional.

ParameterTypeRequiredNotes
currencyIdsstring[]noCurrency IDs to filter on. The server passes this value to the wallet handler without changing it.

Behavior

The server validates params, then calls the wallet handler currency.list with { currencyIds }. The server does not filter the result itself. The wallet handler applies currencyIds and returns the Currency objects.

Result

{ currencies: Currency[] }

A Currency has one of two shapes, selected by the type field.

CryptoCurrency

FieldTypeRequiredNotes
type"CryptoCurrency"yesDiscriminator.
idstringyesCurrency ID, for example bitcoin.
namestringyesDisplay name.
tickerstringyesTicker symbol.
colorstringyesBrand color, for example #ffae35.
decimalsnumberyesNumber of decimals of the currency unit.
familystringyesCoin family, for example bitcoin or ethereum.
categoriesstring[]noCategories assigned to the currency.

TokenCurrency (ERC20)

FieldTypeRequiredNotes
type"TokenCurrency"yesDiscriminator.
idstringyesToken ID.
namestringyesDisplay name.
tickerstringyesTicker symbol.
colorstringyesBrand color.
decimalsnumberyesNumber of decimals of the token unit.
parentstringyesID of the parent currency.
standard"ERC20"yesToken standard. ERC20 is the only value.
contractstringyesContract address of the token.
categoriesstring[]noCategories assigned to the currency.

Errors

The server wraps each error in an RpcError.

ConditionError
currencyIds is not an array of stringsRpcError with code INVALID_PARAMS (-32602).
The method is not in the Live App permissionsRpcError with code SERVER_ERROR (-32000). data.code is PERMISSION_DENIED.
The wallet does not register a currency.list handlerRpcError with code SERVER_ERROR (-32000). data.code is NOT_IMPLEMENTED_BY_WALLET.

Example

Register the wallet handler on the server. This example comes from the standard profile of the Simulator:

server.setHandler("currency.list", ({ currencyIds }) => { if (currencyIds && currencyIds.length > 0) { return currencies.filter((currency) => currencyIds.includes(currency.id)); } return currencies; });

See also

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.