@dhedge/v2-sdk 2.1.5 → 2.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +180 -45
  2. package/dist/config.d.ts +2 -0
  3. package/dist/entities/pool.d.ts +110 -1
  4. package/dist/services/hyperliquid/constants.d.ts +16 -0
  5. package/dist/services/hyperliquid/index.d.ts +6 -0
  6. package/dist/services/hyperliquid/marketData.d.ts +12 -0
  7. package/dist/services/hyperliquid/positionData.d.ts +1 -0
  8. package/dist/services/toros/limitOrder.d.ts +8 -0
  9. package/dist/test/constants.d.ts +7 -1
  10. package/dist/test/wallet.d.ts +1 -0
  11. package/dist/types.d.ts +12 -2
  12. package/dist/v2-sdk.cjs.development.js +1470 -32
  13. package/dist/v2-sdk.cjs.development.js.map +1 -1
  14. package/dist/v2-sdk.cjs.production.min.js +1 -1
  15. package/dist/v2-sdk.cjs.production.min.js.map +1 -1
  16. package/dist/v2-sdk.esm.js +1449 -12
  17. package/dist/v2-sdk.esm.js.map +1 -1
  18. package/package.json +3 -2
  19. package/src/abi/hyperliquid/ICoreDepositWallet.json +130 -0
  20. package/src/abi/hyperliquid/ICoreWriter.json +1 -0
  21. package/src/abi/toros/IPoolLimitOrderManager.json +78 -0
  22. package/src/config.ts +31 -9
  23. package/src/entities/pool.ts +348 -4
  24. package/src/services/hyperliquid/constants.ts +23 -0
  25. package/src/services/hyperliquid/index.ts +176 -0
  26. package/src/services/hyperliquid/marketData.ts +157 -0
  27. package/src/services/hyperliquid/positionData.ts +33 -0
  28. package/src/services/toros/limitOrder.ts +86 -0
  29. package/src/test/constants.ts +11 -5
  30. package/src/test/hyperliquid.test.ts +107 -0
  31. package/src/test/pool.test.ts +37 -45
  32. package/src/test/torosLimitOrder.test.ts +130 -0
  33. package/src/test/wallet.ts +2 -1
  34. package/src/types.ts +13 -2
@@ -4,7 +4,7 @@ import Lyra, { Deployment } from '@lyrafinance/lyra-js';
4
4
  import { Token, Price } from '@uniswap/sdk-core';
5
5
  import { nearestUsableTick, TICK_SPACINGS, encodeSqrtRatioX96, TickMath, priceToClosestTick } from '@uniswap/v3-sdk';
6
6
  import JSBI from 'jsbi';
7
- import BigNumber from 'bignumber.js';
7
+ import BigNumber, { BigNumber as BigNumber$2 } from 'bignumber.js';
8
8
  import axios from 'axios';
9
9
  import 'lodash-es/set';
10
10
  import '@ethersproject/abi';
@@ -4309,6 +4309,7 @@ var Network;
4309
4309
  Network["BASE"] = "base";
4310
4310
  Network["ETHEREUM"] = "ethereum";
4311
4311
  Network["PLASMA"] = "plasma";
4312
+ Network["HYPERLIQUID"] = "hyperliquid";
4312
4313
  })(Network || (Network = {}));
4313
4314
 
4314
4315
  var Dapp;
@@ -4337,6 +4338,7 @@ var Dapp;
4337
4338
  Dapp["ODOS"] = "odos";
4338
4339
  Dapp["PENDLE"] = "pendle";
4339
4340
  Dapp["KYBERSWAP"] = "kyberswap";
4341
+ Dapp["HYPERLIQUID"] = "hyperliquid";
4340
4342
  })(Dapp || (Dapp = {}));
4341
4343
 
4342
4344
  var Transaction;
@@ -4363,19 +4365,19 @@ var Transaction;
4363
4365
  Transaction["REMOVE_LIQUIDITY_UNSTAKE"] = "removeLiquidityAndUnstake";
4364
4366
  })(Transaction || (Transaction = {}));
4365
4367
 
4366
- var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _Network$ARBITRUM, _Network$BASE, _Network$ETHEREUM, _Network$PLASMA, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _Network$OPTIMISM2, _Network$ARBITRUM2, _Network$BASE2, _stakingAddress, _Network$POLYGON4, _Network$OPTIMISM3, _Network$ARBITRUM3, _Network$BASE3, _Network$ETHEREUM2, _Network$PLASMA2, _aaveAddressProvider, _Network$POLYGON5, _Network$OPTIMISM4, _Network$ARBITRUM4, _Network$BASE4, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress, _lyraNetworkMap, _flatMoneyContractAdd, _OdosSwapFeeRecipient;
4368
+ var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _Network$ARBITRUM, _Network$BASE, _Network$ETHEREUM, _Network$PLASMA, _Network$HYPERLIQUID, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _Network$OPTIMISM2, _Network$ARBITRUM2, _Network$BASE2, _stakingAddress, _Network$POLYGON4, _Network$OPTIMISM3, _Network$ARBITRUM3, _Network$BASE3, _Network$ETHEREUM2, _Network$PLASMA2, _aaveAddressProvider, _Network$POLYGON5, _Network$OPTIMISM4, _Network$ARBITRUM4, _Network$BASE4, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress, _lyraNetworkMap, _flatMoneyContractAdd, _limitOrderAddress, _OdosSwapFeeRecipient;
4367
4369
 
4368
4370
  require("dotenv").config();
4369
4371
 
