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

Exchange handlers

The exchange handlers manage swap, sell, and fund operations through Ledger Wallet.

Request handlers

”exchange.start”: Start Exchange

Call this before exchange.complete to generate a nonce for the transaction. The returned transactionId is required by the completion step.

Parameter (in req.params)Required?Note
exchangeTypeâś…Type of exchange: "SWAP", "SELL", or "FUND"
Wallet handler used
exchange.start
  • Returns: A promise that resolves with an object containing the transactionId, which is used to complete the exchange process.

”exchange.complete”: Complete Exchange

Complete an exchange process (swap, sell, or fund) by passing the exchange content and its signature. The optional parameters toAccountId, swapId, and rate are required when exchangeType is "SWAP". The tokenCurrency parameter applies to "SWAP" and "FUND".

Parameter (in req.params)Required?Note
providerâś…A string used to verify the signature.
fromAccountIdâś…Identifier of the account used as a source for the transaction.
rawTransactionâś…A RawTransaction object containing the transaction details.
hexBinaryPayloadâś…Hexadecimal string representing the blueprint of the data that will be allowed for signing.
hexSignatureâś…Hexadecimal string ensuring the source of the payload.
feeStrategyâś…A string representing the fee strategy: "SLOW", "MEDIUM", or "FAST".
exchangeTypeâś…A string specifying the type of exchange operation: "SWAP", "SELL", or "FUND".
toAccountId❌Identifier of the account used as a destination (required for "SWAP").
swapId❌Identifier of the backend swap used (required for "SWAP").
rate❌Swap rate used in the transaction (required for "SWAP").
tokenCurrency❌Used when pointing to a token whose ID does not exist in the Wallet API (optional for "SWAP" and "FUND").
Wallet handler used
exchange.complete
  • Returns: A promise that resolves with an object containing the transactionHash of the broadcasted transaction.
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.