@continuumdao/ctm-mpc-defi 0.2.5 → 0.2.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/dist/agent/catalog.cjs +591 -2
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +343 -1
- package/dist/agent/catalog.js +570 -3
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/gmx/SKILL.md +45 -0
- package/dist/protocols/evm/gmx/index.cjs +2251 -0
- package/dist/protocols/evm/gmx/index.cjs.map +1 -0
- package/dist/protocols/evm/gmx/index.d.ts +469 -0
- package/dist/protocols/evm/gmx/index.js +2181 -0
- package/dist/protocols/evm/gmx/index.js.map +1 -0
- package/package.json +7 -1
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
import { b as KeyGenSubsetForPermit, M as MultisignBuildResult, e as ProtocolModule } from '../../../types-BfjWdw1j.js';
|
|
2
|
+
import { Address } from 'viem';
|
|
3
|
+
import { E as EvmChainDetail } from '../../../types-DUeNJLr9.js';
|
|
4
|
+
|
|
5
|
+
/** GMX V2 production chains supported in Continuum multi-sign v1. */
|
|
6
|
+
declare const GMX_SUPPORTED_CHAIN_IDS: readonly [42161, 43114];
|
|
7
|
+
type GmxSupportedChainId = (typeof GMX_SUPPORTED_CHAIN_IDS)[number];
|
|
8
|
+
declare function isGmxChainSupported(chainId: number): chainId is GmxSupportedChainId;
|
|
9
|
+
|
|
10
|
+
type GmxApiSdkInstance = {
|
|
11
|
+
fetchMarkets: () => Promise<GmxMarketRow[]>;
|
|
12
|
+
fetchMarketsTickers: (args?: {
|
|
13
|
+
symbols?: string[];
|
|
14
|
+
}) => Promise<unknown[]>;
|
|
15
|
+
fetchOhlcv: (args: {
|
|
16
|
+
symbol: string;
|
|
17
|
+
timeframe: string;
|
|
18
|
+
limit?: number;
|
|
19
|
+
since?: number;
|
|
20
|
+
}) => Promise<Array<{
|
|
21
|
+
timestamp: number;
|
|
22
|
+
open: string;
|
|
23
|
+
high: string;
|
|
24
|
+
low: string;
|
|
25
|
+
close: string;
|
|
26
|
+
}>>;
|
|
27
|
+
fetchTokens: () => Promise<GmxTokenRow[]>;
|
|
28
|
+
fetchTokensData: () => Promise<unknown[]>;
|
|
29
|
+
fetchPositionsInfo: (args: {
|
|
30
|
+
address: string;
|
|
31
|
+
includeRelatedOrders?: boolean;
|
|
32
|
+
}) => Promise<GmxPositionRow[]>;
|
|
33
|
+
fetchOrders: (args: {
|
|
34
|
+
address: string;
|
|
35
|
+
}) => Promise<GmxOrderRow[]>;
|
|
36
|
+
fetchStakingPower: (args: {
|
|
37
|
+
address: string;
|
|
38
|
+
}) => Promise<Record<string, unknown>>;
|
|
39
|
+
fetchApy: (params?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
40
|
+
prepareOrder: (args: Record<string, unknown>) => Promise<GmxPrepareOrderResponse>;
|
|
41
|
+
prepareCancelOrder: (args: Record<string, unknown>) => Promise<GmxPrepareOrderResponse>;
|
|
42
|
+
};
|
|
43
|
+
type GmxMarketRow = {
|
|
44
|
+
symbol: string;
|
|
45
|
+
marketTokenAddress: string;
|
|
46
|
+
indexTokenAddress?: string;
|
|
47
|
+
longTokenAddress?: string;
|
|
48
|
+
shortTokenAddress?: string;
|
|
49
|
+
isSpotOnly?: boolean;
|
|
50
|
+
isListed?: boolean;
|
|
51
|
+
};
|
|
52
|
+
type GmxTokenRow = {
|
|
53
|
+
symbol: string;
|
|
54
|
+
address: string;
|
|
55
|
+
decimals: number;
|
|
56
|
+
};
|
|
57
|
+
type GmxPositionRow = {
|
|
58
|
+
key?: string;
|
|
59
|
+
indexName?: string;
|
|
60
|
+
isLong?: boolean;
|
|
61
|
+
sizeInUsd?: bigint | string | number;
|
|
62
|
+
collateralUsd?: bigint | string | number;
|
|
63
|
+
marketAddress?: string;
|
|
64
|
+
};
|
|
65
|
+
type GmxOrderRow = {
|
|
66
|
+
key?: string;
|
|
67
|
+
isLong?: boolean;
|
|
68
|
+
sizeDeltaUsd?: bigint | string | number;
|
|
69
|
+
triggerPrice?: bigint | string | number;
|
|
70
|
+
};
|
|
71
|
+
type GmxPrepareOrderResponse = {
|
|
72
|
+
requestId?: string;
|
|
73
|
+
payloadType: 'transaction' | 'typed-data';
|
|
74
|
+
mode: string;
|
|
75
|
+
payload: {
|
|
76
|
+
to?: string;
|
|
77
|
+
data?: string;
|
|
78
|
+
value?: string | bigint | number;
|
|
79
|
+
};
|
|
80
|
+
estimates?: Record<string, unknown>;
|
|
81
|
+
};
|
|
82
|
+
declare function getGmxApiSdk(chainId: number): GmxApiSdkInstance;
|
|
83
|
+
|
|
84
|
+
/** Parse a USD amount to GMX 30-decimal fixed point. */
|
|
85
|
+
declare function parseGmxUsd30(amountHuman: string): bigint;
|
|
86
|
+
declare function parseGmxTokenAmount(amountHuman: string, decimals: number): bigint;
|
|
87
|
+
|
|
88
|
+
type GmxMarketApySource = {
|
|
89
|
+
apy?: number;
|
|
90
|
+
baseApy?: number;
|
|
91
|
+
bonusApr?: number;
|
|
92
|
+
};
|
|
93
|
+
declare function gmxFormatApyPercent(apy: number | null | undefined): string | null;
|
|
94
|
+
declare function gmxLookupMarketApy(apyByMarket: Record<string, GmxMarketApySource>, marketTokenAddress: string): GmxMarketApySource | null;
|
|
95
|
+
declare function gmxEnrichGmMarketRowWithApy<T extends {
|
|
96
|
+
marketTokenAddress: string;
|
|
97
|
+
}>(row: T, apyByMarket: Record<string, GmxMarketApySource>): T & {
|
|
98
|
+
apy: number | null;
|
|
99
|
+
baseApy: number | null;
|
|
100
|
+
bonusApr: number | null;
|
|
101
|
+
apyPercentLabel: string | null;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
declare function gmxFetchMarkets(chainId: number): Promise<GmxMarketRow[]>;
|
|
105
|
+
declare function gmxFetchTokens(chainId: number): Promise<GmxTokenRow[]>;
|
|
106
|
+
declare function gmxResolveTokenBySymbol(chainId: number, symbol: string): Promise<GmxTokenRow>;
|
|
107
|
+
declare function gmxIsCollateralTokenSupported(chainId: number, tokenAddress: string): Promise<boolean>;
|
|
108
|
+
/** Parse collateral pool tokens from e.g. `ETH/USD [WETH-USDC]` → `WETH`, `USDC`. */
|
|
109
|
+
declare function gmxMarketCollateralTokens(marketSymbol: string): string[];
|
|
110
|
+
declare function gmxMarketAcceptsCollateral(marketSymbol: string, collateralSymbol: string): boolean;
|
|
111
|
+
declare function gmxMarketsForCollateralSymbol(chainId: number, collateralSymbol: string): Promise<GmxMarketRow[]>;
|
|
112
|
+
declare function gmxResolveMarketBySymbol(chainId: number, symbol: string): Promise<GmxMarketRow>;
|
|
113
|
+
declare function gmxResolveMarketByGmTokenAddress(chainId: number, gmTokenAddress: string): Promise<GmxMarketRow | null>;
|
|
114
|
+
type GmxGmMarketSummaryRow = {
|
|
115
|
+
symbol: string;
|
|
116
|
+
marketTokenAddress: string;
|
|
117
|
+
longTokenSymbol: string | null;
|
|
118
|
+
shortTokenSymbol: string | null;
|
|
119
|
+
apy: number | null;
|
|
120
|
+
baseApy: number | null;
|
|
121
|
+
bonusApr: number | null;
|
|
122
|
+
apyPercentLabel: string | null;
|
|
123
|
+
};
|
|
124
|
+
declare function gmxFetchGmMarketsSummary(chainId: number): Promise<GmxGmMarketSummaryRow[]>;
|
|
125
|
+
|
|
126
|
+
type GmxPositionDisplayRow = {
|
|
127
|
+
key: string;
|
|
128
|
+
indexName: string;
|
|
129
|
+
isLong: boolean;
|
|
130
|
+
sizeUsd: string | null;
|
|
131
|
+
collateralUsd: string | null;
|
|
132
|
+
collateralSymbol: string | null;
|
|
133
|
+
entryPriceUsd: string | null;
|
|
134
|
+
markPriceUsd: string | null;
|
|
135
|
+
liquidationPriceUsd: string | null;
|
|
136
|
+
leverageLabel: string | null;
|
|
137
|
+
pnlUsd: string | null;
|
|
138
|
+
};
|
|
139
|
+
declare function gmxFormatPositionsForDisplay(chainId: number, positions: Array<Record<string, unknown>>): Promise<GmxPositionDisplayRow[]>;
|
|
140
|
+
|
|
141
|
+
declare function gmxFetchPositionsForExecutor(args: {
|
|
142
|
+
chainId: number;
|
|
143
|
+
executorAddress: string;
|
|
144
|
+
}): Promise<{
|
|
145
|
+
positions: Array<Record<string, unknown>>;
|
|
146
|
+
}>;
|
|
147
|
+
declare function gmxFetchPositionDisplayRows(args: {
|
|
148
|
+
chainId: number;
|
|
149
|
+
executorAddress: string;
|
|
150
|
+
}): Promise<GmxPositionDisplayRow[]>;
|
|
151
|
+
declare function gmxFetchOrdersForExecutor(args: {
|
|
152
|
+
chainId: number;
|
|
153
|
+
executorAddress: string;
|
|
154
|
+
}): Promise<GmxOrderRow[]>;
|
|
155
|
+
declare function gmxFetchMarketsSummary(args: {
|
|
156
|
+
chainId: number;
|
|
157
|
+
}): Promise<{
|
|
158
|
+
markets: {
|
|
159
|
+
symbol: string;
|
|
160
|
+
marketTokenAddress: string;
|
|
161
|
+
maxLeverageLabel: string | null;
|
|
162
|
+
}[];
|
|
163
|
+
}>;
|
|
164
|
+
declare function gmxFetchCollateralTokens(args: {
|
|
165
|
+
chainId: number;
|
|
166
|
+
}): Promise<{
|
|
167
|
+
symbol: string;
|
|
168
|
+
address: string;
|
|
169
|
+
decimals: number;
|
|
170
|
+
}[]>;
|
|
171
|
+
declare function gmxFetchGmMarkets(args: {
|
|
172
|
+
chainId: number;
|
|
173
|
+
}): Promise<{
|
|
174
|
+
markets: GmxGmMarketSummaryRow[];
|
|
175
|
+
}>;
|
|
176
|
+
/** GM liquidity pool APY per market (sorted highest APY first). Read-only. */
|
|
177
|
+
declare function gmxFetchGmApy(args: {
|
|
178
|
+
chainId: number;
|
|
179
|
+
}): Promise<{
|
|
180
|
+
markets: GmxGmMarketSummaryRow[];
|
|
181
|
+
}>;
|
|
182
|
+
declare function gmxFetchStakingPower(args: {
|
|
183
|
+
chainId: number;
|
|
184
|
+
executorAddress: string;
|
|
185
|
+
}): Promise<{
|
|
186
|
+
stakingPower: any;
|
|
187
|
+
}>;
|
|
188
|
+
declare function gmxFetchGmMarketForToken(args: {
|
|
189
|
+
chainId: number;
|
|
190
|
+
gmTokenAddress: string;
|
|
191
|
+
}): Promise<{
|
|
192
|
+
market: null;
|
|
193
|
+
} | {
|
|
194
|
+
market: {
|
|
195
|
+
symbol: string;
|
|
196
|
+
marketTokenAddress: string;
|
|
197
|
+
longTokenSymbol: string | null;
|
|
198
|
+
shortTokenSymbol: string | null;
|
|
199
|
+
gmDecimals: number;
|
|
200
|
+
};
|
|
201
|
+
}>;
|
|
202
|
+
declare function gmxGmxTokenAddress(chainId: number): string;
|
|
203
|
+
declare function gmxIsGmMarketTokenAddress(chainId: number, tokenAddress: string): Promise<boolean>;
|
|
204
|
+
declare function gmxIsGmxStakeTokenAddress(chainId: number, tokenAddress: string): boolean;
|
|
205
|
+
|
|
206
|
+
type GmxMultisignCommon = {
|
|
207
|
+
keyGen: KeyGenSubsetForPermit;
|
|
208
|
+
chainId: number;
|
|
209
|
+
rpcUrl: string;
|
|
210
|
+
chainDetail: EvmChainDetail;
|
|
211
|
+
useCustomGas: boolean;
|
|
212
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
213
|
+
executorAddress: Address;
|
|
214
|
+
purposeText: string;
|
|
215
|
+
};
|
|
216
|
+
type GmxIncreaseOrderArgs = GmxMultisignCommon & {
|
|
217
|
+
symbol: string;
|
|
218
|
+
direction: 'long' | 'short';
|
|
219
|
+
orderType: 'market' | 'limit';
|
|
220
|
+
sizeUsdHuman: string;
|
|
221
|
+
collateralToken: string;
|
|
222
|
+
collateralAmountHuman: string;
|
|
223
|
+
triggerPriceUsdHuman?: string;
|
|
224
|
+
slippageBps?: number;
|
|
225
|
+
executionFeeBufferBps?: number;
|
|
226
|
+
isNativeIn?: boolean;
|
|
227
|
+
/** Wrapped native (WETH/WAVAX); required when `isNativeIn`. */
|
|
228
|
+
nativeWrapped?: Address;
|
|
229
|
+
};
|
|
230
|
+
type GmxDecreaseOrderArgs = GmxMultisignCommon & {
|
|
231
|
+
symbol: string;
|
|
232
|
+
direction: 'long' | 'short';
|
|
233
|
+
orderType: 'market' | 'limit';
|
|
234
|
+
sizeUsdHuman: string;
|
|
235
|
+
collateralToken: string;
|
|
236
|
+
receiveToken?: string;
|
|
237
|
+
triggerPriceUsdHuman?: string;
|
|
238
|
+
keepLeverage?: boolean;
|
|
239
|
+
slippageBps?: number;
|
|
240
|
+
executionFeeBufferBps?: number;
|
|
241
|
+
/** When true, receive native gas token (GMX unwraps WETH/WAVAX in the order). */
|
|
242
|
+
isNativeOut?: boolean;
|
|
243
|
+
};
|
|
244
|
+
type GmxCancelOrderArgs = GmxMultisignCommon & {
|
|
245
|
+
orderId: string;
|
|
246
|
+
};
|
|
247
|
+
declare function buildEvmMultisignBodyGmxIncreaseBatch(args: GmxIncreaseOrderArgs): Promise<MultisignBuildResult>;
|
|
248
|
+
declare function buildEvmMultisignBodyGmxDecreaseBatch(args: GmxDecreaseOrderArgs): Promise<MultisignBuildResult>;
|
|
249
|
+
/** Alias: limit increase uses orderType limit on increase builder. */
|
|
250
|
+
declare const buildEvmMultisignBodyGmxLimitIncreaseBatch: typeof buildEvmMultisignBodyGmxIncreaseBatch;
|
|
251
|
+
/** Alias: limit decrease uses orderType limit on decrease builder. */
|
|
252
|
+
declare const buildEvmMultisignBodyGmxLimitDecreaseBatch: typeof buildEvmMultisignBodyGmxDecreaseBatch;
|
|
253
|
+
declare function buildEvmMultisignBodyGmxCancelBatch(args: GmxCancelOrderArgs): Promise<MultisignBuildResult>;
|
|
254
|
+
|
|
255
|
+
type GmxGmMultisignCommon = {
|
|
256
|
+
keyGen: KeyGenSubsetForPermit;
|
|
257
|
+
chainId: number;
|
|
258
|
+
rpcUrl: string;
|
|
259
|
+
chainDetail: EvmChainDetail;
|
|
260
|
+
useCustomGas: boolean;
|
|
261
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
262
|
+
executorAddress: Address;
|
|
263
|
+
purposeText: string;
|
|
264
|
+
};
|
|
265
|
+
type GmxGmDepositArgs = GmxGmMultisignCommon & {
|
|
266
|
+
marketSymbol: string;
|
|
267
|
+
collateralToken: string;
|
|
268
|
+
collateralAmountHuman: string;
|
|
269
|
+
executionFeeBufferBps?: number;
|
|
270
|
+
isNativeIn?: boolean;
|
|
271
|
+
nativeWrapped?: Address;
|
|
272
|
+
};
|
|
273
|
+
type GmxGmWithdrawArgs = GmxGmMultisignCommon & {
|
|
274
|
+
marketSymbol: string;
|
|
275
|
+
gmAmountHuman: string;
|
|
276
|
+
gmDecimals?: number;
|
|
277
|
+
executionFeeBufferBps?: number;
|
|
278
|
+
isNativeOut?: boolean;
|
|
279
|
+
};
|
|
280
|
+
declare function buildEvmMultisignBodyGmxGmDepositBatch(args: GmxGmDepositArgs): Promise<MultisignBuildResult>;
|
|
281
|
+
declare function buildEvmMultisignBodyGmxGmWithdrawBatch(args: GmxGmWithdrawArgs): Promise<MultisignBuildResult>;
|
|
282
|
+
|
|
283
|
+
type GmxStakeMultisignCommon = {
|
|
284
|
+
keyGen: KeyGenSubsetForPermit;
|
|
285
|
+
chainId: number;
|
|
286
|
+
rpcUrl: string;
|
|
287
|
+
chainDetail: EvmChainDetail;
|
|
288
|
+
useCustomGas: boolean;
|
|
289
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
290
|
+
executorAddress: Address;
|
|
291
|
+
purposeText: string;
|
|
292
|
+
};
|
|
293
|
+
type GmxStakeGmxArgs = GmxStakeMultisignCommon & {
|
|
294
|
+
amountHuman: string;
|
|
295
|
+
gmxDecimals?: number;
|
|
296
|
+
};
|
|
297
|
+
type GmxUnstakeGmxArgs = GmxStakeMultisignCommon & {
|
|
298
|
+
amountHuman: string;
|
|
299
|
+
gmxDecimals?: number;
|
|
300
|
+
};
|
|
301
|
+
declare function buildEvmMultisignBodyGmxStakeGmxBatch(args: GmxStakeGmxArgs): Promise<MultisignBuildResult>;
|
|
302
|
+
declare function buildEvmMultisignBodyGmxUnstakeGmxBatch(args: GmxUnstakeGmxArgs): Promise<MultisignBuildResult>;
|
|
303
|
+
|
|
304
|
+
declare function gmxContractAddress(chainId: number, name: string): Address;
|
|
305
|
+
|
|
306
|
+
declare function gmxEstimateGmExecutionFee(args: {
|
|
307
|
+
chainId: number;
|
|
308
|
+
rpcUrl: string;
|
|
309
|
+
operation: 'deposit' | 'withdrawal';
|
|
310
|
+
executionFeeBufferBps?: number;
|
|
311
|
+
}): Promise<bigint>;
|
|
312
|
+
declare function gmxZeroAddress(): Address;
|
|
313
|
+
|
|
314
|
+
type GmxGmLiquidityPositionRow = {
|
|
315
|
+
symbol: string;
|
|
316
|
+
marketTokenAddress: string;
|
|
317
|
+
longTokenSymbol: string | null;
|
|
318
|
+
shortTokenSymbol: string | null;
|
|
319
|
+
gmDecimals: number;
|
|
320
|
+
gmBalanceWei: string;
|
|
321
|
+
gmBalanceHuman: string;
|
|
322
|
+
apyPercentLabel: string | null;
|
|
323
|
+
tokenListSymbol: string;
|
|
324
|
+
tokenListName: string;
|
|
325
|
+
};
|
|
326
|
+
declare function gmxFetchGmLiquidityPositions(args: {
|
|
327
|
+
chainId: number;
|
|
328
|
+
executorAddress: string;
|
|
329
|
+
rpcUrl: string;
|
|
330
|
+
includeZeroBalance?: boolean;
|
|
331
|
+
}): Promise<{
|
|
332
|
+
rows: GmxGmLiquidityPositionRow[];
|
|
333
|
+
}>;
|
|
334
|
+
|
|
335
|
+
/** Format a GMX 30-decimal USD bigint as a human-readable dollar string. */
|
|
336
|
+
declare function formatGmxUsd30(value: bigint | string | number | null | undefined): string | null;
|
|
337
|
+
/** Decimal USD string suitable for amount inputs (no currency symbol). */
|
|
338
|
+
declare function formatGmxUsd30HumanInput(value: bigint | string | number | null | undefined): string | null;
|
|
339
|
+
/** Trim trailing zeros from a decimal token amount string. */
|
|
340
|
+
declare function formatGmxTokenAmountHuman(amountWei: bigint, decimals: number): string;
|
|
341
|
+
/** GMX leverage is returned in basis points (size / effective collateral * 10_000). */
|
|
342
|
+
declare function formatGmxLeverageBps(value: bigint | string | number | null | undefined): string | null;
|
|
343
|
+
|
|
344
|
+
type GmxTradeEstimate = {
|
|
345
|
+
direction: 'long' | 'short';
|
|
346
|
+
marketSymbol: string;
|
|
347
|
+
sizeUsdHuman: string;
|
|
348
|
+
collateralSymbol: string;
|
|
349
|
+
collateralAmountHuman: string | null;
|
|
350
|
+
/** Current open position size (Close tab); use for MAX and validation. */
|
|
351
|
+
openPositionSizeUsdHuman: string | null;
|
|
352
|
+
openPositionSizeUsdLabel: string | null;
|
|
353
|
+
entryPriceUsd: string | null;
|
|
354
|
+
liquidationPriceUsd: string | null;
|
|
355
|
+
leverageLabel: string | null;
|
|
356
|
+
maxLeverageLabel: string | null;
|
|
357
|
+
minCollateralAmountHuman: string | null;
|
|
358
|
+
exceedsMaxLeverage: boolean;
|
|
359
|
+
note: string | null;
|
|
360
|
+
};
|
|
361
|
+
declare function gmxEstimateIncreasePreview(args: {
|
|
362
|
+
chainId: number;
|
|
363
|
+
symbol: string;
|
|
364
|
+
direction: 'long' | 'short';
|
|
365
|
+
sizeUsdHuman: string;
|
|
366
|
+
collateralToken: string;
|
|
367
|
+
collateralAmountHuman: string;
|
|
368
|
+
executorAddress?: string;
|
|
369
|
+
}): Promise<GmxTradeEstimate>;
|
|
370
|
+
type GmxClosePositionCap = {
|
|
371
|
+
openPositionSizeUsdHuman: string | null;
|
|
372
|
+
openPositionSizeUsdLabel: string | null;
|
|
373
|
+
};
|
|
374
|
+
declare function gmxFetchClosePositionCap(args: {
|
|
375
|
+
chainId: number;
|
|
376
|
+
symbol: string;
|
|
377
|
+
direction: 'long' | 'short';
|
|
378
|
+
executorAddress: string;
|
|
379
|
+
}): Promise<GmxClosePositionCap>;
|
|
380
|
+
declare function gmxEstimateDecreasePreview(args: {
|
|
381
|
+
chainId: number;
|
|
382
|
+
symbol: string;
|
|
383
|
+
direction: 'long' | 'short';
|
|
384
|
+
sizeUsdHuman: string;
|
|
385
|
+
collateralToken: string;
|
|
386
|
+
executorAddress: string;
|
|
387
|
+
}): Promise<GmxTradeEstimate>;
|
|
388
|
+
declare function gmxAssertIncreaseOrderWithinMaxLeverage(args: {
|
|
389
|
+
chainId: number;
|
|
390
|
+
symbol: string;
|
|
391
|
+
direction: 'long' | 'short';
|
|
392
|
+
sizeUsdHuman: string;
|
|
393
|
+
collateralToken: string;
|
|
394
|
+
collateralAmountHuman: string;
|
|
395
|
+
executorAddress?: string;
|
|
396
|
+
}): Promise<void>;
|
|
397
|
+
/** Returns true when close size is positive and does not exceed the open position. */
|
|
398
|
+
declare function gmxIsCloseSizeWithinPosition(args: {
|
|
399
|
+
closeSizeUsdHuman: string;
|
|
400
|
+
openPositionSizeUsdHuman: string;
|
|
401
|
+
}): boolean;
|
|
402
|
+
|
|
403
|
+
declare function gmxMarketMaxLeverageBps(marketInfo: Record<string, unknown>): number;
|
|
404
|
+
declare function gmxMarketMaxLeverageLabel(marketInfo: Record<string, unknown>): string | null;
|
|
405
|
+
|
|
406
|
+
type GmxOhlcvCandleRow = {
|
|
407
|
+
timestampMs: number;
|
|
408
|
+
timeLabel: string;
|
|
409
|
+
open: string;
|
|
410
|
+
high: string;
|
|
411
|
+
low: string;
|
|
412
|
+
close: string;
|
|
413
|
+
};
|
|
414
|
+
type GmxMarketPrices = {
|
|
415
|
+
symbol: string;
|
|
416
|
+
indexLabel: string;
|
|
417
|
+
collateralSymbol: string;
|
|
418
|
+
indexMarkUsd: string | null;
|
|
419
|
+
collateralUsd: string | null;
|
|
420
|
+
indexPerCollateral: string | null;
|
|
421
|
+
fetchedAtMs: number;
|
|
422
|
+
};
|
|
423
|
+
type GmxMarketSnapshot = GmxMarketPrices & {
|
|
424
|
+
ohlcvTimeframe: GmxOhlcvTimeframe;
|
|
425
|
+
ohlcv: GmxOhlcvCandleRow[];
|
|
426
|
+
};
|
|
427
|
+
declare const GMX_OHLCV_TIMEFRAMES: readonly ["1m", "5m", "15m", "1h", "4h", "1d", "1w", "1M"];
|
|
428
|
+
type GmxOhlcvTimeframe = (typeof GMX_OHLCV_TIMEFRAMES)[number];
|
|
429
|
+
declare function assertGmxOhlcvTimeframe(timeframe: string): GmxOhlcvTimeframe;
|
|
430
|
+
declare function gmxFetchMarketPrices(args: {
|
|
431
|
+
chainId: number;
|
|
432
|
+
symbol: string;
|
|
433
|
+
collateralSymbol: string;
|
|
434
|
+
}): Promise<GmxMarketPrices>;
|
|
435
|
+
declare function gmxFetchOhlcv(args: {
|
|
436
|
+
chainId: number;
|
|
437
|
+
symbol: string;
|
|
438
|
+
timeframe?: string;
|
|
439
|
+
limit?: number;
|
|
440
|
+
sort?: 'asc' | 'desc';
|
|
441
|
+
}): Promise<{
|
|
442
|
+
symbol: string;
|
|
443
|
+
timeframe: GmxOhlcvTimeframe;
|
|
444
|
+
candles: GmxOhlcvCandleRow[];
|
|
445
|
+
}>;
|
|
446
|
+
declare function gmxFetchMarketSnapshot(args: {
|
|
447
|
+
chainId: number;
|
|
448
|
+
symbol: string;
|
|
449
|
+
collateralSymbol: string;
|
|
450
|
+
ohlcvTimeframe?: string;
|
|
451
|
+
}): Promise<GmxMarketSnapshot>;
|
|
452
|
+
|
|
453
|
+
/** Wrapped native collateral symbol GMX perp markets accept (not the zero-address gas token). */
|
|
454
|
+
declare const GMX_WRAPPED_NATIVE_SYMBOL_BY_CHAIN: Partial<Record<number, string>>;
|
|
455
|
+
/** Native gas token symbol for GMX receiveToken unwrap on decrease. */
|
|
456
|
+
declare const GMX_NATIVE_GAS_SYMBOL_BY_CHAIN: Partial<Record<number, string>>;
|
|
457
|
+
declare function gmxWrappedNativeSymbolForChain(chainId: number): string | null;
|
|
458
|
+
declare function gmxNativeGasSymbolForChain(chainId: number): string | null;
|
|
459
|
+
declare function gmxFindWrappedNativeToken(tokens: readonly GmxTokenRow[], chainId: number): GmxTokenRow | null;
|
|
460
|
+
/** Map node asset row address to GMX collateral lookup key (native gas row → wrapped ERC-20). */
|
|
461
|
+
declare function gmxKeyForNodeAssetRow(args: {
|
|
462
|
+
contractAddress: string;
|
|
463
|
+
nativeWrapped: string | null;
|
|
464
|
+
}): string | null;
|
|
465
|
+
|
|
466
|
+
declare const GMX_PROTOCOL_ID = "gmx";
|
|
467
|
+
declare const gmxProtocolModule: ProtocolModule;
|
|
468
|
+
|
|
469
|
+
export { GMX_NATIVE_GAS_SYMBOL_BY_CHAIN, GMX_OHLCV_TIMEFRAMES, GMX_PROTOCOL_ID, GMX_SUPPORTED_CHAIN_IDS, GMX_WRAPPED_NATIVE_SYMBOL_BY_CHAIN, type GmxApiSdkInstance, type GmxCancelOrderArgs, type GmxClosePositionCap, type GmxDecreaseOrderArgs, type GmxGmDepositArgs, type GmxGmLiquidityPositionRow, type GmxGmMarketSummaryRow, type GmxGmWithdrawArgs, type GmxIncreaseOrderArgs, type GmxMarketApySource, type GmxMarketPrices, type GmxMarketRow, type GmxMarketSnapshot, type GmxOhlcvCandleRow, type GmxOhlcvTimeframe, type GmxOrderRow, type GmxPositionDisplayRow, type GmxPositionRow, type GmxPrepareOrderResponse, type GmxStakeGmxArgs, type GmxSupportedChainId, type GmxTokenRow, type GmxTradeEstimate, type GmxUnstakeGmxArgs, assertGmxOhlcvTimeframe, buildEvmMultisignBodyGmxCancelBatch, buildEvmMultisignBodyGmxDecreaseBatch, buildEvmMultisignBodyGmxGmDepositBatch, buildEvmMultisignBodyGmxGmWithdrawBatch, buildEvmMultisignBodyGmxIncreaseBatch, buildEvmMultisignBodyGmxLimitDecreaseBatch, buildEvmMultisignBodyGmxLimitIncreaseBatch, buildEvmMultisignBodyGmxStakeGmxBatch, buildEvmMultisignBodyGmxUnstakeGmxBatch, formatGmxLeverageBps, formatGmxTokenAmountHuman, formatGmxUsd30, formatGmxUsd30HumanInput, getGmxApiSdk, gmxAssertIncreaseOrderWithinMaxLeverage, gmxContractAddress, gmxEnrichGmMarketRowWithApy, gmxEstimateDecreasePreview, gmxEstimateGmExecutionFee, gmxEstimateIncreasePreview, gmxFetchClosePositionCap, gmxFetchCollateralTokens, gmxFetchGmApy, gmxFetchGmLiquidityPositions, gmxFetchGmMarketForToken, gmxFetchGmMarkets, gmxFetchGmMarketsSummary, gmxFetchMarketPrices, gmxFetchMarketSnapshot, gmxFetchMarkets, gmxFetchMarketsSummary, gmxFetchOhlcv, gmxFetchOrdersForExecutor, gmxFetchPositionDisplayRows, gmxFetchPositionsForExecutor, gmxFetchStakingPower, gmxFetchTokens, gmxFindWrappedNativeToken, gmxFormatApyPercent, gmxFormatPositionsForDisplay, gmxGmxTokenAddress, gmxIsCloseSizeWithinPosition, gmxIsCollateralTokenSupported, gmxIsGmMarketTokenAddress, gmxIsGmxStakeTokenAddress, gmxKeyForNodeAssetRow, gmxLookupMarketApy, gmxMarketAcceptsCollateral, gmxMarketCollateralTokens, gmxMarketMaxLeverageBps, gmxMarketMaxLeverageLabel, gmxMarketsForCollateralSymbol, gmxNativeGasSymbolForChain, gmxProtocolModule, gmxResolveMarketByGmTokenAddress, gmxResolveMarketBySymbol, gmxResolveTokenBySymbol, gmxWrappedNativeSymbolForChain, gmxZeroAddress, isGmxChainSupported, parseGmxTokenAmount, parseGmxUsd30 };
|