Merge pull request #120 from SecretSaturn/master

Add option for Secret Ledger App
This commit is contained in:
ping 2022-05-03 09:58:01 +08:00 committed by GitHub
commit 455f69bbc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()
}