@dhedge/v2-sdk 2.1.7 → 2.2.0

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 (93) hide show
  1. package/README.md +400 -53
  2. package/dist/config.d.ts +14 -2
  3. package/dist/entities/pool.d.ts +25 -86
  4. package/dist/entities/utils.d.ts +15 -0
  5. package/dist/services/cowSwap/index.d.ts +10 -0
  6. package/dist/services/hyperliquid/index.d.ts +22 -0
  7. package/dist/services/kyberSwap/index.d.ts +1 -1
  8. package/dist/services/oneInch/index.d.ts +1 -1
  9. package/dist/services/toros/easySwapper.d.ts +14 -0
  10. package/dist/services/toros/swapData.d.ts +5 -5
  11. package/dist/services/uniswap/V3Liquidity.d.ts +2 -2
  12. package/dist/services/velodrome/liquidity.d.ts +3 -0
  13. package/dist/test/constants.d.ts +48 -3
  14. package/dist/test/utils/testingHelper.d.ts +4 -0
  15. package/dist/types.d.ts +21 -5
  16. package/dist/utils/contract.d.ts +20 -0
  17. package/dist/v2-sdk.cjs.development.js +5193 -6711
  18. package/dist/v2-sdk.cjs.development.js.map +1 -1
  19. package/dist/v2-sdk.cjs.production.min.js +1 -1
  20. package/dist/v2-sdk.cjs.production.min.js.map +1 -1
  21. package/dist/v2-sdk.esm.js +5198 -6711
  22. package/dist/v2-sdk.esm.js.map +1 -1
  23. package/package.json +1 -1
  24. package/src/abi/PoolFactory.json +414 -204
  25. package/src/abi/PoolLogic.json +160 -134
  26. package/src/config.ts +19 -9
  27. package/src/entities/pool.ts +103 -254
  28. package/src/entities/utils.ts +15 -0
  29. package/src/services/cowSwap/index.ts +281 -0
  30. package/src/services/hyperliquid/index.ts +22 -0
  31. package/src/services/kyberSwap/index.ts +5 -3
  32. package/src/services/oneInch/index.ts +5 -4
  33. package/src/services/toros/completeWithdrawal.ts +57 -40
  34. package/src/services/toros/easySwapper.ts +15 -1
  35. package/src/services/toros/initWithdrawal.ts +39 -31
  36. package/src/services/toros/swapData.ts +45 -131
  37. package/src/services/uniswap/V3Liquidity.ts +3 -24
  38. package/src/services/velodrome/liquidity.ts +3 -0
  39. package/src/test/aave.test.ts +99 -70
  40. package/src/test/aerodrome.test.ts +53 -24
  41. package/src/test/aerodromeCL.test.ts +64 -30
  42. package/src/test/arrakis.test.ts +23 -35
  43. package/src/test/balancer.test.ts +114 -106
  44. package/src/test/compoundV3.test.ts +45 -29
  45. package/src/test/constants.ts +57 -12
  46. package/src/test/cowswap.test.ts +79 -0
  47. package/src/test/dhedge.test.ts +45 -12
  48. package/src/test/flatmoney.test.ts +25 -39
  49. package/src/test/fluid.test.ts +33 -24
  50. package/src/test/hyperliquid.onchain.test.ts +131 -0
  51. package/src/test/kyberSwap.test.ts +37 -16
  52. package/src/test/lyra.test.ts +159 -150
  53. package/src/test/odos.test.ts +2 -2
  54. package/src/test/oneInch.test.ts +36 -22
  55. package/src/test/pancakeCL.test.ts +72 -31
  56. package/src/test/pendle.test.ts +94 -54
  57. package/src/test/{pendleMint.test.ts → pendleMint.onchain.test.ts} +22 -8
  58. package/src/test/pool.test.ts +152 -95
  59. package/src/test/toros.onchain.test.ts +92 -0
  60. package/src/test/toros.test.ts +74 -20
  61. package/src/test/torosLimitOrder.test.ts +87 -42
  62. package/src/test/uniswap.test.ts +77 -128
  63. package/src/test/utils/testingHelper.ts +120 -0
  64. package/src/test/velodrome.test.ts +126 -92
  65. package/src/test/velodromeCL.test.ts +43 -31
  66. package/src/test/velodromeV2.test.ts +153 -95
  67. package/src/types.ts +22 -6
  68. package/src/utils/contract.ts +20 -0
  69. package/dist/services/futures/constants.d.ts +0 -1
  70. package/dist/services/futures/index.d.ts +0 -2
  71. package/dist/services/futures/margin.d.ts +0 -2
  72. package/dist/services/futures/trade.d.ts +0 -3
  73. package/dist/services/ramses/vesting.d.ts +0 -4
  74. package/dist/services/uniswap/V3Trade.d.ts +0 -3
  75. package/dist/test/utils/futures.d.ts +0 -2
  76. package/src/abi/IRamsesNonfungiblePositionManager.json +0 -486
  77. package/src/abi/ISynthetiXFuturesMarketV2.json +0 -531
  78. package/src/abi/ISynthetix.json +0 -139
  79. package/src/abi/IUniswapV3Quoter.json +0 -195
  80. package/src/abi/IUniswapV3Router.json +0 -221
  81. package/src/abi/IXRam.json +0 -99
  82. package/src/services/futures/constants.ts +0 -1
  83. package/src/services/futures/index.ts +0 -2
  84. package/src/services/futures/margin.ts +0 -10
  85. package/src/services/futures/trade.ts +0 -32
  86. package/src/services/ramses/vesting.ts +0 -24
  87. package/src/services/uniswap/V3Trade.ts +0 -46
  88. package/src/test/futures.test.ts +0 -51
  89. package/src/test/hyperliquid.test.ts +0 -107
  90. package/src/test/ramses.test.ts +0 -190
  91. package/src/test/ramsesCL.test.ts +0 -155
  92. package/src/test/synthetix.test.ts +0 -36
  93. package/src/test/utils/futures.ts +0 -14
