@dhedge/v2-sdk 1.8.0 → 1.8.2

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.
@@ -9643,8 +9643,6 @@ function _getEasySwapperTxData() {
9643
9643
  return _getEasySwapperTxData.apply(this, arguments);
9644
9644
  }
9645
9645
 
9646
- var excludedProtocols = ["OPTIMISM_PMM6"]; //Clipper
9647
-
9648
9646
  function getOneInchProtocols(_x) {
9649
9647
  return _getOneInchProtocols.apply(this, arguments);
9650
9648
  }
@@ -9666,7 +9664,7 @@ function _getOneInchProtocols() {
9666
9664
  return e.id;
9667
9665
  });
9668
9666
  filteredProtocols = protocols.filter(function (e) {
9669
- return !excludedProtocols.includes(e);
9667
+ return !e.includes("PMM");
9670
9668
  });
9671
9669
  return _context.abrupt("return", "&protocols=" + filteredProtocols.join(","));
9672
9670
 
@@ -19145,11 +19143,38 @@ function getFuturesChangeMarginTxData(amount) {
19145
19143
  return new ethers.utils.Interface(ISynthetixFuturesMarketV2.abi).encodeFunctionData("transferMargin", [amount]);
19146
19144
  }
19147
19145
 
19148
- var PRICE_IMPACT_DELTA = /*#__PURE__*/BigNumber.from("500000000000000000");
19149
19146
  var FUTURES_TRACKING = "DHEDGE";
19150
19147
 
19151
- function getFuturesChangePositionTxData(amount) {
19152
- return new ethers.utils.Interface(ISynthetixFuturesMarketV2.abi).encodeFunctionData("submitOffchainDelayedOrderWithTracking", [amount, PRICE_IMPACT_DELTA, ethers.utils.formatBytes32String(FUTURES_TRACKING)]);
19148
+ function getFuturesChangePositionTxData(_x, _x2, _x3) {
19149
+ return _getFuturesChangePositionTxData.apply(this, arguments);
19150
+ }
19151
+
19152
+ function _getFuturesChangePositionTxData() {
19153
+ _getFuturesChangePositionTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(amount, market, pool) {
19154
+ var futuresMarket, fillPrice, adjustmentFactor, desiredFillPrice;
19155
+ return runtime_1.wrap(function _callee$(_context) {
19156
+ while (1) {
19157
+ switch (_context.prev = _context.next) {
19158
+ case 0:
19159
+ futuresMarket = new ethers.Contract(market, ISynthetixFuturesMarketV2.abi, pool.signer);
19160
+ _context.next = 3;
19161
+ return futuresMarket.fillPrice(amount);
19162
+
19163
+ case 3:
19164
+ fillPrice = _context.sent;
19165
+ //Allows for +-0.5% price movements on the desired fill price
19166
+ adjustmentFactor = ethers.BigNumber.from(amount).lt(0) ? 995 : 1005;
19167
+ desiredFillPrice = fillPrice.price.mul(adjustmentFactor).div(1000);
19168
+ return _context.abrupt("return", new ethers.utils.Interface(ISynthetixFuturesMarketV2.abi).encodeFunctionData("submitOffchainDelayedOrderWithTracking", [amount, desiredFillPrice, ethers.utils.formatBytes32String(FUTURES_TRACKING)]));
19169
+
19170
+ case 7:
19171
+ case "end":
19172
+ return _context.stop();
19173
+ }
19174
+ }
19175
+ }, _callee);
19176
+ }));
19177
+ return _getFuturesChangePositionTxData.apply(this, arguments);
19153
19178
  }
19154
19179
 
19155
19180
  var Pool = /*#__PURE__*/function () {
@@ -21153,7 +21178,7 @@ var Pool = /*#__PURE__*/function () {
21153
21178
  /*#__PURE__*/
21154
21179
  function () {
21155
21180
  var _changeFuturesPosition = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee37(market, changeAmount, options) {
21156
- var tx;
21181
+ var txData, tx;
21157
21182
  return runtime_1.wrap(function _callee37$(_context37) {
21158
21183
  while (1) {
21159
21184
  switch (_context37.prev = _context37.next) {
@@ -21163,13 +21188,18 @@ var Pool = /*#__PURE__*/function () {
21163
21188
  }
21164
21189
 
21165
21190
  _context37.next = 3;
21166
- return this.poolLogic.execTransaction(market, getFuturesChangePositionTxData(changeAmount), options);
21191
+ return getFuturesChangePositionTxData(changeAmount, market, this);
21167
21192
 
21168
21193
  case 3:
21194
+ txData = _context37.sent;
21195
+ _context37.next = 6;
21196
+ return this.poolLogic.execTransaction(market, txData, options);
21197
+
21198
+ case 6:
21169
21199
  tx = _context37.sent;
21170
21200
  return _context37.abrupt("return", tx);
21171
21201
 
21172
- case 5:
21202
+ case 8:
21173
21203
  case "end":
21174
21204
  return _context37.stop();
21175
21205
  }