@dhedge/v2-sdk 1.5.4 → 1.7.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/dist/config.d.ts +2 -1
- package/dist/entities/pool.d.ts +21 -1
- package/dist/entities/utils.d.ts +7 -2
- package/dist/services/lyra/markets.d.ts +6 -0
- package/dist/services/lyra/positions.d.ts +2 -0
- package/dist/services/lyra/quote.d.ts +4 -0
- package/dist/services/lyra/trade.d.ts +4 -0
- package/dist/services/lyra/tradeOptionType.d.ts +3 -0
- package/dist/test/constants.d.ts +3 -12
- package/dist/types.d.ts +20 -1
- package/dist/v2-sdk.cjs.development.js +4202 -12
- 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 +4200 -11
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +6 -2
- package/src/abi/IOptionMArketWrapper.json +1038 -0
- package/src/abi/IOptionMarket.json +1473 -0
- package/src/abi/IOptionToken.json +1671 -0
- package/src/config.ts +11 -5
- package/src/entities/pool.ts +61 -1
- package/src/entities/utils.ts +45 -2
- package/src/services/lyra/markets.ts +52 -0
- package/src/services/lyra/positions.ts +19 -0
- package/src/services/lyra/quote.ts +12 -0
- package/src/services/lyra/trade.ts +101 -0
- package/src/services/lyra/tradeOptionType.ts +19 -0
- package/src/test/arrakis.test.ts +65 -52
- package/src/test/constants.ts +17 -14
- package/src/test/lyra.test.ts +163 -0
- package/src/test/pool.test.ts +1 -1
- package/src/test/toros.test.ts +1 -1
- package/src/test/txOptions.ts +1 -1
- package/src/test/uniswap.test.ts +1 -1
- package/src/test/velodrome.test.ts +1 -1
- package/src/test/wallet.ts +8 -0
- package/src/types.ts +20 -1
- package/src/test/sushi.test.ts +0 -173
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddressNetworkMap, AddressDappNetworkMap } from "./types";
|
|
1
|
+
import { AddressNetworkMap, AddressDappNetworkMap, LyraNetworkMap } from "./types";
|
|
2
2
|
import { NetworkChainIdMap } from ".";
|
|
3
3
|
export declare const factoryAddress: AddressNetworkMap;
|
|
4
4
|
export declare const routerAddress: AddressDappNetworkMap;
|
|
@@ -9,6 +9,7 @@ export declare const nonfungiblePositionManagerAddress: AddressNetworkMap;
|
|
|
9
9
|
export declare const networkChainIdMap: NetworkChainIdMap;
|
|
10
10
|
export declare const balancerSubgraph: AddressNetworkMap;
|
|
11
11
|
export declare const multiCallAddress: AddressNetworkMap;
|
|
12
|
+
export declare const lyraNetworkMap: LyraNetworkMap;
|
|
12
13
|
export declare const deadline: number;
|
|
13
14
|
export declare const MaxUint128 = "0xffffffffffffffffffffffffffffffff";
|
|
14
15
|
export declare const UNISWAPV3_QUOTER_ADDRESS = "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6";
|
package/dist/entities/pool.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Contract, Wallet, BigNumber } from "ethers";
|
|
2
|
-
import { Dapp, FundComposition, AssetEnabled, Network } from "../types";
|
|
2
|
+
import { Dapp, FundComposition, AssetEnabled, Network, LyraOptionMarket, LyraOptionType, LyraTradeType, LyraPosition } from "../types";
|
|
3
3
|
import { Utils } from "./utils";
|
|
4
4
|
import { FeeAmount } from "@uniswap/v3-sdk";
|
|
5
5
|
export declare class Pool {
|
|
@@ -318,4 +318,24 @@ export declare class Pool {
|
|
|
318
318
|
* @returns {Promise<any>} Transaction
|
|
319
319
|
*/
|
|
320
320
|
removeLiquidityVelodrome(assetA: string, assetB: string, amount: BigNumber | string, isStable: boolean, options?: any): Promise<any>;
|
|
321
|
+
/**
|
|
322
|
+
* Trade options on lyra
|
|
323
|
+
* @param {LyraOptionMarket} market Underlying market e.g. eth
|
|
324
|
+
* @param {number} expiry Expiry timestamp
|
|
325
|
+
* @param { number} strike Strike price
|
|
326
|
+
* @param {LyraOptionType} optionType Call or put
|
|
327
|
+
* @param { LyraTradeType} tradeType By or sell
|
|
328
|
+
* @param {BigNumber | string } optionAmount Option amount
|
|
329
|
+
* @param {string } assetIn Asset to invest
|
|
330
|
+
* @param {BigNumber | string } collateralChangeAmount Collateral amount to add when shorting options and to remove when covering shorts
|
|
331
|
+
* @param {boolean} isCoveredCall Selling covered call options
|
|
332
|
+
* @param {any} options Transaction options
|
|
333
|
+
* @returns {Promise<any>} Transaction
|
|
334
|
+
*/
|
|
335
|
+
tradeLyraOption(market: LyraOptionMarket, expiry: number, strike: number, optionType: LyraOptionType, tradeType: LyraTradeType, optionAmount: BigNumber | string, assetIn: string, collateralChangeAmount?: BigNumber | string, isCoveredCall?: boolean, options?: any): Promise<any>;
|
|
336
|
+
/**
|
|
337
|
+
* Gets Lyra option positions
|
|
338
|
+
* @returns {Promise<Position>} Transaction
|
|
339
|
+
*/
|
|
340
|
+
getLyraPositions(market: LyraOptionMarket): Promise<LyraPosition[]>;
|
|
321
341
|
}
|
package/dist/entities/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ethers, Wallet } from "ethers";
|
|
2
|
-
import { Dapp, Network, Reserves } from "../types";
|
|
1
|
+
import { BigNumber, ethers, Wallet } from "ethers";
|
|
2
|
+
import { Dapp, LyraOptionMarket, LyraOptionType, LyraTradeType, Network, Reserves } from "../types";
|
|
3
3
|
import { Pool } from ".";
|
|
4
|
+
import { Quote, Strike } from "@lyrafinance/lyra-js";
|
|
4
5
|
export declare class Utils {
|
|
5
6
|
network: Network;
|
|
6
7
|
signer: Wallet;
|
|
@@ -50,4 +51,8 @@ export declare class Utils {
|
|
|
50
51
|
getBalancerSwapTx(pool: Pool, assetFrom: string, assetTo: string, amountIn: ethers.BigNumber | string, slippage: number): Promise<any>;
|
|
51
52
|
getBalancerJoinPoolTx(pool: Pool, balancerPoolId: string, assets: string[], amountsIn: string[] | ethers.BigNumber[]): Promise<any>;
|
|
52
53
|
getBalancerExitPoolTx(pool: Pool, balancerPoolId: string, assets: string[], singleExitAssetIndex: null | number, amount: string | ethers.BigNumber): Promise<any>;
|
|
54
|
+
getLyraOptionExpiries(market: LyraOptionMarket): Promise<number[]>;
|
|
55
|
+
getLyraOptionStrikes(market: LyraOptionMarket, expiry: number): Promise<Strike[]>;
|
|
56
|
+
getLyraOptionStrike(market: LyraOptionMarket, expiry: number, strike: number): Promise<Strike>;
|
|
57
|
+
getLyraOptionQuote(strike: Strike, type: LyraOptionType, tradeType: LyraTradeType, amount: BigNumber | string): Promise<Quote>;
|
|
53
58
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LyraOptionMarket, Network } from "../..";
|
|
2
|
+
import { Board, Strike } from "@lyrafinance/lyra-js";
|
|
3
|
+
export declare function getBoard(network: Network, market: LyraOptionMarket, expiry: number): Promise<Board>;
|
|
4
|
+
export declare function getExpiries(network: Network, market: LyraOptionMarket): Promise<number[]>;
|
|
5
|
+
export declare function getStrikes(network: Network, market: LyraOptionMarket, expiry: number): Promise<Strike[]>;
|
|
6
|
+
export declare function getStrike(network: Network, market: LyraOptionMarket, expiry: number, strike: number): Promise<Strike>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Quote, Strike } from "@lyrafinance/lyra-js";
|
|
2
|
+
import { ethers } from "ethers";
|
|
3
|
+
import { LyraOptionType, LyraTradeType } from "../../types";
|
|
4
|
+
export declare function getQuote(strike: Strike, type: LyraOptionType, tradeType: LyraTradeType, amount: ethers.BigNumber): Promise<Quote>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BigNumber } from "ethers";
|
|
2
|
+
import { Pool } from "../..";
|
|
3
|
+
import { LyraOptionMarket, LyraOptionType, LyraTradeType } from "../../types";
|
|
4
|
+
export declare function getLyraOptionTxData(pool: Pool, market: LyraOptionMarket, optionType: LyraOptionType, expiry: number, strikePrice: number, tradeType: LyraTradeType, optionAmount: BigNumber | string, assetIn: string, collateralAmount: BigNumber, isCoveredCall: boolean): Promise<string>;
|
package/dist/test/constants.d.ts
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
export declare const SUSHI = "0x0b3f868e0be5597d5db7feb59e1cadbb0fdda50a";
|
|
2
|
-
export declare const WMATIC = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270";
|
|
3
|
-
export declare const BAL = "0x9a71012B13CA4d3D0Cdc72A177DF3ef03b0E76A3";
|
|
4
|
-
export declare const AMUSDC = "0x1a13f4ca1d028320a707d99520abfefca3998b7f";
|
|
5
|
-
export declare const VDEBTWETH = "0xede17e9d79fc6f9ff9250d9eefbdb88cc18038b5";
|
|
6
|
-
export declare const ARRAKIS_USDC_WETH_GAUGE = "0x33d1ad9Cd88A509397CD924C2d7613C285602C20";
|
|
7
|
-
export declare const STMATIC = "0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4";
|
|
8
|
-
export declare const WMATIC_STMATIC_LP = "0xaF5E0B5425dE1F5a630A8cB5AA9D97B8141C908D";
|
|
9
|
-
export declare const AARAKIS_WNATIC_STMATIC_GAUGE = "0x9928340f9E1aaAd7dF1D95E27bd9A5c715202a56";
|
|
10
|
-
export declare const ETHBULL3X = "0x460b60565cb73845d56564384ab84bf84c13e47d";
|
|
11
|
-
export declare const BTCBEAR2X = "0x3dbce2c8303609c17aa23b69ebe83c2f5c510ada";
|
|
12
1
|
export declare const WETH = "0x4200000000000000000000000000000000000006";
|
|
13
2
|
export declare const USDC = "0x7F5c764cBc14f9669B88837ca1490cCa17c31607";
|
|
14
3
|
export declare const DAI = "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1";
|
|
@@ -17,4 +6,6 @@ export declare const WBTC = "0x68f180fcCe6836688e9084f035309E29Bf0A2095";
|
|
|
17
6
|
export declare const OP = "4200000000000000000000000000000000000042";
|
|
18
7
|
export declare const WSTETH = "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb";
|
|
19
8
|
export declare const VEL = "0x3c8B650257cFb5f272f799F5e2b4e65093a11a05";
|
|
20
|
-
export declare const
|
|
9
|
+
export declare const SUSD = "0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9";
|
|
10
|
+
export declare const ARRAKIS_USDC_WETH_GAUGE = "0xb8888ea29e2f70ad62a3b69b1a1342720612a00d";
|
|
11
|
+
export declare const TEST_POOL = "0x3d45e539df0f9fa6015106a968d732a8f6c2a40b";
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Deployment } from "@lyrafinance/lyra-js";
|
|
1
2
|
import { BigNumber } from "ethers";
|
|
2
3
|
export declare enum Network {
|
|
3
4
|
POLYGON = "polygon",
|
|
@@ -14,7 +15,8 @@ export declare enum Dapp {
|
|
|
14
15
|
AAVEV3 = "aavev3",
|
|
15
16
|
ARRAKIS = "arrakis",
|
|
16
17
|
TOROS = "toros",
|
|
17
|
-
VELODROME = "velodrome"
|
|
18
|
+
VELODROME = "velodrome",
|
|
19
|
+
LYRA = "lyra"
|
|
18
20
|
}
|
|
19
21
|
export declare enum Transaction {
|
|
20
22
|
SWAP = "swapExactTokensForTokens",
|
|
@@ -58,3 +60,20 @@ export declare type Reserves = {
|
|
|
58
60
|
assetB: BigNumber;
|
|
59
61
|
};
|
|
60
62
|
export declare type NetworkChainIdMap = Readonly<Record<Network, number>>;
|
|
63
|
+
export declare type LyraOptionMarket = "eth";
|
|
64
|
+
export declare type AddressMarketMap = {
|
|
65
|
+
[key in LyraOptionMarket]: string;
|
|
66
|
+
};
|
|
67
|
+
export declare type LyraTradeType = "buy" | "sell";
|
|
68
|
+
export declare type LyraOptionType = "call" | "put";
|
|
69
|
+
export declare type LyraNetworkMap = {
|
|
70
|
+
[key in Network]?: Deployment;
|
|
71
|
+
};
|
|
72
|
+
export declare type LyraPosition = {
|
|
73
|
+
positionId: BigNumber;
|
|
74
|
+
strikeId: BigNumber;
|
|
75
|
+
optionType: number;
|
|
76
|
+
amount: BigNumber;
|
|
77
|
+
collateral: BigNumber;
|
|
78
|
+
state: number;
|
|
79
|
+
};
|