@@ -1,531 +0,0 @@
1
- {
2
- "abi": [
3
- {
4
- "inputs": [
5
- {
6
- "internalType": "address",
7
- "name": "account",
8
- "type": "address"
9
- }
10
- ],
11
- "name": "accessibleMargin",
12
- "outputs": [
13
- {
14
- "internalType": "uint256",
15
- "name": "marginAccessible",
16
- "type": "uint256"
17
- },
18
- {
19
- "internalType": "bool",
20
- "name": "invalid",
21
- "type": "bool"
22
- }
23
- ],
24
- "stateMutability": "view",
25
- "type": "function"
26
- },
27
- {
28
- "inputs": [
29
- {
30
- "internalType": "address",
31
- "name": "account",
32
- "type": "address"
33
- }
34
- ],
35
- "name": "canLiquidate",
36
- "outputs": [
37
- {
38
- "internalType": "bool",
39
- "name": "",
40
- "type": "bool"
41
- }
42
- ],
43
- "stateMutability": "view",
44
- "type": "function"
45
- },
46
- {
47
- "inputs": [
48
- {
49
- "internalType": "address",
50
- "name": "account",
51
- "type": "address"
52
- }
53
- ],
54
- "name": "cancelDelayedOrder",
55
- "outputs": [],
56
- "stateMutability": "nonpayable",
57
- "type": "function"
58
- },
59
- {
60
- "inputs": [
61
- {
62
- "internalType": "address",
63
- "name": "account",
64
- "type": "address"
65
- }
66
- ],
67
- "name": "cancelOffchainDelayedOrder",
68
- "outputs": [],
69
- "stateMutability": "nonpayable",
70
- "type": "function"
71
- },
72
- {
73
- "inputs": [
74
- {
75
- "internalType": "uint256",
76
- "name": "priceImpactDelta",
77
- "type": "uint256"
78
- }
79
- ],
80
- "name": "closePosition",
81
- "outputs": [],
82
- "stateMutability": "nonpayable",
83
- "type": "function"
84
- },
85
- {
86
- "inputs": [
87
- {
88
- "internalType": "uint256",
89
- "name": "priceImpactDelta",
90
- "type": "uint256"
91
- },
92
- {
93
- "internalType": "bytes32",
94
- "name": "trackingCode",
95
- "type": "bytes32"
96
- }
97
- ],
98
- "name": "closePositionWithTracking",
99
- "outputs": [],
100
- "stateMutability": "nonpayable",
101
- "type": "function"
102
- },
103
- {
104
- "inputs": [
105
- {
106
- "internalType": "address",
107
- "name": "account",
108
- "type": "address"
109
- }
110
- ],
111
- "name": "delayedOrders",
112
- "outputs": [
113
- {
114
- "components": [
115
- {
116
- "internalType": "bool",
117
- "name": "isOffchain",
118
- "type": "bool"
119
- },
120
- {
121
- "internalType": "int128",
122
- "name": "sizeDelta",
123
- "type": "int128"
124
- },
125
- {
126
- "internalType": "uint128",
127
- "name": "priceImpactDelta",
128
- "type": "uint128"
129
- },
130
- {
131
- "internalType": "uint128",
132
- "name": "targetRoundId",
133
- "type": "uint128"
134
- },
135
- {
136
- "internalType": "uint128",
137
- "name": "commitDeposit",
138
- "type": "uint128"
139
- },
140
- {
141
- "internalType": "uint128",
142
- "name": "keeperDeposit",
143
- "type": "uint128"
144
- },
145
- {
146
- "internalType": "uint256",
147
- "name": "executableAtTime",
148
- "type": "uint256"
149
- },
150
- {
151
- "internalType": "uint256",
152
- "name": "intentionTime",
153
- "type": "uint256"
154
- },
155
- {
156
- "internalType": "bytes32",
157
- "name": "trackingCode",
158
- "type": "bytes32"
159
- }
160
- ],
161
- "internalType": "struct IPerpsV2Market.DelayedOrder",
162
- "name": "",
163
- "type": "tuple"
164
- }
165
- ],
166
- "stateMutability": "view",
167
- "type": "function"
168
- },
169
- {
170
- "inputs": [
171
- {
172
- "internalType": "int256",
173
- "name": "sizeDelta",
174
- "type": "int256"
175
- }
176
- ],
177
- "name": "fillPrice",
178
- "outputs": [
179
- {
180
- "internalType": "uint256",
181
- "name": "price",
182
- "type": "uint256"
183
- },
184
- {
185
- "internalType": "bool",
186
- "name": "invalid",
187
- "type": "bool"
188
- }
189
- ],
190
- "stateMutability": "view",
191
- "type": "function"
192
- },
193
- {
194
- "inputs": [
195
- {
196
- "internalType": "address",
197
- "name": "account",
198
- "type": "address"
199
- }
200
- ],
201
- "name": "liquidatePosition",
202
- "outputs": [],
203
- "stateMutability": "nonpayable",
204
- "type": "function"
205
- },
206
- {
207
- "inputs": [
208
- {
209
- "internalType": "int256",
210
- "name": "sizeDelta",
211
- "type": "int256"
212
- },
213
- {
214
- "internalType": "uint256",
215
- "name": "priceImpactDelta",
216
- "type": "uint256"
217
- }
218
- ],
219
- "name": "modifyPosition",
220
- "outputs": [],
221
- "stateMutability": "nonpayable",
222
- "type": "function"
223
- },
224
- {
225
- "inputs": [
226
- {
227
- "internalType": "int256",
228
- "name": "sizeDelta",
229
- "type": "int256"
230
- },
231
- {
232
- "internalType": "uint256",
233
- "name": "priceImpactDelta",
234
- "type": "uint256"
235
- },
236
- {
237
- "internalType": "bytes32",
238
- "name": "trackingCode",
239
- "type": "bytes32"
240
- }
241
- ],
242
- "name": "modifyPositionWithTracking",
243
- "outputs": [],
244
- "stateMutability": "nonpayable",
245
- "type": "function"
246
- },
247
- {
248
- "inputs": [
249
- {
250
- "internalType": "int256",
251
- "name": "sizeDelta",
252
- "type": "int256"
253
- },
254
- {
255
- "internalType": "enum IPerpsV2Market.OrderType",
256
- "name": "orderType",
257
- "type": "uint8"
258
- }
259
- ],
260
- "name": "orderFee",
261
- "outputs": [
262
- {
263
- "internalType": "uint256",
264
- "name": "fee",
265
- "type": "uint256"
266
- },
267
- {
268
- "internalType": "bool",
269
- "name": "invalid",
270
- "type": "bool"
271
- }
272
- ],
273
- "stateMutability": "view",
274
- "type": "function"
275
- },
276
- {
277
- "inputs": [
278
- {
279
- "internalType": "address",
280
- "name": "account",
281
- "type": "address"
282
- }
283
- ],
284
- "name": "positions",
285
- "outputs": [
286
- {
287
- "components": [
288
- {
289
- "internalType": "uint64",
290
- "name": "id",
291
- "type": "uint64"
292
- },
293
- {
294
- "internalType": "uint64",
295
- "name": "lastFundingIndex",
296
- "type": "uint64"
297
- },
298
- {
299
- "internalType": "uint128",
300
- "name": "margin",
301
- "type": "uint128"
302
- },
303
- {
304
- "internalType": "uint128",
305
- "name": "lastPrice",
306
- "type": "uint128"
307
- },
308
- {
309
- "internalType": "int128",
310
- "name": "size",
311
- "type": "int128"
312
- }
313
- ],
314
- "internalType": "struct IPerpsV2Market.Position",
315
- "name": "",
316
- "type": "tuple"
317
- }
318
- ],
319
- "stateMutability": "view",
320
- "type": "function"
321
- },
322
- {
323
- "inputs": [
324
- {
325
- "internalType": "int256",
326
- "name": "sizeDelta",
327
- "type": "int256"
328
- },
329
- {
330
- "internalType": "uint256",
331
- "name": "tradePrice",
332
- "type": "uint256"
333
- },
334
- {
335
- "internalType": "enum IPerpsV2Market.OrderType",
336
- "name": "orderType",
337
- "type": "uint8"
338
- },
339
- {
340
- "internalType": "address",
341
- "name": "sender",
342
- "type": "address"
343
- }
344
- ],
345
- "name": "postTradeDetails",
346
- "outputs": [
347
- {
348
- "internalType": "uint256",
349
- "name": "margin",
350
- "type": "uint256"
351
- },
352
- {
353
- "internalType": "int256",
354
- "name": "size",
355
- "type": "int256"
356
- },
357
- {
358
- "internalType": "uint256",
359
- "name": "price",
360
- "type": "uint256"
361
- },
362
- {
363
- "internalType": "uint256",
364
- "name": "liqPrice",
365
- "type": "uint256"
366
- },
367
- {
368
- "internalType": "uint256",
369
- "name": "fee",
370
- "type": "uint256"
371
- },
372
- {
373
- "internalType": "enum IPerpsV2Market.Status",
374
- "name": "status",
375
- "type": "uint8"
376
- }
377
- ],
378
- "stateMutability": "view",
379
- "type": "function"
380
- },
381
- {
382
- "inputs": [
383
- {
384
- "internalType": "address",
385
- "name": "account",
386
- "type": "address"
387
- }
388
- ],
389
- "name": "remainingMargin",
390
- "outputs": [
391
- {
392
- "internalType": "uint256",
393
- "name": "marginRemaining",
394
- "type": "uint256"
395
- },
396
- {
397
- "internalType": "bool",
398
- "name": "invalid",
399
- "type": "bool"
400
- }
401
- ],
402
- "stateMutability": "view",
403
- "type": "function"
404
- },
405
- {
406
- "inputs": [],
407
- "name": "resolver",
408
- "outputs": [
409
- {
410
- "internalType": "contract IAddressResolver",
411
- "name": "",
412
- "type": "address"
413
- }
414
- ],
415
- "stateMutability": "view",
416
- "type": "function"
417
- },
418
- {
419
- "inputs": [
420
- {
421
- "internalType": "int256",
422
- "name": "sizeDelta",
423
- "type": "int256"
424
- },
425
- {
426
- "internalType": "uint256",
427
- "name": "priceImpactDelta",
428
- "type": "uint256"
429
- },
430
- {
431
- "internalType": "uint256",
432
- "name": "desiredTimeDelta",
433
- "type": "uint256"
434
- }
435
- ],
436
- "name": "submitDelayedOrder",
437
- "outputs": [],
438
- "stateMutability": "nonpayable",
439
- "type": "function"
440
- },
441
- {
442
- "inputs": [
443
- {
444
- "internalType": "int256",
445
- "name": "sizeDelta",
446
- "type": "int256"
447
- },
448
- {
449
- "internalType": "uint256",
450
- "name": "priceImpactDelta",
451
- "type": "uint256"
452
- },
453
- {
454
- "internalType": "uint256",
455
- "name": "desiredTimeDelta",
456
- "type": "uint256"
457
- },
458
- {
459
- "internalType": "bytes32",
460
- "name": "trackingCode",
461
- "type": "bytes32"
462
- }
463
- ],
464
- "name": "submitDelayedOrderWithTracking",
465
- "outputs": [],
466
- "stateMutability": "nonpayable",
467
- "type": "function"
468
- },
469
- {
470
- "inputs": [
471
- {
472
- "internalType": "int256",
473
- "name": "sizeDelta",
474
- "type": "int256"
475
- },
476
- {
477
- "internalType": "uint256",
478
- "name": "priceImpactDelta",
479
- "type": "uint256"
480
- }
481
- ],
482
- "name": "submitOffchainDelayedOrder",
483
- "outputs": [],
484
- "stateMutability": "nonpayable",
485
- "type": "function"
486
- },
487
- {
488
- "inputs": [
489
- {
490
- "internalType": "int256",
491
- "name": "sizeDelta",
492
- "type": "int256"
493
- },
494
- {
495
- "internalType": "uint256",
496
- "name": "priceImpactDelta",
497
- "type": "uint256"
498
- },
499
- {
500
- "internalType": "bytes32",
501
- "name": "trackingCode",
502
- "type": "bytes32"
503
- }
504
- ],
505
- "name": "submitOffchainDelayedOrderWithTracking",
506
- "outputs": [],
507
- "stateMutability": "nonpayable",
508
- "type": "function"
509
- },
510
- {
511
- "inputs": [
512
- {
513
- "internalType": "int256",
514
- "name": "marginDelta",
515
- "type": "int256"
516
- }
517
- ],
518
- "name": "transferMargin",
519
- "outputs": [],
520
- "stateMutability": "nonpayable",
521
- "type": "function"
522
- },
523
- {
524
- "inputs": [],
525
- "name": "withdrawAllMargin",
526
- "outputs": [],
527
- "stateMutability": "nonpayable",
528
- "type": "function"
529
- }
530
- ]
531
- }
@@ -1,139 +0,0 @@
1
- {
2
- "abi": [
3
- {
4
- "inputs": [
5
- {
6
- "internalType": "bytes32",
7
- "name": "sourceCurrencyKey",
8
- "type": "bytes32"
9
- },
10
- {
11
- "internalType": "uint256",
12
- "name": "sourceAmount",
13
- "type": "uint256"
14
- },
15
- {
16
- "internalType": "bytes32",
17
- "name": "destinationCurrencyKey",
18
- "type": "bytes32"
19
- }
20
- ],
21
- "name": "exchange",
22
- "outputs": [
23
- {
24
- "internalType": "uint256",
25
- "name": "amountReceived",
26
- "type": "uint256"
27
- }
28
- ],
29
- "stateMutability": "nonpayable",
30
- "type": "function"
31
- },
32
- {
33
- "inputs": [
34
- {
35
- "internalType": "bytes32",
36
- "name": "sourceCurrencyKey",
37
- "type": "bytes32"
38
- },
39
- {
40
- "internalType": "uint256",
41
- "name": "sourceAmount",
42
- "type": "uint256"
43
- },
44
- {
45
- "internalType": "bytes32",
46
- "name": "destinationCurrencyKey",
47
- "type": "bytes32"
48
- },
49
- {
50
- "internalType": "address",
51
- "name": "originator",
52
- "type": "address"
53
- },
54
- {
55
- "internalType": "bytes32",
56
- "name": "trackingCode",
57
- "type": "bytes32"
58
- }
59
- ],
60
- "name": "exchangeWithTracking",
61
- "outputs": [
62
- {
63
- "internalType": "uint256",
64
- "name": "amountReceived",
65
- "type": "uint256"
66
- }
67
- ],
68
- "stateMutability": "nonpayable",
69
- "type": "function"
70
- },
71
- {
72
- "inputs": [
73
- {
74
- "internalType": "bytes32",
75
- "name": "currencyKey",
76
- "type": "bytes32"
77
- }
78
- ],
79
- "name": "settle",
80
- "outputs": [
81
- {
82
- "internalType": "uint256",
83
- "name": "reclaimed",
84
- "type": "uint256"
85
- },
86
- {
87
- "internalType": "uint256",
88
- "name": "refunded",
89
- "type": "uint256"
90
- },
91
- {
92
- "internalType": "uint256",
93
- "name": "numEntriesSettled",
94
- "type": "uint256"
95
- }
96
- ],
97
- "stateMutability": "nonpayable",
98
- "type": "function"
99
- },
100
- {
101
- "inputs": [
102
- {
103
- "internalType": "bytes32",
104
- "name": "key",
105
- "type": "bytes32"
106
- }
107
- ],
108
- "name": "synths",
109
- "outputs": [
110
- {
111
- "internalType": "address",
112
- "name": "synthTokenAddress",
113
- "type": "address"
114
- }
115
- ],
116
- "stateMutability": "view",
117
- "type": "function"
118
- },
119
- {
120
- "inputs": [
121
- {
122
- "internalType": "address",
123
- "name": "asset",
124
- "type": "address"
125
- }
126
- ],
127
- "name": "synthsByAddress",
128
- "outputs": [
129
- {
130
- "internalType": "bytes32",
131
- "name": "key",
132
- "type": "bytes32"
133
- }
134
- ],
135
- "stateMutability": "view",
136
- "type": "function"
137
- }
138
- ]
139
- }