Ledger Wallets
The kit also allows using Ledger wallets to both ask for the address and sign a transaction. The LedgerModule
is not included by default and you need to manually import it like this:
import { LedgerModule } from '@creit.tech/stellar-wallets-kit/modules/ledger.module';
const kit = new StellarWalletsKit({
selectedWalletId: XBULL_ID,
network: WalletNetwork.PUBLIC,
modules: [
new xBullModule(),
new FreighterModule(),
new AlbedoModule(),
new LedgerModule(),
],
});
IMPORTANT: The ledger native library requires that you have the object "Buffer" globally available, this object needs to replicate the nature of the native NodeJs module
After you've done this, you will be able to continue executing other functions normally.
Mnemonic paths
The ledger library works by specifying the path to use when signing or getting the address from your device, for that reason all the kit's methods include the optional path
value which you can specify to let the device know which one to use.
But, we know this might not be the easiest way if you are also handling all other kind of wallets so for that reason the kit also includes a logic that takes care of that so you only need to make sure to call the getAddress
method before you request signing the transaction and so the kit will let the Ledger device know which path is the correct path for the account the user selected.