-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #530 from fmorency/fix-ledger
fix: ledger wallet
- Loading branch information
Showing
8 changed files
with
94 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from './constant'; | ||
export * from './ledger'; | ||
export * from './web-usb-hid/registry'; | ||
export * from './constant'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { ChainRecord, ChainWalletBase, Wallet } from '@cosmos-kit/core'; | ||
|
||
export class LedgerChianWallet extends ChainWalletBase { | ||
export class LedgerChainWallet extends ChainWalletBase { | ||
constructor(walletInfo: Wallet, chainInfo: ChainRecord) { | ||
super(walletInfo, chainInfo); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import { chains } from 'chain-registry' | ||
import Cosmos from "@ledgerhq/hw-app-cosmos"; | ||
import Cosmos from '@ledgerhq/hw-app-cosmos'; | ||
import TransportWebHID from '@ledgerhq/hw-transport-webhid'; | ||
import TransportWebUSB from '@ledgerhq/hw-transport-webusb'; | ||
import TransportWebHID from '@ledgerhq/hw-transport-webhid' | ||
import { chains } from 'chain-registry'; | ||
|
||
export type TransportType = 'WebUSB' | 'WebHID' | ||
export type TransportType = 'WebUSB' | 'WebHID'; | ||
|
||
export async function getCosmosApp(type: TransportType = 'WebUSB') { | ||
if (type === 'WebUSB') { | ||
return new Cosmos(await TransportWebUSB.create()) | ||
return new Cosmos(await TransportWebUSB.create()); | ||
} | ||
if (type === 'WebHID') { | ||
return new Cosmos(await TransportWebHID.create()) | ||
return new Cosmos(await TransportWebHID.create()); | ||
} | ||
throw new Error(`Unknown transport type: ${type}`) | ||
throw new Error(`Unknown transport type: ${type}`); | ||
} | ||
|
||
export function getCosmosPath(accountIndex = 0) { | ||
return `44'/118'/${accountIndex}'/0/0` | ||
return `44'/118'/${accountIndex}'/0/0`; | ||
} | ||
|
||
export const ChainIdToBech32Prefix = {} as { [k: string]: string } | ||
export const ChainIdToBech32Prefix = {} as { [k: string]: string }; | ||
for (const chain of chains) { | ||
ChainIdToBech32Prefix[chain.chain_id] = chain.bech32_prefix | ||
} | ||
ChainIdToBech32Prefix[chain.chain_id] = chain.bech32_prefix; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters