@gmx-io/sdk 1.5.0-alpha-13 → 1.5.0-alpha-14

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 (37) hide show
  1. package/build/cjs/src/clients/v2/__tests__/decrease.spec.js +12 -12
  2. package/build/cjs/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +16 -0
  3. package/build/cjs/src/codegen/prebuilt/hashedMarketConfigKeys.json +122 -0
  4. package/build/cjs/src/codegen/prebuilt/hashedMarketValuesKeys.json +30 -0
  5. package/build/cjs/src/codegen/subsquid.js +24 -0
  6. package/build/cjs/src/configs/marketHours.js +14 -0
  7. package/build/cjs/src/configs/markets.js +14 -0
  8. package/build/cjs/src/configs/tokens.js +18 -0
  9. package/build/cjs/src/utils/markets/utils.js +5 -1
  10. package/build/cjs/src/utils/orderTransactions/utils.js +2 -2
  11. package/build/cjs/src/utils/orderTransactions/validateTypedData.js +3 -3
  12. package/build/cjs/src/utils/swap/__tests__/swapRouting.spec.js +1 -1
  13. package/build/cjs/src/utils/trade/trade.js +0 -7
  14. package/build/cjs/src/utils/tradeHistory/utils.js +1 -0
  15. package/build/cjs/src/utils/twap/index.js +4 -10
  16. package/build/esm/src/clients/v2/__tests__/decrease.spec.js +12 -12
  17. package/build/esm/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +16 -0
  18. package/build/esm/src/codegen/prebuilt/hashedMarketConfigKeys.json +122 -0
  19. package/build/esm/src/codegen/prebuilt/hashedMarketValuesKeys.json +30 -0
  20. package/build/esm/src/codegen/subsquid.js +24 -0
  21. package/build/esm/src/configs/marketHours.js +14 -0
  22. package/build/esm/src/configs/markets.js +14 -0
  23. package/build/esm/src/configs/tokens.js +18 -0
  24. package/build/esm/src/utils/markets/utils.js +4 -1
  25. package/build/esm/src/utils/orderTransactions/utils.js +2 -2
  26. package/build/esm/src/utils/orderTransactions/validateTypedData.js +3 -3
  27. package/build/esm/src/utils/subaccount/index.js +2 -2
  28. package/build/esm/src/utils/swap/__tests__/swapRouting.spec.js +1 -1
  29. package/build/esm/src/utils/trade/trade.js +0 -7
  30. package/build/esm/src/utils/tradeHistory/utils.js +1 -0
  31. package/build/esm/src/utils/twap/index.js +4 -10
  32. package/build/types/src/codegen/prebuilt/index.d.ts +168 -0
  33. package/build/types/src/codegen/subsquid.d.ts +61 -0
  34. package/build/types/src/utils/markets/utils.d.ts +1 -0
  35. package/build/types/src/utils/subaccount/index.d.ts +2 -2
  36. package/build/types/src/utils/tradeHistory/types.d.ts +1 -0
  37. package/package.json +1 -1
@@ -50,6 +50,14 @@
50
50
  "aboveOptimalUsageBorrowingFactorLong": "0x7a6c2c5606edbf4ad6d99540c5788fc9bdc10e90e63a84e11c4129a2f04c8cf9",
51
51
  "aboveOptimalUsageBorrowingFactorShort": "0xc6f8f13437ac5a034a7a93a8a4bfa46e8d83b49c61b45c01240003e491de9d72"
52
52
  },
53
+ "0x1b997cb4841c4cb360E384192fFd7fb26eb10e5f": {
54
+ "optimalUsageFactorLong": "0x4d65f516c890bfdc01bfaf9ef1fe05bc6a78d2a4015d14de0837219c887d7098",
55
+ "optimalUsageFactorShort": "0x42250297858b187815cfd16f31654b887069a6ae5a174f5e8764ef61e68a550e",
56
+ "baseBorrowingFactorLong": "0x64e7d45b8a6b5b607d007c813ac753232dda12a3ba6953a7abdc9ec1495663f4",
57
+ "baseBorrowingFactorShort": "0x2a8628640685fef975df5c0e898fc5d0796e46b0c11cc7f1fcb30ccfcf03900a",
58
+ "aboveOptimalUsageBorrowingFactorLong": "0xcd5fef2dcde9921645b4f25cc06658e4a232efdc005a237a71b5db4aa1795cad",
59
+ "aboveOptimalUsageBorrowingFactorShort": "0x02bf1759ac43e1a8ce374831520870154c462dc29fca7a2a19bac560c4a6ae87"
60
+ },
53
61
  "0xc5c9B5E23810565763De41144741477eeCB25e2e": {
54
62
  "optimalUsageFactorLong": "0x009bc89771e196346b3d41cf47c8234c6843f977392651e5a122511445fdc304",
55
63
  "optimalUsageFactorShort": "0x522a6a2270cc21374e753b06f2df5dabe018d2135aa58d75bd64ab43b16dc98f",
@@ -1115,6 +1123,14 @@
1115
1123
  "baseBorrowingFactorShort": "0x85a4a75fcc2ced632df6a9dadbc46b5d4171f166572e298ac8e0f5dc0a713818",
1116
1124
  "aboveOptimalUsageBorrowingFactorLong": "0xfdc145dc5c86925a834513f0c78ef57f8da0f095253e561506b6367106d5caac",
1117
1125
  "aboveOptimalUsageBorrowingFactorShort": "0xc961a42b4a07b7f63f14fbd2a3c14c41643eb80dd5a8fdcde32ad1365bcb51a7"
1126
+ },
1127
+ "0xE26E7b91143f367445f1c0a5dCf4f4aC8EaDcDb1": {
1128
+ "optimalUsageFactorLong": "0x7dd92ed8d2f972a0bedc134931f1ce1257fdc1ba4ebc043c270e81880efee700",
1129
+ "optimalUsageFactorShort": "0xec58abc0c1c902e8df7ed4f6968dbfd88228e741bfd63bf3efc635e0d7c9bb9d",
1130
+ "baseBorrowingFactorLong": "0x0df8b0065fbf53780b168beeff39d576cca7b15e1f341b4041d7b485a8ef4ec6",
1131
+ "baseBorrowingFactorShort": "0x7d507d9ca2d236ab9c89efaeb23488e5e23a215bd060a72d159eaa1f2fd0b604",
1132
+ "aboveOptimalUsageBorrowingFactorLong": "0x337fd48d8d99cf5949ebc95f32f43bfd55a3bdc9ba8c5ed407f7d6985d3bf30e",
1133
+ "aboveOptimalUsageBorrowingFactorShort": "0x580ab973f5bd7e0ab5f89478b225d431776863715a24acce5ee7fa1bd82ae9b0"
1118
1134
  }
1119
1135
  },
1120
1136
  "43113": {
@@ -368,6 +368,67 @@
368
368
  "virtualLongTokenId": "0x4dd17e45519b6398f395ed0297a67002668c720c17b5043a9623eec83970f300",
369
369
  "virtualShortTokenId": "0x4dd17e45519b6398f395ed0297a67002668c720c17b5043a9623eec83970f300"
370
370
  },
371
+ "0x1b997cb4841c4cb360E384192fFd7fb26eb10e5f": {
372
+ "isDisabled": "0xd8fdace800a4c83103aac9891b4b0f603cacb5305c5076797aa485655594fbba",
373
+ "maxLongPoolAmount": "0xb52e46073affb270b6f5d2dc00e98cad8a137299a18a8e508586b2a7bcc35bd8",
374
+ "maxShortPoolAmount": "0xb52e46073affb270b6f5d2dc00e98cad8a137299a18a8e508586b2a7bcc35bd8",
375
+ "maxLongPoolUsdForDeposit": "0x94073087e28bbd60148240b2ce84a26e792b28e42c3b4bee84c72e6309e55cd2",
376
+ "maxShortPoolUsdForDeposit": "0x94073087e28bbd60148240b2ce84a26e792b28e42c3b4bee84c72e6309e55cd2",
377
+ "reserveFactorLong": "0x369dfbbd5bb64557fa36bc15ae1b8668c400cbc248d2917fe1d3a6f8f7219c33",
378
+ "reserveFactorShort": "0x9d21778e6afe89fdf514be686b911dc469d7bbcc272ceb3b728dff8c6725eced",
379
+ "openInterestReserveFactorLong": "0xd40ff444859dc18c5c99c2ad33d835171e96bbfba7e2dd1b621fec903bb5b26f",
380
+ "openInterestReserveFactorShort": "0x0aa887953050ac21e878045372a940f9cd5c7370a49659f4cec39e51608eb25b",
381
+ "maxOpenInterestLong": "0x9bf240e704d3a75ad35f37d325c02f9aa3e3bc02a0061819c157fbf99455b4b2",
382
+ "maxOpenInterestShort": "0x7015edd7708aad6bd8c52eeab753a1d43558e8a88141855c08da48cc025d752b",
383
+ "minPositionImpactPoolAmount": "0x59afbf7aab6b95a001ffc02754acccd335f43d8d73eeb1fc58097be04a65ad90",
384
+ "positionImpactPoolDistributionRate": "0x534fadcfe9045d76308222b719d22bfb4d7e0881458fd9cc9d95f79763549226",
385
+ "borrowingFactorLong": "0x484562949038cd0cbbe2beb697a8c563b25a9bee77f13c025b34c11eb1264d51",
386
+ "borrowingFactorShort": "0x101a7a04ac633c7478beb76e600ec8d6a27725084c97dc23c93821b6622ee5e6",
387
+ "borrowingExponentFactorLong": "0x054e13a201541edbefbb70d6ca8a7b9f14f513d5b7ab1dbe2d3e58ebf8767376",
388
+ "borrowingExponentFactorShort": "0x117b4960427b5ba19e22cf93bc9e0dc6d89426111b88a430b8e9fb6a9413495c",
389
+ "fundingFactor": "0xa18c4f5b34c81270b08e91be081b6040bad2514f1b12ac9f1da4e472185f9937",
390
+ "fundingExponentFactor": "0xa302c1dd3f51344f25a107b2903d4a45d2e709824a47a5ecd89b77830445ce21",
391
+ "fundingIncreaseFactorPerSecond": "0xfdf029005c5bbf7488cf5db211c03304d8623404c14b81adb0f38e982c39c7ab",
392
+ "fundingDecreaseFactorPerSecond": "0x054a421c8ecc4bfb234c69e84018b01d3f0d1953c48597d1facaa90bea8a6da1",
393
+ "thresholdForStableFunding": "0xd451f4dca402c5f7831b6aa93949eb90578cf3f29b6f9ca1c8d3ecca7dc24de8",
394
+ "thresholdForDecreaseFunding": "0x1cbf36f58c5c89089f8623b9e58833f6371ce29511f2527d0778f7d17d66442e",
395
+ "minFundingFactorPerSecond": "0xf4c570cac7658d1f41dbe1d8a4a2598ce64dd697b0d9c36a6c08b0460ea284b1",
396
+ "maxFundingFactorPerSecond": "0xbbdf760355c10d81f9c346cfa565a144b46661f4be1a5c935cf7b36aaa94f0d7",
397
+ "maxPnlFactorForTradersLong": "0xe9c8aa945fe362a35ee9c317c50f140c6a5df1352e216e6bc30482a9934d475b",
398
+ "maxPnlFactorForTradersShort": "0x28a5854c2725559105d5bca89fa9c7ceabf49430aed49f3d8dfc5a2833df7457",
399
+ "maxPnlFactorForDepositsLong": "0x377f3e2436e51f8bb7332330849c77996db1e76d229c2eb5a9f5f47fd91e65c3",
400
+ "maxPnlFactorForDepositsShort": "0xd731e8084bc74a0e994fac10db3654bd08f57f431dcc10cd2d5e6e9e9bccd0d0",
401
+ "maxPnlFactorForWithdrawalsLong": "0xc3052b80166d473af290a5768304eba8da1e5b462928e8db98ef2ef3e13c91a9",
402
+ "maxPnlFactorForWithdrawalsShort": "0xa9f2024c292786d21122e14295c43d240cbcc385c4af7f7ded06ed594000ece4",
403
+ "positionFeeFactorForBalanceWasImproved": "0xa849fe5cb11f7f9a1aaf701389c202932d3651423178cd6cede552bedb565e85",
404
+ "positionFeeFactorForBalanceWasNotImproved": "0x8095c13a6bc72dbb84db6a9eecb56d37430d29c6446ec655f622d767d7ae992b",
405
+ "positionImpactFactorPositive": "0x740cbf46e81788450458231e648ab3b7b6dc06471829b69fb8a54bc3de4933f4",
406
+ "positionImpactFactorNegative": "0xebc5abe9d1e4c055b0ab182e3a551da01cd828092262a6f07c49c028e209a813",
407
+ "maxPositionImpactFactorPositive": "0xd84068c13d3a491e6642477684c2ef451109403ed3ca9d039a14e78982be9368",
408
+ "maxPositionImpactFactorNegative": "0xaf5f3c3187540ff281a3d49e4e0afc5e8e308a604f70ad372f3023e0d5e4ffb4",
409
+ "maxPositionImpactFactorForLiquidations": "0xee97beca8510a130e1453e6a7c5379a8f7bd94e2a37ca53376272936066af40c",
410
+ "maxLendableImpactFactor": "0x81e965d17630c3f7dd83d54d0043d1e3bfd41e3e23e5f05a586ae5cb06fb2808",
411
+ "maxLendableImpactFactorForWithdrawals": "0xcdb2169f71d16c22b6e551c1ab0fc214aa479433fa4cb94aa89c009eea1a90ae",
412
+ "maxLendableImpactUsd": "0xe57be8dd7792c817a637e22edc476a5140f9e354ade4c031a797c2b47139aa14",
413
+ "lentPositionImpactPoolAmount": "0x68e288e46bd9c3ed97d759789c40371fe3b2c147ff5d037794deeb8bd4ca2662",
414
+ "minCollateralFactor": "0x060ba8a608ecb3021894ff1cff3acd35dcd83acc4d7981f35f355b8e1a076efb",
415
+ "minCollateralFactorForLiquidation": "0xe1578f327b7b4953642dad58e4f612cae1e391ca6e51b53634d09d605adb04df",
416
+ "minCollateralFactorForOpenInterestLong": "0x17d58eaa937f738d247a46f930afb3c3fa0de9540be3dca06d20a0183383f9f5",
417
+ "minCollateralFactorForOpenInterestShort": "0xbc94908e04903c9fbe6bd7c10a393f399f76309bed48b442700a22ac336b1328",
418
+ "positionImpactExponentFactorPositive": "0x507225ae0c269eb456c901de710d5ce0b705580247cdd3d7f16385e195c3f697",
419
+ "positionImpactExponentFactorNegative": "0x0ce571c47f1c3983d18f63d176fb4ab9d01939ab1c03bb84a80fddb63d62e336",
420
+ "swapFeeFactorForBalanceWasImproved": "0xeed9ff6954c0738b72ee0b621ccf6abb300c04144d26dedc84fb808347ab0ef9",
421
+ "swapFeeFactorForBalanceWasNotImproved": "0x8b73f0ed4e83703c38d5f3cff850400da1a662b66cb592721f88ef714e901511",
422
+ "atomicSwapFeeFactor": "0x9d3eeeb6b5fb7f0905214874c795d5b66904525cfcb3baf9bf733e2c815678c8",
423
+ "swapImpactFactorPositive": "0xca6c5e6f90beaecf6bf2c4cb9082e2d471801c1de7a8f7a91689445228106a43",
424
+ "swapImpactFactorNegative": "0xf74a4061682bd6d5aa64f8d08fd89c9d1ddced12e2e0475bc5c1f3f06fbb911f",
425
+ "swapImpactExponentFactor": "0x4b40eaab0e60f6d02e307833005e61fb34b6e39332230c89ae08bae39911c850",
426
+ "withdrawalFeeFactorBalanceWasImproved": "0xd3bd872399788f44b1e62e8073d472855c67cb110a4b8f59787fd6de42bb2345",
427
+ "withdrawalFeeFactorBalanceWasNotImproved": "0x9f5f46d8bdd1d690a8e165e5092b5b69f90a5f88342f9ed0626b67742f84383a",
428
+ "virtualMarketId": "0x0e87938496e6015d1c2770872fe2980107d17adbce91f327a9b79e3615c9d3ef",
429
+ "virtualLongTokenId": "0x4dd17e45519b6398f395ed0297a67002668c720c17b5043a9623eec83970f300",
430
+ "virtualShortTokenId": "0x4dd17e45519b6398f395ed0297a67002668c720c17b5043a9623eec83970f300"
431
+ },
371
432
  "0xc5c9B5E23810565763De41144741477eeCB25e2e": {
372
433
  "isDisabled": "0xa49e0fc2306a1447bc9bd8c575d55503e7c332ac97b4d679e428c7fe8fa9cf91",
373
434
  "maxLongPoolAmount": "0x95faa8ab4cb72d45ef4d4b5497dff66d75e31840f083692073d40a804384f3d4",
@@ -8482,6 +8543,67 @@
8482
8543
  "virtualMarketId": "0x0972819d24db7fb85b0d03ee48c64ce38c97f76b27b8c12da91c070c8604b4ef",
8483
8544
  "virtualLongTokenId": "0xaab37f889b9680dda34f58a689de3023cb22f7ae14d32a3c1d45798a973db1f5",
8484
8545
  "virtualShortTokenId": "0xd5258cb84f0039be58306488e8df941c05f3cf4f219e92aacb6561c736bbb960"
8546
+ },
8547
+ "0xE26E7b91143f367445f1c0a5dCf4f4aC8EaDcDb1": {
8548
+ "isDisabled": "0x89d68641baa8443dcff05c06834a08f6a7c1edef759f2e89505fe251b6411cb5",
8549
+ "maxLongPoolAmount": "0x5c7eb3fb9940700a0eb6d0bc4b2efcec205e4bcd85611f2e63a40fb71b48a68b",
8550
+ "maxShortPoolAmount": "0xe728cf4596862b756ee8448e5477a5e2fe86f4615e86dbf8c346f289601bed4e",
8551
+ "maxLongPoolUsdForDeposit": "0x2b6c1f929f22df9fb3fbc8be79bf3c13c295bbf901c86479bb72e13c6322f311",
8552
+ "maxShortPoolUsdForDeposit": "0xdf9340c2699bb63d0d94e1699f94b67e5ccdb02a196ae3564f0fa67407fd5e14",
8553
+ "reserveFactorLong": "0x942b7baddb60c077d5709214cd5016edaf9326f0a82bef4a44e49c5fca0bed1f",
8554
+ "reserveFactorShort": "0x2d0c83c7f490492743ff305ff8f74c9cb1b0e9d2aed4ea96701697e9f3341334",
8555
+ "openInterestReserveFactorLong": "0x6bfce544dd3b467e6fef0037c39c0c3f67bd864a120acac1613b082aa235b971",
8556
+ "openInterestReserveFactorShort": "0xd6b19d01cdaa02f545273ee699126b49bdd7873cfce6a08f05899cb6c325b565",
8557
+ "maxOpenInterestLong": "0xc1e39a6acef065c09d69a01bb7eb76fef233f9a18cc1b6b074a7d6749de8f73c",
8558
+ "maxOpenInterestShort": "0xc11f4f78c57d7038516959a3fe36ed21919629c78b9dc96d4816d8e62e94726b",
8559
+ "minPositionImpactPoolAmount": "0x1b19fc708a5e2bb9049340fd6b0c9082e4677cc3180085f5a5b6fb0f8d8ae2a6",
8560
+ "positionImpactPoolDistributionRate": "0x82c016e3ad8dc55a677aae0bf9c1e67c8eebd94c4ff89cc974f9309079560748",
8561
+ "borrowingFactorLong": "0x1c84d12dc97018270af71b43842ed10639ff72873e9fb6a90b3032f7112934f7",
8562
+ "borrowingFactorShort": "0x3e95c2ba01960e2493ad89e0338aa4de3013bcd9cb4a3a8cd57b3a4e45142184",
8563
+ "borrowingExponentFactorLong": "0x65835087ab6457e46152b877b5cd1c48195208eec5a3dbeeeeb2e67399541920",
8564
+ "borrowingExponentFactorShort": "0xaf117b7aa763361627572fd0fc9ade6f86574962938033a1dddcb315830728c6",
8565
+ "fundingFactor": "0x6907267fc1b40efd0baa3386f28bb4bf3d6acbc95a6ec68e2be14cd4717809bc",
8566
+ "fundingExponentFactor": "0x4e67a86568a3ede53741d8fc1a497bf0129737c45035ab8fe47b738f8a7f8817",
8567
+ "fundingIncreaseFactorPerSecond": "0xc523d172916b7d185a87546732859612302bcfa1350c2fcaf5969a92a1421220",
8568
+ "fundingDecreaseFactorPerSecond": "0x4df236653ce9022fc7d434b4030c13f8d8c29b26c4bdc840f2ac5402cac306e3",
8569
+ "thresholdForStableFunding": "0xb3e20cff381d08f506fdc80d7b297637d93a6f0af665ce35c830a6c40df05cfa",
8570
+ "thresholdForDecreaseFunding": "0xe66d926cf13dd61685065230c5e677277a6216e486c8b87e7f66a63edc65e763",
8571
+ "minFundingFactorPerSecond": "0x74889040fc831d355b2db59ca6ce334987ae4a0a239ea7a5a26a2a2f54b548f4",
8572
+ "maxFundingFactorPerSecond": "0x7c955ef7e4de4a1959a5d14bb2dd13740c69e6a5499cf641dca8623fe8ed6625",
8573
+ "maxPnlFactorForTradersLong": "0xc2c237f5732794e8b70391ca156529fd8c8d03ea8e6745f925235991046db9c0",
8574
+ "maxPnlFactorForTradersShort": "0x2803e3c558f0310f6695a1f7ea2d065dbdcaf93285819c8044241f1c710e86d2",
8575
+ "maxPnlFactorForDepositsLong": "0xe4ef00881de9d0d7f6859e056d5a2322da73d4bd5eff978b55124a74c012f22a",
8576
+ "maxPnlFactorForDepositsShort": "0xcc75b2513c89b534cfd96e83e3602c3a495348eb1b011289bcab35eb7199d9bc",
8577
+ "maxPnlFactorForWithdrawalsLong": "0xd8a9dd2bf131f01d79b3a6ae5ebf4c07a921a3de7fa51ed28d4ae9890db5cff2",
8578
+ "maxPnlFactorForWithdrawalsShort": "0xa20ea8793827abdebb98815ab39f78243d9767fc96f7e6ddad331dfb84074537",
8579
+ "positionFeeFactorForBalanceWasImproved": "0x2e53b5a6d4eb857bed982666571b5e9f5262f8e5547f3464d5ef31239644f359",
8580
+ "positionFeeFactorForBalanceWasNotImproved": "0x6598798bc9a742ad80e3a067aeb00d2424a148e7cdb8387b2590809918d36f03",
8581
+ "positionImpactFactorPositive": "0xa607759df0905173feec89316d1dc1870cb12771da02d98fa0b2da11f250591e",
8582
+ "positionImpactFactorNegative": "0xcc48be879067c2c1f3239969109e641aa7915b31a950f52a8f1188d0074307c7",
8583
+ "maxPositionImpactFactorPositive": "0xaa439c0da01e92726f3e3614854dd0c9ffe0f9e071ac9ee627c79d110d1d05f4",
8584
+ "maxPositionImpactFactorNegative": "0x07995cd17dad67176b276d778ceb73de0cf26154e9534b510182bb592a491bb2",
8585
+ "maxPositionImpactFactorForLiquidations": "0x04eca53675ea95c36b24e6e843e9e9fb9ee6973f62c05062c426d6f5021aa8aa",
8586
+ "maxLendableImpactFactor": "0x8ca83545dfede07c09ac1fc94a639437785ab14f4b093688e0969588dca6f47f",
8587
+ "maxLendableImpactFactorForWithdrawals": "0x99916a49999fd164beb6992efd4fedb8beeda13c7e88d91025166c8f399984fd",
8588
+ "maxLendableImpactUsd": "0xdc3e2b698a345ac01ab2414afafde24f515f1784565534b33ac0a1e5040b59c2",
8589
+ "lentPositionImpactPoolAmount": "0xb9d9b2f6fa8030ee74c62e7d379e2401e5a6611173f68177414cd37868378e37",
8590
+ "minCollateralFactor": "0xace080b8e8a0d464623d586df742acb186715348c1025fb6d57721c8ff4c1d95",
8591
+ "minCollateralFactorForLiquidation": "0x824059faab4ca34a6ded9708af7a4db6f8c4b808f56f8603e8500f209b0ff5d1",
8592
+ "minCollateralFactorForOpenInterestLong": "0x9b9d4c83bd445c665c57218f3479082ded3a92ace65be3043152b6531786e866",
8593
+ "minCollateralFactorForOpenInterestShort": "0x3335401ee45a10c6928f296e77d8e755d284a29043125cb087c41cd072aa8dda",
8594
+ "positionImpactExponentFactorPositive": "0x0fad9e8d6acccf7b405515de6ecbfdd5158a650667adedc3f292b50b20305359",
8595
+ "positionImpactExponentFactorNegative": "0x2a8d8c25729ceb36b9aef38a35db0fcf013a058ad7f1643cda26b4ba5d53e532",
8596
+ "swapFeeFactorForBalanceWasImproved": "0xc0e7bdcacb1e2981c4012b4ed5f11fd0ee07c179b0cb6da1ac57041c71950f87",
8597
+ "swapFeeFactorForBalanceWasNotImproved": "0x2ababd65bdc1464452c03ed15aa4607d49c72fbb3d1eded38643609f4313af9a",
8598
+ "atomicSwapFeeFactor": "0x79013af000f937998d0016f33cf82090058f5d663cd4d2db53744ff1edb19d38",
8599
+ "swapImpactFactorPositive": "0xf8267cf53897b70b2bc0dff5d39e0a28c4bad82556cc597940a1bfae9eb16fc6",
8600
+ "swapImpactFactorNegative": "0xc67f6d06654371fb91aa8823f26c12fbd0b7be50de1c1ec438565f137bc580cc",
8601
+ "swapImpactExponentFactor": "0x288492d67c0c4af79f66f4c9e6d59da6865e696e95ce05cf69603b4b02f839e1",
8602
+ "withdrawalFeeFactorBalanceWasImproved": "0x8a34a6299a67ed5da0fe36bdcaab5662cd34f0e10c61c4b1830cb7170bf5aa42",
8603
+ "withdrawalFeeFactorBalanceWasNotImproved": "0x70e8956ef08c0020b1299fa6217d82c7b901b341d63d9861a2db14fccdad8f08",
8604
+ "virtualMarketId": "0x22983d1eed32b611212a3a066d73445a81c16488d0eb108423d4fed1375530ff",
8605
+ "virtualLongTokenId": "0xaab37f889b9680dda34f58a689de3023cb22f7ae14d32a3c1d45798a973db1f5",
8606
+ "virtualShortTokenId": "0xd5258cb84f0039be58306488e8df941c05f3cf4f219e92aacb6561c736bbb960"
8485
8607
  }
8486
8608
  },
8487
8609
  "43113": {
@@ -92,6 +92,21 @@
92
92
  "shortInterestInTokensUsingLongToken": "0xc9d6814f7afb11ad28efba7548a877fd702ce6f20100a22028aefd13bcdda320",
93
93
  "shortInterestInTokensUsingShortToken": "0xc9d6814f7afb11ad28efba7548a877fd702ce6f20100a22028aefd13bcdda320"
94
94
  },
95
+ "0x1b997cb4841c4cb360E384192fFd7fb26eb10e5f": {
96
+ "longPoolAmount": "0x6eeeebce2fdf38617ec29eb9959a0de16d48501756a021f6c8f6b731f3edc62d",
97
+ "shortPoolAmount": "0x6eeeebce2fdf38617ec29eb9959a0de16d48501756a021f6c8f6b731f3edc62d",
98
+ "positionImpactPoolAmount": "0x7a957c51406a0e27c1d5d2f992a1c051446ab02e989a1b3d67d1a2f86c372b08",
99
+ "swapImpactPoolAmountLong": "0x833a94ae64a7067956d648375e65ab64a1f2adf4a59af1eaef16428704e70018",
100
+ "swapImpactPoolAmountShort": "0x833a94ae64a7067956d648375e65ab64a1f2adf4a59af1eaef16428704e70018",
101
+ "longInterestUsingLongToken": "0x4e2ed563c2d7531f4e5cfaa2ae66d3c12c943cc9076506f76da61486d6f7651d",
102
+ "longInterestUsingShortToken": "0x4e2ed563c2d7531f4e5cfaa2ae66d3c12c943cc9076506f76da61486d6f7651d",
103
+ "shortInterestUsingLongToken": "0x280211af20306cf74c0c753973fb9a0f4d981c61d99013e3ac558945a4fd3a9d",
104
+ "shortInterestUsingShortToken": "0x280211af20306cf74c0c753973fb9a0f4d981c61d99013e3ac558945a4fd3a9d",
105
+ "longInterestInTokensUsingLongToken": "0xd1128cc54a30352bb652afa395628af45f450cad1496a04c65e532192be6903d",
106
+ "longInterestInTokensUsingShortToken": "0xd1128cc54a30352bb652afa395628af45f450cad1496a04c65e532192be6903d",
107
+ "shortInterestInTokensUsingLongToken": "0x3c97178a46fe7f37a87f5e318ca388132595870b4c7d306ba42e93d1e51b7e6a",
108
+ "shortInterestInTokensUsingShortToken": "0x3c97178a46fe7f37a87f5e318ca388132595870b4c7d306ba42e93d1e51b7e6a"
109
+ },
95
110
  "0xc5c9B5E23810565763De41144741477eeCB25e2e": {
96
111
  "longPoolAmount": "0x7c7a0a88c4e728b99ea46549faef00dc7f38dd06cc788aa991683ec87fa9d5da",
97
112
  "shortPoolAmount": "0xacce4845b7ef6fa3cf28e16cef47786c1759e08039fb6a65196ff8b50c1c051d",
@@ -2088,6 +2103,21 @@
2088
2103
  "longInterestInTokensUsingShortToken": "0x5cabb84debcb7263087ca7ef71e167a8048527739991483f2793bb6079554a50",
2089
2104
  "shortInterestInTokensUsingLongToken": "0xccb072d4c5cf74a4a1d0e6f80b7628dba861d6c95037409fc42800e72a935d7c",
2090
2105
  "shortInterestInTokensUsingShortToken": "0x3e1a9a944352a0080a281988fbf04a6b9c44a82767c10d16eb11ad80b1fb5d65"
2106
+ },
2107
+ "0xE26E7b91143f367445f1c0a5dCf4f4aC8EaDcDb1": {
2108
+ "longPoolAmount": "0x265452d70a411300a2535b1c9c212a3dcea8eb2793c66aec2fcd595776ba2c0b",
2109
+ "shortPoolAmount": "0x24f88d54e73a74c9c029fff00404272e44a15d9f931be2df1433f43ef5e5e428",
2110
+ "positionImpactPoolAmount": "0xddede8ea2450c8952f4d63ca76b41cbff50ac70ff33ad7ffb5af687ece60b6a4",
2111
+ "swapImpactPoolAmountLong": "0x247f293d3ac9f0a364133a52951a65b6c787d4c7bae97dc3b6df050992cdd0d1",
2112
+ "swapImpactPoolAmountShort": "0x7404361cc3b3fef3355b1a5909d966d710da23a6ccbb373c0c055ac93c46fd2f",
2113
+ "longInterestUsingLongToken": "0x3c1d9cbb6e868a0898d95ae2995937e5e688c959765c6011e6a311ff9f201271",
2114
+ "longInterestUsingShortToken": "0x558ce2e2477897307ba2936aa2f8c0dfbd33127aa678ce3848a0f7c2eb3364ec",
2115
+ "shortInterestUsingLongToken": "0x6c78cf314490bc2be23b69fcd0b6151271013acdc842d5825d6dc6142e2f68b6",
2116
+ "shortInterestUsingShortToken": "0x3273042e581026f84dbf62a47104addd7a4c737c96b49a6dced865d8fbacaba1",
2117
+ "longInterestInTokensUsingLongToken": "0x856d71ce9e06098ad8f41521a612499936c6f3f4c2ca09cbe4a0df90220b02e9",
2118
+ "longInterestInTokensUsingShortToken": "0xeaeddb563c71424272116a2849ba68f14386e2a137879fb04dd18ee62516aea9",
2119
+ "shortInterestInTokensUsingLongToken": "0x298283e2a61c186b0a633f3057050bcfefe43863e0a9326815324c4221c151f2",
2120
+ "shortInterestInTokensUsingShortToken": "0x87222648559c2801d1b6b6b0eda191128979ab67acbee2fab701e8a8c0313196"
2091
2121
  }
