@gmx-io/sdk 1.4.0 → 1.4.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/build/cjs/src/abis/GlvReader.js +940 -940
- package/build/cjs/src/abis/IStargate.js +603 -0
- package/build/cjs/src/abis/LayerZeroProvider.js +273 -46
- package/build/cjs/src/abis/index.js +2 -2
- package/build/cjs/src/configs/batch.js +29 -103
- package/build/cjs/src/configs/chainIds.js +2 -2
- package/build/cjs/src/configs/chains.js +230 -151
- package/build/cjs/src/configs/contracts.js +1 -5
- package/build/cjs/src/configs/dataStore.js +5 -4
- package/build/cjs/src/configs/express.js +1 -1
- package/build/cjs/src/configs/gasLimits.js +41 -0
- package/build/cjs/src/configs/markets.js +67 -1
- package/build/cjs/src/configs/multichain.js +1 -0
- package/build/cjs/src/configs/oracleKeeper.js +18 -20
- package/build/cjs/src/configs/tokens.js +53 -14
- package/build/cjs/src/modules/markets/index.js +6 -2
- package/build/cjs/src/modules/markets/markets.spec.js +5 -5
- package/build/cjs/src/modules/markets/query-builders.js +8 -0
- package/build/cjs/src/modules/orders/helpers.js +2 -2
- package/build/cjs/src/modules/orders/helpers.spec.js +1 -1
- package/build/cjs/src/modules/orders/orders.spec.js +1 -1
- package/build/cjs/src/modules/positions/positions.spec.js +2 -2
- package/build/cjs/src/modules/tokens/tokens.spec.js +2 -2
- package/build/cjs/src/modules/trades/trades.spec.js +1 -1
- package/build/cjs/src/modules/utils/utils.js +7 -6
- package/build/cjs/src/prebuilt/hashedKinkModelMarketRatesKeys.json +24 -0
- package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +495 -0
- package/build/cjs/src/prebuilt/hashedMarketValuesKeys.json +45 -0
- package/build/cjs/src/test/mock.js +2 -0
- package/build/cjs/src/types/chains.js +2 -0
- package/build/cjs/src/types/orders.js +8 -2
- package/build/cjs/src/types/subsquid.js +241 -1
- package/build/cjs/src/types/tokens.js +7 -0
- package/build/cjs/src/utils/__tests__/abort.spec.js +122 -0
- package/build/cjs/src/utils/__tests__/numbers.spec.js +94 -14
- package/build/cjs/src/utils/abort.js +31 -0
- package/build/cjs/src/utils/callContract.js +4 -4
- package/build/cjs/src/utils/fees/executionFee.js +14 -11
- package/build/cjs/src/utils/fees/index.js +8 -2
- package/build/cjs/src/utils/marketKeysAndConfigs.js +8 -0
- package/build/cjs/src/utils/markets.js +7 -1
- package/build/cjs/src/utils/multicall.js +54 -17
- package/build/cjs/src/utils/numbers.js +25 -14
- package/build/cjs/src/utils/orders.js +2 -2
- package/build/cjs/src/utils/swap/__tests__/mockRouting.spec.js +7 -6
- package/build/cjs/src/utils/swap/__tests__/swapRouting.spec.js +5 -4
- package/build/cjs/src/utils/swap/__tests__/swapStats.spec.js +10 -9
- package/build/cjs/src/utils/swap/buildSwapStrategy.js +10 -9
- package/build/cjs/src/utils/swap/swapPath.js +6 -6
- package/build/cjs/src/utils/swap/swapRouting.js +8 -4
- package/build/cjs/src/utils/swap/swapStats.js +6 -6
- package/build/cjs/src/utils/swap/swapValues.js +4 -0
- package/build/cjs/src/utils/tokens.js +17 -1
- package/build/cjs/src/utils/trade/decrease.js +1 -1
- package/build/esm/src/abis/GlvReader.js +940 -940
- package/build/esm/src/abis/IStargate.js +601 -0
- package/build/esm/src/abis/LayerZeroProvider.js +273 -46
- package/build/esm/src/abis/index.js +2 -2
- package/build/esm/src/configs/batch.js +30 -104
- package/build/esm/src/configs/chainIds.js +1 -1
- package/build/esm/src/configs/chains.js +212 -147
- package/build/esm/src/configs/contracts.js +1 -5
- package/build/esm/src/configs/dataStore.js +1 -0
- package/build/esm/src/configs/express.js +1 -1
- package/build/esm/src/configs/gasLimits.js +38 -0
- package/build/esm/src/configs/markets.js +60 -1
- package/build/esm/src/configs/multichain.js +2 -1
- package/build/esm/src/configs/oracleKeeper.js +17 -19
- package/build/esm/src/configs/tokens.js +52 -13
- package/build/esm/src/modules/markets/index.js +6 -2
- package/build/esm/src/modules/markets/markets.spec.js +5 -5
- package/build/esm/src/modules/markets/query-builders.js +8 -0
- package/build/esm/src/modules/orders/helpers.js +3 -3
- package/build/esm/src/modules/orders/helpers.spec.js +1 -1
- package/build/esm/src/modules/orders/orders.spec.js +1 -1
- package/build/esm/src/modules/positions/positions.spec.js +2 -2
- package/build/esm/src/modules/tokens/tokens.spec.js +2 -2
- package/build/esm/src/modules/trades/trades.spec.js +1 -1
- package/build/esm/src/modules/utils/utils.js +7 -6
- package/build/esm/src/prebuilt/hashedKinkModelMarketRatesKeys.json +24 -0
- package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +495 -0
- package/build/esm/src/prebuilt/hashedMarketValuesKeys.json +45 -0
- package/build/esm/src/test/mock.js +2 -0
- package/build/esm/src/types/chains.js +1 -0
- package/build/esm/src/types/orders.js +8 -2
- package/build/esm/src/types/subsquid.js +240 -0
- package/build/esm/src/types/tokens.js +6 -1
- package/build/esm/src/utils/__tests__/abort.spec.js +120 -0
- package/build/esm/src/utils/__tests__/numbers.spec.js +95 -15
- package/build/esm/src/utils/abort.js +27 -0
- package/build/esm/src/utils/callContract.js +5 -5
- package/build/esm/src/utils/fees/executionFee.js +15 -12
- package/build/esm/src/utils/fees/index.js +8 -2
- package/build/esm/src/utils/marketKeysAndConfigs.js +9 -1
- package/build/esm/src/utils/markets.js +5 -0
- package/build/esm/src/utils/multicall.js +53 -16
- package/build/esm/src/utils/numbers.js +21 -12
- package/build/esm/src/utils/orders.js +3 -3
- package/build/esm/src/utils/swap/__tests__/mockRouting.spec.js +7 -6
- package/build/esm/src/utils/swap/__tests__/swapRouting.spec.js +5 -4
- package/build/esm/src/utils/swap/__tests__/swapStats.spec.js +10 -9
- package/build/esm/src/utils/swap/buildSwapStrategy.js +10 -9
- package/build/esm/src/utils/swap/swapPath.js +6 -6
- package/build/esm/src/utils/swap/swapRouting.js +8 -4
- package/build/esm/src/utils/swap/swapStats.js +6 -6
- package/build/esm/src/utils/swap/swapValues.js +4 -0
- package/build/esm/src/utils/tokens.js +15 -1
- package/build/esm/src/utils/trade/decrease.js +2 -2
- package/build/types/src/abis/IStargate.d.ts +464 -0
- package/build/types/src/abis/LayerZeroProvider.d.ts +12 -0
- package/build/types/src/abis/index.d.ts +475 -99
- package/build/types/src/configs/chainIds.d.ts +1 -1
- package/build/types/src/configs/chains.d.ts +170 -27
- package/build/types/src/configs/contracts.d.ts +0 -4
- package/build/types/src/configs/dataStore.d.ts +1 -0
- package/build/types/src/configs/express.d.ts +1 -1
- package/build/types/src/configs/gasLimits.d.ts +4 -0
- package/build/types/src/configs/markets.d.ts +10 -1
- package/build/types/src/configs/oracleKeeper.d.ts +13 -0
- package/build/types/src/configs/tokens.d.ts +3 -0
- package/build/types/src/index.d.ts +1 -1
- package/build/types/src/modules/base.d.ts +1 -1
- package/build/types/src/modules/markets/index.d.ts +2 -0
- package/build/types/src/modules/markets/query-builders.d.ts +1 -1
- package/build/types/src/modules/markets/types.d.ts +2 -2
- package/build/types/src/modules/utils/utils.d.ts +2 -3
- package/build/types/src/types/chains.d.ts +57 -0
- package/build/types/src/types/markets.d.ts +2 -0
- package/build/types/src/types/orders.d.ts +8 -2
- package/build/types/src/types/subsquid.d.ts +5987 -5172
- package/build/types/src/types/tokens.d.ts +11 -3
- package/build/types/src/types/trade.d.ts +5 -0
- package/build/types/src/utils/__tests__/abort.spec.d.ts +1 -0
- package/build/types/src/utils/abort.d.ts +1 -0
- package/build/types/src/utils/fees/estimateOraclePriceCount.d.ts +2 -2
- package/build/types/src/utils/fees/executionFee.d.ts +6 -6
- package/build/types/src/utils/fees/index.d.ts +2 -1
- package/build/types/src/utils/marketKeysAndConfigs.d.ts +2 -0
- package/build/types/src/utils/markets.d.ts +4 -2
- package/build/types/src/utils/multicall.d.ts +4 -2
- package/build/types/src/utils/numbers.d.ts +8 -1
- package/build/types/src/utils/swap/buildSwapStrategy.d.ts +6 -3
- package/build/types/src/utils/swap/swapPath.d.ts +2 -1
- package/build/types/src/utils/swap/swapRouting.d.ts +7 -2
- package/build/types/src/utils/swap/swapStats.d.ts +3 -2
- package/build/types/src/utils/swap/swapValues.d.ts +1 -1
- package/build/types/src/utils/tokens.d.ts +3 -0
- package/package.json +8 -2
- package/build/cjs/src/abis/MultichainUtils.js +0 -133
- package/build/esm/src/abis/MultichainUtils.js +0 -131
- package/build/types/src/abis/MultichainUtils.d.ts +0 -100
|
@@ -1,36 +1,179 @@
|
|
|
1
1
|
import { Chain } from "viem/chains";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export type
|
|
10
|
-
export type
|
|
2
|
+
import { ARBITRUM, ARBITRUM_SEPOLIA, AVALANCHE, AVALANCHE_FUJI, BOTANIX, SOURCE_ETHEREUM_MAINNET, SOURCE_BASE_MAINNET, SOURCE_BSC_MAINNET, SOURCE_OPTIMISM_SEPOLIA, SOURCE_SEPOLIA } from "./chainIds";
|
|
3
|
+
export { ARBITRUM, AVALANCHE, AVALANCHE_FUJI, BOTANIX, ARBITRUM_SEPOLIA, SOURCE_ETHEREUM_MAINNET, SOURCE_BASE_MAINNET, SOURCE_BSC_MAINNET, SOURCE_OPTIMISM_SEPOLIA, SOURCE_SEPOLIA, };
|
|
4
|
+
export declare const CONTRACTS_CHAIN_IDS: readonly [42161, 43114, 3637];
|
|
5
|
+
export declare const CONTRACTS_CHAIN_IDS_DEV: readonly [42161, 43114, 3637, 43113, 421614];
|
|
6
|
+
export declare const SETTLEMENT_CHAIN_IDS: readonly [42161, 43114];
|
|
7
|
+
export declare const SETTLEMENT_CHAIN_IDS_DEV: readonly [42161, 43114, 421614];
|
|
8
|
+
export declare const SOURCE_CHAIN_IDS: readonly [11155420, 11155111, 8453, 56, 1];
|
|
9
|
+
export type ContractsChainId = (typeof CONTRACTS_CHAIN_IDS_DEV)[number];
|
|
10
|
+
export type ContractsChainIdProduction = (typeof CONTRACTS_CHAIN_IDS)[number];
|
|
11
|
+
export type SettlementChainId = (typeof SETTLEMENT_CHAIN_IDS_DEV)[number];
|
|
12
|
+
export type SourceChainId = (typeof SOURCE_CHAIN_IDS)[number];
|
|
13
|
+
export declare const GMX_ACCOUNT_PSEUDO_CHAIN_ID = 0;
|
|
14
|
+
export type GmxAccountPseudoChainId = typeof GMX_ACCOUNT_PSEUDO_CHAIN_ID;
|
|
11
15
|
export type AnyChainId = ContractsChainId | SettlementChainId | SourceChainId;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
declare const CONTRACTS_CHAIN_CONFIGS: {
|
|
17
|
+
readonly 42161: {
|
|
18
|
+
readonly chainId: 42161;
|
|
19
|
+
readonly name: "Arbitrum";
|
|
20
|
+
readonly slug: "arbitrum";
|
|
21
|
+
readonly explorerUrl: "https://arbiscan.io/";
|
|
22
|
+
readonly nativeTokenSymbol: "ETH";
|
|
23
|
+
readonly wrappedTokenSymbol: "WETH";
|
|
24
|
+
readonly defaultCollateralSymbol: "USDC.e";
|
|
25
|
+
readonly highExecutionFee: 5;
|
|
26
|
+
readonly shouldUseMaxPriorityFeePerGas: false;
|
|
27
|
+
readonly defaultExecutionFeeBufferBps: 3000;
|
|
28
|
+
readonly maxFeePerGas: undefined;
|
|
29
|
+
readonly gasPricePremium: 0n;
|
|
30
|
+
readonly maxPriorityFeePerGas: 1500000000n;
|
|
31
|
+
readonly excessiveExecutionFee: 10;
|
|
32
|
+
readonly minExecutionFee: undefined;
|
|
33
|
+
readonly gasPriceBuffer: 2000n;
|
|
34
|
+
readonly isDisabled: false;
|
|
35
|
+
};
|
|
36
|
+
readonly 43114: {
|
|
37
|
+
readonly chainId: 43114;
|
|
38
|
+
readonly name: "Avalanche";
|
|
39
|
+
readonly slug: "avalanche";
|
|
40
|
+
readonly explorerUrl: "https://snowtrace.io/";
|
|
41
|
+
readonly nativeTokenSymbol: "AVAX";
|
|
42
|
+
readonly wrappedTokenSymbol: "WAVAX";
|
|
43
|
+
readonly defaultCollateralSymbol: "USDC";
|
|
44
|
+
readonly highExecutionFee: 5;
|
|
45
|
+
readonly shouldUseMaxPriorityFeePerGas: true;
|
|
46
|
+
readonly defaultExecutionFeeBufferBps: 1000;
|
|
47
|
+
readonly maxFeePerGas: 200000000000n;
|
|
48
|
+
readonly gasPricePremium: 6000000000n;
|
|
49
|
+
readonly maxPriorityFeePerGas: 1500000000n;
|
|
50
|
+
readonly excessiveExecutionFee: 10;
|
|
51
|
+
readonly minExecutionFee: undefined;
|
|
52
|
+
readonly gasPriceBuffer: undefined;
|
|
53
|
+
readonly isDisabled: false;
|
|
54
|
+
};
|
|
55
|
+
readonly 43113: {
|
|
56
|
+
readonly chainId: 43113;
|
|
57
|
+
readonly name: "Avalanche Fuji";
|
|
58
|
+
readonly slug: "fuji";
|
|
59
|
+
readonly explorerUrl: "https://testnet.snowtrace.io/";
|
|
60
|
+
readonly nativeTokenSymbol: "AVAX";
|
|
61
|
+
readonly wrappedTokenSymbol: "WAVAX";
|
|
62
|
+
readonly defaultCollateralSymbol: "USDC";
|
|
63
|
+
readonly highExecutionFee: 5;
|
|
64
|
+
readonly shouldUseMaxPriorityFeePerGas: true;
|
|
65
|
+
readonly defaultExecutionFeeBufferBps: 1000;
|
|
66
|
+
readonly maxFeePerGas: undefined;
|
|
67
|
+
readonly gasPricePremium: undefined;
|
|
68
|
+
readonly maxPriorityFeePerGas: 1500000000n;
|
|
69
|
+
readonly excessiveExecutionFee: 10;
|
|
70
|
+
readonly minExecutionFee: undefined;
|
|
71
|
+
readonly gasPriceBuffer: undefined;
|
|
72
|
+
readonly isDisabled: false;
|
|
73
|
+
};
|
|
74
|
+
readonly 421614: {
|
|
75
|
+
readonly chainId: 421614;
|
|
76
|
+
readonly name: "Arbitrum Sepolia";
|
|
77
|
+
readonly slug: "arbitrum-sepolia";
|
|
78
|
+
readonly explorerUrl: "https://sepolia.arbiscan.io/";
|
|
79
|
+
readonly nativeTokenSymbol: "ETH";
|
|
80
|
+
readonly wrappedTokenSymbol: "WETH";
|
|
81
|
+
readonly defaultCollateralSymbol: "USDC";
|
|
82
|
+
readonly highExecutionFee: 5;
|
|
83
|
+
readonly shouldUseMaxPriorityFeePerGas: false;
|
|
84
|
+
readonly defaultExecutionFeeBufferBps: 1000;
|
|
85
|
+
readonly maxFeePerGas: undefined;
|
|
86
|
+
readonly gasPricePremium: undefined;
|
|
87
|
+
readonly maxPriorityFeePerGas: 1500000000n;
|
|
88
|
+
readonly excessiveExecutionFee: 10;
|
|
89
|
+
readonly minExecutionFee: undefined;
|
|
90
|
+
readonly gasPriceBuffer: undefined;
|
|
91
|
+
readonly isDisabled: false;
|
|
92
|
+
};
|
|
93
|
+
readonly 3637: {
|
|
94
|
+
readonly chainId: 3637;
|
|
95
|
+
readonly name: "Botanix";
|
|
96
|
+
readonly slug: "botanix";
|
|
97
|
+
readonly explorerUrl: "https://botanixscan.io/";
|
|
98
|
+
readonly nativeTokenSymbol: "BTC";
|
|
99
|
+
readonly wrappedTokenSymbol: "PBTC";
|
|
100
|
+
readonly defaultCollateralSymbol: "USDC.E";
|
|
101
|
+
readonly highExecutionFee: 5;
|
|
102
|
+
readonly shouldUseMaxPriorityFeePerGas: true;
|
|
103
|
+
readonly defaultExecutionFeeBufferBps: 3000;
|
|
104
|
+
readonly maxFeePerGas: 20n;
|
|
105
|
+
readonly gasPricePremium: undefined;
|
|
106
|
+
readonly maxPriorityFeePerGas: 7n;
|
|
107
|
+
readonly excessiveExecutionFee: 10;
|
|
108
|
+
/**
|
|
109
|
+
* avoid botanix gas spikes when chain is not actively used
|
|
110
|
+
* if set, execution fee value should not be less than this in USD equivalent
|
|
111
|
+
*/
|
|
112
|
+
readonly minExecutionFee: 1000000000000000000000000000n;
|
|
113
|
+
readonly gasPriceBuffer: undefined;
|
|
114
|
+
readonly isDisabled: false;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
declare const SOURCE_CHAIN_CONFIGS: {
|
|
118
|
+
readonly 11155420: {
|
|
119
|
+
readonly chainId: 11155420;
|
|
120
|
+
readonly name: "Optimism Sepolia";
|
|
121
|
+
readonly slug: "optimism-sepolia";
|
|
122
|
+
readonly explorerUrl: "https://sepolia-optimism.etherscan.io/";
|
|
123
|
+
};
|
|
124
|
+
readonly 11155111: {
|
|
125
|
+
readonly chainId: 11155111;
|
|
126
|
+
readonly name: "Sepolia";
|
|
127
|
+
readonly slug: "sepolia";
|
|
128
|
+
readonly explorerUrl: "https://sepolia.etherscan.io/";
|
|
129
|
+
};
|
|
130
|
+
readonly 8453: {
|
|
131
|
+
readonly chainId: 8453;
|
|
132
|
+
readonly name: "Base";
|
|
133
|
+
readonly slug: "base-mainnet";
|
|
134
|
+
readonly explorerUrl: "https://basescan.org/";
|
|
135
|
+
};
|
|
136
|
+
readonly 56: {
|
|
137
|
+
readonly chainId: 56;
|
|
138
|
+
readonly name: "BNB";
|
|
139
|
+
readonly slug: "bnb-mainnet";
|
|
140
|
+
readonly explorerUrl: "https://bscscan.com/";
|
|
141
|
+
};
|
|
142
|
+
readonly 1: {
|
|
143
|
+
readonly chainId: 1;
|
|
144
|
+
readonly name: "Ethereum";
|
|
145
|
+
readonly slug: "ethereum-mainnet";
|
|
146
|
+
readonly explorerUrl: "https://etherscan.io/";
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
export type ContractsChainName = (typeof CONTRACTS_CHAIN_CONFIGS)[keyof typeof CONTRACTS_CHAIN_CONFIGS]["name"];
|
|
150
|
+
export type SourceChainName = (typeof SOURCE_CHAIN_CONFIGS)[keyof typeof SOURCE_CHAIN_CONFIGS]["name"];
|
|
151
|
+
export type ChainName = ContractsChainName | SourceChainName | "Unknown";
|
|
152
|
+
export type ContractsChainSlug = (typeof CONTRACTS_CHAIN_CONFIGS)[keyof typeof CONTRACTS_CHAIN_CONFIGS]["slug"];
|
|
153
|
+
export type SourceChainSlug = (typeof SOURCE_CHAIN_CONFIGS)[keyof typeof SOURCE_CHAIN_CONFIGS]["slug"];
|
|
154
|
+
export type ChainSlug = ContractsChainSlug | SourceChainSlug | "unknown";
|
|
22
155
|
export declare const botanix: Chain;
|
|
156
|
+
export declare const VIEM_CHAIN_BY_CHAIN_ID: Record<AnyChainId, Chain>;
|
|
23
157
|
export declare function getChainName(chainId: number): ChainName;
|
|
158
|
+
export declare function getChainSlug(chainId: number): ChainSlug;
|
|
159
|
+
export declare function getChainIdBySlug(slug: string): AnyChainId | undefined;
|
|
24
160
|
export declare const getViemChain: (chainId: number) => Chain;
|
|
25
161
|
export declare function getHighExecutionFee(chainId: number): any;
|
|
26
162
|
export declare function getExcessiveExecutionFee(chainId: number): any;
|
|
27
163
|
export declare function isContractsChain(chainId: number, dev?: boolean): chainId is ContractsChainId;
|
|
28
164
|
export declare function isTestnetChain(chainId: number): boolean;
|
|
29
|
-
export declare
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export declare
|
|
165
|
+
export declare function getMaxFeePerGas(chainId: ContractsChainId): bigint | undefined;
|
|
166
|
+
export declare function getGasPricePremium(chainId: ContractsChainId): bigint | undefined;
|
|
167
|
+
export declare function getMaxPriorityFeePerGas(chainId: ContractsChainId): 1500000000n | 7n;
|
|
168
|
+
export declare function getMinExecutionFeeUsd(chainId: ContractsChainId): 1000000000000000000000000000n | undefined;
|
|
169
|
+
export declare function getGasPriceBuffer(chainId: ContractsChainId): 2000n | undefined;
|
|
170
|
+
export declare function isChainDisabled(chainId: ContractsChainId): false;
|
|
171
|
+
export declare function getChainNativeTokenSymbol(chainId: ContractsChainId): "ETH" | "AVAX" | "BTC";
|
|
172
|
+
export declare function getChainWrappedTokenSymbol(chainId: ContractsChainId): "WETH" | "WAVAX" | "PBTC";
|
|
173
|
+
export declare function getChainDefaultCollateralSymbol(chainId: ContractsChainId): "USDC.e" | "USDC" | "USDC.E";
|
|
174
|
+
export declare function getExplorerUrl(chainId: number | "layerzero" | "layerzero-testnet"): string;
|
|
175
|
+
export declare function getTokenExplorerUrl(chainId: number, tokenAddress: string): string;
|
|
176
|
+
export declare function getExecutionFeeConfig(chainId: ContractsChainId): {
|
|
177
|
+
shouldUseMaxPriorityFeePerGas: boolean;
|
|
178
|
+
defaultBufferBps: number | undefined;
|
|
179
|
+
} | undefined;
|
|
@@ -31,7 +31,6 @@ export declare const CONTRACTS: {
|
|
|
31
31
|
PositionRouter: string;
|
|
32
32
|
UniswapGmxEthPool: string;
|
|
33
33
|
ReferralStorage: string;
|
|
34
|
-
Timelock: string;
|
|
35
34
|
DataStore: string;
|
|
36
35
|
EventEmitter: string;
|
|
37
36
|
SubaccountRouter: string;
|
|
@@ -94,7 +93,6 @@ export declare const CONTRACTS: {
|
|
|
94
93
|
PositionRouter: string;
|
|
95
94
|
TraderJoeGmxAvaxPool: string;
|
|
96
95
|
ReferralStorage: string;
|
|
97
|
-
Timelock: string;
|
|
98
96
|
DataStore: string;
|
|
99
97
|
EventEmitter: string;
|
|
100
98
|
SubaccountRouter: string;
|
|
@@ -233,7 +231,6 @@ export declare const CONTRACTS: {
|
|
|
233
231
|
ShiftVault: string;
|
|
234
232
|
SyntheticsReader: string;
|
|
235
233
|
SyntheticsRouter: string;
|
|
236
|
-
Timelock: "0x0000000000000000000000000000000000000000";
|
|
237
234
|
GlvReader: string;
|
|
238
235
|
GlvRouter: string;
|
|
239
236
|
GlvVault: string;
|
|
@@ -315,7 +312,6 @@ export declare const CONTRACTS: {
|
|
|
315
312
|
GlpManager: "0x0000000000000000000000000000000000000000";
|
|
316
313
|
RewardReader: "0x0000000000000000000000000000000000000000";
|
|
317
314
|
GlpRewardRouter: "0x0000000000000000000000000000000000000000";
|
|
318
|
-
Timelock: "0x0000000000000000000000000000000000000000";
|
|
319
315
|
};
|
|
320
316
|
};
|
|
321
317
|
type ExtractContractNames<T extends object> = {
|
|
@@ -6,6 +6,7 @@ export declare const SWAP_IMPACT_FACTOR_KEY: string;
|
|
|
6
6
|
export declare const SWAP_IMPACT_EXPONENT_FACTOR_KEY: string;
|
|
7
7
|
export declare const SWAP_FEE_FACTOR_KEY: string;
|
|
8
8
|
export declare const ATOMIC_SWAP_FEE_FACTOR_KEY: string;
|
|
9
|
+
export declare const WITHDRAWAL_FEE_FACTOR_KEY: string;
|
|
9
10
|
export declare const FEE_RECEIVER_DEPOSIT_FACTOR_KEY: string;
|
|
10
11
|
export declare const BORROWING_FEE_RECEIVER_FACTOR_KEY: string;
|
|
11
12
|
export declare const FEE_RECEIVER_WITHDRAWAL_FACTOR_KEY: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Token } from "../types/tokens";
|
|
2
2
|
export declare const SUBACCOUNT_MESSAGE = "Generate a GMX 1CT (One-Click Trading) session. Only sign this message on a trusted website.";
|
|
3
|
-
export declare const SUBACCOUNT_DOCS_URL = "https://docs.gmx.io/docs/trading
|
|
3
|
+
export declare const SUBACCOUNT_DOCS_URL = "https://docs.gmx.io/docs/trading/#one-click-trading";
|
|
4
4
|
export declare const DEFAULT_SUBACCOUNT_EXPIRY_DURATION: number;
|
|
5
5
|
export declare const DEFAULT_SUBACCOUNT_MAX_ALLOWED_COUNT = 90;
|
|
6
6
|
export declare const DEFAULT_PERMIT_DEADLINE_DURATION: number;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { GasLimitsConfig } from "../types/fees";
|
|
2
|
+
import { ContractsChainId } from "./chains";
|
|
3
|
+
export type StaticGasLimitsConfig = Pick<GasLimitsConfig, "createOrderGasLimit" | "updateOrderGasLimit" | "cancelOrderGasLimit" | "tokenPermitGasLimit" | "gmxAccountCollateralGasLimit">;
|
|
4
|
+
export declare const GAS_LIMITS_STATIC_CONFIG: Record<ContractsChainId, StaticGasLimitsConfig>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ERC20Address, NativeTokenSupportedAddress, Token } from "../types/tokens";
|
|
1
2
|
import { ContractsChainId } from "./chains";
|
|
2
3
|
export declare const SWAP_GRAPH_MAX_MARKETS_PER_TOKEN = 5;
|
|
3
4
|
export type MarketConfig = {
|
|
@@ -6,7 +7,15 @@ export type MarketConfig = {
|
|
|
6
7
|
longTokenAddress: string;
|
|
7
8
|
shortTokenAddress: string;
|
|
8
9
|
};
|
|
9
|
-
export
|
|
10
|
+
export type MarketsConfigMap = Record<string, MarketConfig>;
|
|
11
|
+
export declare const MARKETS: Record<ContractsChainId, MarketsConfigMap>;
|
|
10
12
|
export type MarketLabel = `${string}/USD [${string}-${string}]`;
|
|
13
|
+
export declare function getMarketsByChainId(chainId: ContractsChainId): Record<string, MarketConfig>;
|
|
11
14
|
export declare function getMarketByLabel(chainId: ContractsChainId, label: MarketLabel): MarketConfig;
|
|
12
15
|
export declare const fixTokenSymbolFromMarketLabel: (chainId: ContractsChainId, symbol: string) => string;
|
|
16
|
+
export declare function isMarketTokenAddress(chainId: number, marketTokenAddress: string): boolean;
|
|
17
|
+
export declare function getTokenAddressByMarket<T extends "long" | "short" | "index">(chainId: number, marketTokenAddress: string, tokenType: T): T extends "index" ? NativeTokenSupportedAddress | ERC20Address : ERC20Address;
|
|
18
|
+
export declare function getMarketIndexToken(chainId: number, marketTokenAddress: string): Token;
|
|
19
|
+
export declare function getTokenSymbolByMarket(chainId: number, marketTokenAddress: string, tokenType: "long" | "short" | "index"): string;
|
|
20
|
+
export declare function getIsSpotOnlyMarket(chainId: number, marketTokenAddress: string): boolean;
|
|
21
|
+
export declare function getMarketIsSameCollaterals(chainId: number, marketTokenAddress: string): boolean;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
export declare const ORACLE_FALLBACK_TRACKER_CONFIG: {
|
|
2
|
+
trackInterval: number;
|
|
3
|
+
checkTimeout: number;
|
|
4
|
+
cacheTimeout: number;
|
|
5
|
+
disableUnusedTrackingTimeout: number;
|
|
6
|
+
failuresBeforeBan: {
|
|
7
|
+
count: number;
|
|
8
|
+
window: number;
|
|
9
|
+
throttle: number;
|
|
10
|
+
};
|
|
11
|
+
setEndpointsThrottle: number;
|
|
12
|
+
delay: number;
|
|
13
|
+
};
|
|
1
14
|
export declare function getOracleKeeperUrl(chainId: number): any;
|
|
2
15
|
export declare function getOracleKeeperFallbackUrls(chainId: number): any;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Token, TokenAddressTypesMap, TokenCategory } from "../types/tokens";
|
|
2
2
|
export declare const NATIVE_TOKEN_ADDRESS: "0x0000000000000000000000000000000000000000";
|
|
3
|
+
export declare const GM_STUB_ADDRESS = "<GM-ADDRESS>";
|
|
4
|
+
export declare const GLV_STUB_ADDRESS = "<GLV-ADDRESS>";
|
|
3
5
|
export declare const TOKENS: {
|
|
4
6
|
[chainId: number]: Token[];
|
|
5
7
|
};
|
|
@@ -10,6 +12,7 @@ export declare const TOKEN_COLOR_MAP: {
|
|
|
10
12
|
PBTC: string;
|
|
11
13
|
USDC: string;
|
|
12
14
|
"USDC.E": string;
|
|
15
|
+
"USDC.SG": string;
|
|
13
16
|
USDT: string;
|
|
14
17
|
MIM: string;
|
|
15
18
|
FRAX: string;
|
|
@@ -26,7 +26,7 @@ export declare class GmxSdk {
|
|
|
26
26
|
setAccount(account: Address): void;
|
|
27
27
|
executeMulticall<T = any>(request: MulticallRequestConfig<any>): Promise<T>;
|
|
28
28
|
callContract(address: Address, abi: Abi, method: string, params: any[], opts?: CallContractOpts): Promise<string>;
|
|
29
|
-
get chainId():
|
|
29
|
+
get chainId(): 43114 | 42161 | 3637 | 43113 | 421614;
|
|
30
30
|
get chain(): import("viem").Chain;
|
|
31
31
|
get account(): string;
|
|
32
32
|
}
|
|
@@ -6,6 +6,8 @@ export declare class Markets extends Module {
|
|
|
6
6
|
private getMarketsConfigs;
|
|
7
7
|
private getMarketsConstants;
|
|
8
8
|
private _marketsData;
|
|
9
|
+
private _marketsDataOffset;
|
|
10
|
+
private _marketsDataLimit;
|
|
9
11
|
getMarkets(offset?: bigint, limit?: bigint): Promise<MarketsResult>;
|
|
10
12
|
getMarketsInfo(): Promise<MarketsInfoResult>;
|
|
11
13
|
getDailyVolumes(): Promise<Record<string, bigint> | undefined>;
|
|
@@ -34,7 +34,7 @@ export declare function buildMarketsConfigsRequest(chainId: number, { marketsDat
|
|
|
34
34
|
dataStoreAddress: string;
|
|
35
35
|
}): Promise<import("../../utils/multicall").MulticallRequestConfig<{
|
|
36
36
|
[key: `${string}-dataStore`]: {
|
|
37
|
-
calls: Record<"maxFundingFactorPerSecond" | "isDisabled" | "maxLongPoolAmount" | "maxShortPoolAmount" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForStableFunding" | "thresholdForDecreaseFunding" | "minFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "positionFeeFactorForBalanceWasImproved" | "positionFeeFactorForBalanceWasNotImproved" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "maxLendableImpactFactor" | "maxLendableImpactFactorForWithdrawals" | "maxLendableImpactUsd" | "lentPositionImpactPoolAmount" | "minCollateralFactor" | "minCollateralFactorForLiquidation" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionImpactExponentFactorPositive" | "positionImpactExponentFactorNegative" | "swapFeeFactorForBalanceWasImproved" | "swapFeeFactorForBalanceWasNotImproved" | "atomicSwapFeeFactor" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId", {
|
|
37
|
+
calls: Record<"maxFundingFactorPerSecond" | "isDisabled" | "maxLongPoolAmount" | "maxShortPoolAmount" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForStableFunding" | "thresholdForDecreaseFunding" | "minFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "positionFeeFactorForBalanceWasImproved" | "positionFeeFactorForBalanceWasNotImproved" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "maxLendableImpactFactor" | "maxLendableImpactFactorForWithdrawals" | "maxLendableImpactUsd" | "lentPositionImpactPoolAmount" | "minCollateralFactor" | "minCollateralFactorForLiquidation" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionImpactExponentFactorPositive" | "positionImpactExponentFactorNegative" | "swapFeeFactorForBalanceWasImproved" | "swapFeeFactorForBalanceWasNotImproved" | "atomicSwapFeeFactor" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "withdrawalFeeFactorBalanceWasImproved" | "withdrawalFeeFactorBalanceWasNotImproved" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId", {
|
|
38
38
|
methodName: string;
|
|
39
39
|
params: any[];
|
|
40
40
|
}>;
|
|
@@ -18,7 +18,7 @@ export type MarketValues = Pick<MarketInfo, "longInterestUsd" | "shortInterestUs
|
|
|
18
18
|
/**
|
|
19
19
|
* Updates seldom
|
|
20
20
|
*/
|
|
21
|
-
export type MarketConfig = Pick<MarketInfo, "isDisabled" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "maxLongPoolAmount" | "maxShortPoolAmount" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForDecreaseFunding" | "thresholdForStableFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "minCollateralFactor" | "minCollateralFactorForLiquidation" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionFeeFactorForBalanceWasImproved" | "positionFeeFactorForBalanceWasNotImproved" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "maxLendableImpactFactor" | "maxLendableImpactFactorForWithdrawals" | "maxLendableImpactUsd" | "lentPositionImpactPoolAmount" | "positionImpactExponentFactorPositive" | "positionImpactExponentFactorNegative" | "swapFeeFactorForBalanceWasImproved" | "swapFeeFactorForBalanceWasNotImproved" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "atomicSwapFeeFactor" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId">;
|
|
21
|
+
export type MarketConfig = Pick<MarketInfo, "isDisabled" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "maxLongPoolAmount" | "maxShortPoolAmount" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForDecreaseFunding" | "thresholdForStableFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "minCollateralFactor" | "minCollateralFactorForLiquidation" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionFeeFactorForBalanceWasImproved" | "positionFeeFactorForBalanceWasNotImproved" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "maxLendableImpactFactor" | "maxLendableImpactFactorForWithdrawals" | "maxLendableImpactUsd" | "lentPositionImpactPoolAmount" | "positionImpactExponentFactorPositive" | "positionImpactExponentFactorNegative" | "swapFeeFactorForBalanceWasImproved" | "swapFeeFactorForBalanceWasNotImproved" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "atomicSwapFeeFactor" | "withdrawalFeeFactorBalanceWasImproved" | "withdrawalFeeFactorBalanceWasNotImproved" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId">;
|
|
22
22
|
export type MarketValuesMulticallRequestConfig = MulticallRequestConfig<{
|
|
23
23
|
[key: `${string}-reader`]: {
|
|
24
24
|
calls: Record<"marketInfo" | "marketTokenPriceMax" | "marketTokenPriceMin", {
|
|
@@ -35,7 +35,7 @@ export type MarketValuesMulticallRequestConfig = MulticallRequestConfig<{
|
|
|
35
35
|
}>;
|
|
36
36
|
export type MarketConfigMulticallRequestConfig = MulticallRequestConfig<{
|
|
37
37
|
[key: `${string}-dataStore`]: {
|
|
38
|
-
calls: Record<"isDisabled" | "maxLongPoolAmount" | "maxShortPoolAmount" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForStableFunding" | "thresholdForDecreaseFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "positionFeeFactorForBalanceWasImproved" | "positionFeeFactorForBalanceWasNotImproved" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "maxLendableImpactFactor" | "maxLendableImpactFactorForWithdrawals" | "maxLendableImpactUsd" | "lentPositionImpactPoolAmount" | "minCollateralFactor" | "minCollateralFactorForLiquidation" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionImpactExponentFactorPositive" | "positionImpactExponentFactorNegative" | "swapFeeFactorForBalanceWasImproved" | "swapFeeFactorForBalanceWasNotImproved" | "atomicSwapFeeFactor" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId", {
|
|
38
|
+
calls: Record<"isDisabled" | "maxLongPoolAmount" | "maxShortPoolAmount" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForStableFunding" | "thresholdForDecreaseFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "positionFeeFactorForBalanceWasImproved" | "positionFeeFactorForBalanceWasNotImproved" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "maxLendableImpactFactor" | "maxLendableImpactFactorForWithdrawals" | "maxLendableImpactUsd" | "lentPositionImpactPoolAmount" | "minCollateralFactor" | "minCollateralFactorForLiquidation" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionImpactExponentFactorPositive" | "positionImpactExponentFactorNegative" | "swapFeeFactorForBalanceWasImproved" | "swapFeeFactorForBalanceWasNotImproved" | "atomicSwapFeeFactor" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "withdrawalFeeFactorBalanceWasImproved" | "withdrawalFeeFactorBalanceWasNotImproved" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId", {
|
|
39
39
|
methodName: string;
|
|
40
40
|
params: any[];
|
|
41
41
|
}>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { GasLimitsConfig } from "../../types/fees";
|
|
2
2
|
import { TokensData } from "../../types/tokens";
|
|
3
|
-
import type { IncreasePositionAmounts } from "../../types/trade";
|
|
4
|
-
import type { DecreasePositionAmounts, SwapAmounts, TradeFeesType } from "../../types/trade";
|
|
3
|
+
import type { DecreasePositionAmounts, IncreasePositionAmounts, SwapAmounts, TradeFeesType } from "../../types/trade";
|
|
5
4
|
import { Module } from "../base";
|
|
6
5
|
export declare class Utils extends Module {
|
|
7
6
|
private _gasLimits;
|
|
@@ -16,7 +15,7 @@ export declare class Utils extends Module {
|
|
|
16
15
|
decreaseAmounts?: DecreasePositionAmounts;
|
|
17
16
|
increaseAmounts?: IncreasePositionAmounts;
|
|
18
17
|
}): Promise<import("../../types/fees").ExecutionFee | undefined>;
|
|
19
|
-
getGasPrice(): Promise<bigint
|
|
18
|
+
getGasPrice(): Promise<bigint>;
|
|
20
19
|
private _uiFeeFactor;
|
|
21
20
|
getUiFeeFactor(): Promise<bigint>;
|
|
22
21
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type ContractsChainConfig = {
|
|
2
|
+
chainId: number;
|
|
3
|
+
name: string;
|
|
4
|
+
slug: string;
|
|
5
|
+
nativeTokenSymbol: string;
|
|
6
|
+
wrappedTokenSymbol: string;
|
|
7
|
+
defaultCollateralSymbol: string;
|
|
8
|
+
highExecutionFee: number;
|
|
9
|
+
shouldUseMaxPriorityFeePerGas: boolean;
|
|
10
|
+
defaultExecutionFeeBufferBps: number | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* added to maxPriorityFeePerGas
|
|
13
|
+
* applied to EIP-1559 transactions only
|
|
14
|
+
* is not applied to execution fee calculation
|
|
15
|
+
*/
|
|
16
|
+
maxFeePerGas: bigint | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* that was a constant value in ethers v5, after ethers v6 migration we use it as a minimum for maxPriorityFeePerGas
|
|
19
|
+
*/
|
|
20
|
+
maxPriorityFeePerGas: bigint;
|
|
21
|
+
/**
|
|
22
|
+
* added to maxPriorityFeePerGas
|
|
23
|
+
* applied to EIP-1559 transactions only
|
|
24
|
+
* is also applied to the execution fee calculation
|
|
25
|
+
*/
|
|
26
|
+
gasPricePremium: bigint | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* added to gasPrice
|
|
29
|
+
* applied to *non* EIP-1559 transactions only
|
|
30
|
+
*
|
|
31
|
+
* it is *not* applied to the execution fee calculation, and in theory it could cause issues
|
|
32
|
+
* if gas price used in the execution fee calculation is lower
|
|
33
|
+
* than the gas price used in the transaction (e.g. create order transaction)
|
|
34
|
+
* then the transaction will fail with InsufficientExecutionFee error.
|
|
35
|
+
* it is not an issue on Arbitrum though because the passed gas price does not affect the paid gas price.
|
|
36
|
+
* for example if current gas price is 0.1 gwei and UI passes 0.5 gwei the transaction
|
|
37
|
+
* Arbitrum will still charge 0.1 gwei per gas
|
|
38
|
+
*
|
|
39
|
+
* it doesn't make much sense to set this buffer higher than the execution fee buffer
|
|
40
|
+
* because if the paid gas price is higher than the gas price used in the execution fee calculation
|
|
41
|
+
* and the transaction will still fail with InsufficientExecutionFee
|
|
42
|
+
*
|
|
43
|
+
* this buffer could also cause issues on a blockchain that uses passed gas price
|
|
44
|
+
* especially if execution fee buffer and lower than gas price buffer defined bellow
|
|
45
|
+
* */
|
|
46
|
+
gasPriceBuffer: bigint | undefined;
|
|
47
|
+
excessiveExecutionFee: number;
|
|
48
|
+
minExecutionFee: bigint | undefined;
|
|
49
|
+
isDisabled?: boolean;
|
|
50
|
+
explorerUrl: string;
|
|
51
|
+
};
|
|
52
|
+
export type SourceChainConfig = {
|
|
53
|
+
chainId: number;
|
|
54
|
+
name: string;
|
|
55
|
+
slug: string;
|
|
56
|
+
explorerUrl: string;
|
|
57
|
+
};
|
|
@@ -88,6 +88,8 @@ export type MarketInfo = Market & MarketPoolTokens & {
|
|
|
88
88
|
swapImpactFactorPositive: bigint;
|
|
89
89
|
swapImpactFactorNegative: bigint;
|
|
90
90
|
swapImpactExponentFactor: bigint;
|
|
91
|
+
withdrawalFeeFactorBalanceWasImproved?: bigint;
|
|
92
|
+
withdrawalFeeFactorBalanceWasNotImproved?: bigint;
|
|
91
93
|
borrowingFactorPerSecondForLongs: bigint;
|
|
92
94
|
borrowingFactorPerSecondForShorts: bigint;
|
|
93
95
|
fundingFactorPerSecond: bigint;
|
|
@@ -15,10 +15,16 @@ export declare enum OrderType {
|
|
|
15
15
|
export type SwapOrderType = OrderType.MarketSwap | OrderType.LimitSwap;
|
|
16
16
|
export type IncreaseOrderType = OrderType.MarketIncrease | OrderType.LimitIncrease | OrderType.StopIncrease;
|
|
17
17
|
export type DecreaseOrderType = OrderType.MarketDecrease | OrderType.LimitDecrease | OrderType.StopLossDecrease;
|
|
18
|
+
/**
|
|
19
|
+
* @see https://github.com/gmx-io/gmx-synthetics/blob/a54f774198d79954d66d694af1be479bb6da61f1/contracts/pricing/ISwapPricingUtils.sol#L5
|
|
20
|
+
*/
|
|
18
21
|
export declare enum SwapPricingType {
|
|
19
|
-
|
|
22
|
+
Swap = 0,
|
|
20
23
|
Shift = 1,
|
|
21
|
-
|
|
24
|
+
AtomicWithdrawal = 2,
|
|
25
|
+
Deposit = 3,
|
|
26
|
+
Withdrawal = 4,
|
|
27
|
+
AtomicSwap = 5
|
|
22
28
|
}
|
|
23
29
|
export declare enum DecreasePositionSwapType {
|
|
24
30
|
NoSwap = 0,
|