@dhedge/v2-sdk 1.2.1 → 1.4.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.
Files changed (41) hide show
  1. package/dist/config.d.ts +5 -0
  2. package/dist/entities/pool.d.ts +98 -7
  3. package/dist/entities/utils.d.ts +7 -1
  4. package/dist/services/uniswap/V3Liquidity.d.ts +9 -0
  5. package/dist/services/uniswap/V3Trade.d.ts +4 -0
  6. package/dist/services/uniswap/types.d.ts +3 -0
  7. package/dist/test/constants.d.ts +5 -2
  8. package/dist/test/txOptions.d.ts +1 -0
  9. package/dist/types.d.ts +19 -10
  10. package/dist/v2-sdk.cjs.development.js +3796 -679
  11. package/dist/v2-sdk.cjs.development.js.map +1 -1
  12. package/dist/v2-sdk.cjs.production.min.js +1 -1
  13. package/dist/v2-sdk.cjs.production.min.js.map +1 -1
  14. package/dist/v2-sdk.esm.js +3797 -680
  15. package/dist/v2-sdk.esm.js.map +1 -1
  16. package/package.json +4 -1
  17. package/src/abi/IArrakisV1RouterStaking.json +107 -0
  18. package/src/abi/IBalancerRewardsGauge.json +239 -0
  19. package/src/abi/IERC20.json +15 -1
  20. package/src/abi/ILiquidityGaugeV4.json +153 -0
  21. package/src/abi/INonfungiblePositionManager.json +1221 -0
  22. package/src/abi/ISynthetix.json +139 -0
  23. package/src/abi/IUniswapV3Quoter.json +195 -0
  24. package/src/abi/IUniswapV3Router.json +221 -0
  25. package/src/config.ts +35 -8
  26. package/src/entities/dhedge.ts +4 -2
  27. package/src/entities/pool.ts +394 -33
  28. package/src/entities/utils.ts +25 -9
  29. package/src/services/uniswap/V3Liquidity.ts +134 -0
  30. package/src/services/uniswap/V3Trade.ts +47 -0
  31. package/src/services/uniswap/types.ts +16 -0
  32. package/src/test/aave.test.ts +53 -25
  33. package/src/test/arrakis.test.ts +89 -0
  34. package/src/test/balancer.test.ts +115 -10
  35. package/src/test/constants.ts +12 -2
  36. package/src/test/oneInch.test.ts +13 -20
  37. package/src/test/synthetix.test.ts +34 -0
  38. package/src/test/txOptions.ts +15 -0
  39. package/src/test/uniswap.test.ts +125 -0
  40. package/src/test/wallet.ts +4 -0
  41. package/src/types.ts +19 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhedge/v2-sdk",
3
- "version": "1.2.1",
3
+ "version": "1.4.1",
4
4
  "license": "MIT",
5
5
  "description": "🛠 An SDK for building applications on top of dHEDGE V2",
6
6
  "main": "dist/index.js",
@@ -39,10 +39,13 @@
39
39
  "@ethersproject/bignumber": "^5.5.0",
40
40
  "@ethersproject/providers": "5.0.12",
41
41
  "@sushiswap/sdk": "5.0.0-canary.7",
42
+ "@uniswap/sdk-core": "^3.0.1",
43
+ "@uniswap/v3-sdk": "^3.8.2",
42
44
  "axios": "^0.21.4",
43
45
  "bignumber.js": "^9.0.2",
44
46
  "dotenv": "^10.0.0",
45
47
  "ethers": "^5.4.1",
48
+ "jsbi": "^3.1.4",
46
49
  "lodash": "^4.17.21",
47
50
  "web3-utils": "^1.7.0"
48
51
  },
