@rabby-wallet/rabby-swap 0.0.88-alpha.1 → 0.0.88-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 +2 -1
- package/dist/consts.js +1 -0
- package/dist/dexs/1inch.js +5 -0
- package/dist/dexs/pancake.d.ts +5 -0
- package/dist/dexs/pancake.js +17 -0
- package/dist/list.d.ts +15 -0
- package/dist/list.js +24 -0
- package/dist/quote.js +5 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
package/dist/consts.d.ts
CHANGED
package/dist/consts.js
CHANGED
package/dist/dexs/1inch.js
CHANGED
|
@@ -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,17 @@
|
|
|
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.BSC,
|
|
7
|
+
CHAINS_ENUM.BASE,
|
|
8
|
+
"HOOD",
|
|
9
|
+
];
|
|
10
|
+
export const getQuote = generateGetQuote({
|
|
11
|
+
SUPPORT_CHAINS,
|
|
12
|
+
id: "pancake",
|
|
13
|
+
dex: DEX_ENUM.PANCAKESWAP,
|
|
14
|
+
});
|
|
15
|
+
export const decodeCalldata = (tx) => {
|
|
16
|
+
return null;
|
|
17
|
+
};
|
package/dist/list.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export declare const DEX_SUPPORT_CHAINS: {
|
|
|
43
43
|
Magpie: CHAINS_ENUM[];
|
|
44
44
|
Rabby: CHAINS_ENUM[];
|
|
45
45
|
Uniswap: CHAINS_ENUM[];
|
|
46
|
+
PancakeSwap: CHAINS_ENUM[];
|
|
46
47
|
};
|
|
47
48
|
export declare const DEX_ROUTER_WHITELIST: {
|
|
48
49
|
Sushi: {
|
|
@@ -84,6 +85,7 @@ export declare const DEX_ROUTER_WHITELIST: {
|
|
|
84
85
|
BASE: string;
|
|
85
86
|
ERA: string;
|
|
86
87
|
LINEA: string;
|
|
88
|
+
CRO: string;
|
|
87
89
|
};
|
|
88
90
|
ParaSwap: {
|
|
89
91
|
ETH: string;
|
|
@@ -224,6 +226,12 @@ export declare const DEX_ROUTER_WHITELIST: {
|
|
|
224
226
|
CELO: string;
|
|
225
227
|
ERA: string;
|
|
226
228
|
};
|
|
229
|
+
PancakeSwap: {
|
|
230
|
+
[x: string]: string;
|
|
231
|
+
ETH: string;
|
|
232
|
+
BSC: string;
|
|
233
|
+
BASE: string;
|
|
234
|
+
};
|
|
227
235
|
};
|
|
228
236
|
export declare const DEX_SPENDER_WHITELIST: {
|
|
229
237
|
Sushi: {
|
|
@@ -265,6 +273,7 @@ export declare const DEX_SPENDER_WHITELIST: {
|
|
|
265
273
|
BASE: string;
|
|
266
274
|
ERA: string;
|
|
267
275
|
LINEA: string;
|
|
276
|
+
CRO: string;
|
|
268
277
|
};
|
|
269
278
|
ParaSwap: {
|
|
270
279
|
ETH: string;
|
|
@@ -406,4 +415,10 @@ export declare const DEX_SPENDER_WHITELIST: {
|
|
|
406
415
|
CELO: string;
|
|
407
416
|
ERA: string;
|
|
408
417
|
};
|
|
418
|
+
PancakeSwap: {
|
|
419
|
+
[x: string]: string;
|
|
420
|
+
ETH: string;
|
|
421
|
+
BSC: string;
|
|
422
|
+
BASE: string;
|
|
423
|
+
};
|
|
409
424
|
};
|
package/dist/list.js
CHANGED
|
@@ -11,6 +11,7 @@ import { SUPPORT_CHAINS as magpieSupportChains } from "./dexs/magpie";
|
|
|
11
11
|
import { SUPPORT_CHAINS as rabbySupportChains } from "./dexs/rabby";
|
|
12
12
|
import { SUPPORT_CHAINS as sushiSupportChains } from "./dexs/sushi";
|
|
13
13
|
import { SUPPORT_CHAINS as uniSupportChains } from "./dexs/uni";
|
|
14
|
+
import { SUPPORT_CHAINS as pancakeSupportChains } from "./dexs/pancake";
|
|
14
15
|
import { DEX_ENUM } from "./consts";
|
|
15
16
|
export const WrapTokenAddressMap = {
|
|
16
17
|
[CHAINS_ENUM.ETH]: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
|
|
@@ -77,6 +78,7 @@ export const DEX_SUPPORT_CHAINS = {
|
|
|
77
78
|
[DEX_ENUM.MAGPIE]: magpieSupportChains,
|
|
78
79
|
[DEX_ENUM.RABBY]: rabbySupportChains,
|
|
79
80
|
[DEX_ENUM.UNI]: uniSupportChains,
|
|
81
|
+
[DEX_ENUM.PANCAKESWAP]: pancakeSupportChains,
|
|
80
82
|
};
|
|
81
83
|
export const DEX_ROUTER_WHITELIST = {
|
|
82
84
|
[DEX_ENUM.SUSHI]: {
|
|
@@ -130,6 +132,11 @@ export const DEX_ROUTER_WHITELIST = {
|
|
|
130
132
|
[CHAINS_ENUM.LINEA]: "0x111111125421ca6dc452d289314280a0f8842a65",
|
|
131
133
|
["HOOD"]: "0x5A705DE8982235a7fa45bB83dCaCf03a211389C7",
|
|
132
134
|
["ARC"]: "0xE08CAb0828a67291EC4Af1FB3e7f867e206A6bdA",
|
|
135
|
+
[CHAINS_ENUM.CRO]: "0x111111125421ca6dc452d289314280a0f8842a65",
|
|
136
|
+
["UNI"]: "0x111111125421ca6dc452d289314280a0f8842a65",
|
|
137
|
+
["MONAD"]: "0x111111125421ca6dc452d289314280a0f8842a65",
|
|
138
|
+
["SONIC"]: "0x111111125421ca6dc452d289314280a0f8842a65",
|
|
139
|
+
["HYPER"]: "0x5281602adc446a94eb48d055f514a6d8d5bee176",
|
|
133
140
|
},
|
|
134
141
|
[DEX_ENUM.PARASWAP]: {
|
|
135
142
|
[CHAINS_ENUM.ETH]: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
|
|
@@ -310,6 +317,12 @@ export const DEX_ROUTER_WHITELIST = {
|
|
|
310
317
|
["HOOD"]: "0x02E5be68D46DAc0B524905bfF209cf47EE6dB2a9",
|
|
311
318
|
["ARC"]: "0x02E5be68D46DAc0B524905bfF209cf47EE6dB2a9",
|
|
312
319
|
},
|
|
320
|
+
[DEX_ENUM.PANCAKESWAP]: {
|
|
321
|
+
[CHAINS_ENUM.ETH]: "0x2f68417A18dA681589F4eA64B9Cc9839209acfF7",
|
|
322
|
+
[CHAINS_ENUM.BSC]: "0x2f68417A18dA681589F4eA64B9Cc9839209acfF7",
|
|
323
|
+
[CHAINS_ENUM.BASE]: "0x2f68417A18dA681589F4eA64B9Cc9839209acfF7",
|
|
324
|
+
["HOOD"]: "0x6AF306Cd8Be7CEfd38edf4cB7D6FE83A6E29661B",
|
|
325
|
+
},
|
|
313
326
|
};
|
|
314
327
|
export const DEX_SPENDER_WHITELIST = {
|
|
315
328
|
[DEX_ENUM.SUSHI]: {
|
|
@@ -363,6 +376,11 @@ export const DEX_SPENDER_WHITELIST = {
|
|
|
363
376
|
[CHAINS_ENUM.LINEA]: "0x111111125421ca6dc452d289314280a0f8842a65",
|
|
364
377
|
["HOOD"]: "0x5A705DE8982235a7fa45bB83dCaCf03a211389C7",
|
|
365
378
|
["ARC"]: "0xE08CAb0828a67291EC4Af1FB3e7f867e206A6bdA",
|
|
379
|
+
[CHAINS_ENUM.CRO]: "0x111111125421ca6dc452d289314280a0f8842a65",
|
|
380
|
+
["UNI"]: "0x111111125421ca6dc452d289314280a0f8842a65",
|
|
381
|
+
["MONAD"]: "0x111111125421ca6dc452d289314280a0f8842a65",
|
|
382
|
+
["SONIC"]: "0x111111125421ca6dc452d289314280a0f8842a65",
|
|
383
|
+
["HYPER"]: "0x5281602adc446a94eb48d055f514a6d8d5bee176",
|
|
366
384
|
},
|
|
367
385
|
[DEX_ENUM.PARASWAP]: {
|
|
368
386
|
[CHAINS_ENUM.ETH]: "0x216b4b4ba9f3e719726886d34a177484278bfcae",
|
|
@@ -544,4 +562,10 @@ export const DEX_SPENDER_WHITELIST = {
|
|
|
544
562
|
["HOOD"]: "0x02E5be68D46DAc0B524905bfF209cf47EE6dB2a9",
|
|
545
563
|
["ARC"]: "0x02E5be68D46DAc0B524905bfF209cf47EE6dB2a9",
|
|
546
564
|
},
|
|
565
|
+
[DEX_ENUM.PANCAKESWAP]: {
|
|
566
|
+
[CHAINS_ENUM.ETH]: "0x2f68417A18dA681589F4eA64B9Cc9839209acfF7",
|
|
567
|
+
[CHAINS_ENUM.BSC]: "0x2f68417A18dA681589F4eA64B9Cc9839209acfF7",
|
|
568
|
+
[CHAINS_ENUM.BASE]: "0x2f68417A18dA681589F4eA64B9Cc9839209acfF7",
|
|
569
|
+
["HOOD"]: "0x6AF306Cd8Be7CEfd38edf4cB7D6FE83A6E29661B",
|
|
570
|
+
},
|
|
547
571
|
};
|
package/dist/quote.js
CHANGED
|
@@ -21,6 +21,7 @@ import { getQuote as magpieGetQuote, decodeCalldata as magpieDecodeCalldata, } f
|
|
|
21
21
|
import { getQuote as rabbyGetQuote, decodeCalldata as rabbyDecodeCalldata, } from "./dexs/rabby";
|
|
22
22
|
import { getQuote as uniGetQuote, decodeCalldata as uniDecodeCalldata, } from "./dexs/uni";
|
|
23
23
|
import { getQuote as sushiGetQuote, decodeCalldata as sushiDecodeCalldata, } from "./dexs/sushi";
|
|
24
|
+
import { getQuote as pancakeGetQuote, decodeCalldata as pancakeDecodeCalldata, } from "./dexs/pancake";
|
|
24
25
|
export const getQuote = (id, params, api) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
26
|
switch (id) {
|
|
26
27
|
case DEX_ENUM.WRAPTOKEN:
|
|
@@ -49,6 +50,8 @@ export const getQuote = (id, params, api) => __awaiter(void 0, void 0, void 0, f
|
|
|
49
50
|
return yield sushiGetQuote(params, api);
|
|
50
51
|
case DEX_ENUM.UNI:
|
|
51
52
|
return yield uniGetQuote(params, api);
|
|
53
|
+
case DEX_ENUM.PANCAKESWAP:
|
|
54
|
+
return yield pancakeGetQuote(params, api);
|
|
52
55
|
default:
|
|
53
56
|
throw new Error(`${id} is not supported!`);
|
|
54
57
|
}
|
|
@@ -79,6 +82,8 @@ export const decodeCalldata = (id, tx, options = {}) => {
|
|
|
79
82
|
return sushiDecodeCalldata(tx);
|
|
80
83
|
case DEX_ENUM.UNI:
|
|
81
84
|
return uniDecodeCalldata(tx, options);
|
|
85
|
+
case DEX_ENUM.PANCAKESWAP:
|
|
86
|
+
return pancakeDecodeCalldata(tx);
|
|
82
87
|
default:
|
|
83
88
|
throw new Error(`${id} is not supported!`);
|
|
84
89
|
}
|
package/dist/utils.d.ts
CHANGED
|
@@ -16,6 +16,6 @@ export declare const resolveSwapTxValue: ({ dex, chain, fromToken, payTokenId, n
|
|
|
16
16
|
}) => string;
|
|
17
17
|
export declare const generateGetQuote: ({ SUPPORT_CHAINS, id, dex, }: {
|
|
18
18
|
SUPPORT_CHAINS: CHAINS_ENUM[];
|
|
19
|
-
id: "matcha" | "matcha_v2" | "openocean" | "1inch_v6" | "paraswap" | "kyberswap" | "odos" | "paraswap_v6" | "magpie" | "sushi" | "rabby" | "uni";
|
|
19
|
+
id: "matcha" | "matcha_v2" | "openocean" | "1inch_v6" | "paraswap" | "kyberswap" | "odos" | "paraswap_v6" | "magpie" | "sushi" | "rabby" | "uni" | "pancake";
|
|
20
20
|
dex: DEX_ENUM;
|
|
21
21
|
}) => (options: QuoteParams, api: OpenApiService) => Promise<QuoteResult>;
|
package/dist/utils.js
CHANGED
|
@@ -36,7 +36,7 @@ export const generateGetQuote = ({ SUPPORT_CHAINS, id, dex, }) => (options, api)
|
|
|
36
36
|
const params = {
|
|
37
37
|
id: options.userAddress,
|
|
38
38
|
chain_id: options.chainServerId,
|
|
39
|
-
dex_id: options.chain === CHAINS_ENUM.ETH
|
|
39
|
+
dex_id: options.chain === CHAINS_ENUM.ETH && dex !== DEX_ENUM.PANCAKESWAP
|
|
40
40
|
? id
|
|
41
41
|
: `${options.chainServerId}_${id}`,
|
|
42
42
|
pay_token_id: options.fromToken,
|