@gmx-io/sdk 1.4.0 → 1.4.2

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.
Files changed (157) hide show
  1. package/build/cjs/src/abis/GlvReader.js +940 -940
  2. package/build/cjs/src/abis/IStargate.js +603 -0
  3. package/build/cjs/src/abis/LayerZeroProvider.js +273 -46
  4. package/build/cjs/src/abis/index.js +2 -2
  5. package/build/cjs/src/configs/batch.js +29 -103
  6. package/build/cjs/src/configs/chainIds.js +2 -2
  7. package/build/cjs/src/configs/chains.js +230 -151
  8. package/build/cjs/src/configs/contracts.js +1 -5
  9. package/build/cjs/src/configs/dataStore.js +5 -4
  10. package/build/cjs/src/configs/express.js +1 -1
  11. package/build/cjs/src/configs/gasLimits.js +41 -0
  12. package/build/cjs/src/configs/markets.js +102 -1
  13. package/build/cjs/src/configs/multichain.js +1 -0
  14. package/build/cjs/src/configs/oracleKeeper.js +18 -20
  15. package/build/cjs/src/configs/tokens.js +98 -180
  16. package/build/cjs/src/modules/markets/index.js +6 -2
  17. package/build/cjs/src/modules/markets/markets.spec.js +5 -5
  18. package/build/cjs/src/modules/markets/query-builders.js +8 -0
  19. package/build/cjs/src/modules/orders/helpers.js +4 -2
  20. package/build/cjs/src/modules/orders/helpers.spec.js +1 -1
  21. package/build/cjs/src/modules/orders/orders.spec.js +1 -1
  22. package/build/cjs/src/modules/positions/positions.spec.js +2 -2
  23. package/build/cjs/src/modules/tokens/tokens.spec.js +2 -2
  24. package/build/cjs/src/modules/trades/trades.spec.js +1 -1
  25. package/build/cjs/src/modules/utils/utils.js +7 -6
  26. package/build/cjs/src/prebuilt/hashedKinkModelMarketRatesKeys.json +64 -0
  27. package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +780 -0
  28. package/build/cjs/src/prebuilt/hashedMarketValuesKeys.json +120 -0
  29. package/build/cjs/src/test/mock.js +2 -0
  30. package/build/cjs/src/types/chains.js +2 -0
  31. package/build/cjs/src/types/orders.js +8 -2
  32. package/build/cjs/src/types/subsquid.js +241 -1
  33. package/build/cjs/src/types/tokens.js +7 -0
  34. package/build/cjs/src/utils/__tests__/abort.spec.js +122 -0
  35. package/build/cjs/src/utils/__tests__/numbers.spec.js +94 -14
  36. package/build/cjs/src/utils/abort.js +31 -0
  37. package/build/cjs/src/utils/callContract.js +4 -4
  38. package/build/cjs/src/utils/fees/executionFee.js +14 -11
  39. package/build/cjs/src/utils/fees/index.js +8 -2
  40. package/build/cjs/src/utils/marketKeysAndConfigs.js +8 -0
  41. package/build/cjs/src/utils/markets.js +7 -1
  42. package/build/cjs/src/utils/multicall.js +54 -17
  43. package/build/cjs/src/utils/numbers.js +25 -14
  44. package/build/cjs/src/utils/orders.js +2 -2
  45. package/build/cjs/src/utils/swap/__tests__/findSwapPathsBetweenTokens.spec.js +22 -0
  46. package/build/cjs/src/utils/swap/__tests__/mockRouting.spec.js +264 -6
  47. package/build/cjs/src/utils/swap/__tests__/swapRouting.spec.js +5 -4
  48. package/build/cjs/src/utils/swap/__tests__/swapStats.spec.js +10 -9
  49. package/build/cjs/src/utils/swap/buildSwapStrategy.js +20 -11
  50. package/build/cjs/src/utils/swap/findSwapPathsBetweenTokens.js +8 -4
  51. package/build/cjs/src/utils/swap/swapPath.js +6 -6
  52. package/build/cjs/src/utils/swap/swapRouting.js +8 -4
  53. package/build/cjs/src/utils/swap/swapStats.js +6 -6
  54. package/build/cjs/src/utils/swap/swapValues.js +17 -6
  55. package/build/cjs/src/utils/tokens.js +17 -1
  56. package/build/cjs/src/utils/trade/decrease.js +1 -1
  57. package/build/cjs/src/utils/trade/increase.js +3 -0
  58. package/build/esm/src/abis/GlvReader.js +940 -940
  59. package/build/esm/src/abis/IStargate.js +601 -0
  60. package/build/esm/src/abis/LayerZeroProvider.js +273 -46
  61. package/build/esm/src/abis/index.js +2 -2
  62. package/build/esm/src/configs/batch.js +30 -104
  63. package/build/esm/src/configs/chainIds.js +1 -1
  64. package/build/esm/src/configs/chains.js +212 -147
  65. package/build/esm/src/configs/contracts.js +1 -5
  66. package/build/esm/src/configs/dataStore.js +1 -0
  67. package/build/esm/src/configs/express.js +1 -1
  68. package/build/esm/src/configs/gasLimits.js +38 -0
  69. package/build/esm/src/configs/markets.js +95 -1
  70. package/build/esm/src/configs/multichain.js +2 -1
  71. package/build/esm/src/configs/oracleKeeper.js +17 -19
  72. package/build/esm/src/configs/tokens.js +97 -179
  73. package/build/esm/src/modules/markets/index.js +6 -2
  74. package/build/esm/src/modules/markets/markets.spec.js +5 -5
  75. package/build/esm/src/modules/markets/query-builders.js +8 -0
  76. package/build/esm/src/modules/orders/helpers.js +5 -3
  77. package/build/esm/src/modules/orders/helpers.spec.js +1 -1
  78. package/build/esm/src/modules/orders/orders.spec.js +1 -1
  79. package/build/esm/src/modules/positions/positions.spec.js +2 -2
  80. package/build/esm/src/modules/tokens/tokens.spec.js +2 -2
  81. package/build/esm/src/modules/trades/trades.spec.js +1 -1
  82. package/build/esm/src/modules/utils/utils.js +7 -6
  83. package/build/esm/src/prebuilt/hashedKinkModelMarketRatesKeys.json +64 -0
  84. package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +780 -0
  85. package/build/esm/src/prebuilt/hashedMarketValuesKeys.json +120 -0
  86. package/build/esm/src/test/mock.js +2 -0
  87. package/build/esm/src/types/chains.js +1 -0
  88. package/build/esm/src/types/orders.js +8 -2
  89. package/build/esm/src/types/subsquid.js +240 -0
  90. package/build/esm/src/types/tokens.js +6 -1
  91. package/build/esm/src/utils/__tests__/abort.spec.js +120 -0
  92. package/build/esm/src/utils/__tests__/numbers.spec.js +95 -15
  93. package/build/esm/src/utils/abort.js +27 -0
  94. package/build/esm/src/utils/callContract.js +5 -5
  95. package/build/esm/src/utils/fees/executionFee.js +15 -12
  96. package/build/esm/src/utils/fees/index.js +8 -2
  97. package/build/esm/src/utils/marketKeysAndConfigs.js +9 -1
  98. package/build/esm/src/utils/markets.js +5 -0
  99. package/build/esm/src/utils/multicall.js +53 -16
  100. package/build/esm/src/utils/numbers.js +21 -12
  101. package/build/esm/src/utils/orders.js +3 -3
  102. package/build/esm/src/utils/swap/__tests__/findSwapPathsBetweenTokens.spec.js +22 -0
  103. package/build/esm/src/utils/swap/__tests__/mockRouting.spec.js +264 -6
  104. package/build/esm/src/utils/swap/__tests__/swapRouting.spec.js +5 -4
  105. package/build/esm/src/utils/swap/__tests__/swapStats.spec.js +10 -9
  106. package/build/esm/src/utils/swap/buildSwapStrategy.js +21 -12
  107. package/build/esm/src/utils/swap/findSwapPathsBetweenTokens.js +8 -4
  108. package/build/esm/src/utils/swap/swapPath.js +6 -6
  109. package/build/esm/src/utils/swap/swapRouting.js +8 -4
  110. package/build/esm/src/utils/swap/swapStats.js +6 -6
  111. package/build/esm/src/utils/swap/swapValues.js +18 -7
  112. package/build/esm/src/utils/tokens.js +15 -1
  113. package/build/esm/src/utils/trade/decrease.js +2 -2
  114. package/build/esm/src/utils/trade/increase.js +3 -0
  115. package/build/types/src/abis/IStargate.d.ts +464 -0
  116. package/build/types/src/abis/LayerZeroProvider.d.ts +12 -0
  117. package/build/types/src/abis/index.d.ts +475 -99
  118. package/build/types/src/configs/chainIds.d.ts +1 -1
  119. package/build/types/src/configs/chains.d.ts +170 -27
  120. package/build/types/src/configs/contracts.d.ts +0 -4
  121. package/build/types/src/configs/dataStore.d.ts +1 -0
  122. package/build/types/src/configs/express.d.ts +1 -1
  123. package/build/types/src/configs/gasLimits.d.ts +4 -0
  124. package/build/types/src/configs/markets.d.ts +10 -1
  125. package/build/types/src/configs/oracleKeeper.d.ts +13 -0
  126. package/build/types/src/configs/tokens.d.ts +3 -0
  127. package/build/types/src/index.d.ts +1 -1
  128. package/build/types/src/modules/base.d.ts +1 -1
  129. package/build/types/src/modules/markets/index.d.ts +2 -0
  130. package/build/types/src/modules/markets/query-builders.d.ts +1 -1
  131. package/build/types/src/modules/markets/types.d.ts +2 -2
  132. package/build/types/src/modules/utils/utils.d.ts +2 -3
  133. package/build/types/src/types/chains.d.ts +57 -0
  134. package/build/types/src/types/markets.d.ts +2 -0
  135. package/build/types/src/types/orders.d.ts +8 -2
  136. package/build/types/src/types/subsquid.d.ts +5987 -5172
  137. package/build/types/src/types/tokens.d.ts +11 -6
  138. package/build/types/src/types/trade.d.ts +5 -0
  139. package/build/types/src/utils/__tests__/abort.spec.d.ts +1 -0
  140. package/build/types/src/utils/abort.d.ts +1 -0
  141. package/build/types/src/utils/fees/estimateOraclePriceCount.d.ts +2 -2
  142. package/build/types/src/utils/fees/executionFee.d.ts +6 -6
  143. package/build/types/src/utils/fees/index.d.ts +2 -1
  144. package/build/types/src/utils/marketKeysAndConfigs.d.ts +2 -0
  145. package/build/types/src/utils/markets.d.ts +4 -2
  146. package/build/types/src/utils/multicall.d.ts +4 -2
  147. package/build/types/src/utils/numbers.d.ts +8 -1
  148. package/build/types/src/utils/swap/buildSwapStrategy.d.ts +8 -3
  149. package/build/types/src/utils/swap/swapPath.d.ts +2 -1
  150. package/build/types/src/utils/swap/swapRouting.d.ts +7 -2
  151. package/build/types/src/utils/swap/swapStats.d.ts +3 -2
  152. package/build/types/src/utils/swap/swapValues.d.ts +3 -1
  153. package/build/types/src/utils/tokens.d.ts +3 -0
  154. package/package.json +17 -5
  155. package/build/cjs/src/abis/MultichainUtils.js +0 -133
  156. package/build/esm/src/abis/MultichainUtils.js +0 -131
  157. package/build/types/src/abis/MultichainUtils.d.ts +0 -100
