@atomiqlabs/sdk 6.0.2 → 6.0.3
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/LICENSE +201 -201
- package/README.md +1094 -1074
- package/dist/SmartChainAssets.d.ts +93 -93
- package/dist/SmartChainAssets.js +95 -95
- package/dist/SwapperFactory.d.ts +50 -50
- package/dist/SwapperFactory.js +108 -108
- package/dist/Utils.d.ts +11 -11
- package/dist/Utils.js +37 -37
- package/dist/fs-storage/FileSystemStorageManager.d.ts +15 -15
- package/dist/fs-storage/FileSystemStorageManager.js +60 -60
- package/dist/fs-storage/index.d.ts +1 -1
- package/dist/fs-storage/index.js +17 -17
- package/dist/index.d.ts +5 -5
- package/dist/index.js +21 -21
- package/dist/storage/LocalStorageManager.d.ts +24 -24
- package/dist/storage/LocalStorageManager.js +68 -68
- package/package.json +31 -31
- package/src/SmartChainAssets.js +75 -75
- package/src/SmartChainAssets.ts +96 -96
- package/src/SwapperFactory.js +120 -120
- package/src/SwapperFactory.ts +198 -198
- package/src/Utils.js +37 -37
- package/src/Utils.ts +31 -31
- package/src/fs-storage/FileSystemStorageManager.ts +71 -71
- package/src/fs-storage/index.ts +1 -1
- package/src/index.js +21 -21
- package/src/index.ts +5 -5
- package/src/storage/LocalStorageManager.js +72 -72
- package/src/storage/LocalStorageManager.ts +81 -81
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
export declare const SmartChainAssets: {
|
|
2
|
-
readonly _TESTNET_WBTC_VESU: {
|
|
3
|
-
readonly pricing: {
|
|
4
|
-
readonly binancePair: "WBTCBTC";
|
|
5
|
-
readonly okxPair: "WBTC-BTC";
|
|
6
|
-
readonly coinGeckoCoinId: "wrapped-bitcoin";
|
|
7
|
-
readonly coinPaprikaCoinId: "wbtc-wrapped-bitcoin";
|
|
8
|
-
readonly krakenPair: "WBTCXBT";
|
|
9
|
-
};
|
|
10
|
-
readonly name: "Wrapped BTC (WBTC)";
|
|
11
|
-
};
|
|
12
|
-
readonly WBTC: {
|
|
13
|
-
readonly pricing: {
|
|
14
|
-
readonly binancePair: "WBTCBTC";
|
|
15
|
-
readonly okxPair: "WBTC-BTC";
|
|
16
|
-
readonly coinGeckoCoinId: "wrapped-bitcoin";
|
|
17
|
-
readonly coinPaprikaCoinId: "wbtc-wrapped-bitcoin";
|
|
18
|
-
readonly krakenPair: "WBTCXBT";
|
|
19
|
-
};
|
|
20
|
-
readonly name: "Wrapped BTC (WBTC)";
|
|
21
|
-
};
|
|
22
|
-
readonly TBTC: {
|
|
23
|
-
readonly pricing: {
|
|
24
|
-
readonly binancePair: any;
|
|
25
|
-
readonly okxPair: any;
|
|
26
|
-
readonly coinGeckoCoinId: "tbtc";
|
|
27
|
-
readonly coinPaprikaCoinId: "tbtc-tbtc";
|
|
28
|
-
readonly krakenPair: any;
|
|
29
|
-
};
|
|
30
|
-
readonly name: "Threshold BTC (tBTC)";
|
|
31
|
-
};
|
|
32
|
-
readonly USDC: {
|
|
33
|
-
readonly pricing: {
|
|
34
|
-
readonly binancePair: "!BTCUSDC";
|
|
35
|
-
readonly okxPair: "!BTC-USDC";
|
|
36
|
-
readonly coinGeckoCoinId: "usd-coin";
|
|
37
|
-
readonly coinPaprikaCoinId: "usdc-usd-coin";
|
|
38
|
-
readonly krakenPair: "!XBTUSDC";
|
|
39
|
-
};
|
|
40
|
-
readonly name: "USD Circle";
|
|
41
|
-
};
|
|
42
|
-
readonly USDT: {
|
|
43
|
-
readonly pricing: {
|
|
44
|
-
readonly binancePair: "!BTCUSDT";
|
|
45
|
-
readonly okxPair: "!BTC-USDT";
|
|
46
|
-
readonly coinGeckoCoinId: "tether";
|
|
47
|
-
readonly coinPaprikaCoinId: "usdt-tether";
|
|
48
|
-
readonly krakenPair: "!XBTUSDT";
|
|
49
|
-
};
|
|
50
|
-
readonly name: "Tether USD";
|
|
51
|
-
};
|
|
52
|
-
readonly SOL: {
|
|
53
|
-
readonly pricing: {
|
|
54
|
-
readonly binancePair: "SOLBTC";
|
|
55
|
-
readonly okxPair: "SOL-BTC";
|
|
56
|
-
readonly coinGeckoCoinId: "solana";
|
|
57
|
-
readonly coinPaprikaCoinId: "sol-solana";
|
|
58
|
-
readonly krakenPair: "SOLXBT";
|
|
59
|
-
};
|
|
60
|
-
readonly name: "Solana";
|
|
61
|
-
};
|
|
62
|
-
readonly BONK: {
|
|
63
|
-
readonly pricing: {
|
|
64
|
-
readonly binancePair: "BONKUSDC;!BTCUSDC";
|
|
65
|
-
readonly okxPair: "BONK-USDT;!BTC-USDT";
|
|
66
|
-
readonly coinGeckoCoinId: "bonk";
|
|
67
|
-
readonly coinPaprikaCoinId: "bonk-bonk";
|
|
68
|
-
readonly krakenPair: "BONKUSD;!XXBTZUSD";
|
|
69
|
-
};
|
|
70
|
-
readonly name: "Bonk";
|
|
71
|
-
};
|
|
72
|
-
readonly ETH: {
|
|
73
|
-
readonly pricing: {
|
|
74
|
-
readonly binancePair: "ETHBTC";
|
|
75
|
-
readonly okxPair: "ETH-BTC";
|
|
76
|
-
readonly coinGeckoCoinId: "ethereum";
|
|
77
|
-
readonly coinPaprikaCoinId: "eth-ethereum";
|
|
78
|
-
readonly krakenPair: "XETHXXBT";
|
|
79
|
-
};
|
|
80
|
-
readonly name: "Ether";
|
|
81
|
-
};
|
|
82
|
-
readonly STRK: {
|
|
83
|
-
readonly pricing: {
|
|
84
|
-
readonly binancePair: "STRKUSDT;!BTCUSDT";
|
|
85
|
-
readonly okxPair: "STRK-USDT;!BTC-USDT";
|
|
86
|
-
readonly coinGeckoCoinId: "starknet";
|
|
87
|
-
readonly coinPaprikaCoinId: "strk-starknet";
|
|
88
|
-
readonly krakenPair: "STRKUSD;!XXBTZUSD";
|
|
89
|
-
};
|
|
90
|
-
readonly name: "Starknet";
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
export type SmartChainAssetTickers = keyof typeof SmartChainAssets;
|
|
1
|
+
export declare const SmartChainAssets: {
|
|
2
|
+
readonly _TESTNET_WBTC_VESU: {
|
|
3
|
+
readonly pricing: {
|
|
4
|
+
readonly binancePair: "WBTCBTC";
|
|
5
|
+
readonly okxPair: "WBTC-BTC";
|
|
6
|
+
readonly coinGeckoCoinId: "wrapped-bitcoin";
|
|
7
|
+
readonly coinPaprikaCoinId: "wbtc-wrapped-bitcoin";
|
|
8
|
+
readonly krakenPair: "WBTCXBT";
|
|
9
|
+
};
|
|
10
|
+
readonly name: "Wrapped BTC (WBTC)";
|
|
11
|
+
};
|
|
12
|
+
readonly WBTC: {
|
|
13
|
+
readonly pricing: {
|
|
14
|
+
readonly binancePair: "WBTCBTC";
|
|
15
|
+
readonly okxPair: "WBTC-BTC";
|
|
16
|
+
readonly coinGeckoCoinId: "wrapped-bitcoin";
|
|
17
|
+
readonly coinPaprikaCoinId: "wbtc-wrapped-bitcoin";
|
|
18
|
+
readonly krakenPair: "WBTCXBT";
|
|
19
|
+
};
|
|
20
|
+
readonly name: "Wrapped BTC (WBTC)";
|
|
21
|
+
};
|
|
22
|
+
readonly TBTC: {
|
|
23
|
+
readonly pricing: {
|
|
24
|
+
readonly binancePair: any;
|
|
25
|
+
readonly okxPair: any;
|
|
26
|
+
readonly coinGeckoCoinId: "tbtc";
|
|
27
|
+
readonly coinPaprikaCoinId: "tbtc-tbtc";
|
|
28
|
+
readonly krakenPair: any;
|
|
29
|
+
};
|
|
30
|
+
readonly name: "Threshold BTC (tBTC)";
|
|
31
|
+
};
|
|
32
|
+
readonly USDC: {
|
|
33
|
+
readonly pricing: {
|
|
34
|
+
readonly binancePair: "!BTCUSDC";
|
|
35
|
+
readonly okxPair: "!BTC-USDC";
|
|
36
|
+
readonly coinGeckoCoinId: "usd-coin";
|
|
37
|
+
readonly coinPaprikaCoinId: "usdc-usd-coin";
|
|
38
|
+
readonly krakenPair: "!XBTUSDC";
|
|
39
|
+
};
|
|
40
|
+
readonly name: "USD Circle";
|
|
41
|
+
};
|
|
42
|
+
readonly USDT: {
|
|
43
|
+
readonly pricing: {
|
|
44
|
+
readonly binancePair: "!BTCUSDT";
|
|
45
|
+
readonly okxPair: "!BTC-USDT";
|
|
46
|
+
readonly coinGeckoCoinId: "tether";
|
|
47
|
+
readonly coinPaprikaCoinId: "usdt-tether";
|
|
48
|
+
readonly krakenPair: "!XBTUSDT";
|
|
49
|
+
};
|
|
50
|
+
readonly name: "Tether USD";
|
|
51
|
+
};
|
|
52
|
+
readonly SOL: {
|
|
53
|
+
readonly pricing: {
|
|
54
|
+
readonly binancePair: "SOLBTC";
|
|
55
|
+
readonly okxPair: "SOL-BTC";
|
|
56
|
+
readonly coinGeckoCoinId: "solana";
|
|
57
|
+
readonly coinPaprikaCoinId: "sol-solana";
|
|
58
|
+
readonly krakenPair: "SOLXBT";
|
|
59
|
+
};
|
|
60
|
+
readonly name: "Solana";
|
|
61
|
+
};
|
|
62
|
+
readonly BONK: {
|
|
63
|
+
readonly pricing: {
|
|
64
|
+
readonly binancePair: "BONKUSDC;!BTCUSDC";
|
|
65
|
+
readonly okxPair: "BONK-USDT;!BTC-USDT";
|
|
66
|
+
readonly coinGeckoCoinId: "bonk";
|
|
67
|
+
readonly coinPaprikaCoinId: "bonk-bonk";
|
|
68
|
+
readonly krakenPair: "BONKUSD;!XXBTZUSD";
|
|
69
|
+
};
|
|
70
|
+
readonly name: "Bonk";
|
|
71
|
+
};
|
|
72
|
+
readonly ETH: {
|
|
73
|
+
readonly pricing: {
|
|
74
|
+
readonly binancePair: "ETHBTC";
|
|
75
|
+
readonly okxPair: "ETH-BTC";
|
|
76
|
+
readonly coinGeckoCoinId: "ethereum";
|
|
77
|
+
readonly coinPaprikaCoinId: "eth-ethereum";
|
|
78
|
+
readonly krakenPair: "XETHXXBT";
|
|
79
|
+
};
|
|
80
|
+
readonly name: "Ether";
|
|
81
|
+
};
|
|
82
|
+
readonly STRK: {
|
|
83
|
+
readonly pricing: {
|
|
84
|
+
readonly binancePair: "STRKUSDT;!BTCUSDT";
|
|
85
|
+
readonly okxPair: "STRK-USDT;!BTC-USDT";
|
|
86
|
+
readonly coinGeckoCoinId: "starknet";
|
|
87
|
+
readonly coinPaprikaCoinId: "strk-starknet";
|
|
88
|
+
readonly krakenPair: "STRKUSD;!XXBTZUSD";
|
|
89
|
+
};
|
|
90
|
+
readonly name: "Starknet";
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
export type SmartChainAssetTickers = keyof typeof SmartChainAssets;
|
package/dist/SmartChainAssets.js
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SmartChainAssets = void 0;
|
|
4
|
-
exports.SmartChainAssets = {
|
|
5
|
-
_TESTNET_WBTC_VESU: {
|
|
6
|
-
pricing: {
|
|
7
|
-
binancePair: "WBTCBTC",
|
|
8
|
-
okxPair: "WBTC-BTC",
|
|
9
|
-
coinGeckoCoinId: "wrapped-bitcoin",
|
|
10
|
-
coinPaprikaCoinId: "wbtc-wrapped-bitcoin",
|
|
11
|
-
krakenPair: "WBTCXBT"
|
|
12
|
-
},
|
|
13
|
-
name: "Wrapped BTC (WBTC)"
|
|
14
|
-
},
|
|
15
|
-
WBTC: {
|
|
16
|
-
pricing: {
|
|
17
|
-
binancePair: "WBTCBTC",
|
|
18
|
-
okxPair: "WBTC-BTC",
|
|
19
|
-
coinGeckoCoinId: "wrapped-bitcoin",
|
|
20
|
-
coinPaprikaCoinId: "wbtc-wrapped-bitcoin",
|
|
21
|
-
krakenPair: "WBTCXBT"
|
|
22
|
-
},
|
|
23
|
-
name: "Wrapped BTC (WBTC)"
|
|
24
|
-
},
|
|
25
|
-
TBTC: {
|
|
26
|
-
pricing: {
|
|
27
|
-
binancePair: null,
|
|
28
|
-
okxPair: null,
|
|
29
|
-
coinGeckoCoinId: "tbtc",
|
|
30
|
-
coinPaprikaCoinId: "tbtc-tbtc",
|
|
31
|
-
krakenPair: null
|
|
32
|
-
},
|
|
33
|
-
name: "Threshold BTC (tBTC)"
|
|
34
|
-
},
|
|
35
|
-
USDC: {
|
|
36
|
-
pricing: {
|
|
37
|
-
binancePair: "!BTCUSDC",
|
|
38
|
-
okxPair: "!BTC-USDC",
|
|
39
|
-
coinGeckoCoinId: "usd-coin",
|
|
40
|
-
coinPaprikaCoinId: "usdc-usd-coin",
|
|
41
|
-
krakenPair: "!XBTUSDC"
|
|
42
|
-
},
|
|
43
|
-
name: "USD Circle"
|
|
44
|
-
},
|
|
45
|
-
USDT: {
|
|
46
|
-
pricing: {
|
|
47
|
-
binancePair: "!BTCUSDT",
|
|
48
|
-
okxPair: "!BTC-USDT",
|
|
49
|
-
coinGeckoCoinId: "tether",
|
|
50
|
-
coinPaprikaCoinId: "usdt-tether",
|
|
51
|
-
krakenPair: "!XBTUSDT"
|
|
52
|
-
},
|
|
53
|
-
name: "Tether USD"
|
|
54
|
-
},
|
|
55
|
-
SOL: {
|
|
56
|
-
pricing: {
|
|
57
|
-
binancePair: "SOLBTC",
|
|
58
|
-
okxPair: "SOL-BTC",
|
|
59
|
-
coinGeckoCoinId: "solana",
|
|
60
|
-
coinPaprikaCoinId: "sol-solana",
|
|
61
|
-
krakenPair: "SOLXBT"
|
|
62
|
-
},
|
|
63
|
-
name: "Solana"
|
|
64
|
-
},
|
|
65
|
-
BONK: {
|
|
66
|
-
pricing: {
|
|
67
|
-
binancePair: "BONKUSDC;!BTCUSDC",
|
|
68
|
-
okxPair: "BONK-USDT;!BTC-USDT",
|
|
69
|
-
coinGeckoCoinId: "bonk",
|
|
70
|
-
coinPaprikaCoinId: "bonk-bonk",
|
|
71
|
-
krakenPair: "BONKUSD;!XXBTZUSD"
|
|
72
|
-
},
|
|
73
|
-
name: "Bonk"
|
|
74
|
-
},
|
|
75
|
-
ETH: {
|
|
76
|
-
pricing: {
|
|
77
|
-
binancePair: "ETHBTC",
|
|
78
|
-
okxPair: "ETH-BTC",
|
|
79
|
-
coinGeckoCoinId: "ethereum",
|
|
80
|
-
coinPaprikaCoinId: "eth-ethereum",
|
|
81
|
-
krakenPair: "XETHXXBT"
|
|
82
|
-
},
|
|
83
|
-
name: "Ether"
|
|
84
|
-
},
|
|
85
|
-
STRK: {
|
|
86
|
-
pricing: {
|
|
87
|
-
binancePair: "STRKUSDT;!BTCUSDT",
|
|
88
|
-
okxPair: "STRK-USDT;!BTC-USDT",
|
|
89
|
-
coinGeckoCoinId: "starknet",
|
|
90
|
-
coinPaprikaCoinId: "strk-starknet",
|
|
91
|
-
krakenPair: "STRKUSD;!XXBTZUSD"
|
|
92
|
-
},
|
|
93
|
-
name: "Starknet"
|
|
94
|
-
}
|
|
95
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SmartChainAssets = void 0;
|
|
4
|
+
exports.SmartChainAssets = {
|
|
5
|
+
_TESTNET_WBTC_VESU: {
|
|
6
|
+
pricing: {
|
|
7
|
+
binancePair: "WBTCBTC",
|
|
8
|
+
okxPair: "WBTC-BTC",
|
|
9
|
+
coinGeckoCoinId: "wrapped-bitcoin",
|
|
10
|
+
coinPaprikaCoinId: "wbtc-wrapped-bitcoin",
|
|
11
|
+
krakenPair: "WBTCXBT"
|
|
12
|
+
},
|
|
13
|
+
name: "Wrapped BTC (WBTC)"
|
|
14
|
+
},
|
|
15
|
+
WBTC: {
|
|
16
|
+
pricing: {
|
|
17
|
+
binancePair: "WBTCBTC",
|
|
18
|
+
okxPair: "WBTC-BTC",
|
|
19
|
+
coinGeckoCoinId: "wrapped-bitcoin",
|
|
20
|
+
coinPaprikaCoinId: "wbtc-wrapped-bitcoin",
|
|
21
|
+
krakenPair: "WBTCXBT"
|
|
22
|
+
},
|
|
23
|
+
name: "Wrapped BTC (WBTC)"
|
|
24
|
+
},
|
|
25
|
+
TBTC: {
|
|
26
|
+
pricing: {
|
|
27
|
+
binancePair: null,
|
|
28
|
+
okxPair: null,
|
|
29
|
+
coinGeckoCoinId: "tbtc",
|
|
30
|
+
coinPaprikaCoinId: "tbtc-tbtc",
|
|
31
|
+
krakenPair: null
|
|
32
|
+
},
|
|
33
|
+
name: "Threshold BTC (tBTC)"
|
|
34
|
+
},
|
|
35
|
+
USDC: {
|
|
36
|
+
pricing: {
|
|
37
|
+
binancePair: "!BTCUSDC",
|
|
38
|
+
okxPair: "!BTC-USDC",
|
|
39
|
+
coinGeckoCoinId: "usd-coin",
|
|
40
|
+
coinPaprikaCoinId: "usdc-usd-coin",
|
|
41
|
+
krakenPair: "!XBTUSDC"
|
|
42
|
+
},
|
|
43
|
+
name: "USD Circle"
|
|
44
|
+
},
|
|
45
|
+
USDT: {
|
|
46
|
+
pricing: {
|
|
47
|
+
binancePair: "!BTCUSDT",
|
|
48
|
+
okxPair: "!BTC-USDT",
|
|
49
|
+
coinGeckoCoinId: "tether",
|
|
50
|
+
coinPaprikaCoinId: "usdt-tether",
|
|
51
|
+
krakenPair: "!XBTUSDT"
|
|
52
|
+
},
|
|
53
|
+
name: "Tether USD"
|
|
54
|
+
},
|
|
55
|
+
SOL: {
|
|
56
|
+
pricing: {
|
|
57
|
+
binancePair: "SOLBTC",
|
|
58
|
+
okxPair: "SOL-BTC",
|
|
59
|
+
coinGeckoCoinId: "solana",
|
|
60
|
+
coinPaprikaCoinId: "sol-solana",
|
|
61
|
+
krakenPair: "SOLXBT"
|
|
62
|
+
},
|
|
63
|
+
name: "Solana"
|
|
64
|
+
},
|
|
65
|
+
BONK: {
|
|
66
|
+
pricing: {
|
|
67
|
+
binancePair: "BONKUSDC;!BTCUSDC",
|
|
68
|
+
okxPair: "BONK-USDT;!BTC-USDT",
|
|
69
|
+
coinGeckoCoinId: "bonk",
|
|
70
|
+
coinPaprikaCoinId: "bonk-bonk",
|
|
71
|
+
krakenPair: "BONKUSD;!XXBTZUSD"
|
|
72
|
+
},
|
|
73
|
+
name: "Bonk"
|
|
74
|
+
},
|
|
75
|
+
ETH: {
|
|
76
|
+
pricing: {
|
|
77
|
+
binancePair: "ETHBTC",
|
|
78
|
+
okxPair: "ETH-BTC",
|
|
79
|
+
coinGeckoCoinId: "ethereum",
|
|
80
|
+
coinPaprikaCoinId: "eth-ethereum",
|
|
81
|
+
krakenPair: "XETHXXBT"
|
|
82
|
+
},
|
|
83
|
+
name: "Ether"
|
|
84
|
+
},
|
|
85
|
+
STRK: {
|
|
86
|
+
pricing: {
|
|
87
|
+
binancePair: "STRKUSDT;!BTCUSDT",
|
|
88
|
+
okxPair: "STRK-USDT;!BTC-USDT",
|
|
89
|
+
coinGeckoCoinId: "starknet",
|
|
90
|
+
coinPaprikaCoinId: "strk-starknet",
|
|
91
|
+
krakenPair: "STRKUSD;!XXBTZUSD"
|
|
92
|
+
},
|
|
93
|
+
name: "Starknet"
|
|
94
|
+
}
|
|
95
|
+
};
|
package/dist/SwapperFactory.d.ts
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { ChainData, BitcoinNetwork, BitcoinRpc, BaseTokenType, ChainType, StorageObject, IStorageManager } from "@atomiqlabs/base";
|
|
2
|
-
import { BtcToken, CustomPriceFunction, MempoolApi, MempoolBitcoinRpc, SCToken, Swapper, SwapperOptions } from "@atomiqlabs/sdk-lib";
|
|
3
|
-
type ChainInitializer<O, C extends ChainType, T extends BaseTokenType> = {
|
|
4
|
-
chainId: ChainType["ChainId"];
|
|
5
|
-
chainType: ChainType;
|
|
6
|
-
initializer: (options: O, bitcoinRelay: BitcoinRpc<any>, network: BitcoinNetwork, storageCtor: <T extends StorageObject>(name: string) => IStorageManager<T>) => ChainData<C>;
|
|
7
|
-
tokens: T;
|
|
8
|
-
options: O;
|
|
9
|
-
};
|
|
10
|
-
type TokensDict<T extends ChainInitializer<any, any, any>> = {
|
|
11
|
-
[K in T["chainId"]]: {
|
|
12
|
-
[val in keyof T["tokens"]]: SCToken<K>;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
type GetAllTokens<T extends readonly ChainInitializer<any, any, any>[]> = (T extends readonly [infer First extends ChainInitializer<any, any, any>, ...infer Rest extends ChainInitializer<any, any, any>[]] ? TokensDict<First> & GetAllTokens<Rest> : unknown);
|
|
16
|
-
export type TokenResolverDict<T extends ChainInitializer<any, any, any>> = {
|
|
17
|
-
[K in T["chainId"]]: {
|
|
18
|
-
getToken: (address: string) => SCToken<K>;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
type GetAllTokenResolvers<T extends readonly ChainInitializer<any, any, any>[]> = (T extends readonly [infer First extends ChainInitializer<any, any, any>, ...infer Rest extends ChainInitializer<any, any, any>[]] ? TokenResolverDict<First> & GetAllTokenResolvers<Rest> : unknown);
|
|
22
|
-
type OptionsDict<T extends ChainInitializer<any, any, any>> = {
|
|
23
|
-
[K in T["chainId"]]: T["options"];
|
|
24
|
-
};
|
|
25
|
-
type GetAllOptions<T extends readonly ChainInitializer<any, any, any>[]> = (T extends readonly [infer First extends ChainInitializer<any, any, any>, ...infer Rest extends ChainInitializer<any, any, any>[]] ? OptionsDict<First> & GetAllOptions<Rest> : unknown);
|
|
26
|
-
type ChainTypeDict<T extends ChainInitializer<any, any, any>> = {
|
|
27
|
-
[K in T["chainId"]]: T["chainType"];
|
|
28
|
-
};
|
|
29
|
-
type ToMultichain<T extends readonly ChainInitializer<any, any, any>[]> = (T extends readonly [infer First extends ChainInitializer<any, any, any>, ...infer Rest extends ChainInitializer<any, any, any>[]] ? ChainTypeDict<First> & ToMultichain<Rest> : {});
|
|
30
|
-
export type MultichainSwapperOptions<T extends readonly ChainInitializer<any, any, any>[]> = SwapperOptions & {
|
|
31
|
-
chains: GetAllOptions<T>;
|
|
32
|
-
} & {
|
|
33
|
-
chainStorageCtor?: <T extends StorageObject>(name: string) => IStorageManager<T>;
|
|
34
|
-
pricingFeeDifferencePPM?: bigint;
|
|
35
|
-
mempoolApi?: MempoolApi | MempoolBitcoinRpc | string | string[];
|
|
36
|
-
getPriceFn?: CustomPriceFunction;
|
|
37
|
-
};
|
|
38
|
-
export declare class SwapperFactory<T extends readonly ChainInitializer<any, any, any>[]> {
|
|
39
|
-
readonly initializers: T;
|
|
40
|
-
Tokens: GetAllTokens<T> & {
|
|
41
|
-
BITCOIN: {
|
|
42
|
-
BTC: BtcToken<false>;
|
|
43
|
-
BTCLN: BtcToken<true>;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
TokenResolver: GetAllTokenResolvers<T>;
|
|
47
|
-
constructor(initializers: T);
|
|
48
|
-
newSwapper(options: MultichainSwapperOptions<T>): Swapper<ToMultichain<T>>;
|
|
49
|
-
}
|
|
50
|
-
export {};
|
|
1
|
+
import { ChainData, BitcoinNetwork, BitcoinRpc, BaseTokenType, ChainType, StorageObject, IStorageManager } from "@atomiqlabs/base";
|
|
2
|
+
import { BtcToken, CustomPriceFunction, MempoolApi, MempoolBitcoinRpc, SCToken, Swapper, SwapperOptions } from "@atomiqlabs/sdk-lib";
|
|
3
|
+
type ChainInitializer<O, C extends ChainType, T extends BaseTokenType> = {
|
|
4
|
+
chainId: ChainType["ChainId"];
|
|
5
|
+
chainType: ChainType;
|
|
6
|
+
initializer: (options: O, bitcoinRelay: BitcoinRpc<any>, network: BitcoinNetwork, storageCtor: <T extends StorageObject>(name: string) => IStorageManager<T>) => ChainData<C>;
|
|
7
|
+
tokens: T;
|
|
8
|
+
options: O;
|
|
9
|
+
};
|
|
10
|
+
type TokensDict<T extends ChainInitializer<any, any, any>> = {
|
|
11
|
+
[K in T["chainId"]]: {
|
|
12
|
+
[val in keyof T["tokens"]]: SCToken<K>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
type GetAllTokens<T extends readonly ChainInitializer<any, any, any>[]> = (T extends readonly [infer First extends ChainInitializer<any, any, any>, ...infer Rest extends ChainInitializer<any, any, any>[]] ? TokensDict<First> & GetAllTokens<Rest> : unknown);
|
|
16
|
+
export type TokenResolverDict<T extends ChainInitializer<any, any, any>> = {
|
|
17
|
+
[K in T["chainId"]]: {
|
|
18
|
+
getToken: (address: string) => SCToken<K>;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
type GetAllTokenResolvers<T extends readonly ChainInitializer<any, any, any>[]> = (T extends readonly [infer First extends ChainInitializer<any, any, any>, ...infer Rest extends ChainInitializer<any, any, any>[]] ? TokenResolverDict<First> & GetAllTokenResolvers<Rest> : unknown);
|
|
22
|
+
type OptionsDict<T extends ChainInitializer<any, any, any>> = {
|
|
23
|
+
[K in T["chainId"]]: T["options"];
|
|
24
|
+
};
|
|
25
|
+
type GetAllOptions<T extends readonly ChainInitializer<any, any, any>[]> = (T extends readonly [infer First extends ChainInitializer<any, any, any>, ...infer Rest extends ChainInitializer<any, any, any>[]] ? OptionsDict<First> & GetAllOptions<Rest> : unknown);
|
|
26
|
+
type ChainTypeDict<T extends ChainInitializer<any, any, any>> = {
|
|
27
|
+
[K in T["chainId"]]: T["chainType"];
|
|
28
|
+
};
|
|
29
|
+
type ToMultichain<T extends readonly ChainInitializer<any, any, any>[]> = (T extends readonly [infer First extends ChainInitializer<any, any, any>, ...infer Rest extends ChainInitializer<any, any, any>[]] ? ChainTypeDict<First> & ToMultichain<Rest> : {});
|
|
30
|
+
export type MultichainSwapperOptions<T extends readonly ChainInitializer<any, any, any>[]> = SwapperOptions & {
|
|
31
|
+
chains: GetAllOptions<T>;
|
|
32
|
+
} & {
|
|
33
|
+
chainStorageCtor?: <T extends StorageObject>(name: string) => IStorageManager<T>;
|
|
34
|
+
pricingFeeDifferencePPM?: bigint;
|
|
35
|
+
mempoolApi?: MempoolApi | MempoolBitcoinRpc | string | string[];
|
|
36
|
+
getPriceFn?: CustomPriceFunction;
|
|
37
|
+
};
|
|
38
|
+
export declare class SwapperFactory<T extends readonly ChainInitializer<any, any, any>[]> {
|
|
39
|
+
readonly initializers: T;
|
|
40
|
+
Tokens: GetAllTokens<T> & {
|
|
41
|
+
BITCOIN: {
|
|
42
|
+
BTC: BtcToken<false>;
|
|
43
|
+
BTCLN: BtcToken<true>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
TokenResolver: GetAllTokenResolvers<T>;
|
|
47
|
+
constructor(initializers: T);
|
|
48
|
+
newSwapper(options: MultichainSwapperOptions<T>): Swapper<ToMultichain<T>>;
|
|
49
|
+
}
|
|
50
|
+
export {};
|