4370
- var factoryAddress = (_factoryAddress = {}, _factoryAddress[Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress[Network.OPTIMISM] = "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", _factoryAddress[Network.ARBITRUM] = "0xfffb5fb14606eb3a548c113026355020ddf27535", _factoryAddress[Network.BASE] = "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F", _factoryAddress[Network.ETHEREUM] = "0x96D33bCF84DdE326014248E2896F79bbb9c13D6d", _factoryAddress[Network.PLASMA] = "0xAec4975Fc8ad911464D2948D771488b30F6eEE87", _factoryAddress);
4371
- var routerAddress = (_routerAddress = {}, _routerAddress[Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$POLYGON[Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[Dapp.ARRAKIS] = "0xc73fb100a995b33f9fa181d420f4c8d74506df66", _Network$POLYGON[Dapp.TOROS] = "0x45b90480D6F643dE2f128db091A357C3c90399f2", _Network$POLYGON[Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$POLYGON[Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$POLYGON), _routerAddress[Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM[Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$OPTIMISM[Dapp.TOROS] = "0x2Ed1bd7f66e47113672f3870308b5E867C5bb743", _Network$OPTIMISM[Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM[Dapp.VELODROMEV2] = "0xa062ae8a9c5e11aaa026fc2670b0d65ccc8b2858", _Network$OPTIMISM[Dapp.LYRA] = "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B", _Network$OPTIMISM[Dapp.ARRAKIS] = "0x9ce88a56d120300061593eF7AD074A1B710094d5", _Network$OPTIMISM[Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$OPTIMISM[Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$OPTIMISM[Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$OPTIMISM), _routerAddress[Network.ARBITRUM] = (_Network$ARBITRUM = {}, _Network$ARBITRUM[Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$ARBITRUM[Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$ARBITRUM[Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$ARBITRUM[Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$ARBITRUM[Dapp.RAMSES] = "0xaaa87963efeb6f7e0a2711f397663105acb1805e", _Network$ARBITRUM[Dapp.TOROS] = "0xA5679C4272A056Bb83f039961fae7D99C48529F5", _Network$ARBITRUM[Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$ARBITRUM[Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$ARBITRUM[Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$ARBITRUM), _routerAddress[Network.BASE] = (_Network$BASE = {}, _Network$BASE[Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$BASE[Dapp.AERODROME] = "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43", _Network$BASE[Dapp.AAVEV3] = "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5", _Network$BASE[Dapp.TOROS] = "0xf067575Eb60c7587C11e867907AA7284833704d1", _Network$BASE[Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$BASE[Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$BASE[Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$BASE), _routerAddress[Network.ETHEREUM] = (_Network$ETHEREUM = {}, _Network$ETHEREUM[Dapp.AAVEV3] = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2", _Network$ETHEREUM[Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$ETHEREUM[Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$ETHEREUM[Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$ETHEREUM[Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$ETHEREUM), _routerAddress[Network.PLASMA] = (_Network$PLASMA = {}, _Network$PLASMA[Dapp.AAVEV3] = "0x925a2A7214Ed92428B5b1B090F80b25700095e12", _Network$PLASMA[Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$PLASMA[Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$PLASMA), _routerAddress);
4372
- var dappFactoryAddress = (_dappFactoryAddress = {}, _dappFactoryAddress[Network.POLYGON] = (_Network$POLYGON2 = {}, _Network$POLYGON2[Dapp.SUSHISWAP] = "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", _Network$POLYGON2[Dapp.QUICKSWAP] = "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32", _Network$POLYGON2), _dappFactoryAddress[Network.OPTIMISM] = {}, _dappFactoryAddress[Network.ARBITRUM] = {}, _dappFactoryAddress[Network.BASE] = {}, _dappFactoryAddress[Network.ETHEREUM] = {}, _dappFactoryAddress[Network.PLASMA] = {}, _dappFactoryAddress);
4373
- var stakingAddress = (_stakingAddress = {}, _stakingAddress[Network.POLYGON] = (_Network$POLYGON3 = {}, _Network$POLYGON3[Dapp.SUSHISWAP] = "0x0769fd68dFb93167989C6f7254cd0D766Fb2841F", _Network$POLYGON3[Dapp.BALANCER] = "0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", _Network$POLYGON3[Dapp.AAVE] = "0x357D51124f59836DeD84c8a1730D72B749d8BC23", _Network$POLYGON3[Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$POLYGON3), _stakingAddress[Network.OPTIMISM] = (_Network$OPTIMISM2 = {}, _Network$OPTIMISM2[Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$OPTIMISM2[Dapp.COMPOUNDV3] = "0x443ea0340cb75a160f31a440722dec7b5bc3c2e9", _Network$OPTIMISM2), _stakingAddress[Network.ARBITRUM] = (_Network$ARBITRUM2 = {}, _Network$ARBITRUM2[Dapp.COMPOUNDV3] = "0x88730d254a2f7e6ac8388c3198afd694ba9f7fae", _Network$ARBITRUM2[Dapp.PANCAKECL] = "0x5e09ACf80C0296740eC5d6F643005a4ef8DaA694", _Network$ARBITRUM2), _stakingAddress[Network.BASE] = (_Network$BASE2 = {}, _Network$BASE2[Dapp.PANCAKECL] = "0xC6A2Db661D5a5690172d8eB0a7DEA2d3008665A3", _Network$BASE2), _stakingAddress[Network.ETHEREUM] = {}, _stakingAddress[Network.PLASMA] = {}, _stakingAddress);
4374
- var aaveAddressProvider = (_aaveAddressProvider = {}, _aaveAddressProvider[Network.POLYGON] = (_Network$POLYGON4 = {}, _Network$POLYGON4[Dapp.AAVE] = "0xd05e3E715d945B59290df0ae8eF85c1BdB684744", _Network$POLYGON4[Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$POLYGON4), _aaveAddressProvider[Network.OPTIMISM] = (_Network$OPTIMISM3 = {}, _Network$OPTIMISM3[Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$OPTIMISM3), _aaveAddressProvider[Network.ARBITRUM] = (_Network$ARBITRUM3 = {}, _Network$ARBITRUM3[Dapp.AAVEV3] = "0xa97684ead0e402dc232d5a977953df7ecbab3cdb", _Network$ARBITRUM3), _aaveAddressProvider[Network.BASE] = (_Network$BASE3 = {}, _Network$BASE3[Dapp.AAVEV3] = "0xe20fCBdBfFC4Dd138cE8b2E6FBb6CB49777ad64D", _Network$BASE3), _aaveAddressProvider[Network.ETHEREUM] = (_Network$ETHEREUM2 = {}, _Network$ETHEREUM2[Dapp.AAVEV3] = "0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e", _Network$ETHEREUM2), _aaveAddressProvider[Network.PLASMA] = (_Network$PLASMA2 = {}, _Network$PLASMA2[Dapp.AAVEV3] = "0x061D8e131F26512348ee5FA42e2DF1bA9d6505E9", _Network$PLASMA2), _aaveAddressProvider);
4375
- var nonfungiblePositionManagerAddress = (_nonfungiblePositionM = {}, _nonfungiblePositionM[Network.POLYGON] = (_Network$POLYGON5 = {}, _Network$POLYGON5[Dapp.UNISWAPV3] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _Network$POLYGON5), _nonfungiblePositionM[Network.OPTIMISM] = (_Network$OPTIMISM4 = {}, _Network$OPTIMISM4[Dapp.UNISWAPV3] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _Network$OPTIMISM4[Dapp.VELODROMECL] = "0x416b433906b1B72FA758e166e239c43d68dC6F29", _Network$OPTIMISM4), _nonfungiblePositionM[Network.ARBITRUM] = (_Network$ARBITRUM4 = {}, _Network$ARBITRUM4[Dapp.UNISWAPV3] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _Network$ARBITRUM4[Dapp.RAMSESCL] = "0xAA277CB7914b7e5514946Da92cb9De332Ce610EF", _Network$ARBITRUM4[Dapp.PANCAKECL] = "0x46a15b0b27311cedf172ab29e4f4766fbe7f4364", _Network$ARBITRUM4), _nonfungiblePositionM[Network.BASE] = (_Network$BASE4 = {}, _Network$BASE4[Dapp.UNISWAPV3] = "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1", _Network$BASE4[Dapp.AERODROMECL] = "0x827922686190790b37229fd06084350e74485b72", _Network$BASE4[Dapp.PANCAKECL] = "0x46A15B0b27311cedF172AB29E4f4766fbE7F4364", _Network$BASE4), _nonfungiblePositionM[Network.ETHEREUM] = {}, _nonfungiblePositionM[Network.PLASMA] = {}, _nonfungiblePositionM);
4376
- var networkChainIdMap = (_networkChainIdMap = {}, _networkChainIdMap[Network.POLYGON] = 137, _networkChainIdMap[Network.OPTIMISM] = 10, _networkChainIdMap[Network.ARBITRUM] = 42161, _networkChainIdMap[Network.BASE] = 8453, _networkChainIdMap[Network.ETHEREUM] = 1, _networkChainIdMap[Network.PLASMA] = 9745, _networkChainIdMap);
4377
- var balancerSubgraph = (_balancerSubgraph = {}, _balancerSubgraph[Network.POLYGON] = "https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2", _balancerSubgraph[Network.OPTIMISM] = "", _balancerSubgraph[Network.ARBITRUM] = "", _balancerSubgraph[Network.BASE] = "", _balancerSubgraph[Network.ETHEREUM] = "", _balancerSubgraph[Network.PLASMA] = "", _balancerSubgraph);
4378
- var multiCallAddress = (_multiCallAddress = {}, _multiCallAddress[Network.POLYGON] = "0x275617327c958bD06b5D6b871E7f491D76113dd8", _multiCallAddress[Network.OPTIMISM] = "", _multiCallAddress[Network.ARBITRUM] = "", _multiCallAddress[Network.BASE] = "", _multiCallAddress[Network.ETHEREUM] = "", _multiCallAddress[Network.PLASMA] = "", _multiCallAddress);
4372
+ var factoryAddress = (_factoryAddress = {}, _factoryAddress[Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress[Network.OPTIMISM] = "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", _factoryAddress[Network.ARBITRUM] = "0xfffb5fb14606eb3a548c113026355020ddf27535", _factoryAddress[Network.BASE] = "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F", _factoryAddress[Network.ETHEREUM] = "0x96D33bCF84DdE326014248E2896F79bbb9c13D6d", _factoryAddress[Network.PLASMA] = "0xAec4975Fc8ad911464D2948D771488b30F6eEE87", _factoryAddress[Network.HYPERLIQUID] = "0xe91505e2ab653dd128c71e9690eeefd28cc5b333", _factoryAddress);
4373
+ var routerAddress = (_routerAddress = {}, _routerAddress[Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$POLYGON[Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[Dapp.ARRAKIS] = "0xc73fb100a995b33f9fa181d420f4c8d74506df66", _Network$POLYGON[Dapp.TOROS] = "0x45b90480D6F643dE2f128db091A357C3c90399f2", _Network$POLYGON[Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$POLYGON[Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$POLYGON), _routerAddress[Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM[Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$OPTIMISM[Dapp.TOROS] = "0x2Ed1bd7f66e47113672f3870308b5E867C5bb743", _Network$OPTIMISM[Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM[Dapp.VELODROMEV2] = "0xa062ae8a9c5e11aaa026fc2670b0d65ccc8b2858", _Network$OPTIMISM[Dapp.LYRA] = "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B", _Network$OPTIMISM[Dapp.ARRAKIS] = "0x9ce88a56d120300061593eF7AD074A1B710094d5", _Network$OPTIMISM[Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$OPTIMISM[Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$OPTIMISM[Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$OPTIMISM), _routerAddress[Network.ARBITRUM] = (_Network$ARBITRUM = {}, _Network$ARBITRUM[Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$ARBITRUM[Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$ARBITRUM[Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$ARBITRUM[Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$ARBITRUM[Dapp.RAMSES] = "0xaaa87963efeb6f7e0a2711f397663105acb1805e", _Network$ARBITRUM[Dapp.TOROS] = "0xA5679C4272A056Bb83f039961fae7D99C48529F5", _Network$ARBITRUM[Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$ARBITRUM[Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$ARBITRUM[Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$ARBITRUM), _routerAddress[Network.BASE] = (_Network$BASE = {}, _Network$BASE[Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$BASE[Dapp.AERODROME] = "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43", _Network$BASE[Dapp.AAVEV3] = "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5", _Network$BASE[Dapp.TOROS] = "0xf067575Eb60c7587C11e867907AA7284833704d1", _Network$BASE[Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$BASE[Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$BASE[Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$BASE), _routerAddress[Network.ETHEREUM] = (_Network$ETHEREUM = {}, _Network$ETHEREUM[Dapp.AAVEV3] = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2", _Network$ETHEREUM[Dapp.ODOS] = "0x0D05a7D3448512B78fa8A9e46c4872C88C4a0D05", _Network$ETHEREUM[Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$ETHEREUM[Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$ETHEREUM[Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$ETHEREUM), _routerAddress[Network.PLASMA] = (_Network$PLASMA = {}, _Network$PLASMA[Dapp.AAVEV3] = "0x925a2A7214Ed92428B5b1B090F80b25700095e12", _Network$PLASMA[Dapp.PENDLE] = "0x888888888889758F76e7103c6CbF23ABbF58F946", _Network$PLASMA[Dapp.KYBERSWAP] = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", _Network$PLASMA), _routerAddress[Network.HYPERLIQUID] = (_Network$HYPERLIQUID = {}, _Network$HYPERLIQUID[Dapp.HYPERLIQUID] = "0x6b9e773128f453f5c2c60935ee2de2cbc5390a24", _Network$HYPERLIQUID), _routerAddress);
4374
+ var dappFactoryAddress = (_dappFactoryAddress = {}, _dappFactoryAddress[Network.POLYGON] = (_Network$POLYGON2 = {}, _Network$POLYGON2[Dapp.SUSHISWAP] = "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", _Network$POLYGON2[Dapp.QUICKSWAP] = "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32", _Network$POLYGON2), _dappFactoryAddress[Network.OPTIMISM] = {}, _dappFactoryAddress[Network.ARBITRUM] = {}, _dappFactoryAddress[Network.BASE] = {}, _dappFactoryAddress[Network.ETHEREUM] = {}, _dappFactoryAddress[Network.PLASMA] = {}, _dappFactoryAddress[Network.HYPERLIQUID] = {}, _dappFactoryAddress);
4375
+ var stakingAddress = (_stakingAddress = {}, _stakingAddress[Network.POLYGON] = (_Network$POLYGON3 = {}, _Network$POLYGON3[Dapp.SUSHISWAP] = "0x0769fd68dFb93167989C6f7254cd0D766Fb2841F", _Network$POLYGON3[Dapp.BALANCER] = "0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", _Network$POLYGON3[Dapp.AAVE] = "0x357D51124f59836DeD84c8a1730D72B749d8BC23", _Network$POLYGON3[Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$POLYGON3), _stakingAddress[Network.OPTIMISM] = (_Network$OPTIMISM2 = {}, _Network$OPTIMISM2[Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$OPTIMISM2[Dapp.COMPOUNDV3] = "0x443ea0340cb75a160f31a440722dec7b5bc3c2e9", _Network$OPTIMISM2), _stakingAddress[Network.ARBITRUM] = (_Network$ARBITRUM2 = {}, _Network$ARBITRUM2[Dapp.COMPOUNDV3] = "0x88730d254a2f7e6ac8388c3198afd694ba9f7fae", _Network$ARBITRUM2[Dapp.PANCAKECL] = "0x5e09ACf80C0296740eC5d6F643005a4ef8DaA694", _Network$ARBITRUM2), _stakingAddress[Network.BASE] = (_Network$BASE2 = {}, _Network$BASE2[Dapp.PANCAKECL] = "0xC6A2Db661D5a5690172d8eB0a7DEA2d3008665A3", _Network$BASE2), _stakingAddress[Network.ETHEREUM] = {}, _stakingAddress[Network.PLASMA] = {}, _stakingAddress[Network.HYPERLIQUID] = {}, _stakingAddress);
4376
+ var aaveAddressProvider = (_aaveAddressProvider = {}, _aaveAddressProvider[Network.POLYGON] = (_Network$POLYGON4 = {}, _Network$POLYGON4[Dapp.AAVE] = "0xd05e3E715d945B59290df0ae8eF85c1BdB684744", _Network$POLYGON4[Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$POLYGON4), _aaveAddressProvider[Network.OPTIMISM] = (_Network$OPTIMISM3 = {}, _Network$OPTIMISM3[Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$OPTIMISM3), _aaveAddressProvider[Network.ARBITRUM] = (_Network$ARBITRUM3 = {}, _Network$ARBITRUM3[Dapp.AAVEV3] = "0xa97684ead0e402dc232d5a977953df7ecbab3cdb", _Network$ARBITRUM3), _aaveAddressProvider[Network.BASE] = (_Network$BASE3 = {}, _Network$BASE3[Dapp.AAVEV3] = "0xe20fCBdBfFC4Dd138cE8b2E6FBb6CB49777ad64D", _Network$BASE3), _aaveAddressProvider[Network.ETHEREUM] = (_Network$ETHEREUM2 = {}, _Network$ETHEREUM2[Dapp.AAVEV3] = "0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e", _Network$ETHEREUM2), _aaveAddressProvider[Network.PLASMA] = (_Network$PLASMA2 = {}, _Network$PLASMA2[Dapp.AAVEV3] = "0x061D8e131F26512348ee5FA42e2DF1bA9d6505E9", _Network$PLASMA2), _aaveAddressProvider[Network.HYPERLIQUID] = {}, _aaveAddressProvider);
4377
+ var nonfungiblePositionManagerAddress = (_nonfungiblePositionM = {}, _nonfungiblePositionM[Network.POLYGON] = (_Network$POLYGON5 = {}, _Network$POLYGON5[Dapp.UNISWAPV3] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _Network$POLYGON5), _nonfungiblePositionM[Network.OPTIMISM] = (_Network$OPTIMISM4 = {}, _Network$OPTIMISM4[Dapp.UNISWAPV3] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _Network$OPTIMISM4[Dapp.VELODROMECL] = "0x416b433906b1B72FA758e166e239c43d68dC6F29", _Network$OPTIMISM4), _nonfungiblePositionM[Network.ARBITRUM] = (_Network$ARBITRUM4 = {}, _Network$ARBITRUM4[Dapp.UNISWAPV3] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _Network$ARBITRUM4[Dapp.RAMSESCL] = "0xAA277CB7914b7e5514946Da92cb9De332Ce610EF", _Network$ARBITRUM4[Dapp.PANCAKECL] = "0x46a15b0b27311cedf172ab29e4f4766fbe7f4364", _Network$ARBITRUM4), _nonfungiblePositionM[Network.BASE] = (_Network$BASE4 = {}, _Network$BASE4[Dapp.UNISWAPV3] = "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1", _Network$BASE4[Dapp.AERODROMECL] = "0x827922686190790b37229fd06084350e74485b72", _Network$BASE4[Dapp.PANCAKECL] = "0x46A15B0b27311cedF172AB29E4f4766fbE7F4364", _Network$BASE4), _nonfungiblePositionM[Network.ETHEREUM] = {}, _nonfungiblePositionM[Network.PLASMA] = {}, _nonfungiblePositionM[Network.HYPERLIQUID] = {}, _nonfungiblePositionM);
4378
+ var networkChainIdMap = (_networkChainIdMap = {}, _networkChainIdMap[Network.POLYGON] = 137, _networkChainIdMap[Network.OPTIMISM] = 10, _networkChainIdMap[Network.ARBITRUM] = 42161, _networkChainIdMap[Network.BASE] = 8453, _networkChainIdMap[Network.ETHEREUM] = 1, _networkChainIdMap[Network.PLASMA] = 9745, _networkChainIdMap[Network.HYPERLIQUID] = 999, _networkChainIdMap);
4379
+ var balancerSubgraph = (_balancerSubgraph = {}, _balancerSubgraph[Network.POLYGON] = "https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2", _balancerSubgraph[Network.OPTIMISM] = "", _balancerSubgraph[Network.ARBITRUM] = "", _balancerSubgraph[Network.BASE] = "", _balancerSubgraph[Network.ETHEREUM] = "", _balancerSubgraph[Network.PLASMA] = "", _balancerSubgraph[Network.HYPERLIQUID] = "", _balancerSubgraph);
4380
+ var multiCallAddress = (_multiCallAddress = {}, _multiCallAddress[Network.POLYGON] = "0x275617327c958bD06b5D6b871E7f491D76113dd8", _multiCallAddress[Network.OPTIMISM] = "", _multiCallAddress[Network.ARBITRUM] = "", _multiCallAddress[Network.BASE] = "", _multiCallAddress[Network.ETHEREUM] = "", _multiCallAddress[Network.PLASMA] = "", _multiCallAddress[Network.HYPERLIQUID] = "", _multiCallAddress);
4379
4381
  var lyraNetworkMap = (_lyraNetworkMap = {}, _lyraNetworkMap[Network.OPTIMISM] = Deployment.Mainnet, _lyraNetworkMap);
4380
4382
  var MaxUint128 = "0xffffffffffffffffffffffffffffffff";
4381
4383
  var UNISWAPV3_QUOTER_ADDRESS = "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6";
@@ -4399,7 +4401,8 @@ var flatMoneyContractAddresses = (_flatMoneyContractAdd = {}, _flatMoneyContract
4399
4401
  COLLATERAL: "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f",
4400
4402
  StableModule: "0xcD3657cB0E851b6a734c4D1e7FC2640Bcd9f6B2d"
4401
4403
  }, _flatMoneyContractAdd);
4402
- var OdosSwapFeeRecipient = (_OdosSwapFeeRecipient = {}, _OdosSwapFeeRecipient[Network.POLYGON] = "0x090e7fbD87A673eE3D0B6ccACf0e1d94fB90DA59", _OdosSwapFeeRecipient[Network.OPTIMISM] = "0x813123A13d01d3F07d434673Fdc89cBBA523f14d", _OdosSwapFeeRecipient[Network.ARBITRUM] = "0xfbD2B4216f422DC1eEe1Cff4Fb64B726F099dEF5", _OdosSwapFeeRecipient[Network.BASE] = "0x5619AD05b0253a7e647Bd2E4C01c7f40CEaB0879", _OdosSwapFeeRecipient[Network.ETHEREUM] = "0xfbD2B4216f422DC1eEe1Cff4Fb64B726F099dEF5", _OdosSwapFeeRecipient[Network.PLASMA] = "", _OdosSwapFeeRecipient);
4404
+ var limitOrderAddress = (_limitOrderAddress = {}, _limitOrderAddress[Network.POLYGON] = "0xB71410736d2C8F2DAf30dA9D332dA10534d2624d", _limitOrderAddress[Network.OPTIMISM] = "0x3bFE2a472d2964Ea4070725b7Fb0A868b3f08b63", _limitOrderAddress[Network.ARBITRUM] = "0x26a687e8244f1866E9Aa2D400c8b9957Aa8e6Ad4", _limitOrderAddress[Network.BASE] = "0xFcBEc28c43E356693971a24bf3F2Fd7D965E2ebA", _limitOrderAddress[Network.ETHEREUM] = "0x95B19De479bc693721cab39Da98FfECE062f5Ea4", _limitOrderAddress[Network.PLASMA] = "", _limitOrderAddress[Network.HYPERLIQUID] = "", _limitOrderAddress);
4405
+ var OdosSwapFeeRecipient = (_OdosSwapFeeRecipient = {}, _OdosSwapFeeRecipient[Network.POLYGON] = "0x090e7fbD87A673eE3D0B6ccACf0e1d94fB90DA59", _OdosSwapFeeRecipient[Network.OPTIMISM] = "0x813123A13d01d3F07d434673Fdc89cBBA523f14d", _OdosSwapFeeRecipient[Network.ARBITRUM] = "0xfbD2B4216f422DC1eEe1Cff4Fb64B726F099dEF5", _OdosSwapFeeRecipient[Network.BASE] = "0x5619AD05b0253a7e647Bd2E4C01c7f40CEaB0879", _OdosSwapFeeRecipient[Network.ETHEREUM] = "0xfbD2B4216f422DC1eEe1Cff4Fb64B726F099dEF5", _OdosSwapFeeRecipient[Network.PLASMA] = "", _OdosSwapFeeRecipient[Network.HYPERLIQUID] = "", _OdosSwapFeeRecipient);
4403
4406
 
4404
4407
  var abi$3 = [
4405
4408
  {
@@ -29477,6 +29480,270 @@ var getCompleteWithdrawalTxData = /*#__PURE__*/function () {
29477
29480
  };
29478
29481
  }();
29479
29482
 
29483
+ var IPoolLimitOrderManager = [
29484
+ {
29485
+ inputs: [
29486
+ {
29487
+ components: [
29488
+ {
29489
+ internalType: "uint256",
29490
+ name: "amount",
29491
+ type: "uint256"
29492
+ },
29493
+ {
29494
+ internalType: "uint256",
29495
+ name: "stopLossPriceD18",
29496
+ type: "uint256"
29497
+ },
29498
+ {
29499
+ internalType: "uint256",
29500
+ name: "takeProfitPriceD18",
29501
+ type: "uint256"
29502
+ },
29503
+ {
29504
+ internalType: "address",
29505
+ name: "user",
29506
+ type: "address"
29507
+ },
29508
+ {
29509
+ internalType: "address",
29510
+ name: "pool",
29511
+ type: "address"
29512
+ },
29513
+ {
29514
+ internalType: "address",
29515
+ name: "pricingAsset",
29516
+ type: "address"
29517
+ }
29518
+ ],
29519
+ internalType: "struct IPoolLimitOrderManager.LimitOrderInfo",
29520
+ name: "limitOrderInfo",
29521
+ type: "tuple"
29522
+ }
29523
+ ],
29524
+ name: "createLimitOrder",
29525
+ outputs: [
29526
+ ],
29527
+ stateMutability: "nonpayable",
29528
+ type: "function"
29529
+ },
29530
+ {
29531
+ inputs: [
29532
+ {
29533
+ components: [
29534
+ {
29535
+ internalType: "uint256",
29536
+ name: "amount",
29537
+ type: "uint256"
29538
+ },
29539
+ {
29540
+ internalType: "uint256",
29541
+ name: "stopLossPriceD18",
29542
+ type: "uint256"
29543
+ },
29544
+ {
29545
+ internalType: "uint256",
29546
+ name: "takeProfitPriceD18",
29547
+ type: "uint256"
29548
+ },
29549
+ {
29550
+ internalType: "address",
29551
+ name: "user",
29552
+ type: "address"
29553
+ },
29554
+ {
29555
+ internalType: "address",
29556
+ name: "pool",
29557
+ type: "address"
29558
+ },
29559
+ {
29560
+ internalType: "address",
29561
+ name: "pricingAsset",
29562
+ type: "address"
29563
+ }
29564
+ ],
29565
+ internalType: "struct IPoolLimitOrderManager.LimitOrderInfo",
29566
+ name: "limitOrderInfo",
29567
+ type: "tuple"
29568
+ }
29569
+ ],
29570
+ name: "modifyLimitOrder",
29571
+ outputs: [
29572
+ ],
29573
+ stateMutability: "nonpayable",
29574
+ type: "function"
29575
+ },
29576
+ {
29577
+ inputs: [
29578
+ {
29579
+ internalType: "address",
29580
+ name: "pool_",
29581
+ type: "address"
29582
+ }
29583
+ ],
29584
+ name: "deleteLimitOrder",
29585
+ outputs: [
29586
+ ],
29587
+ stateMutability: "nonpayable",
29588
+ type: "function"
29589
+ },
29590
+ {
29591
+ inputs: [
29592
+ ],
29593
+ name: "getAllLimitOrderIds",
29594
+ outputs: [
29595
+ {
29596
+ internalType: "bytes32[]",
29597
+ name: "",
29598
+ type: "bytes32[]"
29599
+ }
29600
+ ],
29601
+ stateMutability: "view",
29602
+ type: "function"
29603
+ },
29604
+ {
29605
+ inputs: [
29606
+ {
29607
+ internalType: "bytes32",
29608
+ name: "orderId",
29609
+ type: "bytes32"
29610
+ }
29611
+ ],
29612
+ name: "limitOrders",
29613
+ outputs: [
29614
+ {
29615
+ internalType: "uint256",
29616
+ name: "amount",
29617
+ type: "uint256"
29618
+ },
29619
+ {
29620
+ internalType: "uint256",
29621
+ name: "stopLossPriceD18",
29622
+ type: "uint256"
29623
+ },
29624
+ {
29625
+ internalType: "uint256",
29626
+ name: "takeProfitPriceD18",
29627
+ type: "uint256"
29628
+ },
29629
+ {
29630
+ internalType: "address",
29631
+ name: "user",
29632
+ type: "address"
29633
+ },
29634
+ {
29635
+ internalType: "address",
29636
+ name: "pool",
29637
+ type: "address"
29638
+ },
29639
+ {
29640
+ internalType: "address",
29641
+ name: "pricingAsset",
29642
+ type: "address"
29643
+ }
29644
+ ],
29645
+ stateMutability: "view",
29646
+ type: "function"
29647
+ }
29648
+ ];
29649
+
29650
+ var iface = /*#__PURE__*/new ethers.utils.Interface(IPoolLimitOrderManager);
29651
+ function getLimitOrderId(userAddress, vaultAddress) {
29652
+ return ethers.utils.solidityKeccak256(["address", "address"], [userAddress, vaultAddress]);
29653
+ }
29654
+ function getCreateLimitOrderTxData(info) {
29655
+ return iface.encodeFunctionData("createLimitOrder", [[info.amount, info.stopLossPriceD18, info.takeProfitPriceD18, info.user, info.pool, info.pricingAsset]]);
29656
+ }
29657
+ function getModifyLimitOrderTxData(info) {
29658
+ return iface.encodeFunctionData("modifyLimitOrder", [[info.amount, info.stopLossPriceD18, info.takeProfitPriceD18, info.user, info.pool, info.pricingAsset]]);
29659
+ }
29660
+ function getDeleteLimitOrderTxData(vaultAddress) {
29661
+ return iface.encodeFunctionData("deleteLimitOrder", [vaultAddress]);
29662
+ }
29663
+ function getTorosLimitOrder(_x, _x2, _x3) {
29664
+ return _getTorosLimitOrder.apply(this, arguments);
29665
+ }
29666
+
29667
+ function _getTorosLimitOrder() {
29668
+ _getTorosLimitOrder = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, userAddress, vaultAddress) {
29669
+ var managerAddress, orderId, contract, result;
29670
+ return runtime_1.wrap(function _callee$(_context) {
29671
+ while (1) {
29672
+ switch (_context.prev = _context.next) {
29673
+ case 0:
29674
+ managerAddress = limitOrderAddress[pool.network];
29675
+
29676
+ if (managerAddress) {
29677
+ _context.next = 3;
29678
+ break;
29679
+ }
29680
+
29681
+ return _context.abrupt("return", null);
29682
+
29683
+ case 3:
29684
+ orderId = getLimitOrderId(userAddress, vaultAddress);
29685
+ contract = new ethers.Contract(managerAddress, IPoolLimitOrderManager, pool.signer);
29686
+ _context.next = 7;
29687
+ return contract.limitOrders(orderId);
29688
+
29689
+ case 7:
29690
+ result = _context.sent;
29691
+
29692
+ if (!result.amount.isZero()) {
29693
+ _context.next = 10;
29694
+ break;
29695
+ }
29696
+
29697
+ return _context.abrupt("return", null);
29698
+
29699
+ case 10:
29700
+ return _context.abrupt("return", {
29701
+ amount: result.amount,
29702
+ stopLossPriceD18: result.stopLossPriceD18,
29703
+ takeProfitPriceD18: result.takeProfitPriceD18,
29704
+ user: result.user,
29705
+ pool: result.pool,
29706
+ pricingAsset: result.pricingAsset
29707
+ });
29708
+
29709
+ case 11:
29710
+ case "end":
29711
+ return _context.stop();
29712
+ }
29713
+ }
29714
+ }, _callee);
29715
+ }));
29716
+ return _getTorosLimitOrder.apply(this, arguments);
29717
+ }
29718
+
29719
+ function hasActiveTorosLimitOrder(_x4, _x5, _x6) {
29720
+ return _hasActiveTorosLimitOrder.apply(this, arguments);
29721
+ }
29722
+
29723
+ function _hasActiveTorosLimitOrder() {
29724
+ _hasActiveTorosLimitOrder = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool, userAddress, vaultAddress) {
29725
+ var order;
29726
+ return runtime_1.wrap(function _callee2$(_context2) {
29727
+ while (1) {
29728
+ switch (_context2.prev = _context2.next) {
29729
+ case 0:
29730
+ _context2.next = 2;
29731
+ return getTorosLimitOrder(pool, userAddress, vaultAddress);
29732
+
29733
+ case 2:
29734
+ order = _context2.sent;
29735
+ return _context2.abrupt("return", order !== null);
29736
+
29737
+ case 4:
29738
+ case "end":
29739
+ return _context2.stop();
29740
+ }
29741
+ }
29742
+ }, _callee2);
29743
+ }));
29744
+ return _hasActiveTorosLimitOrder.apply(this, arguments);
29745
+ }
29746
+
29480
29747
  var kyberBaseUrl = "https://aggregator-api.kyberswap.com";
29481
29748
  function getKyberSwapTxData(_x, _x2, _x3, _x4, _x5) {
29482
29749
  return _getKyberSwapTxData.apply(this, arguments);
@@ -29542,6 +29809,574 @@ function _getKyberSwapTxData() {
29542
29809
  return _getKyberSwapTxData.apply(this, arguments);
29543
29810
  }
29544
29811
 
29812
+ var ICoreDepositWalletAbi = [
29813
+ {
29814
+ inputs: [
29815
+ {
29816
+ internalType: "address",
29817
+ name: "from",
29818
+ type: "address"
29819
+ },
29820
+ {
29821
+ internalType: "bytes32",
29822
+ name: "destinationRecipient",
29823
+ type: "bytes32"
29824
+ },
29825
+ {
29826
+ internalType: "uint32",
29827
+ name: "destinationChainId",
29828
+ type: "uint32"
29829
+ },
29830
+ {
29831
+ internalType: "uint256",
29832
+ name: "amount",
29833
+ type: "uint256"
29834
+ },
29835
+ {
29836
+ internalType: "uint64",
29837
+ name: "coreNonce",
29838
+ type: "uint64"
29839
+ },
29840
+ {
29841
+ internalType: "bytes",
29842
+ name: "data",
29843
+ type: "bytes"
29844
+ }
29845
+ ],
29846
+ name: "coreReceiveWithData",
29847
+ outputs: [
29848
+ ],
29849
+ stateMutability: "nonpayable",
29850
+ type: "function"
29851
+ },
29852
+ {
29853
+ inputs: [
29854
+ {
29855
+ internalType: "uint256",
29856
+ name: "amount",
29857
+ type: "uint256"
29858
+ },
29859
+ {
29860
+ internalType: "uint32",
29861
+ name: "destinationDex",
29862
+ type: "uint32"
29863
+ }
29864
+ ],
29865
+ name: "deposit",
29866
+ outputs: [
29867
+ ],
29868
+ stateMutability: "nonpayable",
29869
+ type: "function"
29870
+ },
29871
+ {
29872
+ inputs: [
29873
+ {
29874
+ internalType: "uint256",
29875
+ name: "amount",
29876
+ type: "uint256"
29877
+ },
29878
+ {
29879
+ internalType: "uint256",
29880
+ name: "authValidAfter",
29881
+ type: "uint256"
29882
+ },
29883
+ {
29884
+ internalType: "uint256",
29885
+ name: "authValidBefore",
29886
+ type: "uint256"
29887
+ },
29888
+ {
29889
+ internalType: "bytes32",
29890
+ name: "authNonce",
29891
+ type: "bytes32"
29892
+ },
29893
+ {
29894
+ internalType: "uint8",
29895
+ name: "v",
29896
+ type: "uint8"
29897
+ },
29898
+ {
29899
+ internalType: "bytes32",
29900
+ name: "r",
29901
+ type: "bytes32"
29902
+ },
29903
+ {
29904
+ internalType: "bytes32",
29905
+ name: "s",
29906
+ type: "bytes32"
29907
+ },
29908
+ {
29909
+ internalType: "uint32",
29910
+ name: "destinationDex",
29911
+ type: "uint32"
29912
+ }
29913
+ ],
29914
+ name: "depositWithAuth",
29915
+ outputs: [
29916
+ ],
29917
+ stateMutability: "nonpayable",
29918
+ type: "function"
29919
+ },
29920
+ {
29921
+ inputs: [
29922
+ {
29923
+ internalType: "address",
29924
+ name: "to",
29925
+ type: "address"
29926
+ },
29927
+ {
29928
+ internalType: "uint256",
29929
+ name: "amount",
29930
+ type: "uint256"
29931
+ }
29932
+ ],
29933
+ name: "transfer",
29934
+ outputs: [
29935
+ {
29936
+ internalType: "bool",
29937
+ name: "success",
29938
+ type: "bool"
29939
+ }
29940
+ ],
29941
+ stateMutability: "nonpayable",
29942
+ type: "function"
29943
+ }
29944
+ ];
29945
+
29946
+ var ICoreWriterAbi = [
29947
+ {
29948
+ anonymous: false,
29949
+ inputs: [
29950
+ {
29951
+ indexed: true,
29952
+ internalType: "address",
29953
+ name: "user",
29954
+ type: "address"
29955
+ },
29956
+ {
29957
+ indexed: false,
29958
+ internalType: "bytes",
29959
+ name: "data",
29960
+ type: "bytes"
29961
+ }
29962
+ ],
29963
+ name: "RawAction",
29964
+ type: "event"
29965
+ },
29966
+ {
29967
+ inputs: [
29968
+ {
29969
+ internalType: "bytes",
29970
+ name: "data",
29971
+ type: "bytes"
29972
+ }
29973
+ ],
29974
+ name: "sendRawAction",
29975
+ outputs: [
29976
+ ],
29977
+ stateMutability: "nonpayable",
29978
+ type: "function"
29979
+ }
29980
+ ];
29981
+
29982
+ var USDC_TOKEN_ID = 0;
29983
+ var USDC_CORE_ADDRESS = "0x2000000000000000000000000000000000000000";
29984
+ var CORE_WRITER_ADDRESS = "0x3333333333333333333333333333333333333333";
29985
+ var SPOT_DEX_ID = 4294967295; // max uint32;
29986
+
29987
+ var HYPERLIQUID_VERSION = 1; //Action IDs
29988
+
29989
+ var SPOT_SEND_ACTION = 6;
29990
+ var SEND_ASSET_ACTION = 13;
29991
+ var LIMIT_ORDER_ACTION = 1; //Order Time In Force options
29992
+ var LIMIT_ORDER_TIF_IOC = 3;
29993
+ var dexIdNameMap = {
29994
+ 0: "",
29995
+ 1: "xyz"
29996
+ };
29997
+ var API_URL = "https://api.hyperliquid.xyz/info";
29998
+
29999
+ var perpDexIndex = function perpDexIndex(assetId) {
30000
+ return Math.max(Math.floor((assetId - 100000) / 10000), 0);
30001
+ };
30002
+
30003
+ var assetIndex = function assetIndex(assetId) {
30004
+ if (assetId > 100000) {
30005
+ //builder-deployed perps
30006
+ return (assetId - 100000) % 10000;
30007
+ } else return assetId;
30008
+ };
30009
+
30010
+ var spotAssetIndex = function spotAssetIndex(assetId) {
30011
+ return assetId - 10000;
30012
+ };
30013
+ var isSpotAsset = function isSpotAsset(assetId) {
30014
+ return assetId > 10000 && assetId < 100000;
30015
+ };
30016
+ var getMidPrice = /*#__PURE__*/function () {
30017
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(assetId, assetName) {
30018
+ var response, raw, price;
30019
+ return runtime_1.wrap(function _callee$(_context) {
30020
+ while (1) {
30021
+ switch (_context.prev = _context.next) {
30022
+ case 0:
30023
+ _context.next = 2;
30024
+ return axios.post(API_URL, {
30025
+ type: "allMids",
30026
+ dex: dexIdNameMap[perpDexIndex(assetId)]
30027
+ });
30028
+
30029
+ case 2:
30030
+ response = _context.sent;
30031
+ raw = response.data[assetName];
30032
+
30033
+ if (!(raw === undefined || raw === null)) {
30034
+ _context.next = 6;
30035
+ break;
30036
+ }
30037
+
30038
+ throw new ApiError("Hyperliquid allMids response missing price for asset \"" + assetName + "\"");
30039
+
30040
+ case 6:
30041
+ price = +raw;
30042
+
30043
+ if (!isNaN(price)) {
30044
+ _context.next = 9;
30045
+ break;
30046
+ }
30047
+
30048
+ throw new ApiError("Hyperliquid allMids returned non-numeric price for asset \"" + assetName + "\": " + raw);
30049
+
30050
+ case 9:
30051
+ return _context.abrupt("return", price);
30052
+
30053
+ case 10:
30054
+ case "end":
30055
+ return _context.stop();
30056
+ }
30057
+ }
30058
+ }, _callee);
30059
+ }));
30060
+
30061
+ return function getMidPrice(_x, _x2) {
30062
+ return _ref.apply(this, arguments);
30063
+ };
30064
+ }();
30065
+ var getAssetInfo = /*#__PURE__*/function () {
30066
+ var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(assetId) {
30067
+ var response, asset, baseToken, dex, _response, meta, assets, index, _asset;
30068
+
30069
+ return runtime_1.wrap(function _callee2$(_context2) {
30070
+ while (1) {
30071
+ switch (_context2.prev = _context2.next) {
30072
+ case 0:
30073
+ if (!isSpotAsset(assetId)) {
30074
+ _context2.next = 11;
30075
+ break;
30076
+ }
30077
+
30078
+ _context2.next = 3;
30079
+ return axios.post(API_URL, {
30080
+ type: "spotMeta"
30081
+ });
30082
+
30083
+ case 3:
30084
+ response = _context2.sent;
30085
+ asset = response.data.universe.find(function (e) {
30086
+ return e.index === spotAssetIndex(assetId);
30087
+ });
30088
+
30089
+ if (asset) {
30090
+ _context2.next = 7;
30091
+ break;
30092
+ }
30093
+
30094
+ throw new ApiError("Hyperliquid spotMeta response contains no asset for assetId " + assetId + " (index " + spotAssetIndex(assetId) + ")");
30095
+
30096
+ case 7:
30097
+ baseToken = response.data.tokens[asset.tokens[0]];
30098
+ return _context2.abrupt("return", {
30099
+ assetName: asset.name,
30100
+ szDecimals: baseToken.szDecimals,
30101
+ baseTokenName: baseToken.name
30102
+ });
30103
+
30104
+ case 11:
30105
+ dex = dexIdNameMap[perpDexIndex(assetId)];
30106
+ _context2.next = 14;
30107
+ return axios.post(API_URL, {
30108
+ type: "metaAndAssetCtxs",
30109
+ dex: dex
30110
+ });
30111
+
30112
+ case 14:
30113
+ _response = _context2.sent;
30114
+
30115
+ if (!(!Array.isArray(_response.data) || _response.data.length === 0)) {
30116
+ _context2.next = 17;
30117
+ break;
30118
+ }
30119
+
30120
+ throw new ApiError("Hyperliquid metaAndAssetCtxs response has invalid data for assetId " + assetId + " (dex " + String(dex) + ")");
30121
+
30122
+ case 17:
30123
+ meta = _response.data[0];
30124
+
30125
+ if (!(!meta || !Array.isArray(meta.universe))) {
30126
+ _context2.next = 20;
30127
+ break;
30128
+ }
30129
+
30130
+ throw new ApiError("Hyperliquid metaAndAssetCtxs response contains no universe for assetId " + assetId + " (dex " + String(dex) + ")");
30131
+
30132
+ case 20:
30133
+ assets = meta.universe;
30134
+ index = assetIndex(assetId);
30135
+
30136
+ if (!(index < 0 || index >= assets.length)) {
30137
+ _context2.next = 24;
30138
+ break;
30139
+ }
30140
+
30141
+ throw new ApiError("Hyperliquid metaAndAssetCtxs response contains no asset for assetId " + assetId + " (dex " + String(dex) + ", index " + index + ", universe length " + assets.length + ")");
30142
+
30143
+ case 24:
30144
+ _asset = assets[index];
30145
+ return _context2.abrupt("return", {
30146
+ assetName: _asset.name,
30147
+ szDecimals: _asset.szDecimals
30148
+ });
30149
+
30150
+ case 26:
30151
+ case "end":
30152
+ return _context2.stop();
30153
+ }
30154
+ }
30155
+ }, _callee2);
30156
+ }));
30157
+
30158
+ return function getAssetInfo(_x3) {
30159
+ return _ref2.apply(this, arguments);
30160
+ };
30161
+ }();
30162
+ var calculatePrice = function calculatePrice(isSpotAsset, szDecimals, midPrice, isBuy, slippage) {
30163
+ // 1. Apply slippage
30164
+ var price = midPrice * (isBuy ? 1 + slippage / 100 : 1 - slippage / 100); // 2. Round to 5 significant figures
30165
+
30166
+ var roundedSignificant = parseFloat(price.toPrecision(5)); // 3. For perp base decimals = 6
30167
+
30168
+ var baseDecimals = isSpotAsset ? 8 : 6;
30169
+ var finalDecimals = baseDecimals - szDecimals;
30170
+ var factor = Math.pow(10, finalDecimals);
30171
+ var roundedDecimals = Math.round(roundedSignificant * factor) / factor;
30172
+ return new BigNumber$2(roundedDecimals).times(1e8).toFixed(0);
30173
+ };
30174
+ var calculateSize = function calculateSize(szDecimals, value, price) {
30175
+ var factor = Math.pow(10, szDecimals);
30176
+ return new BigNumber$2(Math.round(value / price * factor) / factor).times(1e8).toFixed(0);
30177
+ };
30178
+ var scaleSize = function scaleSize(szDecimals, positionSize, percentageToClose) {
30179
+ var factor = Math.pow(10, szDecimals);
30180
+ return new BigNumber$2(Math.round(positionSize * percentageToClose / 100 * factor) / factor).times(1e8).abs().toFixed(0);
30181
+ };
30182
+
30183
+ var getPositionSize = /*#__PURE__*/function () {
30184
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(assetId, isSpot, assetName, user) {
30185
+ var response, balance, _response, position;
30186
+
30187
+ return runtime_1.wrap(function _callee$(_context) {
30188
+ while (1) {
30189
+ switch (_context.prev = _context.next) {
30190
+ case 0:
30191
+ if (!isSpot) {
30192
+ _context.next = 10;
30193
+ break;
30194
+ }
30195
+
30196
+ _context.next = 3;
30197
+ return axios.post(API_URL, {
30198
+ type: "spotClearinghouseState",
30199
+ user: user
30200
+ });
30201
+
30202
+ case 3:
30203
+ response = _context.sent;
30204
+ balance = response.data.balances.find(function (e) {
30205
+ return e.coin === assetName;
30206
+ });
30207
+
30208
+ if (balance) {
30209
+ _context.next = 7;
30210
+ break;
30211
+ }
30212
+
30213
+ throw new Error("No balance found for asset " + assetName);
30214
+
30215
+ case 7:
30216
+ return _context.abrupt("return", +balance.total);
30217
+
30218
+ case 10:
30219
+ _context.next = 12;
30220
+ return axios.post(API_URL, {
30221
+ type: "clearinghouseState",
30222
+ user: user,
30223
+ dex: dexIdNameMap[perpDexIndex(assetId)]
30224
+ });
30225
+
30226
+ case 12:
30227
+ _response = _context.sent;
30228
+ position = _response.data.assetPositions.find(function (e) {
30229
+ return e.position.coin === assetName;
30230
+ });
30231
+
30232
+ if (position) {
30233
+ _context.next = 16;
30234
+ break;
30235
+ }
30236
+
30237
+ throw new Error("No position found for asset " + assetName);
30238
+
30239
+ case 16:
30240
+ return _context.abrupt("return", +position.position.szi);
30241
+
30242
+ case 17:
30243
+ case "end":
30244
+ return _context.stop();
30245
+ }
30246
+ }
30247
+ }, _callee);
30248
+ }));
30249
+
30250
+ return function getPositionSize(_x, _x2, _x3, _x4) {
30251
+ return _ref.apply(this, arguments);
30252
+ };
30253
+ }();
30254
+
30255
+ var depositWallet = /*#__PURE__*/new ethers.utils.Interface(ICoreDepositWalletAbi);
30256
+ var coreWriter = /*#__PURE__*/new ethers.utils.Interface(ICoreWriterAbi);
30257
+ var getDepositHyperliquidTxData = function getDepositHyperliquidTxData(dexId, amount) {
30258
+ return depositWallet.encodeFunctionData("deposit", [amount, dexId]);
30259
+ };
30260
+ var getWithdrawSpotHyperliquidTxData = function getWithdrawSpotHyperliquidTxData(amount) {
30261
+ var coreAmount = ethers.BigNumber.from(amount).mul(100); //USDC on Core has two more decimals
30262
+ //Hardcoded to USDC address and id on Hyperliquid Core
30263
+ //From Spot to EVM
30264
+
30265
+ var innerEncoded = ethers.utils.defaultAbiCoder.encode( //to, token, amount
30266
+ ["address", "uint64", "uint64"], [USDC_CORE_ADDRESS, USDC_TOKEN_ID, coreAmount]);
30267
+ var rawTXData = ethers.utils.solidityPack(["uint8", "uint24", "bytes"], [HYPERLIQUID_VERSION, SPOT_SEND_ACTION, innerEncoded]);
30268
+ return coreWriter.encodeFunctionData("sendRawAction", [rawTXData]);
30269
+ };
30270
+ var getPerpToSpotHyperliquidTxData = function getPerpToSpotHyperliquidTxData(dexId, receiver, amount) {
30271
+ var coreAmount = ethers.BigNumber.from(amount).mul(100); //USDC on Core has two more decimals
30272
+ //From Perp to Spot
30273
+
30274
+ var innerEncoded = ethers.utils.defaultAbiCoder.encode( //destination, subAccount, sourceDex, destinationDex, token, amount
30275
+ ["address", "address", "uint32", "uint32", "uint64", "uint64"], [receiver, ethers.constants.AddressZero, dexId, SPOT_DEX_ID, USDC_TOKEN_ID, coreAmount]);
30276
+ var rawTXData = ethers.utils.solidityPack(["uint8", "uint24", "bytes"], [HYPERLIQUID_VERSION, SEND_ASSET_ACTION, innerEncoded]);
30277
+ return coreWriter.encodeFunctionData("sendRawAction", [rawTXData]);
30278
+ };
30279
+ var getLimitOrderHyperliquidTxData = /*#__PURE__*/function () {
30280
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(assetId, isLong, changeAmount, slippage) {
30281
+ var isBuy, reduceOnly, _yield$getAssetInfo, assetName, szDecimals, midPrice, price, size, innerEncoded, rawTXData;
30282
+
30283
+ return runtime_1.wrap(function _callee$(_context) {
30284
+ while (1) {
30285
+ switch (_context.prev = _context.next) {
30286
+ case 0:
30287
+ isBuy = isLong;
30288
+ reduceOnly = false;
30289
+
30290
+ if (changeAmount < 0) {
30291
+ changeAmount = changeAmount * -1;
30292
+ isBuy = !isLong;
30293
+ reduceOnly = !isSpotAsset(assetId);
30294
+ } //Calculate price with slippage
30295
+
30296
+
30297
+ _context.next = 5;
30298
+ return getAssetInfo(assetId);
30299
+
30300
+ case 5:
30301
+ _yield$getAssetInfo = _context.sent;
30302
+ assetName = _yield$getAssetInfo.assetName;
30303
+ szDecimals = _yield$getAssetInfo.szDecimals;
30304
+ _context.next = 10;
30305
+ return getMidPrice(assetId, assetName);
30306
+
30307
+ case 10:
30308
+ midPrice = _context.sent;
30309
+ price = calculatePrice(isSpotAsset(assetId), szDecimals, midPrice, isBuy, slippage);
30310
+ size = calculateSize(szDecimals, changeAmount, midPrice);
30311
+ innerEncoded = ethers.utils.defaultAbiCoder.encode( //assetIndex, isBuy, price, size, reduceOnly, tif, clientOrderId
30312
+ ["uint32", "bool", "uint64", "uint64", "bool", "uint8", "uint128"], [assetId, isBuy, price, size, reduceOnly, LIMIT_ORDER_TIF_IOC, ethers.BigNumber.from(0) //client order id
30313
+ ]);
30314
+ rawTXData = ethers.utils.solidityPack(["uint8", "uint24", "bytes"], [HYPERLIQUID_VERSION, LIMIT_ORDER_ACTION, innerEncoded]);
30315
+ return _context.abrupt("return", coreWriter.encodeFunctionData("sendRawAction", [rawTXData]));
30316
+
30317
+ case 16:
30318
+ case "end":
30319
+ return _context.stop();
30320
+ }
30321
+ }
30322
+ }, _callee);
30323
+ }));
30324
+
30325
+ return function getLimitOrderHyperliquidTxData(_x, _x2, _x3, _x4) {
30326
+ return _ref.apply(this, arguments);
30327
+ };
30328
+ }();
30329
+ var getClosePositionHyperliquidTxData = /*#__PURE__*/function () {
30330
+ var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(assetId, percentageToClose, slippage, poolAddress) {
30331
+ var isSpot, _yield$getAssetInfo2, assetName, szDecimals, baseTokenName, positionSize, isBuy, sizeRaw, midPrice, price, innerEncoded, rawTXData;
30332
+
30333
+ return runtime_1.wrap(function _callee2$(_context2) {
30334
+ while (1) {
30335
+ switch (_context2.prev = _context2.next) {
30336
+ case 0:
30337
+ isSpot = isSpotAsset(assetId);
30338
+ _context2.next = 3;
30339
+ return getAssetInfo(assetId);
30340
+
30341
+ case 3:
30342
+ _yield$getAssetInfo2 = _context2.sent;
30343
+ assetName = _yield$getAssetInfo2.assetName;
30344
+ szDecimals = _yield$getAssetInfo2.szDecimals;
30345
+ baseTokenName = _yield$getAssetInfo2.baseTokenName;
30346
+ _context2.next = 9;
30347
+ return getPositionSize(assetId, isSpot, baseTokenName != null ? baseTokenName : assetName, poolAddress);
30348
+
30349
+ case 9:
30350
+ positionSize = _context2.sent;
30351
+ isBuy = positionSize < 0; // if position size is negative, we need to buy to close, otherwise sell
30352
+
30353
+ sizeRaw = scaleSize(szDecimals, positionSize, percentageToClose); //Calculate price with slippage
30354
+
30355
+ _context2.next = 14;
30356
+ return getMidPrice(assetId, assetName);
30357
+
30358
+ case 14:
30359
+ midPrice = _context2.sent;
30360
+ price = calculatePrice(isSpotAsset(assetId), szDecimals, midPrice, isBuy, slippage);
30361
+ innerEncoded = ethers.utils.defaultAbiCoder.encode( //assetIndex, isBuy, price, size, reduceOnly, tif, clientOrderId
30362
+ ["uint32", "bool", "uint64", "uint64", "bool", "uint8", "uint128"], [assetId, positionSize < 0, price, sizeRaw, !isSpot, LIMIT_ORDER_TIF_IOC, ethers.BigNumber.from(0) //client order id
30363
+ ]);
30364
+ rawTXData = ethers.utils.solidityPack(["uint8", "uint24", "bytes"], [HYPERLIQUID_VERSION, LIMIT_ORDER_ACTION, innerEncoded]);
30365
+ return _context2.abrupt("return", coreWriter.encodeFunctionData("sendRawAction", [rawTXData]));
30366
+
30367
+ case 19:
30368
+ case "end":
30369
+ return _context2.stop();
30370
+ }
30371
+ }
30372
+ }, _callee2);
30373
+ }));
30374
+
30375
+ return function getClosePositionHyperliquidTxData(_x5, _x6, _x7, _x8) {
30376
+ return _ref2.apply(this, arguments);
30377
+ };
30378
+ }();
30379
+
29545
30380
  var Pool = /*#__PURE__*/function () {
29546
30381
  function Pool(network, signer, poolLogic, mangerLogic, utils, factory, isDhedge) {
29547
30382
  if (isDhedge === void 0) {
@@ -33139,6 +33974,608 @@ var Pool = /*#__PURE__*/function () {
33139
33974
  }
33140
33975
 
33141
33976
  return mintPendle;
33977
+ }()
33978
+ /** Deposit USDC from EVM to a HyperCore trading dex via the CoreDepositWallet.
33979
+ * This bridges USDC on-chain to Hyperliquid for perp/spot trading.
33980
+ *
33981
+ * @param {BigNumber | string} amount USDC amount to deposit (6 decimals, e.g. "1000000" = 1 USDC)
33982
+ * @param {number} dexId Destination dex ID where USDC will be available (default 0)
33983
+ * - 0: Core Perp dex (standard perps like BTC, ETH)
33984
+ * - 1: xyz HIP-3 dex (builder perps like TSLA, GOLD)
33985
+ * @param {any} options Transaction options
33986
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
33987
+ * @returns {Promise<any>} Transaction
33988
+ */
33989
+ ;
33990
+
33991
+ _proto.depositHyperliquid =
33992
+ /*#__PURE__*/
33993
+ function () {
33994
+ var _depositHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee59(amount, dexId, options, sdkOptions) {
33995
+ var tx;
33996
+ return runtime_1.wrap(function _callee59$(_context59) {
33997
+ while (1) {
33998
+ switch (_context59.prev = _context59.next) {
33999
+ case 0:
34000
+ if (dexId === void 0) {
34001
+ dexId = 0;
34002
+ }
34003
+
34004
+ if (options === void 0) {
34005
+ options = null;
34006
+ }
34007
+
34008
+ if (sdkOptions === void 0) {
34009
+ sdkOptions = {
34010
+ estimateGas: false
34011
+ };
34012
+ }
34013
+
34014
+ _context59.next = 5;
34015
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][Dapp.HYPERLIQUID], getDepositHyperliquidTxData(dexId, amount), options], sdkOptions);
34016
+
34017
+ case 5:
34018
+ tx = _context59.sent;
34019
+ return _context59.abrupt("return", tx);
34020
+
34021
+ case 7:
34022
+ case "end":
34023
+ return _context59.stop();
34024
+ }
34025
+ }
34026
+ }, _callee59, this);
34027
+ }));
34028
+
34029
+ function depositHyperliquid(_x279, _x280, _x281, _x282) {
34030
+ return _depositHyperliquid.apply(this, arguments);
34031
+ }
34032
+
34033
+ return depositHyperliquid;
34034
+ }()
34035
+ /** Move USDC from a HyperCore trading dex to the Spot wallet.
34036
+ * Required before calling withdrawHyperliquid() to bridge USDC back to EVM.
34037
+ *
34038
+ * @param {number} dexId Source dex ID where USDC currently sits
34039
+ * - 0: Core Perp dex (standard perps like BTC, ETH)
34040
+ * - 1: xyz HIP-3 dex (builder perps like TSLA, GOLD)
34041
+ * @param {BigNumber | string} amount USDC amount to transfer (6 decimals, e.g. "1000000" = 1 USDC)
34042
+ * @param {any} options Transaction options
34043
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
34044
+ * @returns {Promise<any>} Transaction
34045
+ */
34046
+ ;
34047
+
34048
+ _proto.perpToSpotHyperliquid =
34049
+ /*#__PURE__*/
34050
+ function () {
34051
+ var _perpToSpotHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee60(dexId, amount, options, sdkOptions) {
34052
+ var tx;
34053
+ return runtime_1.wrap(function _callee60$(_context60) {
34054
+ while (1) {
34055
+ switch (_context60.prev = _context60.next) {
34056
+ case 0:
34057
+ if (options === void 0) {
34058
+ options = null;
34059
+ }
34060
+
34061
+ if (sdkOptions === void 0) {
34062
+ sdkOptions = {
34063
+ estimateGas: false
34064
+ };
34065
+ }
34066
+
34067
+ _context60.next = 4;
34068
+ return getPoolTxOrGasEstimate(this, [CORE_WRITER_ADDRESS, getPerpToSpotHyperliquidTxData(dexId, this.address, amount), options], sdkOptions);
34069
+
34070
+ case 4:
34071
+ tx = _context60.sent;
34072
+ return _context60.abrupt("return", tx);
34073
+
34074
+ case 6:
34075
+ case "end":
34076
+ return _context60.stop();
34077
+ }
34078
+ }
34079
+ }, _callee60, this);
34080
+ }));
34081
+
34082
+ function perpToSpotHyperliquid(_x283, _x284, _x285, _x286) {
34083
+ return _perpToSpotHyperliquid.apply(this, arguments);
34084
+ }
34085
+
34086
+ return perpToSpotHyperliquid;
34087
+ }()
34088
+ /** Withdraw USDC from Hyperliquid Spot wallet back to EVM.
34089
+ * USDC must be in the Spot wallet first — use perpToSpotHyperliquid() to move it from a trading dex.
34090
+ *
34091
+ * @param {BigNumber | string} amount USDC amount to withdraw (6 decimals, e.g. "1000000" = 1 USDC)
34092
+ * @param {any} options Transaction options
34093
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
34094
+ * @returns {Promise<any>} Transaction
34095
+ */
34096
+ ;
34097
+
34098
+ _proto.withdrawHyperliquid =
34099
+ /*#__PURE__*/
34100
+ function () {
34101
+ var _withdrawHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee61(amount, options, sdkOptions) {
34102
+ var tx;
34103
+ return runtime_1.wrap(function _callee61$(_context61) {
34104
+ while (1) {
34105
+ switch (_context61.prev = _context61.next) {
34106
+ case 0:
34107
+ if (options === void 0) {
34108
+ options = null;
34109
+ }
34110
+
34111
+ if (sdkOptions === void 0) {
34112
+ sdkOptions = {
34113
+ estimateGas: false
34114
+ };
34115
+ }
34116
+
34117
+ _context61.next = 4;
34118
+ return getPoolTxOrGasEstimate(this, [CORE_WRITER_ADDRESS, getWithdrawSpotHyperliquidTxData(amount), options], sdkOptions);
34119
+
34120
+ case 4:
34121
+ tx = _context61.sent;
34122
+ return _context61.abrupt("return", tx);
34123
+
34124
+ case 6:
34125
+ case "end":
34126
+ return _context61.stop();
34127
+ }
34128
+ }
34129
+ }, _callee61, this);
34130
+ }));
34131
+
34132
+ function withdrawHyperliquid(_x287, _x288, _x289) {
34133
+ return _withdrawHyperliquid.apply(this, arguments);
34134
+ }
34135
+
34136
+ return withdrawHyperliquid;
34137
+ }()
34138
+ /** Open a market order on Hyperliquid
34139
+ * @param {number} assetId Asset id
34140
+ * @param {boolean} isLong Long or short (Note: Spot assets only support long positions)
34141
+ * @param {number} value Order value in base asset units (positive for opening/increasing,
34142
+ * negative for closing/reducing or selling spot)
34143
+ * @param {number } slippage Slippage tolerance in %
34144
+ * @param {any} options Transaction options
34145
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
34146
+ * @returns {Promise<any>} Transaction
34147
+ */
34148
+ ;
34149
+
34150
+ _proto.openMarketOrderHyperliquid =
34151
+ /*#__PURE__*/
34152
+ function () {
34153
+ var _openMarketOrderHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee62(assetId, isLong, value, slippage, options, sdkOptions) {
34154
+ var tx;
34155
+ return runtime_1.wrap(function _callee62$(_context62) {
34156
+ while (1) {
34157
+ switch (_context62.prev = _context62.next) {
34158
+ case 0:
34159
+ if (slippage === void 0) {
34160
+ slippage = 0.5;
34161
+ }
34162
+
34163
+ if (options === void 0) {
34164
+ options = null;
34165
+ }
34166
+
34167
+ if (sdkOptions === void 0) {
34168
+ sdkOptions = {
34169
+ estimateGas: false
34170
+ };
34171
+ }
34172
+
34173
+ _context62.t0 = getPoolTxOrGasEstimate;
34174
+ _context62.t1 = this;
34175
+ _context62.t2 = CORE_WRITER_ADDRESS;
34176
+ _context62.next = 8;
34177
+ return getLimitOrderHyperliquidTxData(assetId, isLong, value, slippage);
34178
+
34179
+ case 8:
34180
+ _context62.t3 = _context62.sent;
34181
+ _context62.t4 = options;
34182
+ _context62.t5 = [_context62.t2, _context62.t3, _context62.t4];
34183
+ _context62.t6 = sdkOptions;
34184
+ _context62.next = 14;
34185
+ return (0, _context62.t0)(_context62.t1, _context62.t5, _context62.t6);
34186
+
34187
+ case 14:
34188
+ tx = _context62.sent;
34189
+ return _context62.abrupt("return", tx);
34190
+
34191
+ case 16:
34192
+ case "end":
34193
+ return _context62.stop();
34194
+ }
34195
+ }
34196
+ }, _callee62, this);
34197
+ }));
34198
+
34199
+ function openMarketOrderHyperliquid(_x290, _x291, _x292, _x293, _x294, _x295) {
34200
+ return _openMarketOrderHyperliquid.apply(this, arguments);
34201
+ }
34202
+
34203
+ return openMarketOrderHyperliquid;
34204
+ }()
34205
+ /** Close a position on Hyperliquid
34206
+ * @param {number} assetId Asset id
34207
+ * @param {number} percentageToClose Percentage of position to close (0-100)
34208
+ * @param {number } slippage Slippage tolerance in %
34209
+ * @param {any} options Transaction options
34210
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
34211
+ * @returns {Promise<any>} Transaction
34212
+ */
34213
+ ;
34214
+
34215
+ _proto.closePositionHyperliquid =
34216
+ /*#__PURE__*/
34217
+ function () {
34218
+ var _closePositionHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee63(assetId, percentageToClose, slippage, options, sdkOptions) {
34219
+ var tx;
34220
+ return runtime_1.wrap(function _callee63$(_context63) {
34221
+ while (1) {
34222
+ switch (_context63.prev = _context63.next) {
34223
+ case 0:
34224
+ if (percentageToClose === void 0) {
34225
+ percentageToClose = 100;
34226
+ }
34227
+
34228
+ if (slippage === void 0) {
34229
+ slippage = 0.5;
34230
+ }
34231
+
34232
+ if (options === void 0) {
34233
+ options = null;
34234
+ }
34235
+
34236
+ if (sdkOptions === void 0) {
34237
+ sdkOptions = {
34238
+ estimateGas: false
34239
+ };
34240
+ }
34241
+
34242
+ _context63.t0 = getPoolTxOrGasEstimate;
34243
+ _context63.t1 = this;
34244
+ _context63.t2 = CORE_WRITER_ADDRESS;
34245
+ _context63.next = 9;
34246
+ return getClosePositionHyperliquidTxData(assetId, percentageToClose, slippage, this.address);
34247
+
34248
+ case 9:
34249
+ _context63.t3 = _context63.sent;
34250
+ _context63.t4 = options;
34251
+ _context63.t5 = [_context63.t2, _context63.t3, _context63.t4];
34252
+ _context63.t6 = sdkOptions;
34253
+ _context63.next = 15;
34254
+ return (0, _context63.t0)(_context63.t1, _context63.t5, _context63.t6);
34255
+
34256
+ case 15:
34257
+ tx = _context63.sent;
34258
+ return _context63.abrupt("return", tx);
34259
+
34260
+ case 17:
34261
+ case "end":
34262
+ return _context63.stop();
34263
+ }
34264
+ }
34265
+ }, _callee63, this);
34266
+ }));
34267
+
34268
+ function closePositionHyperliquid(_x296, _x297, _x298, _x299, _x300) {
34269
+ return _closePositionHyperliquid.apply(this, arguments);
34270
+ }
34271
+
34272
+ return closePositionHyperliquid;
34273
+ }()
34274
+ /**
34275
+ * Approve the Toros vault token for the PoolLimitOrderManager
34276
+ * Must be called before createTorosLimitOrder
34277
+ * @param {string} vaultAddress Address of the Toros vault token to approve
34278
+ * @param {BigNumber | string} amount Amount to approve
34279
+ * @param {any} options Transaction options
34280
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
34281
+ * @returns {Promise<any>} Transaction
34282
+ */
34283
+ ;
34284
+
34285
+ _proto.approveTorosLimitOrder =
34286
+ /*#__PURE__*/
34287
+ function () {
34288
+ var _approveTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee64(vaultAddress, amount, options, sdkOptions) {
34289
+ var managerAddress, iERC20, approveTxData;
34290
+ return runtime_1.wrap(function _callee64$(_context64) {
34291
+ while (1) {
34292
+ switch (_context64.prev = _context64.next) {
34293
+ case 0:
34294
+ if (options === void 0) {
34295
+ options = null;
34296
+ }
34297
+
34298
+ if (sdkOptions === void 0) {
34299
+ sdkOptions = {
34300
+ estimateGas: false
34301
+ };
34302
+ }
34303
+
34304
+ managerAddress = limitOrderAddress[this.network];
34305
+ iERC20 = new ethers.utils.Interface(IERC20.abi);
34306
+ approveTxData = iERC20.encodeFunctionData("approve", [managerAddress, amount]);
34307
+ return _context64.abrupt("return", getPoolTxOrGasEstimate(this, [vaultAddress, approveTxData, options], sdkOptions));
34308
+
34309
+ case 6:
34310
+ case "end":
34311
+ return _context64.stop();
34312
+ }
34313
+ }
34314
+ }, _callee64, this);
34315
+ }));
34316
+
34317
+ function approveTorosLimitOrder(_x301, _x302, _x303, _x304) {
34318
+ return _approveTorosLimitOrder.apply(this, arguments);
34319
+ }
34320
+
34321
+ return approveTorosLimitOrder;
34322
+ }()
34323
+ /**
34324
+ * Create a Toros limit order (stop-loss / take-profit)
34325
+ * @param {string} vaultAddress Address of the Toros vault token
34326
+ * @param {BigNumber | string} amount Vault token amount (18 decimals)
34327
+ * @param {BigNumber | string | null | undefined} stopLossPriceD18 Stop-loss price in D18 (0 or null/undefined = disabled)
34328
+ * @param {BigNumber | string | null | undefined} takeProfitPriceD18 Take-profit price in D18 (MaxUint256 or null/undefined = disabled)
34329
+ * @param {string} pricingAsset Address of the pricing asset (e.g. USDC)
34330
+ * @param {any} options Transaction options
34331
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
34332
+ * @returns {Promise<any>} Transaction
34333
+ */
34334
+ ;
34335
+
34336
+ _proto.createTorosLimitOrder =
34337
+ /*#__PURE__*/
34338
+ function () {
34339
+ var _createTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee65(vaultAddress, amount, stopLossPriceD18, takeProfitPriceD18, pricingAsset, options, sdkOptions) {
34340
+ var managerAddress, resolvedStopLoss, resolvedTakeProfit, info, txData;
34341
+ return runtime_1.wrap(function _callee65$(_context65) {
34342
+ while (1) {
34343
+ switch (_context65.prev = _context65.next) {
34344
+ case 0:
34345
+ if (options === void 0) {
34346
+ options = null;
34347
+ }
34348
+
34349
+ if (sdkOptions === void 0) {
34350
+ sdkOptions = {
34351
+ estimateGas: false
34352
+ };
34353
+ }
34354
+
34355
+ managerAddress = limitOrderAddress[this.network];
34356
+
34357
+ if (managerAddress) {
34358
+ _context65.next = 5;
34359
+ break;
34360
+ }
34361
+
34362
+ throw new Error("Limit orders not supported on " + this.network);
34363
+
34364
+ case 5:
34365
+ resolvedStopLoss = stopLossPriceD18 == null ? BigNumber$1.from(0) : BigNumber$1.from(stopLossPriceD18);
34366
+ resolvedTakeProfit = takeProfitPriceD18 == null ? ethers.constants.MaxUint256 : BigNumber$1.from(takeProfitPriceD18);
34367
+ info = {
34368
+ amount: BigNumber$1.from(amount),
34369
+ stopLossPriceD18: resolvedStopLoss,
34370
+ takeProfitPriceD18: resolvedTakeProfit,
34371
+ user: this.address,
34372
+ pool: vaultAddress,
34373
+ pricingAsset: pricingAsset
34374
+ };
34375
+ txData = getCreateLimitOrderTxData(info);
34376
+ return _context65.abrupt("return", getPoolTxOrGasEstimate(this, [managerAddress, txData, options], sdkOptions));
34377
+
34378
+ case 10:
34379
+ case "end":
34380
+ return _context65.stop();
34381
+ }
34382
+ }
34383
+ }, _callee65, this);
34384
+ }));
34385
+
34386
+ function createTorosLimitOrder(_x305, _x306, _x307, _x308, _x309, _x310, _x311) {
34387
+ return _createTorosLimitOrder.apply(this, arguments);
34388
+ }
34389
+
34390
+ return createTorosLimitOrder;
34391
+ }()
34392
+ /**
34393
+ * Modify an existing Toros limit order
34394
+ * @param {string} vaultAddress Address of the Toros vault token
34395
+ * @param {BigNumber | string} amount New vault token amount (18 decimals)
34396
+ * @param {BigNumber | string | null | undefined} stopLossPriceD18 New stop-loss price in D18 (0 or null/undefined = disabled)
34397
+ * @param {BigNumber | string | null | undefined} takeProfitPriceD18 New take-profit price in D18 (MaxUint256 or null/undefined = disabled)
34398
+ * @param {string} pricingAsset Address of the pricing asset
34399
+ * @param {any} options Transaction options
34400
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
34401
+ * @returns {Promise<any>} Transaction
34402
+ */
34403
+ ;
34404
+
34405
+ _proto.modifyTorosLimitOrder =
34406
+ /*#__PURE__*/
34407
+ function () {
34408
+ var _modifyTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee66(vaultAddress, amount, stopLossPriceD18, takeProfitPriceD18, pricingAsset, options, sdkOptions) {
34409
+ var managerAddress, resolvedStopLoss, resolvedTakeProfit, info, txData;
34410
+ return runtime_1.wrap(function _callee66$(_context66) {
34411
+ while (1) {
34412
+ switch (_context66.prev = _context66.next) {
34413
+ case 0:
34414
+ if (options === void 0) {
34415
+ options = null;
34416
+ }
34417
+
34418
+ if (sdkOptions === void 0) {
34419
+ sdkOptions = {
34420
+ estimateGas: false
34421
+ };
34422
+ }
34423
+
34424
+ managerAddress = limitOrderAddress[this.network];
34425
+
34426
+ if (managerAddress) {
34427
+ _context66.next = 5;
34428
+ break;
34429
+ }
34430
+
34431
+ throw new Error("Limit orders not supported on " + this.network);
34432
+
34433
+ case 5:
34434
+ resolvedStopLoss = stopLossPriceD18 == null ? BigNumber$1.from(0) : BigNumber$1.from(stopLossPriceD18);
34435
+ resolvedTakeProfit = takeProfitPriceD18 == null ? ethers.constants.MaxUint256 : BigNumber$1.from(takeProfitPriceD18);
34436
+ info = {
34437
+ amount: BigNumber$1.from(amount),
34438
+ stopLossPriceD18: resolvedStopLoss,
34439
+ takeProfitPriceD18: resolvedTakeProfit,
34440
+ user: this.address,
34441
+ pool: vaultAddress,
34442
+ pricingAsset: pricingAsset
34443
+ };
34444
+ txData = getModifyLimitOrderTxData(info);
34445
+ return _context66.abrupt("return", getPoolTxOrGasEstimate(this, [managerAddress, txData, options], sdkOptions));
34446
+
34447
+ case 10:
34448
+ case "end":
34449
+ return _context66.stop();
34450
+ }
34451
+ }
34452
+ }, _callee66, this);
34453
+ }));
34454
+
34455
+ function modifyTorosLimitOrder(_x312, _x313, _x314, _x315, _x316, _x317, _x318) {
34456
+ return _modifyTorosLimitOrder.apply(this, arguments);
34457
+ }
34458
+
34459
+ return modifyTorosLimitOrder;
34460
+ }()
34461
+ /**
34462
+ * Delete an existing Toros limit order
34463
+ * @param {string} vaultAddress Address of the Toros vault token
34464
+ * @param {any} options Transaction options
34465
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
34466
+ * @returns {Promise<any>} Transaction
34467
+ */
34468
+ ;
34469
+
34470
+ _proto.deleteTorosLimitOrder =
34471
+ /*#__PURE__*/
34472
+ function () {
34473
+ var _deleteTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee67(vaultAddress, options, sdkOptions) {
34474
+ var managerAddress, txData;
34475
+ return runtime_1.wrap(function _callee67$(_context67) {
34476
+ while (1) {
34477
+ switch (_context67.prev = _context67.next) {
34478
+ case 0:
34479
+ if (options === void 0) {
34480
+ options = null;
34481
+ }
34482
+
34483
+ if (sdkOptions === void 0) {
34484
+ sdkOptions = {
34485
+ estimateGas: false
34486
+ };
34487
+ }
34488
+
34489
+ managerAddress = limitOrderAddress[this.network];
34490
+
34491
+ if (managerAddress) {
34492
+ _context67.next = 5;
34493
+ break;
34494
+ }
34495
+
34496
+ throw new Error("Limit orders not supported on " + this.network);
34497
+
34498
+ case 5:
34499
+ txData = getDeleteLimitOrderTxData(vaultAddress);
34500
+ return _context67.abrupt("return", getPoolTxOrGasEstimate(this, [managerAddress, txData, options], sdkOptions));
34501
+
34502
+ case 7:
34503
+ case "end":
34504
+ return _context67.stop();
34505
+ }
34506
+ }
34507
+ }, _callee67, this);
34508
+ }));
34509
+
34510
+ function deleteTorosLimitOrder(_x319, _x320, _x321) {
34511
+ return _deleteTorosLimitOrder.apply(this, arguments);
34512
+ }
34513
+
34514
+ return deleteTorosLimitOrder;
34515
+ }()
34516
+ /**
34517
+ * Fetch a Toros limit order for a given user and vault
34518
+ * @param {string} userAddress Address of the order owner (the dHEDGE pool)
34519
+ * @param {string} vaultAddress Address of the Toros vault token
34520
+ * @returns {Promise<LimitOrderInfo | null>} Order info, or null if none exists
34521
+ */
34522
+ ;
34523
+
34524
+ _proto.getTorosLimitOrder =
34525
+ /*#__PURE__*/
34526
+ function () {
34527
+ var _getTorosLimitOrder2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee68(userAddress, vaultAddress) {
34528
+ return runtime_1.wrap(function _callee68$(_context68) {
34529
+ while (1) {
34530
+ switch (_context68.prev = _context68.next) {
34531
+ case 0:
34532
+ return _context68.abrupt("return", getTorosLimitOrder(this, userAddress, vaultAddress));
34533
+
34534
+ case 1:
34535
+ case "end":
34536
+ return _context68.stop();
34537
+ }
34538
+ }
34539
+ }, _callee68, this);
34540
+ }));
34541
+
34542
+ function getTorosLimitOrder$1(_x322, _x323) {
34543
+ return _getTorosLimitOrder2.apply(this, arguments);
34544
+ }
34545
+
34546
+ return getTorosLimitOrder$1;
34547
+ }()
34548
+ /**
34549
+ * Check whether an active Toros limit order exists for a given user and vault
34550
+ * @param {string} userAddress Address of the order owner (the dHEDGE pool)
34551
+ * @param {string} vaultAddress Address of the Toros vault token
34552
+ * @returns {Promise<boolean>}
34553
+ */
34554
+ ;
34555
+
34556
+ _proto.hasActiveTorosLimitOrder =
34557
+ /*#__PURE__*/
34558
+ function () {
34559
+ var _hasActiveTorosLimitOrder2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee69(userAddress, vaultAddress) {
34560
+ return runtime_1.wrap(function _callee69$(_context69) {
34561
+ while (1) {
34562
+ switch (_context69.prev = _context69.next) {
34563
+ case 0:
34564
+ return _context69.abrupt("return", hasActiveTorosLimitOrder(this, userAddress, vaultAddress));
34565
+
34566
+ case 1:
34567
+ case "end":
34568
+ return _context69.stop();
34569
+ }
34570
+ }
34571
+ }, _callee69, this);
34572
+ }));
34573
+
34574
+ function hasActiveTorosLimitOrder$1(_x324, _x325) {
34575
+ return _hasActiveTorosLimitOrder2.apply(this, arguments);
34576
+ }
34577
+
34578
+ return hasActiveTorosLimitOrder$1;
33142
34579
  }();
33143
34580
 
33144
34581
  return Pool;