@gmx-io/sdk 1.5.0-alpha-8 → 1.5.0-alpha-9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/build/cjs/src/clients/v1/testUtil.js +1 -1
  2. package/build/cjs/src/clients/v2/index.js +6 -2
  3. package/build/cjs/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +34 -0
  4. package/build/cjs/src/codegen/prebuilt/hashedMarketConfigKeys.json +230 -0
  5. package/build/cjs/src/codegen/prebuilt/hashedMarketValuesKeys.json +62 -0
  6. package/build/cjs/src/configs/__tests__/tokens.spec.js +1 -0
  7. package/build/cjs/src/configs/api.js +4 -3
  8. package/build/cjs/src/configs/batch.js +13 -0
  9. package/build/cjs/src/configs/chainIds.js +2 -1
  10. package/build/cjs/src/configs/chains.js +48 -2
  11. package/build/cjs/src/configs/contracts.js +67 -0
  12. package/build/cjs/src/configs/express.js +2 -0
  13. package/build/cjs/src/configs/gasLimits.js +7 -0
  14. package/build/cjs/src/configs/markets.js +30 -0
  15. package/build/cjs/src/configs/oracleKeeper.js +2 -0
  16. package/build/cjs/src/configs/tokens.js +89 -1
  17. package/build/cjs/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +2 -0
  18. package/build/cjs/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +2 -0
  19. package/build/cjs/src/utils/__tests__/orderTransactions/swapOrders.spec.js +1 -0
  20. package/build/cjs/src/utils/__tests__/uiFeeReceiver.spec.js +24 -0
  21. package/build/cjs/src/utils/errors/parseError.js +3 -0
  22. package/build/cjs/src/utils/staking/api.js +11 -0
  23. package/build/cjs/src/utils/staking/types.js +2 -0
  24. package/build/cjs/src/utils/trade/decrease.js +131 -6
  25. package/build/cjs/src/utils/trade/increase.js +2 -6
  26. package/build/cjs/src/utils/twap/uiFeeReceiver.js +29 -13
  27. package/build/esm/src/clients/v1/testUtil.js +1 -1
  28. package/build/esm/src/clients/v2/index.js +4 -0
  29. package/build/esm/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +34 -0
  30. package/build/esm/src/codegen/prebuilt/hashedMarketConfigKeys.json +230 -0
  31. package/build/esm/src/codegen/prebuilt/hashedMarketValuesKeys.json +62 -0
  32. package/build/esm/src/configs/__tests__/tokens.spec.js +2 -1
  33. package/build/esm/src/configs/api.js +5 -4
  34. package/build/esm/src/configs/batch.js +14 -1
  35. package/build/esm/src/configs/chainIds.js +1 -0
  36. package/build/esm/src/configs/chains.js +48 -3
  37. package/build/esm/src/configs/contracts.js +68 -1
  38. package/build/esm/src/configs/express.js +3 -1
  39. package/build/esm/src/configs/gasLimits.js +8 -1
  40. package/build/esm/src/configs/markets.js +31 -1
  41. package/build/esm/src/configs/oracleKeeper.js +3 -1
  42. package/build/esm/src/configs/tokens.js +90 -2
  43. package/build/esm/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +2 -0
  44. package/build/esm/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +2 -0
  45. package/build/esm/src/utils/__tests__/orderTransactions/swapOrders.spec.js +1 -0
  46. package/build/esm/src/utils/__tests__/uiFeeReceiver.spec.js +25 -1
  47. package/build/esm/src/utils/errors/parseError.js +3 -0
  48. package/build/esm/src/utils/staking/api.js +7 -0
  49. package/build/esm/src/utils/staking/types.js +1 -0
  50. package/build/esm/src/utils/trade/decrease.js +127 -7
  51. package/build/esm/src/utils/trade/increase.js +3 -7
  52. package/build/esm/src/utils/twap/uiFeeReceiver.js +27 -12
  53. package/build/types/src/clients/v1/index.d.ts +1 -1
  54. package/build/types/src/clients/v1/modules/base.d.ts +1 -1
  55. package/build/types/src/clients/v1/multicall.d.ts +1 -1
  56. package/build/types/src/clients/v2/index.d.ts +5 -0
  57. package/build/types/src/codegen/prebuilt/index.d.ts +326 -0
  58. package/build/types/src/configs/chainIds.d.ts +1 -0
  59. package/build/types/src/configs/chains.d.ts +26 -6
  60. package/build/types/src/configs/contracts.d.ts +64 -0
  61. package/build/types/src/utils/errors/parseError.d.ts +3 -0
  62. package/build/types/src/utils/staking/api.d.ts +7 -0
  63. package/build/types/src/utils/staking/types.d.ts +14 -0
  64. package/build/types/src/utils/trade/decrease.d.ts +41 -2
  65. package/build/types/src/utils/trade/types.d.ts +8 -0
  66. package/build/types/src/utils/twap/uiFeeReceiver.d.ts +9 -6
  67. package/package.json +1 -1
@@ -1,14 +1,19 @@
1
1
  import { isAddress } from "viem";
2
2
  const VERSION = "01";
3
3
  const PREFIX = "0xff0000";
4
+ const JIT_BYTE_START = 15 * 2;
5
+ const JIT_BYTE_END = 16 * 2;
6
+ const EXPRESS_BYTE_START = 16 * 2;
7
+ const EXPRESS_BYTE_END = 17 * 2;
4
8
  /**
5
9
  * Ui fee receiver structure:
6
- * 0-3 (4) bytes (0-7 chars) - PREFIX
7
- * 4-15 (12) bytes (8-32 chars) - 12 bytes buffer
8
- * 16 (1) byte (33-34 chars) - isExpress flag
9
- * 17 (1) byte (35-36 chars) - numberOfParts (hex encoded)
10
- * 18-19 (2) bytes (37-40 chars) - twapId
11
- * 20 (1) byte (41-42 chars) - VERSION
10
+ * 0-2 (3) bytes (0-5 chars) - PREFIX
11
+ * 3-13 (11) bytes (6-27 chars) - free buffer
12
+ * 14 (1) byte (28-29 chars) - isJit flag
13
+ * 15 (1) byte (30-31 chars) - isExpress flag
14
+ * 16 (1) byte (32-33 chars) - numberOfParts (hex encoded)
15
+ * 17-18 (2) bytes (34-37 chars) - twapId
16
+ * 19 (1) byte (38-39 chars) - VERSION
12
17
  *
13
18
  * Total: 0x + 20 bytes (41 hex characters)
14
19
  */
@@ -21,23 +26,33 @@ export function createTwapUiFeeReceiver({ numberOfParts }) {
21
26
  const twapId = generateTwapId();
22
27
  const numberOfPartsInHex = numberOfParts.toString(16).padStart(2, "0");
23
28
  const buffer = "00".repeat(12);
24
- const isExpressHex = "00";
25
- return `${PREFIX}${buffer}${isExpressHex}${numberOfPartsInHex}${twapId}${VERSION}`;
29
+ const flagsHex = "00";
30
+ return `${PREFIX}${buffer}${flagsHex}${numberOfPartsInHex}${twapId}${VERSION}`;
26
31
  }
27
32
  export function decodeTwapUiFeeReceiver(address) {
28
33
  const byteString = address.slice(2);
29
34
  const twapId = byteString.slice(34, 38);
30
- const isExpress = byteString.slice(30, 32) === "01";
35
+ const isExpress = getUiFeeReceiverByte(address, EXPRESS_BYTE_START, EXPRESS_BYTE_END) === "01";
36
+ const isJit = getUiFeeReceiverByte(address, JIT_BYTE_START, JIT_BYTE_END) === "01";
31
37
  if (!isValidTwapUiFeeReceiver(address) || twapId === "0000") {
32
38
  return;
33
39
  }
34
40
  const numberOfParts = parseInt(byteString.slice(32, 34), 16);
35
- return { twapId, numberOfParts, isExpress };
41
+ return { twapId, numberOfParts, isExpress, isJit };
36
42
  }
37
43
  export function isValidTwapUiFeeReceiver(address) {
38
44
  return isAddress(address) && address.toLowerCase().startsWith(PREFIX.toLowerCase());
39
45
  }
