@gmx-io/sdk 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/src/abis/ArbitrumNodeInterface.json +105 -0
- package/build/cjs/src/abis/CustomErrors.json +613 -16
- package/build/cjs/src/abis/ERC20PermitInterface.json +118 -0
- package/build/cjs/src/abis/GelatoRelayRouter.json +1426 -0
- package/build/cjs/src/abis/RelayParams.json +110 -0
- package/build/cjs/src/abis/SubaccountApproval.json +17 -0
- package/build/cjs/src/abis/SubaccountGelatoRelayRouter.json +1885 -0
- package/build/cjs/src/abis/SyntheticsReader.json +1 -131
- package/build/cjs/src/abis/__tests__/abis.spec.js +40 -0
- package/build/cjs/src/abis/index.js +8 -0
- package/build/cjs/src/configs/__tests__/permits.spec.js +109 -0
- package/build/cjs/src/configs/__tests__/tokens.spec.js +1 -1
- package/build/cjs/src/configs/chains.js +36 -5
- package/build/cjs/src/configs/contracts.js +15 -3
- package/build/cjs/src/configs/dataStore.js +26 -4
- package/build/cjs/src/configs/express.js +35 -0
- package/build/cjs/src/configs/factors.js +4 -3
- package/build/cjs/src/configs/tokens.js +50 -0
- package/build/cjs/src/configs/twap.js +10 -0
- package/build/cjs/src/index.js +3 -3
- package/build/cjs/src/modules/markets/index.js +1 -0
- package/build/cjs/src/modules/markets/query-builders.js +4 -0
- package/build/cjs/src/modules/orders/helpers.js +2 -0
- package/build/cjs/src/modules/orders/orders.js +4 -3
- package/build/cjs/src/modules/orders/transactions/createDecreaseOrderTxn.js +1 -1
- package/build/cjs/src/modules/orders/transactions/createIncreaseOrderTxn.js +6 -3
- package/build/cjs/src/modules/orders/transactions/createSwapOrderTxn.js +1 -1
- package/build/cjs/src/modules/utils/utils.js +11 -1
- package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +119 -0
- package/build/cjs/src/test/mock.js +30 -1
- package/build/cjs/src/types/twap.js +2 -0
- package/build/cjs/src/utils/__tests__/numbers.spec.js +217 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/batchUtils.spec.js +241 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +595 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +296 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/externalCalls.spec.js +118 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +762 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/swapOrders.spec.js +469 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/updateOrder.spec.js +80 -0
- package/build/cjs/src/utils/__tests__/parseError.spec.js +263 -0
- package/build/cjs/src/utils/__tests__/uiFeeReceiver.spec.js +45 -0
- package/build/cjs/src/utils/bigmath.js +3 -0
- package/build/cjs/src/utils/callContract.js +2 -2
- package/build/cjs/src/utils/errors/index.js +18 -0
- package/build/cjs/src/utils/errors/parseError.js +150 -0
- package/build/cjs/src/utils/{contracts.js → errors/transactionsErrors.js} +35 -3
- package/build/cjs/src/utils/fees/executionFee.js +52 -1
- package/build/cjs/src/utils/fees/index.js +8 -4
- package/build/cjs/src/utils/gelatoRelay.js +5 -0
- package/build/cjs/src/utils/hash.js +6 -1
- package/build/cjs/src/utils/marketKeysAndConfigs.js +4 -0
- package/build/cjs/src/utils/markets.js +5 -1
- package/build/cjs/src/utils/numbers.js +559 -5
- package/build/cjs/src/utils/orderTransactions.js +638 -0
- package/build/cjs/src/utils/orders.js +7 -1
- package/build/cjs/src/utils/simulateExecuteOrder.js +6 -2
- package/build/cjs/src/utils/swap/__tests__/mockRouting.spec.js +11 -6
- package/build/cjs/src/utils/swap/__tests__/swapRouting.spec.js +4 -4
- package/build/cjs/src/utils/swap/__tests__/swapStats.spec.js +9 -0
- package/build/cjs/src/utils/swap/swapPath.js +30 -13
- package/build/cjs/src/utils/swap/swapRouting.js +4 -2
- package/build/cjs/src/utils/swap/swapStats.js +6 -5
- package/build/cjs/src/utils/testUtil.js +1 -1
- package/build/cjs/src/utils/time.js +30 -0
- package/build/cjs/src/utils/tokens.js +16 -2
- package/build/cjs/src/utils/twap/index.js +53 -0
- package/build/cjs/src/utils/twap/uiFeeReceiver.js +31 -0
- package/build/cjs/src/utils/types.js +13 -0
- package/build/esm/src/abis/ArbitrumNodeInterface.json +105 -0
- package/build/esm/src/abis/CustomErrors.json +613 -16
- package/build/esm/src/abis/ERC20PermitInterface.json +118 -0
- package/build/esm/src/abis/GelatoRelayRouter.json +1426 -0
- package/build/esm/src/abis/RelayParams.json +110 -0
- package/build/esm/src/abis/SubaccountApproval.json +17 -0
- package/build/esm/src/abis/SubaccountGelatoRelayRouter.json +1885 -0
- package/build/esm/src/abis/SyntheticsReader.json +1 -131
- package/build/esm/src/abis/__tests__/abis.spec.js +35 -0
- package/build/esm/src/abis/index.js +8 -0
- package/build/esm/src/configs/__tests__/permits.spec.js +107 -0
- package/build/esm/src/configs/__tests__/tokens.spec.js +3 -3
- package/build/esm/src/configs/chains.js +33 -3
- package/build/esm/src/configs/contracts.js +15 -3
- package/build/esm/src/configs/dataStore.js +19 -1
- package/build/esm/src/configs/express.js +29 -0
- package/build/esm/src/configs/factors.js +1 -3
- package/build/esm/src/configs/tokens.js +50 -0
- package/build/esm/src/configs/twap.js +7 -0
- package/build/esm/src/index.js +4 -4
- package/build/esm/src/modules/markets/index.js +1 -0
- package/build/esm/src/modules/markets/query-builders.js +4 -0
- package/build/esm/src/modules/orders/helpers.js +2 -0
- package/build/esm/src/modules/orders/orders.js +4 -3
- package/build/esm/src/modules/orders/transactions/createDecreaseOrderTxn.js +1 -1
- package/build/esm/src/modules/orders/transactions/createIncreaseOrderTxn.js +6 -3
- package/build/esm/src/modules/orders/transactions/createSwapOrderTxn.js +1 -1
- package/build/esm/src/modules/utils/utils.js +13 -3
- package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +119 -0
- package/build/esm/src/test/mock.js +28 -0
- package/build/esm/src/types/twap.js +1 -0
- package/build/esm/src/utils/__tests__/numbers.spec.js +219 -2
- package/build/esm/src/utils/__tests__/orderTransactions/batchUtils.spec.js +239 -0
- package/build/esm/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +593 -0
- package/build/esm/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +294 -0
- package/build/esm/src/utils/__tests__/orderTransactions/externalCalls.spec.js +116 -0
- package/build/esm/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +760 -0
- package/build/esm/src/utils/__tests__/orderTransactions/swapOrders.spec.js +467 -0
- package/build/esm/src/utils/__tests__/orderTransactions/updateOrder.spec.js +78 -0
- package/build/esm/src/utils/__tests__/parseError.spec.js +261 -0
- package/build/esm/src/utils/__tests__/uiFeeReceiver.spec.js +43 -0
- package/build/esm/src/utils/bigmath.js +3 -0
- package/build/esm/src/utils/callContract.js +3 -3
- package/build/esm/src/utils/errors/index.js +2 -0
- package/build/esm/src/utils/errors/parseError.js +141 -0
- package/build/esm/src/utils/{contracts.js → errors/transactionsErrors.js} +30 -1
- package/build/esm/src/utils/fees/executionFee.js +48 -1
- package/build/esm/src/utils/fees/index.js +8 -4
- package/build/esm/src/utils/gelatoRelay.js +2 -0
- package/build/esm/src/utils/hash.js +5 -1
- package/build/esm/src/utils/marketKeysAndConfigs.js +5 -1
- package/build/esm/src/utils/markets.js +3 -0
- package/build/esm/src/utils/numbers.js +516 -1
- package/build/esm/src/utils/orderTransactions.js +607 -0
- package/build/esm/src/utils/orders.js +5 -0
- package/build/esm/src/utils/simulateExecuteOrder.js +6 -2
- package/build/esm/src/utils/swap/__tests__/mockRouting.spec.js +11 -6
- package/build/esm/src/utils/swap/__tests__/swapRouting.spec.js +4 -4
- package/build/esm/src/utils/swap/__tests__/swapStats.spec.js +9 -0
- package/build/esm/src/utils/swap/swapPath.js +30 -13
- package/build/esm/src/utils/swap/swapRouting.js +4 -2
- package/build/esm/src/utils/swap/swapStats.js +6 -5
- package/build/esm/src/utils/testUtil.js +2 -2
- package/build/esm/src/utils/time.js +23 -0
- package/build/esm/src/utils/tokens.js +14 -1
- package/build/esm/src/utils/twap/index.js +44 -0
- package/build/esm/src/utils/twap/uiFeeReceiver.js +24 -0
- package/build/esm/src/utils/types.js +8 -0
- package/build/types/src/abis/__tests__/abis.spec.d.ts +1 -0
- package/build/types/src/abis/index.d.ts +1 -1
- package/build/types/src/configs/__tests__/permits.spec.d.ts +1 -0
- package/build/types/src/configs/chains.d.ts +29 -1
- package/build/types/src/configs/contracts.d.ts +238 -1
- package/build/types/src/configs/dataStore.d.ts +10 -0
- package/build/types/src/configs/express.d.ts +12 -0
- package/build/types/src/configs/factors.d.ts +1 -3
- package/build/types/src/configs/tokens.d.ts +2 -2
- package/build/types/src/configs/twap.d.ts +7 -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/orders/orders.d.ts +2 -1
- package/build/types/src/modules/orders/transactions/createIncreaseOrderTxn.d.ts +1 -1
- package/build/types/src/test/mock.d.ts +16 -1
- package/build/types/src/types/fees.d.ts +9 -0
- package/build/types/src/types/markets.d.ts +1 -0
- package/build/types/src/types/orders.d.ts +3 -0
- package/build/types/src/types/tokens.d.ts +27 -0
- package/build/types/src/types/trade.d.ts +2 -19
- package/build/types/src/types/twap.d.ts +11 -0
- package/build/types/src/utils/__tests__/orderTransactions/batchUtils.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/orderTransactions/decreaseOrders.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/orderTransactions/externalCalls.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/orderTransactions/increaseOrders.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/orderTransactions/swapOrders.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/orderTransactions/updateOrder.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/parseError.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/uiFeeReceiver.spec.d.ts +1 -0
- package/build/types/src/utils/bigmath.d.ts +1 -0
- package/build/types/src/utils/errors/index.d.ts +2 -0
- package/build/types/src/utils/errors/parseError.d.ts +50 -0
- package/build/types/src/utils/errors/transactionsErrors.d.ts +34 -0
- package/build/types/src/utils/fees/executionFee.d.ts +35 -2
- package/build/types/src/utils/fees/index.d.ts +1 -1
- package/build/types/src/utils/gelatoRelay.d.ts +2 -0
- package/build/types/src/utils/hash.d.ts +2 -0
- package/build/types/src/utils/marketKeysAndConfigs.d.ts +1 -0
- package/build/types/src/utils/markets.d.ts +1 -0
- package/build/types/src/utils/numbers.d.ts +110 -1
- package/build/types/src/utils/orderTransactions.d.ts +231 -0
- package/build/types/src/utils/orders.d.ts +2 -1
- package/build/types/src/utils/simulateExecuteOrder.d.ts +4 -0
- package/build/types/src/utils/swap/swapPath.d.ts +5 -5
- package/build/types/src/utils/swap/swapRouting.d.ts +2 -2
- package/build/types/src/utils/swap/swapStats.d.ts +2 -0
- package/build/types/src/utils/time.d.ts +14 -0
- package/build/types/src/utils/tokens.d.ts +6 -5
- package/build/types/src/utils/twap/index.d.ts +17 -0
- package/build/types/src/utils/twap/uiFeeReceiver.d.ts +9 -0
- package/build/types/src/utils/types.d.ts +5 -0
- package/package.json +3 -1
- package/build/types/src/utils/contracts.d.ts +0 -19
|
@@ -1,3 +1,240 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
|
-
export declare const CONTRACTS:
|
|
2
|
+
export declare const CONTRACTS: {
|
|
3
|
+
56: {
|
|
4
|
+
Treasury: string;
|
|
5
|
+
BUSD: string;
|
|
6
|
+
GMT: string;
|
|
7
|
+
Vault: string;
|
|
8
|
+
Router: string;
|
|
9
|
+
Reader: string;
|
|
10
|
+
AmmFactory: string;
|
|
11
|
+
AmmFactoryV2: string;
|
|
12
|
+
OrderBook: string;
|
|
13
|
+
OrderBookReader: string;
|
|
14
|
+
GmxMigrator: string;
|
|
15
|
+
USDG: string;
|
|
16
|
+
NATIVE_TOKEN: string;
|
|
17
|
+
XGMT: string;
|
|
18
|
+
GMT_USDG_PAIR: string;
|
|
19
|
+
XGMT_USDG_PAIR: string;
|
|
20
|
+
GMT_USDG_FARM: string;
|
|
21
|
+
XGMT_USDG_FARM: string;
|
|
22
|
+
USDG_YIELD_TRACKER: string;
|
|
23
|
+
XGMT_YIELD_TRACKER: string;
|
|
24
|
+
GMT_USDG_FARM_TRACKER_XGMT: string;
|
|
25
|
+
GMT_USDG_FARM_TRACKER_NATIVE: string;
|
|
26
|
+
XGMT_USDG_FARM_TRACKER_XGMT: string;
|
|
27
|
+
XGMT_USDG_FARM_TRACKER_NATIVE: string;
|
|
28
|
+
AUTO: string;
|
|
29
|
+
AUTO_USDG_PAIR: string;
|
|
30
|
+
AUTO_USDG_FARM: string;
|
|
31
|
+
AUTO_USDG_FARM_TRACKER_XGMT: string;
|
|
32
|
+
AUTO_USDG_FARM_TRACKER_NATIVE: string;
|
|
33
|
+
GMT_GMX_IOU: string;
|
|
34
|
+
XGMT_GMX_IOU: string;
|
|
35
|
+
GMT_USDG_GMX_IOU: string;
|
|
36
|
+
XGMT_USDG_GMX_IOU: string;
|
|
37
|
+
};
|
|
38
|
+
97: {
|
|
39
|
+
Vault: string;
|
|
40
|
+
Router: string;
|
|
41
|
+
Reader: string;
|
|
42
|
+
AmmFactory: string;
|
|
43
|
+
AmmFactoryV2: string;
|
|
44
|
+
OrderBook: string;
|
|
45
|
+
OrderBookReader: string;
|
|
46
|
+
GmxMigrator: string;
|
|
47
|
+
USDG: string;
|
|
48
|
+
GMT: string;
|
|
49
|
+
NATIVE_TOKEN: string;
|
|
50
|
+
XGMT: string;
|
|
51
|
+
GMT_USDG_PAIR: string;
|
|
52
|
+
XGMT_USDG_PAIR: string;
|
|
53
|
+
GMT_USDG_FARM: string;
|
|
54
|
+
XGMT_USDG_FARM: string;
|
|
55
|
+
USDG_YIELD_TRACKER: string;
|
|
56
|
+
XGMT_YIELD_TRACKER: string;
|
|
57
|
+
GMT_USDG_FARM_TRACKER_XGMT: string;
|
|
58
|
+
GMT_USDG_FARM_TRACKER_NATIVE: string;
|
|
59
|
+
XGMT_USDG_FARM_TRACKER_XGMT: string;
|
|
60
|
+
XGMT_USDG_FARM_TRACKER_NATIVE: string;
|
|
61
|
+
GMT_GMX_IOU: string;
|
|
62
|
+
XGMT_GMX_IOU: string;
|
|
63
|
+
GMT_USDG_GMX_IOU: string;
|
|
64
|
+
XGMT_USDG_GMX_IOU: string;
|
|
65
|
+
};
|
|
66
|
+
42161: {
|
|
67
|
+
Vault: string;
|
|
68
|
+
Router: string;
|
|
69
|
+
VaultReader: string;
|
|
70
|
+
Reader: string;
|
|
71
|
+
GlpManager: string;
|
|
72
|
+
RewardRouter: string;
|
|
73
|
+
GlpRewardRouter: string;
|
|
74
|
+
RewardReader: string;
|
|
75
|
+
GovToken: string;
|
|
76
|
+
NATIVE_TOKEN: string;
|
|
77
|
+
GLP: string;
|
|
78
|
+
GMX: string;
|
|
79
|
+
ES_GMX: string;
|
|
80
|
+
BN_GMX: string;
|
|
81
|
+
USDG: string;
|
|
82
|
+
ES_GMX_IOU: string;
|
|
83
|
+
StakedGmxTracker: string;
|
|
84
|
+
BonusGmxTracker: string;
|
|
85
|
+
FeeGmxTracker: string;
|
|
86
|
+
StakedGlpTracker: string;
|
|
87
|
+
FeeGlpTracker: string;
|
|
88
|
+
ExtendedGmxTracker: string;
|
|
89
|
+
StakedGmxDistributor: string;
|
|
90
|
+
StakedGlpDistributor: string;
|
|
91
|
+
GmxVester: string;
|
|
92
|
+
GlpVester: string;
|
|
93
|
+
AffiliateVester: string;
|
|
94
|
+
OrderBook: string;
|
|
95
|
+
OrderExecutor: string;
|
|
96
|
+
OrderBookReader: string;
|
|
97
|
+
PositionRouter: string;
|
|
98
|
+
PositionManager: string;
|
|
99
|
+
UniswapGmxEthPool: string;
|
|
100
|
+
ReferralStorage: string;
|
|
101
|
+
ReferralReader: string;
|
|
102
|
+
Timelock: string;
|
|
103
|
+
DataStore: string;
|
|
104
|
+
EventEmitter: string;
|
|
105
|
+
SubaccountRouter: string;
|
|
106
|
+
ExchangeRouter: string;
|
|
107
|
+
DepositVault: string;
|
|
108
|
+
WithdrawalVault: string;
|
|
109
|
+
OrderVault: string;
|
|
110
|
+
ShiftVault: string;
|
|
111
|
+
SyntheticsReader: string;
|
|
112
|
+
SyntheticsRouter: string;
|
|
113
|
+
GlvReader: string;
|
|
114
|
+
GlvRouter: string;
|
|
115
|
+
GlvVault: string;
|
|
116
|
+
GelatoRelayRouter: string;
|
|
117
|
+
SubaccountGelatoRelayRouter: string;
|
|
118
|
+
ExternalHandler: string;
|
|
119
|
+
OpenOceanRouter: string;
|
|
120
|
+
ChainlinkPriceFeedProvider: string;
|
|
121
|
+
Multicall: string;
|
|
122
|
+
ArbitrumNodeInterface: string;
|
|
123
|
+
};
|
|
124
|
+
43114: {
|
|
125
|
+
Vault: string;
|
|
126
|
+
Router: string;
|
|
127
|
+
VaultReader: string;
|
|
128
|
+
Reader: string;
|
|
129
|
+
GlpManager: string;
|
|
130
|
+
RewardRouter: string;
|
|
131
|
+
GlpRewardRouter: string;
|
|
132
|
+
RewardReader: string;
|
|
133
|
+
GovToken: string;
|
|
134
|
+
NATIVE_TOKEN: string;
|
|
135
|
+
GLP: string;
|
|
136
|
+
GMX: string;
|
|
137
|
+
ES_GMX: string;
|
|
138
|
+
BN_GMX: string;
|
|
139
|
+
USDG: string;
|
|
140
|
+
ES_GMX_IOU: string;
|
|
141
|
+
StakedGmxTracker: string;
|
|
142
|
+
BonusGmxTracker: string;
|
|
143
|
+
FeeGmxTracker: string;
|
|
144
|
+
StakedGlpTracker: string;
|
|
145
|
+
FeeGlpTracker: string;
|
|
146
|
+
ExtendedGmxTracker: string;
|
|
147
|
+
StakedGmxDistributor: string;
|
|
148
|
+
StakedGlpDistributor: string;
|
|
149
|
+
GmxVester: string;
|
|
150
|
+
GlpVester: string;
|
|
151
|
+
AffiliateVester: string;
|
|
152
|
+
OrderBook: string;
|
|
153
|
+
OrderExecutor: string;
|
|
154
|
+
OrderBookReader: string;
|
|
155
|
+
PositionRouter: string;
|
|
156
|
+
PositionManager: string;
|
|
157
|
+
TraderJoeGmxAvaxPool: string;
|
|
158
|
+
ReferralStorage: string;
|
|
159
|
+
ReferralReader: string;
|
|
160
|
+
Timelock: string;
|
|
161
|
+
DataStore: string;
|
|
162
|
+
EventEmitter: string;
|
|
163
|
+
SubaccountRouter: string;
|
|
164
|
+
ExchangeRouter: string;
|
|
165
|
+
DepositVault: string;
|
|
166
|
+
WithdrawalVault: string;
|
|
167
|
+
OrderVault: string;
|
|
168
|
+
ShiftVault: string;
|
|
169
|
+
SyntheticsReader: string;
|
|
170
|
+
SyntheticsRouter: string;
|
|
171
|
+
GlvReader: string;
|
|
172
|
+
GlvRouter: string;
|
|
173
|
+
GlvVault: string;
|
|
174
|
+
GelatoRelayRouter: string;
|
|
175
|
+
SubaccountGelatoRelayRouter: string;
|
|
176
|
+
ExternalHandler: string;
|
|
177
|
+
OpenOceanRouter: string;
|
|
178
|
+
ChainlinkPriceFeedProvider: string;
|
|
179
|
+
Multicall: string;
|
|
180
|
+
ArbitrumNodeInterface: "0x0000000000000000000000000000000000000000";
|
|
181
|
+
};
|
|
182
|
+
43113: {
|
|
183
|
+
Vault: "0x0000000000000000000000000000000000000000";
|
|
184
|
+
Router: "0x0000000000000000000000000000000000000000";
|
|
185
|
+
VaultReader: "0x0000000000000000000000000000000000000000";
|
|
186
|
+
Reader: "0x0000000000000000000000000000000000000000";
|
|
187
|
+
GlpManager: "0x0000000000000000000000000000000000000000";
|
|
188
|
+
RewardRouter: "0x0000000000000000000000000000000000000000";
|
|
189
|
+
RewardReader: "0x0000000000000000000000000000000000000000";
|
|
190
|
+
GlpRewardRouter: "0x0000000000000000000000000000000000000000";
|
|
191
|
+
NATIVE_TOKEN: string;
|
|
192
|
+
GLP: "0x0000000000000000000000000000000000000000";
|
|
193
|
+
GMX: "0x0000000000000000000000000000000000000000";
|
|
194
|
+
ES_GMX: "0x0000000000000000000000000000000000000000";
|
|
195
|
+
BN_GMX: "0x0000000000000000000000000000000000000000";
|
|
196
|
+
USDG: "0x0000000000000000000000000000000000000000";
|
|
197
|
+
ES_GMX_IOU: "0x0000000000000000000000000000000000000000";
|
|
198
|
+
StakedGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
199
|
+
BonusGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
200
|
+
FeeGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
201
|
+
StakedGlpTracker: "0x0000000000000000000000000000000000000000";
|
|
202
|
+
FeeGlpTracker: "0x0000000000000000000000000000000000000000";
|
|
203
|
+
ExtendedGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
204
|
+
StakedGmxDistributor: "0x0000000000000000000000000000000000000000";
|
|
205
|
+
StakedGlpDistributor: "0x0000000000000000000000000000000000000000";
|
|
206
|
+
GmxVester: "0x0000000000000000000000000000000000000000";
|
|
207
|
+
GlpVester: "0x0000000000000000000000000000000000000000";
|
|
208
|
+
AffiliateVester: "0x0000000000000000000000000000000000000000";
|
|
209
|
+
OrderBook: "0x0000000000000000000000000000000000000000";
|
|
210
|
+
OrderExecutor: "0x0000000000000000000000000000000000000000";
|
|
211
|
+
OrderBookReader: "0x0000000000000000000000000000000000000000";
|
|
212
|
+
PositionRouter: "0x0000000000000000000000000000000000000000";
|
|
213
|
+
PositionManager: "0x0000000000000000000000000000000000000000";
|
|
214
|
+
TraderJoeGmxAvaxPool: "0x0000000000000000000000000000000000000000";
|
|
215
|
+
ReferralStorage: string;
|
|
216
|
+
ReferralReader: "0x0000000000000000000000000000000000000000";
|
|
217
|
+
DataStore: string;
|
|
218
|
+
EventEmitter: string;
|
|
219
|
+
ExchangeRouter: string;
|
|
220
|
+
SubaccountRouter: string;
|
|
221
|
+
DepositVault: string;
|
|
222
|
+
WithdrawalVault: string;
|
|
223
|
+
OrderVault: string;
|
|
224
|
+
ShiftVault: string;
|
|
225
|
+
SyntheticsReader: string;
|
|
226
|
+
SyntheticsRouter: string;
|
|
227
|
+
Timelock: "0x0000000000000000000000000000000000000000";
|
|
228
|
+
GlvReader: string;
|
|
229
|
+
GlvRouter: string;
|
|
230
|
+
GlvVault: string;
|
|
231
|
+
GelatoRelayRouter: "0x0000000000000000000000000000000000000000";
|
|
232
|
+
SubaccountGelatoRelayRouter: "0x0000000000000000000000000000000000000000";
|
|
233
|
+
OpenOceanRouter: "0x0000000000000000000000000000000000000000";
|
|
234
|
+
ExternalHandler: string;
|
|
235
|
+
ChainlinkPriceFeedProvider: "0x0000000000000000000000000000000000000000";
|
|
236
|
+
Multicall: string;
|
|
237
|
+
ArbitrumNodeInterface: "0x0000000000000000000000000000000000000000";
|
|
238
|
+
};
|
|
239
|
+
};
|
|
3
240
|
export declare function getContract(chainId: number, name: string): Address;
|
|
@@ -5,6 +5,7 @@ export declare const POSITION_FEE_FACTOR_KEY: string;
|
|
|
5
5
|
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
|
+
export declare const ATOMIC_SWAP_FEE_FACTOR_KEY: string;
|
|
8
9
|
export declare const FEE_RECEIVER_DEPOSIT_FACTOR_KEY: string;
|
|
9
10
|
export declare const BORROWING_FEE_RECEIVER_FACTOR_KEY: string;
|
|
10
11
|
export declare const FEE_RECEIVER_WITHDRAWAL_FACTOR_KEY: string;
|
|
@@ -87,6 +88,12 @@ export declare const MAX_AUTO_CANCEL_ORDERS_KEY: string;
|
|
|
87
88
|
export declare const OPTIMAL_USAGE_FACTOR: string;
|
|
88
89
|
export declare const BASE_BORROWING_FACTOR: string;
|
|
89
90
|
export declare const ABOVE_OPTIMAL_USAGE_BORROWING_FACTOR: string;
|
|
91
|
+
export declare const SUBACCOUNT_EXPIRES_AT: string;
|
|
92
|
+
export declare const PRICE_FEED_KEY: string;
|
|
93
|
+
export declare const GASLESS_FEATURE_DISABLED_KEY: string;
|
|
94
|
+
export declare const GELATO_RELAY_FEE_MULTIPLIER_FACTOR_KEY: string;
|
|
95
|
+
export declare const GMX_SIMULATION_ORIGIN: string;
|
|
96
|
+
export declare function subaccountExpiresAtKey(account: string, subaccount: string, actionType: string): string;
|
|
90
97
|
export declare function glvShiftLastExecutedAtKey(glvAddress: string): string;
|
|
91
98
|
export declare function glvShiftMinIntervalKey(glvAddress: string): string;
|
|
92
99
|
export declare function glvMaxMarketTokenBalanceUsdKey(glvAddress: string, market: string): string;
|
|
@@ -99,6 +106,7 @@ export declare function positionFeeFactorKey(market: string, forPositiveImpact:
|
|
|
99
106
|
export declare function swapImpactFactorKey(market: string, isPositive: boolean): string;
|
|
100
107
|
export declare function swapImpactExponentFactorKey(market: string): string;
|
|
101
108
|
export declare function swapFeeFactorKey(market: string, forPositiveImpact: boolean): string;
|
|
109
|
+
export declare function atomicSwapFeeFactorKey(market: string): string;
|
|
102
110
|
export declare function openInterestKey(market: string, collateralToken: string, isLong: boolean): string;
|
|
103
111
|
export declare function openInterestInTokensKey(market: string, collateralToken: string, isLong: boolean): string;
|
|
104
112
|
export declare function poolAmountKey(market: string, token: string): string;
|
|
@@ -150,3 +158,5 @@ export declare function subaccountListKey(account: string): string;
|
|
|
150
158
|
export declare function maxAllowedSubaccountActionCountKey(account: string, subaccount: string, actionType: string): string;
|
|
151
159
|
export declare function subaccountActionCountKey(account: string, subaccount: string, actionType: string): string;
|
|
152
160
|
export declare function subaccountAutoTopUpAmountKey(account: string, subaccount: string): string;
|
|
161
|
+
export declare function priceFeedKey(token: string): string;
|
|
162
|
+
export declare function gaslessFeatureDisabledKey(module: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Token } from "../types/tokens";
|
|
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";
|
|
4
|
+
export declare const DEFAULT_SUBACCOUNT_EXPIRY_DURATION: number;
|
|
5
|
+
export declare const DEFAULT_SUBACCOUNT_MAX_ALLOWED_COUNT = 90;
|
|
6
|
+
export declare const DEFAULT_PERMIT_DEADLINE_DURATION: number;
|
|
7
|
+
export declare const DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION: number;
|
|
8
|
+
export declare const MIN_GELATO_USD_BALANCE_FOR_SPONSORED_CALL: bigint;
|
|
9
|
+
export declare const MIN_RELAYER_FEE_USD: bigint;
|
|
10
|
+
export declare function getGasPaymentTokens(chainId: number): string[];
|
|
11
|
+
export declare function getDefaultGasPaymentToken(chainId: number): string;
|
|
12
|
+
export declare function getRelayerFeeToken(chainId: number): Token;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare const BASIS_POINTS_DIVISOR = 10000;
|
|
3
|
-
export declare const BASIS_POINTS_DIVISOR_BIGINT = 10000n;
|
|
1
|
+
export { USD_DECIMALS, BASIS_POINTS_DIVISOR, BASIS_POINTS_DIVISOR_BIGINT } from "../utils/numbers";
|
|
4
2
|
export declare const HIGH_PRICE_IMPACT_BPS = 80;
|
|
5
3
|
export declare const HIGH_POSITION_IMPACT_BPS = 50;
|
|
6
4
|
export declare const HIGH_COLLATERAL_IMPACT_BPS = 500;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Token, TokenCategory } from "../types/tokens";
|
|
1
|
+
import type { Token, TokenAddressTypesMap, TokenCategory } from "../types/tokens";
|
|
2
2
|
export declare const NATIVE_TOKEN_ADDRESS: "0x0000000000000000000000000000000000000000";
|
|
3
3
|
export declare const TOKENS: {
|
|
4
4
|
[chainId: number]: Token[];
|
|
@@ -79,7 +79,7 @@ export declare function getTokenBySymbol(chainId: number, symbol: string, { isSy
|
|
|
79
79
|
version?: "v1" | "v2";
|
|
80
80
|
symbolType?: "symbol" | "baseSymbol";
|
|
81
81
|
}): Token;
|
|
82
|
-
export declare function convertTokenAddress(chainId: number, address: string, convertTo?:
|
|
82
|
+
export declare function convertTokenAddress<T extends keyof TokenAddressTypesMap, R extends TokenAddressTypesMap[T]>(chainId: number, address: string, convertTo?: T): R;
|
|
83
83
|
export declare function getNormalizedTokenSymbol(tokenSymbol: string): string;
|
|
84
84
|
export declare function isChartAvailableForToken(chainId: number, tokenSymbol: string): boolean;
|
|
85
85
|
export declare function getPriceDecimals(chainId: number, tokenSymbol?: string): number;
|
|
@@ -33,7 +33,7 @@ export declare function buildMarketsConfigsRequest(chainId: number, { marketsDat
|
|
|
33
33
|
dataStoreAddress: string;
|
|
34
34
|
}): Promise<import("../../utils/multicall").MulticallRequestConfig<{
|
|
35
35
|
[key: `${string}-dataStore`]: {
|
|
36
|
-
calls: Record<"isDisabled" | "maxLongPoolAmount" | "maxShortPoolAmount" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "longPoolAmountAdjustment" | "shortPoolAmountAdjustment" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForStableFunding" | "thresholdForDecreaseFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "positionFeeFactorForPositiveImpact" | "positionFeeFactorForNegativeImpact" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "minCollateralFactor" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionImpactExponentFactor" | "swapFeeFactorForPositiveImpact" | "swapFeeFactorForNegativeImpact" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId", {
|
|
36
|
+
calls: Record<"isDisabled" | "maxLongPoolAmount" | "maxShortPoolAmount" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "longPoolAmountAdjustment" | "shortPoolAmountAdjustment" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForStableFunding" | "thresholdForDecreaseFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "positionFeeFactorForPositiveImpact" | "positionFeeFactorForNegativeImpact" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "minCollateralFactor" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionImpactExponentFactor" | "swapFeeFactorForPositiveImpact" | "swapFeeFactorForNegativeImpact" | "atomicSwapFeeFactor" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId", {
|
|
37
37
|
methodName: string;
|
|
38
38
|
params: any[];
|
|
39
39
|
}>;
|
|
@@ -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" | "longPoolAmountAdjustment" | "shortPoolAmountAdjustment" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForDecreaseFunding" | "thresholdForStableFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "minCollateralFactor" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionFeeFactorForPositiveImpact" | "positionFeeFactorForNegativeImpact" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "positionImpactExponentFactor" | "swapFeeFactorForPositiveImpact" | "swapFeeFactorForNegativeImpact" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId">;
|
|
21
|
+
export type MarketConfig = Pick<MarketInfo, "isDisabled" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "maxLongPoolAmount" | "maxShortPoolAmount" | "longPoolAmountAdjustment" | "shortPoolAmountAdjustment" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForDecreaseFunding" | "thresholdForStableFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "minCollateralFactor" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionFeeFactorForPositiveImpact" | "positionFeeFactorForNegativeImpact" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "positionImpactExponentFactor" | "swapFeeFactorForPositiveImpact" | "swapFeeFactorForNegativeImpact" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "atomicSwapFeeFactor" | "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" | "longPoolAmountAdjustment" | "shortPoolAmountAdjustment" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForStableFunding" | "thresholdForDecreaseFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "positionFeeFactorForPositiveImpact" | "positionFeeFactorForNegativeImpact" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "minCollateralFactor" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionImpactExponentFactor" | "swapFeeFactorForPositiveImpact" | "swapFeeFactorForNegativeImpact" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId", {
|
|
38
|
+
calls: Record<"isDisabled" | "maxLongPoolAmount" | "maxShortPoolAmount" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "longPoolAmountAdjustment" | "shortPoolAmountAdjustment" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForStableFunding" | "thresholdForDecreaseFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "positionFeeFactorForPositiveImpact" | "positionFeeFactorForNegativeImpact" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "minCollateralFactor" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionImpactExponentFactor" | "swapFeeFactorForPositiveImpact" | "swapFeeFactorForNegativeImpact" | "atomicSwapFeeFactor" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId", {
|
|
39
39
|
methodName: string;
|
|
40
40
|
params: any[];
|
|
41
41
|
}>;
|
|
@@ -39,7 +39,7 @@ export declare class Orders extends Module {
|
|
|
39
39
|
increaseAmounts: IncreasePositionAmounts;
|
|
40
40
|
skipSimulation?: boolean;
|
|
41
41
|
}): Promise<void>;
|
|
42
|
-
createDecreaseOrder({ marketsInfoData, tokensData, marketInfo, decreaseAmounts, collateralToken, allowedSlippage, isLong, referralCode, }: {
|
|
42
|
+
createDecreaseOrder({ marketsInfoData, tokensData, marketInfo, decreaseAmounts, collateralToken, allowedSlippage, isLong, referralCode, isTrigger, }: {
|
|
43
43
|
marketInfo: MarketInfo;
|
|
44
44
|
marketsInfoData: MarketsInfoData;
|
|
45
45
|
tokensData: TokensData;
|
|
@@ -48,6 +48,7 @@ export declare class Orders extends Module {
|
|
|
48
48
|
decreaseAmounts: DecreasePositionAmounts;
|
|
49
49
|
collateralToken: TokenData;
|
|
50
50
|
referralCode?: string;
|
|
51
|
+
isTrigger?: boolean;
|
|
51
52
|
}): Promise<void>;
|
|
52
53
|
createSwapOrder({ isLimit, swapAmounts, allowedSlippage, fromToken, toToken, referralCodeForTxn, tokensData, triggerPrice, }: {
|
|
53
54
|
isLimit: boolean;
|
|
@@ -65,7 +65,7 @@ export declare function getPendingOrderFromParams(chainId: number, txnType: Orde
|
|
|
65
65
|
txnType: OrderTxnType;
|
|
66
66
|
account: string;
|
|
67
67
|
marketAddress: string;
|
|
68
|
-
initialCollateralTokenAddress:
|
|
68
|
+
initialCollateralTokenAddress: import("../../../types/tokens").ERC20Address;
|
|
69
69
|
initialCollateralDeltaAmount: bigint;
|
|
70
70
|
swapPath: string[];
|
|
71
71
|
sizeDeltaUsd: bigint;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { MarketInfo, MarketsData, MarketsInfoData } from "../types/markets";
|
|
2
|
-
import { TokenData, TokensData } from "../types/tokens";
|
|
2
|
+
import { Token, TokenData, TokensData } from "../types/tokens";
|
|
3
|
+
import { ExternalSwapQuote } from "../types/trade";
|
|
3
4
|
export declare function usdToToken(usd: number, token: TokenData): bigint;
|
|
5
|
+
export declare const MOCK_GAS_PRICE = 100000000n;
|
|
4
6
|
export declare function mockMarketKeys(): string[];
|
|
5
7
|
export declare function mockTokensData(overrides?: {
|
|
6
8
|
[symbol: string]: Partial<TokenData>;
|
|
@@ -12,3 +14,16 @@ export declare function mockMarketsData(marketKeys: string[]): MarketsData;
|
|
|
12
14
|
export declare function mockMarketsInfoData(tokensData: TokensData, marketKeys: string[], overrides?: {
|
|
13
15
|
[marketKey: string]: Partial<MarketInfo>;
|
|
14
16
|
}): MarketsInfoData;
|
|
17
|
+
export declare function mockExternalSwap({ inToken, outToken, amountIn, amountOut, priceIn, priceOut, feesUsd, // $5 default fee
|
|
18
|
+
data, to, receiver, }: {
|
|
19
|
+
inToken: Token;
|
|
20
|
+
outToken: Token;
|
|
21
|
+
amountIn: bigint;
|
|
22
|
+
amountOut: bigint;
|
|
23
|
+
priceIn: bigint;
|
|
24
|
+
priceOut: bigint;
|
|
25
|
+
feesUsd?: bigint;
|
|
26
|
+
data?: string;
|
|
27
|
+
to?: string;
|
|
28
|
+
receiver?: string;
|
|
29
|
+
}): ExternalSwapQuote;
|
|
@@ -34,7 +34,16 @@ export type GasLimitsConfig = {
|
|
|
34
34
|
estimatedGasFeeBaseAmount: bigint;
|
|
35
35
|
estimatedGasFeePerOraclePrice: bigint;
|
|
36
36
|
estimatedFeeMultiplierFactor: bigint;
|
|
37
|
+
gelatoRelayFeeMultiplierFactor: bigint;
|
|
37
38
|
glvDepositGasLimit: bigint;
|
|
38
39
|
glvWithdrawalGasLimit: bigint;
|
|
39
40
|
glvPerMarketGasLimit: bigint;
|
|
41
|
+
createOrderGasLimit: bigint;
|
|
42
|
+
updateOrderGasLimit: bigint;
|
|
43
|
+
cancelOrderGasLimit: bigint;
|
|
44
|
+
tokenPermitGasLimit: bigint;
|
|
45
|
+
};
|
|
46
|
+
export type L1ExpressOrderGasReference = {
|
|
47
|
+
gasLimit: bigint;
|
|
48
|
+
sizeOfData: bigint;
|
|
40
49
|
};
|
|
@@ -79,6 +79,7 @@ export type MarketInfo = Market & MarketPoolTokens & {
|
|
|
79
79
|
positionImpactExponentFactor: bigint;
|
|
80
80
|
swapFeeFactorForPositiveImpact: bigint;
|
|
81
81
|
swapFeeFactorForNegativeImpact: bigint;
|
|
82
|
+
atomicSwapFeeFactor: bigint;
|
|
82
83
|
swapImpactFactorPositive: bigint;
|
|
83
84
|
swapImpactFactorNegative: bigint;
|
|
84
85
|
swapImpactExponentFactor: bigint;
|
|
@@ -12,6 +12,9 @@ export declare enum OrderType {
|
|
|
12
12
|
Liquidation = 7,
|
|
13
13
|
StopIncrease = 8
|
|
14
14
|
}
|
|
15
|
+
export type SwapOrderType = OrderType.MarketSwap | OrderType.LimitSwap;
|
|
16
|
+
export type IncreaseOrderType = OrderType.MarketIncrease | OrderType.LimitIncrease | OrderType.StopIncrease;
|
|
17
|
+
export type DecreaseOrderType = OrderType.MarketDecrease | OrderType.LimitDecrease | OrderType.StopLossDecrease;
|
|
15
18
|
export declare enum SwapPricingType {
|
|
16
19
|
TwoStep = 0,
|
|
17
20
|
Shift = 1,
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
export type ERC20Address = string & {
|
|
2
|
+
__brand: "ERC20Address";
|
|
3
|
+
};
|
|
4
|
+
export type NativeTokenSupportedAddress = string & {
|
|
5
|
+
__brand: "NativeTokenSupportedAddress";
|
|
6
|
+
};
|
|
7
|
+
export type TokenAddressTypesMap = {
|
|
8
|
+
wrapped: ERC20Address;
|
|
9
|
+
native: NativeTokenSupportedAddress;
|
|
10
|
+
};
|
|
11
|
+
export type ContractPrice = bigint & {
|
|
12
|
+
__brand: "contractPrice";
|
|
13
|
+
};
|
|
1
14
|
export type TokenCategory = "meme" | "layer1" | "layer2" | "defi";
|
|
2
15
|
export type Token = {
|
|
3
16
|
name: string;
|
|
@@ -18,6 +31,9 @@ export type Token = {
|
|
|
18
31
|
reservesUrl?: string;
|
|
19
32
|
imageUrl?: string;
|
|
20
33
|
categories?: TokenCategory[];
|
|
34
|
+
isPermitSupported?: boolean;
|
|
35
|
+
isPermitDisabled?: boolean;
|
|
36
|
+
contractVersion?: string;
|
|
21
37
|
isUsdg?: boolean;
|
|
22
38
|
isNative?: boolean;
|
|
23
39
|
isWrapped?: boolean;
|
|
@@ -63,6 +79,16 @@ export type TokenInfo = Token & {
|
|
|
63
79
|
maxGlobalShortSize?: bigint;
|
|
64
80
|
maxLongCapacity?: bigint;
|
|
65
81
|
};
|
|
82
|
+
export type SignedTokenPermit = {
|
|
83
|
+
owner: string;
|
|
84
|
+
spender: string;
|
|
85
|
+
value: bigint;
|
|
86
|
+
deadline: bigint;
|
|
87
|
+
v: number;
|
|
88
|
+
r: string;
|
|
89
|
+
s: string;
|
|
90
|
+
token: string;
|
|
91
|
+
};
|
|
66
92
|
export type InfoTokens = {
|
|
67
93
|
[key: string]: TokenInfo;
|
|
68
94
|
};
|
|
@@ -74,6 +100,7 @@ export type TokenData = Token & {
|
|
|
74
100
|
prices: TokenPrices;
|
|
75
101
|
balance?: bigint;
|
|
76
102
|
totalSupply?: bigint;
|
|
103
|
+
hasPriceFeedProvider?: boolean;
|
|
77
104
|
};
|
|
78
105
|
export type TokensRatio = {
|
|
79
106
|
ratio: bigint;
|
|
@@ -214,29 +214,11 @@ export type TradeFeesType = "swap" | "increase" | "decrease" | "edit";
|
|
|
214
214
|
export declare enum ExternalSwapAggregator {
|
|
215
215
|
OpenOcean = "openOcean"
|
|
216
216
|
}
|
|
217
|
-
export type ExternalSwapOutput = {
|
|
218
|
-
aggregator: ExternalSwapAggregator;
|
|
219
|
-
inTokenAddress: string;
|
|
220
|
-
outTokenAddress: string;
|
|
221
|
-
amountIn: bigint;
|
|
222
|
-
amountOut: bigint;
|
|
223
|
-
usdIn: bigint | undefined;
|
|
224
|
-
usdOut: bigint | undefined;
|
|
225
|
-
priceIn: bigint | undefined;
|
|
226
|
-
priceOut: bigint | undefined;
|
|
227
|
-
feesUsd: bigint | undefined;
|
|
228
|
-
needSpenderApproval?: boolean;
|
|
229
|
-
txnData: {
|
|
230
|
-
to: string;
|
|
231
|
-
data: string;
|
|
232
|
-
value: bigint;
|
|
233
|
-
estimatedGas: bigint;
|
|
234
|
-
};
|
|
235
|
-
};
|
|
236
217
|
export type ExternalSwapQuote = {
|
|
237
218
|
aggregator: ExternalSwapAggregator;
|
|
238
219
|
inTokenAddress: string;
|
|
239
220
|
outTokenAddress: string;
|
|
221
|
+
receiver: string;
|
|
240
222
|
amountIn: bigint;
|
|
241
223
|
amountOut: bigint;
|
|
242
224
|
usdIn: bigint;
|
|
@@ -250,6 +232,7 @@ export type ExternalSwapQuote = {
|
|
|
250
232
|
data: string;
|
|
251
233
|
value: bigint;
|
|
252
234
|
estimatedGas: bigint;
|
|
235
|
+
estimatedExecutionFee: bigint;
|
|
253
236
|
};
|
|
254
237
|
};
|
|
255
238
|
export type ExternalSwapCalculationStrategy = "byFromValue" | "leverageBySize";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|