@gmx-io/sdk 1.5.0-alpha-4 → 1.5.0-alpha-6
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/build/cjs/scripts/subsquid-codegen.js +1 -1
- package/build/cjs/src/clients/v1/modules/trades/trades.js +2 -5
- package/build/cjs/src/clients/v1/testUtil.js +1 -1
- package/build/cjs/src/clients/v2/index.js +4 -0
- package/build/cjs/src/codegen/subsquid.js +94 -424
- package/build/cjs/src/configs/express.js +8 -3
- package/build/cjs/src/utils/__tests__/orderTransactions/batchUtils.spec.js +45 -0
- package/build/cjs/src/utils/errors/transactionsErrors.js +32 -0
- package/build/cjs/src/utils/fees/priceImpact.js +5 -1
- package/build/cjs/src/utils/gelatoRelay/utils.js +14 -8
- package/build/cjs/src/utils/numbers/utils.js +20 -6
- package/build/cjs/src/utils/orderTransactions/utils.js +6 -3
- package/build/cjs/src/utils/orders/api.js +1 -1
- package/build/cjs/src/utils/positions/api.js +1 -1
- package/build/cjs/src/utils/positions/utils.js +3 -1
- package/build/cjs/src/utils/prices/api.js +14 -0
- package/build/cjs/src/utils/prices/types.js +2 -0
- package/build/cjs/src/utils/tradeHistory/utils.js +2 -2
- package/build/esm/scripts/subsquid-codegen.js +1 -1
- package/build/esm/src/clients/v1/modules/trades/trades.js +2 -5
- package/build/esm/src/clients/v1/testUtil.js +1 -1
- package/build/esm/src/clients/v2/index.js +4 -0
- package/build/esm/src/codegen/subsquid.js +93 -423
- package/build/esm/src/configs/express.js +7 -2
- package/build/esm/src/utils/__tests__/orderTransactions/batchUtils.spec.js +45 -0
- package/build/esm/src/utils/errors/transactionsErrors.js +32 -0
- package/build/esm/src/utils/fees/priceImpact.js +5 -1
- package/build/esm/src/utils/gelatoRelay/utils.js +11 -4
- package/build/esm/src/utils/numbers/utils.js +20 -6
- package/build/esm/src/utils/orderTransactions/utils.js +6 -3
- package/build/esm/src/utils/orders/api.js +1 -1
- package/build/esm/src/utils/positions/api.js +1 -1
- package/build/esm/src/utils/positions/utils.js +3 -1
- package/build/esm/src/utils/prices/api.js +10 -0
- package/build/esm/src/utils/prices/types.js +1 -0
- package/build/esm/src/utils/tradeHistory/utils.js +2 -2
- package/build/types/src/clients/v2/index.d.ts +5 -2
- package/build/types/src/codegen/subsquid.d.ts +392 -587
- package/build/types/src/configs/express.d.ts +3 -2
- package/build/types/src/utils/errors/transactionsErrors.d.ts +33 -1
- package/build/types/src/utils/gelatoRelay/utils.d.ts +4 -2
- package/build/types/src/utils/numbers/utils.d.ts +2 -1
- package/build/types/src/utils/orderTransactions/utils.d.ts +2 -2
- package/build/types/src/utils/orders/api.d.ts +1 -1
- package/build/types/src/utils/positions/api.d.ts +1 -1
- package/build/types/src/utils/prices/api.d.ts +5 -0
- package/build/types/src/utils/prices/types.d.ts +13 -0
- package/build/types/src/utils/tradeHistory/types.d.ts +2 -6
- package/package.json +8 -2
|
@@ -3,13 +3,18 @@ import { periodToSeconds } from "../utils/time";
|
|
|
3
3
|
import { ARBITRUM, ARBITRUM_SEPOLIA, AVALANCHE, AVALANCHE_FUJI, BOTANIX } from "./chains";
|
|
4
4
|
import { getTokenBySymbol, getWrappedToken } from "./tokens";
|
|
5
5
|
export const SUBACCOUNT_MESSAGE = "Generate a GMX 1CT (One-Click Trading) session. Only sign this message on a trusted website.";
|
|
6
|
-
export const SUBACCOUNT_DOCS_URL = "https://docs.gmx.io/docs/trading/#one-click-trading";
|
|
6
|
+
export const SUBACCOUNT_DOCS_URL = "https://docs.gmx.io/docs/trading/overview/#express-trading-and-one-click-trading";
|
|
7
7
|
export const DEFAULT_SUBACCOUNT_EXPIRY_DURATION = periodToSeconds(7, "1d"); // 1 week
|
|
8
8
|
export const DEFAULT_SUBACCOUNT_MAX_ALLOWED_COUNT = 90;
|
|
9
9
|
export const DEFAULT_PERMIT_DEADLINE_DURATION = periodToSeconds(1, "1h");
|
|
10
10
|
export const DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION = periodToSeconds(1, "1h");
|
|
11
|
-
export const MIN_GELATO_USD_BALANCE_FOR_SPONSORED_CALL = expandDecimals(100, USD_DECIMALS); // 100$
|
|
12
11
|
export const MIN_RELAYER_FEE_USD = 5n ** BigInt(USD_DECIMALS - 1); // 0.5$
|
|
12
|
+
export const GELATO_API_KEYS = {
|
|
13
|
+
[ARBITRUM]: "6dE6kOa9pc1ap4dQQC2iaK9i6nBFp8eYxQlm00VreWc_",
|
|
14
|
+
[AVALANCHE]: "FalsQh9loL6V0rwPy4gWgnQPR6uTHfWjSVT2qlTzUq4_",
|
|
15
|
+
[BOTANIX]: "s5GgkfX7dvd_2uYqsRSCjzMekUrXh0dibUvfLab1Anc_",
|
|
16
|
+
[ARBITRUM_SEPOLIA]: "nx5nyAg4h2kI_64YtOuPt7LSPDEXo4u8eJY_idF9xDw_",
|
|
17
|
+
};
|
|
13
18
|
export const EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = 1000;
|
|
14
19
|
export const EXPRESS_DEFAULT_MIN_RESIDUAL_USD_NUMBER = 20;
|
|
15
20
|
export const EXPRESS_DEFAULT_MIN_RESIDUAL_USD = expandDecimals(EXPRESS_DEFAULT_MIN_RESIDUAL_USD_NUMBER, USD_DECIMALS);
|
|
@@ -175,6 +175,51 @@ describe("Batch Utils", () => {
|
|
|
175
175
|
});
|
|
176
176
|
});
|
|
177
177
|
describe("getBatchTotalExecutionFee", () => {
|
|
178
|
+
it("returns undefined for empty batch", () => {
|
|
179
|
+
const tokensData = {
|
|
180
|
+
[WETH.address]: {
|
|
181
|
+
...WETH,
|
|
182
|
+
prices: {
|
|
183
|
+
minPrice: expandDecimals(2000, USD_DECIMALS),
|
|
184
|
+
maxPrice: expandDecimals(2000, USD_DECIMALS),
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
const result = getBatchTotalExecutionFee({
|
|
189
|
+
batchParams: { createOrderParams: [], updateOrderParams: [], cancelOrderParams: [] },
|
|
190
|
+
tokensData,
|
|
191
|
+
chainId: CHAIN_ID,
|
|
192
|
+
});
|
|
193
|
+
expect(result).toBeUndefined();
|
|
194
|
+
});
|
|
195
|
+
it("returns valid ExecutionFee with zero amounts for cancel-only batch", () => {
|
|
196
|
+
const tokensData = {
|
|
197
|
+
[WETH.address]: {
|
|
198
|
+
...WETH,
|
|
199
|
+
prices: {
|
|
200
|
+
minPrice: expandDecimals(2000, USD_DECIMALS),
|
|
201
|
+
maxPrice: expandDecimals(2000, USD_DECIMALS),
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
const result = getBatchTotalExecutionFee({
|
|
206
|
+
batchParams: {
|
|
207
|
+
createOrderParams: [],
|
|
208
|
+
updateOrderParams: [],
|
|
209
|
+
cancelOrderParams: [{ orderKey: "0x123" }],
|
|
210
|
+
},
|
|
211
|
+
tokensData,
|
|
212
|
+
chainId: CHAIN_ID,
|
|
213
|
+
});
|
|
214
|
+
expect(result).toEqual({
|
|
215
|
+
feeTokenAmount: 0n,
|
|
216
|
+
gasLimit: 0n,
|
|
217
|
+
feeUsd: 0n,
|
|
218
|
+
feeToken: tokensData[WETH.address],
|
|
219
|
+
isFeeHigh: false,
|
|
220
|
+
isFeeVeryHigh: false,
|
|
221
|
+
});
|
|
222
|
+
});
|
|
178
223
|
it("calculates total execution fee including top-ups", () => {
|
|
179
224
|
const params5 = {
|
|
180
225
|
...commonMarketIncreaseParams,
|
|
@@ -59,10 +59,42 @@ const TX_ERROR_PATTERNS = {
|
|
|
59
59
|
};
|
|
60
60
|
export var CustomErrorName;
|
|
61
61
|
(function (CustomErrorName) {
|
|
62
|
+
CustomErrorName["DisabledMarket"] = "DisabledMarket";
|
|
62
63
|
CustomErrorName["EndOfOracleSimulation"] = "EndOfOracleSimulation";
|
|
64
|
+
CustomErrorName["ExternalCallFailed"] = "ExternalCallFailed";
|
|
65
|
+
CustomErrorName["InsufficientCollateralAmount"] = "InsufficientCollateralAmount";
|
|
66
|
+
CustomErrorName["InsufficientCollateralUsd"] = "InsufficientCollateralUsd";
|
|
67
|
+
CustomErrorName["InsufficientExecutionGas"] = "InsufficientExecutionGas";
|
|
63
68
|
CustomErrorName["InsufficientExecutionFee"] = "InsufficientExecutionFee";
|
|
69
|
+
CustomErrorName["InsufficientFundsToPayForCosts"] = "InsufficientFundsToPayForCosts";
|
|
70
|
+
CustomErrorName["InsufficientOutputAmount"] = "InsufficientOutputAmount";
|
|
71
|
+
CustomErrorName["InsufficientPoolAmount"] = "InsufficientPoolAmount";
|
|
72
|
+
CustomErrorName["InsufficientReserve"] = "InsufficientReserve";
|
|
73
|
+
CustomErrorName["InsufficientReserveForOpenInterest"] = "InsufficientReserveForOpenInterest";
|
|
64
74
|
CustomErrorName["OrderNotFulfillableAtAcceptablePrice"] = "OrderNotFulfillableAtAcceptablePrice";
|
|
65
75
|
CustomErrorName["InsufficientSwapOutputAmount"] = "InsufficientSwapOutputAmount";
|
|
76
|
+
CustomErrorName["InvalidCollateralTokenForMarket"] = "InvalidCollateralTokenForMarket";
|
|
77
|
+
CustomErrorName["InvalidDecreaseOrderSize"] = "InvalidDecreaseOrderSize";
|
|
78
|
+
CustomErrorName["InvalidOraclePrice"] = "InvalidOraclePrice";
|
|
79
|
+
CustomErrorName["LiquidatablePosition"] = "LiquidatablePosition";
|
|
80
|
+
CustomErrorName["MarketNotFound"] = "MarketNotFound";
|
|
81
|
+
CustomErrorName["MaxOpenInterestExceeded"] = "MaxOpenInterestExceeded";
|
|
82
|
+
CustomErrorName["MaxPoolAmountExceeded"] = "MaxPoolAmountExceeded";
|
|
83
|
+
CustomErrorName["MaxPoolUsdForDepositExceeded"] = "MaxPoolUsdForDepositExceeded";
|
|
84
|
+
CustomErrorName["MaxPriceAgeExceeded"] = "MaxPriceAgeExceeded";
|
|
85
|
+
CustomErrorName["MinPositionSize"] = "MinPositionSize";
|
|
86
|
+
CustomErrorName["NegativeExecutionPrice"] = "NegativeExecutionPrice";
|
|
87
|
+
CustomErrorName["OrderNotFound"] = "OrderNotFound";
|
|
88
|
+
CustomErrorName["OrderNotUpdatable"] = "OrderNotUpdatable";
|
|
89
|
+
CustomErrorName["OrderTypeCannotBeCreated"] = "OrderTypeCannotBeCreated";
|
|
90
|
+
CustomErrorName["PnlFactorExceededForLongs"] = "PnlFactorExceededForLongs";
|
|
91
|
+
CustomErrorName["PnlFactorExceededForShorts"] = "PnlFactorExceededForShorts";
|
|
92
|
+
CustomErrorName["PriceImpactLargerThanOrderSize"] = "PriceImpactLargerThanOrderSize";
|
|
93
|
+
CustomErrorName["SwapPriceImpactExceedsAmountIn"] = "SwapPriceImpactExceedsAmountIn";
|
|
94
|
+
CustomErrorName["UnableToWithdrawCollateral"] = "UnableToWithdrawCollateral";
|
|
95
|
+
CustomErrorName["UsdDeltaExceedsLongOpenInterest"] = "UsdDeltaExceedsLongOpenInterest";
|
|
96
|
+
CustomErrorName["UsdDeltaExceedsPoolValue"] = "UsdDeltaExceedsPoolValue";
|
|
97
|
+
CustomErrorName["UsdDeltaExceedsShortOpenInterest"] = "UsdDeltaExceedsShortOpenInterest";
|
|
66
98
|
})(CustomErrorName || (CustomErrorName = {}));
|
|
67
99
|
export function getIsUserRejectedError(errorType) {
|
|
68
100
|
return errorType === TxErrorType.UserDenied;
|
|
@@ -342,7 +342,11 @@ export function applyImpactFactor(diff, factor, exponent) {
|
|
|
342
342
|
const _diff = Number(diff) / 10 ** 30;
|
|
343
343
|
const _exponent = Number(exponent) / 10 ** 30;
|
|
344
344
|
// Pow and convert back to BigInt with 30 decimals
|
|
345
|
-
|
|
345
|
+
const powered = _diff ** _exponent * 10 ** 30;
|
|
346
|
+
if (!isFinite(powered) || isNaN(powered)) {
|
|
347
|
+
return 0n;
|
|
348
|
+
}
|
|
349
|
+
let result = bigNumberify(BigInt(Math.round(powered)));
|
|
346
350
|
result = (result * factor) / expandDecimals(1, 30);
|
|
347
351
|
return result;
|
|
348
352
|
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { createGelatoEvmRelayerClient } from "@gelatocloud/gasless";
|
|
2
|
+
export { StatusCode } from "@gelatocloud/gasless";
|
|
3
|
+
let _relayerClients = new Map();
|
|
4
|
+
export function getGelatoRelayerClient(apiKey) {
|
|
5
|
+
let client = _relayerClients.get(apiKey);
|
|
6
|
+
if (!client) {
|
|
7
|
+
client = createGelatoEvmRelayerClient({ apiKey });
|
|
8
|
+
_relayerClients.set(apiKey, client);
|
|
9
|
+
}
|
|
10
|
+
return client;
|
|
11
|
+
}
|
|
@@ -100,7 +100,7 @@ export function bigintToNumber(value, decimals) {
|
|
|
100
100
|
const negative = value < 0;
|
|
101
101
|
if (negative)
|
|
102
102
|
value *= -1n;
|
|
103
|
-
const precision =
|
|
103
|
+
const precision = expandDecimals(1, decimals);
|
|
104
104
|
const int = value / precision;
|
|
105
105
|
const frac = value % precision;
|
|
106
106
|
const num = parseFloat(`${int}.${frac.toString().padStart(decimals, "0")}`);
|
|
@@ -145,7 +145,7 @@ export function formatDeltaUsd(deltaUsd, percentage, opts = {}) {
|
|
|
145
145
|
}
|
|
146
146
|
const sign = getPlusOrMinusSymbol(deltaUsd, { showPlusForZero: opts.showPlusForZero });
|
|
147
147
|
const exceedingInfo = getLimitedDisplay(deltaUsd, USD_DECIMALS);
|
|
148
|
-
const percentageStr = percentage !== undefined ? ` (${sign}${formatPercentage(bigMath.abs(percentage))})` : "";
|
|
148
|
+
const percentageStr = percentage !== undefined && !opts.hidePercentage ? ` (${sign}${formatPercentage(bigMath.abs(percentage))})` : "";
|
|
149
149
|
const deltaUsdStr = formatAmount(exceedingInfo.value, USD_DECIMALS, 2, true);
|
|
150
150
|
const symbol = exceedingInfo.symbol ? `${exceedingInfo.symbol} ` : "";
|
|
151
151
|
return `${symbol}${sign}$\u200a${deltaUsdStr}${percentageStr}`;
|
|
@@ -368,12 +368,15 @@ export const formatArrayAmount = (arr, index, tokenDecimals, displayDecimals, us
|
|
|
368
368
|
}
|
|
369
369
|
return formatAmount(arr[index], tokenDecimals, displayDecimals, useCommas);
|
|
370
370
|
};
|
|
371
|
-
export const formatAmountFree = (amount, tokenDecimals, displayDecimals) => {
|
|
371
|
+
export const formatAmountFree = (amount, tokenDecimals, displayDecimals, visualMultiplier) => {
|
|
372
372
|
if (amount === undefined || amount === null) {
|
|
373
373
|
return "...";
|
|
374
374
|
}
|
|
375
|
-
|
|
376
|
-
|
|
375
|
+
let amountBigInt = BigInt(amount);
|
|
376
|
+
if (visualMultiplier) {
|
|
377
|
+
amountBigInt = amountBigInt / BigInt(visualMultiplier);
|
|
378
|
+
}
|
|
379
|
+
let amountStr = formatUnits(amountBigInt, tokenDecimals);
|
|
377
380
|
amountStr = limitDecimals(amountStr, displayDecimals);
|
|
378
381
|
return trimZeroDecimals(amountStr);
|
|
379
382
|
};
|
|
@@ -397,6 +400,12 @@ export function getLimitedDisplay(amount, tokenDecimals, opts = {}) {
|
|
|
397
400
|
}
|
|
398
401
|
export const limitDecimals = (amount, maxDecimals) => {
|
|
399
402
|
let amountStr = amount.toString();
|
|
403
|
+
if (amountStr.includes("e") || amountStr.includes("E")) {
|
|
404
|
+
const num = Number(amountStr);
|
|
405
|
+
if (!isNaN(num)) {
|
|
406
|
+
amountStr = num.toFixed(20).replace(/\.?0+$/, "");
|
|
407
|
+
}
|
|
408
|
+
}
|
|
400
409
|
if (maxDecimals === undefined) {
|
|
401
410
|
return amountStr;
|
|
402
411
|
}
|
|
@@ -495,11 +504,16 @@ export function bigNumberify(n) {
|
|
|
495
504
|
}
|
|
496
505
|
export const parseValue = (value, tokenDecimals) => {
|
|
497
506
|
const pValue = parseFloat(value);
|
|
498
|
-
if (isNaN(pValue)) {
|
|
507
|
+
if (isNaN(pValue) || !isFinite(pValue)) {
|
|
499
508
|
return undefined;
|
|
500
509
|
}
|
|
501
510
|
value = limitDecimals(value, tokenDecimals);
|
|
502
511
|
const amount = parseUnits(value, tokenDecimals);
|
|
512
|
+
// Cap at a safe maximum to prevent downstream BigInt overflow errors
|
|
513
|
+
const MAX_ALLOWED = expandDecimals(1, 62);
|
|
514
|
+
if (amount > MAX_ALLOWED || amount < -MAX_ALLOWED) {
|
|
515
|
+
return undefined;
|
|
516
|
+
}
|
|
503
517
|
return bigNumberify(amount);
|
|
504
518
|
};
|
|
505
519
|
export function roundUpDivision(a, b) {
|
|
@@ -271,18 +271,21 @@ export function buildUpdateOrderPayload(p) {
|
|
|
271
271
|
},
|
|
272
272
|
};
|
|
273
273
|
}
|
|
274
|
-
export function getBatchTotalExecutionFee({ batchParams
|
|
274
|
+
export function getBatchTotalExecutionFee({ batchParams, tokensData, chainId, }) {
|
|
275
|
+
if (getIsEmptyBatch(batchParams)) {
|
|
276
|
+
return undefined;
|
|
277
|
+
}
|
|
275
278
|
let feeTokenAmount = 0n;
|
|
276
279
|
let gasLimit = 0n;
|
|
277
280
|
const wnt = getByKey(tokensData, getWrappedToken(chainId).address);
|
|
278
281
|
if (!wnt) {
|
|
279
282
|
return undefined;
|
|
280
283
|
}
|
|
281
|
-
for (const co of createOrderParams) {
|
|
284
|
+
for (const co of batchParams.createOrderParams) {
|
|
282
285
|
feeTokenAmount += co.orderPayload.numbers.executionFee;
|
|
283
286
|
gasLimit += co.params.executionGasLimit;
|
|
284
287
|
}
|
|
285
|
-
for (const uo of updateOrderParams) {
|
|
288
|
+
for (const uo of batchParams.updateOrderParams) {
|
|
286
289
|
feeTokenAmount += uo.updatePayload.executionFeeTopUp;
|
|
287
290
|
}
|
|
288
291
|
const feeUsd = convertToUsd(feeTokenAmount, wnt.decimals, wnt.prices.maxPrice);
|
|
@@ -2,7 +2,7 @@ import { deserializeBigIntsInObject } from "../numbers";
|
|
|
2
2
|
export async function fetchApiOrders(ctx, params) {
|
|
3
3
|
const orders = await ctx.api.fetchJson("/orders", {
|
|
4
4
|
query: {
|
|
5
|
-
|
|
5
|
+
address: params.address,
|
|
6
6
|
},
|
|
7
7
|
});
|
|
8
8
|
return orders.map((o) => deserializeBigIntsInObject(o, { handleInts: true }));
|
|
@@ -2,7 +2,7 @@ import { deserializeBigIntsInObject } from "../numbers";
|
|
|
2
2
|
export async function fetchApiPositionsInfo(ctx, params) {
|
|
3
3
|
const positions = await ctx.api.fetchJson("/positions", {
|
|
4
4
|
query: {
|
|
5
|
-
|
|
5
|
+
address: params.address,
|
|
6
6
|
includeRelatedOrders: params.includeRelatedOrders || undefined,
|
|
7
7
|
},
|
|
8
8
|
});
|
|
@@ -235,7 +235,9 @@ export function getContractPositionDynamicFees({ position, marketInfo, marketFee
|
|
|
235
235
|
}
|
|
236
236
|
const claimableLongTokenAmount = getFundingAmount(latestLongTokenClaimableFundingAmountPerSize, position.longTokenClaimableFundingAmountPerSize, sizeInUsd);
|
|
237
237
|
const claimableShortTokenAmount = getFundingAmount(latestShortTokenClaimableFundingAmountPerSize, position.shortTokenClaimableFundingAmountPerSize, sizeInUsd);
|
|
238
|
-
const { balanceWasImproved } = getPriceImpactForPosition(marketInfo, -sizeInUsd, isLong
|
|
238
|
+
const { balanceWasImproved } = getPriceImpactForPosition(marketInfo, -sizeInUsd, isLong, {
|
|
239
|
+
fallbackToZero: true,
|
|
240
|
+
});
|
|
239
241
|
const { positionFeeUsd, discountUsd, uiFeeUsd } = getPositionFee(marketInfo, sizeInUsd, balanceWasImproved, referralInfo);
|
|
240
242
|
const positionFeeAmount = convertToTokenAmount(positionFeeUsd, collateralToken.decimals, collateralMinPrice) ?? 0n;
|
|
241
243
|
const traderDiscountAmount = convertToTokenAmount(discountUsd, collateralToken.decimals, collateralMinPrice) ?? 0n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -39,7 +39,7 @@ export function createRawTradeActionTransformer(marketsInfoData, wrappedToken, t
|
|
|
39
39
|
targetCollateralToken,
|
|
40
40
|
initialCollateralToken,
|
|
41
41
|
timestamp: rawAction.timestamp,
|
|
42
|
-
|
|
42
|
+
transactionHash: rawAction.transactionHash,
|
|
43
43
|
reason: rawAction.reason ?? undefined,
|
|
44
44
|
reasonBytes: rawAction.reasonBytes ?? undefined,
|
|
45
45
|
twapParams: rawAction.twapGroupId && rawAction.numberOfParts
|
|
@@ -120,7 +120,7 @@ export function createRawTradeActionTransformer(marketsInfoData, wrappedToken, t
|
|
|
120
120
|
liquidationFeeAmount: rawAction.liquidationFeeAmount ? BigInt(rawAction.liquidationFeeAmount) : undefined,
|
|
121
121
|
reason: rawAction.reason ?? undefined,
|
|
122
122
|
reasonBytes: rawAction.reasonBytes ?? undefined,
|
|
123
|
-
|
|
123
|
+
transactionHash: rawAction.transactionHash,
|
|
124
124
|
timestamp: rawAction.timestamp,
|
|
125
125
|
shouldUnwrapNativeToken: rawAction.shouldUnwrapNativeToken,
|
|
126
126
|
twapParams: rawAction.twapGroupId && rawAction.numberOfParts
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ContractsChainId } from "../../configs/chains";
|
|
2
2
|
import { IHttp } from "../../utils/http/types";
|
|
3
|
+
import type { OhlcvParams } from "../../utils/prices/types";
|
|
4
|
+
export type { OhlcvCandle, OhlcvParams } from "../../utils/prices/types";
|
|
3
5
|
export declare class GmxApiSdk {
|
|
4
6
|
ctx: {
|
|
5
7
|
chainId: ContractsChainId;
|
|
@@ -11,10 +13,11 @@ export declare class GmxApiSdk {
|
|
|
11
13
|
fetchMarketsInfo(): Promise<import("../../utils/markets").RawMarketInfo[]>;
|
|
12
14
|
fetchTokensData(): Promise<import("../../utils/tokens").TokenData[]>;
|
|
13
15
|
fetchPositionsInfo(params: {
|
|
14
|
-
|
|
16
|
+
address: string;
|
|
15
17
|
includeRelatedOrders?: boolean;
|
|
16
18
|
}): Promise<import("../../utils/positions").ApiPositionInfo[]>;
|
|
17
19
|
fetchOrders(params: {
|
|
18
|
-
|
|
20
|
+
address: string;
|
|
19
21
|
}): Promise<import("../../utils/orders").ApiOrderInfo[]>;
|
|
22
|
+
fetchOhlcv(params: OhlcvParams): Promise<import("../../utils/prices/types").OhlcvCandle[]>;
|
|
20
23
|
}
|