@rabby-wallet/rabby-swap 0.0.45 → 0.0.46-alpha.2

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/consts.d.ts CHANGED
@@ -8,5 +8,6 @@ export declare enum DEX_ENUM {
8
8
  KYBERSWAP = "Kyberswap",
9
9
  PARASWAPV6 = "ParaSwapV6",
10
10
  ODOS = "ODOS",
11
- ZEROXAPIV2 = "0xAPIV2"
11
+ ZEROXAPIV2 = "0xAPIV2",
12
+ MAGPIE = "Magpie"
12
13
  }
package/dist/consts.js CHANGED
@@ -10,4 +10,5 @@ export var DEX_ENUM;
10
10
  DEX_ENUM["PARASWAPV6"] = "ParaSwapV6";
11
11
  DEX_ENUM["ODOS"] = "ODOS";
12
12
  DEX_ENUM["ZEROXAPIV2"] = "0xAPIV2";
13
+ DEX_ENUM["MAGPIE"] = "Magpie";
13
14
  })(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,28 @@
1
+ import { CHAINS_ENUM } from "@debank/common";
2
+ import { generateGetQuote } from "../utils";
3
+ import { DEX_ENUM } from "../consts";
4
+ export const SUPPORT_CHAINS = [
5
+ CHAINS_ENUM.ETH,
6
+ CHAINS_ENUM.OP,
7
+ CHAINS_ENUM.ARBITRUM,
8
+ CHAINS_ENUM.BSC,
9
+ CHAINS_ENUM.AVAX,
10
+ CHAINS_ENUM.FTM,
11
+ CHAINS_ENUM.POLYGON,
12
+ CHAINS_ENUM.BASE,
13
+ CHAINS_ENUM.PZE,
14
+ "SONIC",
15
+ CHAINS_ENUM.BLAST,
16
+ CHAINS_ENUM.MANTA,
17
+ CHAINS_ENUM.METIS,
18
+ CHAINS_ENUM.SCRL,
19
+ CHAINS_ENUM.ERA,
20
+ ];
21
+ export const getQuote = generateGetQuote({
22
+ SUPPORT_CHAINS,
23
+ id: "magpie",
24
+ dex: DEX_ENUM.MAGPIE,
25
+ });
26
+ export const decodeCalldata = (tx) => {
27
+ return null;
28
+ };
@@ -30,6 +30,7 @@ export const SUPPORT_CHAINS = [
30
30
  CHAINS_ENUM.ARBITRUM,
31
31
  CHAINS_ENUM.CRO,
32
32
  CHAINS_ENUM.BASE,
33
+ CHAINS_ENUM.GNOSIS,
33
34
  "SONIC",
34
35
  /**
35
36
  * 接口返回 swap error
@@ -13,6 +13,7 @@ export const SUPPORT_CHAINS = [
13
13
  CHAINS_ENUM.ARBITRUM,
14
14
  CHAINS_ENUM.FTM,
15
15
  CHAINS_ENUM.BASE,
16
+ CHAINS_ENUM.GNOSIS,
16
17
  // CHAINS_ENUM.PZE,
17
18
  ];
18
19
  export const getQuote = generateGetQuote({
@@ -28,12 +28,15 @@ export const SUPPORT_CHAINS = [
28
28
  // CHAINS_ENUM.BTT,
29
29
  CHAINS_ENUM.BASE,
30
30
  CHAINS_ENUM.ERA,
31
- // CHAINS_ENUM.PZE,
31
+ CHAINS_ENUM.PZE,
32
32
  // CHAINS_ENUM.ROSE,
33
33
  CHAINS_ENUM.SCRL,
34
34
  CHAINS_ENUM.MODE,
35
35
  CHAINS_ENUM.MANTLE,
36
36
  "SONIC",
37
+ CHAINS_ENUM.BLAST,
38
+ CHAINS_ENUM.METIS,
39
+ CHAINS_ENUM.MANTA,
37
40
  ];
38
41
  export const getQuote = (options) => __awaiter(void 0, void 0, void 0, function* () {
39
42
  if (!options.chainServerId || !options.nativeTokenAddress) {
package/dist/list.d.ts CHANGED
@@ -15,9 +15,13 @@ export declare const WrapTokenAddressMap: {
15
15
  AURORA: string;
16
16
  BASE: string;
17
17
  ERA: string;
18
+ PZE: string;
18
19
  SCRL: string;
19
20
  MANTLE: string;
20
21
  MODE: string;
22
+ BLAST: string;
23
+ METIS: string;
24
+ MANTA: string;
21
25
  };
22
26
  export declare const DEX_SUPPORT_CHAINS: {
23
27
  WrapToken: CHAINS_ENUM[];
@@ -29,6 +33,7 @@ export declare const DEX_SUPPORT_CHAINS: {
29
33
  ParaSwapV6: CHAINS_ENUM[];
30
34
  ODOS: CHAINS_ENUM[];
31
35
  "0xAPIV2": CHAINS_ENUM[];
36
+ Magpie: CHAINS_ENUM[];
32
37
  };
33
38
  export declare const DEX_ROUTER_WHITELIST: {
34
39
  "1inch": {
@@ -108,6 +113,7 @@ export declare const DEX_ROUTER_WHITELIST: {
108
113
  ARBITRUM: string;
109
114
  BASE: string;
110
115
  PZE: string;
116
+ GNOSIS: string;
111
117
  };
112
118
  ODOS: {
113
119
  ETH: string;
@@ -133,6 +139,23 @@ export declare const DEX_ROUTER_WHITELIST: {
133
139
  BSC: string;
134
140
  AVAX: string;
135
141
  };
142
+ Magpie: {
143
+ [x: string]: string;
144
+ ETH: string;
145
+ OP: string;
146
+ ARBITRUM: string;
147
+ BSC: string;
148
+ AVAX: string;
149
+ FTM: string;
150
+ POLYGON: string;
151
+ BASE: string;
152
+ PZE: string;
153
+ BLAST: string;
154
+ MANTA: string;
155
+ METIS: string;
156
+ SCRL: string;
157
+ ERA: string;
158
+ };
136
159
  };
137
160
  export declare const DEX_SPENDER_WHITELIST: {
138
161
  "1inch": {
@@ -213,6 +236,7 @@ export declare const DEX_SPENDER_WHITELIST: {
213
236
  ARBITRUM: string;
214
237
  BASE: string;
215
238
  PZE: string;
239
+ GNOSIS: string;
216
240
  };
217
241
  ODOS: {
218
242
  ETH: string;
@@ -238,4 +262,21 @@ export declare const DEX_SPENDER_WHITELIST: {
238
262
  BSC: string;
239
263
  AVAX: string;
240
264
  };
265
+ Magpie: {
266
+ [x: string]: string;
267
+ ETH: string;
268
+ OP: string;
269
+ ARBITRUM: string;
270
+ BSC: string;
271
+ AVAX: string;
272
+ FTM: string;
273
+ POLYGON: string;
274
+ BASE: string;
275
+ PZE: string;
276
+ BLAST: string;
277
+ MANTA: string;
278
+ METIS: string;
279
+ SCRL: string;
280
+ ERA: string;
281
+ };
241
282
  };
package/dist/list.js CHANGED
@@ -8,6 +8,7 @@ import { SUPPORT_CHAINS as kyberswapSupportChains } from "./dexs/kyberswap";
8
8
  import { SUPPORT_CHAINS as openOceanSupportChains } from "./dexs/openocean";
9
9
  import { SUPPORT_CHAINS as odosSupportChains } from "./dexs/odos";
10
10
  import { SUPPORT_CHAINS as zeroXV2SupportChains } from "./dexs/0xapi_v2";
11
+ import { SUPPORT_CHAINS as magpieSupportChains } from "./dexs/magpie";
11
12
  import { DEX_ENUM } from "./consts";
12
13
  export const WrapTokenAddressMap = {
13
14
  [CHAINS_ENUM.ETH]: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
@@ -26,11 +27,14 @@ export const WrapTokenAddressMap = {
26
27
  // [CHAINS_ENUM.ROSE]: "0x21c718c22d52d0f3a789b752d4c2fd5908a8a733",
27
28
  [CHAINS_ENUM.BASE]: "0x4200000000000000000000000000000000000006",
28
29
  [CHAINS_ENUM.ERA]: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91",
29
- // [CHAINS_ENUM.PZE]: "0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9",
30
+ [CHAINS_ENUM.PZE]: "0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9",
30
31
  [CHAINS_ENUM.SCRL]: "0x5300000000000000000000000000000000000004",
31
32
  [CHAINS_ENUM.MANTLE]: "0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8",
32
33
  [CHAINS_ENUM.MODE]: "0x4200000000000000000000000000000000000006",
33
34
  ["SONIC"]: "0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38",
35
+ [CHAINS_ENUM.BLAST]: "0x4300000000000000000000000000000000000004",
36
+ [CHAINS_ENUM.METIS]: "0x75cb093e4d61d2a2e65d8e0bbb01de8d89b53481",
37
+ [CHAINS_ENUM.MANTA]: "0x0dc808adce2099a9f62aa87d9670745aba741746",
34
38
  };
35
39
  export const DEX_SUPPORT_CHAINS = {
36
40
  [DEX_ENUM.WRAPTOKEN]: wrapTokenSupportChains,
@@ -42,6 +46,7 @@ export const DEX_SUPPORT_CHAINS = {
42
46
  [DEX_ENUM.PARASWAPV6]: paraswapV6SupportChains,
43
47
  [DEX_ENUM.ODOS]: odosSupportChains,
44
48
  [DEX_ENUM.ZEROXAPIV2]: zeroXV2SupportChains,
49
+ [DEX_ENUM.MAGPIE]: magpieSupportChains,
45
50
  };
46
51
  export const DEX_ROUTER_WHITELIST = {
47
52
  [DEX_ENUM.ONEINCH]: {
@@ -121,6 +126,7 @@ export const DEX_ROUTER_WHITELIST = {
121
126
  [CHAINS_ENUM.ARBITRUM]: "0x6A000F20005980200259B80c5102003040001068",
122
127
  [CHAINS_ENUM.BASE]: "0x6A000F20005980200259B80c5102003040001068",
123
128
  [CHAINS_ENUM.PZE]: "0x6A000F20005980200259B80c5102003040001068",
129
+ [CHAINS_ENUM.GNOSIS]: "0x6A000F20005980200259B80c5102003040001068",
124
130
  },
125
131
  [DEX_ENUM.ODOS]: {
126
132
  [CHAINS_ENUM.ETH]: "0xCf5540fFFCdC3d510B18bFcA6d2b9987b0772559",
@@ -146,6 +152,23 @@ export const DEX_ROUTER_WHITELIST = {
146
152
  [CHAINS_ENUM.BSC]: "0x0000000000001ff3684f28c67538d4d072c22734",
147
153
  [CHAINS_ENUM.AVAX]: "0x0000000000005e88410ccdfade4a5efae4b49562",
148
154
  },
155
+ [DEX_ENUM.MAGPIE]: {
156
+ [CHAINS_ENUM.ETH]: "0x15392211222b46a0ea85a9a800830486d144848d",
157
+ [CHAINS_ENUM.OP]: "0x7f68ab1d50bd4348173e957bfaf0e68b22d3ad13",
158
+ [CHAINS_ENUM.ARBITRUM]: "0x34cdce58cbdc6c54f2ac808a24561d0ab18ca8be",
159
+ [CHAINS_ENUM.BSC]: "0x15392211222b46a0ea85a9a800830486d144848d",
160
+ [CHAINS_ENUM.AVAX]: "0xf25075d95b5945bcff394588db3df8b1cacfccf6",
161
+ [CHAINS_ENUM.FTM]: "0x2b14763c27b9661182c2503f6c9c4d47ba747dd2",
162
+ [CHAINS_ENUM.POLYGON]: "0x15392211222b46a0ea85a9a800830486d144848d",
163
+ [CHAINS_ENUM.BASE]: "0xef42f78d25f4c681dcad2597fa04877ff802ef4b",
164
+ [CHAINS_ENUM.PZE]: "0xcf32c5bb41f7a302298a2d2072155800871baad3",
165
+ ["SONIC"]: "0xba7bac71a8ee550d89b827fe6d67bc3dca07b104",
166
+ [CHAINS_ENUM.BLAST]: "0x5affa5312ade198d9527acf058fee1c8ed8fe9f3",
167
+ [CHAINS_ENUM.MANTA]: "0x5affa5312ade198d9527acf058fee1c8ed8fe9f3",
168
+ [CHAINS_ENUM.METIS]: "0x2b14763c27b9661182c2503f6c9c4d47ba747dd2",
169
+ [CHAINS_ENUM.SCRL]: "0x52bebb970697476313ae2b3383f40d4afd4ad9d3",
170
+ [CHAINS_ENUM.ERA]: "0x38ae1164ca61ee7aa395bb139b3990e347988ce1",
171
+ },
149
172
  };
150
173
  export const DEX_SPENDER_WHITELIST = {
151
174
  [DEX_ENUM.ONEINCH]: {
@@ -226,6 +249,7 @@ export const DEX_SPENDER_WHITELIST = {
226
249
  [CHAINS_ENUM.ARBITRUM]: "0x6A000F20005980200259B80c5102003040001068",
227
250
  [CHAINS_ENUM.BASE]: "0x6A000F20005980200259B80c5102003040001068",
228
251
  [CHAINS_ENUM.PZE]: "0x6A000F20005980200259B80c5102003040001068",
252
+ [CHAINS_ENUM.GNOSIS]: "0x6A000F20005980200259B80c5102003040001068",
229
253
  },
230
254
  [DEX_ENUM.ODOS]: {
231
255
  [CHAINS_ENUM.ETH]: "0xCf5540fFFCdC3d510B18bFcA6d2b9987b0772559",
@@ -251,4 +275,21 @@ export const DEX_SPENDER_WHITELIST = {
251
275
  [CHAINS_ENUM.BSC]: "0x0000000000001ff3684f28c67538d4d072c22734",
252
276
  [CHAINS_ENUM.AVAX]: "0x0000000000005e88410ccdfade4a5efae4b49562",
253
277
  },
278
+ [DEX_ENUM.MAGPIE]: {
279
+ [CHAINS_ENUM.ETH]: "0x15392211222b46a0ea85a9a800830486d144848d",
280
+ [CHAINS_ENUM.OP]: "0x7f68ab1d50bd4348173e957bfaf0e68b22d3ad13",
281
+ [CHAINS_ENUM.ARBITRUM]: "0x34cdce58cbdc6c54f2ac808a24561d0ab18ca8be",
282
+ [CHAINS_ENUM.BSC]: "0x15392211222b46a0ea85a9a800830486d144848d",
283
+ [CHAINS_ENUM.AVAX]: "0xf25075d95b5945bcff394588db3df8b1cacfccf6",
284
+ [CHAINS_ENUM.FTM]: "0x2b14763c27b9661182c2503f6c9c4d47ba747dd2",
285
+ [CHAINS_ENUM.POLYGON]: "0x15392211222b46a0ea85a9a800830486d144848d",
286
+ [CHAINS_ENUM.BASE]: "0xef42f78d25f4c681dcad2597fa04877ff802ef4b",
287
+ [CHAINS_ENUM.PZE]: "0xcf32c5bb41f7a302298a2d2072155800871baad3",
288
+ ["SONIC"]: "0xba7bac71a8ee550d89b827fe6d67bc3dca07b104",
289
+ [CHAINS_ENUM.BLAST]: "0x5affa5312ade198d9527acf058fee1c8ed8fe9f3",
290
+ [CHAINS_ENUM.MANTA]: "0x5affa5312ade198d9527acf058fee1c8ed8fe9f3",
291
+ [CHAINS_ENUM.METIS]: "0x2b14763c27b9661182c2503f6c9c4d47ba747dd2",
292
+ [CHAINS_ENUM.SCRL]: "0x52bebb970697476313ae2b3383f40d4afd4ad9d3",
293
+ [CHAINS_ENUM.ERA]: "0x38ae1164ca61ee7aa395bb139b3990e347988ce1",
294
+ },
254
295
  };
package/dist/quote.js CHANGED
@@ -18,6 +18,7 @@ import { getQuote as kyberswapGetQuote, decodeCalldata as kyberswapDecodeCalldat
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
20
  import { getQuote as zeroXV2GetQuote, decodeCalldata as zeroXV2DecodeCalldata, } from "./dexs/0xapi_v2";
21
+ import { getQuote as magpieGetQuote, decodeCalldata as magpieDecodeCalldata, } from "./dexs/magpie";
21
22
  export const getQuote = (id, params, api) => __awaiter(void 0, void 0, void 0, function* () {
22
23
  switch (id) {
23
24
  case DEX_ENUM.WRAPTOKEN:
@@ -40,6 +41,8 @@ export const getQuote = (id, params, api) => __awaiter(void 0, void 0, void 0, f
40
41
  return yield odosGetQuote(params, api);
41
42
  case DEX_ENUM.ZEROXAPIV2:
42
43
  return yield zeroXV2GetQuote(params, api);
44
+ case DEX_ENUM.MAGPIE:
45
+ return yield magpieGetQuote(params, api);
43
46
  default:
44
47
  throw new Error(`${id} is not supported!`);
45
48
  }
@@ -64,6 +67,8 @@ export const decodeCalldata = (id, tx) => {
64
67
  return odosDecodeCalldata(tx);
65
68
  case DEX_ENUM.ZEROXAPIV2:
66
69
  return zeroXV2DecodeCalldata(tx);
70
+ case DEX_ENUM.MAGPIE:
71
+ return magpieDecodeCalldata(tx);
67
72
  default:
68
73
  throw new Error(`${id} is not supported!`);
69
74
  }
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" | "matcha_v2" | "openocean" | "1inch_v6" | "paraswap" | "kyberswap" | "odos" | "paraswap_v6";
8
+ id: "uniswap3" | "matcha" | "matcha_v2" | "openocean" | "1inch_v6" | "paraswap" | "kyberswap" | "odos" | "paraswap_v6" | "magpie";
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.45",
3
+ "version": "0.0.46-alpha.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {