@dhedge/v2-sdk 1.9.9 → 1.10.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.
- package/dist/config.d.ts +1 -1
- package/dist/entities/pool.d.ts +17 -7
- package/dist/services/uniswap/V3Liquidity.d.ts +8 -7
- package/dist/services/uniswap/V3Trade.d.ts +1 -2
- package/dist/services/velodrome/liquidity.d.ts +7 -3
- package/dist/services/velodrome/staking.d.ts +1 -0
- package/dist/test/constants.d.ts +14 -0
- package/dist/test/utils/testingHelper.d.ts +6 -0
- package/dist/types.d.ts +1 -0
- package/dist/v2-sdk.cjs.development.js +2673 -1368
- package/dist/v2-sdk.cjs.development.js.map +1 -1
- package/dist/v2-sdk.cjs.production.min.js +1 -1
- package/dist/v2-sdk.cjs.production.min.js.map +1 -1
- package/dist/v2-sdk.esm.js +2686 -1381
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/abi/IERC721.json +217 -0
- package/src/abi/IVelodromeCLGauge.json +165 -0
- package/src/abi/IVelodromeNonfungiblePositionManager.json +408 -0
- package/src/config.ts +14 -6
- package/src/entities/pool.ts +141 -82
- package/src/services/lyra/trade.ts +1 -1
- package/src/services/uniswap/V3Liquidity.ts +141 -18
- package/src/services/uniswap/V3Trade.ts +1 -2
- package/src/services/velodrome/liquidity.ts +77 -5
- package/src/services/velodrome/staking.ts +6 -0
- package/src/test/constants.ts +22 -6
- package/src/test/uniswap.test.ts +24 -15
- package/src/test/utils/testingHelper.ts +25 -1
- package/src/test/velodromeCL.test.ts +223 -0
- package/src/types.ts +1 -0
- package/dist/services/uniswap/types.d.ts +0 -3
- package/src/services/uniswap/types.ts +0 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhedge/v2-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "🛠 An SDK for building applications on top of dHEDGE V2",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@ethersproject/providers": "5.0.12",
|
|
49
49
|
"@lyrafinance/lyra-js": "^0.0.20",
|
|
50
50
|
"@sushiswap/sdk": "5.0.0-canary.7",
|
|
51
|
-
"@uniswap/sdk-core": "
|
|
51
|
+
"@uniswap/sdk-core": "3.0.1",
|
|
52
52
|
"@uniswap/v3-sdk": "^3.8.2",
|
|
53
53
|
"axios": "^0.21.4",
|
|
54
54
|
"bignumber.js": "^9.0.2",
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
{
|
|
2
|
+
"abi": [
|
|
3
|
+
{
|
|
4
|
+
"constant": false,
|
|
5
|
+
"inputs": [
|
|
6
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
7
|
+
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }
|
|
8
|
+
],
|
|
9
|
+
"name": "approve",
|
|
10
|
+
"outputs": [],
|
|
11
|
+
"payable": false,
|
|
12
|
+
"stateMutability": "nonpayable",
|
|
13
|
+
"type": "function"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"constant": false,
|
|
17
|
+
"inputs": [
|
|
18
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
19
|
+
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }
|
|
20
|
+
],
|
|
21
|
+
"name": "mint",
|
|
22
|
+
"outputs": [],
|
|
23
|
+
"payable": false,
|
|
24
|
+
"stateMutability": "nonpayable",
|
|
25
|
+
"type": "function"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"constant": false,
|
|
29
|
+
"inputs": [
|
|
30
|
+
{ "internalType": "address", "name": "from", "type": "address" },
|
|
31
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
32
|
+
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }
|
|
33
|
+
],
|
|
34
|
+
"name": "safeTransferFrom",
|
|
35
|
+
"outputs": [],
|
|
36
|
+
"payable": false,
|
|
37
|
+
"stateMutability": "nonpayable",
|
|
38
|
+
"type": "function"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"constant": false,
|
|
42
|
+
"inputs": [
|
|
43
|
+
{ "internalType": "address", "name": "from", "type": "address" },
|
|
44
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
45
|
+
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" },
|
|
46
|
+
{ "internalType": "bytes", "name": "_data", "type": "bytes" }
|
|
47
|
+
],
|
|
48
|
+
"name": "safeTransferFrom",
|
|
49
|
+
"outputs": [],
|
|
50
|
+
"payable": false,
|
|
51
|
+
"stateMutability": "nonpayable",
|
|
52
|
+
"type": "function"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"constant": false,
|
|
56
|
+
"inputs": [
|
|
57
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
58
|
+
{ "internalType": "bool", "name": "approved", "type": "bool" }
|
|
59
|
+
],
|
|
60
|
+
"name": "setApprovalForAll",
|
|
61
|
+
"outputs": [],
|
|
62
|
+
"payable": false,
|
|
63
|
+
"stateMutability": "nonpayable",
|
|
64
|
+
"type": "function"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"constant": false,
|
|
68
|
+
"inputs": [
|
|
69
|
+
{ "internalType": "address", "name": "from", "type": "address" },
|
|
70
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
71
|
+
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }
|
|
72
|
+
],
|
|
73
|
+
"name": "transferFrom",
|
|
74
|
+
"outputs": [],
|
|
75
|
+
"payable": false,
|
|
76
|
+
"stateMutability": "nonpayable",
|
|
77
|
+
"type": "function"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"inputs": [],
|
|
81
|
+
"payable": false,
|
|
82
|
+
"stateMutability": "nonpayable",
|
|
83
|
+
"type": "constructor"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"anonymous": false,
|
|
87
|
+
"inputs": [
|
|
88
|
+
{
|
|
89
|
+
"indexed": true,
|
|
90
|
+
"internalType": "address",
|
|
91
|
+
"name": "from",
|
|
92
|
+
"type": "address"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"indexed": true,
|
|
96
|
+
"internalType": "address",
|
|
97
|
+
"name": "to",
|
|
98
|
+
"type": "address"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"indexed": true,
|
|
102
|
+
"internalType": "uint256",
|
|
103
|
+
"name": "tokenId",
|
|
104
|
+
"type": "uint256"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"name": "Transfer",
|
|
108
|
+
"type": "event"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"anonymous": false,
|
|
112
|
+
"inputs": [
|
|
113
|
+
{
|
|
114
|
+
"indexed": true,
|
|
115
|
+
"internalType": "address",
|
|
116
|
+
"name": "owner",
|
|
117
|
+
"type": "address"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"indexed": true,
|
|
121
|
+
"internalType": "address",
|
|
122
|
+
"name": "approved",
|
|
123
|
+
"type": "address"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"indexed": true,
|
|
127
|
+
"internalType": "uint256",
|
|
128
|
+
"name": "tokenId",
|
|
129
|
+
"type": "uint256"
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"name": "Approval",
|
|
133
|
+
"type": "event"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"anonymous": false,
|
|
137
|
+
"inputs": [
|
|
138
|
+
{
|
|
139
|
+
"indexed": true,
|
|
140
|
+
"internalType": "address",
|
|
141
|
+
"name": "owner",
|
|
142
|
+
"type": "address"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"indexed": true,
|
|
146
|
+
"internalType": "address",
|
|
147
|
+
"name": "operator",
|
|
148
|
+
"type": "address"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"indexed": false,
|
|
152
|
+
"internalType": "bool",
|
|
153
|
+
"name": "approved",
|
|
154
|
+
"type": "bool"
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"name": "ApprovalForAll",
|
|
158
|
+
"type": "event"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"constant": true,
|
|
162
|
+
"inputs": [
|
|
163
|
+
{ "internalType": "address", "name": "owner", "type": "address" }
|
|
164
|
+
],
|
|
165
|
+
"name": "balanceOf",
|
|
166
|
+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
167
|
+
"payable": false,
|
|
168
|
+
"stateMutability": "view",
|
|
169
|
+
"type": "function"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"constant": true,
|
|
173
|
+
"inputs": [
|
|
174
|
+
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }
|
|
175
|
+
],
|
|
176
|
+
"name": "getApproved",
|
|
177
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
178
|
+
"payable": false,
|
|
179
|
+
"stateMutability": "view",
|
|
180
|
+
"type": "function"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"constant": true,
|
|
184
|
+
"inputs": [
|
|
185
|
+
{ "internalType": "address", "name": "owner", "type": "address" },
|
|
186
|
+
{ "internalType": "address", "name": "operator", "type": "address" }
|
|
187
|
+
],
|
|
188
|
+
"name": "isApprovedForAll",
|
|
189
|
+
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
|
190
|
+
"payable": false,
|
|
191
|
+
"stateMutability": "view",
|
|
192
|
+
"type": "function"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"constant": true,
|
|
196
|
+
"inputs": [
|
|
197
|
+
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }
|
|
198
|
+
],
|
|
199
|
+
"name": "ownerOf",
|
|
200
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
201
|
+
"payable": false,
|
|
202
|
+
"stateMutability": "view",
|
|
203
|
+
"type": "function"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"constant": true,
|
|
207
|
+
"inputs": [
|
|
208
|
+
{ "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" }
|
|
209
|
+
],
|
|
210
|
+
"name": "supportsInterface",
|
|
211
|
+
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
|
212
|
+
"payable": false,
|
|
213
|
+
"stateMutability": "view",
|
|
214
|
+
"type": "function"
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
{ "abi": [
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{
|
|
5
|
+
"internalType": "uint256",
|
|
6
|
+
"name": "tokenId",
|
|
7
|
+
"type": "uint256"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"internalType": "uint128",
|
|
11
|
+
"name": "liquidity",
|
|
12
|
+
"type": "uint128"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"internalType": "uint256",
|
|
16
|
+
"name": "amount0Min",
|
|
17
|
+
"type": "uint256"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"internalType": "uint256",
|
|
21
|
+
"name": "amount1Min",
|
|
22
|
+
"type": "uint256"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"internalType": "uint256",
|
|
26
|
+
"name": "deadline",
|
|
27
|
+
"type": "uint256"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"name": "decreaseStakedLiquidity",
|
|
31
|
+
"outputs": [
|
|
32
|
+
{
|
|
33
|
+
"internalType": "uint256",
|
|
34
|
+
"name": "amount0",
|
|
35
|
+
"type": "uint256"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"internalType": "uint256",
|
|
39
|
+
"name": "amount1",
|
|
40
|
+
"type": "uint256"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"stateMutability": "nonpayable",
|
|
44
|
+
"type": "function"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"inputs": [
|
|
48
|
+
{
|
|
49
|
+
"internalType": "uint256",
|
|
50
|
+
"name": "tokenId",
|
|
51
|
+
"type": "uint256"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"name": "deposit",
|
|
55
|
+
"outputs": [],
|
|
56
|
+
"stateMutability": "nonpayable",
|
|
57
|
+
"type": "function"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"inputs": [
|
|
61
|
+
{
|
|
62
|
+
"internalType": "uint256",
|
|
63
|
+
"name": "tokenId",
|
|
64
|
+
"type": "uint256"
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"name": "getReward",
|
|
68
|
+
"outputs": [],
|
|
69
|
+
"stateMutability": "nonpayable",
|
|
70
|
+
"type": "function"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"inputs": [
|
|
74
|
+
{
|
|
75
|
+
"internalType": "address",
|
|
76
|
+
"name": "account",
|
|
77
|
+
"type": "address"
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"name": "getReward",
|
|
81
|
+
"outputs": [],
|
|
82
|
+
"stateMutability": "nonpayable",
|
|
83
|
+
"type": "function"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"inputs": [
|
|
87
|
+
{
|
|
88
|
+
"internalType": "uint256",
|
|
89
|
+
"name": "tokenId",
|
|
90
|
+
"type": "uint256"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"internalType": "uint256",
|
|
94
|
+
"name": "amount0Desired",
|
|
95
|
+
"type": "uint256"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"internalType": "uint256",
|
|
99
|
+
"name": "amount1Desired",
|
|
100
|
+
"type": "uint256"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"internalType": "uint256",
|
|
104
|
+
"name": "amount0Min",
|
|
105
|
+
"type": "uint256"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"internalType": "uint256",
|
|
109
|
+
"name": "amount1Min",
|
|
110
|
+
"type": "uint256"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"internalType": "uint256",
|
|
114
|
+
"name": "deadline",
|
|
115
|
+
"type": "uint256"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"name": "increaseStakedLiquidity",
|
|
119
|
+
"outputs": [
|
|
120
|
+
{
|
|
121
|
+
"internalType": "uint128",
|
|
122
|
+
"name": "liquidity",
|
|
123
|
+
"type": "uint128"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"internalType": "uint256",
|
|
127
|
+
"name": "amount0",
|
|
128
|
+
"type": "uint256"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"internalType": "uint256",
|
|
132
|
+
"name": "amount1",
|
|
133
|
+
"type": "uint256"
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"stateMutability": "payable",
|
|
137
|
+
"type": "function"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"inputs": [],
|
|
141
|
+
"name": "nft",
|
|
142
|
+
"outputs": [
|
|
143
|
+
{
|
|
144
|
+
"internalType": "address",
|
|
145
|
+
"name": "",
|
|
146
|
+
"type": "address"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"stateMutability": "view",
|
|
150
|
+
"type": "function"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"inputs": [
|
|
154
|
+
{
|
|
155
|
+
"internalType": "uint256",
|
|
156
|
+
"name": "tokenId",
|
|
157
|
+
"type": "uint256"
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
"name": "withdraw",
|
|
161
|
+
"outputs": [],
|
|
162
|
+
"stateMutability": "nonpayable",
|
|
163
|
+
"type": "function"
|
|
164
|
+
}
|
|
165
|
+
]}
|