@gmx-io/sdk 0.0.1-alpha-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/LICENSE +40 -0
- package/README.md +79 -0
- package/build/abis/CustomErrors.json +3254 -0
- package/build/abis/DataStore.json +1440 -0
- package/build/abis/ERC721.json +442 -0
- package/build/abis/EventEmitter.json +2065 -0
- package/build/abis/ExchangeRouter.json +1598 -0
- package/build/abis/GMT.json +522 -0
- package/build/abis/GlpManager.json +592 -0
- package/build/abis/GlvReader.json +1425 -0
- package/build/abis/GlvRouter.json +613 -0
- package/build/abis/GmxMigrator.json +657 -0
- package/build/abis/GovToken.json +1121 -0
- package/build/abis/MintableBaseToken.json +696 -0
- package/build/abis/Multicall.json +333 -0
- package/build/abis/OrderBook.json +1997 -0
- package/build/abis/OrderBookReader.json +111 -0
- package/build/abis/OrderExecutor.json +122 -0
- package/build/abis/PositionManager.json +1165 -0
- package/build/abis/PositionRouter.json +2030 -0
- package/build/abis/Reader.json +355 -0
- package/build/abis/ReaderV2.json +630 -0
- package/build/abis/ReferralStorage.json +507 -0
- package/build/abis/RewardReader.json +86 -0
- package/build/abis/RewardRouter.json +769 -0
- package/build/abis/RewardTracker.json +918 -0
- package/build/abis/Router-v2.json +605 -0
- package/build/abis/Router.json +605 -0
- package/build/abis/SubaccountRouter.json +648 -0
- package/build/abis/SyntheticsReader.json +4577 -0
- package/build/abis/SyntheticsRouter.json +77 -0
- package/build/abis/Timelock.json +1737 -0
- package/build/abis/Token.json +345 -0
- package/build/abis/Treasury.json +411 -0
- package/build/abis/UniPool.json +89 -0
- package/build/abis/UniswapV2.json +1 -0
- package/build/abis/Vault.json +3220 -0
- package/build/abis/VaultReader.json +87 -0
- package/build/abis/VaultV2.json +3019 -0
- package/build/abis/VaultV2b.json +3220 -0
- package/build/abis/Vester.json +1031 -0
- package/build/abis/WETH.json +320 -0
- package/build/abis/YieldFarm.json +599 -0
- package/build/abis/YieldToken.json +560 -0
- package/build/prebuilt/hashedMarketConfigKeys.json +3658 -0
- package/build/prebuilt/hashedMarketValuesKeys.json +1103 -0
- package/build/prebuilt/index.ts +28 -0
- package/build/src/abis/CustomErrors.json +3254 -0
- package/build/src/abis/DataStore.json +1440 -0
- package/build/src/abis/ERC721.json +442 -0
- package/build/src/abis/EventEmitter.json +2065 -0
- package/build/src/abis/ExchangeRouter.json +1598 -0
- package/build/src/abis/GMT.json +522 -0
- package/build/src/abis/GlpManager.json +591 -0
- package/build/src/abis/GlvReader.json +1424 -0
- package/build/src/abis/GlvRouter.json +612 -0
- package/build/src/abis/GmxMigrator.json +657 -0
- package/build/src/abis/GovToken.json +1121 -0
- package/build/src/abis/MintableBaseToken.json +696 -0
- package/build/src/abis/Multicall.json +333 -0
- package/build/src/abis/OrderBook.json +1997 -0
- package/build/src/abis/OrderBookReader.json +111 -0
- package/build/src/abis/OrderExecutor.json +122 -0
- package/build/src/abis/PositionManager.json +1165 -0
- package/build/src/abis/PositionRouter.json +2030 -0
- package/build/src/abis/Reader.json +355 -0
- package/build/src/abis/ReaderV2.json +630 -0
- package/build/src/abis/ReferralStorage.json +507 -0
- package/build/src/abis/RewardReader.json +86 -0
- package/build/src/abis/RewardRouter.json +769 -0
- package/build/src/abis/RewardTracker.json +918 -0
- package/build/src/abis/Router-v2.json +605 -0
- package/build/src/abis/Router.json +605 -0
- package/build/src/abis/SubaccountRouter.json +648 -0
- package/build/src/abis/SyntheticsReader.json +4577 -0
- package/build/src/abis/SyntheticsRouter.json +77 -0
- package/build/src/abis/Timelock.json +1737 -0
- package/build/src/abis/Token.json +345 -0
- package/build/src/abis/Treasury.json +411 -0
- package/build/src/abis/UniPool.json +89 -0
- package/build/src/abis/UniswapV2.json +1 -0
- package/build/src/abis/Vault.json +3220 -0
- package/build/src/abis/VaultReader.json +87 -0
- package/build/src/abis/VaultV2.json +3019 -0
- package/build/src/abis/VaultV2b.json +3220 -0
- package/build/src/abis/Vester.json +1031 -0
- package/build/src/abis/WETH.json +320 -0
- package/build/src/abis/YieldFarm.json +599 -0
- package/build/src/abis/YieldToken.json +560 -0
- package/build/src/configs/batch.d.ts +6 -0
- package/build/src/configs/batch.js +51 -0
- package/build/src/configs/chains.d.ts +37 -0
- package/build/src/configs/chains.js +90 -0
- package/build/src/configs/contracts.d.ts +2 -0
- package/build/src/configs/contracts.js +218 -0
- package/build/src/configs/dataStore.d.ts +149 -0
- package/build/src/configs/dataStore.js +276 -0
- package/build/src/configs/factors.d.ts +20 -0
- package/build/src/configs/factors.js +21 -0
- package/build/src/configs/markets.d.ts +8 -0
- package/build/src/configs/markets.js +528 -0
- package/build/src/configs/subgraph.d.ts +3 -0
- package/build/src/configs/subgraph.js +3 -0
- package/build/src/configs/tokens.d.ts +89 -0
- package/build/src/configs/tokens.js +1269 -0
- package/build/src/index.d.ts +44 -0
- package/build/src/index.js +245 -0
- package/build/src/modules/accounts/accounts.d.ts +5 -0
- package/build/src/modules/accounts/accounts.js +36 -0
- package/build/src/modules/accounts/accounts.spec.d.ts +1 -0
- package/build/src/modules/accounts/accounts.spec.js +7 -0
- package/build/src/modules/base.d.ts +9 -0
- package/build/src/modules/base.js +15 -0
- package/build/src/modules/markets/index.d.ts +26 -0
- package/build/src/modules/markets/index.js +339 -0
- package/build/src/modules/markets/markets.spec.d.ts +1 -0
- package/build/src/modules/markets/markets.spec.js +38 -0
- package/build/src/modules/markets/query-builders.d.ts +40 -0
- package/build/src/modules/markets/query-builders.js +379 -0
- package/build/src/modules/markets/types.d.ts +42 -0
- package/build/src/modules/markets/types.js +1 -0
- package/build/src/modules/oracle.d.ts +31 -0
- package/build/src/modules/oracle.js +53 -0
- package/build/src/modules/orders/orders.d.ts +60 -0
- package/build/src/modules/orders/orders.js +270 -0
- package/build/src/modules/orders/orders.spec.d.ts +1 -0
- package/build/src/modules/orders/orders.spec.js +16 -0
- package/build/src/modules/orders/transactions/cancelOrdersTxn.d.ts +6 -0
- package/build/src/modules/orders/transactions/cancelOrdersTxn.js +15 -0
- package/build/src/modules/orders/transactions/createDecreaseOrderTxn.d.ts +32 -0
- package/build/src/modules/orders/transactions/createDecreaseOrderTxn.js +98 -0
- package/build/src/modules/orders/transactions/createIncreaseOrderTxn.d.ts +77 -0
- package/build/src/modules/orders/transactions/createIncreaseOrderTxn.js +164 -0
- package/build/src/modules/orders/transactions/createSwapOrderTxn.d.ts +16 -0
- package/build/src/modules/orders/transactions/createSwapOrderTxn.js +97 -0
- package/build/src/modules/orders/transactions/createWrapOrUnwrapTxn.d.ts +6 -0
- package/build/src/modules/orders/transactions/createWrapOrUnwrapTxn.js +13 -0
- package/build/src/modules/orders/transactions/updateOrderTxn.d.ts +23 -0
- package/build/src/modules/orders/transactions/updateOrderTxn.js +44 -0
- package/build/src/modules/orders/utils.d.ts +248 -0
- package/build/src/modules/orders/utils.js +151 -0
- package/build/src/modules/positions/positions.d.ts +48 -0
- package/build/src/modules/positions/positions.js +563 -0
- package/build/src/modules/positions/positions.spec.d.ts +1 -0
- package/build/src/modules/positions/positions.spec.js +25 -0
- package/build/src/modules/tokens/tokens.d.ts +26 -0
- package/build/src/modules/tokens/tokens.js +132 -0
- package/build/src/modules/tokens/tokens.spec.d.ts +1 -0
- package/build/src/modules/tokens/tokens.spec.js +19 -0
- package/build/src/modules/trades/trades.d.ts +48 -0
- package/build/src/modules/trades/trades.js +390 -0
- package/build/src/modules/trades/trades.spec.d.ts +1 -0
- package/build/src/modules/trades/trades.spec.js +14 -0
- package/build/src/prebuilt/hashedMarketConfigKeys.json +3658 -0
- package/build/src/prebuilt/hashedMarketValuesKeys.json +1103 -0
- package/build/src/prebuilt/index.d.ts +14 -0
- package/build/src/prebuilt/index.js +9 -0
- package/build/src/types/amounts.d.ts +223 -0
- package/build/src/types/amounts.js +17 -0
- package/build/src/types/fees.d.ts +34 -0
- package/build/src/types/fees.js +1 -0
- package/build/src/types/markets.d.ts +143 -0
- package/build/src/types/markets.js +1 -0
- package/build/src/types/orders.d.ts +74 -0
- package/build/src/types/orders.js +33 -0
- package/build/src/types/positions.d.ts +53 -0
- package/build/src/types/positions.js +1 -0
- package/build/src/types/referrals.d.ts +124 -0
- package/build/src/types/referrals.js +9 -0
- package/build/src/types/sdk.d.ts +32 -0
- package/build/src/types/sdk.js +1 -0
- package/build/src/types/sidecarOrders.d.ts +54 -0
- package/build/src/types/sidecarOrders.js +1 -0
- package/build/src/types/syntheticsEvents.d.ts +88 -0
- package/build/src/types/syntheticsEvents.js +1 -0
- package/build/src/types/tokens.d.ts +89 -0
- package/build/src/types/tokens.js +1 -0
- package/build/src/types/trade.d.ts +223 -0
- package/build/src/types/trade.js +17 -0
- package/build/src/types/tradeHistory.d.ts +107 -0
- package/build/src/types/tradeHistory.js +8 -0
- package/build/src/utils/LruCache.d.ts +10 -0
- package/build/src/utils/LruCache.js +45 -0
- package/build/src/utils/bigmath.d.ts +7 -0
- package/build/src/utils/bigmath.js +23 -0
- package/build/src/utils/buildUrl.d.ts +1 -0
- package/build/src/utils/buildUrl.js +5 -0
- package/build/src/utils/callContract.d.ts +17 -0
- package/build/src/utils/callContract.js +133 -0
- package/build/src/utils/common.d.ts +2 -0
- package/build/src/utils/common.js +2 -0
- package/build/src/utils/fees/estimateOraclePriceCount.d.ts +6 -0
- package/build/src/utils/fees/estimateOraclePriceCount.js +19 -0
- package/build/src/utils/fees/executionFee.d.ts +59 -0
- package/build/src/utils/fees/executionFee.js +108 -0
- package/build/src/utils/fees/index.d.ts +29 -0
- package/build/src/utils/fees/index.js +89 -0
- package/build/src/utils/fees/priceImpact.d.ts +75 -0
- package/build/src/utils/fees/priceImpact.js +287 -0
- package/build/src/utils/graphqlFetcher.d.ts +1 -0
- package/build/src/utils/graphqlFetcher.js +18 -0
- package/build/src/utils/hash.d.ts +5 -0
- package/build/src/utils/hash.js +35 -0
- package/build/src/utils/marketKeysAndConfigs.d.ts +66 -0
- package/build/src/utils/marketKeysAndConfigs.js +257 -0
- package/build/src/utils/markets.d.ts +40 -0
- package/build/src/utils/markets.js +129 -0
- package/build/src/utils/multicall.d.ts +64 -0
- package/build/src/utils/multicall.js +116 -0
- package/build/src/utils/numbers.d.ts +9 -0
- package/build/src/utils/numbers.js +30 -0
- package/build/src/utils/objects.d.ts +18 -0
- package/build/src/utils/objects.js +30 -0
- package/build/src/utils/orders.d.ts +28 -0
- package/build/src/utils/orders.js +178 -0
- package/build/src/utils/positions.d.ts +60 -0
- package/build/src/utils/positions.js +133 -0
- package/build/src/utils/prices.d.ts +15 -0
- package/build/src/utils/prices.js +34 -0
- package/build/src/utils/referrals.d.ts +2 -0
- package/build/src/utils/referrals.js +27 -0
- package/build/src/utils/simulateExecuteOrder.d.ts +16 -0
- package/build/src/utils/simulateExecuteOrder.js +143 -0
- package/build/src/utils/slidingWindowFallbackSwitcher.d.ts +24 -0
- package/build/src/utils/slidingWindowFallbackSwitcher.js +40 -0
- package/build/src/utils/subgraph.d.ts +21 -0
- package/build/src/utils/subgraph.js +72 -0
- package/build/src/utils/swapStats.d.ts +35 -0
- package/build/src/utils/swapStats.js +197 -0
- package/build/src/utils/test.d.ts +2 -0
- package/build/src/utils/test.js +24 -0
- package/build/src/utils/tokens.d.ts +18 -0
- package/build/src/utils/tokens.js +64 -0
- package/build/src/utils/trade.d.ts +10 -0
- package/build/src/utils/trade.js +32 -0
- package/build/tsconfig.tsbuildinfo +1 -0
- package/package.json +96 -0
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import { getContractMarketPrices } from "utils/markets";
|
|
2
|
+
import { getByKey } from "utils/objects";
|
|
3
|
+
import DataStore from "abis/DataStore.json";
|
|
4
|
+
import SyntheticsReader from "abis/SyntheticsReader.json";
|
|
5
|
+
import { CLAIMABLE_FUNDING_AMOUNT, MAX_PNL_FACTOR_FOR_TRADERS_KEY } from "configs/dataStore";
|
|
6
|
+
import { HASHED_MARKET_CONFIG_KEYS, HASHED_MARKET_VALUES_KEYS } from "prebuilt";
|
|
7
|
+
import { hashDataMap } from "utils/hash";
|
|
8
|
+
import { getContract } from "configs/contracts";
|
|
9
|
+
import { hashMarketConfigKeys, hashMarketValuesKeys } from "utils/marketKeysAndConfigs";
|
|
10
|
+
export function buildClaimableFundingDataRequest({ marketsAddresses, marketsData, chainId, account, }) {
|
|
11
|
+
if (!marketsAddresses) {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
return marketsAddresses.reduce((request, marketAddress) => {
|
|
15
|
+
const market = getByKey(marketsData, marketAddress);
|
|
16
|
+
if (!market) {
|
|
17
|
+
return request;
|
|
18
|
+
}
|
|
19
|
+
const keys = hashDataMap({
|
|
20
|
+
claimableFundingAmountLong: [
|
|
21
|
+
["bytes32", "address", "address", "address"],
|
|
22
|
+
[CLAIMABLE_FUNDING_AMOUNT, marketAddress, market.longTokenAddress, account],
|
|
23
|
+
],
|
|
24
|
+
claimableFundingAmountShort: [
|
|
25
|
+
["bytes32", "address", "address", "address"],
|
|
26
|
+
[CLAIMABLE_FUNDING_AMOUNT, marketAddress, market.shortTokenAddress, account],
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
request[marketAddress] = {
|
|
30
|
+
contractAddress: getContract(chainId, "DataStore"),
|
|
31
|
+
abi: DataStore.abi,
|
|
32
|
+
calls: {
|
|
33
|
+
claimableFundingAmountLong: {
|
|
34
|
+
methodName: "getUint",
|
|
35
|
+
params: [keys.claimableFundingAmountLong],
|
|
36
|
+
},
|
|
37
|
+
claimableFundingAmountShort: {
|
|
38
|
+
methodName: "getUint",
|
|
39
|
+
params: [keys.claimableFundingAmountShort],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
return request;
|
|
44
|
+
}, {});
|
|
45
|
+
}
|
|
46
|
+
export async function buildMarketsValuesRequest(chainId, { marketsAddresses, marketsData, tokensData, dataStoreAddress, syntheticsReaderAddress, }) {
|
|
47
|
+
const request = {};
|
|
48
|
+
for (const marketAddress of marketsAddresses || []) {
|
|
49
|
+
const market = getByKey(marketsData, marketAddress);
|
|
50
|
+
const marketPrices = getContractMarketPrices(tokensData, market);
|
|
51
|
+
if (!marketPrices) {
|
|
52
|
+
// eslint-disable-next-line no-console
|
|
53
|
+
console.warn("missed market prices", market);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const marketProps = {
|
|
57
|
+
marketToken: market.marketTokenAddress,
|
|
58
|
+
indexToken: market.indexTokenAddress,
|
|
59
|
+
longToken: market.longTokenAddress,
|
|
60
|
+
shortToken: market.shortTokenAddress,
|
|
61
|
+
};
|
|
62
|
+
request[`${marketAddress}-reader`] = {
|
|
63
|
+
contractAddress: syntheticsReaderAddress,
|
|
64
|
+
abi: SyntheticsReader.abi,
|
|
65
|
+
calls: {
|
|
66
|
+
marketInfo: {
|
|
67
|
+
methodName: "getMarketInfo",
|
|
68
|
+
params: [dataStoreAddress, marketPrices, marketAddress],
|
|
69
|
+
},
|
|
70
|
+
marketTokenPriceMax: {
|
|
71
|
+
methodName: "getMarketTokenPrice",
|
|
72
|
+
params: [
|
|
73
|
+
dataStoreAddress,
|
|
74
|
+
marketProps,
|
|
75
|
+
marketPrices.indexTokenPrice,
|
|
76
|
+
marketPrices.longTokenPrice,
|
|
77
|
+
marketPrices.shortTokenPrice,
|
|
78
|
+
MAX_PNL_FACTOR_FOR_TRADERS_KEY,
|
|
79
|
+
true,
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
marketTokenPriceMin: {
|
|
83
|
+
methodName: "getMarketTokenPrice",
|
|
84
|
+
params: [
|
|
85
|
+
dataStoreAddress,
|
|
86
|
+
marketProps,
|
|
87
|
+
marketPrices.indexTokenPrice,
|
|
88
|
+
marketPrices.longTokenPrice,
|
|
89
|
+
marketPrices.shortTokenPrice,
|
|
90
|
+
MAX_PNL_FACTOR_FOR_TRADERS_KEY,
|
|
91
|
+
false,
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
let prebuiltHashedKeys = HASHED_MARKET_VALUES_KEYS[chainId]?.[marketAddress];
|
|
97
|
+
if (!prebuiltHashedKeys) {
|
|
98
|
+
console.warn(`No pre-built hashed market keys found for the market ${marketAddress}. Run \`yarn prebuild\` to generate them.`);
|
|
99
|
+
if (!marketsData?.[marketAddress]) {
|
|
100
|
+
throw new Error(`No market data found for the market ${marketAddress}`);
|
|
101
|
+
}
|
|
102
|
+
prebuiltHashedKeys = hashMarketValuesKeys(marketsData[marketAddress]);
|
|
103
|
+
}
|
|
104
|
+
const keys = {
|
|
105
|
+
...prebuiltHashedKeys,
|
|
106
|
+
};
|
|
107
|
+
request[`${marketAddress}-dataStore`] = {
|
|
108
|
+
contractAddress: dataStoreAddress,
|
|
109
|
+
abi: DataStore.abi,
|
|
110
|
+
calls: {
|
|
111
|
+
longPoolAmount: {
|
|
112
|
+
methodName: "getUint",
|
|
113
|
+
params: [keys.longPoolAmount],
|
|
114
|
+
},
|
|
115
|
+
shortPoolAmount: {
|
|
116
|
+
methodName: "getUint",
|
|
117
|
+
params: [keys.shortPoolAmount],
|
|
118
|
+
},
|
|
119
|
+
positionImpactPoolAmount: {
|
|
120
|
+
methodName: "getUint",
|
|
121
|
+
params: [keys.positionImpactPoolAmount],
|
|
122
|
+
},
|
|
123
|
+
swapImpactPoolAmountLong: {
|
|
124
|
+
methodName: "getUint",
|
|
125
|
+
params: [keys.swapImpactPoolAmountLong],
|
|
126
|
+
},
|
|
127
|
+
swapImpactPoolAmountShort: {
|
|
128
|
+
methodName: "getUint",
|
|
129
|
+
params: [keys.swapImpactPoolAmountShort],
|
|
130
|
+
},
|
|
131
|
+
longInterestUsingLongToken: {
|
|
132
|
+
methodName: "getUint",
|
|
133
|
+
params: [keys.longInterestUsingLongToken],
|
|
134
|
+
},
|
|
135
|
+
longInterestUsingShortToken: {
|
|
136
|
+
methodName: "getUint",
|
|
137
|
+
params: [keys.longInterestUsingShortToken],
|
|
138
|
+
},
|
|
139
|
+
shortInterestUsingLongToken: {
|
|
140
|
+
methodName: "getUint",
|
|
141
|
+
params: [keys.shortInterestUsingLongToken],
|
|
142
|
+
},
|
|
143
|
+
shortInterestUsingShortToken: {
|
|
144
|
+
methodName: "getUint",
|
|
145
|
+
params: [keys.shortInterestUsingShortToken],
|
|
146
|
+
},
|
|
147
|
+
longInterestInTokensUsingLongToken: {
|
|
148
|
+
methodName: "getUint",
|
|
149
|
+
params: [keys.longInterestInTokensUsingLongToken],
|
|
150
|
+
},
|
|
151
|
+
longInterestInTokensUsingShortToken: {
|
|
152
|
+
methodName: "getUint",
|
|
153
|
+
params: [keys.longInterestInTokensUsingShortToken],
|
|
154
|
+
},
|
|
155
|
+
shortInterestInTokensUsingLongToken: {
|
|
156
|
+
methodName: "getUint",
|
|
157
|
+
params: [keys.shortInterestInTokensUsingLongToken],
|
|
158
|
+
},
|
|
159
|
+
shortInterestInTokensUsingShortToken: {
|
|
160
|
+
methodName: "getUint",
|
|
161
|
+
params: [keys.shortInterestInTokensUsingShortToken],
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
return request;
|
|
167
|
+
}
|
|
168
|
+
export async function buildMarketsConfigsRequest(chainId, { marketsData, marketsAddresses, dataStoreAddress, }) {
|
|
169
|
+
const request = {};
|
|
170
|
+
for (const marketAddress of marketsAddresses || []) {
|
|
171
|
+
let prebuiltHashedKeys = HASHED_MARKET_CONFIG_KEYS[chainId]?.[marketAddress];
|
|
172
|
+
if (!prebuiltHashedKeys) {
|
|
173
|
+
console.warn(`No pre-built hashed config keys found for the market ${marketAddress}. Run \`yarn prebuild\` to generate them.`);
|
|
174
|
+
if (!marketsData?.[marketAddress]) {
|
|
175
|
+
throw new Error(`No market data found for the market ${marketAddress}`);
|
|
176
|
+
}
|
|
177
|
+
prebuiltHashedKeys = hashMarketConfigKeys(marketsData[marketAddress]);
|
|
178
|
+
}
|
|
179
|
+
request[`${marketAddress}-dataStore`] = {
|
|
180
|
+
contractAddress: dataStoreAddress,
|
|
181
|
+
abi: DataStore.abi,
|
|
182
|
+
calls: {
|
|
183
|
+
isDisabled: {
|
|
184
|
+
methodName: "getBool",
|
|
185
|
+
params: [prebuiltHashedKeys.isDisabled],
|
|
186
|
+
},
|
|
187
|
+
maxLongPoolAmount: {
|
|
188
|
+
methodName: "getUint",
|
|
189
|
+
params: [prebuiltHashedKeys.maxLongPoolAmount],
|
|
190
|
+
},
|
|
191
|
+
maxShortPoolAmount: {
|
|
192
|
+
methodName: "getUint",
|
|
193
|
+
params: [prebuiltHashedKeys.maxShortPoolAmount],
|
|
194
|
+
},
|
|
195
|
+
maxLongPoolUsdForDeposit: {
|
|
196
|
+
methodName: "getUint",
|
|
197
|
+
params: [prebuiltHashedKeys.maxLongPoolUsdForDeposit],
|
|
198
|
+
},
|
|
199
|
+
maxShortPoolUsdForDeposit: {
|
|
200
|
+
methodName: "getUint",
|
|
201
|
+
params: [prebuiltHashedKeys.maxShortPoolUsdForDeposit],
|
|
202
|
+
},
|
|
203
|
+
longPoolAmountAdjustment: {
|
|
204
|
+
methodName: "getUint",
|
|
205
|
+
params: [prebuiltHashedKeys.longPoolAmountAdjustment],
|
|
206
|
+
},
|
|
207
|
+
shortPoolAmountAdjustment: {
|
|
208
|
+
methodName: "getUint",
|
|
209
|
+
params: [prebuiltHashedKeys.shortPoolAmountAdjustment],
|
|
210
|
+
},
|
|
211
|
+
reserveFactorLong: {
|
|
212
|
+
methodName: "getUint",
|
|
213
|
+
params: [prebuiltHashedKeys.reserveFactorLong],
|
|
214
|
+
},
|
|
215
|
+
reserveFactorShort: {
|
|
216
|
+
methodName: "getUint",
|
|
217
|
+
params: [prebuiltHashedKeys.reserveFactorShort],
|
|
218
|
+
},
|
|
219
|
+
openInterestReserveFactorLong: {
|
|
220
|
+
methodName: "getUint",
|
|
221
|
+
params: [prebuiltHashedKeys.openInterestReserveFactorLong],
|
|
222
|
+
},
|
|
223
|
+
openInterestReserveFactorShort: {
|
|
224
|
+
methodName: "getUint",
|
|
225
|
+
params: [prebuiltHashedKeys.openInterestReserveFactorShort],
|
|
226
|
+
},
|
|
227
|
+
maxOpenInterestLong: {
|
|
228
|
+
methodName: "getUint",
|
|
229
|
+
params: [prebuiltHashedKeys.maxOpenInterestLong],
|
|
230
|
+
},
|
|
231
|
+
maxOpenInterestShort: {
|
|
232
|
+
methodName: "getUint",
|
|
233
|
+
params: [prebuiltHashedKeys.maxOpenInterestShort],
|
|
234
|
+
},
|
|
235
|
+
minPositionImpactPoolAmount: {
|
|
236
|
+
methodName: "getUint",
|
|
237
|
+
params: [prebuiltHashedKeys.minPositionImpactPoolAmount],
|
|
238
|
+
},
|
|
239
|
+
positionImpactPoolDistributionRate: {
|
|
240
|
+
methodName: "getUint",
|
|
241
|
+
params: [prebuiltHashedKeys.positionImpactPoolDistributionRate],
|
|
242
|
+
},
|
|
243
|
+
borrowingFactorLong: {
|
|
244
|
+
methodName: "getUint",
|
|
245
|
+
params: [prebuiltHashedKeys.borrowingFactorLong],
|
|
246
|
+
},
|
|
247
|
+
borrowingFactorShort: {
|
|
248
|
+
methodName: "getUint",
|
|
249
|
+
params: [prebuiltHashedKeys.borrowingFactorShort],
|
|
250
|
+
},
|
|
251
|
+
borrowingExponentFactorLong: {
|
|
252
|
+
methodName: "getUint",
|
|
253
|
+
params: [prebuiltHashedKeys.borrowingExponentFactorLong],
|
|
254
|
+
},
|
|
255
|
+
borrowingExponentFactorShort: {
|
|
256
|
+
methodName: "getUint",
|
|
257
|
+
params: [prebuiltHashedKeys.borrowingExponentFactorShort],
|
|
258
|
+
},
|
|
259
|
+
fundingFactor: {
|
|
260
|
+
methodName: "getUint",
|
|
261
|
+
params: [prebuiltHashedKeys.fundingFactor],
|
|
262
|
+
},
|
|
263
|
+
fundingExponentFactor: {
|
|
264
|
+
methodName: "getUint",
|
|
265
|
+
params: [prebuiltHashedKeys.fundingExponentFactor],
|
|
266
|
+
},
|
|
267
|
+
fundingIncreaseFactorPerSecond: {
|
|
268
|
+
methodName: "getUint",
|
|
269
|
+
params: [prebuiltHashedKeys.fundingIncreaseFactorPerSecond],
|
|
270
|
+
},
|
|
271
|
+
fundingDecreaseFactorPerSecond: {
|
|
272
|
+
methodName: "getUint",
|
|
273
|
+
params: [prebuiltHashedKeys.fundingDecreaseFactorPerSecond],
|
|
274
|
+
},
|
|
275
|
+
thresholdForStableFunding: {
|
|
276
|
+
methodName: "getUint",
|
|
277
|
+
params: [prebuiltHashedKeys.thresholdForStableFunding],
|
|
278
|
+
},
|
|
279
|
+
thresholdForDecreaseFunding: {
|
|
280
|
+
methodName: "getUint",
|
|
281
|
+
params: [prebuiltHashedKeys.thresholdForDecreaseFunding],
|
|
282
|
+
},
|
|
283
|
+
minFundingFactorPerSecond: {
|
|
284
|
+
methodName: "getUint",
|
|
285
|
+
params: [prebuiltHashedKeys.minFundingFactorPerSecond],
|
|
286
|
+
},
|
|
287
|
+
maxFundingFactorPerSecond: {
|
|
288
|
+
methodName: "getUint",
|
|
289
|
+
params: [prebuiltHashedKeys.maxFundingFactorPerSecond],
|
|
290
|
+
},
|
|
291
|
+
maxPnlFactorForTradersLong: {
|
|
292
|
+
methodName: "getUint",
|
|
293
|
+
params: [prebuiltHashedKeys.maxPnlFactorForTradersLong],
|
|
294
|
+
},
|
|
295
|
+
maxPnlFactorForTradersShort: {
|
|
296
|
+
methodName: "getUint",
|
|
297
|
+
params: [prebuiltHashedKeys.maxPnlFactorForTradersShort],
|
|
298
|
+
},
|
|
299
|
+
positionFeeFactorForPositiveImpact: {
|
|
300
|
+
methodName: "getUint",
|
|
301
|
+
params: [prebuiltHashedKeys.positionFeeFactorForPositiveImpact],
|
|
302
|
+
},
|
|
303
|
+
positionFeeFactorForNegativeImpact: {
|
|
304
|
+
methodName: "getUint",
|
|
305
|
+
params: [prebuiltHashedKeys.positionFeeFactorForNegativeImpact],
|
|
306
|
+
},
|
|
307
|
+
positionImpactFactorPositive: {
|
|
308
|
+
methodName: "getUint",
|
|
309
|
+
params: [prebuiltHashedKeys.positionImpactFactorPositive],
|
|
310
|
+
},
|
|
311
|
+
positionImpactFactorNegative: {
|
|
312
|
+
methodName: "getUint",
|
|
313
|
+
params: [prebuiltHashedKeys.positionImpactFactorNegative],
|
|
314
|
+
},
|
|
315
|
+
maxPositionImpactFactorPositive: {
|
|
316
|
+
methodName: "getUint",
|
|
317
|
+
params: [prebuiltHashedKeys.maxPositionImpactFactorPositive],
|
|
318
|
+
},
|
|
319
|
+
maxPositionImpactFactorNegative: {
|
|
320
|
+
methodName: "getUint",
|
|
321
|
+
params: [prebuiltHashedKeys.maxPositionImpactFactorNegative],
|
|
322
|
+
},
|
|
323
|
+
maxPositionImpactFactorForLiquidations: {
|
|
324
|
+
methodName: "getUint",
|
|
325
|
+
params: [prebuiltHashedKeys.maxPositionImpactFactorForLiquidations],
|
|
326
|
+
},
|
|
327
|
+
minCollateralFactor: {
|
|
328
|
+
methodName: "getUint",
|
|
329
|
+
params: [prebuiltHashedKeys.minCollateralFactor],
|
|
330
|
+
},
|
|
331
|
+
minCollateralFactorForOpenInterestLong: {
|
|
332
|
+
methodName: "getUint",
|
|
333
|
+
params: [prebuiltHashedKeys.minCollateralFactorForOpenInterestLong],
|
|
334
|
+
},
|
|
335
|
+
minCollateralFactorForOpenInterestShort: {
|
|
336
|
+
methodName: "getUint",
|
|
337
|
+
params: [prebuiltHashedKeys.minCollateralFactorForOpenInterestShort],
|
|
338
|
+
},
|
|
339
|
+
positionImpactExponentFactor: {
|
|
340
|
+
methodName: "getUint",
|
|
341
|
+
params: [prebuiltHashedKeys.positionImpactExponentFactor],
|
|
342
|
+
},
|
|
343
|
+
swapFeeFactorForPositiveImpact: {
|
|
344
|
+
methodName: "getUint",
|
|
345
|
+
params: [prebuiltHashedKeys.swapFeeFactorForPositiveImpact],
|
|
346
|
+
},
|
|
347
|
+
swapFeeFactorForNegativeImpact: {
|
|
348
|
+
methodName: "getUint",
|
|
349
|
+
params: [prebuiltHashedKeys.swapFeeFactorForNegativeImpact],
|
|
350
|
+
},
|
|
351
|
+
swapImpactFactorPositive: {
|
|
352
|
+
methodName: "getUint",
|
|
353
|
+
params: [prebuiltHashedKeys.swapImpactFactorPositive],
|
|
354
|
+
},
|
|
355
|
+
swapImpactFactorNegative: {
|
|
356
|
+
methodName: "getUint",
|
|
357
|
+
params: [prebuiltHashedKeys.swapImpactFactorNegative],
|
|
358
|
+
},
|
|
359
|
+
swapImpactExponentFactor: {
|
|
360
|
+
methodName: "getUint",
|
|
361
|
+
params: [prebuiltHashedKeys.swapImpactExponentFactor],
|
|
362
|
+
},
|
|
363
|
+
virtualMarketId: {
|
|
364
|
+
methodName: "getBytes32",
|
|
365
|
+
params: [prebuiltHashedKeys.virtualMarketId],
|
|
366
|
+
},
|
|
367
|
+
virtualShortTokenId: {
|
|
368
|
+
methodName: "getBytes32",
|
|
369
|
+
params: [prebuiltHashedKeys.virtualShortTokenId],
|
|
370
|
+
},
|
|
371
|
+
virtualLongTokenId: {
|
|
372
|
+
methodName: "getBytes32",
|
|
373
|
+
params: [prebuiltHashedKeys.virtualLongTokenId],
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
return request;
|
|
379
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { MarketInfo, MarketsData, MarketsInfoData } from "types/markets";
|
|
2
|
+
import { TokensData } from "types/tokens";
|
|
3
|
+
import { MulticallRequestConfig } from "utils/multicall";
|
|
4
|
+
export type MarketsResult = {
|
|
5
|
+
marketsData?: MarketsData;
|
|
6
|
+
marketsAddresses?: string[];
|
|
7
|
+
error?: Error | undefined;
|
|
8
|
+
};
|
|
9
|
+
export type MarketsInfoResult = {
|
|
10
|
+
marketsInfoData?: MarketsInfoData;
|
|
11
|
+
tokensData?: TokensData;
|
|
12
|
+
pricesUpdatedAt?: number;
|
|
13
|
+
isBalancesLoaded?: boolean;
|
|
14
|
+
error?: Error;
|
|
15
|
+
};
|
|
16
|
+
export type MarketValues = Pick<MarketInfo, "longInterestUsd" | "shortInterestUsd" | "longInterestInTokens" | "shortInterestInTokens" | "longPoolAmount" | "shortPoolAmount" | "poolValueMin" | "poolValueMax" | "totalBorrowingFees" | "positionImpactPoolAmount" | "swapImpactPoolAmountLong" | "swapImpactPoolAmountShort" | "pnlLongMax" | "pnlLongMin" | "pnlShortMax" | "pnlShortMin" | "netPnlMax" | "netPnlMin" | "borrowingFactorPerSecondForLongs" | "borrowingFactorPerSecondForShorts" | "fundingFactorPerSecond" | "longsPayShorts" | "virtualPoolAmountForLongToken" | "virtualPoolAmountForShortToken" | "virtualInventoryForPositions">;
|
|
17
|
+
/**
|
|
18
|
+
* Updates seldom
|
|
19
|
+
*/
|
|
20
|
+
export type MarketConfig = Pick<MarketInfo, "isDisabled" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "maxLongPoolAmount" | "maxShortPoolAmount" | "longPoolAmountAdjustment" | "shortPoolAmountAdjustment" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForDecreaseFunding" | "thresholdForStableFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "minCollateralFactor" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionFeeFactorForPositiveImpact" | "positionFeeFactorForNegativeImpact" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "positionImpactExponentFactor" | "swapFeeFactorForPositiveImpact" | "swapFeeFactorForNegativeImpact" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId">;
|
|
21
|
+
export type MarketValuesMulticallRequestConfig = MulticallRequestConfig<{
|
|
22
|
+
[key: `${string}-reader`]: {
|
|
23
|
+
calls: Record<"marketInfo" | "marketTokenPriceMax" | "marketTokenPriceMin", {
|
|
24
|
+
methodName: string;
|
|
25
|
+
params: any[];
|
|
26
|
+
}>;
|
|
27
|
+
};
|
|
28
|
+
[key: `${string}-dataStore`]: {
|
|
29
|
+
calls: Record<"longPoolAmount" | "shortPoolAmount" | "positionImpactPoolAmount" | "swapImpactPoolAmountLong" | "swapImpactPoolAmountShort" | "longInterestUsingLongToken" | "longInterestUsingShortToken" | "shortInterestUsingLongToken" | "shortInterestUsingShortToken" | "longInterestInTokensUsingLongToken" | "longInterestInTokensUsingShortToken" | "shortInterestInTokensUsingLongToken" | "shortInterestInTokensUsingShortToken", {
|
|
30
|
+
methodName: string;
|
|
31
|
+
params: any[];
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
35
|
+
export type MarketConfigMulticallRequestConfig = MulticallRequestConfig<{
|
|
36
|
+
[key: `${string}-dataStore`]: {
|
|
37
|
+
calls: Record<"isDisabled" | "maxLongPoolAmount" | "maxShortPoolAmount" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "longPoolAmountAdjustment" | "shortPoolAmountAdjustment" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForStableFunding" | "thresholdForDecreaseFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "positionFeeFactorForPositiveImpact" | "positionFeeFactorForNegativeImpact" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "minCollateralFactor" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionImpactExponentFactor" | "swapFeeFactorForPositiveImpact" | "swapFeeFactorForNegativeImpact" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId", {
|
|
38
|
+
methodName: string;
|
|
39
|
+
params: any[];
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
42
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { GmxSdk } from "../index";
|
|
2
|
+
export type TickersResponse = {
|
|
3
|
+
minPrice: string;
|
|
4
|
+
maxPrice: string;
|
|
5
|
+
oracleDecimals: number;
|
|
6
|
+
tokenSymbol: string;
|
|
7
|
+
tokenAddress: string;
|
|
8
|
+
updatedAt: number;
|
|
9
|
+
}[];
|
|
10
|
+
export type TokensResponse = {
|
|
11
|
+
symbol: string;
|
|
12
|
+
address: string;
|
|
13
|
+
decimals: number;
|
|
14
|
+
synthetic: boolean;
|
|
15
|
+
}[];
|
|
16
|
+
export type ApiMarket = {
|
|
17
|
+
marketToken: string;
|
|
18
|
+
indexToken: string;
|
|
19
|
+
longToken: string;
|
|
20
|
+
shortToken: string;
|
|
21
|
+
isListed: boolean;
|
|
22
|
+
};
|
|
23
|
+
export type MarketsResponse = ApiMarket[];
|
|
24
|
+
export declare class Oracle {
|
|
25
|
+
sdk: GmxSdk;
|
|
26
|
+
private url;
|
|
27
|
+
constructor(sdk: GmxSdk);
|
|
28
|
+
getMarkets(): Promise<MarketsResponse>;
|
|
29
|
+
getTokens(): Promise<TokensResponse>;
|
|
30
|
+
getTickers(): Promise<TickersResponse>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import fetch from "cross-fetch";
|
|
2
|
+
import { buildUrl } from "utils/buildUrl";
|
|
3
|
+
export class Oracle {
|
|
4
|
+
constructor(sdk) {
|
|
5
|
+
this.sdk = sdk;
|
|
6
|
+
this.url = sdk.config.oracleUrl;
|
|
7
|
+
}
|
|
8
|
+
getMarkets() {
|
|
9
|
+
return fetch(buildUrl(this.url, "/markets"))
|
|
10
|
+
.then((res) => res.json())
|
|
11
|
+
.then((res) => {
|
|
12
|
+
if (!res.markets || !res.markets.length) {
|
|
13
|
+
throw new Error("Invalid markets response");
|
|
14
|
+
}
|
|
15
|
+
return res.markets;
|
|
16
|
+
})
|
|
17
|
+
.catch((e) => {
|
|
18
|
+
// eslint-disable-next-line no-console
|
|
19
|
+
console.error(e);
|
|
20
|
+
throw e;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
getTokens() {
|
|
24
|
+
return fetch(buildUrl(this.url, "/tokens"))
|
|
25
|
+
.then((res) => res.json())
|
|
26
|
+
.then((res) => res.tokens.map(({ synthetic, ...rest }) => {
|
|
27
|
+
return {
|
|
28
|
+
...rest,
|
|
29
|
+
isSynthetic: synthetic,
|
|
30
|
+
};
|
|
31
|
+
}))
|
|
32
|
+
.catch((e) => {
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.error(e);
|
|
35
|
+
throw e;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
getTickers() {
|
|
39
|
+
return fetch(buildUrl(this.url, "/prices/tickers"))
|
|
40
|
+
.then((res) => res.json())
|
|
41
|
+
.then((res) => {
|
|
42
|
+
if (!res.length) {
|
|
43
|
+
throw new Error("Invalid tickers response");
|
|
44
|
+
}
|
|
45
|
+
return res;
|
|
46
|
+
})
|
|
47
|
+
.catch((e) => {
|
|
48
|
+
// eslint-disable-next-line no-console
|
|
49
|
+
console.error(e);
|
|
50
|
+
throw e;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { MarketFilterLongShortItemData } from "modules/trades/trades";
|
|
2
|
+
import { MarketInfo, MarketsInfoData } from "types/markets";
|
|
3
|
+
import { OrdersInfoData, OrderType } from "types/orders";
|
|
4
|
+
import { SidecarLimitOrderEntryValid, SidecarSlTpOrderEntryValid } from "types/sidecarOrders";
|
|
5
|
+
import { TokenData, TokensData } from "types/tokens";
|
|
6
|
+
import { DecreasePositionAmounts, IncreasePositionAmounts, SwapAmounts } from "types/trade";
|
|
7
|
+
import { Module } from "../base";
|
|
8
|
+
import { WrapOrUnwrapParams } from "./transactions/createWrapOrUnwrapTxn";
|
|
9
|
+
export declare class Orders extends Module {
|
|
10
|
+
getOrders({ marketsInfoData, tokensData, orderTypesFilter, marketsDirectionsFilter, }: {
|
|
11
|
+
marketsInfoData: MarketsInfoData;
|
|
12
|
+
tokensData: TokensData;
|
|
13
|
+
orderTypesFilter?: OrderType[];
|
|
14
|
+
marketsDirectionsFilter?: MarketFilterLongShortItemData[];
|
|
15
|
+
}): Promise<{
|
|
16
|
+
count: number;
|
|
17
|
+
ordersInfoData: OrdersInfoData;
|
|
18
|
+
}>;
|
|
19
|
+
createIncreaseOrder({ isLimit, marketAddress, allowedSlippage, collateralTokenAddress, receiveTokenAddress, fromToken, triggerPrice, referralCodeForTxn, increaseAmounts, collateralToken, createSltpEntries, cancelSltpEntries, updateSltpEntries, marketInfo, isLong, indexToken, marketsInfoData, tokensData, }: {
|
|
20
|
+
marketsInfoData: MarketsInfoData;
|
|
21
|
+
tokensData: TokensData;
|
|
22
|
+
isLimit: boolean;
|
|
23
|
+
marketAddress: string;
|
|
24
|
+
fromToken: TokenData;
|
|
25
|
+
allowedSlippage: number;
|
|
26
|
+
collateralToken: TokenData;
|
|
27
|
+
referralCodeForTxn?: string;
|
|
28
|
+
triggerPrice?: bigint;
|
|
29
|
+
collateralTokenAddress: string;
|
|
30
|
+
receiveTokenAddress: string;
|
|
31
|
+
isLong: boolean;
|
|
32
|
+
createSltpEntries?: SidecarSlTpOrderEntryValid[];
|
|
33
|
+
cancelSltpEntries?: (SidecarSlTpOrderEntryValid | SidecarLimitOrderEntryValid)[];
|
|
34
|
+
updateSltpEntries?: (SidecarSlTpOrderEntryValid | SidecarLimitOrderEntryValid)[];
|
|
35
|
+
marketInfo: MarketInfo;
|
|
36
|
+
indexToken: TokenData;
|
|
37
|
+
increaseAmounts: IncreasePositionAmounts;
|
|
38
|
+
}): Promise<void>;
|
|
39
|
+
createDecreaseOrder({ marketsInfoData, tokensData, marketInfo, decreaseAmounts, collateralToken, allowedSlippage, isLong, referralCode, }: {
|
|
40
|
+
marketInfo: MarketInfo;
|
|
41
|
+
marketsInfoData: MarketsInfoData;
|
|
42
|
+
tokensData: TokensData;
|
|
43
|
+
isLong: boolean;
|
|
44
|
+
allowedSlippage: number;
|
|
45
|
+
decreaseAmounts: DecreasePositionAmounts;
|
|
46
|
+
collateralToken: TokenData;
|
|
47
|
+
referralCode?: string;
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
createSwapOrder({ isLimit, swapAmounts, allowedSlippage, fromToken, toToken, referralCodeForTxn, tokensData, }: {
|
|
50
|
+
isLimit: boolean;
|
|
51
|
+
allowedSlippage: number;
|
|
52
|
+
swapAmounts: SwapAmounts;
|
|
53
|
+
fromToken: TokenData;
|
|
54
|
+
referralCodeForTxn?: string;
|
|
55
|
+
toToken: TokenData;
|
|
56
|
+
tokensData: TokensData;
|
|
57
|
+
}): Promise<void>;
|
|
58
|
+
cancelOrders(orderKeys: string[]): Promise<`0x${string}`>;
|
|
59
|
+
createWrapOrUnwrapOrder(p: WrapOrUnwrapParams): Promise<`0x${string}`>;
|
|
60
|
+
}
|