@gmx-io/sdk 1.5.0-alpha-8 → 1.5.0-alpha-10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/scripts/subsquid-codegen.js +1 -1
- package/build/cjs/src/clients/v1/testUtil.js +1 -1
- package/build/cjs/src/clients/v2/__tests__/data.spec.js +85 -0
- package/build/cjs/src/clients/v2/__tests__/decrease.spec.js +471 -0
- package/build/cjs/src/clients/v2/__tests__/editCancel.spec.js +259 -0
- package/build/cjs/src/clients/v2/__tests__/errors.spec.js +261 -0
- package/build/cjs/src/clients/v2/__tests__/increase.spec.js +764 -0
- package/build/cjs/src/clients/v2/__tests__/subaccount.spec.js +74 -0
- package/build/cjs/src/clients/v2/__tests__/swap.spec.js +192 -0
- package/build/cjs/src/clients/v2/__tests__/testUtil.js +136 -0
- package/build/cjs/src/clients/v2/index.js +164 -25
- package/build/cjs/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +82 -0
- package/build/cjs/src/codegen/prebuilt/hashedMarketConfigKeys.json +572 -0
- package/build/cjs/src/codegen/prebuilt/hashedMarketValuesKeys.json +152 -0
- package/build/cjs/src/codegen/subsquid.js +323 -1
- package/build/cjs/src/configs/__tests__/tokens.spec.js +1 -0
- package/build/cjs/src/configs/api.js +4 -3
- package/build/cjs/src/configs/batch.js +13 -0
- package/build/cjs/src/configs/chainIds.js +2 -1
- package/build/cjs/src/configs/chains.js +59 -3
- package/build/cjs/src/configs/contracts.js +73 -6
- package/build/cjs/src/configs/express.js +2 -0
- package/build/cjs/src/configs/gasLimits.js +7 -0
- package/build/cjs/src/configs/markets.js +86 -2
- package/build/cjs/src/configs/oracleKeeper.js +2 -0
- package/build/cjs/src/configs/tokens.js +151 -132
- package/build/cjs/src/test/mock.js +1 -1
- package/build/cjs/src/utils/__tests__/markets.spec.js +10 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +4 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +4 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/swapOrders.spec.js +2 -0
- package/build/cjs/src/utils/__tests__/positions.spec.js +59 -7
- package/build/cjs/src/utils/__tests__/uiFeeReceiver.spec.js +58 -0
- package/build/cjs/src/utils/balances/api.js +65 -0
- package/build/cjs/src/utils/buyback/api.js +7 -0
- package/build/cjs/src/utils/buyback/types.js +2 -0
- package/build/cjs/src/utils/errors/index.js +1 -0
- package/build/cjs/src/utils/errors/isIgnoredEstimateGasError.js +23 -0
- package/build/cjs/src/utils/errors/parseError.js +3 -0
- package/build/cjs/src/utils/express/index.js +18 -0
- package/build/cjs/src/utils/express/types.js +2 -0
- package/build/cjs/src/utils/express/utils/batchOrderUtils.js +218 -0
- package/build/cjs/src/utils/express/utils/bridgeOutUtils.js +73 -0
- package/build/cjs/src/utils/express/utils/estimateExpressParams.js +244 -0
- package/build/cjs/src/utils/express/utils/expressParamsUtils.js +22 -0
- package/build/cjs/src/utils/express/utils/fetchGelatoGasTankBalance.js +13 -0
- package/build/cjs/src/utils/express/utils/gelatoRelayUtils.js +77 -0
- package/build/cjs/src/utils/express/utils/globalExpressParams.js +40 -0
- package/build/cjs/src/utils/express/utils/index.js +27 -0
- package/build/cjs/src/utils/express/utils/oracleParamsUtils.js +49 -0
- package/build/cjs/src/utils/express/utils/referralUtils.js +35 -0
- package/build/cjs/src/utils/express/utils/relayParamsUtils.js +208 -0
- package/build/cjs/src/utils/fees/priceImpact.js +1 -2
- package/build/cjs/src/utils/http/http.js +86 -13
- package/build/cjs/src/utils/markets/utils.js +8 -0
- package/build/cjs/src/utils/metrics/index.js +7 -0
- package/build/cjs/src/utils/numbers/utils.js +29 -27
- package/build/cjs/src/utils/orderTransactions/api.js +88 -0
- package/build/cjs/src/utils/orderTransactions/index.js +2 -0
- package/build/cjs/src/utils/orderTransactions/simulation.js +141 -0
- package/build/cjs/src/utils/orderTransactions/utils.js +4 -1
- package/build/cjs/src/utils/orderTransactions/validateTypedData.js +100 -0
- package/build/cjs/src/utils/positions/utils.js +5 -19
- package/build/cjs/src/utils/rpc/createViemRpc.js +39 -0
- package/build/cjs/src/utils/rpc/index.js +5 -0
- package/build/cjs/src/utils/signer/index.js +5 -0
- package/build/cjs/src/utils/signer/privateKeySigner.js +42 -0
- package/build/cjs/src/utils/staking/api.js +11 -0
- package/build/cjs/src/utils/staking/types.js +2 -0
- package/build/cjs/src/utils/subaccount/api.js +22 -0
- package/build/cjs/src/utils/subaccount/generateSubaccount.js +19 -0
- package/build/cjs/src/utils/subaccount/getEmptySubaccountApproval.js +24 -0
- package/build/cjs/src/utils/subaccount/getSubaccountApprovalTypedData.js +51 -0
- package/build/cjs/src/utils/subaccount/hashSubaccountApproval.js +28 -0
- package/build/cjs/src/utils/subaccount/index.js +30 -0
- package/build/cjs/src/utils/subaccount/types.js +2 -0
- package/build/cjs/src/utils/swap/swapPath.js +4 -1
- package/build/cjs/src/utils/trade/decrease.js +131 -6
- package/build/cjs/src/utils/trade/increase.js +2 -6
- package/build/cjs/src/utils/trade/types.js +1 -1
- package/build/cjs/src/utils/tradeHistory/utils.js +14 -28
- package/build/cjs/src/utils/twap/index.js +4 -1
- package/build/cjs/src/utils/twap/uiFeeReceiver.js +46 -14
- package/build/esm/scripts/subsquid-codegen.js +1 -1
- package/build/esm/src/clients/v1/testUtil.js +1 -1
- package/build/esm/src/clients/v2/__tests__/data.spec.js +83 -0
- package/build/esm/src/clients/v2/__tests__/decrease.spec.js +469 -0
- package/build/esm/src/clients/v2/__tests__/editCancel.spec.js +257 -0
- package/build/esm/src/clients/v2/__tests__/errors.spec.js +259 -0
- package/build/esm/src/clients/v2/__tests__/increase.spec.js +762 -0
- package/build/esm/src/clients/v2/__tests__/subaccount.spec.js +72 -0
- package/build/esm/src/clients/v2/__tests__/swap.spec.js +190 -0
- package/build/esm/src/clients/v2/__tests__/testUtil.js +124 -0
- package/build/esm/src/clients/v2/index.js +140 -4
- package/build/esm/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +82 -0
- package/build/esm/src/codegen/prebuilt/hashedMarketConfigKeys.json +572 -0
- package/build/esm/src/codegen/prebuilt/hashedMarketValuesKeys.json +152 -0
- package/build/esm/src/codegen/subsquid.js +321 -0
- package/build/esm/src/configs/__tests__/tokens.spec.js +2 -1
- package/build/esm/src/configs/api.js +5 -4
- package/build/esm/src/configs/batch.js +14 -1
- package/build/esm/src/configs/chainIds.js +1 -0
- package/build/esm/src/configs/chains.js +59 -4
- package/build/esm/src/configs/contracts.js +74 -7
- package/build/esm/src/configs/express.js +3 -1
- package/build/esm/src/configs/gasLimits.js +8 -1
- package/build/esm/src/configs/markets.js +86 -2
- package/build/esm/src/configs/oracleKeeper.js +3 -1
- package/build/esm/src/configs/tokens.js +151 -131
- package/build/esm/src/test/mock.js +1 -1
- package/build/esm/src/utils/__tests__/markets.spec.js +10 -0
- package/build/esm/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +4 -0
- package/build/esm/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +4 -0
- package/build/esm/src/utils/__tests__/orderTransactions/swapOrders.spec.js +2 -0
- package/build/esm/src/utils/__tests__/positions.spec.js +60 -8
- package/build/esm/src/utils/__tests__/uiFeeReceiver.spec.js +59 -1
- package/build/esm/src/utils/balances/api.js +56 -0
- package/build/esm/src/utils/buyback/api.js +3 -0
- package/build/esm/src/utils/buyback/types.js +1 -0
- package/build/esm/src/utils/errors/index.js +1 -0
- package/build/esm/src/utils/errors/isIgnoredEstimateGasError.js +19 -0
- package/build/esm/src/utils/errors/parseError.js +3 -0
- package/build/esm/src/utils/express/index.js +2 -0
- package/build/esm/src/utils/express/types.js +1 -0
- package/build/esm/src/utils/express/utils/batchOrderUtils.js +210 -0
- package/build/esm/src/utils/express/utils/bridgeOutUtils.js +69 -0
- package/build/esm/src/utils/express/utils/estimateExpressParams.js +238 -0
- package/build/esm/src/utils/express/utils/expressParamsUtils.js +16 -0
- package/build/esm/src/utils/express/utils/fetchGelatoGasTankBalance.js +9 -0
- package/build/esm/src/utils/express/utils/gelatoRelayUtils.js +71 -0
- package/build/esm/src/utils/express/utils/globalExpressParams.js +36 -0
- package/build/esm/src/utils/express/utils/index.js +11 -0
- package/build/esm/src/utils/express/utils/oracleParamsUtils.js +42 -0
- package/build/esm/src/utils/express/utils/referralUtils.js +30 -0
- package/build/esm/src/utils/express/utils/relayParamsUtils.js +198 -0
- package/build/esm/src/utils/fees/priceImpact.js +1 -2
- package/build/esm/src/utils/http/http.js +84 -12
- package/build/esm/src/utils/markets/utils.js +8 -0
- package/build/esm/src/utils/metrics/index.js +4 -0
- package/build/esm/src/utils/numbers/utils.js +25 -24
- package/build/esm/src/utils/orderTransactions/api.js +77 -0
- package/build/esm/src/utils/orderTransactions/index.js +2 -0
- package/build/esm/src/utils/orderTransactions/simulation.js +136 -0
- package/build/esm/src/utils/orderTransactions/utils.js +4 -1
- package/build/esm/src/utils/orderTransactions/validateTypedData.js +95 -0
- package/build/esm/src/utils/positions/utils.js +5 -19
- package/build/esm/src/utils/rpc/createViemRpc.js +35 -0
- package/build/esm/src/utils/rpc/index.js +1 -0
- package/build/esm/src/utils/signer/index.js +1 -0
- package/build/esm/src/utils/signer/privateKeySigner.js +38 -0
- package/build/esm/src/utils/staking/api.js +7 -0
- package/build/esm/src/utils/staking/types.js +1 -0
- package/build/esm/src/utils/subaccount/api.js +16 -0
- package/build/esm/src/utils/subaccount/generateSubaccount.js +15 -0
- package/build/esm/src/utils/subaccount/getEmptySubaccountApproval.js +20 -0
- package/build/esm/src/utils/subaccount/getSubaccountApprovalTypedData.js +47 -0
- package/build/esm/src/utils/subaccount/hashSubaccountApproval.js +24 -0
- package/build/esm/src/utils/subaccount/index.js +6 -0
- package/build/esm/src/utils/subaccount/types.js +1 -0
- package/build/esm/src/utils/swap/swapPath.js +5 -2
- package/build/esm/src/utils/trade/decrease.js +127 -7
- package/build/esm/src/utils/trade/increase.js +3 -7
- package/build/esm/src/utils/trade/types.js +1 -1
- package/build/esm/src/utils/tradeHistory/utils.js +13 -26
- package/build/esm/src/utils/twap/index.js +1 -0
- package/build/esm/src/utils/twap/uiFeeReceiver.js +42 -13
- package/build/types/src/clients/v1/index.d.ts +1 -1
- package/build/types/src/clients/v1/modules/base.d.ts +1 -1
- package/build/types/src/clients/v1/multicall.d.ts +1 -1
- package/build/types/src/clients/v2/__tests__/data.spec.d.ts +1 -0
- package/build/types/src/clients/v2/__tests__/decrease.spec.d.ts +1 -0
- package/build/types/src/clients/v2/__tests__/editCancel.spec.d.ts +1 -0
- package/build/types/src/clients/v2/__tests__/errors.spec.d.ts +1 -0
- package/build/types/src/clients/v2/__tests__/increase.spec.d.ts +1 -0
- package/build/types/src/clients/v2/__tests__/subaccount.spec.d.ts +1 -0
- package/build/types/src/clients/v2/__tests__/swap.spec.d.ts +1 -0
- package/build/types/src/clients/v2/__tests__/testUtil.d.ts +25 -0
- package/build/types/src/clients/v2/index.d.ts +64 -1
- package/build/types/src/codegen/prebuilt/index.d.ts +960 -154
- package/build/types/src/codegen/subsquid.d.ts +1276 -44
- package/build/types/src/configs/chainIds.d.ts +1 -0
- package/build/types/src/configs/chains.d.ts +36 -7
- package/build/types/src/configs/contracts.d.ts +69 -5
- package/build/types/src/configs/markets.d.ts +5 -0
- package/build/types/src/configs/tokens.d.ts +6 -1
- package/build/types/src/utils/balances/api.d.ts +39 -0
- package/build/types/src/utils/buyback/api.d.ts +5 -0
- package/build/types/src/utils/buyback/types.d.ts +15 -0
- package/build/types/src/utils/chains/types.d.ts +1 -0
- package/build/types/src/utils/errors/index.d.ts +1 -0
- package/build/types/src/utils/errors/isIgnoredEstimateGasError.d.ts +2 -0
- package/build/types/src/utils/errors/parseError.d.ts +3 -0
- package/build/types/src/utils/express/index.d.ts +2 -0
- package/build/types/src/utils/express/types.d.ts +95 -0
- package/build/types/src/utils/express/utils/batchOrderUtils.d.ts +98 -0
- package/build/types/src/utils/express/utils/bridgeOutUtils.d.ts +21 -0
- package/build/types/src/utils/express/utils/estimateExpressParams.d.ts +37 -0
- package/build/types/src/utils/express/utils/expressParamsUtils.d.ts +19 -0
- package/build/types/src/utils/express/utils/fetchGelatoGasTankBalance.d.ts +5 -0
- package/build/types/src/utils/express/utils/gelatoRelayUtils.d.ts +25 -0
- package/build/types/src/utils/express/utils/globalExpressParams.d.ts +31 -0
- package/build/types/src/utils/express/utils/index.d.ts +11 -0
- package/build/types/src/utils/express/utils/oracleParamsUtils.d.ts +10 -0
- package/build/types/src/utils/express/utils/referralUtils.d.ts +17 -0
- package/build/types/src/utils/express/utils/relayParamsUtils.d.ts +63 -0
- package/build/types/src/utils/http/http.d.ts +16 -1
- package/build/types/src/utils/http/types.d.ts +3 -0
- package/build/types/src/utils/metrics/index.d.ts +4 -0
- package/build/types/src/utils/numbers/utils.d.ts +2 -5
- package/build/types/src/utils/orderTransactions/api.d.ts +158 -0
- package/build/types/src/utils/orderTransactions/index.d.ts +2 -0
- package/build/types/src/utils/orderTransactions/simulation.d.ts +26 -0
- package/build/types/src/utils/orderTransactions/validateTypedData.d.ts +6 -0
- package/build/types/src/utils/positions/utils.d.ts +1 -9
- package/build/types/src/utils/rpc/createViemRpc.d.ts +3 -0
- package/build/types/src/utils/rpc/index.d.ts +26 -0
- package/build/types/src/utils/signer/index.d.ts +23 -0
- package/build/types/src/utils/signer/privateKeySigner.d.ts +19 -0
- package/build/types/src/utils/staking/api.d.ts +7 -0
- package/build/types/src/utils/staking/types.d.ts +14 -0
- package/build/types/src/utils/subaccount/api.d.ts +50 -0
- package/build/types/src/utils/subaccount/generateSubaccount.d.ts +8 -0
- package/build/types/src/utils/subaccount/getEmptySubaccountApproval.d.ts +9 -0
- package/build/types/src/utils/subaccount/getSubaccountApprovalTypedData.d.ts +24 -0
- package/build/types/src/utils/subaccount/hashSubaccountApproval.d.ts +1 -0
- package/build/types/src/utils/subaccount/index.d.ts +7 -0
- package/build/types/src/utils/subaccount/types.d.ts +55 -0
- package/build/types/src/utils/tokens/types.d.ts +0 -1
- package/build/types/src/utils/trade/decrease.d.ts +41 -2
- package/build/types/src/utils/trade/types.d.ts +9 -1
- package/build/types/src/utils/tradeHistory/utils.d.ts +0 -1
- package/build/types/src/utils/twap/index.d.ts +1 -0
- package/build/types/src/utils/twap/types.d.ts +2 -0
- package/build/types/src/utils/twap/uiFeeReceiver.d.ts +18 -7
- package/package.json +40 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const AVALANCHE = 43114;
|
|
2
2
|
export declare const ARBITRUM = 42161;
|
|
3
3
|
export declare const BOTANIX = 3637;
|
|
4
|
+
export declare const MEGAETH = 4326;
|
|
4
5
|
export declare const SOURCE_ETHEREUM_MAINNET = 1;
|
|
5
6
|
export declare const SOURCE_BASE_MAINNET = 8453;
|
|
6
7
|
export declare const SOURCE_BSC_MAINNET = 56;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Chain } from "viem/chains";
|
|
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];
|
|
2
|
+
import { ARBITRUM, ARBITRUM_SEPOLIA, AVALANCHE, AVALANCHE_FUJI, BOTANIX, MEGAETH, SOURCE_ETHEREUM_MAINNET, SOURCE_BASE_MAINNET, SOURCE_BSC_MAINNET, SOURCE_OPTIMISM_SEPOLIA, SOURCE_SEPOLIA } from "./chainIds";
|
|
3
|
+
export { ARBITRUM, AVALANCHE, AVALANCHE_FUJI, BOTANIX, MEGAETH, 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, 4326];
|
|
5
|
+
export declare const CONTRACTS_CHAIN_IDS_DEV: readonly [42161, 43114, 3637, 4326, 43113, 421614];
|
|
6
6
|
export declare const SETTLEMENT_CHAIN_IDS: readonly [42161, 43114];
|
|
7
7
|
export declare const SETTLEMENT_CHAIN_IDS_DEV: readonly [42161, 43114, 421614, 43113];
|
|
8
8
|
export declare const SOURCE_CHAIN_IDS: readonly [11155420, 11155111, 8453, 56, 1, 421614, 42161, 43114, 43113];
|
|
@@ -113,6 +113,25 @@ declare const CONTRACTS_CHAIN_CONFIGS: {
|
|
|
113
113
|
readonly gasPriceBuffer: undefined;
|
|
114
114
|
readonly isDisabled: false;
|
|
115
115
|
};
|
|
116
|
+
readonly 4326: {
|
|
117
|
+
readonly chainId: 4326;
|
|
118
|
+
readonly name: "MegaETH";
|
|
119
|
+
readonly slug: "megaeth";
|
|
120
|
+
readonly explorerUrl: "https://megaeth.blockscout.com/";
|
|
121
|
+
readonly nativeTokenSymbol: "ETH";
|
|
122
|
+
readonly wrappedTokenSymbol: "WETH";
|
|
123
|
+
readonly defaultCollateralSymbol: "USDM";
|
|
124
|
+
readonly highExecutionFee: 5;
|
|
125
|
+
readonly shouldUseMaxPriorityFeePerGas: true;
|
|
126
|
+
readonly defaultExecutionFeeBufferBps: 3000;
|
|
127
|
+
readonly maxFeePerGas: undefined;
|
|
128
|
+
readonly gasPricePremium: 0n;
|
|
129
|
+
readonly maxPriorityFeePerGas: 500000n;
|
|
130
|
+
readonly excessiveExecutionFee: 10;
|
|
131
|
+
readonly minExecutionFee: undefined;
|
|
132
|
+
readonly gasPriceBuffer: 2000n;
|
|
133
|
+
readonly isDisabled: false;
|
|
134
|
+
};
|
|
116
135
|
};
|
|
117
136
|
declare const SOURCE_CHAIN_CONFIGS: {
|
|
118
137
|
readonly 11155420: {
|
|
@@ -120,54 +139,63 @@ declare const SOURCE_CHAIN_CONFIGS: {
|
|
|
120
139
|
readonly name: "Optimism Sepolia";
|
|
121
140
|
readonly slug: "optimism-sepolia";
|
|
122
141
|
readonly explorerUrl: "https://sepolia-optimism.etherscan.io/";
|
|
142
|
+
readonly gasPriceBuffer: undefined;
|
|
123
143
|
};
|
|
124
144
|
readonly 11155111: {
|
|
125
145
|
readonly chainId: 11155111;
|
|
126
146
|
readonly name: "Sepolia";
|
|
127
147
|
readonly slug: "sepolia";
|
|
128
148
|
readonly explorerUrl: "https://sepolia.etherscan.io/";
|
|
149
|
+
readonly gasPriceBuffer: undefined;
|
|
129
150
|
};
|
|
130
151
|
readonly 8453: {
|
|
131
152
|
readonly chainId: 8453;
|
|
132
153
|
readonly name: "Base";
|
|
133
154
|
readonly slug: "base-mainnet";
|
|
134
155
|
readonly explorerUrl: "https://basescan.org/";
|
|
156
|
+
readonly gasPriceBuffer: 3000n;
|
|
135
157
|
};
|
|
136
158
|
readonly 56: {
|
|
137
159
|
readonly chainId: 56;
|
|
138
160
|
readonly name: "BNB";
|
|
139
161
|
readonly slug: "bnb-mainnet";
|
|
140
162
|
readonly explorerUrl: "https://bscscan.com/";
|
|
163
|
+
readonly gasPriceBuffer: 3000n;
|
|
141
164
|
};
|
|
142
165
|
readonly 1: {
|
|
143
166
|
readonly chainId: 1;
|
|
144
167
|
readonly name: "Ethereum";
|
|
145
168
|
readonly slug: "ethereum-mainnet";
|
|
146
169
|
readonly explorerUrl: "https://etherscan.io/";
|
|
170
|
+
readonly gasPriceBuffer: 3000n;
|
|
147
171
|
};
|
|
148
172
|
readonly 42161: {
|
|
149
173
|
readonly chainId: 42161;
|
|
150
174
|
readonly name: "Arbitrum";
|
|
151
175
|
readonly slug: "arbitrum";
|
|
152
176
|
readonly explorerUrl: "https://arbiscan.io/";
|
|
177
|
+
readonly gasPriceBuffer: undefined;
|
|
153
178
|
};
|
|
154
179
|
readonly 43114: {
|
|
155
180
|
readonly chainId: 43114;
|
|
156
181
|
readonly name: "Avalanche";
|
|
157
182
|
readonly slug: "avalanche";
|
|
158
183
|
readonly explorerUrl: "https://snowtrace.io/";
|
|
184
|
+
readonly gasPriceBuffer: undefined;
|
|
159
185
|
};
|
|
160
186
|
readonly 421614: {
|
|
161
187
|
readonly chainId: 421614;
|
|
162
188
|
readonly name: "Arbitrum Sepolia";
|
|
163
189
|
readonly slug: "arbitrum-sepolia";
|
|
164
190
|
readonly explorerUrl: "https://sepolia.arbiscan.io/";
|
|
191
|
+
readonly gasPriceBuffer: undefined;
|
|
165
192
|
};
|
|
166
193
|
readonly 43113: {
|
|
167
194
|
readonly chainId: 43113;
|
|
168
195
|
readonly name: "Avalanche Fuji";
|
|
169
196
|
readonly slug: "avalanche-fuji";
|
|
170
197
|
readonly explorerUrl: "https://testnet.snowtrace.io/";
|
|
198
|
+
readonly gasPriceBuffer: undefined;
|
|
171
199
|
};
|
|
172
200
|
};
|
|
173
201
|
export type ContractsChainName = (typeof CONTRACTS_CHAIN_CONFIGS)[keyof typeof CONTRACTS_CHAIN_CONFIGS]["name"];
|
|
@@ -177,6 +205,7 @@ export type ContractsChainSlug = (typeof CONTRACTS_CHAIN_CONFIGS)[keyof typeof C
|
|
|
177
205
|
export type SourceChainSlug = (typeof SOURCE_CHAIN_CONFIGS)[keyof typeof SOURCE_CHAIN_CONFIGS]["slug"];
|
|
178
206
|
export type ChainSlug = ContractsChainSlug | SourceChainSlug | "unknown";
|
|
179
207
|
export declare const botanix: Chain;
|
|
208
|
+
export declare const megaeth: Chain;
|
|
180
209
|
export declare const VIEM_CHAIN_BY_CHAIN_ID: Record<AnyChainId, Chain>;
|
|
181
210
|
export declare function getChainName(chainId: number): ChainName;
|
|
182
211
|
export declare function getChainSlug(chainId: number): ChainSlug;
|
|
@@ -188,13 +217,13 @@ export declare function isContractsChain(chainId: number, dev?: boolean): chainI
|
|
|
188
217
|
export declare function isTestnetChain(chainId: number): boolean;
|
|
189
218
|
export declare function getMaxFeePerGas(chainId: ContractsChainId): bigint | undefined;
|
|
190
219
|
export declare function getGasPricePremium(chainId: ContractsChainId): bigint | undefined;
|
|
191
|
-
export declare function getMaxPriorityFeePerGas(chainId: ContractsChainId): 1500000000n | 7n;
|
|
220
|
+
export declare function getMaxPriorityFeePerGas(chainId: ContractsChainId): 1500000000n | 7n | 500000n;
|
|
192
221
|
export declare function getMinExecutionFeeUsd(chainId: ContractsChainId): 1000000000000000000000000000n | undefined;
|
|
193
|
-
export declare function getGasPriceBuffer(chainId: ContractsChainId): 2000n | undefined;
|
|
222
|
+
export declare function getGasPriceBuffer(chainId: ContractsChainId | SourceChainId): 2000n | 3000n | undefined;
|
|
194
223
|
export declare function isChainDisabled(chainId: ContractsChainId): false;
|
|
195
224
|
export declare function getChainNativeTokenSymbol(chainId: ContractsChainId): "ETH" | "AVAX" | "BTC";
|
|
196
225
|
export declare function getChainWrappedTokenSymbol(chainId: ContractsChainId): "WETH" | "WAVAX" | "PBTC";
|
|
197
|
-
export declare function getChainDefaultCollateralSymbol(chainId: ContractsChainId): "USDC.e" | "USDC" | "USDC.E";
|
|
226
|
+
export declare function getChainDefaultCollateralSymbol(chainId: ContractsChainId): "USDC.e" | "USDC" | "USDC.E" | "USDM";
|
|
198
227
|
export declare function getExplorerUrl(chainId: number | "layerzero" | "layerzero-testnet"): string;
|
|
199
228
|
export declare function getTokenExplorerUrl(chainId: number, tokenAddress: string): string;
|
|
200
229
|
export declare function getExecutionFeeConfig(chainId: ContractsChainId): {
|
|
@@ -57,7 +57,7 @@ export declare const CONTRACTS: {
|
|
|
57
57
|
ChainlinkPriceFeedProvider: string;
|
|
58
58
|
ClaimHandler: string;
|
|
59
59
|
ExternalHandler: string;
|
|
60
|
-
|
|
60
|
+
KyberSwapRouter: string;
|
|
61
61
|
Multicall: string;
|
|
62
62
|
ArbitrumNodeInterface: string;
|
|
63
63
|
LayerZeroEndpoint: string;
|
|
@@ -119,7 +119,7 @@ export declare const CONTRACTS: {
|
|
|
119
119
|
ChainlinkPriceFeedProvider: string;
|
|
120
120
|
ClaimHandler: string;
|
|
121
121
|
ExternalHandler: string;
|
|
122
|
-
|
|
122
|
+
KyberSwapRouter: string;
|
|
123
123
|
Multicall: string;
|
|
124
124
|
ArbitrumNodeInterface: "0x0000000000000000000000000000000000000000";
|
|
125
125
|
LayerZeroEndpoint: string;
|
|
@@ -152,7 +152,7 @@ export declare const CONTRACTS: {
|
|
|
152
152
|
ChainlinkPriceFeedProvider: string;
|
|
153
153
|
ClaimHandler: string;
|
|
154
154
|
ExternalHandler: string;
|
|
155
|
-
|
|
155
|
+
KyberSwapRouter: "0x0000000000000000000000000000000000000000";
|
|
156
156
|
Multicall: string;
|
|
157
157
|
LayerZeroEndpoint: string;
|
|
158
158
|
ArbitrumNodeInterface: "0x0000000000000000000000000000000000000000";
|
|
@@ -191,6 +191,70 @@ export declare const CONTRACTS: {
|
|
|
191
191
|
StBTC: string;
|
|
192
192
|
PBTC: string;
|
|
193
193
|
};
|
|
194
|
+
4326: {
|
|
195
|
+
DataStore: string;
|
|
196
|
+
EventEmitter: string;
|
|
197
|
+
SubaccountRouter: string;
|
|
198
|
+
ExchangeRouter: string;
|
|
199
|
+
DepositVault: string;
|
|
200
|
+
WithdrawalVault: string;
|
|
201
|
+
OrderVault: string;
|
|
202
|
+
ShiftVault: string;
|
|
203
|
+
SyntheticsReader: string;
|
|
204
|
+
SyntheticsRouter: string;
|
|
205
|
+
GlvReader: string;
|
|
206
|
+
GlvRouter: string;
|
|
207
|
+
GlvVault: string;
|
|
208
|
+
GelatoRelayRouter: string;
|
|
209
|
+
SubaccountGelatoRelayRouter: string;
|
|
210
|
+
MultichainClaimsRouter: string;
|
|
211
|
+
MultichainGlvRouter: string;
|
|
212
|
+
MultichainGmRouter: string;
|
|
213
|
+
MultichainOrderRouter: string;
|
|
214
|
+
MultichainSubaccountRouter: string;
|
|
215
|
+
MultichainTransferRouter: string;
|
|
216
|
+
MultichainVault: string;
|
|
217
|
+
LayerZeroProvider: string;
|
|
218
|
+
ChainlinkPriceFeedProvider: string;
|
|
219
|
+
ClaimHandler: string;
|
|
220
|
+
ExternalHandler: string;
|
|
221
|
+
KyberSwapRouter: string;
|
|
222
|
+
Multicall: string;
|
|
223
|
+
LayerZeroEndpoint: string;
|
|
224
|
+
ArbitrumNodeInterface: "0x0000000000000000000000000000000000000000";
|
|
225
|
+
GelatoRelayAddress: string;
|
|
226
|
+
Vault: "0x0000000000000000000000000000000000000000";
|
|
227
|
+
Reader: "0x0000000000000000000000000000000000000000";
|
|
228
|
+
PositionRouter: "0x0000000000000000000000000000000000000000";
|
|
229
|
+
ReferralStorage: string;
|
|
230
|
+
VaultReader: "0x0000000000000000000000000000000000000000";
|
|
231
|
+
GlpManager: "0x0000000000000000000000000000000000000000";
|
|
232
|
+
RewardRouter: "0x0000000000000000000000000000000000000000";
|
|
233
|
+
RewardReader: "0x0000000000000000000000000000000000000000";
|
|
234
|
+
GlpRewardRouter: "0x0000000000000000000000000000000000000000";
|
|
235
|
+
StakedGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
236
|
+
FeeGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
237
|
+
GLP: "0x0000000000000000000000000000000000000000";
|
|
238
|
+
GMX: "0x0000000000000000000000000000000000000000";
|
|
239
|
+
ES_GMX: "0x0000000000000000000000000000000000000000";
|
|
240
|
+
BN_GMX: "0x0000000000000000000000000000000000000000";
|
|
241
|
+
USDG: "0x0000000000000000000000000000000000000000";
|
|
242
|
+
BonusGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
243
|
+
StakedGlpTracker: "0x0000000000000000000000000000000000000000";
|
|
244
|
+
FeeGlpTracker: "0x0000000000000000000000000000000000000000";
|
|
245
|
+
ExtendedGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
246
|
+
StakedGmxDistributor: "0x0000000000000000000000000000000000000000";
|
|
247
|
+
StakedGlpDistributor: "0x0000000000000000000000000000000000000000";
|
|
248
|
+
GmxVester: "0x0000000000000000000000000000000000000000";
|
|
249
|
+
GlpVester: "0x0000000000000000000000000000000000000000";
|
|
250
|
+
AffiliateVester: "0x0000000000000000000000000000000000000000";
|
|
251
|
+
Router: "0x0000000000000000000000000000000000000000";
|
|
252
|
+
GovToken: "0x0000000000000000000000000000000000000000";
|
|
253
|
+
ES_GMX_IOU: "0x0000000000000000000000000000000000000000";
|
|
254
|
+
OrderBook: "0x0000000000000000000000000000000000000000";
|
|
255
|
+
UniswapGmxEthPool: "0x0000000000000000000000000000000000000000";
|
|
256
|
+
NATIVE_TOKEN: string;
|
|
257
|
+
};
|
|
194
258
|
43113: {
|
|
195
259
|
Vault: "0x0000000000000000000000000000000000000000";
|
|
196
260
|
Router: "0x0000000000000000000000000000000000000000";
|
|
@@ -246,7 +310,7 @@ export declare const CONTRACTS: {
|
|
|
246
310
|
LayerZeroProvider: string;
|
|
247
311
|
ChainlinkPriceFeedProvider: string;
|
|
248
312
|
ClaimHandler: string;
|
|
249
|
-
|
|
313
|
+
KyberSwapRouter: "0x0000000000000000000000000000000000000000";
|
|
250
314
|
ExternalHandler: string;
|
|
251
315
|
Multicall: string;
|
|
252
316
|
ArbitrumNodeInterface: "0x0000000000000000000000000000000000000000";
|
|
@@ -291,7 +355,7 @@ export declare const CONTRACTS: {
|
|
|
291
355
|
BN_GMX: "0x0000000000000000000000000000000000000000";
|
|
292
356
|
USDG: "0x0000000000000000000000000000000000000000";
|
|
293
357
|
ES_GMX_IOU: "0x0000000000000000000000000000000000000000";
|
|
294
|
-
|
|
358
|
+
KyberSwapRouter: "0x0000000000000000000000000000000000000000";
|
|
295
359
|
Vault: "0x0000000000000000000000000000000000000000";
|
|
296
360
|
PositionRouter: "0x0000000000000000000000000000000000000000";
|
|
297
361
|
RewardRouter: "0x0000000000000000000000000000000000000000";
|
|
@@ -9,6 +9,11 @@ export type MarketConfig = {
|
|
|
9
9
|
};
|
|
10
10
|
export type MarketsConfigMap = Record<string, MarketConfig>;
|
|
11
11
|
export declare const MARKETS: Record<ContractsChainId, MarketsConfigMap>;
|
|
12
|
+
/**
|
|
13
|
+
* Markets excluded from swap path routing (collateral swaps and express fee swaps).
|
|
14
|
+
* GM token buying/selling of these markets is unaffected — only routing through them is blocked.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DISABLED_SWAP_ROUTE_MARKETS: Partial<Record<ContractsChainId, string[]>>;
|
|
12
17
|
export type MarketLabel = `${string}/USD [${string}-${string}]`;
|
|
13
18
|
export declare function getMarketsByChainId(chainId: ContractsChainId): Record<string, MarketConfig>;
|
|
14
19
|
export declare function getMarketByLabel(chainId: ContractsChainId, label: MarketLabel): MarketConfig;
|
|
@@ -38,6 +38,12 @@ export declare const TOKEN_COLOR_MAP: {
|
|
|
38
38
|
MATIC: string;
|
|
39
39
|
EIGEN: string;
|
|
40
40
|
SATS: string;
|
|
41
|
+
XAU: string;
|
|
42
|
+
XAG: string;
|
|
43
|
+
GOLD: string;
|
|
44
|
+
SILVER: string;
|
|
45
|
+
XPT: string;
|
|
46
|
+
XPD: string;
|
|
41
47
|
default: string;
|
|
42
48
|
};
|
|
43
49
|
export declare const TOKENS_MAP: {
|
|
@@ -87,7 +93,6 @@ export declare function getTokenBySymbol(chainId: number, symbol: string, { isSy
|
|
|
87
93
|
export declare function convertTokenAddress<T extends keyof TokenAddressTypesMap, R extends TokenAddressTypesMap[T]>(chainId: number, address: string, convertTo?: T): R;
|
|
88
94
|
export declare function getNormalizedTokenSymbol(tokenSymbol: string): string;
|
|
89
95
|
export declare function isChartAvailableForToken(chainId: number, tokenSymbol: string): boolean;
|
|
90
|
-
export declare function getPriceDecimals(chainId: number, tokenSymbol?: string): number;
|
|
91
96
|
export declare function getTokenBySymbolSafe(chainId: number, symbol: string, params?: Parameters<typeof getTokenBySymbol>[2]): Token | undefined;
|
|
92
97
|
export declare function isTokenInList(token: Token, tokenList: Token[]): boolean;
|
|
93
98
|
export declare function isSimilarToken(tokenA: Token, tokenB: Token): boolean;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ContractsChainId } from "../../configs/chains";
|
|
2
|
+
import { IHttp } from "../http/types";
|
|
3
|
+
export type ApproveTokenParams = {
|
|
4
|
+
tokenAddress: string;
|
|
5
|
+
spender: SpenderType;
|
|
6
|
+
amount?: bigint;
|
|
7
|
+
};
|
|
8
|
+
export type ApproveTokenResult = {
|
|
9
|
+
to: string;
|
|
10
|
+
data: string;
|
|
11
|
+
value: bigint;
|
|
12
|
+
};
|
|
13
|
+
export type WalletBalance = {
|
|
14
|
+
symbol: string;
|
|
15
|
+
address: string;
|
|
16
|
+
decimals: number;
|
|
17
|
+
balance: bigint;
|
|
18
|
+
};
|
|
19
|
+
export type TokenAllowance = {
|
|
20
|
+
symbol: string;
|
|
21
|
+
address: string;
|
|
22
|
+
decimals: number;
|
|
23
|
+
allowance: bigint;
|
|
24
|
+
};
|
|
25
|
+
export type SpenderType = "router" | "glv";
|
|
26
|
+
export declare function fetchWalletBalances(ctx: {
|
|
27
|
+
api: IHttp;
|
|
28
|
+
}, params: {
|
|
29
|
+
address: string;
|
|
30
|
+
}): Promise<WalletBalance[]>;
|
|
31
|
+
export declare function fetchAllowances(ctx: {
|
|
32
|
+
api: IHttp;
|
|
33
|
+
}, params: {
|
|
34
|
+
address: string;
|
|
35
|
+
spender: SpenderType;
|
|
36
|
+
}): Promise<TokenAllowance[]>;
|
|
37
|
+
export declare function buildApproveTransaction(ctx: {
|
|
38
|
+
chainId: ContractsChainId;
|
|
39
|
+
}, params: ApproveTokenParams): ApproveTokenResult;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type BuybackWeekData = {
|
|
2
|
+
weekStart: number;
|
|
3
|
+
weekEnd: number;
|
|
4
|
+
weeklyAccrued: string;
|
|
5
|
+
cumulativeAccrued: string;
|
|
6
|
+
};
|
|
7
|
+
export type BuybackSummary = {
|
|
8
|
+
totalAccrued: string;
|
|
9
|
+
latestWeekAccrued: string;
|
|
10
|
+
weeksTracked: number;
|
|
11
|
+
};
|
|
12
|
+
export type BuybackWeeklyStatsResponse = {
|
|
13
|
+
summary: BuybackSummary;
|
|
14
|
+
weeks: BuybackWeekData[];
|
|
15
|
+
};
|
|
@@ -16,6 +16,7 @@ export type ErrorLike = {
|
|
|
16
16
|
tags?: string;
|
|
17
17
|
isAdditionalValidationPassed?: boolean;
|
|
18
18
|
additionalValidationType?: string;
|
|
19
|
+
simulationMethod?: string;
|
|
19
20
|
info?: {
|
|
20
21
|
error?: ErrorLike;
|
|
21
22
|
};
|
|
@@ -39,6 +40,7 @@ export type ErrorData = {
|
|
|
39
40
|
errorSource?: string;
|
|
40
41
|
isAdditionalValidationPassed?: boolean;
|
|
41
42
|
additionalValidationType?: string;
|
|
43
|
+
simulationMethod?: string;
|
|
42
44
|
parentError?: ErrorData;
|
|
43
45
|
errorDepth?: number;
|
|
44
46
|
};
|
|
@@ -47,6 +49,7 @@ export declare function extendError(error: ErrorLike, params: {
|
|
|
47
49
|
errorSource?: string;
|
|
48
50
|
isAdditionalValidationPassed?: boolean;
|
|
49
51
|
additionalValidationType?: string;
|
|
52
|
+
simulationMethod?: string;
|
|
50
53
|
data?: any;
|
|
51
54
|
}): ErrorLike;
|
|
52
55
|
export declare function parseError(error: ErrorLike | string | undefined, errorDepth?: number): ErrorData | undefined;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { ExternalCallsPayload } from "../orderTransactions";
|
|
2
|
+
import type { Subaccount, SubaccountValidations } from "../subaccount";
|
|
3
|
+
import type { SignedTokenPermit, TokenData } from "../tokens/types";
|
|
4
|
+
export type { Subaccount, SubaccountOnchainData, SubaccountSerializedConfig, SignedSubaccountApproval, SubaccountValidations } from "../subaccount";
|
|
5
|
+
export type OracleParamsPayload = {
|
|
6
|
+
tokens: string[];
|
|
7
|
+
providers: string[];
|
|
8
|
+
data: string[];
|
|
9
|
+
};
|
|
10
|
+
export type RelayFeePayload = {
|
|
11
|
+
feeToken: string;
|
|
12
|
+
feeAmount: bigint;
|
|
13
|
+
feeSwapPath: string[];
|
|
14
|
+
};
|
|
15
|
+
export type RelayParamsPayload = {
|
|
16
|
+
oracleParams: OracleParamsPayload;
|
|
17
|
+
tokenPermits: SignedTokenPermit[];
|
|
18
|
+
externalCalls: ExternalCallsPayload;
|
|
19
|
+
fee: RelayFeePayload;
|
|
20
|
+
deadline: bigint;
|
|
21
|
+
desChainId: bigint;
|
|
22
|
+
userNonce: bigint;
|
|
23
|
+
};
|
|
24
|
+
export type RelayParamsPayloadWithSignature = RelayParamsPayload & {
|
|
25
|
+
signature: string;
|
|
26
|
+
};
|
|
27
|
+
export type RawRelayParamsPayload = Omit<RelayParamsPayload, "deadline">;
|
|
28
|
+
export type GasPaymentParams = {
|
|
29
|
+
gasPaymentToken: TokenData;
|
|
30
|
+
relayFeeToken: TokenData;
|
|
31
|
+
gasPaymentTokenAddress: string;
|
|
32
|
+
relayerFeeTokenAddress: string;
|
|
33
|
+
relayerFeeAmount: bigint;
|
|
34
|
+
gasPaymentTokenAmount: bigint;
|
|
35
|
+
totalRelayerFeeTokenAmount: bigint;
|
|
36
|
+
gasPaymentTokenAsCollateralAmount: bigint;
|
|
37
|
+
};
|
|
38
|
+
export type GasPaymentValidations = {
|
|
39
|
+
isOutGasTokenBalance: boolean;
|
|
40
|
+
needGasPaymentTokenApproval: boolean;
|
|
41
|
+
isValid: boolean;
|
|
42
|
+
};
|
|
43
|
+
export type BatchTypedData = {
|
|
44
|
+
domain: {
|
|
45
|
+
name: string;
|
|
46
|
+
version: string;
|
|
47
|
+
chainId: number;
|
|
48
|
+
verifyingContract: string;
|
|
49
|
+
};
|
|
50
|
+
types: Record<string, {
|
|
51
|
+
name: string;
|
|
52
|
+
type: string;
|
|
53
|
+
}[]>;
|
|
54
|
+
message: Record<string, any>;
|
|
55
|
+
};
|
|
56
|
+
export type ExpressTxnData = {
|
|
57
|
+
callData: string;
|
|
58
|
+
to: string;
|
|
59
|
+
feeToken: string;
|
|
60
|
+
feeAmount: bigint;
|
|
61
|
+
};
|
|
62
|
+
export type ExpressParamsEstimationMethod = "approximate" | "estimateGas";
|
|
63
|
+
export type ExpressTxnParams = {
|
|
64
|
+
chainId: number;
|
|
65
|
+
subaccount: Subaccount | undefined;
|
|
66
|
+
relayParamsPayload: RawRelayParamsPayload;
|
|
67
|
+
gasPaymentParams: GasPaymentParams;
|
|
68
|
+
gasLimit: bigint;
|
|
69
|
+
l1GasLimit: bigint;
|
|
70
|
+
gasPrice: bigint;
|
|
71
|
+
executionFeeAmount: bigint;
|
|
72
|
+
executionGasLimit: bigint;
|
|
73
|
+
estimationMethod: ExpressParamsEstimationMethod;
|
|
74
|
+
gasPaymentValidations: GasPaymentValidations;
|
|
75
|
+
subaccountValidations: SubaccountValidations | undefined;
|
|
76
|
+
isGmxAccount: boolean;
|
|
77
|
+
};
|
|
78
|
+
export type ExpressTransactionBuilder = (params: {
|
|
79
|
+
relayParams: RawRelayParamsPayload;
|
|
80
|
+
gasPaymentParams: GasPaymentParams;
|
|
81
|
+
subaccount: Subaccount | undefined;
|
|
82
|
+
}) => Promise<{
|
|
83
|
+
txnData: ExpressTxnData;
|
|
84
|
+
}>;
|
|
85
|
+
export type ExpressTransactionEstimatorParams = {
|
|
86
|
+
account: string;
|
|
87
|
+
gasPaymentTokenAsCollateralAmount: bigint;
|
|
88
|
+
executionFeeAmount: bigint;
|
|
89
|
+
executionGasLimit: bigint;
|
|
90
|
+
transactionPayloadGasLimit: bigint;
|
|
91
|
+
transactionExternalCalls: ExternalCallsPayload | undefined;
|
|
92
|
+
subaccountActions: number;
|
|
93
|
+
isValid: boolean;
|
|
94
|
+
expressTransactionBuilder: ExpressTransactionBuilder;
|
|
95
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { ContractsChainId, SourceChainId } from "../../../configs/chains";
|
|
2
|
+
import type { IMetrics } from "../../metrics";
|
|
3
|
+
import type { BatchOrderTxnParams } from "../../orderTransactions";
|
|
4
|
+
import type { IRpc } from "../../rpc";
|
|
5
|
+
import type { BuiltGlobalExpressParams } from "./globalExpressParams";
|
|
6
|
+
import type { BatchTypedData, ExpressTxnData, RawRelayParamsPayload, RelayParamsPayload } from "../types";
|
|
7
|
+
export declare function getBatchTypedData({ chainId, signingChainId, batchParams, relayParams, account, subaccountApprovalHash, relayRouterAddress, }: {
|
|
8
|
+
chainId: ContractsChainId;
|
|
9
|
+
signingChainId?: SourceChainId | ContractsChainId;
|
|
10
|
+
batchParams: BatchOrderTxnParams;
|
|
11
|
+
relayParams: RelayParamsPayload;
|
|
12
|
+
account: string;
|
|
13
|
+
subaccountApprovalHash?: string;
|
|
14
|
+
relayRouterAddress: string;
|
|
15
|
+
}): BatchTypedData;
|
|
16
|
+
export declare function buildBatchOrderCalldata({ chainId, batchParams, relayParamsPayload, signature, account, srcChainId, subaccountApproval, isGmxAccount, deadline: overrideDeadline, }: {
|
|
17
|
+
chainId: ContractsChainId;
|
|
18
|
+
batchParams: BatchOrderTxnParams;
|
|
19
|
+
relayParamsPayload: RawRelayParamsPayload;
|
|
20
|
+
signature: string;
|
|
21
|
+
account: string;
|
|
22
|
+
srcChainId?: SourceChainId;
|
|
23
|
+
subaccountApproval?: {
|
|
24
|
+
subaccount: string;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
};
|
|
27
|
+
isGmxAccount: boolean;
|
|
28
|
+
deadline?: bigint;
|
|
29
|
+
}): ExpressTxnData & {
|
|
30
|
+
relayRouterAddress: string;
|
|
31
|
+
};
|
|
32
|
+
export declare function getBatchParamsLists(batchParams: BatchOrderTxnParams): {
|
|
33
|
+
createOrderParamsList: {
|
|
34
|
+
addresses: {
|
|
35
|
+
receiver: string;
|
|
36
|
+
uiFeeReceiver: string;
|
|
37
|
+
cancellationReceiver: string;
|
|
38
|
+
callbackContract: string;
|
|
39
|
+
market: string;
|
|
40
|
+
initialCollateralToken: import("../../tokens").ERC20Address;
|
|
41
|
+
swapPath: string[];
|
|
42
|
+
};
|
|
43
|
+
numbers: {
|
|
44
|
+
sizeDeltaUsd: bigint;
|
|
45
|
+
initialCollateralDeltaAmount: bigint;
|
|
46
|
+
triggerPrice: 0n | import("../../tokens").ContractPrice;
|
|
47
|
+
acceptablePrice: 0n | import("../../tokens").ContractPrice;
|
|
48
|
+
executionFee: bigint;
|
|
49
|
+
callbackGasLimit: bigint;
|
|
50
|
+
minOutputAmount: bigint;
|
|
51
|
+
validFromTime: bigint;
|
|
52
|
+
};
|
|
53
|
+
orderType: import("../../orders").OrderType;
|
|
54
|
+
decreasePositionSwapType: import("../../orders").DecreasePositionSwapType;
|
|
55
|
+
isLong: boolean;
|
|
56
|
+
shouldUnwrapNativeToken: boolean;
|
|
57
|
+
autoCancel: boolean;
|
|
58
|
+
referralCode: string;
|
|
59
|
+
dataList: string[];
|
|
60
|
+
}[];
|
|
61
|
+
updateOrderParamsList: {
|
|
62
|
+
key: string;
|
|
63
|
+
sizeDeltaUsd: bigint;
|
|
64
|
+
acceptablePrice: import("../../tokens").ContractPrice;
|
|
65
|
+
triggerPrice: import("../../tokens").ContractPrice;
|
|
66
|
+
minOutputAmount: bigint;
|
|
67
|
+
validFromTime: bigint;
|
|
68
|
+
autoCancel: boolean;
|
|
69
|
+
executionFeeIncrease: bigint;
|
|
70
|
+
}[];
|
|
71
|
+
cancelOrderKeys: string[];
|
|
72
|
+
};
|
|
73
|
+
export declare function buildSignedBatchOrderCalldata({ config, account, batchParams, relayParamsPayload, signature, isGmxAccount, signingChainId, subaccountApproval, deadline, }: {
|
|
74
|
+
config: BuiltGlobalExpressParams;
|
|
75
|
+
account: string;
|
|
76
|
+
batchParams: BatchOrderTxnParams;
|
|
77
|
+
relayParamsPayload: RawRelayParamsPayload;
|
|
78
|
+
signature: string;
|
|
79
|
+
isGmxAccount: boolean;
|
|
80
|
+
signingChainId?: number;
|
|
81
|
+
subaccountApproval?: {
|
|
82
|
+
subaccount: string;
|
|
83
|
+
[key: string]: any;
|
|
84
|
+
};
|
|
85
|
+
deadline?: bigint;
|
|
86
|
+
}): ExpressTxnData & {
|
|
87
|
+
relayRouterAddress: string;
|
|
88
|
+
};
|
|
89
|
+
export declare function simulateExpressOrder({ rpc, simulationOrigin, callData, to, stateOverride, metrics, }: {
|
|
90
|
+
rpc: IRpc;
|
|
91
|
+
simulationOrigin: string;
|
|
92
|
+
callData: string;
|
|
93
|
+
to: string;
|
|
94
|
+
stateOverride?: Parameters<IRpc["estimateGas"]>[0]["stateOverride"];
|
|
95
|
+
metrics?: IMetrics;
|
|
96
|
+
}): Promise<{
|
|
97
|
+
gasLimit: bigint;
|
|
98
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ContractsChainId, SourceChainId } from "../../../configs/chains";
|
|
2
|
+
import type { IAbstractSigner } from "../../signer";
|
|
3
|
+
import type { ExpressTxnData, RawRelayParamsPayload } from "../types";
|
|
4
|
+
export type BridgeOutParams = {
|
|
5
|
+
token: string;
|
|
6
|
+
amount: bigint;
|
|
7
|
+
minAmountOut: bigint;
|
|
8
|
+
provider: string;
|
|
9
|
+
data: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function buildAndSignBridgeOutTxn({ chainId, srcChainId, relayParamsPayload, params, signer, account, emptySignature, relayerFeeTokenAddress, relayerFeeAmount, }: {
|
|
12
|
+
chainId: ContractsChainId;
|
|
13
|
+
srcChainId: SourceChainId;
|
|
14
|
+
relayParamsPayload: RawRelayParamsPayload;
|
|
15
|
+
params: BridgeOutParams;
|
|
16
|
+
signer: IAbstractSigner | undefined;
|
|
17
|
+
account: string;
|
|
18
|
+
emptySignature?: boolean;
|
|
19
|
+
relayerFeeTokenAddress: string;
|
|
20
|
+
relayerFeeAmount: bigint;
|
|
21
|
+
}): Promise<ExpressTxnData>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ContractsChainId } from "../../../configs/chains";
|
|
2
|
+
import type { IMetrics } from "../../metrics";
|
|
3
|
+
import type { IRpc, StateOverrideEntry } from "../../rpc";
|
|
4
|
+
import type { SignedTokenPermit, TokenData, TokensAllowanceData } from "../../tokens/types";
|
|
5
|
+
import type { BuiltGlobalExpressParams } from "./globalExpressParams";
|
|
6
|
+
import type { ExpressParamsEstimationMethod, ExpressTransactionEstimatorParams, ExpressTxnParams, GasPaymentValidations, Subaccount, SubaccountValidations } from "../types";
|
|
7
|
+
export declare function getNeedTokenApprove(tokenAllowanceData: TokensAllowanceData | undefined, tokenAddress: string | undefined, amountToSpend: bigint | undefined, permits: SignedTokenPermit[]): boolean;
|
|
8
|
+
export declare function getGasPaymentValidations({ gasPaymentToken, gasPaymentTokenAmount, gasPaymentTokenAsCollateralAmount, gasPaymentAllowanceData, tokenPermits, isGmxAccount, }: {
|
|
9
|
+
gasPaymentToken: TokenData;
|
|
10
|
+
gasPaymentTokenAmount: bigint;
|
|
11
|
+
gasPaymentTokenAsCollateralAmount: bigint;
|
|
12
|
+
gasPaymentAllowanceData: TokensAllowanceData | undefined;
|
|
13
|
+
tokenPermits: SignedTokenPermit[];
|
|
14
|
+
isGmxAccount: boolean;
|
|
15
|
+
}): GasPaymentValidations;
|
|
16
|
+
export type EstimateExpressParamsInput = {
|
|
17
|
+
chainId: ContractsChainId;
|
|
18
|
+
isGmxAccount: boolean;
|
|
19
|
+
globalExpressParams: BuiltGlobalExpressParams;
|
|
20
|
+
transactionParams: ExpressTransactionEstimatorParams;
|
|
21
|
+
estimationMethod?: ExpressParamsEstimationMethod;
|
|
22
|
+
requireValidations?: boolean;
|
|
23
|
+
subaccount?: Subaccount;
|
|
24
|
+
throwOnInvalid?: boolean;
|
|
25
|
+
overrideGasLimit?: bigint;
|
|
26
|
+
rpc?: IRpc;
|
|
27
|
+
simulationOrigin?: string;
|
|
28
|
+
stateOverride?: StateOverrideEntry[];
|
|
29
|
+
metrics?: IMetrics;
|
|
30
|
+
gasPaymentAllowanceData?: TokensAllowanceData;
|
|
31
|
+
getSubaccountValidations?: (params: {
|
|
32
|
+
requiredActions: number;
|
|
33
|
+
subaccount: Subaccount;
|
|
34
|
+
subaccountRouterAddress: string;
|
|
35
|
+
}) => SubaccountValidations;
|
|
36
|
+
};
|
|
37
|
+
export declare function estimateExpressParams({ chainId, isGmxAccount, transactionParams, globalExpressParams, estimationMethod, requireValidations, subaccount: rawSubaccount, throwOnInvalid, overrideGasLimit, rpc, simulationOrigin, stateOverride, metrics, gasPaymentAllowanceData, getSubaccountValidations, }: EstimateExpressParamsInput): Promise<ExpressTxnParams | undefined>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { GasPaymentValidations } from "../types";
|
|
2
|
+
export declare class ExpressEstimationError extends Error {
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class ExpressEstimationInsufficientGasPaymentTokenBalanceError extends ExpressEstimationError {
|
|
6
|
+
readonly params?: {
|
|
7
|
+
balance?: bigint | undefined;
|
|
8
|
+
requiredAmount?: bigint | undefined;
|
|
9
|
+
} | undefined;
|
|
10
|
+
name: string;
|
|
11
|
+
constructor(params?: {
|
|
12
|
+
balance?: bigint | undefined;
|
|
13
|
+
requiredAmount?: bigint | undefined;
|
|
14
|
+
} | undefined);
|
|
15
|
+
}
|
|
16
|
+
export declare function getIsValidExpressParams({ gasPaymentValidations, }: {
|
|
17
|
+
gasPaymentValidations: GasPaymentValidations;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}): boolean;
|