@gmx-io/sdk 1.5.0-alpha-3 → 1.5.0-alpha-5
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/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +16 -0
- package/build/cjs/src/codegen/prebuilt/hashedMarketConfigKeys.json +114 -0
- package/build/cjs/src/codegen/prebuilt/hashedMarketValuesKeys.json +30 -0
- package/build/cjs/src/codegen/subsquid.js +94 -424
- package/build/cjs/src/configs/express.js +7 -2
- package/build/cjs/src/configs/markets.js +14 -0
- package/build/cjs/src/configs/tokens.js +22 -0
- package/build/cjs/src/utils/__tests__/numbers.spec.js +19 -0
- 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 +45 -8
- package/build/cjs/src/utils/orderTransactions/utils.js +6 -3
- package/build/cjs/src/utils/positions/utils.js +3 -1
- 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/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +16 -0
- package/build/esm/src/codegen/prebuilt/hashedMarketConfigKeys.json +114 -0
- package/build/esm/src/codegen/prebuilt/hashedMarketValuesKeys.json +30 -0
- package/build/esm/src/codegen/subsquid.js +93 -423
- package/build/esm/src/configs/express.js +6 -1
- package/build/esm/src/configs/markets.js +14 -0
- package/build/esm/src/configs/tokens.js +22 -0
- package/build/esm/src/utils/__tests__/numbers.spec.js +20 -1
- 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 +45 -8
- package/build/esm/src/utils/orderTransactions/utils.js +6 -3
- package/build/esm/src/utils/positions/utils.js +3 -1
- package/build/esm/src/utils/tradeHistory/utils.js +2 -2
- package/build/types/src/codegen/prebuilt/index.d.ts +160 -0
- package/build/types/src/codegen/subsquid.d.ts +392 -587
- package/build/types/src/configs/express.d.ts +2 -1
- 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/tradeHistory/types.d.ts +2 -6
- package/package.json +2 -2
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Token } from "../utils/tokens/types";
|
|
2
|
+
import { ContractsChainId } from "./chains";
|
|
2
3
|
export declare const SUBACCOUNT_MESSAGE = "Generate a GMX 1CT (One-Click Trading) session. Only sign this message on a trusted website.";
|
|
3
4
|
export declare const SUBACCOUNT_DOCS_URL = "https://docs.gmx.io/docs/trading/#one-click-trading";
|
|
4
5
|
export declare const DEFAULT_SUBACCOUNT_EXPIRY_DURATION: number;
|
|
5
6
|
export declare const DEFAULT_SUBACCOUNT_MAX_ALLOWED_COUNT = 90;
|
|
6
7
|
export declare const DEFAULT_PERMIT_DEADLINE_DURATION: number;
|
|
7
8
|
export declare const DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION: number;
|
|
8
|
-
export declare const MIN_GELATO_USD_BALANCE_FOR_SPONSORED_CALL: bigint;
|
|
9
9
|
export declare const MIN_RELAYER_FEE_USD: bigint;
|
|
10
|
+
export declare const GELATO_API_KEYS: Partial<Record<ContractsChainId, string>>;
|
|
10
11
|
export declare const EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = 1000;
|
|
11
12
|
export declare const EXPRESS_DEFAULT_MIN_RESIDUAL_USD_NUMBER = 20;
|
|
12
13
|
export declare const EXPRESS_DEFAULT_MIN_RESIDUAL_USD: bigint;
|
|
@@ -11,10 +11,42 @@ export type ErrorPattern = {
|
|
|
11
11
|
code?: number;
|
|
12
12
|
};
|
|
13
13
|
export declare enum CustomErrorName {
|
|
14
|
+
DisabledMarket = "DisabledMarket",
|
|
14
15
|
EndOfOracleSimulation = "EndOfOracleSimulation",
|
|
16
|
+
ExternalCallFailed = "ExternalCallFailed",
|
|
17
|
+
InsufficientCollateralAmount = "InsufficientCollateralAmount",
|
|
18
|
+
InsufficientCollateralUsd = "InsufficientCollateralUsd",
|
|
19
|
+
InsufficientExecutionGas = "InsufficientExecutionGas",
|
|
15
20
|
InsufficientExecutionFee = "InsufficientExecutionFee",
|
|
21
|
+
InsufficientFundsToPayForCosts = "InsufficientFundsToPayForCosts",
|
|
22
|
+
InsufficientOutputAmount = "InsufficientOutputAmount",
|
|
23
|
+
InsufficientPoolAmount = "InsufficientPoolAmount",
|
|
24
|
+
InsufficientReserve = "InsufficientReserve",
|
|
25
|
+
InsufficientReserveForOpenInterest = "InsufficientReserveForOpenInterest",
|
|
16
26
|
OrderNotFulfillableAtAcceptablePrice = "OrderNotFulfillableAtAcceptablePrice",
|
|
17
|
-
InsufficientSwapOutputAmount = "InsufficientSwapOutputAmount"
|
|
27
|
+
InsufficientSwapOutputAmount = "InsufficientSwapOutputAmount",
|
|
28
|
+
InvalidCollateralTokenForMarket = "InvalidCollateralTokenForMarket",
|
|
29
|
+
InvalidDecreaseOrderSize = "InvalidDecreaseOrderSize",
|
|
30
|
+
InvalidOraclePrice = "InvalidOraclePrice",
|
|
31
|
+
LiquidatablePosition = "LiquidatablePosition",
|
|
32
|
+
MarketNotFound = "MarketNotFound",
|
|
33
|
+
MaxOpenInterestExceeded = "MaxOpenInterestExceeded",
|
|
34
|
+
MaxPoolAmountExceeded = "MaxPoolAmountExceeded",
|
|
35
|
+
MaxPoolUsdForDepositExceeded = "MaxPoolUsdForDepositExceeded",
|
|
36
|
+
MaxPriceAgeExceeded = "MaxPriceAgeExceeded",
|
|
37
|
+
MinPositionSize = "MinPositionSize",
|
|
38
|
+
NegativeExecutionPrice = "NegativeExecutionPrice",
|
|
39
|
+
OrderNotFound = "OrderNotFound",
|
|
40
|
+
OrderNotUpdatable = "OrderNotUpdatable",
|
|
41
|
+
OrderTypeCannotBeCreated = "OrderTypeCannotBeCreated",
|
|
42
|
+
PnlFactorExceededForLongs = "PnlFactorExceededForLongs",
|
|
43
|
+
PnlFactorExceededForShorts = "PnlFactorExceededForShorts",
|
|
44
|
+
PriceImpactLargerThanOrderSize = "PriceImpactLargerThanOrderSize",
|
|
45
|
+
SwapPriceImpactExceedsAmountIn = "SwapPriceImpactExceedsAmountIn",
|
|
46
|
+
UnableToWithdrawCollateral = "UnableToWithdrawCollateral",
|
|
47
|
+
UsdDeltaExceedsLongOpenInterest = "UsdDeltaExceedsLongOpenInterest",
|
|
48
|
+
UsdDeltaExceedsPoolValue = "UsdDeltaExceedsPoolValue",
|
|
49
|
+
UsdDeltaExceedsShortOpenInterest = "UsdDeltaExceedsShortOpenInterest"
|
|
18
50
|
}
|
|
19
51
|
export declare function getIsUserRejectedError(errorType: TxErrorType): boolean;
|
|
20
52
|
export declare function getIsUserError(errorType: TxErrorType): boolean;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
1
|
+
import { type GelatoEvmRelayerClient } from "@gelatocloud/gasless";
|
|
2
|
+
export { StatusCode } from "@gelatocloud/gasless";
|
|
3
|
+
export type { TerminalStatus, Status, GelatoEvmRelayerClient } from "@gelatocloud/gasless";
|
|
4
|
+
export declare function getGelatoRelayerClient(apiKey: string): GelatoEvmRelayerClient;
|
|
@@ -45,6 +45,7 @@ export declare function formatBigUsd(amount: bigint, opts?: {
|
|
|
45
45
|
export declare function formatDeltaUsd(deltaUsd?: bigint, percentage?: bigint, opts?: {
|
|
46
46
|
fallbackToZero?: boolean;
|
|
47
47
|
showPlusForZero?: boolean;
|
|
48
|
+
hidePercentage?: boolean;
|
|
48
49
|
}): string | undefined;
|
|
49
50
|
export declare function formatPercentage(percentage?: bigint, opts?: {
|
|
50
51
|
fallbackToZero?: boolean;
|
|
@@ -93,7 +94,7 @@ export declare function numberWithCommas(x: BigNumberish, { showDollar }?: {
|
|
|
93
94
|
export declare const formatAmount: (amount: BigNumberish | undefined, tokenDecimals: number, displayDecimals?: number, useCommas?: boolean, defaultValue?: string, visualMultiplier?: number) => string;
|
|
94
95
|
export declare const formatKeyAmount: <T extends {}>(map: T | undefined, key: keyof T, tokenDecimals: number, displayDecimals: number, useCommas?: boolean) => string;
|
|
95
96
|
export declare const formatArrayAmount: (arr: any[], index: number, tokenDecimals: number, displayDecimals?: number, useCommas?: boolean) => string;
|
|
96
|
-
export declare const formatAmountFree: (amount: BigNumberish, tokenDecimals: number, displayDecimals?: number) => string;
|
|
97
|
+
export declare const formatAmountFree: (amount: BigNumberish, tokenDecimals: number, displayDecimals?: number, visualMultiplier?: number) => string;
|
|
97
98
|
export declare function getLimitedDisplay(amount: bigint, tokenDecimals: number, opts?: {
|
|
98
99
|
maxThreshold?: BigNumberish | null;
|
|
99
100
|
minThreshold?: BigNumberish;
|
|
@@ -9,7 +9,7 @@ export type ExchangeRouterCall = {
|
|
|
9
9
|
params: any[];
|
|
10
10
|
};
|
|
11
11
|
export type BatchOrderTxnParams = {
|
|
12
|
-
createOrderParams: CreateOrderTxnParams<
|
|
12
|
+
createOrderParams: CreateOrderTxnParams<SwapOrderParams | IncreasePositionOrderParams | DecreasePositionOrderParams>[];
|
|
13
13
|
updateOrderParams: UpdateOrderTxnParams[];
|
|
14
14
|
cancelOrderParams: CancelOrderTxnParams[];
|
|
15
15
|
};
|
|
@@ -162,7 +162,7 @@ export declare function buildDecreaseOrderPayload(p: DecreasePositionOrderParams
|
|
|
162
162
|
export declare function buildTwapOrdersPayloads<T extends SwapOrderParams | IncreasePositionOrderParams | DecreasePositionOrderParams>(p: T, twapParams: TwapOrderParams): CreateOrderTxnParams<T>[];
|
|
163
163
|
export declare function getIsTwapOrderPayload(p: CreateOrderPayload): boolean;
|
|
164
164
|
export declare function buildUpdateOrderPayload(p: UpdateOrderParams): UpdateOrderTxnParams;
|
|
165
|
-
export declare function getBatchTotalExecutionFee({ batchParams
|
|
165
|
+
export declare function getBatchTotalExecutionFee({ batchParams, tokensData, chainId, }: {
|
|
166
166
|
batchParams: BatchOrderTxnParams;
|
|
167
167
|
tokensData: TokensData;
|
|
168
168
|
chainId: number;
|
|
@@ -52,9 +52,7 @@ export type PositionTradeAction = {
|
|
|
52
52
|
numberOfParts: number;
|
|
53
53
|
} | undefined;
|
|
54
54
|
timestamp: number;
|
|
55
|
-
|
|
56
|
-
hash: string;
|
|
57
|
-
};
|
|
55
|
+
transactionHash: string;
|
|
58
56
|
};
|
|
59
57
|
export type SwapTradeAction = {
|
|
60
58
|
type: "swap";
|
|
@@ -79,9 +77,7 @@ export type SwapTradeAction = {
|
|
|
79
77
|
numberOfParts: number;
|
|
80
78
|
} | undefined;
|
|
81
79
|
timestamp: number;
|
|
82
|
-
|
|
83
|
-
hash: string;
|
|
84
|
-
};
|
|
80
|
+
transactionHash: string;
|
|
85
81
|
};
|
|
86
82
|
export type TradeAction = PositionTradeAction | SwapTradeAction;
|
|
87
83
|
export declare function isPositionTradeAction(tradeAction: TradeAction): tradeAction is PositionTradeAction;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gmx-io/sdk",
|
|
3
|
-
"version": "1.5.0-alpha-
|
|
3
|
+
"version": "1.5.0-alpha-5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -323,7 +323,7 @@
|
|
|
323
323
|
"node": ">=18.0.0"
|
|
324
324
|
},
|
|
325
325
|
"dependencies": {
|
|
326
|
-
"@
|
|
326
|
+
"@gelatocloud/gasless": "0.0.10",
|
|
327
327
|
"cross-fetch": "4.0.0",
|
|
328
328
|
"crypto-js": "4.2.0",
|
|
329
329
|
"graphql": "15.8.0",
|