@swapkit/core 1.0.0-rc.1 → 1.0.0-rc.11
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 +2 -2
- package/dist/index.d.ts +6 -4
- package/dist/index.es.js +560 -490
- package/package.json +13 -13
- package/src/client/explorerUrls.ts +2 -0
- package/src/client/index.ts +6 -7
- package/src/client/types.ts +2 -0
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "swapkit-oss-team",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@swapkit/types": "1.0.0-rc.
|
|
5
|
-
"@swapkit/helpers": "1.0.0-rc.
|
|
4
|
+
"@swapkit/types": "1.0.0-rc.5",
|
|
5
|
+
"@swapkit/helpers": "1.0.0-rc.6"
|
|
6
6
|
},
|
|
7
7
|
"description": "SwapKit Lib core",
|
|
8
8
|
"devDependencies": {
|
|
@@ -13,18 +13,18 @@
|
|
|
13
13
|
"vite-plugin-wasm": "3.2.2",
|
|
14
14
|
"vitest": "0.34.4",
|
|
15
15
|
"@internal/config": "0.0.0-internal.0",
|
|
16
|
-
"@swapkit/api": "1.0.0-rc.
|
|
17
|
-
"@swapkit/tokens": "1.0.0-rc.
|
|
18
|
-
"@swapkit/toolbox-cosmos": "1.0.0-rc.
|
|
19
|
-
"@swapkit/toolbox-evm": "1.0.0-rc.
|
|
20
|
-
"@swapkit/toolbox-utxo": "1.0.0-rc.
|
|
16
|
+
"@swapkit/api": "1.0.0-rc.5",
|
|
17
|
+
"@swapkit/tokens": "1.0.0-rc.5",
|
|
18
|
+
"@swapkit/toolbox-cosmos": "1.0.0-rc.8",
|
|
19
|
+
"@swapkit/toolbox-evm": "1.0.0-rc.7",
|
|
20
|
+
"@swapkit/toolbox-utxo": "1.0.0-rc.7"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@swapkit/api": "1.0.0-rc.
|
|
24
|
-
"@swapkit/tokens": "1.0.0-rc.
|
|
25
|
-
"@swapkit/toolbox-cosmos": "1.0.0-rc.
|
|
26
|
-
"@swapkit/toolbox-evm": "1.0.0-rc.
|
|
27
|
-
"@swapkit/toolbox-utxo": "1.0.0-rc.
|
|
23
|
+
"@swapkit/api": "1.0.0-rc.5",
|
|
24
|
+
"@swapkit/tokens": "1.0.0-rc.5",
|
|
25
|
+
"@swapkit/toolbox-cosmos": "1.0.0-rc.8",
|
|
26
|
+
"@swapkit/toolbox-evm": "1.0.0-rc.7",
|
|
27
|
+
"@swapkit/toolbox-utxo": "1.0.0-rc.7"
|
|
28
28
|
},
|
|
29
29
|
"eslintConfig": {
|
|
30
30
|
"extends": "../../../internal/eslint-config"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"repository": "https://github.com/thorswap/SwapKit.git",
|
|
53
53
|
"type": "module",
|
|
54
54
|
"types": "./dist/index.d.ts",
|
|
55
|
-
"version": "1.0.0-rc.
|
|
55
|
+
"version": "1.0.0-rc.11",
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "NODE_OPTIONS=--max_old_space_size=16384 vite build",
|
|
58
58
|
"clean": "rm -rf dist vite.config.ts.* .turbo node_modules",
|
|
@@ -8,6 +8,7 @@ export const getExplorerTxUrl = ({ chain, txHash }: { txHash: string; chain: Cha
|
|
|
8
8
|
case Chain.Bitcoin:
|
|
9
9
|
case Chain.BitcoinCash:
|
|
10
10
|
case Chain.Maya:
|
|
11
|
+
case Chain.Kujira:
|
|
11
12
|
case Chain.THORChain:
|
|
12
13
|
return `${baseUrl}/tx/${txHash}`;
|
|
13
14
|
|
|
@@ -46,6 +47,7 @@ export const getExplorerAddressUrl = ({ chain, address }: { address: string; cha
|
|
|
46
47
|
case Chain.Maya:
|
|
47
48
|
case Chain.Optimism:
|
|
48
49
|
case Chain.Polygon:
|
|
50
|
+
case Chain.Kujira:
|
|
49
51
|
case Chain.THORChain:
|
|
50
52
|
return `${baseUrl}/address/${address}`;
|
|
51
53
|
|
package/src/client/index.ts
CHANGED
|
@@ -68,9 +68,8 @@ export class SwapKitCore<T = ''> {
|
|
|
68
68
|
getWallet = <T extends Chain>(chain: Chain) => this.connectedWallets[chain] as WalletMethods[T];
|
|
69
69
|
getExplorerAddressUrl = (chain: Chain, address: string) =>
|
|
70
70
|
getExplorerAddressUrl({ chain, address });
|
|
71
|
-
getBalance = async (chain: Chain,
|
|
72
|
-
|
|
73
|
-
const wallet = await this.getWalletByChain(chain);
|
|
71
|
+
getBalance = async (chain: Chain, potentialScamFilter?: boolean) => {
|
|
72
|
+
const wallet = await this.getWalletByChain(chain, potentialScamFilter);
|
|
74
73
|
|
|
75
74
|
return wallet?.balance || [];
|
|
76
75
|
};
|
|
@@ -170,11 +169,11 @@ export class SwapKitCore<T = ''> {
|
|
|
170
169
|
}
|
|
171
170
|
};
|
|
172
171
|
|
|
173
|
-
getWalletByChain = async (chain: Chain) => {
|
|
172
|
+
getWalletByChain = async (chain: Chain, potentialScamFilter?: boolean) => {
|
|
174
173
|
const address = this.getAddress(chain);
|
|
175
174
|
if (!address) return null;
|
|
176
175
|
|
|
177
|
-
const balance = (await this.getWallet(chain)?.getBalance(address)) ?? [
|
|
176
|
+
const balance = (await this.getWallet(chain)?.getBalance(address, potentialScamFilter)) ?? [
|
|
178
177
|
AssetValue.fromChainOrSignature(chain),
|
|
179
178
|
];
|
|
180
179
|
|
|
@@ -393,7 +392,7 @@ export class SwapKitCore<T = ''> {
|
|
|
393
392
|
assetValue: AssetValue;
|
|
394
393
|
percent: number;
|
|
395
394
|
from: 'sym' | 'rune' | 'asset';
|
|
396
|
-
to: 'sym' | 'rune';
|
|
395
|
+
to: 'sym' | 'rune' | 'asset';
|
|
397
396
|
}) => {
|
|
398
397
|
const targetAsset =
|
|
399
398
|
to === 'rune'
|
|
@@ -576,7 +575,7 @@ export class SwapKitCore<T = ''> {
|
|
|
576
575
|
connectTrezor = async (_chains: Chain, _derivationPath: number[]): Promise<void> => {
|
|
577
576
|
throw new SwapKitError('core_wallet_trezor_not_installed');
|
|
578
577
|
};
|
|
579
|
-
connectKeplr = async (): Promise<void> => {
|
|
578
|
+
connectKeplr = async (_chain: Chain): Promise<void> => {
|
|
580
579
|
throw new SwapKitError('core_wallet_keplr_not_installed');
|
|
581
580
|
};
|
|
582
581
|
connectOkx = async (_chains: Chain[]): Promise<void> => {
|
package/src/client/types.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
BinanceToolbox,
|
|
5
5
|
DepositParam,
|
|
6
6
|
GaiaToolbox,
|
|
7
|
+
KujiraToolbox,
|
|
7
8
|
ThorchainToolboxType,
|
|
8
9
|
} from '@swapkit/toolbox-cosmos';
|
|
9
10
|
import type {
|
|
@@ -86,6 +87,7 @@ export type WalletMethods = {
|
|
|
86
87
|
[Chain.Cosmos]: CosmosBasedWallet<typeof GaiaToolbox> | null;
|
|
87
88
|
[Chain.Dogecoin]: UTXOWallet<typeof DOGEToolbox> | null;
|
|
88
89
|
[Chain.Ethereum]: EVMWallet<typeof ETHToolbox> | null;
|
|
90
|
+
[Chain.Kujira]: CosmosBasedWallet<typeof KujiraToolbox> | null;
|
|
89
91
|
[Chain.Litecoin]: UTXOWallet<typeof LTCToolbox> | null;
|
|
90
92
|
[Chain.Maya]: ThorchainWallet | null;
|
|
91
93
|
[Chain.Optimism]: EVMWallet<typeof OPToolbox> | null;
|