2092
2122
  },
2093
2123
  "43113": {
@@ -96,6 +96,12 @@ export var AccountStatOrderByInput;
96
96
  AccountStatOrderByInput["realizedPriceImpact_DESC"] = "realizedPriceImpact_DESC";
97
97
  AccountStatOrderByInput["realizedPriceImpact_DESC_NULLS_FIRST"] = "realizedPriceImpact_DESC_NULLS_FIRST";
98
98
  AccountStatOrderByInput["realizedPriceImpact_DESC_NULLS_LAST"] = "realizedPriceImpact_DESC_NULLS_LAST";
99
+ AccountStatOrderByInput["realizedSwapFees_ASC"] = "realizedSwapFees_ASC";
100
+ AccountStatOrderByInput["realizedSwapFees_ASC_NULLS_FIRST"] = "realizedSwapFees_ASC_NULLS_FIRST";
101
+ AccountStatOrderByInput["realizedSwapFees_ASC_NULLS_LAST"] = "realizedSwapFees_ASC_NULLS_LAST";
102
+ AccountStatOrderByInput["realizedSwapFees_DESC"] = "realizedSwapFees_DESC";
103
+ AccountStatOrderByInput["realizedSwapFees_DESC_NULLS_FIRST"] = "realizedSwapFees_DESC_NULLS_FIRST";
104
+ AccountStatOrderByInput["realizedSwapFees_DESC_NULLS_LAST"] = "realizedSwapFees_DESC_NULLS_LAST";
99
105
  AccountStatOrderByInput["realizedSwapImpact_ASC"] = "realizedSwapImpact_ASC";
100
106
  AccountStatOrderByInput["realizedSwapImpact_ASC_NULLS_FIRST"] = "realizedSwapImpact_ASC_NULLS_FIRST";
101
107
  AccountStatOrderByInput["realizedSwapImpact_ASC_NULLS_LAST"] = "realizedSwapImpact_ASC_NULLS_LAST";
@@ -2045,6 +2051,12 @@ export var PositionChangeOrderByInput;
2045
2051
  PositionChangeOrderByInput["sizeInUsd_DESC"] = "sizeInUsd_DESC";
2046
2052
  PositionChangeOrderByInput["sizeInUsd_DESC_NULLS_FIRST"] = "sizeInUsd_DESC_NULLS_FIRST";
2047
2053
  PositionChangeOrderByInput["sizeInUsd_DESC_NULLS_LAST"] = "sizeInUsd_DESC_NULLS_LAST";
2054
+ PositionChangeOrderByInput["swapFeeUsd_ASC"] = "swapFeeUsd_ASC";
2055
+ PositionChangeOrderByInput["swapFeeUsd_ASC_NULLS_FIRST"] = "swapFeeUsd_ASC_NULLS_FIRST";
2056
+ PositionChangeOrderByInput["swapFeeUsd_ASC_NULLS_LAST"] = "swapFeeUsd_ASC_NULLS_LAST";
2057
+ PositionChangeOrderByInput["swapFeeUsd_DESC"] = "swapFeeUsd_DESC";
2058
+ PositionChangeOrderByInput["swapFeeUsd_DESC_NULLS_FIRST"] = "swapFeeUsd_DESC_NULLS_FIRST";
2059
+ PositionChangeOrderByInput["swapFeeUsd_DESC_NULLS_LAST"] = "swapFeeUsd_DESC_NULLS_LAST";
2048
2060
  PositionChangeOrderByInput["swapImpactUsd_ASC"] = "swapImpactUsd_ASC";
2049
2061
  PositionChangeOrderByInput["swapImpactUsd_ASC_NULLS_FIRST"] = "swapImpactUsd_ASC_NULLS_FIRST";
2050
2062
  PositionChangeOrderByInput["swapImpactUsd_ASC_NULLS_LAST"] = "swapImpactUsd_ASC_NULLS_LAST";
@@ -2364,6 +2376,12 @@ export var PositionOrderByInput;
2364
2376
  PositionOrderByInput["accountStat_realizedPriceImpact_DESC"] = "accountStat_realizedPriceImpact_DESC";
2365
2377
  PositionOrderByInput["accountStat_realizedPriceImpact_DESC_NULLS_FIRST"] = "accountStat_realizedPriceImpact_DESC_NULLS_FIRST";
2366
2378
  PositionOrderByInput["accountStat_realizedPriceImpact_DESC_NULLS_LAST"] = "accountStat_realizedPriceImpact_DESC_NULLS_LAST";
2379
+ PositionOrderByInput["accountStat_realizedSwapFees_ASC"] = "accountStat_realizedSwapFees_ASC";
2380
+ PositionOrderByInput["accountStat_realizedSwapFees_ASC_NULLS_FIRST"] = "accountStat_realizedSwapFees_ASC_NULLS_FIRST";
2381
+ PositionOrderByInput["accountStat_realizedSwapFees_ASC_NULLS_LAST"] = "accountStat_realizedSwapFees_ASC_NULLS_LAST";
2382
+ PositionOrderByInput["accountStat_realizedSwapFees_DESC"] = "accountStat_realizedSwapFees_DESC";
2383
+ PositionOrderByInput["accountStat_realizedSwapFees_DESC_NULLS_FIRST"] = "accountStat_realizedSwapFees_DESC_NULLS_FIRST";
2384
+ PositionOrderByInput["accountStat_realizedSwapFees_DESC_NULLS_LAST"] = "accountStat_realizedSwapFees_DESC_NULLS_LAST";
2367
2385
  PositionOrderByInput["accountStat_realizedSwapImpact_ASC"] = "accountStat_realizedSwapImpact_ASC";
2368
2386
  PositionOrderByInput["accountStat_realizedSwapImpact_ASC_NULLS_FIRST"] = "accountStat_realizedSwapImpact_ASC_NULLS_FIRST";
2369
2387
  PositionOrderByInput["accountStat_realizedSwapImpact_ASC_NULLS_LAST"] = "accountStat_realizedSwapImpact_ASC_NULLS_LAST";
@@ -3157,6 +3175,12 @@ export var TradeActionOrderByInput;
3157
3175
  TradeActionOrderByInput["srcChainId_DESC"] = "srcChainId_DESC";
3158
3176
  TradeActionOrderByInput["srcChainId_DESC_NULLS_FIRST"] = "srcChainId_DESC_NULLS_FIRST";
3159
3177
  TradeActionOrderByInput["srcChainId_DESC_NULLS_LAST"] = "srcChainId_DESC_NULLS_LAST";
3178
+ TradeActionOrderByInput["swapFeeUsd_ASC"] = "swapFeeUsd_ASC";
3179
+ TradeActionOrderByInput["swapFeeUsd_ASC_NULLS_FIRST"] = "swapFeeUsd_ASC_NULLS_FIRST";
3180
+ TradeActionOrderByInput["swapFeeUsd_ASC_NULLS_LAST"] = "swapFeeUsd_ASC_NULLS_LAST";
3181
+ TradeActionOrderByInput["swapFeeUsd_DESC"] = "swapFeeUsd_DESC";
3182
+ TradeActionOrderByInput["swapFeeUsd_DESC_NULLS_FIRST"] = "swapFeeUsd_DESC_NULLS_FIRST";
3183
+ TradeActionOrderByInput["swapFeeUsd_DESC_NULLS_LAST"] = "swapFeeUsd_DESC_NULLS_LAST";
3160
3184
  TradeActionOrderByInput["swapImpactUsd_ASC"] = "swapImpactUsd_ASC";
3161
3185
  TradeActionOrderByInput["swapImpactUsd_ASC_NULLS_FIRST"] = "swapImpactUsd_ASC_NULLS_FIRST";
3162
3186
  TradeActionOrderByInput["swapImpactUsd_ASC_NULLS_LAST"] = "swapImpactUsd_ASC_NULLS_LAST";
@@ -21,4 +21,18 @@ export const MARKET_HOURS_MARKETS = {
21
21
  offHoursMcf: 40n * 10n ** 27n,
22
22
  offHoursMaxLeverage: 20,
23
23
  },
24
+ "0xE26E7b91143f367445f1c0a5dCf4f4aC8EaDcDb1": {
25
+ // MegaETH MEGA/USD
26
+ onHoursMcf: 22n * 10n ** 27n,
27
+ onHoursMaxLeverage: 40,
28
+ offHoursMcf: 22n * 10n ** 27n,
29
+ offHoursMaxLeverage: 40,
30
+ },
31
+ "0x1b997cb4841c4cb360E384192fFd7fb26eb10e5f": {
32
+ // Arbitrum MEGA/USD
33
+ onHoursMcf: 18n * 10n ** 27n,
34
+ onHoursMaxLeverage: 50,
35
+ offHoursMcf: 18n * 10n ** 27n,
36
+ offHoursMaxLeverage: 50,
37
+ },
24
38
  };