@@ -0,0 +1,107 @@
1
+ {
2
+ "abi": [
3
+ {
4
+ "inputs": [
5
+ {
6
+ "internalType": "address",
7
+ "name": "gauge",
8
+ "type": "address"
9
+ },
10
+ {
11
+ "internalType": "uint256",
12
+ "name": "amount0Max",
13
+ "type": "uint256"
14
+ },
15
+ {
16
+ "internalType": "uint256",
17
+ "name": "amount1Max",
18
+ "type": "uint256"
19
+ },
20
+ {
21
+ "internalType": "uint256",
22
+ "name": "amount0Min",
23
+ "type": "uint256"
24
+ },
25
+ {
26
+ "internalType": "uint256",
27
+ "name": "amount1Min",
28
+ "type": "uint256"
29
+ },
30
+ {
31
+ "internalType": "address",
32
+ "name": "receiver",
33
+ "type": "address"
34
+ }
35
+ ],
36
+ "name": "addLiquidityAndStake",
37
+ "outputs": [
38
+ {
39
+ "internalType": "uint256",
40
+ "name": "amount0",
41
+ "type": "uint256"
42
+ },
43
+ {
44
+ "internalType": "uint256",
45
+ "name": "amount1",
46
+ "type": "uint256"
47
+ },
48
+ {
49
+ "internalType": "uint256",
50
+ "name": "mintAmount",
51
+ "type": "uint256"
52
+ }
53
+ ],
54
+ "stateMutability": "nonpayable",
55
+ "type": "function"
56
+ },
57
+ {
58
+ "inputs": [
59
+ {
60
+ "internalType": "address",
61
+ "name": "gauge",
62
+ "type": "address"
63
+ },
64
+ {
65
+ "internalType": "uint256",
66
+ "name": "burnAmount",
67
+ "type": "uint256"
68
+ },
69
+ {
70
+ "internalType": "uint256",
71
+ "name": "amount0Min",
72
+ "type": "uint256"
73
+ },
74
+ {
75
+ "internalType": "uint256",
76
+ "name": "amount1Min",
77
+ "type": "uint256"
78
+ },
79
+ {
80
+ "internalType": "address",
81
+ "name": "receiver",
82
+ "type": "address"
83
+ }
84
+ ],
85
+ "name": "removeLiquidityAndUnstake",
86
+ "outputs": [
87
+ {
88
+ "internalType": "uint256",
89
+ "name": "amount0",
90
+ "type": "uint256"
91
+ },
92
+ {
93
+ "internalType": "uint256",
94
+ "name": "amount1",
95
+ "type": "uint256"
96
+ },
97
+ {
98
+ "internalType": "uint128",
99
+ "name": "liquidityBurned",
100
+ "type": "uint128"
101
+ }
102
+ ],
103
+ "stateMutability": "nonpayable",
104
+ "type": "function"
105
+ }
106
+ ]
107
+ }
@@ -0,0 +1,239 @@
1
+ {
2
+ "abi": [
3
+ {
4
+ "inputs": [
5
+ {
6
+ "internalType": "address",
7
+ "name": "user",
8
+ "type": "address"
9
+ }
10
+ ],
11
+ "name": "balanceOf",
12
+ "outputs": [
13
+ {
14
+ "internalType": "uint256",
15
+ "name": "",
16
+ "type": "uint256"
17
+ }
18
+ ],
19
+ "stateMutability": "view",
20
+ "type": "function"
21
+ },
22
+ {
23
+ "inputs": [
24
+ {
25
+ "internalType": "address",
26
+ "name": "user",
27
+ "type": "address"
28
+ }
29
+ ],
30
+ "name": "claim_rewards",
31
+ "outputs": [],
32
+ "stateMutability": "nonpayable",
33
+ "type": "function"
34
+ },
35
+ {
36
+ "inputs": [
37
+ {
38
+ "internalType": "address",
39
+ "name": "user",
40
+ "type": "address"
41
+ },
42
+ {
43
+ "internalType": "address",
44
+ "name": "receiver",
45
+ "type": "address"
46
+ }
47
+ ],
48
+ "name": "claim_rewards",
49
+ "outputs": [],
50
+ "stateMutability": "nonpayable",
51
+ "type": "function"
52
+ },
53
+ {
54
+ "inputs": [],
55
+ "name": "claim_rewards",
56
+ "outputs": [],
57
+ "stateMutability": "nonpayable",
58
+ "type": "function"
59
+ },
60
+ {
61
+ "inputs": [
62
+ {
63
+ "internalType": "address",
64
+ "name": "user",
65
+ "type": "address"
66
+ },
67
+ {
68
+ "internalType": "address",
69
+ "name": "rewardToken",
70
+ "type": "address"
71
+ }
72
+ ],
73
+ "name": "claimable_reward",
74
+ "outputs": [
75
+ {
76
+ "internalType": "uint256",
77
+ "name": "",
78
+ "type": "uint256"
79
+ }
80
+ ],
81
+ "stateMutability": "view",
82
+ "type": "function"
83
+ },
84
+ {
85
+ "inputs": [
86
+ {
87
+ "internalType": "address",
88
+ "name": "user",
89
+ "type": "address"
90
+ },
91
+ {
92
+ "internalType": "address",
93
+ "name": "rewardToken",
94
+ "type": "address"
95
+ }
96
+ ],
97
+ "name": "claimable_reward_write",
98
+ "outputs": [
99
+ {
100
+ "internalType": "uint256",
101
+ "name": "",
102
+ "type": "uint256"
103
+ }
104
+ ],
105
+ "stateMutability": "nonpayable",
106
+ "type": "function"
107
+ },
108
+ {
109
+ "inputs": [
110
+ {
111
+ "internalType": "uint256",
112
+ "name": "amount",
113
+ "type": "uint256"
114
+ },
115
+ {
116
+ "internalType": "address",
117
+ "name": "user",
118
+ "type": "address"
119
+ }
120
+ ],
121
+ "name": "deposit",
122
+ "outputs": [],
123
+ "stateMutability": "nonpayable",
124
+ "type": "function"
125
+ },
126
+ {
127
+ "inputs": [
128
+ {
129
+ "internalType": "uint256",
130
+ "name": "amount",
131
+ "type": "uint256"
132
+ },
133
+ {
134
+ "internalType": "address",
135
+ "name": "onBehalf",
136
+ "type": "address"
137
+ },
138
+ {
139
+ "internalType": "bool",
140
+ "name": "isClaimRewards",
141
+ "type": "bool"
142
+ }
143
+ ],
144
+ "name": "deposit",
145
+ "outputs": [],
146
+ "stateMutability": "nonpayable",
147
+ "type": "function"
148
+ },
149
+ {
150
+ "inputs": [
151
+ {
152
+ "internalType": "uint256",
153
+ "name": "amount",
154
+ "type": "uint256"
155
+ }
156
+ ],
157
+ "name": "deposit",
158
+ "outputs": [],
159
+ "stateMutability": "nonpayable",
160
+ "type": "function"
161
+ },
162
+ {
163
+ "inputs": [],
164
+ "name": "lp_token",
165
+ "outputs": [
166
+ {
167
+ "internalType": "address",
168
+ "name": "",
169
+ "type": "address"
170
+ }
171
+ ],
172
+ "stateMutability": "view",
173
+ "type": "function"
174
+ },
175
+ {
176
+ "inputs": [],
177
+ "name": "reward_contract",
178
+ "outputs": [
179
+ {
180
+ "internalType": "address",
181
+ "name": "",
182
+ "type": "address"
183
+ }
184
+ ],
185
+ "stateMutability": "view",
186
+ "type": "function"
187
+ },
188
+ {
189
+ "inputs": [
190
+ {
191
+ "internalType": "uint256",
192
+ "name": "index",
193
+ "type": "uint256"
194
+ }
195
+ ],
196
+ "name": "reward_tokens",
197
+ "outputs": [
198
+ {
199
+ "internalType": "address",
200
+ "name": "",
201
+ "type": "address"
202
+ }
203
+ ],
204
+ "stateMutability": "view",
205
+ "type": "function"
206
+ },
207
+ {
208
+ "inputs": [
209
+ {
210
+ "internalType": "uint256",
211
+ "name": "amount",
212
+ "type": "uint256"
213
+ }
214
+ ],
215
+ "name": "withdraw",
216
+ "outputs": [],
217
+ "stateMutability": "nonpayable",
218
+ "type": "function"
219
+ },
220
+ {
221
+ "inputs": [
222
+ {
223
+ "internalType": "uint256",
224
+ "name": "amount",
225
+ "type": "uint256"
226
+ },
227
+ {
228
+ "internalType": "bool",
229
+ "name": "isClaimRewards",
230
+ "type": "bool"
231
+ }
232
+ ],
233
+ "name": "withdraw",
234
+ "outputs": [],
235
+ "stateMutability": "nonpayable",
236
+ "type": "function"
237
+ }
238
+ ]
239
+ }
@@ -246,7 +246,21 @@
246
246
  "payable": false,
