@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.
- package/README.md +400 -53
- package/dist/config.d.ts +14 -2
- package/dist/entities/pool.d.ts +25 -86
- package/dist/entities/utils.d.ts +15 -0
- package/dist/services/cowSwap/index.d.ts +10 -0
- package/dist/services/hyperliquid/index.d.ts +22 -0
- package/dist/services/kyberSwap/index.d.ts +1 -1
- package/dist/services/oneInch/index.d.ts +1 -1
- package/dist/services/toros/easySwapper.d.ts +14 -0
- package/dist/services/toros/swapData.d.ts +5 -5
- package/dist/services/uniswap/V3Liquidity.d.ts +2 -2
- package/dist/services/velodrome/liquidity.d.ts +3 -0
- package/dist/test/constants.d.ts +48 -3
- package/dist/test/utils/testingHelper.d.ts +4 -0
- package/dist/types.d.ts +21 -5
- package/dist/utils/contract.d.ts +20 -0
- package/dist/v2-sdk.cjs.development.js +5193 -6711
- 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 +5198 -6711
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/PoolFactory.json +414 -204
- package/src/abi/PoolLogic.json +160 -134
- package/src/config.ts +19 -9
- package/src/entities/pool.ts +103 -254
- package/src/entities/utils.ts +15 -0
- package/src/services/cowSwap/index.ts +281 -0
- package/src/services/hyperliquid/index.ts +22 -0
- package/src/services/kyberSwap/index.ts +5 -3
- package/src/services/oneInch/index.ts +5 -4
- package/src/services/toros/completeWithdrawal.ts +57 -40
- package/src/services/toros/easySwapper.ts +15 -1
- package/src/services/toros/initWithdrawal.ts +39 -31
- package/src/services/toros/swapData.ts +45 -131
- package/src/services/uniswap/V3Liquidity.ts +3 -24
- package/src/services/velodrome/liquidity.ts +3 -0
- package/src/test/aave.test.ts +99 -70
- package/src/test/aerodrome.test.ts +53 -24
- package/src/test/aerodromeCL.test.ts +64 -30
- package/src/test/arrakis.test.ts +23 -35
- package/src/test/balancer.test.ts +114 -106
- package/src/test/compoundV3.test.ts +45 -29
- package/src/test/constants.ts +57 -12
- package/src/test/cowswap.test.ts +79 -0
- package/src/test/dhedge.test.ts +45 -12
- package/src/test/flatmoney.test.ts +25 -39
- package/src/test/fluid.test.ts +33 -24
- package/src/test/hyperliquid.onchain.test.ts +131 -0
- package/src/test/kyberSwap.test.ts +37 -16
- package/src/test/lyra.test.ts +159 -150
- package/src/test/odos.test.ts +2 -2
- package/src/test/oneInch.test.ts +36 -22
- package/src/test/pancakeCL.test.ts +72 -31
- package/src/test/pendle.test.ts +94 -54
- package/src/test/{pendleMint.test.ts → pendleMint.onchain.test.ts} +22 -8
- package/src/test/pool.test.ts +152 -95
- package/src/test/toros.onchain.test.ts +92 -0
- package/src/test/toros.test.ts +74 -20
- package/src/test/torosLimitOrder.test.ts +87 -42
- package/src/test/uniswap.test.ts +77 -128
- package/src/test/utils/testingHelper.ts +120 -0
- package/src/test/velodrome.test.ts +126 -92
- package/src/test/velodromeCL.test.ts +43 -31
- package/src/test/velodromeV2.test.ts +153 -95
- package/src/types.ts +22 -6
- package/src/utils/contract.ts +20 -0
- package/dist/services/futures/constants.d.ts +0 -1
- package/dist/services/futures/index.d.ts +0 -2
- package/dist/services/futures/margin.d.ts +0 -2
- package/dist/services/futures/trade.d.ts +0 -3
- package/dist/services/ramses/vesting.d.ts +0 -4
- package/dist/services/uniswap/V3Trade.d.ts +0 -3
- package/dist/test/utils/futures.d.ts +0 -2
- package/src/abi/IRamsesNonfungiblePositionManager.json +0 -486
- package/src/abi/ISynthetiXFuturesMarketV2.json +0 -531
- package/src/abi/ISynthetix.json +0 -139
- package/src/abi/IUniswapV3Quoter.json +0 -195
- package/src/abi/IUniswapV3Router.json +0 -221
- package/src/abi/IXRam.json +0 -99
- package/src/services/futures/constants.ts +0 -1
- package/src/services/futures/index.ts +0 -2
- package/src/services/futures/margin.ts +0 -10
- package/src/services/futures/trade.ts +0 -32
- package/src/services/ramses/vesting.ts +0 -24
- package/src/services/uniswap/V3Trade.ts +0 -46
- package/src/test/futures.test.ts +0 -51
- package/src/test/hyperliquid.test.ts +0 -107
- package/src/test/ramses.test.ts +0 -190
- package/src/test/ramsesCL.test.ts +0 -155
- package/src/test/synthetix.test.ts +0 -36
- package/src/test/utils/futures.ts +0 -14
package/dist/config.d.ts
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import { AddressNetworkMap, Network, AddressDappNetworkMap, LyraNetworkMap } from "./types";
|
|
2
2
|
import { NetworkChainIdMap } from ".";
|
|
3
|
+
/** dHEDGE PoolFactory proxy address per network — used by `Dhedge.createPool` and pool lookups. */
|
|
3
4
|
export declare const factoryAddress: AddressNetworkMap;
|
|
5
|
+
/** Router/spender address for each (network, Dapp). Target of `pool.approve`/`pool.trade`. */
|
|
4
6
|
export declare const routerAddress: AddressDappNetworkMap;
|
|
7
|
+
/** CoW Protocol GPv2Settlement address per network (where pre-signed orders are submitted). */
|
|
8
|
+
export declare const gpv2SettlementAddress: Partial<Record<Network, string>>;
|
|
9
|
+
/** Pair-factory address for each (network, Dapp). Used for LP pair lookup (e.g. Sushi/Quickswap). */
|
|
5
10
|
export declare const dappFactoryAddress: AddressDappNetworkMap;
|
|
11
|
+
/** Staking-rewards / MasterChef / Voter address for each (network, Dapp). */
|
|
6
12
|
export declare const stakingAddress: AddressDappNetworkMap;
|
|
13
|
+
/** Aave PoolAddressesProvider per network — entrypoint for Aave V2/V3 lookups. */
|
|
7
14
|
export declare const aaveAddressProvider: AddressDappNetworkMap;
|
|
15
|
+
/** ERC-721 NonfungiblePositionManager for each Uniswap V3-style CL Dapp. */
|
|
8
16
|
export declare const nonfungiblePositionManagerAddress: AddressDappNetworkMap;
|
|
17
|
+
/** EVM chain id for each `Network` — used by API quotes (1inch, Pendle, KyberSwap…). */
|
|
9
18
|
export declare const networkChainIdMap: NetworkChainIdMap;
|
|
19
|
+
/** Balancer SOR subgraph URL per network (used by `Utils.getBalancerSwapTx`). */
|
|
10
20
|
export declare const balancerSubgraph: AddressNetworkMap;
|
|
21
|
+
/** Multicall3 contract per network — used by `multicall` / `Multicaller`. */
|
|
11
22
|
export declare const multiCallAddress: AddressNetworkMap;
|
|
23
|
+
/** Lyra deployment id per network — passed to `@lyrafinance/lyra-js` to scope queries. */
|
|
12
24
|
export declare const lyraNetworkMap: LyraNetworkMap;
|
|
13
25
|
export declare const MaxUint128 = "0xffffffffffffffffffffffffffffffff";
|
|
14
|
-
|
|
15
|
-
export declare const SYNTHETIX_TRACKING_CODE = "0x4448454447450000000000000000000000000000000000000000000000000000";
|
|
26
|
+
/** FlatMoney v1/v2 module addresses per network (DelayedOrder, FlatcoinVault, StableModule). */
|
|
16
27
|
export declare const flatMoneyContractAddresses: Readonly<Partial<Record<Network, {
|
|
17
28
|
OrderExecution?: string;
|
|
18
29
|
DelayedOrder: string;
|
|
@@ -20,6 +31,7 @@ export declare const flatMoneyContractAddresses: Readonly<Partial<Record<Network
|
|
|
20
31
|
StableModule: string;
|
|
21
32
|
COLLATERAL: string;
|
|
22
33
|
}>>>;
|
|
34
|
+
/** Toros PoolLimitOrderManager address per network — used for stop-loss / take-profit orders. */
|
|
23
35
|
export declare const limitOrderAddress: AddressNetworkMap;
|
|
24
36
|
export declare const OdosSwapFeeRecipient: {
|
|
25
37
|
polygon: string;
|
package/dist/entities/pool.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare class Pool {
|
|
|
18
18
|
getComposition(): Promise<FundComposition[]>;
|
|
19
19
|
/**
|
|
20
20
|
* Approve the asset that can be deposited into a pool
|
|
21
|
-
* @param {string}
|
|
21
|
+
* @param {string} asset Address of deposit asset
|
|
22
22
|
* @param {BigNumber | string} amount Amount to be approved
|
|
23
23
|
* @param {any} options Transaction options
|
|
24
24
|
* @param {boolean} estimateGas Simulate/estimate gas
|
|
@@ -56,17 +56,17 @@ export declare class Pool {
|
|
|
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
|
-
* @param {BigNumber | string} amount
|
|
59
|
+
* @param {BigNumber | string} amount Amount to be approved
|
|
60
60
|
* @param {any} options Transaction options
|
|
61
61
|
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
62
62
|
* @returns {Promise<any>} Transaction
|
|
63
63
|
*/
|
|
64
64
|
approveStaking(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
65
65
|
/**
|
|
66
|
-
* Approve
|
|
67
|
-
*
|
|
68
|
-
* @param {string} asset Address of
|
|
69
|
-
* @param {BigNumber | string} amount
|
|
66
|
+
* Approve an asset for the Uniswap V3 NonfungiblePositionManager
|
|
67
|
+
* (used before mint/increase liquidity calls)
|
|
68
|
+
* @param {string} asset Address of asset to approve
|
|
69
|
+
* @param {BigNumber | string} amount Amount to be approved
|
|
70
70
|
* @param {any} options Transaction options
|
|
71
71
|
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
72
72
|
* @returns {Promise<any>} Transaction
|
|
@@ -188,7 +188,7 @@ export declare class Pool {
|
|
|
188
188
|
*/
|
|
189
189
|
lendCompoundV3(market: string, asset: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
190
190
|
/**
|
|
191
|
-
*
|
|
191
|
+
* Withdraw 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
|
|
@@ -198,7 +198,7 @@ export declare class Pool {
|
|
|
198
198
|
*/
|
|
199
199
|
withdrawDeposit(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
200
200
|
/**
|
|
201
|
-
*
|
|
201
|
+
* Withdraw 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
|
|
@@ -280,11 +280,11 @@ export declare class Pool {
|
|
|
280
280
|
*/
|
|
281
281
|
joinBalancerPool(poolId: string, assets: string[], amountsIn: string[] | BigNumber[], options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
282
282
|
/**
|
|
283
|
-
*
|
|
283
|
+
* Exit a Balancer pool
|
|
284
284
|
* @param {string} poolId Balancer pool id
|
|
285
|
-
* @param {string[]
|
|
286
|
-
* @param {BigNumber | string
|
|
287
|
-
* @param {
|
|
285
|
+
* @param {string[]} assets Array of balancer pool assets
|
|
286
|
+
* @param {BigNumber | string} amount Amount of pool tokens to withdraw
|
|
287
|
+
* @param {null | number} singleExitAssetIndex Index of asset to withdraw to
|
|
288
288
|
* @param {any} options Transaction options
|
|
289
289
|
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
290
290
|
* @returns {Promise<any>} Transaction
|
|
@@ -331,7 +331,7 @@ export declare class Pool {
|
|
|
331
331
|
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
332
332
|
* @returns {Promise<any>} Transaction
|
|
333
333
|
*/
|
|
334
|
-
addLiquidityUniswapV3(dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL | Dapp.
|
|
334
|
+
addLiquidityUniswapV3(dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL | 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>;
|
|
335
335
|
/**
|
|
336
336
|
* Remove liquidity from an UniswapV3 or Arrakis liquidity pool
|
|
337
337
|
* @param {Dapp} dapp Platform either UniswapV3 or Arrakis
|
|
@@ -362,29 +362,6 @@ export declare class Pool {
|
|
|
362
362
|
* @returns {Promise<any>} Transaction
|
|
363
363
|
*/
|
|
364
364
|
claimFees(dapp: Dapp, tokenId: string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
365
|
-
/**
|
|
366
|
-
* Get rewards of an NFT position
|
|
367
|
-
* @param {Dapp} dapp Platform e.g. Ramses CL
|
|
368
|
-
* @param {string} tokenId Token Id
|
|
369
|
-
* @param {string[]} rewards Reward tokens
|
|
370
|
-
* @param {any} options Transaction option
|
|
371
|
-
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
372
|
-
* @returns {Promise<any>} Transaction
|
|
373
|
-
*/
|
|
374
|
-
getRewards(dapp: Dapp, tokenId: string, rewards: string[], options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
375
|
-
/**
|
|
376
|
-
* Trade an asset into another asset
|
|
377
|
-
* @param {Dapp} dapp Platform like Sushiswap or Uniswap
|
|
378
|
-
* @param {string} assetFrom Asset to trade from
|
|
379
|
-
* @param {string} assetTo Asset to trade into
|
|
380
|
-
* @param {BigNumber | string} amountIn Amount
|
|
381
|
-
* @param { FeeAmount } feeAmount Fee tier (Low 0.05%, Medium 0.3%, High 1%)
|
|
382
|
-
* @param {number} slippage Slippage tolerance in %
|
|
383
|
-
* @param {any} options Transaction options
|
|
384
|
-
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
385
|
-
* @returns {Promise<any>} Transaction
|
|
386
|
-
*/
|
|
387
|
-
tradeUniswapV3(assetFrom: string, assetTo: string, amountIn: BigNumber | string, feeAmount: number, slippage?: number, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
388
365
|
/**
|
|
389
366
|
* Add liquidity to Velodrome pool
|
|
390
367
|
* @param {string} assetA First asset
|
|
@@ -432,8 +409,8 @@ export declare class Pool {
|
|
|
432
409
|
*/
|
|
433
410
|
removeLiquidityVelodromeV2(assetA: string, assetB: string, amount: BigNumber | string, isStable: boolean, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
434
411
|
/**
|
|
435
|
-
* Add liquidity to Velodrome V2 or
|
|
436
|
-
* @param {Dapp} dapp VelodromeV2
|
|
412
|
+
* Add liquidity to Velodrome V2 or Aerodrome pool
|
|
413
|
+
* @param {Dapp} dapp VelodromeV2 or Aerodrome
|
|
437
414
|
* @param {string} assetA First asset
|
|
438
415
|
* @param {string} assetB Second asset
|
|
439
416
|
* @param {BigNumber | string} amountA Amount first asset
|
|
@@ -443,10 +420,10 @@ export declare class Pool {
|
|
|
443
420
|
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
444
421
|
* @returns {Promise<any>} Transaction
|
|
445
422
|
*/
|
|
446
|
-
addLiquidityV2(dapp: Dapp.VELODROMEV2 | Dapp.
|
|
423
|
+
addLiquidityV2(dapp: Dapp.VELODROMEV2 | Dapp.AERODROME, assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, isStable: boolean, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
447
424
|
/**
|
|
448
|
-
* Remove liquidity from Velodrome V2 or
|
|
449
|
-
* @param {Dapp} dapp VelodromeV2
|
|
425
|
+
* Remove liquidity from Velodrome V2 or Aerodrome pool
|
|
426
|
+
* @param {Dapp} dapp VelodromeV2 or Aerodrome
|
|
450
427
|
* @param {string} assetA First asset
|
|
451
428
|
* @param {string} assetB Second asset
|
|
452
429
|
* @param {BigNumber | string} amount Amount of LP tokens
|
|
@@ -455,7 +432,7 @@ export declare class Pool {
|
|
|
455
432
|
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
456
433
|
* @returns {Promise<any>} Transaction
|
|
457
434
|
*/
|
|
458
|
-
removeLiquidityV2(dapp: Dapp.VELODROMEV2 | Dapp.
|
|
435
|
+
removeLiquidityV2(dapp: Dapp.VELODROMEV2 | Dapp.AERODROME, assetA: string, assetB: string, amount: BigNumber | string, isStable: boolean, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
459
436
|
/**
|
|
460
437
|
* Trade options on lyra
|
|
461
438
|
* @param {LyraOptionMarket} market Underlying market e.g. eth
|
|
@@ -477,32 +454,6 @@ export declare class Pool {
|
|
|
477
454
|
* @returns {Promise<Position>} Transaction
|
|
478
455
|
*/
|
|
479
456
|
getLyraPositions(market: LyraOptionMarket): Promise<LyraPosition[]>;
|
|
480
|
-
/** Deposit or withdraws (negative amount) asset for Synthetix future margin trading
|
|
481
|
-
*
|
|
482
|
-
* @param {string} market Address of futures market
|
|
483
|
-
* @param {BigNumber | string } changeAmount Amount to increase/decrease margin
|
|
484
|
-
* @param {any} options Transaction options
|
|
485
|
-
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
486
|
-
* @returns {Promise<any>} Transaction
|
|
487
|
-
*/
|
|
488
|
-
changeFuturesMargin(market: string, changeAmount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
489
|
-
/** Change position in Synthetix futures market (long/short)
|
|
490
|
-
*
|
|
491
|
-
* @param {string} market Address of futures market
|
|
492
|
-
* @param {BigNumber | string } changeAmount Negative for short, positive for long
|
|
493
|
-
* @param {any} options Transaction options
|
|
494
|
-
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
495
|
-
* @returns {Promise<any>} Transaction
|
|
496
|
-
*/
|
|
497
|
-
changeFuturesPosition(market: string, changeAmount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
498
|
-
/** Cancels an open oder on Synthetix futures market
|
|
499
|
-
*
|
|
500
|
-
* @param {string} market Address of futures market
|
|
501
|
-
* @param {any} options Transaction options
|
|
502
|
-
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
503
|
-
* @returns {Promise<any>} Transaction
|
|
504
|
-
*/
|
|
505
|
-
cancelFuturesOrder(market: string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
506
457
|
/**
|
|
507
458
|
* mintManagerFee
|
|
508
459
|
* @param {any} options Transaction options
|
|
@@ -515,24 +466,6 @@ export declare class Pool {
|
|
|
515
466
|
* @returns {Promise<BigNumber>} fee
|
|
516
467
|
*/
|
|
517
468
|
getAvailableManagerFee(): Promise<BigNumber>;
|
|
518
|
-
/** Vest tokens (e.g. Ramses xoRAM)
|
|
519
|
-
*
|
|
520
|
-
* @param {string} tokenAddress Address of the token to vest
|
|
521
|
-
* @param {BigNumber | string } changeAmount Negative for short, positive for long
|
|
522
|
-
* @param {any} options Transaction options
|
|
523
|
-
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
524
|
-
* @returns {Promise<any>} Transaction
|
|
525
|
-
*/
|
|
526
|
-
vestTokens(tokenAddress: string, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
527
|
-
/** Exit position of vested tokens (e.g. Ramses xoRAM)
|
|
528
|
-
*
|
|
529
|
-
* @param {string} tokenAddress Address of the token to vest
|
|
530
|
-
* @param {number } id position Id of the vested tokens
|
|
531
|
-
* @param {any} options Transaction options
|
|
532
|
-
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
533
|
-
* @returns {Promise<any>} Transaction
|
|
534
|
-
*/
|
|
535
|
-
exitVestedToken(tokenAddress: string, id: number, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
536
469
|
/** deposit rETH to mint UNIT via the Flat Money protocol
|
|
537
470
|
*
|
|
538
471
|
* @param { BigNumber | string } depositAmount Amount of rETH to deposit
|
|
@@ -553,6 +486,12 @@ export declare class Pool {
|
|
|
553
486
|
* @returns {Promise<any>} Transaction
|
|
554
487
|
*/
|
|
555
488
|
redeemUnitViaFlatMoney(withdrawAmount: ethers.BigNumber | string, slippage: number | undefined, maxKeeperFeeInUsd: number | null, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
489
|
+
/**
|
|
490
|
+
* Cancel a previously announced FlatMoney order (mint/redeem UNIT) before it executes
|
|
491
|
+
* @param {any} options Transaction options
|
|
492
|
+
* @param {boolean} estimateGas Simulate/estimate gas instead of sending
|
|
493
|
+
* @returns {Promise<any>} Transaction
|
|
494
|
+
*/
|
|
556
495
|
cancelOrderViaFlatMoney(options?: any, estimateGas?: boolean): Promise<any>;
|
|
557
496
|
/**
|
|
558
497
|
* Complete a Toros withdrawal to a single asset
|
package/dist/entities/utils.d.ts
CHANGED
|
@@ -48,11 +48,26 @@ export declare class Utils {
|
|
|
48
48
|
* @returns {Promise<ethers.BigNumber>} Reserves of the assets in BigNumber
|
|
49
49
|
*/
|
|
50
50
|
getMinAmountOut(dapp: Dapp, assetFrom: string, assetTo: string, amountIn: string | ethers.BigNumber, slippage: number): Promise<ethers.BigNumber>;
|
|
51
|
+
/**
|
|
52
|
+
* Build calldata for a Balancer swap. Routes through the Balancer SOR — picks
|
|
53
|
+
* a single `swap` for direct hops or `batchSwap` for multi-hop routes.
|
|
54
|
+
* `slippage` is in % (e.g. 0.5 = 0.5%).
|
|
55
|
+
*/
|
|
51
56
|
getBalancerSwapTx(pool: Pool, assetFrom: string, assetTo: string, amountIn: ethers.BigNumber | string, slippage: number): Promise<any>;
|
|
57
|
+
/** Build calldata to join a Balancer pool by depositing the given asset amounts. */
|
|
52
58
|
getBalancerJoinPoolTx(pool: Pool, balancerPoolId: string, assets: string[], amountsIn: string[] | ethers.BigNumber[]): Promise<any>;
|
|
59
|
+
/**
|
|
60
|
+
* Build calldata to exit a Balancer pool. If `singleExitAssetIndex` is null
|
|
61
|
+
* the exit is proportional across all `assets`; otherwise the BPT is redeemed
|
|
62
|
+
* into the single asset at that index.
|
|
63
|
+
*/
|
|
53
64
|
getBalancerExitPoolTx(pool: Pool, balancerPoolId: string, assets: string[], singleExitAssetIndex: null | number, amount: string | ethers.BigNumber): Promise<any>;
|
|
65
|
+
/** List available expiry timestamps for a Lyra option market. */
|
|
54
66
|
getLyraOptionExpiries(market: LyraOptionMarket): Promise<number[]>;
|
|
67
|
+
/** List available strikes for a Lyra option market at a given expiry. */
|
|
55
68
|
getLyraOptionStrikes(market: LyraOptionMarket, expiry: number): Promise<Strike[]>;
|
|
69
|
+
/** Resolve a single Lyra strike by its strike price for a market/expiry. */
|
|
56
70
|
getLyraOptionStrike(market: LyraOptionMarket, expiry: number, strike: number): Promise<Strike>;
|
|
71
|
+
/** Get a Lyra option quote (premium, fees, slippage) for a strike/type/size. */
|
|
57
72
|
getLyraOptionQuote(strike: Strike, type: LyraOptionType, tradeType: LyraTradeType, amount: BigNumber | string): Promise<Quote>;
|
|
58
73
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
|
+
import { Pool } from "../../entities";
|
|
3
|
+
export declare const KIND_SELL: string;
|
|
4
|
+
export declare const KIND_BUY: string;
|
|
5
|
+
export declare const BALANCE_ERC20: string;
|
|
6
|
+
export declare function getCowSwapTxData(pool: Pool, assetFrom: string, assetTo: string, amountIn: ethers.BigNumber | string, slippage: number, kind?: "sell" | "buy"): Promise<{
|
|
7
|
+
encodedTypedData: string;
|
|
8
|
+
preSignTxData: string;
|
|
9
|
+
minAmountOut: string;
|
|
10
|
+
}>;
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
import { ethers } from "ethers";
|
|
2
|
+
/** Encode `deposit(amount, dexId)` on the Hyperliquid CoreDepositWallet to bridge USDC into HyperCore. */
|
|
2
3
|
export declare const getDepositHyperliquidTxData: (dexId: number, amount: ethers.BigNumber | string) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Encode a CoreWriter `sendRawAction` for SPOT_SEND that bridges USDC from the
|
|
6
|
+
* HyperCore Spot wallet back to EVM. Amount is supplied in 6 decimals (EVM USDC) and
|
|
7
|
+
* scaled up by 100 for HyperCore's 8-decimal USDC.
|
|
8
|
+
*/
|
|
3
9
|
export declare const getWithdrawSpotHyperliquidTxData: (amount: ethers.BigNumber | string) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Encode a CoreWriter `sendRawAction` for SEND_ASSET that moves USDC between
|
|
12
|
+
* HyperCore dexes (perp/spot/xyz). Amount is supplied in 6 decimals (EVM USDC) and
|
|
13
|
+
* scaled to HyperCore's 8 decimals.
|
|
14
|
+
*/
|
|
4
15
|
export declare const getSendAssetHyperliquidTxData: (sourceDex: number, destinationDex: number, receiver: string, amount: ethers.BigNumber | string) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Encode a CoreWriter `sendRawAction` for an IOC limit order on a Hyperliquid asset.
|
|
18
|
+
* Auto-flips side and sets `reduceOnly` when `changeAmount` is negative (perp close).
|
|
19
|
+
* Price is offset by `slippage`% from the current mid in the direction of execution.
|
|
20
|
+
*/
|
|
5
21
|
export declare const getLimitOrderHyperliquidTxData: (assetId: number, isLong: boolean, changeAmount: number, slippage: number) => Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Encode a CoreWriter `sendRawAction` for an IOC limit order that closes
|
|
24
|
+
* `percentageToClose`% of the pool's current Hyperliquid position. Reads the
|
|
25
|
+
* existing position size on-chain to determine the side (buy to close shorts,
|
|
26
|
+
* sell to close longs).
|
|
27
|
+
*/
|
|
6
28
|
export declare const getClosePositionHyperliquidTxData: (assetId: number, percentageToClose: number, slippage: number, poolAddress: string) => Promise<string>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ethers } from "../..";
|
|
2
2
|
import { Pool } from "../../entities";
|
|
3
3
|
export declare const kyberBaseUrl = "https://aggregator-api.kyberswap.com";
|
|
4
|
-
export declare function getKyberSwapTxData(pool: Pool, tokenIn: string, tokenOut: string, amountIn: ethers.BigNumber | string, slippage: number): Promise<{
|
|
4
|
+
export declare function getKyberSwapTxData(pool: Pool, tokenIn: string, tokenOut: string, amountIn: ethers.BigNumber | string, slippage: number, sender?: string, receiver?: string): Promise<{
|
|
5
5
|
swapTxData: string;
|
|
6
6
|
minAmountOut: string;
|
|
7
7
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ethers } from "../..";
|
|
2
2
|
import { Pool } from "../../entities";
|
|
3
|
-
export declare function getOneInchSwapTxData(pool: Pool, assetFrom: string, assetTo: string, amountIn: ethers.BigNumber | string, slippage: number,
|
|
3
|
+
export declare function getOneInchSwapTxData(pool: Pool, assetFrom: string, assetTo: string, amountIn: ethers.BigNumber | string, slippage: number, sender?: string, receiver?: string): Promise<{
|
|
4
4
|
swapTxData: string;
|
|
5
5
|
dstAmount: string;
|
|
6
6
|
}>;
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { ethers } from "ethers";
|
|
2
2
|
import { Pool } from "../..";
|
|
3
|
+
/** Minimum USD value of a leftover token to bother swapping during a withdrawal. */
|
|
3
4
|
export declare const LOW_USD_VALUE_FOR_WITHDRAWAL = 1;
|
|
5
|
+
/** Slippage (bps) applied to the swap of small-value leftover tokens during withdrawal. */
|
|
4
6
|
export declare const SLIPPAGE_FOR_LOW_VALUE_SWAP = 500;
|
|
7
|
+
/**
|
|
8
|
+
* Resolve which asset should be used to deposit into a Toros pool. Returns the
|
|
9
|
+
* caller's `investAsset` if the pool already accepts it, otherwise the pool's
|
|
10
|
+
* primary deposit asset.
|
|
11
|
+
*/
|
|
5
12
|
export declare function getPoolDepositAsset(pool: Pool, poolAddress: string, investAsset: string): Promise<string | undefined>;
|
|
13
|
+
/** Read the current per-token price of a Toros vault from its PoolLogic. */
|
|
6
14
|
export declare function getTorosPoolTokenPrice(pool: Pool, poolAddress: string): Promise<ethers.BigNumber>;
|
|
15
|
+
/** Quote how many Toros vault tokens a deposit of `investAsset` would mint. */
|
|
7
16
|
export declare function getEasySwapperDepositQuote(pool: Pool, torosAsset: string, investAsset: string, amountIn: ethers.BigNumber): Promise<ethers.BigNumber>;
|
|
17
|
+
/**
|
|
18
|
+
* Build the EasySwapper calldata for a Toros deposit or the start of a withdrawal.
|
|
19
|
+
* If `assetFrom` is a Toros pool, this is treated as a withdrawal and routes through
|
|
20
|
+
* `getInitWithdrawalTxData`. Otherwise it builds a `depositWithCustomCooldown` call.
|
|
21
|
+
*/
|
|
8
22
|
export declare function getEasySwapperTxData(pool: Pool, assetFrom: string, assetTo: string, amountIn: ethers.BigNumber, slippage: number): Promise<any>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { Pool } from "../..";
|
|
2
|
+
export declare const SWAPPER_ADDRESS = "0x4F754e0F0924afD74980886b0B479Fa1D7C58D0D";
|
|
3
|
+
export declare const ROUTER_KEYS: readonly ["KYBER_SWAP_V2", "ONE_INCH"];
|
|
4
|
+
export declare type RouterKey = typeof ROUTER_KEYS[number];
|
|
2
5
|
export interface SwapParams {
|
|
3
6
|
srcAsset: string;
|
|
4
7
|
srcAmount: string;
|
|
5
8
|
dstAsset: string;
|
|
6
|
-
chainId: number;
|
|
7
|
-
from: string;
|
|
8
|
-
receiver: string;
|
|
9
9
|
slippage: number;
|
|
10
10
|
}
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const getSwapData: (pool: Pool, params: SwapParams, routerKeyString: RouterKey) => Promise<string>;
|
|
@@ -4,7 +4,7 @@ import { Dapp, Pool } from "../..";
|
|
|
4
4
|
import BigNumber from "bignumber.js";
|
|
5
5
|
export declare function tryParsePrice(baseToken: Token, quoteToken: Token, value: string): Price<Token, Token>;
|
|
6
6
|
export declare function tryParseTick(baseToken: Token, quoteToken: Token, feeAmount: number, value: string): number;
|
|
7
|
-
export declare function getUniswapV3MintTxData(dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL | Dapp.
|
|
8
|
-
export declare function getUniswapV3Liquidity(dapp: Dapp
|
|
7
|
+
export declare function getUniswapV3MintTxData(dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL | Dapp.PANCAKECL, pool: Pool, assetA: string, assetB: string, amountA: string | ethers.BigNumber, amountB: string | ethers.BigNumber, minPrice: number | null, maxPrice: number | null, minTick: number | null, maxTick: number | null, feeAmountOrTickSpacing: number): Promise<any>;
|
|
8
|
+
export declare function getUniswapV3Liquidity(dapp: Dapp, tokenId: string, pool: Pool): Promise<BigNumber>;
|
|
9
9
|
export declare function getIncreaseLiquidityTxData(pool: Pool, dapp: Dapp, tokenId: string, amountA: ethers.BigNumber | string, amountB: ethers.BigNumber | string): Promise<any>;
|
|
10
10
|
export declare function getDecreaseLiquidityTxData(pool: Pool, dapp: Dapp, tokenId: string, amount: number | undefined, isStaked: boolean): Promise<any>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ethers } from "ethers";
|
|
2
2
|
import { Pool } from "../../entities";
|
|
3
3
|
import { Dapp } from "../../types";
|
|
4
|
+
/** Encode Velodrome router calldata to add liquidity to a stable or volatile pair. */
|
|
4
5
|
export declare function getVelodromeAddLiquidityTxData(pool: Pool, assetA: string, assetB: string, amountA: ethers.BigNumber | string, amountB: ethers.BigNumber | string, isStable: boolean): Promise<any>;
|
|
6
|
+
/** Encode Velodrome router calldata to remove liquidity from a stable or volatile pair. */
|
|
5
7
|
export declare function getVelodromeRemoveLiquidityTxData(pool: Pool, assetA: string, assetB: string, amount: ethers.BigNumber | string, isStable: boolean): Promise<any>;
|
|
8
|
+
/** Read the current owner of a Velodrome/Aerodrome/Pancake CL position NFT. */
|
|
6
9
|
export declare function getClOwner(pool: Pool, dapp: Dapp.VELODROMECL | Dapp.AERODROMECL | Dapp.PANCAKECL, tokenId: string): Promise<string>;
|
package/dist/test/constants.d.ts
CHANGED
|
@@ -11,8 +11,6 @@ export declare const VEL = "0x3c8B650257cFb5f272f799F5e2b4e65093a11a05";
|
|
|
11
11
|
export declare const SUSD = "0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9";
|
|
12
12
|
export declare const SETH = "0xE405de8F52ba7559f9df3C368500B6E6ae6Cee49";
|
|
13
13
|
export declare const ARRAKIS_USDC_WETH_GAUGE = "0xb8888ea29e2f70ad62a3b69b1a1342720612a00d";
|
|
14
|
-
export declare const KWENTA_ETH_PERP = "0xf86048dff23cf130107dfb4e6386f574231a5c65";
|
|
15
|
-
export declare const KWENTA_ETH_PERP_V2 = "0x2b3bb4c683bfc5239b029131eef3b1d214478d93";
|
|
16
14
|
export declare const TEST_POOL: {
|
|
17
15
|
polygon: string;
|
|
18
16
|
optimism: string;
|
|
@@ -43,6 +41,9 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
43
41
|
FLUID_WETH: string;
|
|
44
42
|
TOROS: string;
|
|
45
43
|
UNIT: string;
|
|
44
|
+
WSTETH: string;
|
|
45
|
+
BALANCER_WSTETH_WETH_POOL: string;
|
|
46
|
+
BALANCER_WSTETH_WETH_GAUGE: string;
|
|
46
47
|
};
|
|
47
48
|
optimism: {
|
|
48
49
|
USDC: string;
|
|
@@ -52,7 +53,6 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
52
53
|
SUSD: string;
|
|
53
54
|
WETH: string;
|
|
54
55
|
WBTC: string;
|
|
55
|
-
KWENTA_ETH_PERP_V2: string;
|
|
56
56
|
uniswapV3: {
|
|
57
57
|
nonfungiblePositionManager: string;
|
|
58
58
|
};
|
|
@@ -65,6 +65,9 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
65
65
|
COMPOUNDV3_WETH: string;
|
|
66
66
|
FLUID_WETH: string;
|
|
67
67
|
TOROS: string;
|
|
68
|
+
WSTETH: string;
|
|
69
|
+
BALANCER_WSTETH_WETH_POOL: string;
|
|
70
|
+
BALANCER_WSTETH_WETH_GAUGE: string;
|
|
68
71
|
};
|
|
69
72
|
arbitrum: {
|
|
70
73
|
USDC: string;
|
|
@@ -110,6 +113,9 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
110
113
|
COMPOUNDV3_WETH: string;
|
|
111
114
|
FLUID_WETH: string;
|
|
112
115
|
TOROS: string;
|
|
116
|
+
WSTETH: string;
|
|
117
|
+
BALANCER_WSTETH_WETH_POOL: string;
|
|
118
|
+
BALANCER_WSTETH_WETH_GAUGE: string;
|
|
113
119
|
};
|
|
114
120
|
ethereum: {
|
|
115
121
|
USDC: string;
|
|
@@ -131,16 +137,55 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
131
137
|
FLUID_WETH: string;
|
|
132
138
|
TOROS: string;
|
|
133
139
|
UNIT: string;
|
|
140
|
+
WSTETH: string;
|
|
141
|
+
BALANCER_WSTETH_WETH_POOL: string;
|
|
142
|
+
BALANCER_WSTETH_WETH_GAUGE: string;
|
|
134
143
|
};
|
|
135
144
|
plasma: {
|
|
136
145
|
USDC: string;
|
|
137
146
|
WETH: string;
|
|
147
|
+
WBTC: string;
|
|
138
148
|
USDT: string;
|
|
139
149
|
USDE: string;
|
|
150
|
+
VELO: string;
|
|
151
|
+
uniswapV3: {
|
|
152
|
+
nonfungiblePositionManager: string;
|
|
153
|
+
};
|
|
154
|
+
COMPOUNDV3_WETH: string;
|
|
155
|
+
FLUID_WETH: string;
|
|
156
|
+
UNIT: string;
|
|
157
|
+
TOROS: string;
|
|
158
|
+
SUSD: string;
|
|
159
|
+
VELODROME_CL_USDC_WETH_GAUGE: string;
|
|
160
|
+
ARRAKIS_USDC_WETH_GAUGE: string;
|
|
161
|
+
ARRAKIS_USDC_WETH_LP: string;
|
|
162
|
+
WMATIC: string;
|
|
163
|
+
WSTETH: string;
|
|
164
|
+
BALANCER_WSTETH_WETH_POOL: string;
|
|
165
|
+
BALANCER_WSTETH_WETH_GAUGE: string;
|
|
140
166
|
};
|
|
141
167
|
hyperliquid: {
|
|
142
168
|
USDC: string;
|
|
169
|
+
USDT: string;
|
|
170
|
+
USDE: string;
|
|
143
171
|
WETH: string;
|
|
172
|
+
WBTC: string;
|
|
173
|
+
VELO: string;
|
|
174
|
+
uniswapV3: {
|
|
175
|
+
nonfungiblePositionManager: string;
|
|
176
|
+
};
|
|
177
|
+
COMPOUNDV3_WETH: string;
|
|
178
|
+
FLUID_WETH: string;
|
|
179
|
+
UNIT: string;
|
|
180
|
+
TOROS: string;
|
|
181
|
+
SUSD: string;
|
|
182
|
+
VELODROME_CL_USDC_WETH_GAUGE: string;
|
|
183
|
+
ARRAKIS_USDC_WETH_GAUGE: string;
|
|
184
|
+
ARRAKIS_USDC_WETH_LP: string;
|
|
185
|
+
WMATIC: string;
|
|
186
|
+
WSTETH: string;
|
|
187
|
+
BALANCER_WSTETH_WETH_POOL: string;
|
|
188
|
+
BALANCER_WSTETH_WETH_GAUGE: string;
|
|
144
189
|
};
|
|
145
190
|
};
|
|
146
191
|
export declare const MAX_AMOUNT: ethers.BigNumber;
|
|
@@ -45,6 +45,10 @@ export declare const runWithImpersonateAccount: ({ account, provider }: {
|
|
|
45
45
|
}, fnToRun: ({ signer }: {
|
|
46
46
|
signer: ethers.providers.JsonRpcSigner;
|
|
47
47
|
}) => void) => Promise<void>;
|
|
48
|
+
export declare const fixOracleAggregatorStaleness: ({ pool, provider }: {
|
|
49
|
+
pool: Pool;
|
|
50
|
+
provider: ethers.providers.JsonRpcProvider;
|
|
51
|
+
}) => Promise<void>;
|
|
48
52
|
export declare const setChainlinkTimeout: ({ pool, provider }: {
|
|
49
53
|
pool: Pool;
|
|
50
54
|
provider: ethers.providers.JsonRpcProvider;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Deployment } from "@lyrafinance/lyra-js";
|
|
2
2
|
import { BigNumber } from "ethers";
|
|
3
|
+
/** Networks supported by the SDK. The string value matches keys in `routerAddress`,
|
|
4
|
+
* `nonfungiblePositionManagerAddress`, etc. in `config.ts`. */
|
|
3
5
|
export declare enum Network {
|
|
4
6
|
POLYGON = "polygon",
|
|
5
7
|
OPTIMISM = "optimism",
|
|
@@ -9,6 +11,8 @@ export declare enum Network {
|
|
|
9
11
|
PLASMA = "plasma",
|
|
10
12
|
HYPERLIQUID = "hyperliquid"
|
|
11
13
|
}
|
|
14
|
+
/** Identifies a target protocol/integration for `pool.trade`, `pool.approve`, etc.
|
|
15
|
+
* Each entry maps to address registries (router, factory, gauge) in `config.ts`. */
|
|
12
16
|
export declare enum Dapp {
|
|
13
17
|
SUSHISWAP = "sushiswap",
|
|
14
18
|
AAVE = "aave",
|
|
@@ -16,7 +20,6 @@ export declare enum Dapp {
|
|
|
16
20
|
QUICKSWAP = "quickswap",
|
|
17
21
|
BALANCER = "balancer",
|
|
18
22
|
UNISWAPV3 = "uniswapV3",
|
|
19
|
-
SYNTHETIX = "synthetix",
|
|
20
23
|
AAVEV3 = "aavev3",
|
|
21
24
|
ARRAKIS = "arrakis",
|
|
22
25
|
TOROS = "toros",
|
|
@@ -24,17 +27,18 @@ export declare enum Dapp {
|
|
|
24
27
|
VELODROMEV2 = "velodromeV2",
|
|
25
28
|
VELODROMECL = "velodromeCL",
|
|
26
29
|
LYRA = "lyra",
|
|
27
|
-
RAMSES = "ramses",
|
|
28
30
|
AERODROME = "aerodrome",
|
|
29
31
|
AERODROMECL = "aerodromeCL",
|
|
30
|
-
RAMSESCL = "ramsesCL",
|
|
31
32
|
PANCAKECL = "pancakeCL",
|
|
32
33
|
COMPOUNDV3 = "compoundV3",
|
|
33
34
|
ODOS = "odos",
|
|
34
35
|
PENDLE = "pendle",
|
|
35
36
|
KYBERSWAP = "kyberswap",
|
|
36
|
-
HYPERLIQUID = "hyperliquid"
|
|
37
|
+
HYPERLIQUID = "hyperliquid",
|
|
38
|
+
COWSWAP = "cowswap"
|
|
37
39
|
}
|
|
40
|
+
/** Function-name strings used when encoding ABI calls — keep in sync with the
|
|
41
|
+
* matching ABI files in `src/abi/`. */
|
|
38
42
|
export declare enum Transaction {
|
|
39
43
|
SWAP = "swapExactTokensForTokens",
|
|
40
44
|
ADD_LIQUIDITY = "addLiquidity",
|
|
@@ -52,7 +56,6 @@ export declare enum Transaction {
|
|
|
52
56
|
WITHDRAW = "withdraw",
|
|
53
57
|
MINT = "mint",
|
|
54
58
|
BURN = "burn",
|
|
55
|
-
SWAP_SYNTHS = "exchangeWithTracking",
|
|
56
59
|
ADD_LIQUIDITY_STAKE = "addLiquidityAndStake",
|
|
57
60
|
REMOVE_LIQUIDITY_UNSTAKE = "removeLiquidityAndUnstake"
|
|
58
61
|
}
|
|
@@ -61,11 +64,14 @@ export declare type AddressDappMap = {
|
|
|
61
64
|
[key in Dapp]?: string;
|
|
62
65
|
};
|
|
63
66
|
export declare type AddressDappNetworkMap = Readonly<Record<Network, AddressDappMap>>;
|
|
67
|
+
/** Tuple form `[asset, isDeposit]` accepted by the factory's `createFund`. */
|
|
64
68
|
export declare type SupportedAsset = [string, boolean];
|
|
69
|
+
/** Object form of a supported asset entry; preferred over `SupportedAsset` in SDK methods. */
|
|
65
70
|
export declare type AssetEnabled = {
|
|
66
71
|
asset: string;
|
|
67
72
|
isDeposit: boolean;
|
|
68
73
|
};
|
|
74
|
+
/** A pool's holding of one asset returned by `pool.getComposition()`. */
|
|
69
75
|
export declare type FundComposition = {
|
|
70
76
|
asset: string;
|
|
71
77
|
isDeposit: boolean;
|
|
@@ -94,11 +100,21 @@ export declare type LyraPosition = {
|
|
|
94
100
|
collateral: BigNumber;
|
|
95
101
|
state: number;
|
|
96
102
|
};
|
|
103
|
+
/**
|
|
104
|
+
* Options that control how SDK methods dispatch a transaction:
|
|
105
|
+
* - `estimateGas`: simulate and return gas + minAmountOut without sending.
|
|
106
|
+
* - `onlyGetTxData`: return the encoded calldata without sending or simulating.
|
|
107
|
+
* - `useTraderAddressAsFrom`: send via the EOA wallet instead of the pool's
|
|
108
|
+
* `execTransaction` (used when the SDK is acting as a non-dHEDGE caller).
|
|
109
|
+
* - `boolean` shorthand: `true` is equivalent to `{ estimateGas: true }` (kept
|
|
110
|
+
* for backward compatibility).
|
|
111
|
+
*/
|
|
97
112
|
export declare type SDKOptions = {
|
|
98
113
|
estimateGas: boolean;
|
|
99
114
|
onlyGetTxData?: boolean;
|
|
100
115
|
useTraderAddressAsFrom?: boolean;
|
|
101
116
|
} | boolean;
|
|
117
|
+
/** Parameters for a Toros limit order (stop-loss / take-profit) on a vault token. */
|
|
102
118
|
export declare type LimitOrderInfo = {
|
|
103
119
|
amount: BigNumber;
|
|
104
120
|
stopLossPriceD18: BigNumber;
|
package/dist/utils/contract.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { ethers, Network, Pool, SDKOptions } from "..";
|
|
2
|
+
/** Single contract read: `call = [address, methodName, params?]`. */
|
|
2
3
|
export declare function call(provider: ethers.Signer, abi: any[], call: any[], options?: any): Promise<any>;
|
|
4
|
+
/**
|
|
5
|
+
* Batch multiple contract reads through Multicall's `tryAggregate`.
|
|
6
|
+
* Each call entry is `[address, methodName, params]`. When `requireSuccess` is false,
|
|
7
|
+
* failing calls return `null` instead of reverting the whole batch.
|
|
8
|
+
*/
|
|
3
9
|
export declare function multicall<T>(network: Network, provider: ethers.Signer, abi: any[], calls: any[], options?: any, requireSuccess?: boolean): Promise<(T | null)[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Fluent helper for building a multicall and dispatching results into a typed object.
|
|
12
|
+
* Use `.call(path, address, fn, params)` repeatedly, then `.execute()` returns the
|
|
13
|
+
* populated object with results placed at the given lodash paths.
|
|
14
|
+
*/
|
|
4
15
|
export declare class Multicaller {
|
|
5
16
|
network: Network;
|
|
6
17
|
provider: ethers.Signer;
|
|
@@ -13,4 +24,13 @@ export declare class Multicaller {
|
|
|
13
24
|
execute(from?: any): Promise<any>;
|
|
14
25
|
}
|
|
15
26
|
export declare const isSdkOptionsBoolean: (sdkOptions: SDKOptions) => sdkOptions is boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Central executor for SDK transactions. Routes a (`to`, `data`, `txOptions`) tuple
|
|
29
|
+
* through one of four paths depending on `pool.isDhedge` and `sdkOptions`:
|
|
30
|
+
* - dHEDGE pool: `pool.poolLogic.execTransaction(...)` (or its gas estimate)
|
|
31
|
+
* - non-dHEDGE/EOA: `pool.signer.sendTransaction(...)` (or its gas estimate)
|
|
32
|
+
* Honours `sdkOptions.onlyGetTxData` (returns the encoded tx without sending),
|
|
33
|
+
* `estimateGas` (returns gas + minAmountOut without sending), and
|
|
34
|
+
* `useTraderAddressAsFrom` (forces the EOA path even for dHEDGE pools).
|
|
35
|
+
*/
|
|
16
36
|
export declare const getPoolTxOrGasEstimate: (pool: Pool, args: any[], sdkOptions: SDKOptions) => Promise<any>;
|