@@ -1,36 +1,179 @@
1
1
  import { Chain } from "viem/chains";
2
- import type { GasLimitsConfig } from "../types/fees";
3
- import { AVALANCHE, AVALANCHE_FUJI, ARBITRUM, BOTANIX, ETH_MAINNET, ARBITRUM_SEPOLIA, SOURCE_OPTIMISM_SEPOLIA, SOURCE_SEPOLIA, SOURCE_BASE_MAINNET, SOURCE_BSC_MAINNET } from "./chainIds";
4
- export { AVALANCHE, AVALANCHE_FUJI, ARBITRUM, BOTANIX, ETH_MAINNET, ARBITRUM_SEPOLIA, SOURCE_OPTIMISM_SEPOLIA, SOURCE_SEPOLIA, SOURCE_BASE_MAINNET, SOURCE_BSC_MAINNET, };
5
- export declare const CONTRACTS_CHAIN_IDS: ContractsChainId[];
6
- export declare const CONTRACTS_CHAIN_IDS_DEV: ContractsChainId[];
7
- export type ContractsChainId = typeof ARBITRUM | typeof AVALANCHE | typeof AVALANCHE_FUJI | typeof BOTANIX | typeof ARBITRUM_SEPOLIA;
8
- export type ContractsChainIdProduction = Exclude<ContractsChainId, typeof AVALANCHE_FUJI | typeof ARBITRUM_SEPOLIA>;
9
- export type SettlementChainId = typeof ARBITRUM_SEPOLIA | typeof ARBITRUM | typeof AVALANCHE;
10
- export type SourceChainId = typeof SOURCE_OPTIMISM_SEPOLIA | typeof SOURCE_SEPOLIA | typeof SOURCE_BASE_MAINNET | typeof SOURCE_BSC_MAINNET;
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
- export type ChainName = "Arbitrum" | "Avalanche" | "Avalanche Fuji" | "Arbitrum Sepolia" | "Optimism Sepolia" | "Sepolia" | "Botanix" | "Base" | "BNB";
13
- export declare const CHAIN_NAMES_MAP: Record<AnyChainId, ChainName>;
14
- export declare const CHAIN_SLUGS_MAP: Record<ContractsChainId, string>;
15
- export declare const HIGH_EXECUTION_FEES_MAP: Record<ContractsChainId, number>;
16
- export declare const MAX_FEE_PER_GAS_MAP: Record<number, bigint>;
17
- export declare const GAS_PRICE_PREMIUM_MAP: Record<number, bigint>;
18
- export declare const MAX_PRIORITY_FEE_PER_GAS_MAP: Record<ContractsChainId, bigint | undefined>;
19
- export declare const EXCESSIVE_EXECUTION_FEES_MAP: Partial<Record<ContractsChainId, number>>;
20
- export declare const MIN_EXECUTION_FEE_USD: Partial<Record<ContractsChainId, bigint | undefined>>;
21
- export declare const GAS_PRICE_BUFFER_MAP: Record<number, bigint>;
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 const EXECUTION_FEE_CONFIG_V2: {
30
- [chainId in ContractsChainId]: {
31
- shouldUseMaxPriorityFeePerGas: boolean;
32
- defaultBufferBps?: number;
33
- };
34
- };
35
- type StaticGasLimitsConfig = Pick<GasLimitsConfig, "createOrderGasLimit" | "updateOrderGasLimit" | "cancelOrderGasLimit" | "tokenPermitGasLimit" | "gmxAccountCollateralGasLimit">;
36
- export declare const GAS_LIMITS_STATIC_CONFIG: Record<ContractsChainId, StaticGasLimitsConfig>;
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/v2/#one-click-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 declare const MARKETS: Record<ContractsChainId, Record<string, MarketConfig>>;
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(): import("./configs/chains").ContractsChainId;
29
+ get chainId(): 43114 | 42161 | 3637 | 43113 | 421614;
30
30
  get chain(): import("viem").Chain;
31
31
  get account(): string;
32
32
  }
@@ -3,6 +3,6 @@ export declare class Module {
3
3
  sdk: GmxSdk;
4
4
  constructor(sdk: GmxSdk);
5
5
  get oracle(): import("./oracle").Oracle;
6
- get chainId(): import("../configs/chains").ContractsChainId;
6
+ get chainId(): 43114 | 42161 | 3637 | 43113 | 421614;
7
7
  get account(): string;
8
8
  }
@@ -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 | undefined>;
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
- TwoStep = 0,
22
+ Swap = 0,
20
23
  Shift = 1,
21
- Atomic = 2
24
+ AtomicWithdrawal = 2,
25
+ Deposit = 3,
26
+ Withdrawal = 4,
27
+ AtomicSwap = 5
22
28
  }
23
29
  export declare enum DecreasePositionSwapType {
24
30
  NoSwap = 0,