File tree Expand file tree Collapse file tree 2 files changed +21
-14
lines changed
src/modules/select/wallets Expand file tree Collapse file tree 2 files changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -138,17 +138,20 @@ async function ledgerProvider(options: {
138
138
}
139
139
140
140
async function setPath ( path : string , custom ?: boolean ) {
141
- if ( custom ) {
142
- if ( ! isValidPath ( path ) ) {
143
- return false
144
- }
145
-
146
- const address = await getAddress ( path )
141
+ if ( ! isValidPath ( path ) ) {
142
+ return false
143
+ }
147
144
148
- // over-ride any exsting addresses for the case of accountSelect being called
145
+ if ( path !== dPath ) {
146
+ // clear any exsting addresses if different path
149
147
addressToPath = new Map ( )
148
+ }
149
+
150
+ if ( custom ) {
151
+ const address = await getAddress ( path )
150
152
addressToPath . set ( address , path )
151
153
customPath = true
154
+
152
155
return true
153
156
}
154
157
Original file line number Diff line number Diff line change @@ -137,18 +137,22 @@ async function trezorProvider(options: {
137
137
}
138
138
139
139
async function setPath ( path : string , custom ?: boolean ) {
140
- if ( custom ) {
141
- if ( ! isValidPath ( path ) ) {
142
- return false
143
- }
140
+ if ( ! isValidPath ( path ) ) {
141
+ return false
142
+ }
144
143
144
+ if ( path !== dPath ) {
145
+ // clear any exsting addresses if different path
146
+ addressToPath = new Map ( )
147
+ }
148
+
149
+ if ( custom ) {
145
150
try {
146
151
const address = await getAddress ( path )
147
-
148
- // over-ride any exsting addresses for the case of accountSelect being called
149
- addressToPath = new Map ( )
150
152
addressToPath . set ( address , path )
153
+ dPath = path
151
154
customPath = true
155
+
152
156
return true
153
157
} catch ( error ) {
154
158
throw new Error (
You can’t perform that action at this time.
0 commit comments