@dhedge/v2-sdk 2.1.4 → 2.1.6

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/README.md +180 -45
  2. package/dist/config.d.ts +10 -0
  3. package/dist/entities/pool.d.ts +110 -1
  4. package/dist/services/hyperliquid/constants.d.ts +16 -0
  5. package/dist/services/hyperliquid/index.d.ts +6 -0
  6. package/dist/services/hyperliquid/marketData.d.ts +12 -0
  7. package/dist/services/hyperliquid/positionData.d.ts +1 -0
  8. package/dist/services/odos/index.d.ts +15 -1
  9. package/dist/services/toros/limitOrder.d.ts +8 -0
  10. package/dist/test/constants.d.ts +7 -0
  11. package/dist/test/wallet.d.ts +1 -0
  12. package/dist/types.d.ts +12 -2
  13. package/dist/v2-sdk.cjs.development.js +4256 -1335
  14. package/dist/v2-sdk.cjs.development.js.map +1 -1
  15. package/dist/v2-sdk.cjs.production.min.js +1 -1
  16. package/dist/v2-sdk.cjs.production.min.js.map +1 -1
  17. package/dist/v2-sdk.esm.js +5007 -2087
  18. package/dist/v2-sdk.esm.js.map +1 -1
  19. package/package.json +3 -2
  20. package/src/abi/hyperliquid/ICoreDepositWallet.json +130 -0
  21. package/src/abi/hyperliquid/ICoreWriter.json +1 -0
  22. package/src/abi/odos/OdosRouterV3.json +1351 -0
  23. package/src/abi/toros/IPoolLimitOrderManager.json +78 -0
  24. package/src/config.ts +44 -13
  25. package/src/entities/pool.ts +348 -4
  26. package/src/services/hyperliquid/constants.ts +23 -0
  27. package/src/services/hyperliquid/index.ts +176 -0
  28. package/src/services/hyperliquid/marketData.ts +157 -0
  29. package/src/services/hyperliquid/positionData.ts +33 -0
  30. package/src/services/odos/index.ts +97 -13
  31. package/src/services/toros/completeWithdrawal.ts +1 -1
  32. package/src/services/toros/initWithdrawal.ts +1 -1
  33. package/src/services/toros/limitOrder.ts +86 -0
  34. package/src/services/toros/swapData.ts +83 -12
  35. package/src/test/constants.ts +10 -3
  36. package/src/test/hyperliquid.test.ts +107 -0
  37. package/src/test/odos.test.ts +43 -12
  38. package/src/test/pool.test.ts +37 -45
  39. package/src/test/torosLimitOrder.test.ts +130 -0
  40. package/src/test/wallet.ts +2 -1
  41. package/src/types.ts +13 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhedge/v2-sdk",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "license": "MIT",
5
5
  "description": "🛠 An SDK for building applications on top of dHEDGE V2",
6
6
  "main": "dist/index.js",
@@ -25,7 +25,8 @@
25
25
  "fork:arbitrum": "hardhat node --port 8540 --fork $(grep ARBITRUM_URL .env | cut -d '=' -f2)",
26
26
  "fork:base": "hardhat node --port 8546 --fork $(grep BASE_URL .env | cut -d '=' -f2)",
27
27
  "fork:ethereum": "hardhat node --port 8547 --fork $(grep ETHEREUM_URL .env | cut -d '=' -f2)",
28
- "fork:plasma": "hardhat node --port 8548 --fork $(grep PLASMA_URL .env | cut -d '=' -f2)"
28
+ "fork:plasma": "hardhat node --port 8548 --fork $(grep PLASMA_URL .env | cut -d '=' -f2)",
29
+ "fork:hyperliquid": "hardhat node --port 8549 --fork $(grep HYPERLIQUID_URL .env | cut -d '=' -f2)"
29
30
  },
30
31
  "husky": {
31
32
  "hooks": {
@@ -0,0 +1,130 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "address",
6
+ "name": "from",
7
+ "type": "address"
8
+ },
9
+ {
10
+ "internalType": "bytes32",
11
+ "name": "destinationRecipient",
12
+ "type": "bytes32"
13
+ },
14
+ {
15
+ "internalType": "uint32",
16
+ "name": "destinationChainId",
17
+ "type": "uint32"
18
+ },
19
+ {
20
+ "internalType": "uint256",
21
+ "name": "amount",
22
+ "type": "uint256"
23
+ },
24
+ {
25
+ "internalType": "uint64",
26
+ "name": "coreNonce",
27
+ "type": "uint64"
28
+ },
29
+ {
30
+ "internalType": "bytes",
31
+ "name": "data",
32
+ "type": "bytes"
33
+ }
34
+ ],
35
+ "name": "coreReceiveWithData",
36
+ "outputs": [],
37
+ "stateMutability": "nonpayable",
38
+ "type": "function"
39
+ },
40
+ {
41
+ "inputs": [
42
+ {
43
+ "internalType": "uint256",
44
+ "name": "amount",
45
+ "type": "uint256"
46
+ },
47
+ {
48
+ "internalType": "uint32",
49
+ "name": "destinationDex",
50
+ "type": "uint32"
51
+ }
52
+ ],
53
+ "name": "deposit",
54
+ "outputs": [],
55
+ "stateMutability": "nonpayable",
56
+ "type": "function"
57
+ },
58
+ {
59
+ "inputs": [
60
+ {
61
+ "internalType": "uint256",
62
+ "name": "amount",
63
+ "type": "uint256"
64
+ },
65
+ {
66
+ "internalType": "uint256",
67
+ "name": "authValidAfter",
68
+ "type": "uint256"
69
+ },
70
+ {
71
+ "internalType": "uint256",
72
+ "name": "authValidBefore",
73
+ "type": "uint256"
74
+ },
75
+ {
76
+ "internalType": "bytes32",
77
+ "name": "authNonce",
78
+ "type": "bytes32"
79
+ },
80
+ {
81
+ "internalType": "uint8",
82
+ "name": "v",
83
+ "type": "uint8"
84
+ },
85
+ {
86
+ "internalType": "bytes32",
87
+ "name": "r",
88
+ "type": "bytes32"
89
+ },
90
+ {
91
+ "internalType": "bytes32",
92
+ "name": "s",
93
+ "type": "bytes32"
94
+ },
95
+ {
96
+ "internalType": "uint32",
97
+ "name": "destinationDex",
98
+ "type": "uint32"
99
+ }
100
+ ],
101
+ "name": "depositWithAuth",
102
+ "outputs": [],
103
+ "stateMutability": "nonpayable",
104
+ "type": "function"
105
+ },
106
+ {
107
+ "inputs": [
108
+ {
109
+ "internalType": "address",
110
+ "name": "to",
111
+ "type": "address"
112
+ },
113
+ {
114
+ "internalType": "uint256",
115
+ "name": "amount",
116
+ "type": "uint256"
117
+ }
118
+ ],
119
+ "name": "transfer",
120
+ "outputs": [
121
+ {
122
+ "internalType": "bool",
123
+ "name": "success",
124
+ "type": "bool"
125
+ }
126
+ ],
127
+ "stateMutability": "nonpayable",
128
+ "type": "function"
129
+ }
130
+ ]
@@ -0,0 +1 @@
1
+ [{"anonymous": false,"inputs": [{"indexed": true,"internalType": "address","name": "user","type": "address"},{"indexed": false,"internalType": "bytes","name": "data","type": "bytes"}],"name": "RawAction","type": "event"},{"inputs": [{"internalType": "bytes","name": "data","type": "bytes"}],"name": "sendRawAction","outputs": [],"stateMutability": "nonpayable","type": "function"}]