From e381f811710c17bd620e5cd71bad483bb120a6a1 Mon Sep 17 00:00:00 2001 From: h3rt <94856309+SecretSaturn@users.noreply.github.com> Date: Sun, 1 May 2022 20:34:12 +0200 Subject: [PATCH] Add option for Secret Ledger App When the BIP44 cointype is 529 the compatible Secret Ledger app will be used instead of the Cosmos Ledger app which only supports the BIP44 118 cointype --- src/libs/utils.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libs/utils.js b/src/libs/utils.js index 1cad7347..a794cd50 100644 --- a/src/libs/utils.js +++ b/src/libs/utils.js @@ -232,7 +232,12 @@ export async function sign(device, chainId, signerAddress, messages, fee, memo, export async function getLedgerAddress(transport = 'blu', hdPath = "m/44'/118/0'/0/0") { const trans = transport === 'usb' ? await TransportWebUSB.create() : await TransportWebBLE.create() - const signer = new LedgerSigner(trans, { hdPaths: [stringToPath(hdPath)] }) + // extract Cointype from from HDPath + const coinType = Number(stringToPath(hdPath)[1]) + // Check if Cointype is 529 for Secret Ledger App and use Cosmos Ledger App instead + const ledgerName = (coinType === 529) ? 'Secret' : 'Cosmos' + + const signer = new LedgerSigner(trans, { hdPaths: [stringToPath(hdPath)], ledgerAppName: ledgerName }) return signer.getAccounts() }