@rabby-wallet/rabby-swap 0.0.40 → 0.0.42-beta.0

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/abi.d.ts CHANGED
@@ -303,3 +303,19 @@ export declare const ParaSwapV6ABI: ({
303
303
  name?: undefined;
304
304
  outputs?: undefined;
305
305
  })[];
306
+ export declare const ZeroXABIV2: ({
307
+ inputs: never[];
308
+ stateMutability: string;
309
+ type: string;
310
+ name?: undefined;
311
+ } | {
312
+ inputs: never[];
313
+ name: string;
314
+ type: string;
315
+ stateMutability?: undefined;
316
+ } | {
317
+ stateMutability: string;
318
+ type: string;
319
+ inputs?: undefined;
320
+ name?: undefined;
321
+ })[];
package/dist/abi.js CHANGED
@@ -1731,3 +1731,8 @@ export const ParaSwapV6ABI = [
1731
1731
  },
1732
1732
  { stateMutability: "payable", type: "receive" },
1733
1733
  ];
1734
+ export const ZeroXABIV2 = [
1735
+ { inputs: [], stateMutability: "nonpayable", type: "constructor" },
1736
+ { inputs: [], name: "ConfusedDeputy", type: "error" },
1737
+ { stateMutability: "payable", type: "fallback" },
1738
+ ];
package/dist/consts.d.ts CHANGED
@@ -7,5 +7,6 @@ export declare enum DEX_ENUM {
7
7
  UNISWAP = "Uniswap",
8
8
  KYBERSWAP = "Kyberswap",
9
9
  PARASWAPV6 = "ParaSwapV6",
10
- ODOS = "ODOS"
10
+ ODOS = "ODOS",
11
+ ZEROXAPIV2 = "0xAPI_V2"
11
12
  }
package/dist/consts.js CHANGED
@@ -9,4 +9,5 @@ export var DEX_ENUM;
9
9
  DEX_ENUM["KYBERSWAP"] = "Kyberswap";
10
10
  DEX_ENUM["PARASWAPV6"] = "ParaSwapV6";
11
11
  DEX_ENUM["ODOS"] = "ODOS";
12
+ DEX_ENUM["ZEROXAPIV2"] = "0xAPI_V2";
12
13
  })(DEX_ENUM || (DEX_ENUM = {}));
@@ -0,0 +1,5 @@
1
+ import { CHAINS_ENUM } from "@debank/common";
2
+ import { TxWithChainId, DecodeCalldataResult } from "../quote";
3
+ export declare const SUPPORT_CHAINS: CHAINS_ENUM[];
4
+ export declare const getQuote: (options: import("../quote").QuoteParams, api: import("@rabby-wallet/rabby-api").OpenApiService) => Promise<import("../quote").QuoteResult>;
5
+ export declare const decodeCalldata: (tx: TxWithChainId) => DecodeCalldataResult | null;
@@ -0,0 +1,21 @@
1
+ import { CHAINS_ENUM } from "@debank/common";
2
+ import { generateGetQuote } from "../utils";
3
+ import { DEX_ENUM } from "../consts";
4
+ const NATIVE_TOKEN = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
5
+ export const SUPPORT_CHAINS = [
6
+ CHAINS_ENUM.ETH,
7
+ CHAINS_ENUM.POLYGON,
8
+ CHAINS_ENUM.ARBITRUM,
9
+ CHAINS_ENUM.BASE,
10
+ CHAINS_ENUM.OP,
11
+ CHAINS_ENUM.BSC,
12
+ CHAINS_ENUM.AVAX,
13
+ ];
14
+ export const getQuote = generateGetQuote({
15
+ SUPPORT_CHAINS,
16
+ id: "matcha_v2",
17
+ dex: DEX_ENUM.ZEROXAPIV2,
18
+ });
19
+ export const decodeCalldata = (tx) => {
20
+ return null;
21
+ };
package/dist/list.d.ts CHANGED
@@ -26,6 +26,8 @@ export declare const DEX_SUPPORT_CHAINS: {
26
26
  OpenOcean: CHAINS_ENUM[];
27
27
  Kyberswap: CHAINS_ENUM[];
28
28
  ParaSwapV6: CHAINS_ENUM[];
29
+ ODOS: CHAINS_ENUM[];
30
+ "0xAPI_V2": CHAINS_ENUM[];
29
31
  };
