@dhedge/v2-sdk 2.0.0 → 2.0.2

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.
@@ -1,5 +1,5 @@
1
1
  import { Contract, ethers, Wallet, BigNumber } from "ethers";
2
- import { Dapp, FundComposition, AssetEnabled, Network, LyraOptionMarket, LyraOptionType, LyraTradeType, LyraPosition } from "../types";
2
+ import { Dapp, FundComposition, AssetEnabled, Network, LyraOptionMarket, LyraOptionType, LyraTradeType, LyraPosition, SDKOptions } from "../types";
3
3
  import { Utils } from "./utils";
4
4
  export declare class Pool {
5
5
  readonly poolLogic: Contract;
@@ -48,50 +48,50 @@ export declare class Pool {
48
48
  * @param {string} asset Address of asset
49
49
  * @param {BigNumber | string} Amount to be approved
50
50
  * @param {any} options Transaction options
51
- * @param {boolean} estimateGas Simulate/estimate gas
51
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
52
52
  * @returns {Promise<any>} Transaction
53
53
  */
54
- approve(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
54
+ approve(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
55
55
  /**
56
56
  * Approve the liquidity pool token for staking
57
57
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
58
58
  * @param {string} asset Address of liquidity pool token
59
59
  * @param {BigNumber | string} amount Aamount to be approved
60
60
  * @param {any} options Transaction options
61
- * @param {boolean} estimateGas Simulate/estimate gas
61
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
62
62
  * @returns {Promise<any>} Transaction
63
63
  */
64
- approveStaking(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
64
+ approveStaking(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
65
65
  /**
66
66
  * Approve the liquidity pool token for staking
67
67
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
68
68
  * @param {string} asset Address of liquidity pool token
69
69
  * @param {BigNumber | string} amount Aamount to be approved
70
70
  * @param {any} options Transaction options
71
- * @param {boolean} estimateGas Simulate/estimate gas
71
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
72
72
  * @returns {Promise<any>} Transaction
73
73
  */
74
- approveUniswapV3Liquidity(asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
74
+ approveUniswapV3Liquidity(asset: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
75
75
  /**
76
76
  * Approve the asset for provided spender address
77
77
  * @param {string} spender Spender address
78
78
  * @param {string} asset Address of asset
79
79
  * @param {BigNumber | string} amount to be approved
80
80
  * @param {any} options Transaction options
81
- * @param {boolean} estimateGas Simulate/estimate gas
81
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
82
82
  * @returns {Promise<any>} Transaction
83
83
  */
84
- approveSpender(spender: string, asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
84
+ approveSpender(spender: string, asset: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
85
85
  /**
86
86
  * Approve NFT for provided spender address
87
87
  * @param {string} spender Spender address
88
88
  * @param {string} asset Address of asset
89
89
  * @param {string} tokenId NFT id
90
90
  * @param {any} options Transaction options
91
- * @param {boolean} estimateGas Simulate/estimate gas
91
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
92
92
  * @returns {Promise<any>} Transaction
93
93
  */
94
- approveSpenderNFT(spender: string, asset: string, tokenId: string, options?: any, estimateGas?: boolean): Promise<any>;
94
+ approveSpenderNFT(spender: string, asset: string, tokenId: string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
95
95
  /**
96
96
  * Trade an asset into another asset
97
97
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
@@ -100,10 +100,10 @@ export declare class Pool {
100
100
  * @param {BigNumber | string} amountIn Amount
101
101
  * @param {number} slippage Slippage tolerance in %
102
102
  * @param {any} options Transaction options
103
- * @param {boolean} estimateGas Simulate/estimate gas
103
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
104
104
  * @returns {Promise<any>} Transaction
105
105
  */
106
- trade(dapp: Dapp, assetFrom: string, assetTo: string, amountIn: BigNumber | string, slippage?: number, options?: any, estimateGas?: boolean): Promise<any>;
106
+ trade(dapp: Dapp, assetFrom: string, assetTo: string, amountIn: BigNumber | string, slippage?: number, options?: any, sdkOptions?: SDKOptions): Promise<any>;
107
107
  /**
108
108
  * Add liquidity to a liquidity pool
109
109
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
@@ -112,10 +112,10 @@ export declare class Pool {
112
112
  * @param {BigNumber | string} amountA Amount first asset
113
113
  * @param {BigNumber | string} amountB Amount second asset
114
114
  * @param {any} options Transaction options
115
- * @param {boolean} estimateGas Simulate/estimate gas
115
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
116
116
  * @returns {Promise<any>} Transaction
117
117
  */
118
- addLiquidity(dapp: Dapp, assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
118
+ addLiquidity(dapp: Dapp, assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
119
119
  /**
120
120
  * Remove liquidity from a liquidity pool
121
121
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
@@ -123,49 +123,49 @@ export declare class Pool {
123
123
  * @param {string} assetB Second asset
124
124
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
125
125
  * @param {any} options Transaction options
126
- * @param {boolean} estimateGas Simulate/estimate gas
126
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
127
127
  * @returns {Promise<any>} Transaction
128
128
  */
129
- removeLiquidity(dapp: Dapp, assetA: string, assetB: string, amount: string | BigNumber, options?: any, estimateGas?: boolean): Promise<any>;
129
+ removeLiquidity(dapp: Dapp, assetA: string, assetB: string, amount: string | BigNumber, options?: any, sdkOptions?: SDKOptions): Promise<any>;
130
130
  /**
131
131
  * Stake liquidity pool tokens in a yield farm
132
132
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
133
133
  * @param {string} asset Liquidity pool token
134
134
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
135
135
  * @param {any} options Transaction options
136
- * @param {boolean} estimateGas Simulate/estimate gas
136
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
137
137
  * @returns {Promise<any>} Transaction
138
138
  */
139
- stake(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
139
+ stake(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
140
140
  /**
141
141
  * Stake liquidity pool tokens in gauge contract
142
142
  * @param {Dapp} dapp Platform like Balancer or Velodrome
143
143
  * @param {string} gauge Gauge contract address
144
144
  * @param {BigNumber | string} amount Amount of liquidity pool tokens or token ID for Velodrome CL
145
145
  * @param {any} options Transaction options
146
- * @param {boolean} estimateGas Simulate/estimate gas
146
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
147
147
  * @returns {Promise<any>} Transaction
148
148
  */
149
- stakeInGauge(dapp: Dapp, gauge: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
149
+ stakeInGauge(dapp: Dapp, gauge: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
150
150
  /**
151
151
  * Unstake liquidity pool tokens from a yield farm
152
152
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
153
153
  * @param {string} asset Liquidity pool token
154
154
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
155
155
  * @param {any} options Transaction options
156
- * @param {boolean} estimateGas Simulate/estimate gas
156
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
157
157
  * @returns {Promise<any>} Transaction
158
158
  */
159
- unStake(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
159
+ unStake(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
160
160
  /**
161
161
  * Unstake liquidity pool tokens from Velodrome or Balancer gauge
162
162
  * @param {string} gauge Gauge contract address
163
163
  * @param {BigNumber | string} amount Amount of liquidity pool tokens or CL token ID
164
164
  * @param {any} options Transaction options
165
- * @param {boolean} estimateGas Simulate/estimate gas
165
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
166
166
  * @returns {Promise<any>} Transaction
167
167
  */
168
- unstakeFromGauge(gauge: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
168
+ unstakeFromGauge(gauge: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
169
169
  /**
170
170
  * Lend asset to a lending pool
171
171
  * @param {Dapp} dapp Platform like Aave
@@ -173,40 +173,40 @@ export declare class Pool {
173
173
  * @param {BigNumber | string} amount Amount of asset to lend
174
174
  * @param {number} referralCode Code from Aave referral program
175
175
  * @param {any} options Transaction options
176
- * @param {boolean} estimateGas Simulate/estimate gas
176
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
177
177
  * @returns {Promise<any>} Transaction
178
178
  */
179
- lend(dapp: Dapp, asset: string, amount: BigNumber | string, referralCode?: number, options?: any, estimateGas?: boolean): Promise<any>;
179
+ lend(dapp: Dapp, asset: string, amount: BigNumber | string, referralCode?: number, options?: any, sdkOptions?: SDKOptions): Promise<any>;
180
180
  /**
181
181
  * Lend asset to a Compound V3 or Fluid lending pool
182
182
  * @param {string} market Address of cToken or fToken
183
183
  * @param {string} asset Asset
184
184
  * @param {BigNumber | string} amount Amount of asset to lend
185
185
  * @param {any} options Transaction options
186
- * @param {boolean} estimateGas Simulate/estimate gas
186
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
187
187
  * @returns {Promise<any>} Transaction
188
188
  */
189
- lendCompoundV3(market: string, asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
189
+ lendCompoundV3(market: string, asset: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
190
190
  /**
191
191
  * Witdraw asset from a lending pool
192
192
  * @param {Dapp} dapp Platform like Aave
193
193
  * @param {string} asset Asset
194
194
  * @param {BigNumber | string} amount Amount of asset to lend
195
195
  * @param {any} options Transaction options
196
- * @param {boolean} estimateGas Simulate/estimate gas
196
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
197
197
  * @returns {Promise<any>} Transaction
198
198
  */
199
- withdrawDeposit(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
199
+ withdrawDeposit(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
200
200
  /**
201
201
  * Witdraw asset from a Compound V3 or Fluid lending pool
202
202
  * @param {string} market Address of cToken or fToken
203
203
  * @param {string} asset Asset
204
204
  * @param {BigNumber | string} amount Amount of asset to withdraw
205
205
  * @param {any} options Transaction options
206
- * @param {boolean} estimateGas Simulate/estimate gas
206
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
207
207
  * @returns {Promise<any>} Transaction
208
208
  */
209
- withdrawCompoundV3(market: string, asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
209
+ withdrawCompoundV3(market: string, asset: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
210
210
  /**
211
211
  * Borrow asset from a lending pool
212
212
  * @param {Dapp} dapp Platform like Aave
@@ -214,29 +214,29 @@ export declare class Pool {
214
214
  * @param {BigNumber | string} amount Amount of asset to lend
215
215
  * @param {number} referralCode Code from Aave referral program
216
216
  * @param {any} options Transaction options
217
- * @param {boolean} estimateGas Simulate/estimate gas
217
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
218
218
  * @returns {Promise<any>} Transaction
219
219
  */
220
- borrow(dapp: Dapp, asset: string, amount: BigNumber | string, referralCode?: number, options?: any, estimateGas?: boolean): Promise<any>;
220
+ borrow(dapp: Dapp, asset: string, amount: BigNumber | string, referralCode?: number, options?: any, sdkOptions?: SDKOptions): Promise<any>;
221
221
  /**
222
222
  * Repays borrowed asset to a lending pool
223
223
  * @param {Dapp} dapp Platform like Aave
224
224
  * @param {string} asset Asset
225
225
  * @param {BigNumber | string} amount Amount of asset to lend
226
226
  * @param {any} options Transaction options
227
- * @param {boolean} estimateGas Simulate/estimate gas
227
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
228
228
  * @returns {Promise<any>} Transaction
229
229
  */
230
- repay(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
230
+ repay(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
231
231
  /**
232
232
  * Claim rewards of staked liquidity pool tokens
233
233
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
234
234
  * @param {string} asset Liquidity pool token
235
235
  * @param {any} options Transaction option
236
- * @param {boolean} estimateGas Simulate/estimate gas
236
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
237
237
  * @returns {Promise<any>} Transaction
238
238
  */
239
- harvestRewards(dapp: Dapp, asset: string, options?: any, estimateGas?: boolean): Promise<any>;
239
+ harvestRewards(dapp: Dapp, asset: string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
240
240
  /**
241
241
  * Change enabled pool assets
242
242
  * @param {AssetEnabled[]} assets New pool assets
@@ -253,16 +253,24 @@ export declare class Pool {
253
253
  * @returns {Promise<any>} Transaction
254
254
  */
255
255
  setTrader(trader: string, options?: any, estimateGas?: boolean): Promise<any>;
256
+ /**
257
+ * Sets a pool private or public
258
+ * @param {boolean} _private True for private, false for public
259
+ * @param {any} options Transaction options
260
+ * @param {boolean} estimateGas Simulate/estimate gas
261
+ * @returns {Promise<any>} Transaction
262
+ */
263
+ setPrivate(_private: boolean, options?: any, estimateGas?: boolean): Promise<any>;
256
264
  /**
257
265
  * Invest into a Balancer pool
258
266
  * @param {string} poolId Balancer pool id
259
267
  * @param {string[] | } assetsIn Array of balancer pool assets
260
268
  * @param {BigNumber[] | string[]} amountsIn Array of maximum amounts to provide to pool
261
269
  * @param {any} options Transaction options
262
- * @param {boolean} estimateGas Simulate/estimate gas
270
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
263
271
  * @returns {Promise<any>} Transaction
264
272
  */
265
- joinBalancerPool(poolId: string, assets: string[], amountsIn: string[] | BigNumber[], options?: any, estimateGas?: boolean): Promise<any>;
273
+ joinBalancerPool(poolId: string, assets: string[], amountsIn: string[] | BigNumber[], options?: any, sdkOptions?: SDKOptions): Promise<any>;
266
274
  /**
267
275
  * Invest into a Balancer pool
268
276
  * @param {string} poolId Balancer pool id
@@ -270,35 +278,35 @@ export declare class Pool {
270
278
  * @param {BigNumber | string } amount Amount of pool tokens to withdraw
271
279
  * @param { null | number } singleExitAssetIndex Index of asset to withdraw to
272
280
  * @param {any} options Transaction options
273
- * @param {boolean} estimateGas Simulate/estimate gas
281
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
274
282
  * @returns {Promise<any>} Transaction
275
283
  */
276
- exitBalancerPool(poolId: string, assets: string[], amount: string | BigNumber, singleExitAssetIndex?: number | null, options?: any, estimateGas?: boolean): Promise<any>;
284
+ exitBalancerPool(poolId: string, assets: string[], amount: string | BigNumber, singleExitAssetIndex?: number | null, options?: any, sdkOptions?: SDKOptions): Promise<any>;
277
285
  /**
278
286
  * Claim rewards from Aave platform
279
287
  * @param {string[]} assets Aave tokens (deposit/debt) hold by pool
280
288
  * @param {any} options Transaction options
281
- * @param {boolean} estimateGas Simulate/estimate gas
289
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
282
290
  * @returns {Promise<any>} Transaction
283
291
  */
284
- harvestAaveRewards(assets: string[], options?: any, estimateGas?: boolean): Promise<any>;
292
+ harvestAaveRewards(assets: string[], options?: any, sdkOptions?: SDKOptions): Promise<any>;
285
293
  /**
286
294
  * Claim rewards from Aave platform
287
295
  * @param {string[]} assets Assets invested in Aave
288
296
  * @param {string} rewardAssets Reward token address
289
297
  * @param {any} options Transaction options
290
- * @param {boolean} estimateGas Simulate/estimate gas
298
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
291
299
  * @returns {Promise<any>} Transaction
292
300
  */
293
- harvestAaveV3Rewards(assets: string[], rewardAsset: string, options?: any, estimateGas?: boolean): Promise<any>;
301
+ harvestAaveV3Rewards(assets: string[], rewardAsset: string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
294
302
  /**
295
303
  * Claim rewards from CompoundV3
296
304
  * @param {string} asset Compound lending asset
297
305
  * @param {any} options Transaction options
298
- * @param {boolean} estimateGas Simulate/estimate gas
306
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
299
307
  * @returns {Promise<any>} Transaction
300
308
  */
301
- harvestCompoundV3Rewards(asset: string, options?: any, estimateGas?: boolean): Promise<any>;
309
+ harvestCompoundV3Rewards(asset: string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
302
310
  /**
303
311
  * Create UniswapV3 liquidity pool
304
312
  * @param {dapp} Platform UniswapV3, VelodromeCL, AerodromeCL or RamesesCL
@@ -312,20 +320,20 @@ export declare class Pool {
312
320
  * @param { number } maxTick Upper tick range
313
321
  * @param { number } feeAmountOrTickSpacing Fee tier UniswapV3 or tick spacing VelodromeCL
314
322
  * @param {any} options Transaction options
315
- * @param {boolean} estimateGas Simulate/estimate gas
323
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
316
324
  * @returns {Promise<any>} Transaction
317
325
  */
318
- addLiquidityUniswapV3(dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL | Dapp.RAMSESCL | Dapp.PANCAKECL, assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, minPrice: number | null, maxPrice: number | null, minTick: number | null, maxTick: number | null, feeAmountOrTickSpacing: number, options?: any, estimateGas?: boolean): Promise<any>;
326
+ addLiquidityUniswapV3(dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL | Dapp.RAMSESCL | Dapp.PANCAKECL, assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, minPrice: number | null, maxPrice: number | null, minTick: number | null, maxTick: number | null, feeAmountOrTickSpacing: number, options?: any, sdkOptions?: SDKOptions): Promise<any>;
319
327
  /**
320
328
  * Remove liquidity from an UniswapV3 or Arrakis liquidity pool
321
329
  * @param {Dapp} dapp Platform either UniswapV3 or Arrakis
322
330
  * @param {string} tokenId Token Id of UniswapV3 position
323
331
  * @param {number} amount Amount in percent of assets to be removed
324
332
  * @param {any} options Transaction options
325
- * @param {boolean} estimateGas Simulate/estimate gas
333
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
326
334
  * @returns {Promise<any>} Transaction
327
335
  */
328
- decreaseLiquidity(dapp: Dapp, tokenId: string, amount?: number, options?: any, estimateGas?: boolean): Promise<any>;
336
+ decreaseLiquidity(dapp: Dapp, tokenId: string, amount?: number, options?: any, sdkOptions?: SDKOptions): Promise<any>;
329
337
  /**
330
338
  * Increase liquidity of an UniswapV, VelodromeCL or Arrakis liquidity pool
331
339
  * @param {Dapp} dapp Platform either UniswapV3 or Arrakis
@@ -333,29 +341,29 @@ export declare class Pool {
333
341
  * @param {BigNumber | string} amountA Amount first asset
334
342
  * @param {BigNumber | string} amountB Amount second asset
335
343
  * @param {any} options Transaction options
336
- * @param {boolean} estimateGas Simulate/estimate gas
344
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
337
345
  * @returns {Promise<any>} Transaction
338
346
  */
339
- increaseLiquidity(dapp: Dapp, tokenId: string, amountA: BigNumber | string, amountB: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
347
+ increaseLiquidity(dapp: Dapp, tokenId: string, amountA: BigNumber | string, amountB: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
340
348
  /**
341
349
  * Claim fees of an UniswapV3 liquidity or Arrakis pool
342
350
  * @param {Dapp} dapp Platform either UniswapV3 or Arrakis
343
351
  * @param {string} tokenId Token Id of UniswapV3 or Gauge address
344
352
  * @param {any} options Transaction option
345
- * @param {boolean} estimateGas Simulate/estimate gas
353
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
346
354
  * @returns {Promise<any>} Transaction
347
355
  */
348
- claimFees(dapp: Dapp, tokenId: string, options?: any, estimateGas?: boolean): Promise<any>;
356
+ claimFees(dapp: Dapp, tokenId: string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
349
357
  /**
350
358
  * Get rewards of an NFT position
351
359
  * @param {Dapp} dapp Platform e.g. Ramses CL
352
360
  * @param {string} tokenId Token Id
353
361
  * @param {string[]} rewards Reward tokens
354
362
  * @param {any} options Transaction option
355
- * @param {boolean} estimateGas Simulate/estimate gas
363
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
356
364
  * @returns {Promise<any>} Transaction
357
365
  */
358
- getRewards(dapp: Dapp, tokenId: string, rewards: string[], options?: any, estimateGas?: boolean): Promise<any>;
366
+ getRewards(dapp: Dapp, tokenId: string, rewards: string[], options?: any, sdkOptions?: SDKOptions): Promise<any>;
359
367
  /**
360
368
  * Trade an asset into another asset
361
369
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
@@ -365,10 +373,10 @@ export declare class Pool {
365
373
  * @param { FeeAmount } feeAmount Fee tier (Low 0.05%, Medium 0.3%, High 1%)
366
374
  * @param {number} slippage Slippage tolerance in %
367
375
  * @param {any} options Transaction options
368
- * @param {boolean} estimateGas Simulate/estimate gas
376
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
369
377
  * @returns {Promise<any>} Transaction
370
378
  */
371
- tradeUniswapV3(assetFrom: string, assetTo: string, amountIn: BigNumber | string, feeAmount: number, slippage?: number, options?: any, estimateGas?: boolean): Promise<any>;
379
+ tradeUniswapV3(assetFrom: string, assetTo: string, amountIn: BigNumber | string, feeAmount: number, slippage?: number, options?: any, sdkOptions?: SDKOptions): Promise<any>;
372
380
  /**
373
381
  * Add liquidity to Velodrome pool
374
382
  * @param {string} assetA First asset
@@ -377,10 +385,10 @@ export declare class Pool {
377
385
  * @param {BigNumber | string} amountB Amount second asset
378
386
  * @param { boolean } isStable Is stable pool
379
387
  * @param {any} options Transaction options
380
- * @param {boolean} estimateGas Simulate/estimate gas
388
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
381
389
  * @returns {Promise<any>} Transaction
382
390
  */
383
- addLiquidityVelodrome(assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, isStable: boolean, options?: any, estimateGas?: boolean): Promise<any>;
391
+ addLiquidityVelodrome(assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, isStable: boolean, options?: any, sdkOptions?: SDKOptions): Promise<any>;
384
392
  /**
385
393
  * Remove liquidity from Velodrome pool
386
394
  * @param {string} assetA First asset
@@ -388,10 +396,10 @@ export declare class Pool {
388
396
  * @param {BigNumber | string} amount Amount of LP tokens
389
397
  * @param { boolean } isStable Is stable pool
390
398
  * @param {any} options Transaction options
391
- * @param {boolean} estimateGas Simulate/estimate gas
399
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
392
400
  * @returns {Promise<any>} Transaction
393
401
  */
394
- removeLiquidityVelodrome(assetA: string, assetB: string, amount: BigNumber | string, isStable: boolean, options?: any, estimateGas?: boolean): Promise<any>;
402
+ removeLiquidityVelodrome(assetA: string, assetB: string, amount: BigNumber | string, isStable: boolean, options?: any, sdkOptions?: SDKOptions): Promise<any>;
395
403
  /**
396
404
  * Add liquidity to Velodrome V2 pool
397
405
  * @param {string} assetA First asset
@@ -400,10 +408,10 @@ export declare class Pool {
400
408
  * @param {BigNumber | string} amountB Amount second asset
401
409
  * @param { boolean } isStable Is stable pool
402
410
  * @param {any} options Transaction options
403
- * @param {boolean} estimateGas Simulate/estimate gas
411
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
404
412
  * @returns {Promise<any>} Transaction
405
413
  */
406
- addLiquidityVelodromeV2(assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, isStable: boolean, options?: any, estimateGas?: boolean): Promise<any>;
414
+ addLiquidityVelodromeV2(assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, isStable: boolean, options?: any, sdkOptions?: SDKOptions): Promise<any>;
407
415
  /**
408
416
  * Remove liquidity from Velodrome V2 pool
409
417
  * @param {string} assetA First asset
@@ -411,10 +419,10 @@ export declare class Pool {
411
419
  * @param {BigNumber | string} amount Amount of LP tokens
412
420
  * @param { boolean } isStable Is stable pool
413
421
  * @param {any} options Transaction options
414
- * @param {boolean} estimateGas Simulate/estimate gas
422
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
415
423
  * @returns {Promise<any>} Transaction
416
424
  */
417
- removeLiquidityVelodromeV2(assetA: string, assetB: string, amount: BigNumber | string, isStable: boolean, options?: any, estimateGas?: boolean): Promise<any>;
425
+ removeLiquidityVelodromeV2(assetA: string, assetB: string, amount: BigNumber | string, isStable: boolean, options?: any, sdkOptions?: SDKOptions): Promise<any>;
418
426
  /**
419
427
  * Add liquidity to Velodrome V2 or Ramses pool
420
428
  * @param {Dapp} dapp VelodromeV2, Ramses or Aerodrome
@@ -424,10 +432,10 @@ export declare class Pool {
424
432
  * @param {BigNumber | string} amountB Amount second asset
425
433
  * @param { boolean } isStable Is stable pool
426
434
  * @param {any} options Transaction options
427
- * @param {boolean} estimateGas Simulate/estimate gas
435
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
428
436
  * @returns {Promise<any>} Transaction
429
437
  */
430
- addLiquidityV2(dapp: Dapp.VELODROMEV2 | Dapp.RAMSES | Dapp.AERODROME, assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, isStable: boolean, options?: any, estimateGas?: boolean): Promise<any>;
438
+ addLiquidityV2(dapp: Dapp.VELODROMEV2 | Dapp.RAMSES | Dapp.AERODROME, assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, isStable: boolean, options?: any, sdkOptions?: SDKOptions): Promise<any>;
431
439
  /**
432
440
  * Remove liquidity from Velodrome V2 or Ramses pool
433
441
  * @param {Dapp} dapp VelodromeV2, Ramses or Aerodrome
@@ -436,10 +444,10 @@ export declare class Pool {
436
444
  * @param {BigNumber | string} amount Amount of LP tokens
437
445
  * @param { boolean } isStable Is stable pool
438
446
  * @param {any} options Transaction options
439
- * @param {boolean} estimateGas Simulate/estimate gas
447
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
440
448
  * @returns {Promise<any>} Transaction
441
449
  */
442
- removeLiquidityV2(dapp: Dapp.VELODROMEV2 | Dapp.RAMSES | Dapp.AERODROME, assetA: string, assetB: string, amount: BigNumber | string, isStable: boolean, options?: any, estimateGas?: boolean): Promise<any>;
450
+ removeLiquidityV2(dapp: Dapp.VELODROMEV2 | Dapp.RAMSES | Dapp.AERODROME, assetA: string, assetB: string, amount: BigNumber | string, isStable: boolean, options?: any, sdkOptions?: SDKOptions): Promise<any>;
443
451
  /**
444
452
  * Trade options on lyra
445
453
  * @param {LyraOptionMarket} market Underlying market e.g. eth
@@ -452,10 +460,10 @@ export declare class Pool {
452
460
  * @param {BigNumber | string } collateralChangeAmount Collateral amount to add when shorting options and to remove when covering shorts
453
461
  * @param {boolean} isCoveredCall Selling covered call options
454
462
  * @param {any} options Transaction options
455
- * @param {boolean} estimateGas Simulate/estimate gas
463
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
456
464
  * @returns {Promise<any>} Transaction
457
465
  */
458
- tradeLyraOption(market: LyraOptionMarket, expiry: number, strike: number, optionType: LyraOptionType, tradeType: LyraTradeType, optionAmount: BigNumber | string, assetIn: string, collateralChangeAmount?: BigNumber | string, isCoveredCall?: boolean, options?: any, estimateGas?: boolean): Promise<any>;
466
+ tradeLyraOption(market: LyraOptionMarket, expiry: number, strike: number, optionType: LyraOptionType, tradeType: LyraTradeType, optionAmount: BigNumber | string, assetIn: string, collateralChangeAmount?: BigNumber | string, isCoveredCall?: boolean, options?: any, sdkOptions?: SDKOptions): Promise<any>;
459
467
  /**
460
468
  * Gets Lyra option positions
461
469
  * @returns {Promise<Position>} Transaction
@@ -466,27 +474,27 @@ export declare class Pool {
466
474
  * @param {string} market Address of futures market
467
475
  * @param {BigNumber | string } changeAmount Amount to increase/decrease margin
468
476
  * @param {any} options Transaction options
469
- * @param {boolean} estimateGas Simulate/estimate gas
477
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
470
478
  * @returns {Promise<any>} Transaction
471
479
  */
472
- changeFuturesMargin(market: string, changeAmount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
480
+ changeFuturesMargin(market: string, changeAmount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
473
481
  /** Change position in Synthetix futures market (long/short)
474
482
  *
475
483
  * @param {string} market Address of futures market
476
484
  * @param {BigNumber | string } changeAmount Negative for short, positive for long
477
485
  * @param {any} options Transaction options
478
- * @param {boolean} estimateGas Simulate/estimate gas
486
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
479
487
  * @returns {Promise<any>} Transaction
480
488
  */
481
- changeFuturesPosition(market: string, changeAmount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
489
+ changeFuturesPosition(market: string, changeAmount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
482
490
  /** Cancels an open oder on Synthetix futures market
483
491
  *
484
492
  * @param {string} market Address of futures market
485
493
  * @param {any} options Transaction options
486
- * @param {boolean} estimateGas Simulate/estimate gas
494
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
487
495
  * @returns {Promise<any>} Transaction
488
496
  */
489
- cancelFuturesOrder(market: string, options?: any, estimateGas?: boolean): Promise<any>;
497
+ cancelFuturesOrder(market: string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
490
498
  /**
491
499
  * mintManagerFee
492
500
  * @param {any} options Transaction options
@@ -504,47 +512,47 @@ export declare class Pool {
504
512
  * @param {string} tokenAddress Address of the token to vest
505
513
  * @param {BigNumber | string } changeAmount Negative for short, positive for long
506
514
  * @param {any} options Transaction options
507
- * @param {boolean} estimateGas Simulate/estimate gas
515
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
508
516
  * @returns {Promise<any>} Transaction
509
517
  */
510
- vestTokens(tokenAddress: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
518
+ vestTokens(tokenAddress: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
511
519
  /** Exit position of vested tokens (e.g. Ramses xoRAM)
512
520
  *
513
521
  * @param {string} tokenAddress Address of the token to vest
514
522
  * @param {number } id position Id of the vested tokens
515
523
  * @param {any} options Transaction options
516
- * @param {boolean} estimateGas Simulate/estimate gas
524
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
517
525
  * @returns {Promise<any>} Transaction
518
526
  */
519
- exitVestedToken(tokenAddress: string, id: number, options?: any, estimateGas?: boolean): Promise<any>;
527
+ exitVestedToken(tokenAddress: string, id: number, options?: any, sdkOptions?: SDKOptions): Promise<any>;
520
528
  /** deposit rETH to mint UNIT via the Flat Money protocol
521
529
  *
522
530
  * @param { BigNumber | string } depositAmount Amount of rETH to deposit
523
531
  * @param { number } slippage slippage, 0.5 represents 0.5%
524
532
  * @param { number | null } maxKeeperFeeInUsd 5 represents $5; null will skip the maxKeeperFee check
525
533
  * @param {any} options Transaction options
526
- * @param {boolean} estimateGas Simulate/estimate gas
534
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
527
535
  * @returns {Promise<any>} Transaction
528
536
  */
529
- mintUnitViaFlatMoney(depositAmount: ethers.BigNumber | string, slippage: number | undefined, maxKeeperFeeInUsd: number | null, options?: any, estimateGas?: boolean): Promise<any>;
537
+ mintUnitViaFlatMoney(depositAmount: ethers.BigNumber | string, slippage: number | undefined, maxKeeperFeeInUsd: number | null, options?: any, sdkOptions?: SDKOptions): Promise<any>;
530
538
  /** redeem UNIT via the Flat Money protocol
531
539
  *
532
540
  * @param { BigNumber | string } depositAmount Amount of UNIT to withdraw
533
541
  * @param { number } slippage slippage, 0.5 represents 0.5%
534
542
  * @param { number | null } maxKeeperFeeInUsd 5 represents $5; null will skip the maxKeeperFee check
535
543
  * @param {any} options Transaction options
536
- * @param {boolean} estimateGas Simulate/estimate gas
544
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
537
545
  * @returns {Promise<any>} Transaction
538
546
  */
539
- redeemUnitViaFlatMoney(withdrawAmount: ethers.BigNumber | string, slippage: number | undefined, maxKeeperFeeInUsd: number | null, options?: any, estimateGas?: boolean): Promise<any>;
547
+ redeemUnitViaFlatMoney(withdrawAmount: ethers.BigNumber | string, slippage: number | undefined, maxKeeperFeeInUsd: number | null, options?: any, sdkOptions?: SDKOptions): Promise<any>;
540
548
  cancelOrderViaFlatMoney(options?: any, estimateGas?: boolean): Promise<any>;
541
549
  /**
542
550
  * Complete a Toros withdrawal to a single asset
543
551
  * @param {string} destinationToken Address of destination asset
544
552
  * @param {number} slippage Slippage tolerance in %
545
553
  * @param {any} options Transaction options
546
- * @param {boolean} estimateGas Simulate/estimate gas
554
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
547
555
  * @returns {Promise<any>} Transaction
548
556
  */
549
- completeTorosWithdrawal(destinationToken: string, slippage?: number, options?: any, estimateGas?: boolean): Promise<any>;
557
+ completeTorosWithdrawal(destinationToken: string, slippage?: number, options?: any, sdkOptions?: SDKOptions): Promise<any>;
550
558
  }
@@ -1,10 +1,10 @@
1
- import { Pool, ethers } from "../..";
1
+ import { Pool, SDKOptions, ethers } from "../..";
2
2
  export declare function getAnnounceStableDepositTxData(depositAmount: ethers.BigNumber | string, minAmountOut: ethers.BigNumber | string, keeperFee: ethers.BigNumber | string): string;
3
3
  export declare function getAnnounceStableWithdrawTxData(withdrawAmount: ethers.BigNumber | string, minAmountOut: ethers.BigNumber | string, keeperFee: ethers.BigNumber | string): string;
4
4
  export declare function getCancelExistingOrderTxData(account: string): string;
5
5
  export declare function getCancelExistingOrderTxDataForV2(account: string): string;
6
6
  export declare function mintUnitViaFlatMoney(pool: Pool, depositAmount: ethers.BigNumber | string, slippage: number, // 0.5 means 0.5%
7
- maxKeeperFeeInUsd: number | null, options?: any, estimateGas?: boolean): Promise<any>;
7
+ maxKeeperFeeInUsd: number | null, options?: any, sdkOptions?: SDKOptions): Promise<any>;
8
8
  export declare function redeemUnitViaFlatMoney(pool: Pool, withdrawAmount: ethers.BigNumber | string, slippage: number, // 0.5 means 0.5%
9
- maxKeeperFeeInUsd: number | null, options?: any, estimateGas?: boolean): Promise<any>;
10
- export declare function cancelOrderViaFlatMoney(pool: Pool, options?: any, estimateGas?: boolean): Promise<any>;
9
+ maxKeeperFeeInUsd: number | null, options?: any, sdkOptions?: SDKOptions): Promise<any>;
10
+ export declare function cancelOrderViaFlatMoney(pool: Pool, options?: any, sdkOptions?: SDKOptions): Promise<any>;
@@ -1,5 +1,6 @@
1
1
  import { ethers } from "../..";
2
2
  import { Pool } from "../../entities";
3
+ export declare const odosBaseUrl = "https://api.odos.xyz/sor";
3
4
  export declare function getOdosSwapTxData(pool: Pool, assetFrom: string, assetTo: string, amountIn: ethers.BigNumber | string, slippage: number): Promise<{
4
5
  swapTxData: string;
5
6
  minAmountOut: string;
@@ -0,0 +1,7 @@
1
+ import { ethers, Pool } from "../..";
2
+ export interface TrackedAsset {
3
+ token: string;
4
+ balance: ethers.BigNumber;
5
+ }
6
+ export declare const createCompleteWithdrawalTxArguments: (pool: Pool, receiveToken: string, slippage: number) => Promise<any>;
7
+ export declare const getCompleteWithdrawalTxData: (pool: Pool, receiveToken: string, slippage: number, useOnChainSwap: boolean) => Promise<string>;
@@ -1,8 +1,8 @@
1
1
  import { ethers } from "ethers";
2
2
  import { Pool } from "../..";
3
+ export declare const LOW_USD_VALUE_FOR_WITHDRAWAL = 1;
4
+ export declare const SLIPPAGE_FOR_LOW_VALUE_SWAP = 500;
3
5
  export declare function getPoolDepositAsset(pool: Pool, poolAddress: string, investAsset: string): Promise<string | undefined>;
4
6
  export declare function getTorosPoolTokenPrice(pool: Pool, poolAddress: string): Promise<ethers.BigNumber>;
5
7
  export declare function getEasySwapperDepositQuote(pool: Pool, torosAsset: string, investAsset: string, amountIn: ethers.BigNumber): Promise<ethers.BigNumber>;
6
- export declare function getEasySwapperWithdrawalQuote(pool: Pool, torosAsset: string, investAsset: string, amountIn: ethers.BigNumber): Promise<ethers.BigNumber>;
7
8
  export declare function getEasySwapperTxData(pool: Pool, assetFrom: string, assetTo: string, amountIn: ethers.BigNumber, slippage: number): Promise<any>;
8
- export declare function getCompleteWithdrawalTxData(pool: Pool, destToken: string, slippage: number): Promise<string>;
@@ -0,0 +1,3 @@
1
+ import { Pool } from "../..";
2
+ export declare const createWithdrawTxArguments: (pool: Pool, torosAsset: string, amountIn: string, slippage: number, useOnChainSwap: boolean) => Promise<any>;
3
+ export declare const getInitWithdrawalTxData: (pool: Pool, torosAsset: string, amountIn: string, slippage: number, useOnChainSwap: boolean) => Promise<string>;
@@ -0,0 +1,5 @@
1
+ export declare function retry<T>({ fn, maxRetries, delayMs }: {
2
+ fn: () => Promise<T>;
3
+ maxRetries?: number;
4
+ delayMs?: number;
5
+ }): Promise<T>;