40
46
  export function setUiFeeReceiverIsExpress(uiFeeReceiver, isExpress) {
41
- const isExpressInHex = isExpress ? "01" : "00";
42
- return `${uiFeeReceiver.slice(0, 16 * 2)}${isExpressInHex}${uiFeeReceiver.slice(17 * 2)}`;
47
+ return setUiFeeReceiverByte(uiFeeReceiver, EXPRESS_BYTE_START, EXPRESS_BYTE_END, isExpress);
48
+ }
49
+ export function setUiFeeReceiverIsJit(uiFeeReceiver, isJit) {
50
+ return setUiFeeReceiverByte(uiFeeReceiver, JIT_BYTE_START, JIT_BYTE_END, isJit);
51
+ }
52
+ function getUiFeeReceiverByte(uiFeeReceiver, start, end) {
53
+ return uiFeeReceiver.slice(start, end);
54
+ }
55
+ function setUiFeeReceiverByte(uiFeeReceiver, start, end, enabled) {
56
+ const value = enabled ? "01" : "00";
57
+ return `${uiFeeReceiver.slice(0, start)}${value}${uiFeeReceiver.slice(end)}`;
43
58
  }
@@ -26,7 +26,7 @@ export declare class GmxSdk {
26
26
  setAccount(account: Address): void;
27
27
  executeMulticall<T = any>(request: MulticallRequestConfig<any>): Promise<T>;
28
28
  callContract(address: Address, abi: Abi, method: string, params: any[], opts?: CallContractOpts): Promise<string>;
29
- get chainId(): 43114 | 42161 | 3637 | 43113 | 421614;
29
+ get chainId(): 43114 | 42161 | 3637 | 4326 | 43113 | 421614;
30
30
  get chain(): import("viem").Chain;
31
31
  get account(): string;
32
32
  }
@@ -3,6 +3,6 @@ export declare class Module {
3
3
  sdk: GmxSdk;
4
4
  constructor(sdk: GmxSdk);
5
5
  get oracle(): import("./oracle").Oracle;
6
- get chainId(): 43114 | 42161 | 3637 | 43113 | 421614;
6
+ get chainId(): 43114 | 42161 | 3637 | 4326 | 43113 | 421614;
7
7
  get account(): string;
8
8
  }
@@ -14,7 +14,7 @@ export declare class Multicall {
14
14
  };
15
15
  static getInstance(sdk: GmxSdk): Promise<Multicall>;
16
16
  constructor(sdk: GmxSdk);
17
- get chainId(): 43114 | 42161 | 3637 | 43113 | 421614;
17
+ get chainId(): 43114 | 42161 | 3637 | 4326 | 43113 | 421614;
18
18
  call(request: MulticallRequestConfig<any>, maxTimeout: number): Promise<MulticallResult<any>>;
19
19
  }
20
20
  export type SkipKey = null | undefined | false;
@@ -5,12 +5,14 @@ import { MarketTicker, MarketWithTiers } from "../../utils/markets/types";
5
5
  import { PerformanceAnnualized, PerformanceParams, PerformanceSnapshots } from "../../utils/performance/types";
6
6
  import type { OhlcvParams } from "../../utils/prices/types";
7
7
  import { MarketRates, RatesParams } from "../../utils/rates/types";
8
+ import { StakingPowerResponse } from "../../utils/staking/types";
8
9
  export type { ApyEntry, ApyParams, ApyResponse } from "../../utils/apy/types";
9
10
  export type { MarketTicker, MarketWithTiers } from "../../utils/markets/types";
10
11
  export type { Pair } from "../../utils/pairs/types";
11
12
  export type { PerformanceAnnualized, PerformanceParams, PerformanceSnapshot, PerformanceSnapshots, } from "../../utils/performance/types";
12
13
  export type { OhlcvCandle, OhlcvParams } from "../../utils/prices/types";
13
14
  export type { ApiParameterPeriod, MarketRates, RatesParams, RatesSnapshot } from "../../utils/rates/types";
