@dhedge/v2-sdk 1.7.2 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/config.d.ts +0 -1
  2. package/dist/entities/pool.d.ts +16 -7
  3. package/dist/services/futures/constants.d.ts +3 -0
  4. package/dist/services/futures/index.d.ts +2 -0
  5. package/dist/services/futures/margin.d.ts +2 -0
  6. package/dist/services/futures/trade.d.ts +2 -0
  7. package/dist/services/velodrome/liquidity.d.ts +2 -2
  8. package/dist/test/constants.d.ts +24 -2
  9. package/dist/test/utils/token.d.ts +3 -0
  10. package/dist/utils/deadline.d.ts +2 -0
  11. package/dist/v2-sdk.cjs.development.js +4540 -5101
  12. package/dist/v2-sdk.cjs.development.js.map +1 -1
  13. package/dist/v2-sdk.cjs.production.min.js +1 -1
  14. package/dist/v2-sdk.cjs.production.min.js.map +1 -1
  15. package/dist/v2-sdk.esm.js +7340 -7901
  16. package/dist/v2-sdk.esm.js.map +1 -1
  17. package/package.json +5 -2
  18. package/src/abi/IDhedgeEasySwapper.json +99 -239
  19. package/src/abi/ISynthetiXFuturesMarketV2.json +531 -0
  20. package/src/config.ts +4 -5
  21. package/src/entities/pool.ts +68 -44
  22. package/src/services/futures/constants.ts +4 -0
  23. package/src/services/futures/index.ts +2 -0
  24. package/src/services/futures/margin.ts +10 -0
  25. package/src/services/futures/trade.ts +15 -0
  26. package/src/services/oneInch/protocols.ts +1 -1
  27. package/src/services/toros/easySwapper.ts +3 -2
  28. package/src/services/uniswap/V3Liquidity.ts +2 -3
  29. package/src/services/velodrome/liquidity.ts +7 -7
  30. package/src/test/constants.ts +27 -2
  31. package/src/test/futures.test.ts +48 -0
  32. package/src/test/oneInch.test.ts +32 -36
  33. package/src/test/pool.test.ts +42 -85
  34. package/src/test/toros.test.ts +50 -98
  35. package/src/test/uniswap.test.ts +65 -30
  36. package/src/test/utils/token.ts +31 -0
  37. package/src/test/velodrome.test.ts +74 -101
  38. package/src/test/wallet.ts +5 -3
  39. package/src/utils/deadline.ts +6 -0
  40. package/dist/services/claim-balancer/claim.service.d.ts +0 -17
  41. package/dist/services/claim-balancer/claim.worker.d.ts +0 -4
  42. package/dist/services/claim-balancer/ipfs.service.d.ts +0 -4
  43. package/dist/services/claim-balancer/types.d.ts +0 -54
  44. package/src/services/claim-balancer/MultiTokenClaim.json +0 -115
  45. package/src/services/claim-balancer/claim.service.ts +0 -262
  46. package/src/services/claim-balancer/claim.worker.ts +0 -32
  47. package/src/services/claim-balancer/ipfs.service.ts +0 -12
  48. package/src/services/claim-balancer/types.ts +0 -66
package/dist/config.d.ts CHANGED
@@ -10,7 +10,6 @@ export declare const networkChainIdMap: NetworkChainIdMap;
10
10
  export declare const balancerSubgraph: AddressNetworkMap;
11
11
  export declare const multiCallAddress: AddressNetworkMap;
12
12
  export declare const lyraNetworkMap: LyraNetworkMap;
13
- export declare const deadline: number;
14
13
  export declare const MaxUint128 = "0xffffffffffffffffffffffffffffffff";
15
14
  export declare const UNISWAPV3_QUOTER_ADDRESS = "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6";
16
15
  export declare const SYNTHETIX_TRACKING_CODE = "0x4448454447450000000000000000000000000000000000000000000000000000";
@@ -221,13 +221,6 @@ export declare class Pool {
221
221
  * @returns {Promise<any>} Transaction
222
222
  */
223
223
  exitBalancerPool(poolId: string, assets: string[], amount: string | BigNumber, singleExitAssetIndex?: number | null, options?: any): Promise<any>;
224
- /**
225
- * Claim rewards from Balancer pools
226
- * @param {string[]} assets Array of tokens being claimed
227
- * @param {any} options Transaction options
228
- * @returns {Promise<any>} Transaction
229
- */
230
- harvestBalancerRewards(options?: any): Promise<any>;
231
224
  /**
232
225
  * Claim rewards from Aave platform
233
226
  * @param {string[]} assets Aave tokens (deposit/debt) hold by pool
@@ -338,4 +331,20 @@ export declare class Pool {
338
331
  * @returns {Promise<Position>} Transaction
339
332
  */
340
333
  getLyraPositions(market: LyraOptionMarket): Promise<LyraPosition[]>;
334
+ /** Deposit or withdraws (negative amount) asset for Synthetix future margin trading
335
+ *
336
+ * @param {string} market Address of futures market
337
+ * @param {BigNumber | string } changeAmount Amount to increase/decrease margin
338
+ * @param {any} options Transaction options
339
+ * @returns {Promise<any>} Transaction
340
+ */
341
+ changeFuturesMargin(market: string, changeAmount: BigNumber | string, options?: any): Promise<any>;
342
+ /** Change position in Synthetix futures market (long/short)
343
+ *
344
+ * @param {string} market Address of futures market
345
+ * @param {BigNumber | string } changeAmount Negative for short, positive for long
346
+ * @param {any} options Transaction options
347
+ * @returns {Promise<any>} Transaction
348
+ */
349
+ changeFuturesPosition(market: string, changeAmount: BigNumber | string, options?: any): Promise<any>;
341
350
  }
