@swapkit/wallet-keystore 1.1.4 → 1.2.0
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/dist/index.js +7 -7
- package/dist/index.js.map +3 -3
- package/package.json +8 -8
- package/src/keystore.ts +18 -9
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
|
-
"@swapkit/toolbox-cosmos": "1.0
|
|
6
|
-
"@swapkit/toolbox-evm": "1.
|
|
7
|
-
"@swapkit/toolbox-radix": "1.0.
|
|
8
|
-
"@swapkit/toolbox-solana": "1.0.
|
|
9
|
-
"@swapkit/toolbox-substrate": "1.
|
|
10
|
-
"@swapkit/toolbox-utxo": "1.1.
|
|
4
|
+
"@swapkit/helpers": "1.6.0",
|
|
5
|
+
"@swapkit/toolbox-cosmos": "1.1.0",
|
|
6
|
+
"@swapkit/toolbox-evm": "1.3.0",
|
|
7
|
+
"@swapkit/toolbox-radix": "1.0.22",
|
|
8
|
+
"@swapkit/toolbox-solana": "1.0.22",
|
|
9
|
+
"@swapkit/toolbox-substrate": "1.2.0",
|
|
10
|
+
"@swapkit/toolbox-utxo": "1.1.5",
|
|
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.
|
|
38
|
+
"version": "1.2.0"
|
|
39
39
|
}
|
package/src/keystore.ts
CHANGED
|
@@ -48,12 +48,13 @@ const getWalletMethodsForChain = async ({
|
|
|
48
48
|
stagenet,
|
|
49
49
|
}: Params) => {
|
|
50
50
|
switch (chain) {
|
|
51
|
-
case Chain.BinanceSmartChain:
|
|
52
51
|
case Chain.Arbitrum:
|
|
53
|
-
case Chain.Optimism:
|
|
54
|
-
case Chain.Polygon:
|
|
55
52
|
case Chain.Avalanche:
|
|
56
|
-
case Chain.
|
|
53
|
+
case Chain.Base:
|
|
54
|
+
case Chain.BinanceSmartChain:
|
|
55
|
+
case Chain.Ethereum:
|
|
56
|
+
case Chain.Optimism:
|
|
57
|
+
case Chain.Polygon: {
|
|
57
58
|
const { HDNodeWallet, getProvider, getToolboxByChain } = await import("@swapkit/toolbox-evm");
|
|
58
59
|
|
|
59
60
|
const keys = ensureEVMApiKeys({ chain, covalentApiKey, ethplorerApiKey });
|
|
@@ -125,8 +126,11 @@ const getWalletMethodsForChain = async ({
|
|
|
125
126
|
const { getToolboxByChain } = await import("@swapkit/toolbox-cosmos");
|
|
126
127
|
const toolbox = getToolboxByChain(chain)({ server: api, stagenet });
|
|
127
128
|
const address = await toolbox.getAddressFromMnemonic(phrase);
|
|
129
|
+
const signer = await toolbox.getSigner(phrase);
|
|
130
|
+
|
|
131
|
+
const transfer = (params: TransferParams) => toolbox.transfer({ ...params, signer });
|
|
128
132
|
|
|
129
|
-
return { address, walletMethods: toolbox };
|
|
133
|
+
return { address, walletMethods: { ...toolbox, transfer } };
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
case Chain.Maya:
|
|
@@ -211,10 +215,15 @@ function connectKeystore({
|
|
|
211
215
|
setRequestClientConfig({ apiKey: thorswapApiKey });
|
|
212
216
|
|
|
213
217
|
const promises = chains.map(async (chain) => {
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
+
const index = typeof derivationPathMapOrIndex === "number" ? derivationPathMapOrIndex : 0;
|
|
219
|
+
const derivationPathArray =
|
|
220
|
+
derivationPathMapOrIndex && typeof derivationPathMapOrIndex === "object"
|
|
221
|
+
? derivationPathMapOrIndex[chain]
|
|
222
|
+
: undefined;
|
|
223
|
+
|
|
224
|
+
const derivationPath = derivationPathArray
|
|
225
|
+
? derivationPathToString(derivationPathArray)
|
|
226
|
+
: `${DerivationPath[chain]}/${index}`;
|
|
218
227
|
|
|
219
228
|
const { address, walletMethods } = await getWalletMethodsForChain({
|
|
220
229
|
derivationPath,
|