☞   The renaming of “Ledger Live” to “Ledger Wallet” is still in progress in the repos.
     This page may contain references to “Ledger Live” that will be updated soon.

Provider’s LiveApp

As explained in the Swap Integration page, you need to modify your LiveApp with some particularities compared to the one that can be found in the Discover section.

Your LiveApp must:

  • Use the Ledger Exchange Services Kit, in addition to the Wallet API.
  • Respond to specific LiveApp URLs in order to adapt to the flow inside Ledger Wallet.
  • Have a modified, slightly more complex, Manifest file.
  • Follow specifics flow/ux requirements.

Ledger Exchange Services Kit

To learn how to create (or embed if already existing) your user interface for the swap, please follow the Discover documentation.

Your LiveApp will interact with Ledger Wallet, through the ExchangeSDK, with the corresponding method.

You will need to set up the SDK with your providerId attributed upon request by Ledger.

const exchangeSDK = new ExchangeSDK("yourProviderId");

SWAP Method

This method will need you to provide the following parameters:

exchangeSDK.swap({
  quoteId: "1234",
  fromAccountId: "07AB5930-C73A-433F-A2FA-920640AF3A02",
  toAccountId: "76A239EB-1C2A-4237-B942-CA87472106EB",
  fromAmount: "12.3",
  feeStrategy: "SLOW",
  rate: 0.7555,
});

LiveApp URL

The LiveApp needs to respond to an URL with some parameters. LiveApp URLs are used to open your LiveApp with the quote values that the user already entered in Ledger Wallet.

The LiveApp URL format is already fixed and will depend on the information you provided inside your LiveApp manifest (ex: ledgerlive://discover/swapprovidername).

  • quoteId: The id retrieved by Ledger’s backend during a quote request.
  • fromAmount: The amount of currency.
  • fromAccountId: The user’s account id in Ledger Wallet repository.
  • toAccountId: The user’s account id in Ledger Wallet repository.
  • rate: the rate differences in the pair.
  • feeStrategy: SLOW, MEDIUM, FAST or CUSTOM.
  • initFeeTotalValue: initial transaction total fee.
  • customFeeConfig(optional, required for CUSTOM feeStrategy): Custom fee configuration in case the strategy is of type CUSTOM. The key-value object is encoded in URI parameter.
  • ledger-transaction-id: id used by ledger to track transactions and their completion statuses.
  • fiatCurrencyId: The fiat currency id used as reference for the quote.
  • theme: The theme used in Ledger Wallet.
  • displayLanguage: The language used in Ledger Wallet.

Example:

ledgerlive://discover/swapprovidername?quoteId=1234&fromAmount=0.09&fromAccountId=82f48c06-6170-536e-a21b-56b30b02b58d&toAccountId=c0c4493e-fc4b-50b6-b1a0-566f1a751521&rate=79.09405555555555555556&feeStrategy=CUSTOM&initFeeTotalValue=878198522989412&customFeeConfig=%7B%22maxFeePerGas%22%3A%2212000000000%22%2C%22maxPriorityFeePerGas%22%3A%221000000000%22%2C%22userGasLimit%22%3Anull%2C%22gasLimit%22%3A%2221000%22%7D
👉

Ledger needs to know how to send referral information through the widget.

Manifest Permission

Your LiveApp manifest should contains at least those permissions request:

"permissions": [
  "account.list",
  "currency.list",
  "custom.exchange.start",
  "custom.exchange.complete",
  "custom.exchange.error",
]

Flow/UX requirements

Please refer to the Flow Breakdown section for more information.

Ledger
Copyright © Ledger SAS. All rights reserved. Ledger, Ledger Stax, Ledger Nano S, Ledger Vault, Bolos are trademarks owned by Ledger SAS