overview
The Exchange handlers facilitates various exchange operations such as starting the exchange process, completing swap, sell, and fund transactions using Ledger Live.
request handlers:
“exchange.start” - Start Exchange
Start the exchange process by generating a nonce on Ledger device. This method is typically called before completing the exchange process.
parameter (in req.params) | required? | note |
---|---|---|
exchangeType | ✅ | Type of exchange, “SWAP”, “SELL” or “FUND” |
walletHandler used | note |
---|---|
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.
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 | ❌ | Swap tokenCurrency is used when we want point a new token, as id does not exists in wallet-api (optional for "SWAP" and "FUND" ). |
walletHandler used | note |
---|---|
exchange.complete |
- Returns: A promise that resolves with an object containing the
transactionHash
of the broadcasted transaction.