@@ -0,0 +1,3 @@
1
+ import { BigNumber } from "ethers";
2
+ export declare const PRICE_IMPACT_DELTA: BigNumber;
3
+ export declare const FUTURES_TRACKING = "DHEDGE";
@@ -0,0 +1,2 @@
1
+ export { getFuturesChangeMarginTxData } from "./margin";
2
+ export { getFuturesChangePositionTxData } from "./trade";
@@ -0,0 +1,2 @@
1
+ import { ethers } from "../..";
2
+ export declare function getFuturesChangeMarginTxData(amount: ethers.BigNumber | string): string;
@@ -0,0 +1,2 @@
1
+ import { ethers } from "../..";
2
+ export declare function getFuturesChangePositionTxData(amount: ethers.BigNumber | string): string;
@@ -1,4 +1,4 @@
1
1
  import { BigNumber } from "ethers";
2
2
  import { Pool } from "../../entities";
3
- export declare function getVelodromeAddLiquidityTxData(pool: Pool, assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, isStable: boolean): any;
4
- export declare function getVelodromeRemoveLiquidityTxData(pool: Pool, assetA: string, assetB: string, amount: BigNumber | string, isStable: boolean): any;
3
+ export declare function getVelodromeAddLiquidityTxData(pool: Pool, assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, isStable: boolean): Promise<any>;
4
+ export declare function getVelodromeRemoveLiquidityTxData(pool: Pool, assetA: string, assetB: string, amount: BigNumber | string, isStable: boolean): Promise<any>;
@@ -1,11 +1,33 @@
1
+ import { ethers } from "ethers";
2
+ import { Network } from "../types";
1
3
  export declare const WETH = "0x4200000000000000000000000000000000000006";
2
4
  export declare const USDC = "0x7F5c764cBc14f9669B88837ca1490cCa17c31607";
3
5
  export declare const DAI = "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1";
4
6
  export declare const USDy = "0x1ec50880101022c11530a069690f5446d1464592";
5
7
  export declare const WBTC = "0x68f180fcCe6836688e9084f035309E29Bf0A2095";
6
- export declare const OP = "4200000000000000000000000000000000000042";
8
+ export declare const OP = "0x4200000000000000000000000000000000000042";
7
9
  export declare const WSTETH = "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb";
8
10
  export declare const VEL = "0x3c8B650257cFb5f272f799F5e2b4e65093a11a05";
9
11
  export declare const SUSD = "0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9";
12
+ export declare const SETH = "0xE405de8F52ba7559f9df3C368500B6E6ae6Cee49";
10
13
  export declare const ARRAKIS_USDC_WETH_GAUGE = "0xb8888ea29e2f70ad62a3b69b1a1342720612a00d";
11
- export declare const TEST_POOL = "0x3d45e539df0f9fa6015106a968d732a8f6c2a40b";
14
+ export declare const KWENTA_ETH_PERP = "0xf86048dff23cf130107dfb4e6386f574231a5c65";
15
+ export declare const KWENTA_ETH_PERP_V2 = "0x2b3bb4c683bfc5239b029131eef3b1d214478d93";
16
+ export declare const TEST_POOL: {
17
+ polygon: string;
18
+ optimism: string;
19
+ };
20
+ export declare const CONTRACT_ADDRESS: {
21
+ polygon: {
22
+ USDC: string;
23
+ WETH: string;
24
+ WBTC: string;
25
+ };
26
+ optimism: {
27
+ USDC: string;
28
+ SUSD: string;
29
+ WETH: string;
30
+ KWENTA_ETH_PERP_V2: string;
31
+ };
32
+ };
33
+ export declare const MAX_AMOUNT: ethers.BigNumber;
@@ -0,0 +1,3 @@
1
+ import { BigNumber, Wallet } from "ethers";
2
+ export declare const balanceDelta: (owner: string, asset: string, signer: Wallet) => Promise<BigNumber>;
3
+ export declare const allowanceDelta: (owner: string, asset: string, spender: string, signer: Wallet) => Promise<BigNumber>;
@@ -0,0 +1,2 @@
1
+ import { Pool } from "../entities";
2
+ export declare const getDeadline: (pool: Pool) => Promise<number>;