30
32
  export declare const DEX_ROUTER_WHITELIST: {
31
33
  "1inch": {
@@ -119,6 +121,15 @@ export declare const DEX_ROUTER_WHITELIST: {
119
121
  SCRL: string;
120
122
  MODE: string;
121
123
  };
124
+ "0xAPI_V2": {
125
+ ETH: string;
126
+ POLYGON: string;
127
+ ARBITRUM: string;
128
+ BASE: string;
129
+ OP: string;
130
+ BSC: string;
131
+ AVAX: string;
132
+ };
122
133
  };
123
134
  export declare const DEX_SPENDER_WHITELIST: {
124
135
  "1inch": {
@@ -213,4 +224,13 @@ export declare const DEX_SPENDER_WHITELIST: {
213
224
  SCRL: string;
214
225
  MODE: string;
215
226
  };
227
+ "0xAPI_V2": {
228
+ ETH: string;
229
+ POLYGON: string;
230
+ ARBITRUM: string;
231
+ BASE: string;
232
+ OP: string;
233
+ BSC: string;
234
+ AVAX: string;
235
+ };
216
236
  };
package/dist/list.js CHANGED
@@ -6,6 +6,8 @@ import { SUPPORT_CHAINS as paraswapSupportChains } from "./dexs/paraswap";
6
6
  import { SUPPORT_CHAINS as paraswapV6SupportChains } from "./dexs/paraswap_v6";
7
7
  import { SUPPORT_CHAINS as kyberswapSupportChains } from "./dexs/kyberswap";
8
8
  import { SUPPORT_CHAINS as openOceanSupportChains } from "./dexs/openocean";
9
+ import { SUPPORT_CHAINS as odosSupportChains } from "./dexs/odos";
10
+ import { SUPPORT_CHAINS as zeroXV2SupportChains } from "./dexs/0xapi_v2";
9
11
  import { DEX_ENUM } from "./consts";
10
12
  export const WrapTokenAddressMap = {
11
13
  [CHAINS_ENUM.ETH]: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
@@ -37,6 +39,8 @@ export const DEX_SUPPORT_CHAINS = {
37
39
  [DEX_ENUM.OPENOCEAN]: openOceanSupportChains,
38
40
  [DEX_ENUM.KYBERSWAP]: kyberswapSupportChains,
39
41
  [DEX_ENUM.PARASWAPV6]: paraswapV6SupportChains,
42
+ [DEX_ENUM.ODOS]: odosSupportChains,
43
+ [DEX_ENUM.ZEROXAPIV2]: zeroXV2SupportChains,
40
44
  };
41
45
  export const DEX_ROUTER_WHITELIST = {
42
46
  [DEX_ENUM.ONEINCH]: {
@@ -130,6 +134,15 @@ export const DEX_ROUTER_WHITELIST = {
130
134
  [CHAINS_ENUM.SCRL]: "0xbFe03C9E20a9Fc0b37de01A172F207004935E0b1",
131
135
  [CHAINS_ENUM.MODE]: "0x7E15EB462cdc67Cf92Af1f7102465a8F8c784874",
132
136
  },
137
+ [DEX_ENUM.ZEROXAPIV2]: {
138
+ [CHAINS_ENUM.ETH]: "0x0000000000001ff3684f28c67538d4d072c22734",
139
+ [CHAINS_ENUM.POLYGON]: "0x0000000000001ff3684f28c67538d4d072c22734",
140
+ [CHAINS_ENUM.ARBITRUM]: "0x0000000000001ff3684f28c67538d4d072c22734",
141
+ [CHAINS_ENUM.BASE]: "0x0000000000001ff3684f28c67538d4d072c22734",
142
+ [CHAINS_ENUM.OP]: "0x0000000000001ff3684f28c67538d4d072c22734",
143
+ [CHAINS_ENUM.BSC]: "0x0000000000005e88410ccdfade4a5efae4b49562",
144
+ [CHAINS_ENUM.AVAX]: "0x0000000000005e88410ccdfade4a5efae4b49562",
145
+ },
133
146
  };
134
147
  export const DEX_SPENDER_WHITELIST = {
135
148
  [DEX_ENUM.ONEINCH]: {
@@ -224,4 +237,13 @@ export const DEX_SPENDER_WHITELIST = {
224
237
  [CHAINS_ENUM.SCRL]: "0xbFe03C9E20a9Fc0b37de01A172F207004935E0b1",
225
238
  [CHAINS_ENUM.MODE]: "0x7E15EB462cdc67Cf92Af1f7102465a8F8c784874",
226
239
  },
240
+ [DEX_ENUM.ZEROXAPIV2]: {
241
+ [CHAINS_ENUM.ETH]: "0x0000000000001ff3684f28c67538d4d072c22734",
242
+ [CHAINS_ENUM.POLYGON]: "0x0000000000001ff3684f28c67538d4d072c22734",
243
+ [CHAINS_ENUM.ARBITRUM]: "0x0000000000001ff3684f28c67538d4d072c22734",
244
+ [CHAINS_ENUM.BASE]: "0x0000000000001ff3684f28c67538d4d072c22734",
245
+ [CHAINS_ENUM.OP]: "0x0000000000001ff3684f28c67538d4d072c22734",
246
+ [CHAINS_ENUM.BSC]: "0x0000000000005e88410ccdfade4a5efae4b49562",
247
+ [CHAINS_ENUM.AVAX]: "0x0000000000005e88410ccdfade4a5efae4b49562",
248
+ },
227
249
  };
package/dist/quote.js CHANGED
@@ -17,6 +17,7 @@ import { getQuote as uniswapGetQuote, decodeCalldata as uniswapDecodeCalldata, }
17
17
  import { getQuote as kyberswapGetQuote, decodeCalldata as kyberswapDecodeCalldata, } from "./dexs/kyberswap";
18
18
  import { getQuote as paraSwapV6GetQuote, decodeCalldata as paraSwapV6DecodeCalldata, } from "./dexs/paraswap_v6";
19
19
  import { getQuote as odosGetQuote, decodeCalldata as odosDecodeCalldata, } from "./dexs/odos";
20
+ import { getQuote as zeroXV2GetQuote, decodeCalldata as zeroXV2DecodeCalldata, } from "./dexs/0xapi_v2";
20
21
  export const getQuote = (id, params, api) => __awaiter(void 0, void 0, void 0, function* () {
21
22
  switch (id) {
22
23
  case DEX_ENUM.WRAPTOKEN:
@@ -37,6 +38,8 @@ export const getQuote = (id, params, api) => __awaiter(void 0, void 0, void 0, f
37
38
  return yield paraSwapV6GetQuote(params, api);
38
39
  case DEX_ENUM.ODOS:
39
40
  return yield odosGetQuote(params, api);
41
+ case DEX_ENUM.ZEROXAPIV2:
42
+ return yield zeroXV2GetQuote(params, api);
40
43
  default:
41
44
  throw new Error(`${id} is not supported!`);
42
45
  }
@@ -59,6 +62,8 @@ export const decodeCalldata = (id, tx) => {
59
62
  return paraSwapV6DecodeCalldata(tx);
60
63
  case DEX_ENUM.ODOS:
61
64
  return odosDecodeCalldata(tx);
65
+ case DEX_ENUM.ZEROXAPIV2:
66
+ return zeroXV2DecodeCalldata(tx);
62
67
  default:
63
68
  throw new Error(`${id} is not supported!`);
64
69
  }
package/dist/utils.d.ts CHANGED
@@ -5,6 +5,6 @@ import { DEX_ENUM } from "./consts";
5
5
  export declare const isSameAddress: (addr1: string, addr2: string) => boolean;
6
6
  export declare const generateGetQuote: ({ SUPPORT_CHAINS, id, dex, }: {
7
7
  SUPPORT_CHAINS: CHAINS_ENUM[];
8
- id: "uniswap3" | "matcha" | "openocean" | "1inch_v6" | "paraswap" | "kyberswap" | "odos" | "paraswap_v6";
8
+ id: "uniswap3" | "matcha" | "matcha_v2" | "openocean" | "1inch_v6" | "paraswap" | "kyberswap" | "odos" | "paraswap_v6";
9
9
  dex: DEX_ENUM;
10
10
  }) => (options: QuoteParams, api: OpenApiService) => Promise<QuoteResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/rabby-swap",
3
- "version": "0.0.40",
3
+ "version": "0.0.42-beta.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {