Use a signer
As ledger devices are able to install applications that will allow to be compatible with different blockchains, we have created these kits.
Each signer kit is coming along with a Ledger Embedded App (ex: signer-kit-eth is coming with ledger app ethereum ).
The main goal of each signer is to ease interaction with the app in the most seamless way possible.
Note: We will show the usage of the signer with the Ethereum signer. The same logic can be applied to the other signers.
Installation
Note: This module is not standalone; it depends on the @ledgerhq/device-management-kit package, so you need to install it first.
To install the device-signer-kit-ethereum
package, run the following command:
npm install @ledgerhq/device-signer-kit-ethereum
Usage
To initialize an Ethereum signer instance, you need a Ledger Device Management Kit instance and the ID of the session of the connected device. Use the SignerEthBuilder
along with the Context Module by default developed by Ledger:
// Initialize an Ethereum signer instance using default context module
const signerEth = new SignerEthBuilder({ dmk, sessionId }).build();
You can also configure the context module yourself:
// Initialize an Ethereum signer instance using customized context module
const signerEth = new SignerEthBuilder({ dmk, sessionId })
.withContextModule(customContextModule)
.build();