@@ -936,6 +936,13 @@ export const MARKETS = {
936
936
  longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
937
937
  shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
938
938
  },
939
+ // MEGA/USD [WETH-USDC]
940
+ "0xE26E7b91143f367445f1c0a5dCf4f4aC8EaDcDb1": {
941
+ marketTokenAddress: "0xE26E7b91143f367445f1c0a5dCf4f4aC8EaDcDb1",
942
+ indexTokenAddress: "0x13983f27Ce9365055a6a553233c49fE28e70103e",
943
+ longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
944
+ shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
945
+ },
939
946
  },
940
947
  [AVALANCHE]: {
941
948
  // BTC/USD [BTC-USDC]
@@ -1331,6 +1338,13 @@ export const MARKETS = {
1331
1338
  longTokenAddress: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
1332
1339
  shortTokenAddress: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
1333
1340
  },
1341
+ // MEGA/USD [USDM-USDM]
1342
+ "0x1b997cb4841c4cb360E384192fFd7fb26eb10e5f": {
1343
+ marketTokenAddress: "0x1b997cb4841c4cb360E384192fFd7fb26eb10e5f",
1344
+ indexTokenAddress: "0x28B7E77f82B25B95953825F1E3eA0E36c1c29861",
1345
+ longTokenAddress: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
1346
+ shortTokenAddress: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
1347
+ },
1334
1348
  // SWAP-ONLY [ETH-USDM]
1335
1349
  "0xc5c9B5E23810565763De41144741477eeCB25e2e": {
1336
1350
  marketTokenAddress: "0xc5c9B5E23810565763De41144741477eeCB25e2e",
@@ -1229,6 +1229,16 @@ export const TOKENS = {
1229
1229
  imageUrl: "https://s2.coinmarketcap.com/static/img/coins/64x64/39464.png",
1230
1230
  explorerUrl: "https://arbiscan.io/token/0x620aC65BE29066Bb9D1E92C65b35B9fD321Fb963",
1231
1231
  },
1232
+ {
1233
+ name: "MegaETH",
1234
+ symbol: "MEGA",
1235
+ address: "0x13983f27Ce9365055a6a553233c49fE28e70103e",
1236
+ isSynthetic: true,
1237
+ decimals: 18,
1238
+ categories: ["layer2", "defi"],
1239
+ imageUrl: "https://assets.coingecko.com/coins/images/69995/standard/ICON.png?1760337992",
1240
+ explorerUrl: "https://arbiscan.io/token/0x13983f27Ce9365055a6a553233c49fE28e70103e",
1241
+ },
1232
1242
  ],
1233
1243
  [AVALANCHE]: [
1234
1244
  {
@@ -1977,6 +1987,14 @@ export const TOKENS = {
1977
1987
  isStable: true,
1978
1988
  imageUrl: "https://assets.coingecko.com/coins/images/69955/standard/USDm.png?1760170136",
1979
1989
  },
1990
+ {
1991
+ name: "MegaETH",
1992
+ symbol: "MEGA",
1993
+ address: "0x28B7E77f82B25B95953825F1E3eA0E36c1c29861",
1994
+ decimals: 18,
1995
+ categories: ["layer2", "defi"],
1996
+ imageUrl: "https://assets.coingecko.com/coins/images/69995/standard/ICON.png?1760337992",
1997
+ },
1980
1998
  {
1981
1999
  name: "GMX",
1982
2000
  symbol: "GMX",
@@ -4,7 +4,7 @@ import { MARKET_HOURS_MARKETS } from "../../configs/marketHours";
4
4
  import { convertTokenAddress, getTokenVisualMultiplier, NATIVE_TOKEN_ADDRESS } from "../../configs/tokens";
5
5
  import { bigMath } from "../bigmath";
6
6
  import { getBorrowingFactorPerPeriod, getFundingFactorPerPeriod } from "../fees";
7
- import { applyFactor, PRECISION } from "../numbers";
7
+ import { applyFactor, expandDecimals, PRECISION } from "../numbers";
8
8
  import { getByKey } from "../objects";
9
9
  import { periodToSeconds } from "../time";
10
10
  import { convertToContractTokenPrices, convertToUsd, getMidPrice } from "../tokens";
@@ -205,6 +205,9 @@ export function getPriceForPnl(prices, isLong, maximize) {
205
205
  export function getIsMarketAvailableForExpressSwaps(marketInfo) {
206
206
  return [marketInfo.indexToken, marketInfo.longToken, marketInfo.shortToken].every((token) => token.hasPriceFeedProvider);
207
207
  }
208
+ export function getIsMarketDeprecated(marketInfo) {
209
+ return marketInfo.maxOpenInterestLong <= expandDecimals(1n, 30) && marketInfo.maxOpenInterestShort <= expandDecimals(1n, 30);
210
+ }
208
211
  export function getMarket24Stats(dayPriceCandle) {
209
212
  const open24h = dayPriceCandle.open;
210
213
  const high24h = dayPriceCandle.high;
@@ -158,8 +158,8 @@ export function buildDecreaseOrderPayload(p) {
158
158
  };
159
159
  }
160
160
  export function buildTwapOrdersPayloads(p, twapParams) {
161
- if (!twapParams.numberOfParts || twapParams.numberOfParts < 2) {
162
- throw new Error(`TWAP numberOfParts must be >= 2, got ${twapParams.numberOfParts}`);
161
+ if (!twapParams.numberOfParts || twapParams.numberOfParts <= 0) {
162
+ throw new Error(`TWAP numberOfParts must be > 0, got ${twapParams.numberOfParts}`);
163
163
  }
164
164
  const uiFeeReceiver = createTwapUiFeeReceiver({ numberOfParts: twapParams.numberOfParts, source: twapParams.source });
165
165
  if (isSwapOrderType(p.orderType)) {
@@ -70,7 +70,8 @@ accountAddress) {
70
70
  const cancellationReceiver = order?.addresses?.cancellationReceiver;
71
71
  if (cancellationReceiver) {
72
72
  const checksummedCancellationReceiver = getAddress(cancellationReceiver);
73
- if (checksummedCancellationReceiver !== ZERO_ADDRESS && !allowedReceivers.has(checksummedCancellationReceiver)) {
73
+ if (checksummedCancellationReceiver !== ZERO_ADDRESS &&
74
+ !allowedReceivers.has(checksummedCancellationReceiver)) {
74
75
  throw new Error(`Order cancellationReceiver "${cancellationReceiver}" does not match signer "${signerAddress}". Possible malicious typed data.`);
75
76
  }
76
77
  }
@@ -84,8 +85,7 @@ export function validateSubaccountApprovalTypedData(domain, message, chainId, si
84
85
  if (message.account && getAddress(message.account) !== checksummedSigner) {
85
86
  throw new Error(`Subaccount approval account "${message.account}" does not match signer "${signerAddress}"`);
86
87
  }
87
- if (message.subaccount &&
88
- getAddress(message.subaccount) !== getAddress(expectedSubaccountAddress)) {
88
+ if (message.subaccount && getAddress(message.subaccount) !== getAddress(expectedSubaccountAddress)) {
89
89
  throw new Error(`Subaccount address "${message.subaccount}" does not match expected "${expectedSubaccountAddress}"`);
90
90
  }
91
91
  }
@@ -2,5 +2,5 @@ export * from "./types";
2
2
  export { generateSubaccount, decryptSubaccountPrivateKey, createSubaccountSignerFromConfig, } from "./generateSubaccount";
3
3
  export { hashSubaccountApproval } from "./hashSubaccountApproval";
4
4
  export { getEmptySubaccountApproval } from "./getEmptySubaccountApproval";
5
- export { getSubaccountApprovalTypedData, } from "./getSubaccountApprovalTypedData";
6
- export { fetchSubaccountStatus, prepareSubaccountApproval, signSubaccountApproval, } from "./api";
5
+ export { getSubaccountApprovalTypedData } from "./getSubaccountApprovalTypedData";
6
+ export { fetchSubaccountStatus, prepareSubaccountApproval, signSubaccountApproval } from "./api";
@@ -293,7 +293,7 @@ describe("getBestSwapPath", () => {
293
293
  it("should handle routes with zero output", () => {
294
294
  const routes = createTestRoutes();
295
295
  const result = getBestSwapPath({ routes, usdIn: 100n * dollar, estimator: () => ({ usdOut: 0n }) });
296
- expect(result).toBeUndefined();
296
+ expect(result).toEqual(routes[0]);
297
297
  });
298
298
  it("should skip routes that throw errors", () => {
299
299
  const routes = createTestRoutes();
@@ -3,11 +3,7 @@ import { bigMath } from "../bigmath";
3
3
  import { DecreasePositionSwapType } from "../orders/types";
4
4
  import { getShouldUseMaxPrice } from "../prices";
5
5
  import { TradeMode, TradeType, } from "./types";
6
- const MAX_ALLOWED_SLIPPAGE = 5000; // 50%
7
6
  export function applySlippageToPrice(allowedSlippage, price, isIncrease, isLong) {
8
- if (allowedSlippage < 0 || allowedSlippage > MAX_ALLOWED_SLIPPAGE) {
9
- throw new Error(`allowedSlippage must be between 0 and ${MAX_ALLOWED_SLIPPAGE} bps, got ${allowedSlippage}`);
10
- }
11
7
  const shouldIncreasePrice = getShouldUseMaxPrice(isIncrease, isLong);
12
8
  const slippageBasisPoints = shouldIncreasePrice
13
9
  ? BASIS_POINTS_DIVISOR + allowedSlippage
@@ -15,9 +11,6 @@ export function applySlippageToPrice(allowedSlippage, price, isIncrease, isLong)
15
11
  return bigMath.mulDiv(price, BigInt(slippageBasisPoints), BASIS_POINTS_DIVISOR_BIGINT);
16
12
  }
17
13
  export function applySlippageToMinOut(allowedSlippage, minOutputAmount) {
18
- if (allowedSlippage < 0 || allowedSlippage > MAX_ALLOWED_SLIPPAGE) {
19
- throw new Error(`allowedSlippage must be between 0 and ${MAX_ALLOWED_SLIPPAGE} bps, got ${allowedSlippage}`);
20
- }
21
14
  const slippageBasisPoints = BASIS_POINTS_DIVISOR - allowedSlippage;
22
15
  return bigMath.mulDiv(minOutputAmount, BigInt(slippageBasisPoints), BASIS_POINTS_DIVISOR_BIGINT);
23
16
  }
@@ -118,6 +118,7 @@ export function createRawTradeActionTransformer(marketsInfoData, wrappedToken, t
118
118
  positionFeeAmount: rawAction.positionFeeAmount ? BigInt(rawAction.positionFeeAmount) : undefined,
119
119
  borrowingFeeAmount: rawAction.borrowingFeeAmount ? BigInt(rawAction.borrowingFeeAmount) : undefined,
120
120
  fundingFeeAmount: rawAction.fundingFeeAmount ? BigInt(rawAction.fundingFeeAmount) : undefined,
121
+ swapFeeUsd: rawAction.swapFeeUsd ? BigInt(rawAction.swapFeeUsd) : undefined,
121
122
  liquidationFeeAmount: rawAction.liquidationFeeAmount ? BigInt(rawAction.liquidationFeeAmount) : undefined,
122
123
  reason: rawAction.reason ?? undefined,
123
124
  reasonBytes: rawAction.reasonBytes ?? undefined,
@@ -12,13 +12,10 @@ export function getTwapDurationInSeconds(duration) {
12
12
  return duration.hours * 60 * 60 + duration.minutes * 60;
13
13
  }
14
14
  export function getTwapValidFromTime(duration, numberOfParts, partIndex) {
15
- if (numberOfParts < 2) {
16
- throw new Error(`TWAP numberOfParts must be >= 2, got ${numberOfParts}`);
17
- }
18
15
  const durationMinutes = duration.hours * 60 + duration.minutes;
19
- const durationSeconds = durationMinutes * 60;
16
+ const durationMs = durationMinutes * 60;
20
17
  const startTime = Math.ceil(Date.now() / 1000);
21
- return BigInt(Math.floor(startTime + (durationSeconds / (numberOfParts - 1)) * partIndex));
18
+ return BigInt(Math.floor(startTime + (durationMs / (numberOfParts - 1)) * partIndex));
22
19
  }
23
20
  export function changeTwapNumberOfPartsValue(value) {
24
21
  if (value < MIN_TWAP_NUMBER_OF_PARTS) {
@@ -40,13 +37,10 @@ export function getTwapOrderKey({ twapId, orderType, pool, isLong, collateralTok
40
37
  return `${twapId}-${type}-${pool}-${collateralTokenSymbol}`;
41
38
  }
42
39
  export function makeTwapValidFromTimeGetter(duration, numberOfParts) {
43
- if (numberOfParts < 2) {
44
- throw new Error(`TWAP numberOfParts must be >= 2, got ${numberOfParts}`);
45
- }
46
40
  const durationMinutes = duration.hours * 60 + duration.minutes;
47
- const durationSeconds = durationMinutes * 60;
41
+ const durationMs = durationMinutes * 60;
48
42
  const startTime = Math.ceil(Date.now() / 1000);
49
43
  return (part) => {
50
- return BigInt(Math.floor(startTime + (durationSeconds / (numberOfParts - 1)) * part));
44
+ return BigInt(Math.floor(startTime + (durationMs / (numberOfParts - 1)) * part));
51
45
  };
52
46
  }