@swapkit/wallet-keystore 1.2.27 → 1.2.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "dependencies": {
3
3
  "@scure/bip39": "1.3.0",
4
- "@swapkit/helpers": "1.13.2",
5
- "@swapkit/toolbox-cosmos": "1.3.16",
6
- "@swapkit/toolbox-evm": "1.5.7",
7
- "@swapkit/toolbox-radix": "1.2.11",
8
- "@swapkit/toolbox-solana": "1.1.15",
9
- "@swapkit/toolbox-substrate": "1.2.19",
10
- "@swapkit/toolbox-utxo": "1.1.24",
4
+ "@swapkit/helpers": "1.13.3",
5
+ "@swapkit/toolbox-cosmos": "1.4.0",
6
+ "@swapkit/toolbox-evm": "1.5.8",
7
+ "@swapkit/toolbox-radix": "1.2.12",
8
+ "@swapkit/toolbox-solana": "1.1.16",
9
+ "@swapkit/toolbox-substrate": "1.2.20",
10
+ "@swapkit/toolbox-utxo": "1.1.25",
11
11
  "blakejs": "1.2.1",
12
12
  "micro-key-producer": "0.7.0"
13
13
  },
@@ -34,5 +34,5 @@
34
34
  },
35
35
  "type": "module",
36
36
  "types": "./src/index.ts",
37
- "version": "1.2.27"
37
+ "version": "1.2.29"
38
38
  }
package/src/keystore.ts CHANGED
@@ -2,8 +2,8 @@ import {
2
2
  type AssetValue,
3
3
  Chain,
4
4
  type ConnectWalletParams,
5
- DerivationPath,
6
5
  type DerivationPathArray,
6
+ NetworkDerivationPath,
7
7
  RPCUrl,
8
8
  type WalletChain,
9
9
  WalletOption,
@@ -12,6 +12,7 @@ import {
12
12
  derivationPathToString,
13
13
  ensureEVMApiKeys,
14
14
  setRequestClientConfig,
15
+ updatedLastIndex,
15
16
  } from "@swapkit/helpers";
16
17
  import type { DepositParam, TransferParams } from "@swapkit/toolbox-cosmos";
17
18
  import type {
@@ -206,15 +207,26 @@ function connectKeystore({
206
207
  setRequestClientConfig({ apiKey: thorswapApiKey });
207
208
 
208
209
  const promises = chains.map(async (chain) => {
209
- const index = typeof derivationPathMapOrIndex === "number" ? derivationPathMapOrIndex : 0;
210
- const derivationPathArray =
210
+ const derivationPathIndex =
211
+ typeof derivationPathMapOrIndex === "number" ? derivationPathMapOrIndex : 0;
212
+
213
+ const derivationPathFromMap =
211
214
  derivationPathMapOrIndex && typeof derivationPathMapOrIndex === "object"
212
215
  ? derivationPathMapOrIndex[chain]
213
216
  : undefined;
214
217
 
215
- const derivationPath = derivationPathArray
216
- ? derivationPathToString(derivationPathArray)
217
- : `${DerivationPath[chain]}/${index}`;
218
+ const [first, second, third, fourth, fifth] = NetworkDerivationPath[chain];
219
+
220
+ const derivationPathArray: DerivationPathArray =
221
+ derivationPathFromMap ||
222
+ updatedLastIndex(
223
+ chain === Chain.Solana
224
+ ? [first, second, third, fourth]
225
+ : [first, second, third, fourth, fifth],
226
+ derivationPathIndex,
227
+ );
228
+
229
+ const derivationPath = derivationPathToString(derivationPathArray);
218
230
 
219
231
  const { address, walletMethods } = await getWalletMethodsForChain({
220
232
  derivationPath,