@swapkit/wallet-keystore 1.0.0-rc.13 → 1.0.0-rc.15
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.cjs +6 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +324 -326
- package/package.json +10 -10
- package/src/keystore.ts +6 -7
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"crypto-js": "4.2.0",
|
|
5
5
|
"blakejs": "1.2.1",
|
|
6
6
|
"uuid": "9.0.0",
|
|
7
|
-
"@swapkit/types": "1.0.0-rc.
|
|
7
|
+
"@swapkit/types": "1.0.0-rc.6"
|
|
8
8
|
},
|
|
9
9
|
"description": "SwapKit Lib keystore",
|
|
10
10
|
"devDependencies": {
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"vite": "4.4.9",
|
|
20
20
|
"vitest": "0.34.4",
|
|
21
21
|
"@internal/config": "0.0.0-internal.0",
|
|
22
|
-
"@swapkit/helpers": "1.0.0-rc.
|
|
23
|
-
"@swapkit/toolbox-cosmos": "1.0.0-rc.
|
|
24
|
-
"@swapkit/toolbox-evm": "1.0.0-rc.
|
|
25
|
-
"@swapkit/toolbox-utxo": "1.0.0-rc.
|
|
22
|
+
"@swapkit/helpers": "1.0.0-rc.9",
|
|
23
|
+
"@swapkit/toolbox-cosmos": "1.0.0-rc.11",
|
|
24
|
+
"@swapkit/toolbox-evm": "1.0.0-rc.10",
|
|
25
|
+
"@swapkit/toolbox-utxo": "1.0.0-rc.10"
|
|
26
26
|
},
|
|
27
27
|
"eslintConfig": {
|
|
28
28
|
"extends": "../../../internal/eslint-config"
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"@scure/bip39": "1.2.1",
|
|
48
48
|
"ethers": "^6.7.1",
|
|
49
49
|
"bitcoinjs-lib": "^5.2.0",
|
|
50
|
-
"@swapkit/helpers": "1.0.0-rc.
|
|
51
|
-
"@swapkit/toolbox-cosmos": "1.0.0-rc.
|
|
52
|
-
"@swapkit/toolbox-evm": "1.0.0-rc.
|
|
53
|
-
"@swapkit/toolbox-utxo": "1.0.0-rc.
|
|
50
|
+
"@swapkit/helpers": "1.0.0-rc.9",
|
|
51
|
+
"@swapkit/toolbox-cosmos": "1.0.0-rc.11",
|
|
52
|
+
"@swapkit/toolbox-evm": "1.0.0-rc.10",
|
|
53
|
+
"@swapkit/toolbox-utxo": "1.0.0-rc.10"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"repository": "https://github.com/thorswap/SwapKit.git",
|
|
60
60
|
"type": "module",
|
|
61
61
|
"types": "./dist/index.d.ts",
|
|
62
|
-
"version": "1.0.0-rc.
|
|
62
|
+
"version": "1.0.0-rc.15",
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "vite build",
|
|
65
65
|
"clean": "rm -rf dist vite.config.ts.* .turbo node_modules",
|
package/src/keystore.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { Psbt } from 'bitcoinjs-lib';
|
|
|
10
10
|
|
|
11
11
|
type KeystoreOptions = {
|
|
12
12
|
ethplorerApiKey?: string;
|
|
13
|
-
|
|
13
|
+
blockchairApiKey?: string;
|
|
14
14
|
covalentApiKey?: string;
|
|
15
15
|
stagenet?: boolean;
|
|
16
16
|
};
|
|
@@ -30,7 +30,7 @@ const getWalletMethodsForChain = async ({
|
|
|
30
30
|
phrase,
|
|
31
31
|
ethplorerApiKey,
|
|
32
32
|
covalentApiKey,
|
|
33
|
-
|
|
33
|
+
blockchairApiKey,
|
|
34
34
|
index,
|
|
35
35
|
stagenet,
|
|
36
36
|
}: Params) => {
|
|
@@ -72,9 +72,8 @@ const getWalletMethodsForChain = async ({
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
case Chain.BitcoinCash: {
|
|
75
|
-
if (!utxoApiKey) throw new Error('UTXO API key not found');
|
|
76
75
|
const { BCHToolbox } = await import('@swapkit/toolbox-utxo');
|
|
77
|
-
const toolbox = BCHToolbox({ rpcUrl, apiKey:
|
|
76
|
+
const toolbox = BCHToolbox({ rpcUrl, apiKey: blockchairApiKey, apiClient: api });
|
|
78
77
|
const keys = await toolbox.createKeysForPath({ phrase, derivationPath });
|
|
79
78
|
const address = toolbox.getAddressFromKeys(keys);
|
|
80
79
|
|
|
@@ -106,7 +105,7 @@ const getWalletMethodsForChain = async ({
|
|
|
106
105
|
case Chain.Bitcoin:
|
|
107
106
|
case Chain.Dogecoin:
|
|
108
107
|
case Chain.Litecoin: {
|
|
109
|
-
const params = { rpcUrl, apiKey:
|
|
108
|
+
const params = { rpcUrl, apiKey: blockchairApiKey, apiClient: api };
|
|
110
109
|
|
|
111
110
|
const { BTCToolbox, LTCToolbox, DOGEToolbox } = await import('@swapkit/toolbox-utxo');
|
|
112
111
|
|
|
@@ -236,7 +235,7 @@ const connectKeystore =
|
|
|
236
235
|
addChain,
|
|
237
236
|
apis,
|
|
238
237
|
rpcUrls,
|
|
239
|
-
config: { covalentApiKey, ethplorerApiKey, utxoApiKey, stagenet },
|
|
238
|
+
config: { covalentApiKey, ethplorerApiKey, blockchairApiKey, utxoApiKey, stagenet },
|
|
240
239
|
}: ConnectWalletParams) =>
|
|
241
240
|
async (chains: Chain[], phrase: string, index: number = 0) => {
|
|
242
241
|
const promises = chains.map(async (chain) => {
|
|
@@ -248,7 +247,7 @@ const connectKeystore =
|
|
|
248
247
|
covalentApiKey,
|
|
249
248
|
ethplorerApiKey,
|
|
250
249
|
phrase,
|
|
251
|
-
utxoApiKey,
|
|
250
|
+
blockchairApiKey: blockchairApiKey || utxoApiKey,
|
|
252
251
|
stagenet,
|
|
253
252
|
});
|
|
254
253
|
|