@dhedge/v2-sdk 1.8.3 → 1.9.1
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 +7 -0
- package/dist/entities/pool.d.ts +29 -1
- package/dist/errors.d.ts +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/services/futures/trade.d.ts +1 -0
- package/dist/services/velodrome/staking.d.ts +2 -2
- package/dist/services/zeroEx/zeroExTrade.d.ts +3 -0
- package/dist/test/constants.d.ts +9 -2
- package/dist/test/utils/futures.d.ts +2 -0
- package/dist/types.d.ts +5 -2
- package/dist/v2-sdk.cjs.development.js +748 -131
- 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 +748 -132
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +3 -2
- package/src/abi/IVelodromeGaugeV2.json +191 -0
- package/src/config.ts +28 -9
- package/src/entities/pool.ts +110 -6
- package/src/errors.ts +10 -0
- package/src/index.ts +1 -0
- package/src/services/futures/trade.ts +6 -0
- package/src/services/velodrome/staking.ts +33 -20
- package/src/services/zeroEx/zeroExTrade.ts +52 -0
- package/src/test/aave.test.ts +71 -112
- package/src/test/balancer.test.ts +108 -200
- package/src/test/constants.ts +11 -4
- package/src/test/futures.test.ts +5 -2
- package/src/test/oneInch.test.ts +4 -3
- package/src/test/txOptions.ts +1 -1
- package/src/test/utils/futures.ts +14 -0
- package/src/test/velodromeV2.test.ts +114 -0
- package/src/test/wallet.ts +1 -1
- package/src/test/zeroEx.test.ts +46 -0
- package/src/types.ts +5 -2
package/README.md
CHANGED
|
@@ -28,6 +28,13 @@ yarn add @dhedge/v2-sdk
|
|
|
28
28
|
|
|
29
29
|
### Initial setup
|
|
30
30
|
|
|
31
|
+
If you want to use 1Inch to trade pool assets you need to apply for an enterprise endpoint at [1Inch](https://docs.1inch.io/docs/aggregation-protocol/introduction).
|
|
32
|
+
Then you need to copy .env.example file to .env and set your url there.
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
ONEINCH_API_URL=https://my-personal-url.1inch.io/v5.0
|
|
36
|
+
```
|
|
37
|
+
|
|
31
38
|
Initialize the sdk with an [ethers wallet](https://docs.ethers.io/v5/api/signer/#Wallet) and the network.
|
|
32
39
|
|
|
33
40
|
```
|
package/dist/entities/pool.d.ts
CHANGED
|
@@ -135,7 +135,7 @@ export declare class Pool {
|
|
|
135
135
|
*/
|
|
136
136
|
unStake(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any): Promise<any>;
|
|
137
137
|
/**
|
|
138
|
-
* Unstake liquidity pool tokens from gauge
|
|
138
|
+
* Unstake liquidity pool tokens from Velodrome or Balancer gauge
|
|
139
139
|
* @param {string} gauge Gauge contract address
|
|
140
140
|
* @param {BigNumber | string} amount Amount of liquidity pool tokens
|
|
141
141
|
* @param {any} options Transaction options
|
|
@@ -311,6 +311,27 @@ export declare class Pool {
|
|
|
311
311
|
* @returns {Promise<any>} Transaction
|
|
312
312
|
*/
|
|
313
313
|
removeLiquidityVelodrome(assetA: string, assetB: string, amount: BigNumber | string, isStable: boolean, options?: any): Promise<any>;
|
|
314
|
+
/**
|
|
315
|
+
* Add liquidity to Velodrome V2 pool
|
|
316
|
+
* @param {string} assetA First asset
|
|
317
|
+
* @param {string} assetB Second asset
|
|
318
|
+
* @param {BigNumber | string} amountA Amount first asset
|
|
319
|
+
* @param {BigNumber | string} amountB Amount second asset
|
|
320
|
+
* @param { boolean } isStable Is stable pool
|
|
321
|
+
* @param {any} options Transaction options
|
|
322
|
+
* @returns {Promise<any>} Transaction
|
|
323
|
+
*/
|
|
324
|
+
addLiquidityVelodromeV2(assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, isStable: boolean, options?: any): Promise<any>;
|
|
325
|
+
/**
|
|
326
|
+
* Remove liquidity from Velodrome V2 pool
|
|
327
|
+
* @param {string} assetA First asset
|
|
328
|
+
* @param {string} assetB Second asset
|
|
329
|
+
* @param {BigNumber | string} amount Amount of LP tokens
|
|
330
|
+
* @param { boolean } isStable Is stable pool
|
|
331
|
+
* @param {any} options Transaction options
|
|
332
|
+
* @returns {Promise<any>} Transaction
|
|
333
|
+
*/
|
|
334
|
+
removeLiquidityVelodromeV2(assetA: string, assetB: string, amount: BigNumber | string, isStable: boolean, options?: any): Promise<any>;
|
|
314
335
|
/**
|
|
315
336
|
* Trade options on lyra
|
|
316
337
|
* @param {LyraOptionMarket} market Underlying market e.g. eth
|
|
@@ -347,4 +368,11 @@ export declare class Pool {
|
|
|
347
368
|
* @returns {Promise<any>} Transaction
|
|
348
369
|
*/
|
|
349
370
|
changeFuturesPosition(market: string, changeAmount: BigNumber | string, options?: any): Promise<any>;
|
|
371
|
+
/** Cancels an open oder on Synthetix futures market
|
|
372
|
+
*
|
|
373
|
+
* @param {string} market Address of futures market
|
|
374
|
+
* @param {any} options Transaction options
|
|
375
|
+
* @returns {Promise<any>} Transaction
|
|
376
|
+
*/
|
|
377
|
+
cancelFuturesOrder(market: string, options?: any): Promise<any>;
|
|
350
378
|
}
|
package/dist/errors.d.ts
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { BigNumber } from "ethers";
|
|
2
2
|
import { Pool } from "../../entities";
|
|
3
|
-
export declare function getVelodromeStakeTxData(amount: BigNumber | string): any;
|
|
4
|
-
export declare function getVelodromeClaimTxData(pool: Pool, gauge: string): Promise<any>;
|
|
3
|
+
export declare function getVelodromeStakeTxData(amount: BigNumber | string, v2: boolean): any;
|
|
4
|
+
export declare function getVelodromeClaimTxData(pool: Pool, gauge: string, v2: boolean): Promise<any>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { BigNumber } from "ethers";
|
|
2
|
+
import { Network } from "../../types";
|
|
3
|
+
export declare const getZeroExTradeTxData: (network: Network, assetFrom: string, assetTo: string, amountIn: BigNumber | string, slippage: number | undefined, takerAddress: string) => Promise<string>;
|
package/dist/test/constants.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const KWENTA_ETH_PERP_V2 = "0x2b3bb4c683bfc5239b029131eef3b1d2144
|
|
|
16
16
|
export declare const TEST_POOL: {
|
|
17
17
|
polygon: string;
|
|
18
18
|
optimism: string;
|
|
19
|
+
arbitrum: string;
|
|
19
20
|
};
|
|
20
21
|
export declare const CONTRACT_ADDRESS: {
|
|
21
22
|
polygon: {
|
|
@@ -30,8 +31,14 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
30
31
|
SUSD: string;
|
|
31
32
|
WETH: string;
|
|
32
33
|
KWENTA_ETH_PERP_V2: string;
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
};
|
|
35
|
+
arbitrum: {
|
|
36
|
+
USDC: string;
|
|
37
|
+
WETH: string;
|
|
38
|
+
WBTC: string;
|
|
39
|
+
WSTETH: string;
|
|
40
|
+
BALANCER_WSTETH_WETH_POOL: string;
|
|
41
|
+
BALANCER_WSTETH_WETH_GAUGE: string;
|
|
35
42
|
};
|
|
36
43
|
};
|
|
37
44
|
export declare const MAX_AMOUNT: ethers.BigNumber;
|
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { Deployment } from "@lyrafinance/lyra-js";
|
|
|
2
2
|
import { BigNumber } from "ethers";
|
|
3
3
|
export declare enum Network {
|
|
4
4
|
POLYGON = "polygon",
|
|
5
|
-
OPTIMISM = "optimism"
|
|
5
|
+
OPTIMISM = "optimism",
|
|
6
|
+
ARBITRUM = "arbitrum"
|
|
6
7
|
}
|
|
7
8
|
export declare enum Dapp {
|
|
8
9
|
SUSHISWAP = "sushiswap",
|
|
@@ -16,7 +17,9 @@ export declare enum Dapp {
|
|
|
16
17
|
ARRAKIS = "arrakis",
|
|
17
18
|
TOROS = "toros",
|
|
18
19
|
VELODROME = "velodrome",
|
|
19
|
-
|
|
20
|
+
VELODROMEV2 = "velodromeV2",
|
|
21
|
+
LYRA = "lyra",
|
|
22
|
+
ZEROEX = "0x"
|
|
20
23
|
}
|
|
21
24
|
export declare enum Transaction {
|
|
22
25
|
SWAP = "swapExactTokensForTokens",
|