@dhedge/v2-sdk 2.1.6 → 2.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.d.ts +1 -0
- package/dist/entities/pool.d.ts +11 -0
- package/dist/services/cowSwap/index.d.ts +10 -0
- package/dist/services/hyperliquid/index.d.ts +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/v2-sdk.cjs.development.js +393 -112
- package/dist/v2-sdk.cjs.development.js.map +1 -1
- package/dist/v2-sdk.cjs.production.min.js +1 -1
- package/dist/v2-sdk.cjs.production.min.js.map +1 -1
- package/dist/v2-sdk.esm.js +393 -112
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +6 -1
- package/src/entities/pool.ts +94 -4
- package/src/services/cowSwap/index.ts +281 -0
- package/src/services/hyperliquid/index.ts +8 -6
- package/src/test/constants.ts +1 -1
- package/src/test/cowswap.test.ts +81 -0
- package/src/types.ts +2 -1
package/dist/v2-sdk.esm.js
CHANGED
|
@@ -4339,6 +4339,7 @@ var Dapp;
|
|
|
4339
4339
|
Dapp["PENDLE"] = "pendle";
|
|
4340
4340
|
Dapp["KYBERSWAP"] = "kyberswap";
|
|
4341
4341
|
Dapp["HYPERLIQUID"] = "hyperliquid";
|
|
4342
|
+
Dapp["COWSWAP"] = "cowswap";
|
|
4342
4343
|
})(Dapp || (Dapp = {}));
|
|
4343
4344
|
|
|
4344
4345
|
var Transaction;
|
|
@@ -4365,12 +4366,13 @@ var Transaction;
|
|
|
4365
4366
|
Transaction["REMOVE_LIQUIDITY_UNSTAKE"] = "removeLiquidityAndUnstake";
|
|
4366
4367
|
})(Transaction || (Transaction = {}));
|
|
4367
4368
|
|
|
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;
|
|
4369
|
+
var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _Network$ARBITRUM, _Network$BASE, _Network$ETHEREUM, _Network$PLASMA, _Network$HYPERLIQUID, _routerAddress, _gpv2SettlementAddres, _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;
|
|
4369
4370
|
|
|
4370
4371
|
require("dotenv").config();
|
|
4371
4372
|
|
|
4372
4373
|
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 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[Dapp.COWSWAP] = "0x893223Be4e941fAA8A8DB93D0C097fCac37801ce", _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);
|
|
4375
|
+
var gpv2SettlementAddress = (_gpv2SettlementAddres = {}, _gpv2SettlementAddres[Network.POLYGON] = "0x9008D19f58AAbD9eD0D60971565AA8510560ab41", _gpv2SettlementAddres);
|
|
4374
4376
|
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
4377
|
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
4378
|
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);
|
|
@@ -29809,6 +29811,188 @@ function _getKyberSwapTxData() {
|
|
|
29809
29811
|
return _getKyberSwapTxData.apply(this, arguments);
|
|
29810
29812
|
}
|
|
29811
29813
|
|
|
29814
|
+
var KIND_SELL = /*#__PURE__*/ethers.utils.keccak256( /*#__PURE__*/ethers.utils.toUtf8Bytes("sell"));
|
|
29815
|
+
var KIND_BUY = /*#__PURE__*/ethers.utils.keccak256( /*#__PURE__*/ethers.utils.toUtf8Bytes("buy"));
|
|
29816
|
+
var BALANCE_ERC20 = /*#__PURE__*/ethers.utils.keccak256( /*#__PURE__*/ethers.utils.toUtf8Bytes("erc20")); // Matches CowSwapOrderTypeHashLib.ORDER_TYPE_HASH exactly:
|
|
29817
|
+
// kind/sellTokenBalance/buyTokenBalance are "string" in the type string
|
|
29818
|
+
// but encoded as bytes32 values in abi.encode — must replicate this exactly
|
|
29819
|
+
|
|
29820
|
+
var ORDER_TYPE_HASH = /*#__PURE__*/ethers.utils.keccak256( /*#__PURE__*/ethers.utils.toUtf8Bytes("Order(" + "address sellToken," + "address buyToken," + "address receiver," + "uint256 sellAmount," + "uint256 buyAmount," + "uint32 validTo," + "bytes32 appData," + "uint256 feeAmount," + "string kind," + "bool partiallyFillable," + "string sellTokenBalance," + "string buyTokenBalance" + ")")); // Matches CowSwapOrderTypeHashLib.EIP712_DOMAIN_TYPEHASH
|
|
29821
|
+
|
|
29822
|
+
var EIP712_DOMAIN_TYPEHASH = /*#__PURE__*/ethers.utils.keccak256( /*#__PURE__*/ethers.utils.toUtf8Bytes("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"));
|
|
29823
|
+
var cowSwapApiNetworkMap = {
|
|
29824
|
+
polygon: "polygon"
|
|
29825
|
+
};
|
|
29826
|
+
var GPv2Settlement_ABI = ["function setPreSignature(bytes calldata orderUid, bool signed) external"]; // Replicates CowSwapOrderTypeHashLib.hashOrder
|
|
29827
|
+
|
|
29828
|
+
function hashOrder(order) {
|
|
29829
|
+
return ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(["bytes32", "address", "address", "address", "uint256", "uint256", "uint32", "bytes32", "uint256", "bytes32", "bool", "bytes32", "bytes32"], [ORDER_TYPE_HASH, order.sellToken, order.buyToken, order.receiver, order.sellAmount, order.buyAmount, order.validTo, order.appData, order.feeAmount, order.kind, order.partiallyFillable, order.sellTokenBalance, order.buyTokenBalance]));
|
|
29830
|
+
} // Replicates CowSwapOrderTypeHashLib.domainSeparator
|
|
29831
|
+
|
|
29832
|
+
|
|
29833
|
+
function computeDomainSeparator(name, version, chainId, verifyingContract) {
|
|
29834
|
+
return ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(["bytes32", "bytes32", "bytes32", "uint256", "address"], [EIP712_DOMAIN_TYPEHASH, ethers.utils.keccak256(ethers.utils.toUtf8Bytes(name)), ethers.utils.keccak256(ethers.utils.toUtf8Bytes(version)), chainId, verifyingContract]));
|
|
29835
|
+
} // Replicates CowSwapOrderTypeHashLib.getDigest
|
|
29836
|
+
|
|
29837
|
+
|
|
29838
|
+
function computeOrderDigest(domainSep, orderHash) {
|
|
29839
|
+
return ethers.utils.keccak256(ethers.utils.solidityPack(["bytes2", "bytes32", "bytes32"], ["0x1901", domainSep, orderHash]));
|
|
29840
|
+
}
|
|
29841
|
+
|
|
29842
|
+
function getCowSwapTxData(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
29843
|
+
return _getCowSwapTxData.apply(this, arguments);
|
|
29844
|
+
}
|
|
29845
|
+
|
|
29846
|
+
function _getCowSwapTxData() {
|
|
29847
|
+
_getCowSwapTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, assetFrom, assetTo, amountIn, slippage, kind) {
|
|
29848
|
+
var chainId, network, gpv2Settlement, baseUrl, quoteResponse, quoteResult, _quoteResponse$quote, sellAmount, buyAmount, validTo, buyAmountWithSlippage, orderValues, domainSep, orderHash, orderDigest, orderUid, typedData, encodedTypedData, settlementIface, preSignTxData;
|
|
29849
|
+
|
|
29850
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
29851
|
+
while (1) {
|
|
29852
|
+
switch (_context.prev = _context.next) {
|
|
29853
|
+
case 0:
|
|
29854
|
+
if (kind === void 0) {
|
|
29855
|
+
kind = "sell";
|
|
29856
|
+
}
|
|
29857
|
+
|
|
29858
|
+
chainId = networkChainIdMap[pool.network];
|
|
29859
|
+
network = cowSwapApiNetworkMap[pool.network];
|
|
29860
|
+
|
|
29861
|
+
if (network) {
|
|
29862
|
+
_context.next = 5;
|
|
29863
|
+
break;
|
|
29864
|
+
}
|
|
29865
|
+
|
|
29866
|
+
throw new Error("CowSwap is not supported on network: " + pool.network);
|
|
29867
|
+
|
|
29868
|
+
case 5:
|
|
29869
|
+
gpv2Settlement = gpv2SettlementAddress[pool.network];
|
|
29870
|
+
|
|
29871
|
+
if (gpv2Settlement) {
|
|
29872
|
+
_context.next = 8;
|
|
29873
|
+
break;
|
|
29874
|
+
}
|
|
29875
|
+
|
|
29876
|
+
throw new Error("GPv2Settlement address not configured for network: " + pool.network);
|
|
29877
|
+
|
|
29878
|
+
case 8:
|
|
29879
|
+
baseUrl = "https://api.cow.fi/" + network + "/api/v1"; // 1. Get quote
|
|
29880
|
+
|
|
29881
|
+
_context.prev = 9;
|
|
29882
|
+
_context.next = 12;
|
|
29883
|
+
return axios.post(baseUrl + "/quote", _extends({
|
|
29884
|
+
sellToken: assetFrom,
|
|
29885
|
+
buyToken: assetTo
|
|
29886
|
+
}, kind === "sell" ? {
|
|
29887
|
+
sellAmountBeforeFee: amountIn.toString()
|
|
29888
|
+
} : {
|
|
29889
|
+
buyAmountAfterFee: amountIn.toString()
|
|
29890
|
+
}, {
|
|
29891
|
+
from: pool.address,
|
|
29892
|
+
receiver: pool.address,
|
|
29893
|
+
kind: kind,
|
|
29894
|
+
signingScheme: "presign",
|
|
29895
|
+
partiallyFillable: false,
|
|
29896
|
+
sellTokenBalance: "erc20",
|
|
29897
|
+
buyTokenBalance: "erc20"
|
|
29898
|
+
}));
|
|
29899
|
+
|
|
29900
|
+
case 12:
|
|
29901
|
+
quoteResult = _context.sent;
|
|
29902
|
+
quoteResponse = quoteResult.data;
|
|
29903
|
+
_context.next = 19;
|
|
29904
|
+
break;
|
|
29905
|
+
|
|
29906
|
+
case 16:
|
|
29907
|
+
_context.prev = 16;
|
|
29908
|
+
_context.t0 = _context["catch"](9);
|
|
29909
|
+
throw new ApiError("CowSwap quote request failed");
|
|
29910
|
+
|
|
29911
|
+
case 19:
|
|
29912
|
+
_quoteResponse$quote = quoteResponse.quote, sellAmount = _quoteResponse$quote.sellAmount, buyAmount = _quoteResponse$quote.buyAmount, validTo = _quoteResponse$quote.validTo;
|
|
29913
|
+
buyAmountWithSlippage = ethers.BigNumber.from(new BigNumber(buyAmount.toString()).times(new BigNumber(1).minus(new BigNumber(slippage).div(100))).toFixed(0, BigNumber.ROUND_DOWN));
|
|
29914
|
+
orderValues = {
|
|
29915
|
+
sellToken: assetFrom,
|
|
29916
|
+
buyToken: assetTo,
|
|
29917
|
+
receiver: pool.address,
|
|
29918
|
+
sellAmount: sellAmount,
|
|
29919
|
+
buyAmount: buyAmountWithSlippage.toString(),
|
|
29920
|
+
validTo: validTo,
|
|
29921
|
+
appData: ethers.constants.HashZero,
|
|
29922
|
+
feeAmount: "0",
|
|
29923
|
+
kind: kind === "sell" ? KIND_SELL : KIND_BUY,
|
|
29924
|
+
partiallyFillable: false,
|
|
29925
|
+
sellTokenBalance: BALANCE_ERC20,
|
|
29926
|
+
buyTokenBalance: BALANCE_ERC20
|
|
29927
|
+
}; // 2. Compute digest matching CowSwapOrderTypeHashLib.getDigest exactly
|
|
29928
|
+
|
|
29929
|
+
domainSep = computeDomainSeparator("Gnosis Protocol", "v2", chainId, gpv2Settlement);
|
|
29930
|
+
orderHash = hashOrder(orderValues);
|
|
29931
|
+
orderDigest = computeOrderDigest(domainSep, orderHash); // orderUid = abi.encodePacked(orderDigest, owner, validTo) — 32 + 20 + 4 = 56 bytes
|
|
29932
|
+
|
|
29933
|
+
orderUid = ethers.utils.solidityPack(["bytes32", "address", "uint32"], [orderDigest, pool.address, validTo]); // 3. Submit order to CowSwap API — solver waits for on-chain presign before executing
|
|
29934
|
+
|
|
29935
|
+
_context.prev = 26;
|
|
29936
|
+
_context.next = 29;
|
|
29937
|
+
return axios.post(baseUrl + "/orders", {
|
|
29938
|
+
sellToken: assetFrom,
|
|
29939
|
+
buyToken: assetTo,
|
|
29940
|
+
receiver: pool.address,
|
|
29941
|
+
sellAmount: sellAmount,
|
|
29942
|
+
buyAmount: buyAmountWithSlippage.toString(),
|
|
29943
|
+
validTo: validTo,
|
|
29944
|
+
appData: ethers.constants.HashZero,
|
|
29945
|
+
feeAmount: "0",
|
|
29946
|
+
kind: kind,
|
|
29947
|
+
partiallyFillable: false,
|
|
29948
|
+
signingScheme: "presign",
|
|
29949
|
+
signature: pool.address,
|
|
29950
|
+
sellTokenBalance: "erc20",
|
|
29951
|
+
buyTokenBalance: "erc20",
|
|
29952
|
+
from: pool.address,
|
|
29953
|
+
quoteId: quoteResponse.id
|
|
29954
|
+
});
|
|
29955
|
+
|
|
29956
|
+
case 29:
|
|
29957
|
+
_context.next = 34;
|
|
29958
|
+
break;
|
|
29959
|
+
|
|
29960
|
+
case 31:
|
|
29961
|
+
_context.prev = 31;
|
|
29962
|
+
_context.t1 = _context["catch"](26);
|
|
29963
|
+
throw new ApiError("CowSwap order submission failed");
|
|
29964
|
+
|
|
29965
|
+
case 34:
|
|
29966
|
+
// 4. Encode CowSwapTypedData for submit() on TypedStructuredDataValidator
|
|
29967
|
+
typedData = {
|
|
29968
|
+
domain: {
|
|
29969
|
+
name: "Gnosis Protocol",
|
|
29970
|
+
version: "v2",
|
|
29971
|
+
chainId: chainId,
|
|
29972
|
+
verifyingContract: gpv2Settlement
|
|
29973
|
+
},
|
|
29974
|
+
order: orderValues
|
|
29975
|
+
};
|
|
29976
|
+
encodedTypedData = ethers.utils.defaultAbiCoder.encode(["tuple(" + "tuple(string name, string version, uint256 chainId, address verifyingContract) domain," + "tuple(address sellToken, address buyToken, address receiver, uint256 sellAmount, uint256 buyAmount, uint32 validTo, bytes32 appData, uint256 feeAmount, bytes32 kind, bool partiallyFillable, bytes32 sellTokenBalance, bytes32 buyTokenBalance) order" + ")"], [typedData]); // 5. Encode setPreSignature() — guard checks isValidatedHash(pool, orderDigest)
|
|
29977
|
+
|
|
29978
|
+
settlementIface = new ethers.utils.Interface(GPv2Settlement_ABI);
|
|
29979
|
+
preSignTxData = settlementIface.encodeFunctionData("setPreSignature", [orderUid, true]);
|
|
29980
|
+
return _context.abrupt("return", {
|
|
29981
|
+
encodedTypedData: encodedTypedData,
|
|
29982
|
+
preSignTxData: preSignTxData,
|
|
29983
|
+
minAmountOut: buyAmountWithSlippage.toString()
|
|
29984
|
+
});
|
|
29985
|
+
|
|
29986
|
+
case 39:
|
|
29987
|
+
case "end":
|
|
29988
|
+
return _context.stop();
|
|
29989
|
+
}
|
|
29990
|
+
}
|
|
29991
|
+
}, _callee, null, [[9, 16], [26, 31]]);
|
|
29992
|
+
}));
|
|
29993
|
+
return _getCowSwapTxData.apply(this, arguments);
|
|
29994
|
+
}
|
|
29995
|
+
|
|
29812
29996
|
var ICoreDepositWalletAbi = [
|
|
29813
29997
|
{
|
|
29814
29998
|
inputs: [
|
|
@@ -30267,12 +30451,13 @@ var getWithdrawSpotHyperliquidTxData = function getWithdrawSpotHyperliquidTxData
|
|
|
30267
30451
|
var rawTXData = ethers.utils.solidityPack(["uint8", "uint24", "bytes"], [HYPERLIQUID_VERSION, SPOT_SEND_ACTION, innerEncoded]);
|
|
30268
30452
|
return coreWriter.encodeFunctionData("sendRawAction", [rawTXData]);
|
|
30269
30453
|
};
|
|
30270
|
-
var
|
|
30271
|
-
|
|
30272
|
-
//
|
|
30454
|
+
var getSendAssetHyperliquidTxData = function getSendAssetHyperliquidTxData(sourceDex, destinationDex, receiver, amount) {
|
|
30455
|
+
// Convert 6-decimal EVM USDC to 8-decimal HyperCore USDC (spot, main perp, and xyz)
|
|
30456
|
+
// Transfer USDC between dexes (perp, spot, xyz)
|
|
30457
|
+
var coreAmount = ethers.BigNumber.from(amount).mul(100); //From Perp to Spot
|
|
30273
30458
|
|
|
30274
30459
|
var innerEncoded = ethers.utils.defaultAbiCoder.encode( //destination, subAccount, sourceDex, destinationDex, token, amount
|
|
30275
|
-
["address", "address", "uint32", "uint32", "uint64", "uint64"], [receiver, ethers.constants.AddressZero,
|
|
30460
|
+
["address", "address", "uint32", "uint32", "uint64", "uint64"], [receiver, ethers.constants.AddressZero, sourceDex, destinationDex, USDC_TOKEN_ID, coreAmount]);
|
|
30276
30461
|
var rawTXData = ethers.utils.solidityPack(["uint8", "uint24", "bytes"], [HYPERLIQUID_VERSION, SEND_ASSET_ACTION, innerEncoded]);
|
|
30277
30462
|
return coreWriter.encodeFunctionData("sendRawAction", [rawTXData]);
|
|
30278
30463
|
};
|
|
@@ -30905,7 +31090,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30905
31090
|
/*#__PURE__*/
|
|
30906
31091
|
function () {
|
|
30907
31092
|
var _trade = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(dapp, assetFrom, assetTo, amountIn, slippage, options, sdkOptions) {
|
|
30908
|
-
var swapTxData, minAmountOut, _yield$getOneInchSwap, iSynthetix, assets, daoAddress, _yield$getOdosSwapTxD, _yield$getPendleSwapT, _yield$getKyberSwapTx, iUniswapV2Router, calculatedMinAmountOut, tx;
|
|
31093
|
+
var swapTxData, minAmountOut, _yield$getOneInchSwap, iSynthetix, assets, daoAddress, _yield$getOdosSwapTxD, _yield$getPendleSwapT, _yield$getKyberSwapTx, cowSwapEstimateGas, _yield$getCowSwapTxDa, encodedTypedData, preSignTxData, cowMinOut, validatorContract, submitTx, submitReceipt, iUniswapV2Router, calculatedMinAmountOut, tx;
|
|
30909
31094
|
|
|
30910
31095
|
return runtime_1.wrap(function _callee10$(_context10) {
|
|
30911
31096
|
while (1) {
|
|
@@ -30927,7 +31112,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30927
31112
|
|
|
30928
31113
|
minAmountOut = null;
|
|
30929
31114
|
_context10.t0 = dapp;
|
|
30930
|
-
_context10.next = _context10.t0 === Dapp.ONEINCH ? 7 : _context10.t0 === Dapp.BALANCER ? 13 : _context10.t0 === Dapp.SYNTHETIX ? 17 : _context10.t0 === Dapp.TOROS ? 24 : _context10.t0 === Dapp.ODOS ? 28 : _context10.t0 === Dapp.PENDLE ? 34 : _context10.t0 === Dapp.KYBERSWAP ? 40 : 46;
|
|
31115
|
+
_context10.next = _context10.t0 === Dapp.ONEINCH ? 7 : _context10.t0 === Dapp.BALANCER ? 13 : _context10.t0 === Dapp.SYNTHETIX ? 17 : _context10.t0 === Dapp.TOROS ? 24 : _context10.t0 === Dapp.ODOS ? 28 : _context10.t0 === Dapp.PENDLE ? 34 : _context10.t0 === Dapp.KYBERSWAP ? 40 : _context10.t0 === Dapp.COWSWAP ? 46 : 65;
|
|
30931
31116
|
break;
|
|
30932
31117
|
|
|
30933
31118
|
case 7:
|
|
@@ -30938,7 +31123,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30938
31123
|
_yield$getOneInchSwap = _context10.sent;
|
|
30939
31124
|
swapTxData = _yield$getOneInchSwap.swapTxData;
|
|
30940
31125
|
minAmountOut = _yield$getOneInchSwap.dstAmount;
|
|
30941
|
-
return _context10.abrupt("break",
|
|
31126
|
+
return _context10.abrupt("break", 80);
|
|
30942
31127
|
|
|
30943
31128
|
case 13:
|
|
30944
31129
|
_context10.next = 15;
|
|
@@ -30946,7 +31131,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30946
31131
|
|
|
30947
31132
|
case 15:
|
|
30948
31133
|
swapTxData = _context10.sent;
|
|
30949
|
-
return _context10.abrupt("break",
|
|
31134
|
+
return _context10.abrupt("break", 80);
|
|
30950
31135
|
|
|
30951
31136
|
case 17:
|
|
30952
31137
|
iSynthetix = new ethers.utils.Interface(ISynthetix.abi);
|
|
@@ -30959,7 +31144,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30959
31144
|
case 21:
|
|
30960
31145
|
daoAddress = _context10.sent;
|
|
30961
31146
|
swapTxData = iSynthetix.encodeFunctionData(Transaction.SWAP_SYNTHS, [assets[0], amountIn, assets[1], daoAddress, SYNTHETIX_TRACKING_CODE]);
|
|
30962
|
-
return _context10.abrupt("break",
|
|
31147
|
+
return _context10.abrupt("break", 80);
|
|
30963
31148
|
|
|
30964
31149
|
case 24:
|
|
30965
31150
|
_context10.next = 26;
|
|
@@ -30967,7 +31152,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30967
31152
|
|
|
30968
31153
|
case 26:
|
|
30969
31154
|
swapTxData = _context10.sent;
|
|
30970
|
-
return _context10.abrupt("break",
|
|
31155
|
+
return _context10.abrupt("break", 80);
|
|
30971
31156
|
|
|
30972
31157
|
case 28:
|
|
30973
31158
|
_context10.next = 30;
|
|
@@ -30977,7 +31162,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30977
31162
|
_yield$getOdosSwapTxD = _context10.sent;
|
|
30978
31163
|
swapTxData = _yield$getOdosSwapTxD.swapTxData;
|
|
30979
31164
|
minAmountOut = _yield$getOdosSwapTxD.minAmountOut;
|
|
30980
|
-
return _context10.abrupt("break",
|
|
31165
|
+
return _context10.abrupt("break", 80);
|
|
30981
31166
|
|
|
30982
31167
|
case 34:
|
|
30983
31168
|
_context10.next = 36;
|
|
@@ -30987,7 +31172,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30987
31172
|
_yield$getPendleSwapT = _context10.sent;
|
|
30988
31173
|
swapTxData = _yield$getPendleSwapT.swapTxData;
|
|
30989
31174
|
minAmountOut = _yield$getPendleSwapT.minAmountOut;
|
|
30990
|
-
return _context10.abrupt("break",
|
|
31175
|
+
return _context10.abrupt("break", 80);
|
|
30991
31176
|
|
|
30992
31177
|
case 40:
|
|
30993
31178
|
_context10.next = 42;
|
|
@@ -30997,14 +31182,58 @@ var Pool = /*#__PURE__*/function () {
|
|
|
30997
31182
|
_yield$getKyberSwapTx = _context10.sent;
|
|
30998
31183
|
swapTxData = _yield$getKyberSwapTx.swapTxData;
|
|
30999
31184
|
minAmountOut = _yield$getKyberSwapTx.minAmountOut;
|
|
31000
|
-
return _context10.abrupt("break",
|
|
31185
|
+
return _context10.abrupt("break", 80);
|
|
31001
31186
|
|
|
31002
31187
|
case 46:
|
|
31188
|
+
cowSwapEstimateGas = isSdkOptionsBoolean(sdkOptions) ? sdkOptions : sdkOptions.estimateGas;
|
|
31189
|
+
|
|
31190
|
+
if (!(cowSwapEstimateGas || !isSdkOptionsBoolean(sdkOptions) && sdkOptions.onlyGetTxData)) {
|
|
31191
|
+
_context10.next = 49;
|
|
31192
|
+
break;
|
|
31193
|
+
}
|
|
31194
|
+
|
|
31195
|
+
throw new Error("CowSwap requires two sequential transactions (submit + preSign) and does not support estimateGas or onlyGetTxData");
|
|
31196
|
+
|
|
31197
|
+
case 49:
|
|
31198
|
+
_context10.next = 51;
|
|
31199
|
+
return getCowSwapTxData(this, assetFrom, assetTo, amountIn, slippage);
|
|
31200
|
+
|
|
31201
|
+
case 51:
|
|
31202
|
+
_yield$getCowSwapTxDa = _context10.sent;
|
|
31203
|
+
encodedTypedData = _yield$getCowSwapTxDa.encodedTypedData;
|
|
31204
|
+
preSignTxData = _yield$getCowSwapTxDa.preSignTxData;
|
|
31205
|
+
cowMinOut = _yield$getCowSwapTxDa.minAmountOut;
|
|
31206
|
+
// Tx 1: manager calls submit() directly on TypedStructuredDataValidator (not via pool.execTransaction)
|
|
31207
|
+
validatorContract = new Contract(routerAddress[this.network][dapp], ["function submit(address _poolLogic, uint8 _dataType, bytes memory _structuredData) external"], this.signer);
|
|
31208
|
+
_context10.next = 58;
|
|
31209
|
+
return validatorContract.submit.apply(validatorContract, [this.address, 1
|
|
31210
|
+
/* COWSWAP_ORDER */
|
|
31211
|
+
, encodedTypedData].concat(options ? [options] : []));
|
|
31212
|
+
|
|
31213
|
+
case 58:
|
|
31214
|
+
submitTx = _context10.sent;
|
|
31215
|
+
_context10.next = 61;
|
|
31216
|
+
return submitTx.wait(3);
|
|
31217
|
+
|
|
31218
|
+
case 61:
|
|
31219
|
+
submitReceipt = _context10.sent;
|
|
31220
|
+
|
|
31221
|
+
if (!(submitReceipt.status === 0)) {
|
|
31222
|
+
_context10.next = 64;
|
|
31223
|
+
break;
|
|
31224
|
+
}
|
|
31225
|
+
|
|
31226
|
+
return _context10.abrupt("return", submitReceipt);
|
|
31227
|
+
|
|
31228
|
+
case 64:
|
|
31229
|
+
return _context10.abrupt("return", getPoolTxOrGasEstimate(this, [gpv2SettlementAddress[this.network], preSignTxData, options, cowMinOut], sdkOptions));
|
|
31230
|
+
|
|
31231
|
+
case 65:
|
|
31003
31232
|
iUniswapV2Router = new ethers.utils.Interface(IUniswapV2Router.abi);
|
|
31004
|
-
_context10.next =
|
|
31233
|
+
_context10.next = 68;
|
|
31005
31234
|
return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
|
|
31006
31235
|
|
|
31007
|
-
case
|
|
31236
|
+
case 68:
|
|
31008
31237
|
calculatedMinAmountOut = _context10.sent;
|
|
31009
31238
|
_context10.t1 = iUniswapV2Router;
|
|
31010
31239
|
_context10.t2 = Transaction.SWAP;
|
|
@@ -31012,23 +31241,23 @@ var Pool = /*#__PURE__*/function () {
|
|
|
31012
31241
|
_context10.t4 = calculatedMinAmountOut;
|
|
31013
31242
|
_context10.t5 = [assetFrom, assetTo];
|
|
31014
31243
|
_context10.t6 = this.address;
|
|
31015
|
-
_context10.next =
|
|
31244
|
+
_context10.next = 77;
|
|
31016
31245
|
return getDeadline(this);
|
|
31017
31246
|
|
|
31018
|
-
case
|
|
31247
|
+
case 77:
|
|
31019
31248
|
_context10.t7 = _context10.sent;
|
|
31020
31249
|
_context10.t8 = [_context10.t3, _context10.t4, _context10.t5, _context10.t6, _context10.t7];
|
|
31021
31250
|
swapTxData = _context10.t1.encodeFunctionData.call(_context10.t1, _context10.t2, _context10.t8);
|
|
31022
31251
|
|
|
31023
|
-
case
|
|
31024
|
-
_context10.next =
|
|
31252
|
+
case 80:
|
|
31253
|
+
_context10.next = 82;
|
|
31025
31254
|
return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], swapTxData, options, minAmountOut], sdkOptions);
|
|
31026
31255
|
|
|
31027
|
-
case
|
|
31256
|
+
case 82:
|
|
31028
31257
|
tx = _context10.sent;
|
|
31029
31258
|
return _context10.abrupt("return", tx);
|
|
31030
31259
|
|
|
31031
|
-
case
|
|
31260
|
+
case 84:
|
|
31032
31261
|
case "end":
|
|
31033
31262
|
return _context10.stop();
|
|
31034
31263
|
}
|
|
@@ -34065,7 +34294,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34065
34294
|
}
|
|
34066
34295
|
|
|
34067
34296
|
_context60.next = 4;
|
|
34068
|
-
return getPoolTxOrGasEstimate(this, [CORE_WRITER_ADDRESS,
|
|
34297
|
+
return getPoolTxOrGasEstimate(this, [CORE_WRITER_ADDRESS, getSendAssetHyperliquidTxData(dexId, SPOT_DEX_ID, this.address, amount), options], sdkOptions);
|
|
34069
34298
|
|
|
34070
34299
|
case 4:
|
|
34071
34300
|
tx = _context60.sent;
|
|
@@ -34085,20 +34314,22 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34085
34314
|
|
|
34086
34315
|
return perpToSpotHyperliquid;
|
|
34087
34316
|
}()
|
|
34088
|
-
/**
|
|
34089
|
-
* USDC must be in the Spot wallet first — use perpToSpotHyperliquid() to move it from a trading dex.
|
|
34317
|
+
/** Move USDC from HyperCore spot wallet to a trading dex.
|
|
34090
34318
|
*
|
|
34091
|
-
* @param {
|
|
34319
|
+
* @param {number} dexId Destination dex ID where USDC will be moved to
|
|
34320
|
+
* - 0: Core Perp dex (standard perps like BTC, ETH)
|
|
34321
|
+
* - 1: xyz HIP-3 dex (builder perps like TSLA, GOLD)
|
|
34322
|
+
* @param {BigNumber | string} amount USDC amount to transfer (6 decimals, e.g. "1000000" = 1 USDC)
|
|
34092
34323
|
* @param {any} options Transaction options
|
|
34093
34324
|
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
34094
34325
|
* @returns {Promise<any>} Transaction
|
|
34095
34326
|
*/
|
|
34096
34327
|
;
|
|
34097
34328
|
|
|
34098
|
-
_proto.
|
|
34329
|
+
_proto.spotToPerpHyperliquid =
|
|
34099
34330
|
/*#__PURE__*/
|
|
34100
34331
|
function () {
|
|
34101
|
-
var
|
|
34332
|
+
var _spotToPerpHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee61(dexId, amount, options, sdkOptions) {
|
|
34102
34333
|
var tx;
|
|
34103
34334
|
return runtime_1.wrap(function _callee61$(_context61) {
|
|
34104
34335
|
while (1) {
|
|
@@ -34115,7 +34346,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34115
34346
|
}
|
|
34116
34347
|
|
|
34117
34348
|
_context61.next = 4;
|
|
34118
|
-
return getPoolTxOrGasEstimate(this, [CORE_WRITER_ADDRESS,
|
|
34349
|
+
return getPoolTxOrGasEstimate(this, [CORE_WRITER_ADDRESS, getSendAssetHyperliquidTxData(SPOT_DEX_ID, dexId, this.address, amount), options], sdkOptions);
|
|
34119
34350
|
|
|
34120
34351
|
case 4:
|
|
34121
34352
|
tx = _context61.sent;
|
|
@@ -34129,7 +34360,57 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34129
34360
|
}, _callee61, this);
|
|
34130
34361
|
}));
|
|
34131
34362
|
|
|
34132
|
-
function
|
|
34363
|
+
function spotToPerpHyperliquid(_x287, _x288, _x289, _x290) {
|
|
34364
|
+
return _spotToPerpHyperliquid.apply(this, arguments);
|
|
34365
|
+
}
|
|
34366
|
+
|
|
34367
|
+
return spotToPerpHyperliquid;
|
|
34368
|
+
}()
|
|
34369
|
+
/** Withdraw USDC from Hyperliquid Spot wallet back to EVM.
|
|
34370
|
+
* USDC must be in the Spot wallet first — use perpToSpotHyperliquid() to move it from a trading dex.
|
|
34371
|
+
*
|
|
34372
|
+
* @param {BigNumber | string} amount USDC amount to withdraw (6 decimals, e.g. "1000000" = 1 USDC)
|
|
34373
|
+
* @param {any} options Transaction options
|
|
34374
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
34375
|
+
* @returns {Promise<any>} Transaction
|
|
34376
|
+
*/
|
|
34377
|
+
;
|
|
34378
|
+
|
|
34379
|
+
_proto.withdrawHyperliquid =
|
|
34380
|
+
/*#__PURE__*/
|
|
34381
|
+
function () {
|
|
34382
|
+
var _withdrawHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee62(amount, options, sdkOptions) {
|
|
34383
|
+
var tx;
|
|
34384
|
+
return runtime_1.wrap(function _callee62$(_context62) {
|
|
34385
|
+
while (1) {
|
|
34386
|
+
switch (_context62.prev = _context62.next) {
|
|
34387
|
+
case 0:
|
|
34388
|
+
if (options === void 0) {
|
|
34389
|
+
options = null;
|
|
34390
|
+
}
|
|
34391
|
+
|
|
34392
|
+
if (sdkOptions === void 0) {
|
|
34393
|
+
sdkOptions = {
|
|
34394
|
+
estimateGas: false
|
|
34395
|
+
};
|
|
34396
|
+
}
|
|
34397
|
+
|
|
34398
|
+
_context62.next = 4;
|
|
34399
|
+
return getPoolTxOrGasEstimate(this, [CORE_WRITER_ADDRESS, getWithdrawSpotHyperliquidTxData(amount), options], sdkOptions);
|
|
34400
|
+
|
|
34401
|
+
case 4:
|
|
34402
|
+
tx = _context62.sent;
|
|
34403
|
+
return _context62.abrupt("return", tx);
|
|
34404
|
+
|
|
34405
|
+
case 6:
|
|
34406
|
+
case "end":
|
|
34407
|
+
return _context62.stop();
|
|
34408
|
+
}
|
|
34409
|
+
}
|
|
34410
|
+
}, _callee62, this);
|
|
34411
|
+
}));
|
|
34412
|
+
|
|
34413
|
+
function withdrawHyperliquid(_x291, _x292, _x293) {
|
|
34133
34414
|
return _withdrawHyperliquid.apply(this, arguments);
|
|
34134
34415
|
}
|
|
34135
34416
|
|
|
@@ -34150,11 +34431,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34150
34431
|
_proto.openMarketOrderHyperliquid =
|
|
34151
34432
|
/*#__PURE__*/
|
|
34152
34433
|
function () {
|
|
34153
|
-
var _openMarketOrderHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34434
|
+
var _openMarketOrderHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee63(assetId, isLong, value, slippage, options, sdkOptions) {
|
|
34154
34435
|
var tx;
|
|
34155
|
-
return runtime_1.wrap(function
|
|
34436
|
+
return runtime_1.wrap(function _callee63$(_context63) {
|
|
34156
34437
|
while (1) {
|
|
34157
|
-
switch (
|
|
34438
|
+
switch (_context63.prev = _context63.next) {
|
|
34158
34439
|
case 0:
|
|
34159
34440
|
if (slippage === void 0) {
|
|
34160
34441
|
slippage = 0.5;
|
|
@@ -34170,33 +34451,33 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34170
34451
|
};
|
|
34171
34452
|
}
|
|
34172
34453
|
|
|
34173
|
-
|
|
34174
|
-
|
|
34175
|
-
|
|
34176
|
-
|
|
34454
|
+
_context63.t0 = getPoolTxOrGasEstimate;
|
|
34455
|
+
_context63.t1 = this;
|
|
34456
|
+
_context63.t2 = CORE_WRITER_ADDRESS;
|
|
34457
|
+
_context63.next = 8;
|
|
34177
34458
|
return getLimitOrderHyperliquidTxData(assetId, isLong, value, slippage);
|
|
34178
34459
|
|
|
34179
34460
|
case 8:
|
|
34180
|
-
|
|
34181
|
-
|
|
34182
|
-
|
|
34183
|
-
|
|
34184
|
-
|
|
34185
|
-
return (0,
|
|
34461
|
+
_context63.t3 = _context63.sent;
|
|
34462
|
+
_context63.t4 = options;
|
|
34463
|
+
_context63.t5 = [_context63.t2, _context63.t3, _context63.t4];
|
|
34464
|
+
_context63.t6 = sdkOptions;
|
|
34465
|
+
_context63.next = 14;
|
|
34466
|
+
return (0, _context63.t0)(_context63.t1, _context63.t5, _context63.t6);
|
|
34186
34467
|
|
|
34187
34468
|
case 14:
|
|
34188
|
-
tx =
|
|
34189
|
-
return
|
|
34469
|
+
tx = _context63.sent;
|
|
34470
|
+
return _context63.abrupt("return", tx);
|
|
34190
34471
|
|
|
34191
34472
|
case 16:
|
|
34192
34473
|
case "end":
|
|
34193
|
-
return
|
|
34474
|
+
return _context63.stop();
|
|
34194
34475
|
}
|
|
34195
34476
|
}
|
|
34196
|
-
},
|
|
34477
|
+
}, _callee63, this);
|
|
34197
34478
|
}));
|
|
34198
34479
|
|
|
34199
|
-
function openMarketOrderHyperliquid(
|
|
34480
|
+
function openMarketOrderHyperliquid(_x294, _x295, _x296, _x297, _x298, _x299) {
|
|
34200
34481
|
return _openMarketOrderHyperliquid.apply(this, arguments);
|
|
34201
34482
|
}
|
|
34202
34483
|
|
|
@@ -34215,11 +34496,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34215
34496
|
_proto.closePositionHyperliquid =
|
|
34216
34497
|
/*#__PURE__*/
|
|
34217
34498
|
function () {
|
|
34218
|
-
var _closePositionHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34499
|
+
var _closePositionHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee64(assetId, percentageToClose, slippage, options, sdkOptions) {
|
|
34219
34500
|
var tx;
|
|
34220
|
-
return runtime_1.wrap(function
|
|
34501
|
+
return runtime_1.wrap(function _callee64$(_context64) {
|
|
34221
34502
|
while (1) {
|
|
34222
|
-
switch (
|
|
34503
|
+
switch (_context64.prev = _context64.next) {
|
|
34223
34504
|
case 0:
|
|
34224
34505
|
if (percentageToClose === void 0) {
|
|
34225
34506
|
percentageToClose = 100;
|
|
@@ -34239,33 +34520,33 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34239
34520
|
};
|
|
34240
34521
|
}
|
|
34241
34522
|
|
|
34242
|
-
|
|
34243
|
-
|
|
34244
|
-
|
|
34245
|
-
|
|
34523
|
+
_context64.t0 = getPoolTxOrGasEstimate;
|
|
34524
|
+
_context64.t1 = this;
|
|
34525
|
+
_context64.t2 = CORE_WRITER_ADDRESS;
|
|
34526
|
+
_context64.next = 9;
|
|
34246
34527
|
return getClosePositionHyperliquidTxData(assetId, percentageToClose, slippage, this.address);
|
|
34247
34528
|
|
|
34248
34529
|
case 9:
|
|
34249
|
-
|
|
34250
|
-
|
|
34251
|
-
|
|
34252
|
-
|
|
34253
|
-
|
|
34254
|
-
return (0,
|
|
34530
|
+
_context64.t3 = _context64.sent;
|
|
34531
|
+
_context64.t4 = options;
|
|
34532
|
+
_context64.t5 = [_context64.t2, _context64.t3, _context64.t4];
|
|
34533
|
+
_context64.t6 = sdkOptions;
|
|
34534
|
+
_context64.next = 15;
|
|
34535
|
+
return (0, _context64.t0)(_context64.t1, _context64.t5, _context64.t6);
|
|
34255
34536
|
|
|
34256
34537
|
case 15:
|
|
34257
|
-
tx =
|
|
34258
|
-
return
|
|
34538
|
+
tx = _context64.sent;
|
|
34539
|
+
return _context64.abrupt("return", tx);
|
|
34259
34540
|
|
|
34260
34541
|
case 17:
|
|
34261
34542
|
case "end":
|
|
34262
|
-
return
|
|
34543
|
+
return _context64.stop();
|
|
34263
34544
|
}
|
|
34264
34545
|
}
|
|
34265
|
-
},
|
|
34546
|
+
}, _callee64, this);
|
|
34266
34547
|
}));
|
|
34267
34548
|
|
|
34268
|
-
function closePositionHyperliquid(
|
|
34549
|
+
function closePositionHyperliquid(_x300, _x301, _x302, _x303, _x304) {
|
|
34269
34550
|
return _closePositionHyperliquid.apply(this, arguments);
|
|
34270
34551
|
}
|
|
34271
34552
|
|
|
@@ -34285,11 +34566,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34285
34566
|
_proto.approveTorosLimitOrder =
|
|
34286
34567
|
/*#__PURE__*/
|
|
34287
34568
|
function () {
|
|
34288
|
-
var _approveTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34569
|
+
var _approveTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee65(vaultAddress, amount, options, sdkOptions) {
|
|
34289
34570
|
var managerAddress, iERC20, approveTxData;
|
|
34290
|
-
return runtime_1.wrap(function
|
|
34571
|
+
return runtime_1.wrap(function _callee65$(_context65) {
|
|
34291
34572
|
while (1) {
|
|
34292
|
-
switch (
|
|
34573
|
+
switch (_context65.prev = _context65.next) {
|
|
34293
34574
|
case 0:
|
|
34294
34575
|
if (options === void 0) {
|
|
34295
34576
|
options = null;
|
|
@@ -34304,17 +34585,17 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34304
34585
|
managerAddress = limitOrderAddress[this.network];
|
|
34305
34586
|
iERC20 = new ethers.utils.Interface(IERC20.abi);
|
|
34306
34587
|
approveTxData = iERC20.encodeFunctionData("approve", [managerAddress, amount]);
|
|
34307
|
-
return
|
|
34588
|
+
return _context65.abrupt("return", getPoolTxOrGasEstimate(this, [vaultAddress, approveTxData, options], sdkOptions));
|
|
34308
34589
|
|
|
34309
34590
|
case 6:
|
|
34310
34591
|
case "end":
|
|
34311
|
-
return
|
|
34592
|
+
return _context65.stop();
|
|
34312
34593
|
}
|
|
34313
34594
|
}
|
|
34314
|
-
},
|
|
34595
|
+
}, _callee65, this);
|
|
34315
34596
|
}));
|
|
34316
34597
|
|
|
34317
|
-
function approveTorosLimitOrder(
|
|
34598
|
+
function approveTorosLimitOrder(_x305, _x306, _x307, _x308) {
|
|
34318
34599
|
return _approveTorosLimitOrder.apply(this, arguments);
|
|
34319
34600
|
}
|
|
34320
34601
|
|
|
@@ -34336,11 +34617,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34336
34617
|
_proto.createTorosLimitOrder =
|
|
34337
34618
|
/*#__PURE__*/
|
|
34338
34619
|
function () {
|
|
34339
|
-
var _createTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34620
|
+
var _createTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee66(vaultAddress, amount, stopLossPriceD18, takeProfitPriceD18, pricingAsset, options, sdkOptions) {
|
|
34340
34621
|
var managerAddress, resolvedStopLoss, resolvedTakeProfit, info, txData;
|
|
34341
|
-
return runtime_1.wrap(function
|
|
34622
|
+
return runtime_1.wrap(function _callee66$(_context66) {
|
|
34342
34623
|
while (1) {
|
|
34343
|
-
switch (
|
|
34624
|
+
switch (_context66.prev = _context66.next) {
|
|
34344
34625
|
case 0:
|
|
34345
34626
|
if (options === void 0) {
|
|
34346
34627
|
options = null;
|
|
@@ -34355,7 +34636,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34355
34636
|
managerAddress = limitOrderAddress[this.network];
|
|
34356
34637
|
|
|
34357
34638
|
if (managerAddress) {
|
|
34358
|
-
|
|
34639
|
+
_context66.next = 5;
|
|
34359
34640
|
break;
|
|
34360
34641
|
}
|
|
34361
34642
|
|
|
@@ -34373,17 +34654,17 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34373
34654
|
pricingAsset: pricingAsset
|
|
34374
34655
|
};
|
|
34375
34656
|
txData = getCreateLimitOrderTxData(info);
|
|
34376
|
-
return
|
|
34657
|
+
return _context66.abrupt("return", getPoolTxOrGasEstimate(this, [managerAddress, txData, options], sdkOptions));
|
|
34377
34658
|
|
|
34378
34659
|
case 10:
|
|
34379
34660
|
case "end":
|
|
34380
|
-
return
|
|
34661
|
+
return _context66.stop();
|
|
34381
34662
|
}
|
|
34382
34663
|
}
|
|
34383
|
-
},
|
|
34664
|
+
}, _callee66, this);
|
|
34384
34665
|
}));
|
|
34385
34666
|
|
|
34386
|
-
function createTorosLimitOrder(
|
|
34667
|
+
function createTorosLimitOrder(_x309, _x310, _x311, _x312, _x313, _x314, _x315) {
|
|
34387
34668
|
return _createTorosLimitOrder.apply(this, arguments);
|
|
34388
34669
|
}
|
|
34389
34670
|
|
|
@@ -34405,11 +34686,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34405
34686
|
_proto.modifyTorosLimitOrder =
|
|
34406
34687
|
/*#__PURE__*/
|
|
34407
34688
|
function () {
|
|
34408
|
-
var _modifyTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34689
|
+
var _modifyTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee67(vaultAddress, amount, stopLossPriceD18, takeProfitPriceD18, pricingAsset, options, sdkOptions) {
|
|
34409
34690
|
var managerAddress, resolvedStopLoss, resolvedTakeProfit, info, txData;
|
|
34410
|
-
return runtime_1.wrap(function
|
|
34691
|
+
return runtime_1.wrap(function _callee67$(_context67) {
|
|
34411
34692
|
while (1) {
|
|
34412
|
-
switch (
|
|
34693
|
+
switch (_context67.prev = _context67.next) {
|
|
34413
34694
|
case 0:
|
|
34414
34695
|
if (options === void 0) {
|
|
34415
34696
|
options = null;
|
|
@@ -34424,7 +34705,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34424
34705
|
managerAddress = limitOrderAddress[this.network];
|
|
34425
34706
|
|
|
34426
34707
|
if (managerAddress) {
|
|
34427
|
-
|
|
34708
|
+
_context67.next = 5;
|
|
34428
34709
|
break;
|
|
34429
34710
|
}
|
|
34430
34711
|
|
|
@@ -34442,17 +34723,17 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34442
34723
|
pricingAsset: pricingAsset
|
|
34443
34724
|
};
|
|
34444
34725
|
txData = getModifyLimitOrderTxData(info);
|
|
34445
|
-
return
|
|
34726
|
+
return _context67.abrupt("return", getPoolTxOrGasEstimate(this, [managerAddress, txData, options], sdkOptions));
|
|
34446
34727
|
|
|
34447
34728
|
case 10:
|
|
34448
34729
|
case "end":
|
|
34449
|
-
return
|
|
34730
|
+
return _context67.stop();
|
|
34450
34731
|
}
|
|
34451
34732
|
}
|
|
34452
|
-
},
|
|
34733
|
+
}, _callee67, this);
|
|
34453
34734
|
}));
|
|
34454
34735
|
|
|
34455
|
-
function modifyTorosLimitOrder(
|
|
34736
|
+
function modifyTorosLimitOrder(_x316, _x317, _x318, _x319, _x320, _x321, _x322) {
|
|
34456
34737
|
return _modifyTorosLimitOrder.apply(this, arguments);
|
|
34457
34738
|
}
|
|
34458
34739
|
|
|
@@ -34470,11 +34751,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34470
34751
|
_proto.deleteTorosLimitOrder =
|
|
34471
34752
|
/*#__PURE__*/
|
|
34472
34753
|
function () {
|
|
34473
|
-
var _deleteTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34754
|
+
var _deleteTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee68(vaultAddress, options, sdkOptions) {
|
|
34474
34755
|
var managerAddress, txData;
|
|
34475
|
-
return runtime_1.wrap(function
|
|
34756
|
+
return runtime_1.wrap(function _callee68$(_context68) {
|
|
34476
34757
|
while (1) {
|
|
34477
|
-
switch (
|
|
34758
|
+
switch (_context68.prev = _context68.next) {
|
|
34478
34759
|
case 0:
|
|
34479
34760
|
if (options === void 0) {
|
|
34480
34761
|
options = null;
|
|
@@ -34489,7 +34770,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34489
34770
|
managerAddress = limitOrderAddress[this.network];
|
|
34490
34771
|
|
|
34491
34772
|
if (managerAddress) {
|
|
34492
|
-
|
|
34773
|
+
_context68.next = 5;
|
|
34493
34774
|
break;
|
|
34494
34775
|
}
|
|
34495
34776
|
|
|
@@ -34497,17 +34778,17 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34497
34778
|
|
|
34498
34779
|
case 5:
|
|
34499
34780
|
txData = getDeleteLimitOrderTxData(vaultAddress);
|
|
34500
|
-
return
|
|
34781
|
+
return _context68.abrupt("return", getPoolTxOrGasEstimate(this, [managerAddress, txData, options], sdkOptions));
|
|
34501
34782
|
|
|
34502
34783
|
case 7:
|
|
34503
34784
|
case "end":
|
|
34504
|
-
return
|
|
34785
|
+
return _context68.stop();
|
|
34505
34786
|
}
|
|
34506
34787
|
}
|
|
34507
|
-
},
|
|
34788
|
+
}, _callee68, this);
|
|
34508
34789
|
}));
|
|
34509
34790
|
|
|
34510
|
-
function deleteTorosLimitOrder(
|
|
34791
|
+
function deleteTorosLimitOrder(_x323, _x324, _x325) {
|
|
34511
34792
|
return _deleteTorosLimitOrder.apply(this, arguments);
|
|
34512
34793
|
}
|
|
34513
34794
|
|
|
@@ -34524,22 +34805,22 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34524
34805
|
_proto.getTorosLimitOrder =
|
|
34525
34806
|
/*#__PURE__*/
|
|
34526
34807
|
function () {
|
|
34527
|
-
var _getTorosLimitOrder2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34528
|
-
return runtime_1.wrap(function
|
|
34808
|
+
var _getTorosLimitOrder2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee69(userAddress, vaultAddress) {
|
|
34809
|
+
return runtime_1.wrap(function _callee69$(_context69) {
|
|
34529
34810
|
while (1) {
|
|
34530
|
-
switch (
|
|
34811
|
+
switch (_context69.prev = _context69.next) {
|
|
34531
34812
|
case 0:
|
|
34532
|
-
return
|
|
34813
|
+
return _context69.abrupt("return", getTorosLimitOrder(this, userAddress, vaultAddress));
|
|
34533
34814
|
|
|
34534
34815
|
case 1:
|
|
34535
34816
|
case "end":
|
|
34536
|
-
return
|
|
34817
|
+
return _context69.stop();
|
|
34537
34818
|
}
|
|
34538
34819
|
}
|
|
34539
|
-
},
|
|
34820
|
+
}, _callee69, this);
|
|
34540
34821
|
}));
|
|
34541
34822
|
|
|
34542
|
-
function getTorosLimitOrder$1(
|
|
34823
|
+
function getTorosLimitOrder$1(_x326, _x327) {
|
|
34543
34824
|
return _getTorosLimitOrder2.apply(this, arguments);
|
|
34544
34825
|
}
|
|
34545
34826
|
|
|
@@ -34556,22 +34837,22 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34556
34837
|
_proto.hasActiveTorosLimitOrder =
|
|
34557
34838
|
/*#__PURE__*/
|
|
34558
34839
|
function () {
|
|
34559
|
-
var _hasActiveTorosLimitOrder2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34560
|
-
return runtime_1.wrap(function
|
|
34840
|
+
var _hasActiveTorosLimitOrder2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee70(userAddress, vaultAddress) {
|
|
34841
|
+
return runtime_1.wrap(function _callee70$(_context70) {
|
|
34561
34842
|
while (1) {
|
|
34562
|
-
switch (
|
|
34843
|
+
switch (_context70.prev = _context70.next) {
|
|
34563
34844
|
case 0:
|
|
34564
|
-
return
|
|
34845
|
+
return _context70.abrupt("return", hasActiveTorosLimitOrder(this, userAddress, vaultAddress));
|
|
34565
34846
|
|
|
34566
34847
|
case 1:
|
|
34567
34848
|
case "end":
|
|
34568
|
-
return
|
|
34849
|
+
return _context70.stop();
|
|
34569
34850
|
}
|
|
34570
34851
|
}
|
|
34571
|
-
},
|
|
34852
|
+
}, _callee70, this);
|
|
34572
34853
|
}));
|
|
34573
34854
|
|
|
34574
|
-
function hasActiveTorosLimitOrder$1(
|
|
34855
|
+
function hasActiveTorosLimitOrder$1(_x328, _x329) {
|
|
34575
34856
|
return _hasActiveTorosLimitOrder2.apply(this, arguments);
|
|
34576
34857
|
}
|
|
34577
34858
|
|