@swapkit/wallet-keystore 1.1.4 → 1.1.5

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.5.0",
5
- "@swapkit/toolbox-cosmos": "1.0.22",
6
- "@swapkit/toolbox-evm": "1.2.3",
7
- "@swapkit/toolbox-radix": "1.0.20",
8
- "@swapkit/toolbox-solana": "1.0.20",
9
- "@swapkit/toolbox-substrate": "1.1.15",
10
- "@swapkit/toolbox-utxo": "1.1.3",
4
+ "@swapkit/helpers": "1.5.1",
5
+ "@swapkit/toolbox-cosmos": "1.0.23",
6
+ "@swapkit/toolbox-evm": "1.2.4",
7
+ "@swapkit/toolbox-radix": "1.0.21",
8
+ "@swapkit/toolbox-solana": "1.0.21",
9
+ "@swapkit/toolbox-substrate": "1.1.16",
10
+ "@swapkit/toolbox-utxo": "1.1.4",
11
11
  "blakejs": "1.2.1",
12
12
  "micro-key-producer": "0.7.0"
13
13
  },
@@ -35,5 +35,5 @@
35
35
  },
36
36
  "type": "module",
37
37
  "types": "./src/index.ts",
38
- "version": "1.1.4"
38
+ "version": "1.1.5"
39
39
  }
package/src/keystore.ts CHANGED
@@ -125,8 +125,11 @@ const getWalletMethodsForChain = async ({
125
125
  const { getToolboxByChain } = await import("@swapkit/toolbox-cosmos");
126
126
  const toolbox = getToolboxByChain(chain)({ server: api, stagenet });
127
127
  const address = await toolbox.getAddressFromMnemonic(phrase);
128
+ const signer = await toolbox.getSigner(phrase);
129
+
130
+ const transfer = (params: TransferParams) => toolbox.transfer({ ...params, signer });
128
131
 
129
- return { address, walletMethods: toolbox };
132
+ return { address, walletMethods: { ...toolbox, transfer } };
130
133
  }
131
134
 
132
135
  case Chain.Maya:
@@ -211,10 +214,15 @@ function connectKeystore({
211
214
  setRequestClientConfig({ apiKey: thorswapApiKey });
212
215
 
213
216
  const promises = chains.map(async (chain) => {
214
- const derivationPath =
215
- typeof derivationPathMapOrIndex === "object" && derivationPathMapOrIndex[chain]
216
- ? derivationPathToString(derivationPathMapOrIndex[chain])
217
- : `${DerivationPath[chain]}/${derivationPathMapOrIndex || 0}`;
217
+ const index = typeof derivationPathMapOrIndex === "number" ? derivationPathMapOrIndex : 0;
218
+ const derivationPathArray =
219
+ derivationPathMapOrIndex && typeof derivationPathMapOrIndex === "object"
220
+ ? derivationPathMapOrIndex[chain]
221
+ : undefined;
222
+
223
+ const derivationPath = derivationPathArray
224
+ ? derivationPathToString(derivationPathArray)
225
+ : `${DerivationPath[chain]}/${index}`;
218
226
 
219
227
  const { address, walletMethods } = await getWalletMethodsForChain({
220
228
  derivationPath,