247
247
  "stateMutability": "nonpayable",
248
248
  "type": "function"
249
- }
249
+ },
250
+ {
251
+ "constant": true,
252
+ "inputs": [],
253
+ "name": "decimals",
254
+ "outputs": [
255
+ {
256
+ "name": "",
257
+ "type": "uint8"
258
+ }
259
+ ],
260
+ "payable": false,
261
+ "stateMutability": "view",
262
+ "type": "function"
263
+ }
250
264
  ]
251
265
  }
252
266
 
@@ -0,0 +1,153 @@
1
+ { "abi": [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "address",
6
+ "name": "user",
7
+ "type": "address"
8
+ }
9
+ ],
10
+ "name": "claim_rewards",
11
+ "outputs": [],
12
+ "stateMutability": "nonpayable",
13
+ "type": "function"
14
+ },
15
+ {
16
+ "inputs": [
17
+ {
18
+ "internalType": "address",
19
+ "name": "user",
20
+ "type": "address"
21
+ },
22
+ {
23
+ "internalType": "address",
24
+ "name": "receiver",
25
+ "type": "address"
26
+ }
27
+ ],
28
+ "name": "claim_rewards",
29
+ "outputs": [],
30
+ "stateMutability": "nonpayable",
31
+ "type": "function"
32
+ },
33
+ {
34
+ "inputs": [],
35
+ "name": "claim_rewards",
36
+ "outputs": [],
37
+ "stateMutability": "nonpayable",
38
+ "type": "function"
39
+ },
40
+ {
41
+ "inputs": [
42
+ {
43
+ "internalType": "address",
44
+ "name": "user",
45
+ "type": "address"
46
+ },
47
+ {
48
+ "internalType": "address",
49
+ "name": "rewardToken",
50
+ "type": "address"
51
+ }
52
+ ],
53
+ "name": "claimable_reward",
54
+ "outputs": [
55
+ {
56
+ "internalType": "uint256",
57
+ "name": "",
58
+ "type": "uint256"
59
+ }
60
+ ],
61
+ "stateMutability": "view",
62
+ "type": "function"
63
+ },
64
+ {
65
+ "inputs": [],
66
+ "name": "reward_count",
67
+ "outputs": [
68
+ {
69
+ "internalType": "uint256",
70
+ "name": "",
71
+ "type": "uint256"
72
+ }
73
+ ],
74
+ "stateMutability": "view",
75
+ "type": "function"
76
+ },
77
+ {
78
+ "inputs": [
79
+ {
80
+ "internalType": "address",
81
+ "name": "token",
82
+ "type": "address"
83
+ }
84
+ ],
85
+ "name": "reward_data",
86
+ "outputs": [
87
+ {
88
+ "internalType": "address",
89
+ "name": "",
90
+ "type": "address"
91
+ },
92
+ {
93
+ "internalType": "address",
94
+ "name": "",
95
+ "type": "address"
96
+ },
97
+ {
98
+ "internalType": "uint256",
99
+ "name": "",
100
+ "type": "uint256"
101
+ },
102
+ {
103
+ "internalType": "uint256",
104
+ "name": "",
105
+ "type": "uint256"
106
+ },
107
+ {
108
+ "internalType": "uint256",
109
+ "name": "",
110
+ "type": "uint256"
111
+ },
112
+ {
113
+ "internalType": "uint256",
114
+ "name": "",
115
+ "type": "uint256"
116
+ }
117
+ ],
118
+ "stateMutability": "view",
119
+ "type": "function"
120
+ },
121
+ {
122
+ "inputs": [
123
+ {
124
+ "internalType": "uint256",
125
+ "name": "index",
126
+ "type": "uint256"
127
+ }
128
+ ],
129
+ "name": "reward_tokens",
130
+ "outputs": [
131
+ {
132
+ "internalType": "address",
133
+ "name": "",
134
+ "type": "address"
135
+ }
136
+ ],
137
+ "stateMutability": "view",
138
+ "type": "function"
139
+ },
140
+ {
141
+ "inputs": [],
142
+ "name": "staking_token",
143
+ "outputs": [
144
+ {
145
+ "internalType": "address",
146
+ "name": "",
147
+ "type": "address"
148
+ }
149
+ ],
150
+ "stateMutability": "view",
151
+ "type": "function"
152
+ }
153
+ ]}