Skip to content

Commit 5a2e5f4

Browse files
committed
Add default path
1 parent 9e99f94 commit 5a2e5f4

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/modules/select/wallets/ledger.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ async function ledgerProvider(options: {
130130
}
131131

132132
const address = await getAddress(path)
133+
134+
// over-ride any exsting addresses for the case of accountSelect being called
135+
addressToPath = new Map()
133136
addressToPath.set(address, path)
134137
customPath = true
135138
return true
@@ -212,6 +215,10 @@ async function ledgerProvider(options: {
212215
return addresses()
213216
}
214217

218+
if (dPath === '') {
219+
dPath = LEDGER_LIVE_PATH
220+
}
221+
215222
if (dPath === LEDGER_LIVE_PATH) {
216223
const currentAccounts = addressToPath.size
217224
const paths = []

src/modules/select/wallets/trezor.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import * as EthereumTx from 'ethereumjs-tx'
1414

1515
const { default: TrezorConnect, DEVICE_EVENT, DEVICE } = TrezorConnectLibrary
1616

17+
const TREZOR_DEFAULT_PATH = "m/44'/60'/0'/0"
18+
1719
function trezor(options: TrezorOptions & CommonWalletOptions): WalletModule {
1820
const {
1921
rpcUrl,
@@ -142,6 +144,9 @@ async function trezorProvider(options: {
142144

143145
try {
144146
const address = await getAddress(path)
147+
148+
// over-ride any exsting addresses for the case of accountSelect being called
149+
addressToPath = new Map()
145150
addressToPath.set(address, path)
146151
customPath = true
147152
return true
@@ -247,6 +252,10 @@ async function trezorProvider(options: {
247252
return addresses()
248253
}
249254

255+
if (dPath === '') {
256+
dPath = TREZOR_DEFAULT_PATH
257+
}
258+
250259
if (!account) {
251260
try {
252261
account = await getPublicKey()

0 commit comments

Comments
 (0)