@swapkit/core 1.0.0-rc.12 → 1.0.0-rc.120
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/index.js +7324 -0
- package/dist/index.js.map +41 -0
- package/package.json +33 -47
- package/src/__tests__/helpers.test.ts +53 -0
- package/src/aggregator/contracts/avaxGeneric.ts +50 -50
- package/src/aggregator/contracts/avaxWoofi.ts +80 -80
- package/src/aggregator/contracts/bscGeneric.ts +59 -59
- package/src/aggregator/contracts/ethGeneric.ts +50 -50
- package/src/aggregator/contracts/index.ts +30 -28
- package/src/aggregator/contracts/pancakeV2.ts +80 -80
- package/src/aggregator/contracts/pangolin.ts +65 -65
- package/src/aggregator/contracts/routers/index.ts +58 -0
- package/src/aggregator/contracts/routers/kyber.ts +402 -0
- package/src/aggregator/contracts/routers/oneinch.ts +2188 -0
- package/src/aggregator/contracts/routers/pancakeswap.ts +340 -0
- package/src/aggregator/contracts/routers/pangolin.ts +340 -0
- package/src/aggregator/contracts/routers/sushiswap.ts +340 -0
- package/src/aggregator/contracts/routers/traderJoe.ts +340 -0
- package/src/aggregator/contracts/routers/uniswapv2.ts +340 -0
- package/src/aggregator/contracts/routers/uniswapv3.ts +254 -0
- package/src/aggregator/contracts/routers/woofi.ts +171 -0
- package/src/aggregator/contracts/sushiswap.ts +65 -65
- package/src/aggregator/contracts/traderJoe.ts +65 -65
- package/src/aggregator/contracts/uniswapV2.ts +65 -65
- package/src/aggregator/contracts/uniswapV2Leg.ts +70 -70
- package/src/aggregator/contracts/uniswapV3_100.ts +70 -70
- package/src/aggregator/contracts/uniswapV3_10000.ts +70 -70
- package/src/aggregator/contracts/uniswapV3_3000.ts +70 -70
- package/src/aggregator/contracts/uniswapV3_500.ts +70 -70
- package/src/aggregator/getSwapParams.ts +12 -12
- package/src/client/index.ts +206 -646
- package/src/client/old.ts +854 -0
- package/src/helpers/explorerUrls.ts +38 -0
- package/src/index.ts +6 -4
- package/src/types.ts +149 -0
- package/LICENSE +0 -201
- package/dist/index-9e36735e.cjs +0 -1
- package/dist/index-cf1865cd.js +0 -649
- package/dist/index.cjs +0 -2
- package/dist/index.d.ts +0 -216
- package/dist/index.es.js +0 -3818
- package/src/client/__tests__/helpers.test.ts +0 -69
- package/src/client/explorerUrls.ts +0 -62
- package/src/client/thornode.ts +0 -31
- package/src/client/types.ts +0 -103
|
@@ -1,106 +1,106 @@
|
|
|
1
1
|
export const bscGeneric = [
|
|
2
2
|
{
|
|
3
|
-
inputs: [{ internalType:
|
|
4
|
-
stateMutability:
|
|
5
|
-
type:
|
|
3
|
+
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
4
|
+
stateMutability: "nonpayable",
|
|
5
|
+
type: "constructor",
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
8
|
anonymous: false,
|
|
9
9
|
inputs: [
|
|
10
|
-
{ indexed: false, internalType:
|
|
11
|
-
{ indexed: false, internalType:
|
|
10
|
+
{ indexed: false, internalType: "uint256", name: "fee", type: "uint256" },
|
|
11
|
+
{ indexed: false, internalType: "address", name: "feeRecipient", type: "address" },
|
|
12
12
|
],
|
|
13
|
-
name:
|
|
14
|
-
type:
|
|
13
|
+
name: "FeeSet",
|
|
14
|
+
type: "event",
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
anonymous: false,
|
|
18
18
|
inputs: [
|
|
19
|
-
{ indexed: true, internalType:
|
|
20
|
-
{ indexed: false, internalType:
|
|
19
|
+
{ indexed: true, internalType: "address", name: "owner", type: "address" },
|
|
20
|
+
{ indexed: false, internalType: "bool", name: "active", type: "bool" },
|
|
21
21
|
],
|
|
22
|
-
name:
|
|
23
|
-
type:
|
|
22
|
+
name: "OwnerSet",
|
|
23
|
+
type: "event",
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
anonymous: false,
|
|
27
27
|
inputs: [
|
|
28
|
-
{ indexed: false, internalType:
|
|
29
|
-
{ indexed: false, internalType:
|
|
30
|
-
{ indexed: false, internalType:
|
|
31
|
-
{ indexed: false, internalType:
|
|
32
|
-
{ indexed: false, internalType:
|
|
33
|
-
{ indexed: false, internalType:
|
|
34
|
-
{ indexed: false, internalType:
|
|
28
|
+
{ indexed: false, internalType: "address", name: "from", type: "address" },
|
|
29
|
+
{ indexed: false, internalType: "address", name: "token", type: "address" },
|
|
30
|
+
{ indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
|
|
31
|
+
{ indexed: false, internalType: "uint256", name: "out", type: "uint256" },
|
|
32
|
+
{ indexed: false, internalType: "uint256", name: "fee", type: "uint256" },
|
|
33
|
+
{ indexed: false, internalType: "address", name: "vault", type: "address" },
|
|
34
|
+
{ indexed: false, internalType: "string", name: "memo", type: "string" },
|
|
35
35
|
],
|
|
36
|
-
name:
|
|
37
|
-
type:
|
|
36
|
+
name: "SwapIn",
|
|
37
|
+
type: "event",
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
inputs: [],
|
|
41
|
-
name:
|
|
42
|
-
outputs: [{ internalType:
|
|
43
|
-
stateMutability:
|
|
44
|
-
type:
|
|
41
|
+
name: "fee",
|
|
42
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
43
|
+
stateMutability: "view",
|
|
44
|
+
type: "function",
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
inputs: [],
|
|
48
|
-
name:
|
|
49
|
-
outputs: [{ internalType:
|
|
50
|
-
stateMutability:
|
|
51
|
-
type:
|
|
48
|
+
name: "feeRecipient",
|
|
49
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
50
|
+
stateMutability: "view",
|
|
51
|
+
type: "function",
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
|
-
inputs: [{ internalType:
|
|
55
|
-
name:
|
|
56
|
-
outputs: [{ internalType:
|
|
57
|
-
stateMutability:
|
|
58
|
-
type:
|
|
54
|
+
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
55
|
+
name: "owners",
|
|
56
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
57
|
+
stateMutability: "view",
|
|
58
|
+
type: "function",
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
inputs: [
|
|
62
|
-
{ internalType:
|
|
63
|
-
{ internalType:
|
|
62
|
+
{ internalType: "uint256", name: "_fee", type: "uint256" },
|
|
63
|
+
{ internalType: "address", name: "_feeRecipient", type: "address" },
|
|
64
64
|
],
|
|
65
|
-
name:
|
|
65
|
+
name: "setFee",
|
|
66
66
|
outputs: [],
|
|
67
|
-
stateMutability:
|
|
68
|
-
type:
|
|
67
|
+
stateMutability: "nonpayable",
|
|
68
|
+
type: "function",
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
inputs: [
|
|
72
|
-
{ internalType:
|
|
73
|
-
{ internalType:
|
|
72
|
+
{ internalType: "address", name: "owner", type: "address" },
|
|
73
|
+
{ internalType: "bool", name: "active", type: "bool" },
|
|
74
74
|
],
|
|
75
|
-
name:
|
|
75
|
+
name: "setOwner",
|
|
76
76
|
outputs: [],
|
|
77
|
-
stateMutability:
|
|
78
|
-
type:
|
|
77
|
+
stateMutability: "nonpayable",
|
|
78
|
+
type: "function",
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
inputs: [
|
|
82
|
-
{ internalType:
|
|
83
|
-
{ internalType:
|
|
84
|
-
{ internalType:
|
|
85
|
-
{ internalType:
|
|
86
|
-
{ internalType:
|
|
87
|
-
{ internalType:
|
|
88
|
-
{ internalType:
|
|
89
|
-
{ internalType:
|
|
82
|
+
{ internalType: "address", name: "router", type: "address" },
|
|
83
|
+
{ internalType: "address", name: "vault", type: "address" },
|
|
84
|
+
{ internalType: "string", name: "memo", type: "string" },
|
|
85
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
86
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
87
|
+
{ internalType: "address", name: "swapRouter", type: "address" },
|
|
88
|
+
{ internalType: "bytes", name: "data", type: "bytes" },
|
|
89
|
+
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
|
90
90
|
],
|
|
91
|
-
name:
|
|
91
|
+
name: "swapIn",
|
|
92
92
|
outputs: [],
|
|
93
|
-
stateMutability:
|
|
94
|
-
type:
|
|
93
|
+
stateMutability: "nonpayable",
|
|
94
|
+
type: "function",
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
97
|
inputs: [],
|
|
98
|
-
name:
|
|
98
|
+
name: "tokenTransferProxy",
|
|
99
99
|
outputs: [
|
|
100
|
-
{ internalType:
|
|
100
|
+
{ internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" },
|
|
101
101
|
],
|
|
102
|
-
stateMutability:
|
|
103
|
-
type:
|
|
102
|
+
stateMutability: "view",
|
|
103
|
+
type: "function",
|
|
104
104
|
},
|
|
105
|
-
{ stateMutability:
|
|
105
|
+
{ stateMutability: "payable", type: "receive" },
|
|
106
106
|
];
|
|
@@ -1,92 +1,92 @@
|
|
|
1
1
|
export const ethGeneric = [
|
|
2
2
|
{
|
|
3
|
-
inputs: [{ internalType:
|
|
4
|
-
stateMutability:
|
|
5
|
-
type:
|
|
3
|
+
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
4
|
+
stateMutability: "nonpayable",
|
|
5
|
+
type: "constructor",
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
8
|
anonymous: false,
|
|
9
9
|
inputs: [
|
|
10
|
-
{ indexed: false, internalType:
|
|
11
|
-
{ indexed: false, internalType:
|
|
10
|
+
{ indexed: false, internalType: "uint256", name: "fee", type: "uint256" },
|
|
11
|
+
{ indexed: false, internalType: "address", name: "feeRecipient", type: "address" },
|
|
12
12
|
],
|
|
13
|
-
name:
|
|
14
|
-
type:
|
|
13
|
+
name: "FeeSet",
|
|
14
|
+
type: "event",
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
anonymous: false,
|
|
18
18
|
inputs: [
|
|
19
|
-
{ indexed: true, internalType:
|
|
20
|
-
{ indexed: false, internalType:
|
|
19
|
+
{ indexed: true, internalType: "address", name: "owner", type: "address" },
|
|
20
|
+
{ indexed: false, internalType: "bool", name: "active", type: "bool" },
|
|
21
21
|
],
|
|
22
|
-
name:
|
|
23
|
-
type:
|
|
22
|
+
name: "OwnerSet",
|
|
23
|
+
type: "event",
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
inputs: [],
|
|
27
|
-
name:
|
|
28
|
-
outputs: [{ internalType:
|
|
29
|
-
stateMutability:
|
|
30
|
-
type:
|
|
27
|
+
name: "fee",
|
|
28
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
29
|
+
stateMutability: "view",
|
|
30
|
+
type: "function",
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
inputs: [],
|
|
34
|
-
name:
|
|
35
|
-
outputs: [{ internalType:
|
|
36
|
-
stateMutability:
|
|
37
|
-
type:
|
|
34
|
+
name: "feeRecipient",
|
|
35
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
36
|
+
stateMutability: "view",
|
|
37
|
+
type: "function",
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
inputs: [{ internalType:
|
|
41
|
-
name:
|
|
42
|
-
outputs: [{ internalType:
|
|
43
|
-
stateMutability:
|
|
44
|
-
type:
|
|
40
|
+
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
41
|
+
name: "owners",
|
|
42
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
43
|
+
stateMutability: "view",
|
|
44
|
+
type: "function",
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
inputs: [
|
|
48
|
-
{ internalType:
|
|
49
|
-
{ internalType:
|
|
48
|
+
{ internalType: "uint256", name: "_fee", type: "uint256" },
|
|
49
|
+
{ internalType: "address", name: "_feeRecipient", type: "address" },
|
|
50
50
|
],
|
|
51
|
-
name:
|
|
51
|
+
name: "setFee",
|
|
52
52
|
outputs: [],
|
|
53
|
-
stateMutability:
|
|
54
|
-
type:
|
|
53
|
+
stateMutability: "nonpayable",
|
|
54
|
+
type: "function",
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
inputs: [
|
|
58
|
-
{ internalType:
|
|
59
|
-
{ internalType:
|
|
58
|
+
{ internalType: "address", name: "owner", type: "address" },
|
|
59
|
+
{ internalType: "bool", name: "active", type: "bool" },
|
|
60
60
|
],
|
|
61
|
-
name:
|
|
61
|
+
name: "setOwner",
|
|
62
62
|
outputs: [],
|
|
63
|
-
stateMutability:
|
|
64
|
-
type:
|
|
63
|
+
stateMutability: "nonpayable",
|
|
64
|
+
type: "function",
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
inputs: [
|
|
68
|
-
{ internalType:
|
|
69
|
-
{ internalType:
|
|
70
|
-
{ internalType:
|
|
71
|
-
{ internalType:
|
|
72
|
-
{ internalType:
|
|
73
|
-
{ internalType:
|
|
74
|
-
{ internalType:
|
|
75
|
-
{ internalType:
|
|
68
|
+
{ internalType: "address", name: "tcRouter", type: "address" },
|
|
69
|
+
{ internalType: "address", name: "tcVault", type: "address" },
|
|
70
|
+
{ internalType: "string", name: "tcMemo", type: "string" },
|
|
71
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
72
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
73
|
+
{ internalType: "address", name: "router", type: "address" },
|
|
74
|
+
{ internalType: "bytes", name: "data", type: "bytes" },
|
|
75
|
+
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
|
76
76
|
],
|
|
77
|
-
name:
|
|
77
|
+
name: "swapIn",
|
|
78
78
|
outputs: [],
|
|
79
|
-
stateMutability:
|
|
80
|
-
type:
|
|
79
|
+
stateMutability: "nonpayable",
|
|
80
|
+
type: "function",
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
inputs: [],
|
|
84
|
-
name:
|
|
84
|
+
name: "tokenTransferProxy",
|
|
85
85
|
outputs: [
|
|
86
|
-
{ internalType:
|
|
86
|
+
{ internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" },
|
|
87
87
|
],
|
|
88
|
-
stateMutability:
|
|
89
|
-
type:
|
|
88
|
+
stateMutability: "view",
|
|
89
|
+
type: "function",
|
|
90
90
|
},
|
|
91
|
-
{ stateMutability:
|
|
91
|
+
{ stateMutability: "payable", type: "receive" },
|
|
92
92
|
];
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { avaxGeneric } from
|
|
2
|
-
import { avaxWoofi } from
|
|
3
|
-
import { bscGeneric } from
|
|
4
|
-
import { ethGeneric } from
|
|
5
|
-
import { pancakeV2 } from
|
|
6
|
-
import { pangolin } from
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
1
|
+
import { avaxGeneric } from "./avaxGeneric.ts";
|
|
2
|
+
import { avaxWoofi } from "./avaxWoofi.ts";
|
|
3
|
+
import { bscGeneric } from "./bscGeneric.ts";
|
|
4
|
+
import { ethGeneric } from "./ethGeneric.ts";
|
|
5
|
+
import { pancakeV2 } from "./pancakeV2.ts";
|
|
6
|
+
import { pangolin } from "./pangolin.ts";
|
|
7
|
+
import { lowercasedRouterAbiMapping } from "./routers/index.ts";
|
|
8
|
+
import { sushiswap } from "./sushiswap.ts";
|
|
9
|
+
import { traderJoe } from "./traderJoe.ts";
|
|
10
|
+
import { uniswapV2 } from "./uniswapV2.ts";
|
|
11
|
+
import { uniswapV2Leg } from "./uniswapV2Leg.ts";
|
|
12
|
+
import { uniswapV3_100 } from "./uniswapV3_100.ts";
|
|
13
|
+
import { uniswapV3_500 } from "./uniswapV3_500.ts";
|
|
14
|
+
import { uniswapV3_3000 } from "./uniswapV3_3000.ts";
|
|
15
|
+
import { uniswapV3_10000 } from "./uniswapV3_10000.ts";
|
|
15
16
|
|
|
16
17
|
type AbiTypes =
|
|
17
18
|
| typeof avaxGeneric
|
|
@@ -29,24 +30,24 @@ type AbiTypes =
|
|
|
29
30
|
|
|
30
31
|
export enum AGG_CONTRACT_ADDRESS {
|
|
31
32
|
// AVAX
|
|
32
|
-
PANGOLIN =
|
|
33
|
-
AVAX_GENERIC =
|
|
34
|
-
AVAX_WOOFI =
|
|
35
|
-
AVAX_TRADER_JOE =
|
|
33
|
+
PANGOLIN = "0x942c6dA485FD6cEf255853ef83a149d43A73F18a",
|
|
34
|
+
AVAX_GENERIC = "0x7C38b8B2efF28511ECc14a621e263857Fb5771d3",
|
|
35
|
+
AVAX_WOOFI = "0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a",
|
|
36
|
+
AVAX_TRADER_JOE = "0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212",
|
|
36
37
|
|
|
37
38
|
// BSC
|
|
38
|
-
BSC_GENERIC =
|
|
39
|
-
BSC_PANCAKE_V2 =
|
|
39
|
+
BSC_GENERIC = "0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c",
|
|
40
|
+
BSC_PANCAKE_V2 = "0x30912B38618D3D37De3191A4FFE982C65a9aEC2E",
|
|
40
41
|
|
|
41
42
|
// ETH
|
|
42
|
-
ETH_GENERIC =
|
|
43
|
-
UNISWAP_V2 =
|
|
44
|
-
SUSHISWAP =
|
|
45
|
-
UNISWAP_V3_100 =
|
|
46
|
-
UNISWAP_V3_500 =
|
|
47
|
-
UNISWAP_V3_3000 =
|
|
48
|
-
UNISWAP_V3_10000 =
|
|
49
|
-
UNISWAP_V2_LEG =
|
|
43
|
+
ETH_GENERIC = "0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2",
|
|
44
|
+
UNISWAP_V2 = "0x86904Eb2b3c743400D03f929F2246EfA80B91215",
|
|
45
|
+
SUSHISWAP = "0xbf365e79aA44A2164DA135100C57FDB6635ae870",
|
|
46
|
+
UNISWAP_V3_100 = "0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8",
|
|
47
|
+
UNISWAP_V3_500 = "0xe4ddca21881bac219af7f217703db0475d2a9f02",
|
|
48
|
+
UNISWAP_V3_3000 = "0x11733abf0cdb43298f7e949c930188451a9a9ef2",
|
|
49
|
+
UNISWAP_V3_10000 = "0xb33874810e5395eb49d8bd7e912631db115d5a03",
|
|
50
|
+
UNISWAP_V2_LEG = "0x3660dE6C56cFD31998397652941ECe42118375DA",
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
export const lowercasedGenericAbiMappings = {
|
|
@@ -56,6 +57,7 @@ export const lowercasedGenericAbiMappings = {
|
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
export const lowercasedContractAbiMapping = {
|
|
60
|
+
...lowercasedRouterAbiMapping,
|
|
59
61
|
...lowercasedGenericAbiMappings,
|
|
60
62
|
// AVAX
|
|
61
63
|
[AGG_CONTRACT_ADDRESS.PANGOLIN.toLowerCase()]: pangolin,
|