@rabby-wallet/rabby-swap 0.0.46 → 0.0.47-alpha.1
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/uniswap_api.d.ts +5 -0
- package/dist/dexs/uniswap_api.js +23 -0
- package/dist/list.d.ts +30 -0
- package/dist/list.js +31 -0
- package/dist/quote.js +5 -0
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
package/dist/consts.d.ts
CHANGED
package/dist/consts.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,23 @@
|
|
|
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.POLYGON,
|
|
11
|
+
CHAINS_ENUM.BASE,
|
|
12
|
+
CHAINS_ENUM.BLAST,
|
|
13
|
+
CHAINS_ENUM.ERA,
|
|
14
|
+
CHAINS_ENUM.CELO,
|
|
15
|
+
];
|
|
16
|
+
export const getQuote = generateGetQuote({
|
|
17
|
+
SUPPORT_CHAINS,
|
|
18
|
+
id: "uni",
|
|
19
|
+
dex: DEX_ENUM.UNISWAP_API,
|
|
20
|
+
});
|
|
21
|
+
export const decodeCalldata = (tx) => {
|
|
22
|
+
return null;
|
|
23
|
+
};
|
package/dist/list.d.ts
CHANGED
|
@@ -22,6 +22,11 @@ export declare const WrapTokenAddressMap: {
|
|
|
22
22
|
BLAST: string;
|
|
23
23
|
METIS: string;
|
|
24
24
|
MANTA: string;
|
|
25
|
+
/**
|
|
26
|
+
* celo 0x471EcE3750Da237f93B8E339c536989b8978a438
|
|
27
|
+
* does not support wrap token
|
|
28
|
+
*/
|
|
29
|
+
CELO: string;
|
|
25
30
|
};
|
|
26
31
|
export declare const DEX_SUPPORT_CHAINS: {
|
|
27
32
|
WrapToken: CHAINS_ENUM[];
|
|
@@ -34,6 +39,7 @@ export declare const DEX_SUPPORT_CHAINS: {
|
|
|
34
39
|
ODOS: CHAINS_ENUM[];
|
|
35
40
|
"0xAPIV2": CHAINS_ENUM[];
|
|
36
41
|
Magpie: CHAINS_ENUM[];
|
|
42
|
+
UniswapAPi: CHAINS_ENUM[];
|
|
37
43
|
};
|
|
38
44
|
export declare const DEX_ROUTER_WHITELIST: {
|
|
39
45
|
"1inch": {
|
|
@@ -156,6 +162,18 @@ export declare const DEX_ROUTER_WHITELIST: {
|
|
|
156
162
|
SCRL: string;
|
|
157
163
|
ERA: string;
|
|
158
164
|
};
|
|
165
|
+
UniswapAPi: {
|
|
166
|
+
ETH: string;
|
|
167
|
+
OP: string;
|
|
168
|
+
ARBITRUM: string;
|
|
169
|
+
BSC: string;
|
|
170
|
+
AVAX: string;
|
|
171
|
+
POLYGON: string;
|
|
172
|
+
BASE: string;
|
|
173
|
+
BLAST: string;
|
|
174
|
+
ERA: string;
|
|
175
|
+
CELO: string;
|
|
176
|
+
};
|
|
159
177
|
};
|
|
160
178
|
export declare const DEX_SPENDER_WHITELIST: {
|
|
161
179
|
"1inch": {
|
|
@@ -279,4 +297,16 @@ export declare const DEX_SPENDER_WHITELIST: {
|
|
|
279
297
|
SCRL: string;
|
|
280
298
|
ERA: string;
|
|
281
299
|
};
|
|
300
|
+
UniswapAPi: {
|
|
301
|
+
ETH: string;
|
|
302
|
+
OP: string;
|
|
303
|
+
ARBITRUM: string;
|
|
304
|
+
BSC: string;
|
|
305
|
+
AVAX: string;
|
|
306
|
+
POLYGON: string;
|
|
307
|
+
BASE: string;
|
|
308
|
+
BLAST: string;
|
|
309
|
+
ERA: string;
|
|
310
|
+
CELO: string;
|
|
311
|
+
};
|
|
282
312
|
};
|
package/dist/list.js
CHANGED
|
@@ -9,6 +9,7 @@ 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
11
|
import { SUPPORT_CHAINS as magpieSupportChains } from "./dexs/magpie";
|
|
12
|
+
import { SUPPORT_CHAINS as uniswapApiSupportChains } from "./dexs/uniswap_api";
|
|
12
13
|
import { DEX_ENUM } from "./consts";
|
|
13
14
|
export const WrapTokenAddressMap = {
|
|
14
15
|
[CHAINS_ENUM.ETH]: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
|
|
@@ -35,6 +36,11 @@ export const WrapTokenAddressMap = {
|
|
|
35
36
|
[CHAINS_ENUM.BLAST]: "0x4300000000000000000000000000000000000004",
|
|
36
37
|
[CHAINS_ENUM.METIS]: "0x75cb093e4d61d2a2e65d8e0bbb01de8d89b53481",
|
|
37
38
|
[CHAINS_ENUM.MANTA]: "0x0dc808adce2099a9f62aa87d9670745aba741746",
|
|
39
|
+
/**
|
|
40
|
+
* celo 0x471EcE3750Da237f93B8E339c536989b8978a438
|
|
41
|
+
* does not support wrap token
|
|
42
|
+
*/
|
|
43
|
+
[CHAINS_ENUM.CELO]: " ",
|
|
38
44
|
};
|
|
39
45
|
export const DEX_SUPPORT_CHAINS = {
|
|
40
46
|
[DEX_ENUM.WRAPTOKEN]: wrapTokenSupportChains,
|
|
@@ -47,6 +53,7 @@ export const DEX_SUPPORT_CHAINS = {
|
|
|
47
53
|
[DEX_ENUM.ODOS]: odosSupportChains,
|
|
48
54
|
[DEX_ENUM.ZEROXAPIV2]: zeroXV2SupportChains,
|
|
49
55
|
[DEX_ENUM.MAGPIE]: magpieSupportChains,
|
|
56
|
+
[DEX_ENUM.UNISWAP_API]: uniswapApiSupportChains,
|
|
50
57
|
};
|
|
51
58
|
export const DEX_ROUTER_WHITELIST = {
|
|
52
59
|
[DEX_ENUM.ONEINCH]: {
|
|
@@ -169,6 +176,18 @@ export const DEX_ROUTER_WHITELIST = {
|
|
|
169
176
|
[CHAINS_ENUM.SCRL]: "0x52bebb970697476313ae2b3383f40d4afd4ad9d3",
|
|
170
177
|
[CHAINS_ENUM.ERA]: "0x38ae1164ca61ee7aa395bb139b3990e347988ce1",
|
|
171
178
|
},
|
|
179
|
+
[DEX_ENUM.UNISWAP_API]: {
|
|
180
|
+
[CHAINS_ENUM.ETH]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
181
|
+
[CHAINS_ENUM.OP]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
182
|
+
[CHAINS_ENUM.ARBITRUM]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
183
|
+
[CHAINS_ENUM.BSC]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
184
|
+
[CHAINS_ENUM.AVAX]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
185
|
+
[CHAINS_ENUM.POLYGON]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
186
|
+
[CHAINS_ENUM.BASE]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
187
|
+
[CHAINS_ENUM.BLAST]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
188
|
+
[CHAINS_ENUM.ERA]: "0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06",
|
|
189
|
+
[CHAINS_ENUM.CELO]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
190
|
+
},
|
|
172
191
|
};
|
|
173
192
|
export const DEX_SPENDER_WHITELIST = {
|
|
174
193
|
[DEX_ENUM.ONEINCH]: {
|
|
@@ -292,4 +311,16 @@ export const DEX_SPENDER_WHITELIST = {
|
|
|
292
311
|
[CHAINS_ENUM.SCRL]: "0x52bebb970697476313ae2b3383f40d4afd4ad9d3",
|
|
293
312
|
[CHAINS_ENUM.ERA]: "0x38ae1164ca61ee7aa395bb139b3990e347988ce1",
|
|
294
313
|
},
|
|
314
|
+
[DEX_ENUM.UNISWAP_API]: {
|
|
315
|
+
[CHAINS_ENUM.ETH]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
316
|
+
[CHAINS_ENUM.OP]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
317
|
+
[CHAINS_ENUM.ARBITRUM]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
318
|
+
[CHAINS_ENUM.BSC]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
319
|
+
[CHAINS_ENUM.AVAX]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
320
|
+
[CHAINS_ENUM.POLYGON]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
321
|
+
[CHAINS_ENUM.BASE]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
322
|
+
[CHAINS_ENUM.BLAST]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
323
|
+
[CHAINS_ENUM.ERA]: "0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06",
|
|
324
|
+
[CHAINS_ENUM.CELO]: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
325
|
+
},
|
|
295
326
|
};
|
package/dist/quote.js
CHANGED
|
@@ -19,6 +19,7 @@ import { getQuote as paraSwapV6GetQuote, decodeCalldata as paraSwapV6DecodeCalld
|
|
|
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
21
|
import { getQuote as magpieGetQuote, decodeCalldata as magpieDecodeCalldata, } from "./dexs/magpie";
|
|
22
|
+
import { getQuote as uniswapApiGetQuote, decodeCalldata as uniswapApiDecodeCalldata, } from "./dexs/uniswap_api";
|
|
22
23
|
export const getQuote = (id, params, api) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
24
|
switch (id) {
|
|
24
25
|
case DEX_ENUM.WRAPTOKEN:
|
|
@@ -43,6 +44,8 @@ export const getQuote = (id, params, api) => __awaiter(void 0, void 0, void 0, f
|
|
|
43
44
|
return yield zeroXV2GetQuote(params, api);
|
|
44
45
|
case DEX_ENUM.MAGPIE:
|
|
45
46
|
return yield magpieGetQuote(params, api);
|
|
47
|
+
case DEX_ENUM.UNISWAP_API:
|
|
48
|
+
return yield uniswapApiGetQuote(params, api);
|
|
46
49
|
default:
|
|
47
50
|
throw new Error(`${id} is not supported!`);
|
|
48
51
|
}
|
|
@@ -69,6 +72,8 @@ export const decodeCalldata = (id, tx) => {
|
|
|
69
72
|
return zeroXV2DecodeCalldata(tx);
|
|
70
73
|
case DEX_ENUM.MAGPIE:
|
|
71
74
|
return magpieDecodeCalldata(tx);
|
|
75
|
+
case DEX_ENUM.UNISWAP_API:
|
|
76
|
+
return uniswapApiDecodeCalldata(tx);
|
|
72
77
|
default:
|
|
73
78
|
throw new Error(`${id} is not supported!`);
|
|
74
79
|
}
|
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" | "magpie";
|
|
8
|
+
id: "uniswap3" | "matcha" | "matcha_v2" | "openocean" | "1inch_v6" | "paraswap" | "kyberswap" | "odos" | "paraswap_v6" | "magpie" | "uni";
|
|
9
9
|
dex: DEX_ENUM;
|
|
10
10
|
}) => (options: QuoteParams, api: OpenApiService) => Promise<QuoteResult>;
|