15
+ export type { StakingPowerResponse } from "../../utils/staking/types";
14
16
  export declare class GmxApiSdk {
15
17
  ctx: {
16
18
  chainId: ContractsChainId;
@@ -40,4 +42,7 @@ export declare class GmxApiSdk {
40
42
  fetchApy(params?: ApyParams): Promise<ApyResponse>;
41
43
  fetchPerformanceAnnualized(params?: PerformanceParams): Promise<PerformanceAnnualized[]>;
42
44
  fetchPerformanceSnapshots(params?: PerformanceParams): Promise<PerformanceSnapshots[]>;
45
+ fetchStakingPower(params: {
46
+ address: string;
47
+ }): Promise<StakingPowerResponse>;
43
48
  }
@@ -46,6 +46,68 @@ export declare const HASHED_MARKET_VALUES_KEYS: {
46
46
  shortInterestInTokensUsingShortToken: string;
47
47
  };
48
48
  };
49
+ "4326": {
50
+ "0x31EdCc52bE2Fa55Ba68f50409F9e6b7d9EbF3D59": {
51
+ longPoolAmount: string;
52
+ shortPoolAmount: string;
53
+ positionImpactPoolAmount: string;
54
+ swapImpactPoolAmountLong: string;
55
+ swapImpactPoolAmountShort: string;
56
+ longInterestUsingLongToken: string;
57
+ longInterestUsingShortToken: string;
58
+ shortInterestUsingLongToken: string;
59
+ shortInterestUsingShortToken: string;
60
+ longInterestInTokensUsingLongToken: string;
61
+ longInterestInTokensUsingShortToken: string;
62
+ shortInterestInTokensUsingLongToken: string;
63
+ shortInterestInTokensUsingShortToken: string;
64
+ };
65
+ "0x9b1B72720f6D277F3b1e607a0c5fab1B300248b1": {
66
+ longPoolAmount: string;
67
+ shortPoolAmount: string;
68
+ positionImpactPoolAmount: string;
69
+ swapImpactPoolAmountLong: string;
70
+ swapImpactPoolAmountShort: string;
71
+ longInterestUsingLongToken: string;
72
+ longInterestUsingShortToken: string;
73
+ shortInterestUsingLongToken: string;
74
+ shortInterestUsingShortToken: string;
75
+ longInterestInTokensUsingLongToken: string;
76
+ longInterestInTokensUsingShortToken: string;
77
+ shortInterestInTokensUsingLongToken: string;
78
+ shortInterestInTokensUsingShortToken: string;
79
+ };
80
+ "0xe8E716F1cddfFD0698B86919D41A8228d701fEe9": {
81
+ longPoolAmount: string;
82
+ shortPoolAmount: string;
83
+ positionImpactPoolAmount: string;
84
+ swapImpactPoolAmountLong: string;
85
+ swapImpactPoolAmountShort: string;
86
+ longInterestUsingLongToken: string;
87
+ longInterestUsingShortToken: string;
88
+ shortInterestUsingLongToken: string;
89
+ shortInterestUsingShortToken: string;
90
+ longInterestInTokensUsingLongToken: string;
91
+ longInterestInTokensUsingShortToken: string;
92
+ shortInterestInTokensUsingLongToken: string;
93
+ shortInterestInTokensUsingShortToken: string;
94
+ };
95
+ "0xc5c9B5E23810565763De41144741477eeCB25e2e": {
96
+ longPoolAmount: string;
97
+ shortPoolAmount: string;
98
+ positionImpactPoolAmount: string;
99
+ swapImpactPoolAmountLong: string;
100
+ swapImpactPoolAmountShort: string;
101
+ longInterestUsingLongToken: string;
102
+ longInterestUsingShortToken: string;
103
+ shortInterestUsingLongToken: string;
104
+ shortInterestUsingShortToken: string;
105
+ longInterestInTokensUsingLongToken: string;
106
+ longInterestInTokensUsingShortToken: string;
107
+ shortInterestInTokensUsingLongToken: string;
108
+ shortInterestInTokensUsingShortToken: string;
109
+ };
110
+ };
49
111
  "42161": {
50
112
  "0x47c031236e19d024b42f8AE6780E44A573170703": {
51
113
  longPoolAmount: string;
@@ -2809,6 +2871,236 @@ export declare const HASHED_MARKET_CONFIG_KEYS: {
2809
2871
  virtualShortTokenId: string;
2810
2872
  };
2811
2873
  };
2874
+ "4326": {
2875
+ "0x31EdCc52bE2Fa55Ba68f50409F9e6b7d9EbF3D59": {
2876
+ isDisabled: string;
2877
+ maxLongPoolAmount: string;
2878
+ maxShortPoolAmount: string;
2879
+ maxLongPoolUsdForDeposit: string;
2880
+ maxShortPoolUsdForDeposit: string;
2881
+ reserveFactorLong: string;
2882
+ reserveFactorShort: string;
2883
+ openInterestReserveFactorLong: string;
2884
+ openInterestReserveFactorShort: string;
2885
+ maxOpenInterestLong: string;
2886
+ maxOpenInterestShort: string;
2887
+ minPositionImpactPoolAmount: string;
2888
+ positionImpactPoolDistributionRate: string;
2889
+ borrowingFactorLong: string;
2890
+ borrowingFactorShort: string;
2891
+ borrowingExponentFactorLong: string;
2892
+ borrowingExponentFactorShort: string;
2893
+ fundingFactor: string;
2894
+ fundingExponentFactor: string;
2895
+ fundingIncreaseFactorPerSecond: string;
2896
+ fundingDecreaseFactorPerSecond: string;
2897
+ thresholdForStableFunding: string;
2898
+ thresholdForDecreaseFunding: string;
2899
+ minFundingFactorPerSecond: string;
2900
+ maxFundingFactorPerSecond: string;
2901
+ maxPnlFactorForTradersLong: string;
2902
+ maxPnlFactorForTradersShort: string;
2903
+ positionFeeFactorForBalanceWasImproved: string;
2904
+ positionFeeFactorForBalanceWasNotImproved: string;
2905
+ positionImpactFactorPositive: string;
2906
+ positionImpactFactorNegative: string;
2907
+ maxPositionImpactFactorPositive: string;
2908
+ maxPositionImpactFactorNegative: string;
2909
+ maxPositionImpactFactorForLiquidations: string;
2910
+ maxLendableImpactFactor: string;
2911
+ maxLendableImpactFactorForWithdrawals: string;
2912
+ maxLendableImpactUsd: string;
2913
+ lentPositionImpactPoolAmount: string;
2914
+ minCollateralFactor: string;
2915
+ minCollateralFactorForLiquidation: string;
2916
+ minCollateralFactorForOpenInterestLong: string;
2917
+ minCollateralFactorForOpenInterestShort: string;
2918
+ positionImpactExponentFactorPositive: string;
2919
+ positionImpactExponentFactorNegative: string;
2920
+ swapFeeFactorForBalanceWasImproved: string;
2921
+ swapFeeFactorForBalanceWasNotImproved: string;
2922
+ atomicSwapFeeFactor: string;
2923
+ swapImpactFactorPositive: string;
2924
+ swapImpactFactorNegative: string;
2925
+ swapImpactExponentFactor: string;
2926
+ withdrawalFeeFactorBalanceWasImproved: string;
2927
+ withdrawalFeeFactorBalanceWasNotImproved: string;
2928
+ virtualMarketId: string;
2929
+ virtualLongTokenId: string;
2930
+ virtualShortTokenId: string;
2931
+ };
2932
+ "0x9b1B72720f6D277F3b1e607a0c5fab1B300248b1": {
2933
+ isDisabled: string;
2934
+ maxLongPoolAmount: string;
2935
+ maxShortPoolAmount: string;
2936
+ maxLongPoolUsdForDeposit: string;
2937
+ maxShortPoolUsdForDeposit: string;
2938
+ reserveFactorLong: string;
2939
+ reserveFactorShort: string;
2940
+ openInterestReserveFactorLong: string;
2941
+ openInterestReserveFactorShort: string;
2942
+ maxOpenInterestLong: string;
2943
+ maxOpenInterestShort: string;
2944
+ minPositionImpactPoolAmount: string;
2945
+ positionImpactPoolDistributionRate: string;
2946
+ borrowingFactorLong: string;
2947
+ borrowingFactorShort: string;
2948
+ borrowingExponentFactorLong: string;
2949
+ borrowingExponentFactorShort: string;
2950
+ fundingFactor: string;
2951
+ fundingExponentFactor: string;
2952
+ fundingIncreaseFactorPerSecond: string;
2953
+ fundingDecreaseFactorPerSecond: string;
2954
+ thresholdForStableFunding: string;
2955
+ thresholdForDecreaseFunding: string;
2956
+ minFundingFactorPerSecond: string;
2957
+ maxFundingFactorPerSecond: string;
2958
+ maxPnlFactorForTradersLong: string;
2959
+ maxPnlFactorForTradersShort: string;
2960
+ positionFeeFactorForBalanceWasImproved: string;
2961
+ positionFeeFactorForBalanceWasNotImproved: string;
2962
+ positionImpactFactorPositive: string;
2963
+ positionImpactFactorNegative: string;
2964
+ maxPositionImpactFactorPositive: string;
2965
+ maxPositionImpactFactorNegative: string;
2966
+ maxPositionImpactFactorForLiquidations: string;
2967
+ maxLendableImpactFactor: string;
2968
+ maxLendableImpactFactorForWithdrawals: string;
2969
+ maxLendableImpactUsd: string;
2970
+ lentPositionImpactPoolAmount: string;
2971
+ minCollateralFactor: string;
2972
+ minCollateralFactorForLiquidation: string;
2973
+ minCollateralFactorForOpenInterestLong: string;
2974
+ minCollateralFactorForOpenInterestShort: string;
2975
+ positionImpactExponentFactorPositive: string;
2976
+ positionImpactExponentFactorNegative: string;
2977
+ swapFeeFactorForBalanceWasImproved: string;
2978
+ swapFeeFactorForBalanceWasNotImproved: string;
2979
+ atomicSwapFeeFactor: string;
2980
+ swapImpactFactorPositive: string;
2981
+ swapImpactFactorNegative: string;
2982
+ swapImpactExponentFactor: string;
2983
+ withdrawalFeeFactorBalanceWasImproved: string;
2984
+ withdrawalFeeFactorBalanceWasNotImproved: string;
2985
+ virtualMarketId: string;
2986
+ virtualLongTokenId: string;
2987
+ virtualShortTokenId: string;
2988
+ };
2989
+ "0xe8E716F1cddfFD0698B86919D41A8228d701fEe9": {
2990
+ isDisabled: string;
2991
+ maxLongPoolAmount: string;
2992
+ maxShortPoolAmount: string;
2993
+ maxLongPoolUsdForDeposit: string;
2994
+ maxShortPoolUsdForDeposit: string;
2995
+ reserveFactorLong: string;
2996
+ reserveFactorShort: string;
2997
+ openInterestReserveFactorLong: string;
2998
+ openInterestReserveFactorShort: string;
2999
+ maxOpenInterestLong: string;
3000
+ maxOpenInterestShort: string;
3001
+ minPositionImpactPoolAmount: string;
3002
+ positionImpactPoolDistributionRate: string;
3003
+ borrowingFactorLong: string;
3004
+ borrowingFactorShort: string;
3005
+ borrowingExponentFactorLong: string;
3006
+ borrowingExponentFactorShort: string;
3007
+ fundingFactor: string;
3008
+ fundingExponentFactor: string;
3009
+ fundingIncreaseFactorPerSecond: string;
3010
+ fundingDecreaseFactorPerSecond: string;
3011
+ thresholdForStableFunding: string;
3012
+ thresholdForDecreaseFunding: string;
3013
+ minFundingFactorPerSecond: string;
3014
+ maxFundingFactorPerSecond: string;
3015
+ maxPnlFactorForTradersLong: string;
3016
+ maxPnlFactorForTradersShort: string;
3017
+ positionFeeFactorForBalanceWasImproved: string;
3018
+ positionFeeFactorForBalanceWasNotImproved: string;
3019
+ positionImpactFactorPositive: string;
3020
+ positionImpactFactorNegative: string;
3021
+ maxPositionImpactFactorPositive: string;
3022
+ maxPositionImpactFactorNegative: string;
3023
+ maxPositionImpactFactorForLiquidations: string;
3024
+ maxLendableImpactFactor: string;
3025
+ maxLendableImpactFactorForWithdrawals: string;
3026
+ maxLendableImpactUsd: string;
3027
+ lentPositionImpactPoolAmount: string;
3028
+ minCollateralFactor: string;
3029
+ minCollateralFactorForLiquidation: string;
3030
+ minCollateralFactorForOpenInterestLong: string;
3031
+ minCollateralFactorForOpenInterestShort: string;
3032
+ positionImpactExponentFactorPositive: string;
3033
+ positionImpactExponentFactorNegative: string;
3034
+ swapFeeFactorForBalanceWasImproved: string;
3035
+ swapFeeFactorForBalanceWasNotImproved: string;
3036
+ atomicSwapFeeFactor: string;
3037
+ swapImpactFactorPositive: string;
3038
+ swapImpactFactorNegative: string;
3039
+ swapImpactExponentFactor: string;
3040
+ withdrawalFeeFactorBalanceWasImproved: string;
3041
+ withdrawalFeeFactorBalanceWasNotImproved: string;
3042
+ virtualMarketId: string;
3043
+ virtualLongTokenId: string;
3044
+ virtualShortTokenId: string;
3045
+ };
3046
+ "0xc5c9B5E23810565763De41144741477eeCB25e2e": {
3047
+ isDisabled: string;
3048
+ maxLongPoolAmount: string;
3049
+ maxShortPoolAmount: string;
3050
+ maxLongPoolUsdForDeposit: string;
3051
+ maxShortPoolUsdForDeposit: string;
3052
+ reserveFactorLong: string;
3053
+ reserveFactorShort: string;
3054
+ openInterestReserveFactorLong: string;
3055
+ openInterestReserveFactorShort: string;
3056
+ maxOpenInterestLong: string;
3057
+ maxOpenInterestShort: string;
3058
+ minPositionImpactPoolAmount: string;
3059
+ positionImpactPoolDistributionRate: string;
3060
+ borrowingFactorLong: string;
3061
+ borrowingFactorShort: string;
3062
+ borrowingExponentFactorLong: string;
3063
+ borrowingExponentFactorShort: string;
3064
+ fundingFactor: string;
3065
+ fundingExponentFactor: string;
3066
+ fundingIncreaseFactorPerSecond: string;
3067
+ fundingDecreaseFactorPerSecond: string;
3068
+ thresholdForStableFunding: string;
3069
+ thresholdForDecreaseFunding: string;
3070
+ minFundingFactorPerSecond: string;
3071
+ maxFundingFactorPerSecond: string;
3072
+ maxPnlFactorForTradersLong: string;
3073
+ maxPnlFactorForTradersShort: string;
3074
+ positionFeeFactorForBalanceWasImproved: string;
3075
+ positionFeeFactorForBalanceWasNotImproved: string;
3076
+ positionImpactFactorPositive: string;
3077
+ positionImpactFactorNegative: string;
3078
+ maxPositionImpactFactorPositive: string;
3079
+ maxPositionImpactFactorNegative: string;
3080
+ maxPositionImpactFactorForLiquidations: string;
3081
+ maxLendableImpactFactor: string;
3082
+ maxLendableImpactFactorForWithdrawals: string;
3083
+ maxLendableImpactUsd: string;
3084
+ lentPositionImpactPoolAmount: string;
3085
+ minCollateralFactor: string;
3086
+ minCollateralFactorForLiquidation: string;
3087
+ minCollateralFactorForOpenInterestLong: string;
3088
+ minCollateralFactorForOpenInterestShort: string;
3089
+ positionImpactExponentFactorPositive: string;
3090
+ positionImpactExponentFactorNegative: string;
3091
+ swapFeeFactorForBalanceWasImproved: string;
3092
+ swapFeeFactorForBalanceWasNotImproved: string;
3093
+ atomicSwapFeeFactor: string;
3094
+ swapImpactFactorPositive: string;
3095
+ swapImpactFactorNegative: string;
3096
+ swapImpactExponentFactor: string;
3097
+ withdrawalFeeFactorBalanceWasImproved: string;
3098
+ withdrawalFeeFactorBalanceWasNotImproved: string;
3099
+ virtualMarketId: string;
3100
+ virtualLongTokenId: string;
3101
+ virtualShortTokenId: string;
3102
+ };
3103
+ };
2812
3104
  "42161": {
2813
3105
  "0x47c031236e19d024b42f8AE6780E44A573170703": {
2814
3106
  isDisabled: string;
@@ -12649,6 +12941,40 @@ export declare const HASHED_KINK_MODEL_MARKET_RATES_KEYS: {
12649
12941
  aboveOptimalUsageBorrowingFactorShort: string;
12650
12942
  };
12651
12943
  };
12944
+ "4326": {
12945
+ "0x31EdCc52bE2Fa55Ba68f50409F9e6b7d9EbF3D59": {
12946
+ optimalUsageFactorLong: string;
12947
+ optimalUsageFactorShort: string;
12948
+ baseBorrowingFactorLong: string;
12949
+ baseBorrowingFactorShort: string;
12950
+ aboveOptimalUsageBorrowingFactorLong: string;
12951
+ aboveOptimalUsageBorrowingFactorShort: string;
12952
+ };
12953
+ "0x9b1B72720f6D277F3b1e607a0c5fab1B300248b1": {
12954
+ optimalUsageFactorLong: string;
12955
+ optimalUsageFactorShort: string;
12956
+ baseBorrowingFactorLong: string;
12957
+ baseBorrowingFactorShort: string;
12958
+ aboveOptimalUsageBorrowingFactorLong: string;
12959
+ aboveOptimalUsageBorrowingFactorShort: string;
12960
+ };
12961
+ "0xe8E716F1cddfFD0698B86919D41A8228d701fEe9": {
12962
+ optimalUsageFactorLong: string;
12963
+ optimalUsageFactorShort: string;
12964
+ baseBorrowingFactorLong: string;
12965
+ baseBorrowingFactorShort: string;
12966
+ aboveOptimalUsageBorrowingFactorLong: string;
12967
+ aboveOptimalUsageBorrowingFactorShort: string;
12968
+ };
12969
+ "0xc5c9B5E23810565763De41144741477eeCB25e2e": {
12970
+ optimalUsageFactorLong: string;
12971
+ optimalUsageFactorShort: string;
12972
+ baseBorrowingFactorLong: string;
12973
+ baseBorrowingFactorShort: string;
12974
+ aboveOptimalUsageBorrowingFactorLong: string;
12975
+ aboveOptimalUsageBorrowingFactorShort: string;
12976
+ };
12977
+ };
12652
12978
  "42161": {
12653
12979
  "0x47c031236e19d024b42f8AE6780E44A573170703": {
12654
12980
  optimalUsageFactorLong: string;
@@ -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: {
@@ -177,6 +196,7 @@ export type ContractsChainSlug = (typeof CONTRACTS_CHAIN_CONFIGS)[keyof typeof C
177
196
  export type SourceChainSlug = (typeof SOURCE_CHAIN_CONFIGS)[keyof typeof SOURCE_CHAIN_CONFIGS]["slug"];
178
197
  export type ChainSlug = ContractsChainSlug | SourceChainSlug | "unknown";
179
198
  export declare const botanix: Chain;
199
+ export declare const megaeth: Chain;
180
200
  export declare const VIEM_CHAIN_BY_CHAIN_ID: Record<AnyChainId, Chain>;
181
201
  export declare function getChainName(chainId: number): ChainName;
182
202
  export declare function getChainSlug(chainId: number): ChainSlug;
@@ -188,13 +208,13 @@ export declare function isContractsChain(chainId: number, dev?: boolean): chainI
188
208
  export declare function isTestnetChain(chainId: number): boolean;
189
209
  export declare function getMaxFeePerGas(chainId: ContractsChainId): bigint | undefined;
190
210
  export declare function getGasPricePremium(chainId: ContractsChainId): bigint | undefined;
191
- export declare function getMaxPriorityFeePerGas(chainId: ContractsChainId): 1500000000n | 7n;
211
+ export declare function getMaxPriorityFeePerGas(chainId: ContractsChainId): 1500000000n | 7n | 500000n;
192
212
  export declare function getMinExecutionFeeUsd(chainId: ContractsChainId): 1000000000000000000000000000n | undefined;
193
213
  export declare function getGasPriceBuffer(chainId: ContractsChainId): 2000n | undefined;
194
214
  export declare function isChainDisabled(chainId: ContractsChainId): false;
195
215
  export declare function getChainNativeTokenSymbol(chainId: ContractsChainId): "ETH" | "AVAX" | "BTC";
196
216
  export declare function getChainWrappedTokenSymbol(chainId: ContractsChainId): "WETH" | "WAVAX" | "PBTC";
197
- export declare function getChainDefaultCollateralSymbol(chainId: ContractsChainId): "USDC.e" | "USDC" | "USDC.E";
217
+ export declare function getChainDefaultCollateralSymbol(chainId: ContractsChainId): "USDC.e" | "USDC" | "USDC.E" | "USDM";
198
218
  export declare function getExplorerUrl(chainId: number | "layerzero" | "layerzero-testnet"): string;
199
219
  export declare function getTokenExplorerUrl(chainId: number, tokenAddress: string): string;
200
220
  export declare function getExecutionFeeConfig(chainId: ContractsChainId): {
@@ -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
+ OpenOceanRouter: "0x0000000000000000000000000000000000000000";
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";
@@ -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,7 @@
1
+ import { IHttp } from "../http/types";
2
+ import { StakingPowerResponse } from "./types";
3
+ export declare function fetchApiStakingPower(ctx: {
4
+ api: IHttp;
5
+ }, params: {
6
+ address: string;
7
+ }): Promise<StakingPowerResponse>;
@@ -0,0 +1,14 @@
1
+ export type StakingPowerResponse = {
2
+ cumulativePower: bigint;
3
+ totalNetworkPower: bigint;
4
+ userSharePercent: number;
5
+ historicalMaxStaked: bigint | null;
6
+ currentStaked: bigint;
7
+ loyaltyRatio: number | null;
8
+ lastPowerResetAt: number | null;
9
+ powerResetCount: number;
10
+ projectedRewardShare: bigint | null;
11
+ treasuryGmxBalance: bigint | null;
12
+ powerAccrualStart: number;
13
+ loyaltyTrackingStart: number;
14
+ };