@gmx-io/sdk 2.4.0 → 2.6.0-next.0
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/generate-synthetics-abis.js +17 -2
- package/build/cjs/src/abis/CustomErrors.js +98 -0
- package/build/cjs/src/abis/CustomErrorsV2_2_1.js +5565 -0
- package/build/cjs/src/abis/ExchangeRouterV2_2_1.js +1462 -0
- package/build/cjs/src/abis/GelatoRelayRouterV2_2_1.js +1945 -0
- package/build/cjs/src/abis/GlvReaderV2_2_1.js +1681 -0
- package/build/cjs/src/abis/MultichainClaimsRouterV2_2_1.js +1281 -0
- package/build/cjs/src/abis/MultichainGlvRouterV2_2_1.js +1176 -0
- package/build/cjs/src/abis/MultichainGmRouterV2_2_1.js +1480 -0
- package/build/cjs/src/abis/MultichainOrderRouterV2_2_1.js +2065 -0
- package/build/cjs/src/abis/MultichainSubaccountRouterV2_2_1.js +2160 -0
- package/build/cjs/src/abis/MultichainTransferRouterV2_2_1.js +1033 -0
- package/build/cjs/src/abis/RelayParamsV2_2_1.js +56 -0
- package/build/cjs/src/abis/RewardRouterV3.js +675 -0
- package/build/cjs/src/abis/SubaccountGelatoRelayRouterV2_2_1.js +2502 -0
- package/build/cjs/src/abis/SyntheticsReaderV2_2_1.js +5279 -0
- package/build/cjs/src/abis/__tests__/fixtures/arbitrumSepoliaReaders.json +8 -0
- package/build/cjs/src/abis/__tests__/getAbi.spec.js +84 -0
- package/build/cjs/src/abis/getAbi.js +42 -0
- package/build/cjs/src/abis/index.js +4 -1
- package/build/cjs/src/clients/v1/modules/orders/orders.js +5 -3
- package/build/cjs/src/clients/v1/modules/orders/transactions/createIncreaseOrderTxn.js +3 -1
- package/build/cjs/src/clients/v1/modules/orders/transactions/updateOrderTxn.js +21 -25
- package/build/cjs/src/clients/v1/modules/orders/utils.js +6 -7
- package/build/cjs/src/clients/v1/modules/trades/trades.js +4 -3
- package/build/cjs/src/clients/v1/multicall.js +2 -1
- package/build/cjs/src/clients/v2/__tests__/decrease.spec.js +0 -2
- package/build/cjs/src/clients/v2/__tests__/editCancel.spec.js +0 -3
- package/build/cjs/src/clients/v2/__tests__/globalCleanup.js +0 -1
- package/build/cjs/src/clients/v2/__tests__/increase.spec.js +0 -2
- package/build/cjs/src/clients/v2/__tests__/subaccountLifecycle.spec.js +0 -1
- package/build/cjs/src/clients/v2/__tests__/testUtil.js +0 -1
- package/build/cjs/src/configs/__tests__/markets.spec.js +8 -1
- package/build/cjs/src/configs/chains.js +3 -0
- package/build/cjs/src/configs/contracts.js +27 -18
- package/build/cjs/src/configs/dataStore.js +13 -3
- package/build/cjs/src/utils/__tests__/address.spec.js +50 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +41 -4
- package/build/cjs/src/utils/__tests__/orderTransactions/updateOrder.spec.js +4 -0
- package/build/cjs/src/utils/__tests__/referrals.spec.js +36 -4
- package/build/cjs/src/utils/address/index.js +17 -0
- package/build/cjs/src/utils/address/utils.js +32 -0
- package/build/cjs/src/utils/errors/transactionsErrors.js +17 -0
- package/build/cjs/src/utils/express/utils/batchOrderUtils.js +14 -9
- package/build/cjs/src/utils/express/utils/bridgeOutUtils.js +52 -17
- package/build/cjs/src/utils/express/utils/referralUtils.js +38 -25
- package/build/cjs/src/utils/express/utils/relayParamsUtils.js +11 -3
- package/build/cjs/src/utils/multichain/api.js +17 -8
- package/build/cjs/src/utils/orderTransactions/api.js +3 -4
- package/build/cjs/src/utils/orderTransactions/utils.js +8 -7
- package/build/cjs/src/utils/referrals/utils.js +24 -15
- package/build/cjs/src/utils/subaccount/getEmptySubaccountApproval.js +2 -0
- package/build/cjs/src/utils/subaccount/getSubaccountApprovalTypedData.js +37 -15
- package/build/cjs/src/utils/subaccount/hashSubaccountApproval.js +32 -18
- package/build/cjs/src/utils/subaccount/index.js +4 -1
- package/build/cjs/src/utils/subaccount/sdkClient.js +1 -1
- package/build/cjs/src/utils/subaccount/state.js +10 -1
- package/build/cjs/src/utils/tradeHistory/utils.js +6 -6
- package/build/esm/scripts/generate-synthetics-abis.js +17 -2
- package/build/esm/src/abis/CustomErrors.js +98 -0
- package/build/esm/src/abis/CustomErrorsV2_2_1.js +5563 -0
- package/build/esm/src/abis/ExchangeRouterV2_2_1.js +1460 -0
- package/build/esm/src/abis/GelatoRelayRouterV2_2_1.js +1943 -0
- package/build/esm/src/abis/GlvReaderV2_2_1.js +1679 -0
- package/build/esm/src/abis/MultichainClaimsRouterV2_2_1.js +1279 -0
- package/build/esm/src/abis/MultichainGlvRouterV2_2_1.js +1174 -0
- package/build/esm/src/abis/MultichainGmRouterV2_2_1.js +1478 -0
- package/build/esm/src/abis/MultichainOrderRouterV2_2_1.js +2063 -0
- package/build/esm/src/abis/MultichainSubaccountRouterV2_2_1.js +2158 -0
- package/build/esm/src/abis/MultichainTransferRouterV2_2_1.js +1031 -0
- package/build/esm/src/abis/RelayParamsV2_2_1.js +54 -0
- package/build/esm/src/abis/RewardRouterV3.js +673 -0
- package/build/esm/src/abis/SubaccountGelatoRelayRouterV2_2_1.js +2500 -0
- package/build/esm/src/abis/SyntheticsReaderV2_2_1.js +5277 -0
- package/build/esm/src/abis/__tests__/fixtures/arbitrumSepoliaReaders.json +8 -0
- package/build/esm/src/abis/__tests__/getAbi.spec.js +79 -0
- package/build/esm/src/abis/getAbi.js +35 -0
- package/build/esm/src/abis/index.js +4 -1
- package/build/esm/src/clients/v1/modules/orders/orders.js +5 -3
- package/build/esm/src/clients/v1/modules/orders/transactions/createIncreaseOrderTxn.js +3 -1
- package/build/esm/src/clients/v1/modules/orders/transactions/updateOrderTxn.js +21 -25
- package/build/esm/src/clients/v1/modules/orders/utils.js +6 -7
- package/build/esm/src/clients/v1/modules/trades/trades.js +4 -3
- package/build/esm/src/clients/v1/multicall.js +2 -1
- package/build/esm/src/clients/v2/__tests__/decrease.spec.js +0 -2
- package/build/esm/src/clients/v2/__tests__/editCancel.spec.js +0 -3
- package/build/esm/src/clients/v2/__tests__/globalCleanup.js +0 -1
- package/build/esm/src/clients/v2/__tests__/increase.spec.js +0 -2
- package/build/esm/src/clients/v2/__tests__/subaccountLifecycle.spec.js +0 -1
- package/build/esm/src/clients/v2/__tests__/testUtil.js +0 -1
- package/build/esm/src/configs/__tests__/markets.spec.js +9 -2
- package/build/esm/src/configs/chains.js +3 -0
- package/build/esm/src/configs/contracts.js +25 -17
- package/build/esm/src/configs/dataStore.js +8 -0
- package/build/esm/src/utils/__tests__/address.spec.js +48 -0
- package/build/esm/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +43 -6
- package/build/esm/src/utils/__tests__/orderTransactions/updateOrder.spec.js +5 -1
- package/build/esm/src/utils/__tests__/referrals.spec.js +37 -5
- package/build/esm/src/utils/address/index.js +1 -0
- package/build/esm/src/utils/address/utils.js +25 -0
- package/build/esm/src/utils/errors/transactionsErrors.js +17 -0
- package/build/esm/src/utils/express/utils/batchOrderUtils.js +14 -9
- package/build/esm/src/utils/express/utils/bridgeOutUtils.js +53 -18
- package/build/esm/src/utils/express/utils/referralUtils.js +37 -25
- package/build/esm/src/utils/express/utils/relayParamsUtils.js +10 -5
- package/build/esm/src/utils/multichain/api.js +15 -7
- package/build/esm/src/utils/orderTransactions/api.js +3 -4
- package/build/esm/src/utils/orderTransactions/utils.js +9 -8
- package/build/esm/src/utils/referrals/utils.js +23 -15
- package/build/esm/src/utils/subaccount/getEmptySubaccountApproval.js +2 -0
- package/build/esm/src/utils/subaccount/getSubaccountApprovalTypedData.js +36 -14
- package/build/esm/src/utils/subaccount/hashSubaccountApproval.js +32 -18
- package/build/esm/src/utils/subaccount/index.js +2 -2
- package/build/esm/src/utils/subaccount/sdkClient.js +2 -2
- package/build/esm/src/utils/subaccount/state.js +8 -0
- package/build/esm/src/utils/tradeHistory/utils.js +6 -6
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/scripts/generate-synthetics-abis.d.ts +6 -0
- package/build/types/src/abis/CustomErrors.d.ts +160 -0
- package/build/types/src/abis/CustomErrorsV2_2_1.d.ts +4174 -0
- package/build/types/src/abis/ExchangeRouterV2_2_1.d.ts +1128 -0
- package/build/types/src/abis/GelatoRelayRouterV2_2_1.d.ts +1508 -0
- package/build/types/src/abis/GlvReaderV2_2_1.d.ts +1293 -0
- package/build/types/src/abis/MultichainClaimsRouterV2_2_1.d.ts +985 -0
- package/build/types/src/abis/MultichainGlvRouterV2_2_1.d.ts +906 -0
- package/build/types/src/abis/MultichainGmRouterV2_2_1.d.ts +1142 -0
- package/build/types/src/abis/MultichainOrderRouterV2_2_1.d.ts +1601 -0
- package/build/types/src/abis/MultichainSubaccountRouterV2_2_1.d.ts +1678 -0
- package/build/types/src/abis/MultichainTransferRouterV2_2_1.d.ts +793 -0
- package/build/types/src/abis/RelayParamsV2_2_1.d.ts +118 -0
- package/build/types/src/abis/RewardRouterV3.d.ts +1129 -0
- package/build/types/src/abis/SubaccountGelatoRelayRouterV2_2_1.d.ts +1946 -0
- package/build/types/src/abis/SyntheticsReaderV2_2_1.d.ts +4075 -0
- package/build/types/src/abis/__tests__/getAbi.spec.d.ts +1 -0
- package/build/types/src/abis/getAbi.d.ts +17051 -0
- package/build/types/src/abis/index.d.ts +6700 -4744
- package/build/types/src/clients/v1/modules/orders/transactions/createIncreaseOrderTxn.d.ts +2 -1
- package/build/types/src/clients/v1/modules/orders/transactions/updateOrderTxn.d.ts +8 -3
- package/build/types/src/configs/contracts.d.ts +6 -0
- package/build/types/src/configs/dataStore.d.ts +4 -0
- package/build/types/src/utils/__tests__/address.spec.d.ts +1 -0
- package/build/types/src/utils/address/index.d.ts +1 -0
- package/build/types/src/utils/address/utils.d.ts +11 -0
- package/build/types/src/utils/errors/transactionsErrors.d.ts +18 -1
- package/build/types/src/utils/express/types.d.ts +1 -0
- package/build/types/src/utils/express/utils/batchOrderUtils.d.ts +4 -3
- package/build/types/src/utils/express/utils/bridgeOutUtils.d.ts +8 -2
- package/build/types/src/utils/express/utils/referralUtils.d.ts +21 -0
- package/build/types/src/utils/multichain/api.d.ts +8 -0
- package/build/types/src/utils/orderTransactions/api.d.ts +0 -3
- package/build/types/src/utils/orderTransactions/utils.d.ts +5 -2
- package/build/types/src/utils/referrals/utils.d.ts +7 -1
- package/build/types/src/utils/subaccount/api.d.ts +1 -0
- package/build/types/src/utils/subaccount/getSubaccountApprovalTypedData.d.ts +4 -0
- package/build/types/src/utils/subaccount/hashSubaccountApproval.d.ts +2 -1
- package/build/types/src/utils/subaccount/index.d.ts +2 -2
- package/build/types/src/utils/subaccount/state.d.ts +2 -1
- package/build/types/src/utils/subaccount/types.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GmxSdk } from "../../..";
|
|
2
|
-
import { OrderTxnType, OrderType } from "../../../../../utils/orders/types";
|
|
2
|
+
import { DecreasePositionSwapType, OrderTxnType, OrderType } from "../../../../../utils/orders/types";
|
|
3
3
|
import { TokenData, TokenPrices, TokensData } from "../../../../../utils/tokens/types";
|
|
4
4
|
import { DecreaseOrderParams } from "./createDecreaseOrderTxn";
|
|
5
5
|
export type PriceOverrides = {
|
|
@@ -54,6 +54,7 @@ export type SecondaryUpdateOrderParams = SecondaryOrderCommonParams & {
|
|
|
54
54
|
indexToken: TokenData;
|
|
55
55
|
minOutputAmount: bigint;
|
|
56
56
|
autoCancel: boolean;
|
|
57
|
+
decreasePositionSwapType: DecreasePositionSwapType;
|
|
57
58
|
};
|
|
58
59
|
export declare function createIncreaseOrderTxn({ sdk, createIncreaseOrderParams: p, createDecreaseOrderParams, cancelOrderParams, updateOrderParams, }: {
|
|
59
60
|
sdk: GmxSdk;
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import { Address } from "viem";
|
|
2
2
|
import type { GmxSdk } from "../../..";
|
|
3
|
+
import { DecreasePositionSwapType, OrderType } from "../../../../../utils/orders/types";
|
|
3
4
|
import { Token } from "../../../../../utils/tokens/types";
|
|
4
5
|
export type UpdateOrderParams = {
|
|
5
6
|
orderKey: string;
|
|
6
|
-
|
|
7
|
+
orderType: OrderType;
|
|
8
|
+
indexToken: Token;
|
|
7
9
|
sizeDeltaUsd: bigint;
|
|
8
10
|
triggerPrice: bigint;
|
|
9
11
|
acceptablePrice: bigint;
|
|
10
12
|
minOutputAmount: bigint;
|
|
13
|
+
decreasePositionSwapType: DecreasePositionSwapType;
|
|
11
14
|
executionFee?: bigint;
|
|
12
15
|
autoCancel: boolean;
|
|
13
16
|
};
|
|
14
17
|
export declare function updateOrderTxn(sdk: GmxSdk, p: UpdateOrderParams): Promise<Address>;
|
|
15
|
-
export declare function createUpdateEncodedPayload({ sdk, orderKey, sizeDeltaUsd, executionFee, indexToken, acceptablePrice, triggerPrice, autoCancel, minOutputAmount, }: {
|
|
18
|
+
export declare function createUpdateEncodedPayload({ sdk, orderKey, orderType, sizeDeltaUsd, executionFee, indexToken, acceptablePrice, triggerPrice, autoCancel, minOutputAmount, decreasePositionSwapType, }: {
|
|
16
19
|
sdk: GmxSdk;
|
|
17
20
|
orderKey: string;
|
|
21
|
+
orderType: OrderType;
|
|
18
22
|
sizeDeltaUsd: bigint;
|
|
19
23
|
executionFee?: bigint;
|
|
20
|
-
indexToken
|
|
24
|
+
indexToken: Token;
|
|
21
25
|
acceptablePrice: bigint;
|
|
22
26
|
triggerPrice: bigint;
|
|
23
27
|
minOutputAmount: bigint;
|
|
24
28
|
autoCancel: boolean;
|
|
29
|
+
decreasePositionSwapType: DecreasePositionSwapType;
|
|
25
30
|
}): string[];
|
|
@@ -7,6 +7,7 @@ export declare const CONTRACTS: {
|
|
|
7
7
|
Reader: string;
|
|
8
8
|
GlpManager: string;
|
|
9
9
|
RewardRouter: string;
|
|
10
|
+
RewardRouterV3: string;
|
|
10
11
|
GlpRewardRouter: string;
|
|
11
12
|
RewardReader: string;
|
|
12
13
|
GovToken: string;
|
|
@@ -70,6 +71,7 @@ export declare const CONTRACTS: {
|
|
|
70
71
|
Reader: string;
|
|
71
72
|
GlpManager: string;
|
|
72
73
|
RewardRouter: string;
|
|
74
|
+
RewardRouterV3: string;
|
|
73
75
|
GlpRewardRouter: string;
|
|
74
76
|
RewardReader: string;
|
|
75
77
|
GovToken: string;
|
|
@@ -165,6 +167,7 @@ export declare const CONTRACTS: {
|
|
|
165
167
|
VaultReader: "0x0000000000000000000000000000000000000000";
|
|
166
168
|
GlpManager: "0x0000000000000000000000000000000000000000";
|
|
167
169
|
RewardRouter: "0x0000000000000000000000000000000000000000";
|
|
170
|
+
RewardRouterV3: "0x0000000000000000000000000000000000000000";
|
|
168
171
|
RewardReader: "0x0000000000000000000000000000000000000000";
|
|
169
172
|
GlpRewardRouter: "0x0000000000000000000000000000000000000000";
|
|
170
173
|
StakedGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
@@ -197,6 +200,7 @@ export declare const CONTRACTS: {
|
|
|
197
200
|
Reader: "0x0000000000000000000000000000000000000000";
|
|
198
201
|
GlpManager: "0x0000000000000000000000000000000000000000";
|
|
199
202
|
RewardRouter: "0x0000000000000000000000000000000000000000";
|
|
203
|
+
RewardRouterV3: "0x0000000000000000000000000000000000000000";
|
|
200
204
|
RewardReader: "0x0000000000000000000000000000000000000000";
|
|
201
205
|
GlpRewardRouter: "0x0000000000000000000000000000000000000000";
|
|
202
206
|
NATIVE_TOKEN: string;
|
|
@@ -295,6 +299,7 @@ export declare const CONTRACTS: {
|
|
|
295
299
|
Vault: "0x0000000000000000000000000000000000000000";
|
|
296
300
|
PositionRouter: "0x0000000000000000000000000000000000000000";
|
|
297
301
|
RewardRouter: "0x0000000000000000000000000000000000000000";
|
|
302
|
+
RewardRouterV3: "0x0000000000000000000000000000000000000000";
|
|
298
303
|
StakedGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
299
304
|
BonusGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
300
305
|
FeeGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
@@ -318,6 +323,7 @@ type ExtractContractNames<T extends object> = {
|
|
|
318
323
|
[K in keyof T]: keyof T[K];
|
|
319
324
|
}[keyof T];
|
|
320
325
|
export type ContractName = ExtractContractNames<typeof CONTRACTS>;
|
|
326
|
+
export declare function isContractsV2_2_1(chainId: number): boolean;
|
|
321
327
|
export declare function getContract(chainId: ContractsChainId, name: ContractName): Address;
|
|
322
328
|
export declare function tryGetContract(chainId: ContractsChainId, name: ContractName): Address | undefined;
|
|
323
329
|
export {};
|
|
@@ -88,6 +88,7 @@ export declare const MAX_ALLOWED_SUBACCOUNT_ACTION_COUNT: string;
|
|
|
88
88
|
export declare const SUBACCOUNT_ACTION_COUNT: string;
|
|
89
89
|
export declare const SUBACCOUNT_ORDER_ACTION: string;
|
|
90
90
|
export declare const SUBACCOUNT_INTEGRATION_ID: string;
|
|
91
|
+
export declare const SUBACCOUNT_REVOCATION_COUNTER: string;
|
|
91
92
|
export declare const SUBACCOUNT_AUTO_TOP_UP_AMOUNT: string;
|
|
92
93
|
export declare const GLV_MAX_MARKET_TOKEN_BALANCE_USD: string;
|
|
93
94
|
export declare const MIN_COLLATERAL_FACTOR_FOR_LIQUIDATION_KEY: string;
|
|
@@ -106,6 +107,7 @@ export declare const SUBACCOUNT_EXPIRES_AT: string;
|
|
|
106
107
|
export declare const MULTICHAIN_BALANCE: string;
|
|
107
108
|
export declare const PRICE_FEED_KEY: string;
|
|
108
109
|
export declare const GASLESS_FEATURE_DISABLED_KEY: string;
|
|
110
|
+
export declare const SIGNAL_UNSTAKE_FEATURE_DISABLED_KEY: string;
|
|
109
111
|
export declare const GELATO_RELAY_FEE_MULTIPLIER_FACTOR_KEY: string;
|
|
110
112
|
export declare const REQUEST_EXPIRATION_TIME_KEY: string;
|
|
111
113
|
export declare const GMX_SIMULATION_ORIGIN: string;
|
|
@@ -186,9 +188,11 @@ export declare function maxLendableImpactFactorKey(market: string): string;
|
|
|
186
188
|
export declare function maxLendableImpactFactorForWithdrawalsKey(market: string): string;
|
|
187
189
|
export declare function maxLendableImpactUsdKey(market: string): string;
|
|
188
190
|
export declare function subaccountIntegrationIdKey(account: string, subaccount: string): string;
|
|
191
|
+
export declare function subaccountRevocationCounterKey(account: string, subaccount: string): string;
|
|
189
192
|
export declare function subaccountAutoTopUpAmountKey(account: string, subaccount: string): string;
|
|
190
193
|
export declare function multichainBalanceKey(account: string, token: string): string;
|
|
191
194
|
export declare function priceFeedKey(token: string): string;
|
|
192
195
|
export declare function gaslessFeatureDisabledKey(module: string): string;
|
|
196
|
+
export declare function signalUnstakeFeatureDisabledKey(rewardRouter: string): string;
|
|
193
197
|
export declare function claimTermsKey(distributionId: bigint): string;
|
|
194
198
|
export declare function claimsDisabledKey(distributionId: bigint): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./utils";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Addresses in shared code are EVM hex or Solana base58. Base58 has no `0` in its alphabet, so it never matches.
|
|
3
|
+
* Base58 is case-sensitive, so it must never be checksummed, lowercased or compared through viem.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isEvmAddress(address: string): boolean;
|
|
6
|
+
/** Checksums an EVM address and keeps any other address as it is. */
|
|
7
|
+
export declare function normalizeAddress(address: string): string;
|
|
8
|
+
/** Compares EVM hex case-insensitively and any other address exactly. Empty input does not match. */
|
|
9
|
+
export declare function isSameAddress(a: string | undefined, b: string | undefined): boolean;
|
|
10
|
+
/** A map or set key: lowercased for EVM hex (addresses and hashes), unchanged for base58. */
|
|
11
|
+
export declare function getAddressKey(address: string): string;
|
|
@@ -12,6 +12,8 @@ export type ErrorPattern = {
|
|
|
12
12
|
};
|
|
13
13
|
export declare enum CustomErrorName {
|
|
14
14
|
DisabledMarket = "DisabledMarket",
|
|
15
|
+
EmptyDesignatedVesters = "EmptyDesignatedVesters",
|
|
16
|
+
EmptyStakeAmount = "EmptyStakeAmount",
|
|
15
17
|
EndOfOracleSimulation = "EndOfOracleSimulation",
|
|
16
18
|
ExternalCallFailed = "ExternalCallFailed",
|
|
17
19
|
InsufficientBridgeOutputAmount = "InsufficientBridgeOutputAmount",
|
|
@@ -26,6 +28,7 @@ export declare enum CustomErrorName {
|
|
|
26
28
|
InsufficientReserveForOpenInterest = "InsufficientReserveForOpenInterest",
|
|
27
29
|
OrderNotFulfillableAtAcceptablePrice = "OrderNotFulfillableAtAcceptablePrice",
|
|
28
30
|
InsufficientSwapOutputAmount = "InsufficientSwapOutputAmount",
|
|
31
|
+
InsufficientStrictTransferAllowance = "InsufficientStrictTransferAllowance",
|
|
29
32
|
InvalidCollateralTokenForMarket = "InvalidCollateralTokenForMarket",
|
|
30
33
|
InvalidDecreaseOrderSize = "InvalidDecreaseOrderSize",
|
|
31
34
|
InvalidOraclePrice = "InvalidOraclePrice",
|
|
@@ -37,6 +40,8 @@ export declare enum CustomErrorName {
|
|
|
37
40
|
MaxPoolUsdForDepositExceeded = "MaxPoolUsdForDepositExceeded",
|
|
38
41
|
MaxPriceAgeExceeded = "MaxPriceAgeExceeded",
|
|
39
42
|
MaxRelayFeeSwapExceeded = "MaxRelayFeeSwapExceeded",
|
|
43
|
+
MaxUnstakeRequestsExceeded = "MaxUnstakeRequestsExceeded",
|
|
44
|
+
MaxUnstakeRequestsOnTransfer = "MaxUnstakeRequestsOnTransfer",
|
|
40
45
|
MinPositionSize = "MinPositionSize",
|
|
41
46
|
NegativeExecutionPrice = "NegativeExecutionPrice",
|
|
42
47
|
OrderNotFound = "OrderNotFound",
|
|
@@ -45,11 +50,23 @@ export declare enum CustomErrorName {
|
|
|
45
50
|
PnlFactorExceededForLongs = "PnlFactorExceededForLongs",
|
|
46
51
|
PnlFactorExceededForShorts = "PnlFactorExceededForShorts",
|
|
47
52
|
PriceImpactLargerThanOrderSize = "PriceImpactLargerThanOrderSize",
|
|
53
|
+
SelfVestingTransfer = "SelfVestingTransfer",
|
|
54
|
+
StakingReceiverNotFresh = "StakingReceiverNotFresh",
|
|
55
|
+
StakingSenderHasPairAmounts = "StakingSenderHasPairAmounts",
|
|
56
|
+
StakingSenderHasVestedTokens = "StakingSenderHasVestedTokens",
|
|
48
57
|
SwapPriceImpactExceedsAmountIn = "SwapPriceImpactExceedsAmountIn",
|
|
58
|
+
TransferNotSignalled = "TransferNotSignalled",
|
|
59
|
+
TransferVesterConfigChanged = "TransferVesterConfigChanged",
|
|
49
60
|
UnableToWithdrawCollateral = "UnableToWithdrawCollateral",
|
|
61
|
+
UnstakeAmountExceedsStake = "UnstakeAmountExceedsStake",
|
|
62
|
+
UnstakeNotSignalled = "UnstakeNotSignalled",
|
|
50
63
|
UsdDeltaExceedsLongOpenInterest = "UsdDeltaExceedsLongOpenInterest",
|
|
51
64
|
UsdDeltaExceedsPoolValue = "UsdDeltaExceedsPoolValue",
|
|
52
|
-
UsdDeltaExceedsShortOpenInterest = "UsdDeltaExceedsShortOpenInterest"
|
|
65
|
+
UsdDeltaExceedsShortOpenInterest = "UsdDeltaExceedsShortOpenInterest",
|
|
66
|
+
VesterAccountFrozen = "VesterAccountFrozen",
|
|
67
|
+
VesterProvisioningNotComplete = "VesterProvisioningNotComplete",
|
|
68
|
+
VestingReceiverNotFresh = "VestingReceiverNotFresh",
|
|
69
|
+
VestingSenderHasOpenSession = "VestingSenderHasOpenSession"
|
|
53
70
|
}
|
|
54
71
|
export declare function getIsUserRejectedError(errorType: TxErrorType): boolean;
|
|
55
72
|
export declare function getIsUserError(errorType: TxErrorType): boolean;
|
|
@@ -29,7 +29,7 @@ export declare function buildBatchOrderCalldata({ chainId, batchParams, relayPar
|
|
|
29
29
|
}): ExpressTxnData & {
|
|
30
30
|
relayRouterAddress: string;
|
|
31
31
|
};
|
|
32
|
-
export declare function getBatchParamsLists(batchParams: BatchOrderTxnParams): {
|
|
32
|
+
export declare function getBatchParamsLists(chainId: ContractsChainId, batchParams: BatchOrderTxnParams): {
|
|
33
33
|
createOrderParamsList: {
|
|
34
34
|
addresses: {
|
|
35
35
|
receiver: string;
|
|
@@ -59,14 +59,15 @@ export declare function getBatchParamsLists(batchParams: BatchOrderTxnParams): {
|
|
|
59
59
|
dataList: string[];
|
|
60
60
|
}[];
|
|
61
61
|
updateOrderParamsList: {
|
|
62
|
+
autoCancel: boolean;
|
|
63
|
+
executionFeeIncrease: bigint;
|
|
64
|
+
decreasePositionSwapType?: import("../../orders").DecreasePositionSwapType | undefined;
|
|
62
65
|
key: string;
|
|
63
66
|
sizeDeltaUsd: bigint;
|
|
64
67
|
acceptablePrice: import("../../tokens").ContractPrice;
|
|
65
68
|
triggerPrice: import("../../tokens").ContractPrice;
|
|
66
69
|
minOutputAmount: bigint;
|
|
67
70
|
validFromTime: bigint;
|
|
68
|
-
autoCancel: boolean;
|
|
69
|
-
executionFeeIncrease: bigint;
|
|
70
71
|
}[];
|
|
71
72
|
cancelOrderKeys: string[];
|
|
72
73
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ContractsChainId, SourceChainId } from "../../../configs/chains";
|
|
2
|
-
import type
|
|
2
|
+
import { type BridgeOutParams } from "../../multichain/api";
|
|
3
3
|
import type { IAbstractSigner } from "../../signer";
|
|
4
4
|
import { getGelatoRelayRouterDomain } from "./relayParamsUtils";
|
|
5
5
|
import type { ExpressTxnData, RawRelayParamsPayload, RelayParamsPayload } from "../types";
|
|
@@ -32,15 +32,21 @@ export type BridgeOutTypedData = {
|
|
|
32
32
|
provider: string;
|
|
33
33
|
data: string;
|
|
34
34
|
relayParams: string;
|
|
35
|
+
account?: string;
|
|
36
|
+
bridgeFeeToken?: string;
|
|
37
|
+
bridgeFeeAmount?: bigint;
|
|
38
|
+
bridgeFeeSwapPath?: string[];
|
|
39
|
+
bridgeFeeMinOutputAmount?: bigint;
|
|
35
40
|
};
|
|
36
41
|
};
|
|
37
42
|
/**
|
|
38
43
|
* EIP-712 typed-data describing a `MultichainTransferRouter.bridgeOut` call.
|
|
39
44
|
* Single source of truth shared by SDK signing helpers and server-side prepare flows.
|
|
40
45
|
*/
|
|
41
|
-
export declare function getBridgeOutTypedData({ chainId, srcChainId, params, relayParams, }: {
|
|
46
|
+
export declare function getBridgeOutTypedData({ chainId, srcChainId, params, relayParams, account, }: {
|
|
42
47
|
chainId: ContractsChainId;
|
|
43
48
|
srcChainId: SourceChainId;
|
|
44
49
|
params: BridgeOutParams;
|
|
45
50
|
relayParams: RelayParamsPayload;
|
|
51
|
+
account: string;
|
|
46
52
|
}): BridgeOutTypedData;
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import type { ContractsChainId, SourceChainId } from "../../../configs/chains";
|
|
2
2
|
import type { IAbstractSigner } from "../../signer";
|
|
3
3
|
import type { RelayParamsPayload } from "../types";
|
|
4
|
+
export declare function getReferralCodeTypedData({ primaryType, chainId, srcChainId, relayParams, referralCode, account, }: {
|
|
5
|
+
primaryType: "SetTraderReferralCode" | "RegisterCode";
|
|
6
|
+
chainId: ContractsChainId;
|
|
7
|
+
srcChainId: SourceChainId;
|
|
8
|
+
relayParams: RelayParamsPayload;
|
|
9
|
+
referralCode: string;
|
|
10
|
+
account: string;
|
|
11
|
+
}): {
|
|
12
|
+
domain: import("../../signer").TypedDataDomain;
|
|
13
|
+
types: {
|
|
14
|
+
[x: string]: {
|
|
15
|
+
name: string;
|
|
16
|
+
type: string;
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
19
|
+
message: {
|
|
20
|
+
referralCode: string;
|
|
21
|
+
relayParams: string;
|
|
22
|
+
account?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
4
25
|
export declare function signSetTraderReferralCode({ signer, relayParams, referralCode, chainId, srcChainId, }: {
|
|
5
26
|
signer: IAbstractSigner;
|
|
6
27
|
relayParams: RelayParamsPayload;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { type Hex } from "viem";
|
|
2
2
|
import type { AnyChainId, SettlementChainId } from "../../configs/chains";
|
|
3
3
|
import type { IAbstractSigner } from "../signer";
|
|
4
|
+
export type BridgeFeeParams = {
|
|
5
|
+
feeToken: string;
|
|
6
|
+
feeAmount: bigint;
|
|
7
|
+
feeSwapPath: string[];
|
|
8
|
+
minOutputAmount: bigint;
|
|
9
|
+
};
|
|
4
10
|
export type BridgeOutParams = {
|
|
5
11
|
token: string;
|
|
6
12
|
amount: bigint;
|
|
7
13
|
minAmountOut: bigint;
|
|
8
14
|
provider: string;
|
|
9
15
|
data: string;
|
|
16
|
+
bridgeFee?: BridgeFeeParams;
|
|
10
17
|
};
|
|
11
18
|
export type BuildTxnResult = {
|
|
12
19
|
to: Hex;
|
|
@@ -27,6 +34,7 @@ export type SameChainDepositRequest = {
|
|
|
27
34
|
* `MultichainTransferRouter.multicall([sendWnt|sendTokens, bridgeIn])`.
|
|
28
35
|
*/
|
|
29
36
|
export declare function buildSameChainDepositTxn(request: SameChainDepositRequest): BuildTxnResult;
|
|
37
|
+
export declare function getEmptyBridgeFeeParams(): BridgeFeeParams;
|
|
30
38
|
export declare function buildSameChainWithdrawBridgeOutParams(params: {
|
|
31
39
|
tokenAddress: string;
|
|
32
40
|
amount: bigint;
|
|
@@ -98,7 +98,6 @@ export type PrepareOrderError = {
|
|
|
98
98
|
};
|
|
99
99
|
export type PrepareOrderResponse = {
|
|
100
100
|
requestId: string;
|
|
101
|
-
idempotencyKey?: string;
|
|
102
101
|
payloadType: "transaction" | "typed-data";
|
|
103
102
|
mode: TransactionMode;
|
|
104
103
|
payload: Record<string, any>;
|
|
@@ -114,7 +113,6 @@ export type SubmitOrderRequest = {
|
|
|
114
113
|
signature?: string;
|
|
115
114
|
from?: string;
|
|
116
115
|
eip712Data?: Record<string, any>;
|
|
117
|
-
idempotencyKey?: string;
|
|
118
116
|
};
|
|
119
117
|
export type SubmitOrderResponse = {
|
|
120
118
|
requestId: string;
|
|
@@ -129,7 +127,6 @@ export type SubmitOrderResponse = {
|
|
|
129
127
|
};
|
|
130
128
|
export type OrderStatusRequest = {
|
|
131
129
|
requestId?: string;
|
|
132
|
-
idempotencyKey?: string;
|
|
133
130
|
};
|
|
134
131
|
export type OrderStatusResponse = {
|
|
135
132
|
requestId: string;
|
|
@@ -69,6 +69,7 @@ export type UpdateOrderParams = {
|
|
|
69
69
|
minOutputAmount: bigint;
|
|
70
70
|
autoCancel: boolean;
|
|
71
71
|
validFromTime: bigint;
|
|
72
|
+
decreasePositionSwapType: DecreasePositionSwapType;
|
|
72
73
|
executionFeeTopUp: bigint;
|
|
73
74
|
executionGasLimit?: bigint;
|
|
74
75
|
};
|
|
@@ -84,6 +85,7 @@ export type UpdateOrderPayload = {
|
|
|
84
85
|
minOutputAmount: bigint;
|
|
85
86
|
autoCancel: boolean;
|
|
86
87
|
validFromTime: bigint;
|
|
88
|
+
decreasePositionSwapType: DecreasePositionSwapType;
|
|
87
89
|
executionFeeTopUp: bigint;
|
|
88
90
|
};
|
|
89
91
|
export type TokenTransfersParams = {
|
|
@@ -208,7 +210,8 @@ export declare function getExternalCallsPayload({ chainId, account, quote, }: {
|
|
|
208
210
|
account: string;
|
|
209
211
|
quote: ExternalSwapQuote;
|
|
210
212
|
}): ExternalCallsPayload;
|
|
211
|
-
export declare function getBatchOrderMulticallPayload({ params }: {
|
|
213
|
+
export declare function getBatchOrderMulticallPayload({ chainId, params, }: {
|
|
214
|
+
chainId: ContractsChainId;
|
|
212
215
|
params: BatchOrderTxnParams;
|
|
213
216
|
}): {
|
|
214
217
|
multicall: ExchangeRouterCall[];
|
|
@@ -230,7 +233,7 @@ export declare function buildCancelOrderMulticall({ params }: {
|
|
|
230
233
|
multicall: ExchangeRouterCall[];
|
|
231
234
|
value: bigint;
|
|
232
235
|
};
|
|
233
|
-
export declare function encodeExchangeRouterMulticall(multicall: ExchangeRouterCall[]): {
|
|
236
|
+
export declare function encodeExchangeRouterMulticall(chainId: ContractsChainId, multicall: ExchangeRouterCall[]): {
|
|
234
237
|
encodedMulticall: Hex[];
|
|
235
238
|
callData: Hex;
|
|
236
239
|
};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export declare const MAX_REFERRAL_CODE_LENGTH = 20;
|
|
2
2
|
import { Hash } from "viem";
|
|
3
|
+
export declare const REFERRAL_CODE_REGEX: RegExp;
|
|
4
|
+
export declare function isReferralCodeHex(value: string | null | undefined): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Codes registered through the UI are letters, digits and `_` right-padded with zeros. The contract accepts any
|
|
7
|
+
* bytes32, so anything else (e.g. left-padded addresses, hashes, other text) is returned as the original hex.
|
|
8
|
+
*/
|
|
3
9
|
export declare function decodeReferralCode(hexCode?: Hash): string;
|
|
4
|
-
export declare function encodeReferralCode(code: string):
|
|
10
|
+
export declare function encodeReferralCode(code: string): string;
|
|
@@ -13,6 +13,8 @@ export type SubaccountApprovalTypedData = {
|
|
|
13
13
|
message: Record<string, any>;
|
|
14
14
|
primaryType: string;
|
|
15
15
|
};
|
|
16
|
+
export declare const SUBACCOUNT_APPROVAL_TYPES: SubaccountApprovalTypedData["types"];
|
|
17
|
+
export declare const SUBACCOUNT_APPROVAL_TYPES_V2_2_1: SubaccountApprovalTypedData["types"];
|
|
16
18
|
export declare function getSubaccountApprovalTypedData(params: {
|
|
17
19
|
chainId: ContractsChainId;
|
|
18
20
|
subaccountAddress: string;
|
|
@@ -20,5 +22,7 @@ export declare function getSubaccountApprovalTypedData(params: {
|
|
|
20
22
|
expiresAt: bigint;
|
|
21
23
|
maxAllowedCount: bigint;
|
|
22
24
|
nonce: bigint;
|
|
25
|
+
account: string;
|
|
26
|
+
revocationCounter: bigint;
|
|
23
27
|
signingChainId?: number;
|
|
24
28
|
}): SubaccountApprovalTypedData;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ContractsChainId } from "../../configs/chains";
|
|
2
|
+
export declare function hashSubaccountApproval(chainId: ContractsChainId, approval: Record<string, any>): string;
|
|
@@ -2,7 +2,7 @@ export * from "./types";
|
|
|
2
2
|
export { generateSubaccount, decryptSubaccountPrivateKey, createSubaccountSignerFromConfig, type GeneratedSubaccount, } from "./generateSubaccount";
|
|
3
3
|
export { hashSubaccountApproval } from "./hashSubaccountApproval";
|
|
4
4
|
export { getEmptySubaccountApproval } from "./getEmptySubaccountApproval";
|
|
5
|
-
export { getSubaccountApprovalTypedData, type SubaccountApprovalTypedData } from "./getSubaccountApprovalTypedData";
|
|
6
|
-
export { isEmptySubaccountApproval, isSameSubaccountApproval, isSubaccountApprovalExpired, isSubaccountApprovalNonceExpired, isSubaccountApprovalSynced, isSubaccountStatusUsable, parseSubaccountStatus, shouldRefreshExplicitSubaccountApproval, toSignedSubaccountApproval, } from "./state";
|
|
5
|
+
export { getSubaccountApprovalTypedData, SUBACCOUNT_APPROVAL_TYPES, SUBACCOUNT_APPROVAL_TYPES_V2_2_1, type SubaccountApprovalTypedData, } from "./getSubaccountApprovalTypedData";
|
|
6
|
+
export { isEmptySubaccountApproval, isSameSubaccountApproval, isSubaccountApprovalExpired, isSubaccountApprovalNonceExpired, isSubaccountApprovalRevoked, isSubaccountApprovalSynced, isSubaccountStatusUsable, parseSubaccountStatus, shouldRefreshExplicitSubaccountApproval, toSignedSubaccountApproval, } from "./state";
|
|
7
7
|
export { fetchSubaccountStatus, prepareSubaccountApproval, signSubaccountApproval } from "./api";
|
|
8
8
|
export type { SubaccountStatusRequest, SubaccountStatusResponse, SubaccountApprovalPrepareRequest, SubaccountApprovalPrepareResponse, } from "./api";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { SubaccountApprovalPrepareResponse, SubaccountStatusResponse } from "./api";
|
|
2
|
-
import type { SdkSubaccountApproval, SdkSubaccountStatus, SignedSubaccountApproval, StoredSubaccountApproval } from "./types";
|
|
2
|
+
import type { SdkSubaccountApproval, SdkSubaccountStatus, SignedSubaccountApproval, StoredSubaccountApproval, SubaccountApproval } from "./types";
|
|
3
3
|
export declare function parseSubaccountStatus(status: SubaccountStatusResponse): SdkSubaccountStatus;
|
|
4
4
|
export declare function isSubaccountStatusUsable(status: SdkSubaccountStatus | undefined): boolean;
|
|
5
5
|
export declare function isEmptySubaccountApproval(approval: SdkSubaccountApproval): boolean;
|
|
6
6
|
export declare function isSameSubaccountApproval(a: SdkSubaccountApproval, b: SdkSubaccountApproval): boolean;
|
|
7
7
|
export declare function shouldRefreshExplicitSubaccountApproval(approval: SdkSubaccountApproval, status: SdkSubaccountStatus | undefined, pendingApproval: StoredSubaccountApproval | undefined): boolean;
|
|
8
8
|
export declare function isSubaccountApprovalNonceExpired(approval: SdkSubaccountApproval, status: SdkSubaccountStatus): boolean;
|
|
9
|
+
export declare function isSubaccountApprovalRevoked(approval: SubaccountApproval, revocationCounter: bigint): boolean;
|
|
9
10
|
export declare function isSubaccountApprovalSynced(approval: SdkSubaccountApproval, status: SdkSubaccountStatus): boolean;
|
|
10
11
|
export declare function isSubaccountApprovalExpired(approval: SdkSubaccountApproval): boolean;
|
|
11
12
|
export declare function toSignedSubaccountApproval(prepared: SubaccountApprovalPrepareResponse, signature: string): SignedSubaccountApproval;
|
|
@@ -8,6 +8,7 @@ export type SubaccountOnchainData = {
|
|
|
8
8
|
approvalNonce: bigint;
|
|
9
9
|
multichainApprovalNonce: bigint;
|
|
10
10
|
integrationId: string | undefined;
|
|
11
|
+
revocationCounter: bigint;
|
|
11
12
|
};
|
|
12
13
|
export type SubaccountSerializedConfig = {
|
|
13
14
|
privateKey: string;
|
|
@@ -24,6 +25,8 @@ export type SubaccountApproval = {
|
|
|
24
25
|
desChainId: bigint;
|
|
25
26
|
deadline: bigint;
|
|
26
27
|
integrationId: string;
|
|
28
|
+
revocationCounter?: bigint;
|
|
29
|
+
eip6492SignatureWrapperHash?: string;
|
|
27
30
|
};
|
|
28
31
|
export type SignedSubaccountApproval = SubaccountApproval & {
|
|
29
32
|
signature: string;
|
|
@@ -60,7 +63,6 @@ export type Subaccount = {
|
|
|
60
63
|
export type SubaccountValidations = {
|
|
61
64
|
isExpired: boolean;
|
|
62
65
|
isActionsExceeded: boolean;
|
|
63
|
-
isNonceExpired: boolean;
|
|
64
66
|
isApprovalInvalid: boolean;
|
|
65
67
|
isValid: boolean;
|
|
66
68
|
};
|