@rabby-wallet/rabby-swap 0.0.80-alpha.1 → 0.0.80-alpha.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/dist/tokenPools.d.ts +3 -4
- package/dist/tokenPools.js +17 -15
- package/package.json +1 -1
package/dist/tokenPools.d.ts
CHANGED
|
@@ -13,10 +13,9 @@ export declare const STABLE_TOKEN_POOL: readonly TokenPoolToken[];
|
|
|
13
13
|
export declare const NATIVE_AND_DERIVATIVE_TOKEN_POOL: readonly TokenPoolToken[];
|
|
14
14
|
/**
|
|
15
15
|
* Returns true when both tokens form a same-type pair in the same pool:
|
|
16
|
-
* either two stablecoins, or
|
|
17
|
-
* native-equivalent/derivative pair.
|
|
16
|
+
* either two stablecoins, or two native/derivative tokens.
|
|
18
17
|
*
|
|
19
|
-
* Lookup is O(1) after module initialization. Tokens from different pools
|
|
20
|
-
*
|
|
18
|
+
* Lookup is O(1) after module initialization. Tokens from different pools do
|
|
19
|
+
* not match.
|
|
21
20
|
*/
|
|
22
21
|
export declare const isSameTypeTokenPair: (tokenA: TokenPoolLookupToken | null | undefined, tokenB: TokenPoolLookupToken | null | undefined) => boolean;
|
package/dist/tokenPools.js
CHANGED
|
@@ -9,6 +9,7 @@ export const STABLE_TOKEN_POOL = [
|
|
|
9
9
|
{ chain: "abs", id: "0x0709F39376dEEe2A2dfC94A58EdEb2Eb9DF012bD" },
|
|
10
10
|
{ chain: "arb", id: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1" },
|
|
11
11
|
{ chain: "arb", id: "0x46850aD61C2B7d64d08c9C754F45254596696984" },
|
|
12
|
+
{ chain: "arb", id: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8" },
|
|
12
13
|
{ chain: "arb", id: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831" },
|
|
13
14
|
{ chain: "arb", id: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" },
|
|
14
15
|
{ chain: "arb", id: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9" },
|
|
@@ -31,6 +32,7 @@ export const STABLE_TOKEN_POOL = [
|
|
|
31
32
|
{ chain: "blast", id: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" },
|
|
32
33
|
{ chain: "bsc", id: "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3" },
|
|
33
34
|
{ chain: "bsc", id: "0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409" },
|
|
35
|
+
{ chain: "bsc", id: "0x8d0D000Ee44948FC98c9B98A4FA4921476f08B0d" },
|
|
34
36
|
{ chain: "bsc", id: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d" },
|
|
35
37
|
{ chain: "bsc", id: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" },
|
|
36
38
|
{ chain: "bsc", id: "0x55d398326f99059fF775485246999027B3197955" },
|
|
@@ -44,6 +46,7 @@ export const STABLE_TOKEN_POOL = [
|
|
|
44
46
|
{ chain: "era", id: "0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4" },
|
|
45
47
|
{ chain: "era", id: "0x39Fe7a0DACcE31Bd90418e3e659fb0b5f0B3Db0d" },
|
|
46
48
|
{ chain: "era", id: "0x493257fD37EDB34451f62EDf8D2a0C418852bA4C" },
|
|
49
|
+
{ chain: "eth", id: "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E" },
|
|
47
50
|
{ chain: "eth", id: "0x6B175474E89094C44Da98b954EedeAC495271d0F" },
|
|
48
51
|
{ chain: "eth", id: "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c" },
|
|
49
52
|
{ chain: "eth", id: "0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409" },
|
|
@@ -52,11 +55,13 @@ export const STABLE_TOKEN_POOL = [
|
|
|
52
55
|
{ chain: "eth", id: "0x4c9EDD5852cd905f086C759E8383e09bff1E68B3" },
|
|
53
56
|
{ chain: "eth", id: "0xdC035D45d973E3EC169d2276DDab16f1e407384F" },
|
|
54
57
|
{ chain: "eth", id: "0xdAC17F958D2ee523a2206206994597C13D831ec7" },
|
|
58
|
+
{ chain: "eth", id: "0x8d0D000Ee44948FC98c9B98A4FA4921476f08B0d" },
|
|
55
59
|
{ chain: "gravity", id: "0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6" },
|
|
56
60
|
{ chain: "gravity", id: "0x816E810f9F787d669FB71932DeabF6c83781Cd48" },
|
|
57
61
|
{ chain: "hood", id: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168" },
|
|
58
62
|
{ chain: "hyper", id: "0xb88339CB7199b77E23DB6E890353E22632Ba630f" },
|
|
59
63
|
{ chain: "hyper", id: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" },
|
|
64
|
+
{ chain: "hyper", id: "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb" },
|
|
60
65
|
{ chain: "ink", id: "0x2D270e6886d130D724215A266106e6832161EAEd" },
|
|
61
66
|
{ chain: "ink", id: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" },
|
|
62
67
|
{ chain: "ink", id: "0x0200C29006150606B650577BBE7B6248F58470c1" },
|
|
@@ -71,6 +76,7 @@ export const STABLE_TOKEN_POOL = [
|
|
|
71
76
|
{ chain: "manta", id: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" },
|
|
72
77
|
{ chain: "manta", id: "0xf417F5A458eC102B90352F697D6e2Ac3A3d2851f" },
|
|
73
78
|
{ chain: "matic", id: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063" },
|
|
79
|
+
{ chain: "matic", id: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" },
|
|
74
80
|
{ chain: "matic", id: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359" },
|
|
75
81
|
{ chain: "matic", id: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F" },
|
|
76
82
|
{ chain: "megaeth", id: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" },
|
|
@@ -80,9 +86,11 @@ export const STABLE_TOKEN_POOL = [
|
|
|
80
86
|
{ chain: "mnt", id: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" },
|
|
81
87
|
{ chain: "mnt", id: "0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE" },
|
|
82
88
|
{ chain: "mnt", id: "0x779Ded0c9e1022225f8E0630b35a9b54bE713736" },
|
|
89
|
+
{ chain: "mnt", id: "0x111111d2bf19e43c34263401e0cad979ed1cdb61" },
|
|
83
90
|
{ chain: "mode", id: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" },
|
|
84
91
|
{ chain: "monad", id: "0x754704Bc059F8C67012fEd69BC8A327a5aafb603" },
|
|
85
92
|
{ chain: "monad", id: "0xe7cd86e13AC4309349F30B3435a9d337750fC82D" },
|
|
93
|
+
{ chain: "monad", id: "0x111111d2bf19e43c34263401e0cad979ed1cdb61" },
|
|
86
94
|
{ chain: "op", id: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1" },
|
|
87
95
|
{ chain: "op", id: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85" },
|
|
88
96
|
{ chain: "op", id: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" },
|
|
@@ -109,16 +117,17 @@ export const STABLE_TOKEN_POOL = [
|
|
|
109
117
|
{ chain: "tempo", id: "0x20c000000000000000000000b9537d11c60e8b50" },
|
|
110
118
|
{ chain: "tempo", id: "0x20c00000000000000000000014f22ca97301eb73" },
|
|
111
119
|
{ chain: "uni", id: "0x078D782b760474a361dDA0AF3839290b0EF57AD6" },
|
|
120
|
+
{ chain: "uni", id: "0x9151434b16b9763660705744891fA906F660EcC5" },
|
|
112
121
|
{ chain: "xdai", id: "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83" },
|
|
113
122
|
{ chain: "xdai", id: "0x4ECaBa5870353805a9F068101A40E0f32ed605C6" },
|
|
114
123
|
{ chain: "xlayer", id: "0x74b7F16337b8972027F6196A17a631aC6dE26d22" },
|
|
115
|
-
{ chain: "xlayer", id: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" },
|
|
124
|
+
{ chain: "xlayer", id: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" },
|
|
125
|
+
{ chain: "xlayer", id: "0x111111d2bf19e43c34263401e0cad979ed1cdb61" }, // USD1
|
|
116
126
|
];
|
|
117
127
|
/**
|
|
118
|
-
* Native-equivalent and derivative
|
|
128
|
+
* Native-equivalent and derivative tokens.
|
|
119
129
|
*
|
|
120
|
-
*
|
|
121
|
-
* ETH <-> stETH and WETH <-> stETH while rejecting stETH <-> cbETH.
|
|
130
|
+
* Any two tokens in this pool form a same-type pair on the same chain.
|
|
122
131
|
*/
|
|
123
132
|
const ETH_NATIVE_TOKEN = { chain: "eth", id: "eth" }; // ETH
|
|
124
133
|
const ETH_WRAPPED_NATIVE_TOKEN = {
|
|
@@ -148,14 +157,12 @@ const isTokenPoolLookupToken = (token) => !!token &&
|
|
|
148
157
|
const getTokenKey = (token) => `${token.chain.toLowerCase()}${TOKEN_KEY_SEPARATOR}${token.id.toLowerCase()}`;
|
|
149
158
|
const stableTokenKeySet = new Set(STABLE_TOKEN_POOL.map(getTokenKey));
|
|
150
159
|
const nativeAndDerivativeTokenKeySet = new Set(NATIVE_AND_DERIVATIVE_TOKEN_POOL.map(getTokenKey));
|
|
151
|
-
const nativeEquivalentTokenKeySet = new Set([ETH_NATIVE_TOKEN, ETH_WRAPPED_NATIVE_TOKEN].map(getTokenKey));
|
|
152
160
|
/**
|
|
153
161
|
* Returns true when both tokens form a same-type pair in the same pool:
|
|
154
|
-
* either two stablecoins, or
|
|
155
|
-
* native-equivalent/derivative pair.
|
|
162
|
+
* either two stablecoins, or two native/derivative tokens.
|
|
156
163
|
*
|
|
157
|
-
* Lookup is O(1) after module initialization. Tokens from different pools
|
|
158
|
-
*
|
|
164
|
+
* Lookup is O(1) after module initialization. Tokens from different pools do
|
|
165
|
+
* not match.
|
|
159
166
|
*/
|
|
160
167
|
export const isSameTypeTokenPair = (tokenA, tokenB) => {
|
|
161
168
|
if (!isTokenPoolLookupToken(tokenA) || !isTokenPoolLookupToken(tokenB)) {
|
|
@@ -170,11 +177,6 @@ export const isSameTypeTokenPair = (tokenA, tokenB) => {
|
|
|
170
177
|
stableTokenKeySet.has(tokenBKey)) {
|
|
171
178
|
return true;
|
|
172
179
|
}
|
|
173
|
-
if (tokenAKey === tokenBKey) {
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
180
|
return (nativeAndDerivativeTokenKeySet.has(tokenAKey) &&
|
|
177
|
-
nativeAndDerivativeTokenKeySet.has(tokenBKey)
|
|
178
|
-
(nativeEquivalentTokenKeySet.has(tokenAKey) ||
|
|
179
|
-
nativeEquivalentTokenKeySet.has(tokenBKey)));
|
|
181
|
+
nativeAndDerivativeTokenKeySet.has(tokenBKey));
|
|
180
182
|
};
|