@dhedge/v2-sdk 2.1.6 → 2.1.7
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/entities/pool.d.ts +11 -0
- package/dist/services/hyperliquid/index.d.ts +1 -1
- package/dist/v2-sdk.cjs.development.js +146 -93
- 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 +146 -93
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/entities/pool.ts +37 -3
- package/src/services/hyperliquid/index.ts +8 -6
package/dist/entities/pool.d.ts
CHANGED
|
@@ -598,6 +598,17 @@ export declare class Pool {
|
|
|
598
598
|
* @returns {Promise<any>} Transaction
|
|
599
599
|
*/
|
|
600
600
|
perpToSpotHyperliquid(dexId: number, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
601
|
+
/** Move USDC from HyperCore spot wallet to a trading dex.
|
|
602
|
+
*
|
|
603
|
+
* @param {number} dexId Destination dex ID where USDC will be moved to
|
|
604
|
+
* - 0: Core Perp dex (standard perps like BTC, ETH)
|
|
605
|
+
* - 1: xyz HIP-3 dex (builder perps like TSLA, GOLD)
|
|
606
|
+
* @param {BigNumber | string} amount USDC amount to transfer (6 decimals, e.g. "1000000" = 1 USDC)
|
|
607
|
+
* @param {any} options Transaction options
|
|
608
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
609
|
+
* @returns {Promise<any>} Transaction
|
|
610
|
+
*/
|
|
611
|
+
spotToPerpHyperliquid(dexId: number, amount: BigNumber | string, options?: any, sdkOptions?: SDKOptions): Promise<any>;
|
|
601
612
|
/** Withdraw USDC from Hyperliquid Spot wallet back to EVM.
|
|
602
613
|
* USDC must be in the Spot wallet first — use perpToSpotHyperliquid() to move it from a trading dex.
|
|
603
614
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ethers } from "ethers";
|
|
2
2
|
export declare const getDepositHyperliquidTxData: (dexId: number, amount: ethers.BigNumber | string) => string;
|
|
3
3
|
export declare const getWithdrawSpotHyperliquidTxData: (amount: ethers.BigNumber | string) => string;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const getSendAssetHyperliquidTxData: (sourceDex: number, destinationDex: number, receiver: string, amount: ethers.BigNumber | string) => string;
|
|
5
5
|
export declare const getLimitOrderHyperliquidTxData: (assetId: number, isLong: boolean, changeAmount: number, slippage: number) => Promise<string>;
|
|
6
6
|
export declare const getClosePositionHyperliquidTxData: (assetId: number, percentageToClose: number, slippage: number, poolAddress: string) => Promise<string>;
|
|
@@ -30268,12 +30268,13 @@ var getWithdrawSpotHyperliquidTxData = function getWithdrawSpotHyperliquidTxData
|
|
|
30268
30268
|
var rawTXData = ethers.ethers.utils.solidityPack(["uint8", "uint24", "bytes"], [HYPERLIQUID_VERSION, SPOT_SEND_ACTION, innerEncoded]);
|
|
30269
30269
|
return coreWriter.encodeFunctionData("sendRawAction", [rawTXData]);
|
|
30270
30270
|
};
|
|
30271
|
-
var
|
|
30272
|
-
|
|
30273
|
-
//
|
|
30271
|
+
var getSendAssetHyperliquidTxData = function getSendAssetHyperliquidTxData(sourceDex, destinationDex, receiver, amount) {
|
|
30272
|
+
// Convert 6-decimal EVM USDC to 8-decimal HyperCore USDC (spot, main perp, and xyz)
|
|
30273
|
+
// Transfer USDC between dexes (perp, spot, xyz)
|
|
30274
|
+
var coreAmount = ethers.ethers.BigNumber.from(amount).mul(100); //From Perp to Spot
|
|
30274
30275
|
|
|
30275
30276
|
var innerEncoded = ethers.ethers.utils.defaultAbiCoder.encode( //destination, subAccount, sourceDex, destinationDex, token, amount
|
|
30276
|
-
["address", "address", "uint32", "uint32", "uint64", "uint64"], [receiver, ethers.ethers.constants.AddressZero,
|
|
30277
|
+
["address", "address", "uint32", "uint32", "uint64", "uint64"], [receiver, ethers.ethers.constants.AddressZero, sourceDex, destinationDex, USDC_TOKEN_ID, coreAmount]);
|
|
30277
30278
|
var rawTXData = ethers.ethers.utils.solidityPack(["uint8", "uint24", "bytes"], [HYPERLIQUID_VERSION, SEND_ASSET_ACTION, innerEncoded]);
|
|
30278
30279
|
return coreWriter.encodeFunctionData("sendRawAction", [rawTXData]);
|
|
30279
30280
|
};
|
|
@@ -34066,7 +34067,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34066
34067
|
}
|
|
34067
34068
|
|
|
34068
34069
|
_context60.next = 4;
|
|
34069
|
-
return getPoolTxOrGasEstimate(this, [CORE_WRITER_ADDRESS,
|
|
34070
|
+
return getPoolTxOrGasEstimate(this, [CORE_WRITER_ADDRESS, getSendAssetHyperliquidTxData(dexId, SPOT_DEX_ID, this.address, amount), options], sdkOptions);
|
|
34070
34071
|
|
|
34071
34072
|
case 4:
|
|
34072
34073
|
tx = _context60.sent;
|
|
@@ -34086,20 +34087,22 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34086
34087
|
|
|
34087
34088
|
return perpToSpotHyperliquid;
|
|
34088
34089
|
}()
|
|
34089
|
-
/**
|
|
34090
|
-
* USDC must be in the Spot wallet first — use perpToSpotHyperliquid() to move it from a trading dex.
|
|
34090
|
+
/** Move USDC from HyperCore spot wallet to a trading dex.
|
|
34091
34091
|
*
|
|
34092
|
-
* @param {
|
|
34092
|
+
* @param {number} dexId Destination dex ID where USDC will be moved to
|
|
34093
|
+
* - 0: Core Perp dex (standard perps like BTC, ETH)
|
|
34094
|
+
* - 1: xyz HIP-3 dex (builder perps like TSLA, GOLD)
|
|
34095
|
+
* @param {BigNumber | string} amount USDC amount to transfer (6 decimals, e.g. "1000000" = 1 USDC)
|
|
34093
34096
|
* @param {any} options Transaction options
|
|
34094
34097
|
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
34095
34098
|
* @returns {Promise<any>} Transaction
|
|
34096
34099
|
*/
|
|
34097
34100
|
;
|
|
34098
34101
|
|
|
34099
|
-
_proto.
|
|
34102
|
+
_proto.spotToPerpHyperliquid =
|
|
34100
34103
|
/*#__PURE__*/
|
|
34101
34104
|
function () {
|
|
34102
|
-
var
|
|
34105
|
+
var _spotToPerpHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee61(dexId, amount, options, sdkOptions) {
|
|
34103
34106
|
var tx;
|
|
34104
34107
|
return runtime_1.wrap(function _callee61$(_context61) {
|
|
34105
34108
|
while (1) {
|
|
@@ -34116,7 +34119,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34116
34119
|
}
|
|
34117
34120
|
|
|
34118
34121
|
_context61.next = 4;
|
|
34119
|
-
return getPoolTxOrGasEstimate(this, [CORE_WRITER_ADDRESS,
|
|
34122
|
+
return getPoolTxOrGasEstimate(this, [CORE_WRITER_ADDRESS, getSendAssetHyperliquidTxData(SPOT_DEX_ID, dexId, this.address, amount), options], sdkOptions);
|
|
34120
34123
|
|
|
34121
34124
|
case 4:
|
|
34122
34125
|
tx = _context61.sent;
|
|
@@ -34130,7 +34133,57 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34130
34133
|
}, _callee61, this);
|
|
34131
34134
|
}));
|
|
34132
34135
|
|
|
34133
|
-
function
|
|
34136
|
+
function spotToPerpHyperliquid(_x287, _x288, _x289, _x290) {
|
|
34137
|
+
return _spotToPerpHyperliquid.apply(this, arguments);
|
|
34138
|
+
}
|
|
34139
|
+
|
|
34140
|
+
return spotToPerpHyperliquid;
|
|
34141
|
+
}()
|
|
34142
|
+
/** Withdraw USDC from Hyperliquid Spot wallet back to EVM.
|
|
34143
|
+
* USDC must be in the Spot wallet first — use perpToSpotHyperliquid() to move it from a trading dex.
|
|
34144
|
+
*
|
|
34145
|
+
* @param {BigNumber | string} amount USDC amount to withdraw (6 decimals, e.g. "1000000" = 1 USDC)
|
|
34146
|
+
* @param {any} options Transaction options
|
|
34147
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
34148
|
+
* @returns {Promise<any>} Transaction
|
|
34149
|
+
*/
|
|
34150
|
+
;
|
|
34151
|
+
|
|
34152
|
+
_proto.withdrawHyperliquid =
|
|
34153
|
+
/*#__PURE__*/
|
|
34154
|
+
function () {
|
|
34155
|
+
var _withdrawHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee62(amount, options, sdkOptions) {
|
|
34156
|
+
var tx;
|
|
34157
|
+
return runtime_1.wrap(function _callee62$(_context62) {
|
|
34158
|
+
while (1) {
|
|
34159
|
+
switch (_context62.prev = _context62.next) {
|
|
34160
|
+
case 0:
|
|
34161
|
+
if (options === void 0) {
|
|
34162
|
+
options = null;
|
|
34163
|
+
}
|
|
34164
|
+
|
|
34165
|
+
if (sdkOptions === void 0) {
|
|
34166
|
+
sdkOptions = {
|
|
34167
|
+
estimateGas: false
|
|
34168
|
+
};
|
|
34169
|
+
}
|
|
34170
|
+
|
|
34171
|
+
_context62.next = 4;
|
|
34172
|
+
return getPoolTxOrGasEstimate(this, [CORE_WRITER_ADDRESS, getWithdrawSpotHyperliquidTxData(amount), options], sdkOptions);
|
|
34173
|
+
|
|
34174
|
+
case 4:
|
|
34175
|
+
tx = _context62.sent;
|
|
34176
|
+
return _context62.abrupt("return", tx);
|
|
34177
|
+
|
|
34178
|
+
case 6:
|
|
34179
|
+
case "end":
|
|
34180
|
+
return _context62.stop();
|
|
34181
|
+
}
|
|
34182
|
+
}
|
|
34183
|
+
}, _callee62, this);
|
|
34184
|
+
}));
|
|
34185
|
+
|
|
34186
|
+
function withdrawHyperliquid(_x291, _x292, _x293) {
|
|
34134
34187
|
return _withdrawHyperliquid.apply(this, arguments);
|
|
34135
34188
|
}
|
|
34136
34189
|
|
|
@@ -34151,11 +34204,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34151
34204
|
_proto.openMarketOrderHyperliquid =
|
|
34152
34205
|
/*#__PURE__*/
|
|
34153
34206
|
function () {
|
|
34154
|
-
var _openMarketOrderHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34207
|
+
var _openMarketOrderHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee63(assetId, isLong, value, slippage, options, sdkOptions) {
|
|
34155
34208
|
var tx;
|
|
34156
|
-
return runtime_1.wrap(function
|
|
34209
|
+
return runtime_1.wrap(function _callee63$(_context63) {
|
|
34157
34210
|
while (1) {
|
|
34158
|
-
switch (
|
|
34211
|
+
switch (_context63.prev = _context63.next) {
|
|
34159
34212
|
case 0:
|
|
34160
34213
|
if (slippage === void 0) {
|
|
34161
34214
|
slippage = 0.5;
|
|
@@ -34171,33 +34224,33 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34171
34224
|
};
|
|
34172
34225
|
}
|
|
34173
34226
|
|
|
34174
|
-
|
|
34175
|
-
|
|
34176
|
-
|
|
34177
|
-
|
|
34227
|
+
_context63.t0 = getPoolTxOrGasEstimate;
|
|
34228
|
+
_context63.t1 = this;
|
|
34229
|
+
_context63.t2 = CORE_WRITER_ADDRESS;
|
|
34230
|
+
_context63.next = 8;
|
|
34178
34231
|
return getLimitOrderHyperliquidTxData(assetId, isLong, value, slippage);
|
|
34179
34232
|
|
|
34180
34233
|
case 8:
|
|
34181
|
-
|
|
34182
|
-
|
|
34183
|
-
|
|
34184
|
-
|
|
34185
|
-
|
|
34186
|
-
return (0,
|
|
34234
|
+
_context63.t3 = _context63.sent;
|
|
34235
|
+
_context63.t4 = options;
|
|
34236
|
+
_context63.t5 = [_context63.t2, _context63.t3, _context63.t4];
|
|
34237
|
+
_context63.t6 = sdkOptions;
|
|
34238
|
+
_context63.next = 14;
|
|
34239
|
+
return (0, _context63.t0)(_context63.t1, _context63.t5, _context63.t6);
|
|
34187
34240
|
|
|
34188
34241
|
case 14:
|
|
34189
|
-
tx =
|
|
34190
|
-
return
|
|
34242
|
+
tx = _context63.sent;
|
|
34243
|
+
return _context63.abrupt("return", tx);
|
|
34191
34244
|
|
|
34192
34245
|
case 16:
|
|
34193
34246
|
case "end":
|
|
34194
|
-
return
|
|
34247
|
+
return _context63.stop();
|
|
34195
34248
|
}
|
|
34196
34249
|
}
|
|
34197
|
-
},
|
|
34250
|
+
}, _callee63, this);
|
|
34198
34251
|
}));
|
|
34199
34252
|
|
|
34200
|
-
function openMarketOrderHyperliquid(
|
|
34253
|
+
function openMarketOrderHyperliquid(_x294, _x295, _x296, _x297, _x298, _x299) {
|
|
34201
34254
|
return _openMarketOrderHyperliquid.apply(this, arguments);
|
|
34202
34255
|
}
|
|
34203
34256
|
|
|
@@ -34216,11 +34269,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34216
34269
|
_proto.closePositionHyperliquid =
|
|
34217
34270
|
/*#__PURE__*/
|
|
34218
34271
|
function () {
|
|
34219
|
-
var _closePositionHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34272
|
+
var _closePositionHyperliquid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee64(assetId, percentageToClose, slippage, options, sdkOptions) {
|
|
34220
34273
|
var tx;
|
|
34221
|
-
return runtime_1.wrap(function
|
|
34274
|
+
return runtime_1.wrap(function _callee64$(_context64) {
|
|
34222
34275
|
while (1) {
|
|
34223
|
-
switch (
|
|
34276
|
+
switch (_context64.prev = _context64.next) {
|
|
34224
34277
|
case 0:
|
|
34225
34278
|
if (percentageToClose === void 0) {
|
|
34226
34279
|
percentageToClose = 100;
|
|
@@ -34240,33 +34293,33 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34240
34293
|
};
|
|
34241
34294
|
}
|
|
34242
34295
|
|
|
34243
|
-
|
|
34244
|
-
|
|
34245
|
-
|
|
34246
|
-
|
|
34296
|
+
_context64.t0 = getPoolTxOrGasEstimate;
|
|
34297
|
+
_context64.t1 = this;
|
|
34298
|
+
_context64.t2 = CORE_WRITER_ADDRESS;
|
|
34299
|
+
_context64.next = 9;
|
|
34247
34300
|
return getClosePositionHyperliquidTxData(assetId, percentageToClose, slippage, this.address);
|
|
34248
34301
|
|
|
34249
34302
|
case 9:
|
|
34250
|
-
|
|
34251
|
-
|
|
34252
|
-
|
|
34253
|
-
|
|
34254
|
-
|
|
34255
|
-
return (0,
|
|
34303
|
+
_context64.t3 = _context64.sent;
|
|
34304
|
+
_context64.t4 = options;
|
|
34305
|
+
_context64.t5 = [_context64.t2, _context64.t3, _context64.t4];
|
|
34306
|
+
_context64.t6 = sdkOptions;
|
|
34307
|
+
_context64.next = 15;
|
|
34308
|
+
return (0, _context64.t0)(_context64.t1, _context64.t5, _context64.t6);
|
|
34256
34309
|
|
|
34257
34310
|
case 15:
|
|
34258
|
-
tx =
|
|
34259
|
-
return
|
|
34311
|
+
tx = _context64.sent;
|
|
34312
|
+
return _context64.abrupt("return", tx);
|
|
34260
34313
|
|
|
34261
34314
|
case 17:
|
|
34262
34315
|
case "end":
|
|
34263
|
-
return
|
|
34316
|
+
return _context64.stop();
|
|
34264
34317
|
}
|
|
34265
34318
|
}
|
|
34266
|
-
},
|
|
34319
|
+
}, _callee64, this);
|
|
34267
34320
|
}));
|
|
34268
34321
|
|
|
34269
|
-
function closePositionHyperliquid(
|
|
34322
|
+
function closePositionHyperliquid(_x300, _x301, _x302, _x303, _x304) {
|
|
34270
34323
|
return _closePositionHyperliquid.apply(this, arguments);
|
|
34271
34324
|
}
|
|
34272
34325
|
|
|
@@ -34286,11 +34339,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34286
34339
|
_proto.approveTorosLimitOrder =
|
|
34287
34340
|
/*#__PURE__*/
|
|
34288
34341
|
function () {
|
|
34289
|
-
var _approveTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34342
|
+
var _approveTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee65(vaultAddress, amount, options, sdkOptions) {
|
|
34290
34343
|
var managerAddress, iERC20, approveTxData;
|
|
34291
|
-
return runtime_1.wrap(function
|
|
34344
|
+
return runtime_1.wrap(function _callee65$(_context65) {
|
|
34292
34345
|
while (1) {
|
|
34293
|
-
switch (
|
|
34346
|
+
switch (_context65.prev = _context65.next) {
|
|
34294
34347
|
case 0:
|
|
34295
34348
|
if (options === void 0) {
|
|
34296
34349
|
options = null;
|
|
@@ -34305,17 +34358,17 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34305
34358
|
managerAddress = limitOrderAddress[this.network];
|
|
34306
34359
|
iERC20 = new ethers.ethers.utils.Interface(IERC20.abi);
|
|
34307
34360
|
approveTxData = iERC20.encodeFunctionData("approve", [managerAddress, amount]);
|
|
34308
|
-
return
|
|
34361
|
+
return _context65.abrupt("return", getPoolTxOrGasEstimate(this, [vaultAddress, approveTxData, options], sdkOptions));
|
|
34309
34362
|
|
|
34310
34363
|
case 6:
|
|
34311
34364
|
case "end":
|
|
34312
|
-
return
|
|
34365
|
+
return _context65.stop();
|
|
34313
34366
|
}
|
|
34314
34367
|
}
|
|
34315
|
-
},
|
|
34368
|
+
}, _callee65, this);
|
|
34316
34369
|
}));
|
|
34317
34370
|
|
|
34318
|
-
function approveTorosLimitOrder(
|
|
34371
|
+
function approveTorosLimitOrder(_x305, _x306, _x307, _x308) {
|
|
34319
34372
|
return _approveTorosLimitOrder.apply(this, arguments);
|
|
34320
34373
|
}
|
|
34321
34374
|
|
|
@@ -34337,11 +34390,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34337
34390
|
_proto.createTorosLimitOrder =
|
|
34338
34391
|
/*#__PURE__*/
|
|
34339
34392
|
function () {
|
|
34340
|
-
var _createTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34393
|
+
var _createTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee66(vaultAddress, amount, stopLossPriceD18, takeProfitPriceD18, pricingAsset, options, sdkOptions) {
|
|
34341
34394
|
var managerAddress, resolvedStopLoss, resolvedTakeProfit, info, txData;
|
|
34342
|
-
return runtime_1.wrap(function
|
|
34395
|
+
return runtime_1.wrap(function _callee66$(_context66) {
|
|
34343
34396
|
while (1) {
|
|
34344
|
-
switch (
|
|
34397
|
+
switch (_context66.prev = _context66.next) {
|
|
34345
34398
|
case 0:
|
|
34346
34399
|
if (options === void 0) {
|
|
34347
34400
|
options = null;
|
|
@@ -34356,7 +34409,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34356
34409
|
managerAddress = limitOrderAddress[this.network];
|
|
34357
34410
|
|
|
34358
34411
|
if (managerAddress) {
|
|
34359
|
-
|
|
34412
|
+
_context66.next = 5;
|
|
34360
34413
|
break;
|
|
34361
34414
|
}
|
|
34362
34415
|
|
|
@@ -34374,17 +34427,17 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34374
34427
|
pricingAsset: pricingAsset
|
|
34375
34428
|
};
|
|
34376
34429
|
txData = getCreateLimitOrderTxData(info);
|
|
34377
|
-
return
|
|
34430
|
+
return _context66.abrupt("return", getPoolTxOrGasEstimate(this, [managerAddress, txData, options], sdkOptions));
|
|
34378
34431
|
|
|
34379
34432
|
case 10:
|
|
34380
34433
|
case "end":
|
|
34381
|
-
return
|
|
34434
|
+
return _context66.stop();
|
|
34382
34435
|
}
|
|
34383
34436
|
}
|
|
34384
|
-
},
|
|
34437
|
+
}, _callee66, this);
|
|
34385
34438
|
}));
|
|
34386
34439
|
|
|
34387
|
-
function createTorosLimitOrder(
|
|
34440
|
+
function createTorosLimitOrder(_x309, _x310, _x311, _x312, _x313, _x314, _x315) {
|
|
34388
34441
|
return _createTorosLimitOrder.apply(this, arguments);
|
|
34389
34442
|
}
|
|
34390
34443
|
|
|
@@ -34406,11 +34459,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34406
34459
|
_proto.modifyTorosLimitOrder =
|
|
34407
34460
|
/*#__PURE__*/
|
|
34408
34461
|
function () {
|
|
34409
|
-
var _modifyTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34462
|
+
var _modifyTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee67(vaultAddress, amount, stopLossPriceD18, takeProfitPriceD18, pricingAsset, options, sdkOptions) {
|
|
34410
34463
|
var managerAddress, resolvedStopLoss, resolvedTakeProfit, info, txData;
|
|
34411
|
-
return runtime_1.wrap(function
|
|
34464
|
+
return runtime_1.wrap(function _callee67$(_context67) {
|
|
34412
34465
|
while (1) {
|
|
34413
|
-
switch (
|
|
34466
|
+
switch (_context67.prev = _context67.next) {
|
|
34414
34467
|
case 0:
|
|
34415
34468
|
if (options === void 0) {
|
|
34416
34469
|
options = null;
|
|
@@ -34425,7 +34478,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34425
34478
|
managerAddress = limitOrderAddress[this.network];
|
|
34426
34479
|
|
|
34427
34480
|
if (managerAddress) {
|
|
34428
|
-
|
|
34481
|
+
_context67.next = 5;
|
|
34429
34482
|
break;
|
|
34430
34483
|
}
|
|
34431
34484
|
|
|
@@ -34443,17 +34496,17 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34443
34496
|
pricingAsset: pricingAsset
|
|
34444
34497
|
};
|
|
34445
34498
|
txData = getModifyLimitOrderTxData(info);
|
|
34446
|
-
return
|
|
34499
|
+
return _context67.abrupt("return", getPoolTxOrGasEstimate(this, [managerAddress, txData, options], sdkOptions));
|
|
34447
34500
|
|
|
34448
34501
|
case 10:
|
|
34449
34502
|
case "end":
|
|
34450
|
-
return
|
|
34503
|
+
return _context67.stop();
|
|
34451
34504
|
}
|
|
34452
34505
|
}
|
|
34453
|
-
},
|
|
34506
|
+
}, _callee67, this);
|
|
34454
34507
|
}));
|
|
34455
34508
|
|
|
34456
|
-
function modifyTorosLimitOrder(
|
|
34509
|
+
function modifyTorosLimitOrder(_x316, _x317, _x318, _x319, _x320, _x321, _x322) {
|
|
34457
34510
|
return _modifyTorosLimitOrder.apply(this, arguments);
|
|
34458
34511
|
}
|
|
34459
34512
|
|
|
@@ -34471,11 +34524,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34471
34524
|
_proto.deleteTorosLimitOrder =
|
|
34472
34525
|
/*#__PURE__*/
|
|
34473
34526
|
function () {
|
|
34474
|
-
var _deleteTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34527
|
+
var _deleteTorosLimitOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee68(vaultAddress, options, sdkOptions) {
|
|
34475
34528
|
var managerAddress, txData;
|
|
34476
|
-
return runtime_1.wrap(function
|
|
34529
|
+
return runtime_1.wrap(function _callee68$(_context68) {
|
|
34477
34530
|
while (1) {
|
|
34478
|
-
switch (
|
|
34531
|
+
switch (_context68.prev = _context68.next) {
|
|
34479
34532
|
case 0:
|
|
34480
34533
|
if (options === void 0) {
|
|
34481
34534
|
options = null;
|
|
@@ -34490,7 +34543,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34490
34543
|
managerAddress = limitOrderAddress[this.network];
|
|
34491
34544
|
|
|
34492
34545
|
if (managerAddress) {
|
|
34493
|
-
|
|
34546
|
+
_context68.next = 5;
|
|
34494
34547
|
break;
|
|
34495
34548
|
}
|
|
34496
34549
|
|
|
@@ -34498,17 +34551,17 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34498
34551
|
|
|
34499
34552
|
case 5:
|
|
34500
34553
|
txData = getDeleteLimitOrderTxData(vaultAddress);
|
|
34501
|
-
return
|
|
34554
|
+
return _context68.abrupt("return", getPoolTxOrGasEstimate(this, [managerAddress, txData, options], sdkOptions));
|
|
34502
34555
|
|
|
34503
34556
|
case 7:
|
|
34504
34557
|
case "end":
|
|
34505
|
-
return
|
|
34558
|
+
return _context68.stop();
|
|
34506
34559
|
}
|
|
34507
34560
|
}
|
|
34508
|
-
},
|
|
34561
|
+
}, _callee68, this);
|
|
34509
34562
|
}));
|
|
34510
34563
|
|
|
34511
|
-
function deleteTorosLimitOrder(
|
|
34564
|
+
function deleteTorosLimitOrder(_x323, _x324, _x325) {
|
|
34512
34565
|
return _deleteTorosLimitOrder.apply(this, arguments);
|
|
34513
34566
|
}
|
|
34514
34567
|
|
|
@@ -34525,22 +34578,22 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34525
34578
|
_proto.getTorosLimitOrder =
|
|
34526
34579
|
/*#__PURE__*/
|
|
34527
34580
|
function () {
|
|
34528
|
-
var _getTorosLimitOrder2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34529
|
-
return runtime_1.wrap(function
|
|
34581
|
+
var _getTorosLimitOrder2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee69(userAddress, vaultAddress) {
|
|
34582
|
+
return runtime_1.wrap(function _callee69$(_context69) {
|
|
34530
34583
|
while (1) {
|
|
34531
|
-
switch (
|
|
34584
|
+
switch (_context69.prev = _context69.next) {
|
|
34532
34585
|
case 0:
|
|
34533
|
-
return
|
|
34586
|
+
return _context69.abrupt("return", getTorosLimitOrder(this, userAddress, vaultAddress));
|
|
34534
34587
|
|
|
34535
34588
|
case 1:
|
|
34536
34589
|
case "end":
|
|
34537
|
-
return
|
|
34590
|
+
return _context69.stop();
|
|
34538
34591
|
}
|
|
34539
34592
|
}
|
|
34540
|
-
},
|
|
34593
|
+
}, _callee69, this);
|
|
34541
34594
|
}));
|
|
34542
34595
|
|
|
34543
|
-
function getTorosLimitOrder$1(
|
|
34596
|
+
function getTorosLimitOrder$1(_x326, _x327) {
|
|
34544
34597
|
return _getTorosLimitOrder2.apply(this, arguments);
|
|
34545
34598
|
}
|
|
34546
34599
|
|
|
@@ -34557,22 +34610,22 @@ var Pool = /*#__PURE__*/function () {
|
|
|
34557
34610
|
_proto.hasActiveTorosLimitOrder =
|
|
34558
34611
|
/*#__PURE__*/
|
|
34559
34612
|
function () {
|
|
34560
|
-
var _hasActiveTorosLimitOrder2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
34561
|
-
return runtime_1.wrap(function
|
|
34613
|
+
var _hasActiveTorosLimitOrder2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee70(userAddress, vaultAddress) {
|
|
34614
|
+
return runtime_1.wrap(function _callee70$(_context70) {
|
|
34562
34615
|
while (1) {
|
|
34563
|
-
switch (
|
|
34616
|
+
switch (_context70.prev = _context70.next) {
|
|
34564
34617
|
case 0:
|
|
34565
|
-
return
|
|
34618
|
+
return _context70.abrupt("return", hasActiveTorosLimitOrder(this, userAddress, vaultAddress));
|
|
34566
34619
|
|
|
34567
34620
|
case 1:
|
|
34568
34621
|
case "end":
|
|
34569
|
-
return
|
|
34622
|
+
return _context70.stop();
|
|
34570
34623
|
}
|
|
34571
34624
|
}
|
|
34572
|
-
},
|
|
34625
|
+
}, _callee70, this);
|
|
34573
34626
|
}));
|
|
34574
34627
|
|
|
34575
|
-
function hasActiveTorosLimitOrder$1(
|
|
34628
|
+
function hasActiveTorosLimitOrder$1(_x328, _x329) {
|
|
34576
34629
|
return _hasActiveTorosLimitOrder2.apply(this, arguments);
|
|
34577
34630
|
}
|
|
34578
34631
|
|