@rabby-wallet/rabby-swap 0.0.83 → 0.0.85

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.
@@ -16,6 +16,7 @@ export const SUPPORT_CHAINS = [
16
16
  CHAINS_ENUM.ERA,
17
17
  CHAINS_ENUM.LINEA,
18
18
  "HOOD",
19
+ "ARC",
19
20
  ];
20
21
  export const getQuote = generateGetQuote({
21
22
  SUPPORT_CHAINS,
package/dist/dexs/uni.js CHANGED
@@ -16,6 +16,7 @@ export const SUPPORT_CHAINS = [
16
16
  "TEMPO",
17
17
  "MONAD",
18
18
  "HOOD",
19
+ "ARC",
19
20
  ];
20
21
  export const UNI_NATIVE_TO_ADDRESSES = {
21
22
  [CHAINS_ENUM.ETH]: "0x66a9893cC07D91D95644AEDD05D03f95e1dBA8Af",
@@ -32,6 +33,7 @@ export const UNI_NATIVE_TO_ADDRESSES = {
32
33
  ["TEMPO"]: "0x1FEbB76Be10aAf3A1402F04e8E835f2c382F7914",
33
34
  ["MONAD"]: "0x0d97dc33264bfc1c226207428a79b26757fb9dc3",
34
35
  ["HOOD"]: "0x8876789976decbfcbbbe364623c63652db8c0904",
36
+ ["ARC"]: "0x4fca4a51ab4f23a7447b3284fbd7d73289a89fb1",
35
37
  };
36
38
  export const getQuote = generateGetQuote({
37
39
  SUPPORT_CHAINS,
package/dist/list.js CHANGED
@@ -127,7 +127,8 @@ export const DEX_ROUTER_WHITELIST = {
127
127
  [CHAINS_ENUM.BASE]: "0x111111125421ca6dc452d289314280a0f8842a65",
128
128
  [CHAINS_ENUM.ERA]: "0x6fd4383cb451173d5f9304f041c7bcbf27d561ff",
129
129
  [CHAINS_ENUM.LINEA]: "0x111111125421ca6dc452d289314280a0f8842a65",
130
- ["HOOD"]: "0x5A705DE8982235a7fa45bB83dCaCf03a211389C7"
130
+ ["HOOD"]: "0x5A705DE8982235a7fa45bB83dCaCf03a211389C7",
131
+ ["ARC"]: "0xE08CAb0828a67291EC4Af1FB3e7f867e206A6bdA",
131
132
  },
132
133
  [DEX_ENUM.PARASWAP]: {
133
134
  [CHAINS_ENUM.ETH]: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
@@ -304,6 +305,7 @@ export const DEX_ROUTER_WHITELIST = {
304
305
  ["TEMPO"]: "0x02E5be68D46DAc0B524905bfF209cf47EE6dB2a9",
305
306
  ["MONAD"]: "0x02E5be68D46DAc0B524905bfF209cf47EE6dB2a9",
306
307
  ["HOOD"]: "0x02E5be68D46DAc0B524905bfF209cf47EE6dB2a9",
308
+ ["ARC"]: "0x4fca4a51ab4f23a7447b3284fbd7d73289a89fb1",
307
309
  },
308
310
  };
309
311
  export const DEX_SPENDER_WHITELIST = {
@@ -355,7 +357,8 @@ export const DEX_SPENDER_WHITELIST = {
355
357
  [CHAINS_ENUM.BASE]: "0x111111125421ca6dc452d289314280a0f8842a65",
356
358
  [CHAINS_ENUM.ERA]: "0x6fd4383cb451173d5f9304f041c7bcbf27d561ff",
357
359
  [CHAINS_ENUM.LINEA]: "0x111111125421ca6dc452d289314280a0f8842a65",
358
- ["HOOD"]: "0x5A705DE8982235a7fa45bB83dCaCf03a211389C7"
360
+ ["HOOD"]: "0x5A705DE8982235a7fa45bB83dCaCf03a211389C7",
361
+ ["ARC"]: "0xE08CAb0828a67291EC4Af1FB3e7f867e206A6bdA",
359
362
  },
360
363
  [DEX_ENUM.PARASWAP]: {
361
364
  [CHAINS_ENUM.ETH]: "0x216b4b4ba9f3e719726886d34a177484278bfcae",
@@ -533,5 +536,6 @@ export const DEX_SPENDER_WHITELIST = {
533
536
  ["TEMPO"]: "0x02E5be68D46DAc0B524905bfF209cf47EE6dB2a9",
534
537
  ["MONAD"]: "0x02E5be68D46DAc0B524905bfF209cf47EE6dB2a9",
535
538
  ["HOOD"]: "0x02E5be68D46DAc0B524905bfF209cf47EE6dB2a9",
539
+ ["ARC"]: "0x02E5be68D46DAc0B524905bfF209cf47EE6dB2a9",
536
540
  },
537
541
  };
@@ -11,6 +11,19 @@ export type TokenPoolToken = TokenPoolLookupToken;
11
11
  */
12
12
  export declare const STABLE_TOKEN_POOL: readonly TokenPoolToken[];
13
13
  export declare const NATIVE_AND_DERIVATIVE_TOKEN_POOL: readonly TokenPoolToken[];
14
+ /**
15
+ * Returns true when both tokens are stablecoins on the same chain.
16
+ *
17
+ * Lookup is O(1) after module initialization.
18
+ */
19
+ export declare const isStableTokenPair: (tokenA: TokenPoolLookupToken | null | undefined, tokenB: TokenPoolLookupToken | null | undefined) => boolean;
20
+ /**
21
+ * Returns true when both tokens are native or derivative (LST/LRT) tokens on
22
+ * the same chain.
23
+ *
24
+ * Lookup is O(1) after module initialization.
25
+ */
26
+ export declare const isNativeAndDerivativeTokenPair: (tokenA: TokenPoolLookupToken | null | undefined, tokenB: TokenPoolLookupToken | null | undefined) => boolean;
14
27
  /**
15
28
  * Returns true when both tokens form a same-type pair in the same pool:
16
29
  * either two stablecoins, or two native/derivative tokens.
@@ -232,6 +232,38 @@ const isTokenPoolLookupToken = (token) => !!token &&
232
232
  const getTokenKey = (token) => `${token.chain.toLowerCase()}${TOKEN_KEY_SEPARATOR}${token.id.toLowerCase()}`;
233
233
  const stableTokenKeySet = new Set(STABLE_TOKEN_POOL.map(getTokenKey));
234
234
  const nativeAndDerivativeTokenKeySet = new Set(NATIVE_AND_DERIVATIVE_TOKEN_POOL.map(getTokenKey));
235
+ const getComparableTokenPairKeys = (tokenA, tokenB) => {
236
+ if (!isTokenPoolLookupToken(tokenA) || !isTokenPoolLookupToken(tokenB)) {
237
+ return null;
238
+ }
239
+ if (tokenA.chain.toLowerCase() !== tokenB.chain.toLowerCase()) {
240
+ return null;
241
+ }
242
+ return [getTokenKey(tokenA), getTokenKey(tokenB)];
243
+ };
244
+ /**
245
+ * Returns true when both tokens are stablecoins on the same chain.
246
+ *
247
+ * Lookup is O(1) after module initialization.
248
+ */
249
+ export const isStableTokenPair = (tokenA, tokenB) => {
250
+ const keys = getComparableTokenPairKeys(tokenA, tokenB);
251
+ return (!!keys &&
252
+ stableTokenKeySet.has(keys[0]) &&
253
+ stableTokenKeySet.has(keys[1]));
254
+ };
255
+ /**
256
+ * Returns true when both tokens are native or derivative (LST/LRT) tokens on
257
+ * the same chain.
258
+ *
259
+ * Lookup is O(1) after module initialization.
260
+ */
261
+ export const isNativeAndDerivativeTokenPair = (tokenA, tokenB) => {
262
+ const keys = getComparableTokenPairKeys(tokenA, tokenB);
263
+ return (!!keys &&
264
+ nativeAndDerivativeTokenKeySet.has(keys[0]) &&
265
+ nativeAndDerivativeTokenKeySet.has(keys[1]));
266
+ };
235
267
  /**
236
268
  * Returns true when both tokens form a same-type pair in the same pool:
237
269
  * either two stablecoins, or two native/derivative tokens.
@@ -239,19 +271,5 @@ const nativeAndDerivativeTokenKeySet = new Set(NATIVE_AND_DERIVATIVE_TOKEN_POOL.
239
271
  * Lookup is O(1) after module initialization. Tokens from different pools do
240
272
  * not match.
241
273
  */
242
- export const isSameTypeTokenPair = (tokenA, tokenB) => {
243
- if (!isTokenPoolLookupToken(tokenA) || !isTokenPoolLookupToken(tokenB)) {
244
- return false;
245
- }
246
- if (tokenA.chain.toLowerCase() !== tokenB.chain.toLowerCase()) {
247
- return false;
248
- }
249
- const tokenAKey = getTokenKey(tokenA);
250
- const tokenBKey = getTokenKey(tokenB);
251
- if (stableTokenKeySet.has(tokenAKey) &&
252
- stableTokenKeySet.has(tokenBKey)) {
253
- return true;
254
- }
255
- return (nativeAndDerivativeTokenKeySet.has(tokenAKey) &&
256
- nativeAndDerivativeTokenKeySet.has(tokenBKey));
257
- };
274
+ export const isSameTypeTokenPair = (tokenA, tokenB) => isStableTokenPair(tokenA, tokenB) ||
275
+ isNativeAndDerivativeTokenPair(tokenA, tokenB);
package/dist/utils.js CHANGED
@@ -53,8 +53,9 @@ export const generateGetQuote = ({ SUPPORT_CHAINS, id, dex, }) => (options, api)
53
53
  toToken: data.receive_token.id,
54
54
  toTokenAmount: data.receive_token_raw_amount + "",
55
55
  toTokenDecimals: data.receive_token.decimals,
56
- spender: dex === DEX_ENUM.PARASWAP
57
- ? DEX_SPENDER_WHITELIST[DEX_ENUM.PARASWAP][options.chain]
56
+ spender: dex === DEX_ENUM.PARASWAP ||
57
+ (dex === DEX_ENUM.UNI && options.chain === "ARC")
58
+ ? DEX_SPENDER_WHITELIST[dex][options.chain]
58
59
  : data.dex_swap_to,
59
60
  gasUsed: data.gas_used,
60
61
  origin: data,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/rabby-swap",
3
- "version": "0.0.83",
3
+ "version": "0.0.85",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {