@dhedge/v2-sdk 1.9.0 → 1.9.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.
@@ -7,12 +7,12 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
7
7
  var ethers = require('ethers');
8
8
  var Lyra = require('@lyrafinance/lyra-js');
9
9
  var Lyra__default = _interopDefault(Lyra);
10
- var axios = _interopDefault(require('axios'));
11
10
  var sdkCore = require('@uniswap/sdk-core');
12
11
  var v3Sdk = require('@uniswap/v3-sdk');
13
12
  var JSBI = _interopDefault(require('jsbi'));
14
13
  require('lodash/set');
15
14
  require('@ethersproject/abi');
15
+ var axios = _interopDefault(require('axios'));
16
16
  var sdk = require('@sushiswap/sdk');
17
17
  var sor = require('@balancer-labs/sor');
18
18
 
@@ -52,6 +52,105 @@ function _asyncToGenerator(fn) {
52
52
  };
53
53
  }
54
54
 
55
+ function _inheritsLoose(subClass, superClass) {
56
+ subClass.prototype = Object.create(superClass.prototype);
57
+ subClass.prototype.constructor = subClass;
58
+
59
+ _setPrototypeOf(subClass, superClass);
60
+ }
61
+
62
+ function _getPrototypeOf(o) {
63
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
64
+ return o.__proto__ || Object.getPrototypeOf(o);
65
+ };
66
+ return _getPrototypeOf(o);
67
+ }
68
+
69
+ function _setPrototypeOf(o, p) {
70
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
71
+ o.__proto__ = p;
72
+ return o;
73
+ };
74
+
75
+ return _setPrototypeOf(o, p);
76
+ }
77
+
78
+ function _isNativeReflectConstruct() {
79
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
80
+ if (Reflect.construct.sham) return false;
81
+ if (typeof Proxy === "function") return true;
82
+
83
+ try {
84
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
85
+ return true;
86
+ } catch (e) {
87
+ return false;
88
+ }
89
+ }
90
+
91
+ function _construct(Parent, args, Class) {
92
+ if (_isNativeReflectConstruct()) {
93
+ _construct = Reflect.construct;
94
+ } else {
95
+ _construct = function _construct(Parent, args, Class) {
96
+ var a = [null];
97
+ a.push.apply(a, args);
98
+ var Constructor = Function.bind.apply(Parent, a);
99
+ var instance = new Constructor();
100
+ if (Class) _setPrototypeOf(instance, Class.prototype);
101
+ return instance;
102
+ };
103
+ }
104
+
105
+ return _construct.apply(null, arguments);
106
+ }
107
+
108
+ function _isNativeFunction(fn) {
109
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
110
+ }
111
+
112
+ function _wrapNativeSuper(Class) {
113
+ var _cache = typeof Map === "function" ? new Map() : undefined;
114
+
115
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
116
+ if (Class === null || !_isNativeFunction(Class)) return Class;
117
+
118
+ if (typeof Class !== "function") {
119
+ throw new TypeError("Super expression must either be null or a function");
120
+ }
121
+
122
+ if (typeof _cache !== "undefined") {
123
+ if (_cache.has(Class)) return _cache.get(Class);
124
+
125
+ _cache.set(Class, Wrapper);
126
+ }
127
+
128
+ function Wrapper() {
129
+ return _construct(Class, arguments, _getPrototypeOf(this).constructor);
130
+ }
131
+
132
+ Wrapper.prototype = Object.create(Class.prototype, {
133
+ constructor: {
134
+ value: Wrapper,
135
+ enumerable: false,
136
+ writable: true,
137
+ configurable: true
138
+ }
139
+ });
140
+ return _setPrototypeOf(Wrapper, Class);
141
+ };
142
+
143
+ return _wrapNativeSuper(Class);
144
+ }
145
+
146
+ function _assertThisInitialized(self) {
147
+ if (self === void 0) {
148
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
149
+ }
150
+
151
+ return self;
152
+ }
153
+
55
154
  function createCommonjsModule(fn, module) {
56
155
  return module = { exports: {} }, fn(module, module.exports), module.exports;
57
156
  }
@@ -3822,7 +3921,9 @@ var ManagerLogic = {
3822
3921
  Dapp["ARRAKIS"] = "arrakis";
3823
3922
  Dapp["TOROS"] = "toros";
3824
3923
  Dapp["VELODROME"] = "velodrome";
3924
+ Dapp["VELODROMEV2"] = "velodromeV2";
3825
3925
  Dapp["LYRA"] = "lyra";
3926
+ Dapp["ZEROEX"] = "0x";
3826
3927
  })(exports.Dapp || (exports.Dapp = {}));
3827
3928
 
3828
3929
  (function (Transaction) {
@@ -3852,7 +3953,7 @@ var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _Network$ARBITRUM, _ro
3852
3953
  require("dotenv").config();
3853
3954
 
3854
3955
  var factoryAddress = (_factoryAddress = {}, _factoryAddress[exports.Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress[exports.Network.OPTIMISM] = "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", _factoryAddress[exports.Network.ARBITRUM] = "0xfffb5fb14606eb3a548c113026355020ddf27535", _factoryAddress);
3855
- var routerAddress = (_routerAddress = {}, _routerAddress[exports.Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[exports.Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[exports.Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[exports.Dapp.ARRAKIS] = "0xc73fb100a995b33f9fa181d420f4c8d74506df66", _Network$POLYGON[exports.Dapp.TOROS] = "0xB2F1498983bf9c9442c35F772e6C1AdE66a8DeDE", _Network$POLYGON), _routerAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[exports.Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$OPTIMISM[exports.Dapp.TOROS] = "0x3988513793bCE39f0167064A9F7fC3617FaF35AB", _Network$OPTIMISM[exports.Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM[exports.Dapp.LYRA] = "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B", _Network$OPTIMISM[exports.Dapp.ARRAKIS] = "0x9ce88a56d120300061593eF7AD074A1B710094d5", _Network$OPTIMISM), _routerAddress[exports.Network.ARBITRUM] = (_Network$ARBITRUM = {}, _Network$ARBITRUM[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$ARBITRUM[exports.Dapp.UNISWAPV3] = "0xe592427a0aece92de3edee1f18e0157c05861564", _Network$ARBITRUM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$ARBITRUM[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$ARBITRUM), _routerAddress);
3956
+ var routerAddress = (_routerAddress = {}, _routerAddress[exports.Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[exports.Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[exports.Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[exports.Dapp.ARRAKIS] = "0xc73fb100a995b33f9fa181d420f4c8d74506df66", _Network$POLYGON[exports.Dapp.TOROS] = "0xB2F1498983bf9c9442c35F772e6C1AdE66a8DeDE", _Network$POLYGON[exports.Dapp.ZEROEX] = "0xdef1c0ded9bec7f1a1670819833240f027b25eff", _Network$POLYGON), _routerAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[exports.Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$OPTIMISM[exports.Dapp.TOROS] = "0x3988513793bCE39f0167064A9F7fC3617FaF35AB", _Network$OPTIMISM[exports.Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM[exports.Dapp.VELODROMEV2] = "0xa062ae8a9c5e11aaa026fc2670b0d65ccc8b2858", _Network$OPTIMISM[exports.Dapp.LYRA] = "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B", _Network$OPTIMISM[exports.Dapp.ARRAKIS] = "0x9ce88a56d120300061593eF7AD074A1B710094d5", _Network$OPTIMISM[exports.Dapp.ZEROEX] = "0xdef1abe32c034e558cdd535791643c58a13acc10", _Network$OPTIMISM), _routerAddress[exports.Network.ARBITRUM] = (_Network$ARBITRUM = {}, _Network$ARBITRUM[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$ARBITRUM[exports.Dapp.UNISWAPV3] = "0xe592427a0aece92de3edee1f18e0157c05861564", _Network$ARBITRUM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$ARBITRUM[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$ARBITRUM), _routerAddress);
3856
3957
  var dappFactoryAddress = (_dappFactoryAddress = {}, _dappFactoryAddress[exports.Network.POLYGON] = (_Network$POLYGON2 = {}, _Network$POLYGON2[exports.Dapp.SUSHISWAP] = "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", _Network$POLYGON2[exports.Dapp.QUICKSWAP] = "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32", _Network$POLYGON2), _dappFactoryAddress[exports.Network.OPTIMISM] = {}, _dappFactoryAddress[exports.Network.ARBITRUM] = {}, _dappFactoryAddress);
3857
3958
  var stakingAddress = (_stakingAddress = {}, _stakingAddress[exports.Network.POLYGON] = (_Network$POLYGON3 = {}, _Network$POLYGON3[exports.Dapp.SUSHISWAP] = "0x0769fd68dFb93167989C6f7254cd0D766Fb2841F", _Network$POLYGON3[exports.Dapp.BALANCER] = "0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", _Network$POLYGON3[exports.Dapp.AAVE] = "0x357D51124f59836DeD84c8a1730D72B749d8BC23", _Network$POLYGON3[exports.Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$POLYGON3), _stakingAddress[exports.Network.OPTIMISM] = {}, _stakingAddress[exports.Network.ARBITRUM] = {}, _stakingAddress);
3858
3959
  var aaveAddressProvider = (_aaveAddressProvider = {}, _aaveAddressProvider[exports.Network.POLYGON] = (_Network$POLYGON4 = {}, _Network$POLYGON4[exports.Dapp.AAVE] = "0xd05e3E715d945B59290df0ae8eF85c1BdB684744", _Network$POLYGON4[exports.Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$POLYGON4), _aaveAddressProvider[exports.Network.OPTIMISM] = (_Network$OPTIMISM2 = {}, _Network$OPTIMISM2[exports.Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$OPTIMISM2), _aaveAddressProvider[exports.Network.ARBITRUM] = (_Network$ARBITRUM2 = {}, _Network$ARBITRUM2[exports.Dapp.AAVEV3] = "0xa97684ead0e402dc232d5a977953df7ecbab3cdb", _Network$ARBITRUM2), _aaveAddressProvider);
@@ -9649,46 +9750,6 @@ function _getEasySwapperTxData() {
9649
9750
  return _getEasySwapperTxData.apply(this, arguments);
9650
9751
  }
9651
9752
 
9652
- function getOneInchProtocols(_x) {
9653
- return _getOneInchProtocols.apply(this, arguments);
9654
- }
9655
-
9656
- function _getOneInchProtocols() {
9657
- _getOneInchProtocols = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(chainId) {
9658
- var response, protocols, filteredProtocols;
9659
- return runtime_1.wrap(function _callee$(_context) {
9660
- while (1) {
9661
- switch (_context.prev = _context.next) {
9662
- case 0:
9663
- _context.prev = 0;
9664
- _context.next = 3;
9665
- return axios.get("https://api.1inch.io/v5.0/" + chainId + "/liquidity-sources");
9666
-
9667
- case 3:
9668
- response = _context.sent;
9669
- protocols = response.data.protocols.map(function (e) {
9670
- return e.id;
9671
- });
9672
- filteredProtocols = protocols.filter(function (e) {
9673
- return !e.includes("PMM");
9674
- });
9675
- return _context.abrupt("return", "&protocols=" + filteredProtocols.join(","));
9676
-
9677
- case 9:
9678
- _context.prev = 9;
9679
- _context.t0 = _context["catch"](0);
9680
- return _context.abrupt("return", "");
9681
-
9682
- case 12:
9683
- case "end":
9684
- return _context.stop();
9685
- }
9686
- }
9687
- }, _callee, null, [[0, 9]]);
9688
- }));
9689
- return _getOneInchProtocols.apply(this, arguments);
9690
- }
9691
-
9692
9753
  var abi$i = [
9693
9754
  {
9694
9755
  inputs: [
@@ -14540,207 +14601,421 @@ var abi$l = [
14540
14601
  type: "function"
14541
14602
  }
14542
14603
  ];
14543
- var IVelodromeGauge = {
14604
+ var IVelodromeGaugeV1 = {
14544
14605
  abi: abi$l
14545
14606
  };
14546
14607
 
14547
- function call(_x, _x2, _x3, _x4) {
14548
- return _call.apply(this, arguments);
14549
- }
14550
-
14551
- function _call() {
14552
- _call = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(provider, abi, call, options) {
14553
- var contract, params;
14554
- return runtime_1.wrap(function _callee2$(_context2) {
14555
- while (1) {
14556
- switch (_context2.prev = _context2.next) {
14557
- case 0:
14558
- contract = new ethers.ethers.Contract(call[0], abi, provider);
14559
- _context2.prev = 1;
14560
- params = call[2] || [];
14561
- _context2.next = 5;
14562
- return contract[call[1]].apply(contract, params.concat([options || {}]));
14563
-
14564
- case 5:
14565
- return _context2.abrupt("return", _context2.sent);
14566
-
14567
- case 8:
14568
- _context2.prev = 8;
14569
- _context2.t0 = _context2["catch"](1);
14570
- return _context2.abrupt("return", Promise.reject(_context2.t0));
14571
-
14572
- case 11:
14573
- case "end":
14574
- return _context2.stop();
14575
- }
14576
- }
14577
- }, _callee2, null, [[1, 8]]);
14578
- }));
14579
- return _call.apply(this, arguments);
14580
- }
14581
-
14582
- var iVelodromeGauge = /*#__PURE__*/new ethers.ethers.utils.Interface(IVelodromeGauge.abi);
14583
- function getVelodromeStakeTxData(amount) {
14584
- return iVelodromeGauge.encodeFunctionData(exports.Transaction.DEPOSIT, [amount, "0"]);
14585
- }
14586
- function getVelodromeClaimTxData(_x, _x2) {
14587
- return _getVelodromeClaimTxData.apply(this, arguments);
14588
- }
14589
-
14590
- function _getVelodromeClaimTxData() {
14591
- _getVelodromeClaimTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, gauge) {
14592
- var rewardAssetCount, rewardAssets;
14593
- return runtime_1.wrap(function _callee$(_context) {
14594
- while (1) {
14595
- switch (_context.prev = _context.next) {
14596
- case 0:
14597
- _context.next = 2;
14598
- return call(pool.signer, IVelodromeGauge.abi, [gauge, "rewardsListLength", []]);
14599
-
14600
- case 2:
14601
- rewardAssetCount = _context.sent;
14602
- _context.next = 5;
14603
- return Promise.all(Array.from(Array(rewardAssetCount.toNumber()).keys()).map(function (e) {
14604
- return call(pool.signer, IVelodromeGauge.abi, [gauge, "rewards", [e]]);
14605
- }));
14606
-
14607
- case 5:
14608
- rewardAssets = _context.sent;
14609
- return _context.abrupt("return", iVelodromeGauge.encodeFunctionData("getReward", [pool.address, rewardAssets]));
14610
-
14611
- case 7:
14612
- case "end":
14613
- return _context.stop();
14614
- }
14615
- }
14616
- }, _callee);
14617
- }));
14618
- return _getVelodromeClaimTxData.apply(this, arguments);
14619
- }
14620
-
14621
- function getBoard(_x, _x2, _x3) {
14622
- return _getBoard.apply(this, arguments);
14623
- }
14624
-
14625
- function _getBoard() {
14626
- _getBoard = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(network, market, expiry) {
14627
- var lyra, optionMarket, filteredBoards;
14628
- return runtime_1.wrap(function _callee$(_context) {
14629
- while (1) {
14630
- switch (_context.prev = _context.next) {
14631
- case 0:
14632
- lyra = new Lyra__default(lyraNetworkMap[network]);
14633
- _context.next = 3;
14634
- return lyra.market(market);
14635
-
14636
- case 3:
14637
- optionMarket = _context.sent;
14638
- filteredBoards = optionMarket.liveBoards().filter(function (e) {
14639
- return e.expiryTimestamp === expiry;
14640
- });
14641
-
14642
- if (!(filteredBoards.length === 0)) {
14643
- _context.next = 7;
14644
- break;
14645
- }
14646
-
14647
- throw new Error("no lyra board for expiry");
14648
-
14649
- case 7:
14650
- return _context.abrupt("return", filteredBoards[0]);
14651
-
14652
- case 8:
14653
- case "end":
14654
- return _context.stop();
14655
- }
14656
- }
14657
- }, _callee);
14658
- }));
14659
- return _getBoard.apply(this, arguments);
14660
- }
14661
-
14662
- function getExpiries(_x4, _x5) {
14663
- return _getExpiries.apply(this, arguments);
14664
- }
14665
-
14666
- function _getExpiries() {
14667
- _getExpiries = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(network, market) {
14668
- var lyra, optionMarket;
14669
- return runtime_1.wrap(function _callee2$(_context2) {
14670
- while (1) {
14671
- switch (_context2.prev = _context2.next) {
14672
- case 0:
14673
- lyra = new Lyra__default(lyraNetworkMap[network]);
14674
- _context2.next = 3;
14675
- return lyra.market(market);
14676
-
14677
- case 3:
14678
- optionMarket = _context2.sent;
14679
- return _context2.abrupt("return", optionMarket.liveBoards().map(function (e) {
14680
- return e.expiryTimestamp;
14681
- }));
14682
-
14683
- case 5:
14684
- case "end":
14685
- return _context2.stop();
14686
- }
14687
- }
14688
- }, _callee2);
14689
- }));
14690
- return _getExpiries.apply(this, arguments);
14691
- }
14692
-
14693
- function getStrikes(_x6, _x7, _x8) {
14694
- return _getStrikes.apply(this, arguments);
14695
- }
14696
-
14697
- function _getStrikes() {
14698
- _getStrikes = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(network, market, expiry) {
14699
- return runtime_1.wrap(function _callee3$(_context3) {
14700
- while (1) {
14701
- switch (_context3.prev = _context3.next) {
14702
- case 0:
14703
- _context3.next = 2;
14704
- return getBoard(network, market, expiry);
14705
-
14706
- case 2:
14707
- return _context3.abrupt("return", _context3.sent.strikes());
14708
-
14709
- case 3:
14710
- case "end":
14711
- return _context3.stop();
14712
- }
14713
- }
14714
- }, _callee3);
14715
- }));
14716
- return _getStrikes.apply(this, arguments);
14717
- }
14718
-
14719
- function getStrike(_x9, _x10, _x11, _x12) {
14720
- return _getStrike.apply(this, arguments);
14721
- }
14722
-
14723
- function _getStrike() {
14724
- _getStrike = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(network, market, expiry, strike) {
14725
- var strikes, filteredStrike;
14726
- return runtime_1.wrap(function _callee4$(_context4) {
14727
- while (1) {
14728
- switch (_context4.prev = _context4.next) {
14729
- case 0:
14730
- _context4.next = 2;
14731
- return getStrikes(network, market, expiry);
14732
-
14733
- case 2:
14734
- strikes = _context4.sent;
14735
- filteredStrike = strikes.filter(function (e) {
14736
- return parseFloat(ethers.ethers.utils.formatEther(e.strikePrice)) === strike;
14737
- });
14738
-
14739
- if (!(filteredStrike.length === 0)) {
14740
- _context4.next = 6;
14741
- break;
14742
- }
14743
-
14608
+ var abi$m = [
14609
+ {
14610
+ inputs: [
14611
+ {
14612
+ internalType: "address",
14613
+ name: "user",
14614
+ type: "address"
14615
+ }
14616
+ ],
14617
+ name: "balanceOf",
14618
+ outputs: [
14619
+ {
14620
+ internalType: "uint256",
14621
+ name: "",
14622
+ type: "uint256"
14623
+ }
14624
+ ],
14625
+ stateMutability: "view",
14626
+ type: "function"
14627
+ },
14628
+ {
14629
+ inputs: [
14630
+ {
14631
+ internalType: "uint256",
14632
+ name: "_amount",
14633
+ type: "uint256"
14634
+ },
14635
+ {
14636
+ internalType: "address",
14637
+ name: "_recipient",
14638
+ type: "address"
14639
+ }
14640
+ ],
14641
+ name: "deposit",
14642
+ outputs: [
14643
+ ],
14644
+ stateMutability: "nonpayable",
14645
+ type: "function"
14646
+ },
14647
+ {
14648
+ inputs: [
14649
+ {
14650
+ internalType: "uint256",
14651
+ name: "_amount",
14652
+ type: "uint256"
14653
+ }
14654
+ ],
14655
+ name: "deposit",
14656
+ outputs: [
14657
+ ],
14658
+ stateMutability: "nonpayable",
14659
+ type: "function"
14660
+ },
14661
+ {
14662
+ inputs: [
14663
+ {
14664
+ internalType: "address",
14665
+ name: "_account",
14666
+ type: "address"
14667
+ }
14668
+ ],
14669
+ name: "earned",
14670
+ outputs: [
14671
+ {
14672
+ internalType: "uint256",
14673
+ name: "_earned",
14674
+ type: "uint256"
14675
+ }
14676
+ ],
14677
+ stateMutability: "view",
14678
+ type: "function"
14679
+ },
14680
+ {
14681
+ inputs: [
14682
+ {
14683
+ internalType: "address",
14684
+ name: "_account",
14685
+ type: "address"
14686
+ }
14687
+ ],
14688
+ name: "getReward",
14689
+ outputs: [
14690
+ ],
14691
+ stateMutability: "nonpayable",
14692
+ type: "function"
14693
+ },
14694
+ {
14695
+ inputs: [
14696
+ ],
14697
+ name: "isPool",
14698
+ outputs: [
14699
+ {
14700
+ internalType: "bool",
14701
+ name: "_isPool",
14702
+ type: "bool"
14703
+ }
14704
+ ],
14705
+ stateMutability: "view",
14706
+ type: "function"
14707
+ },
14708
+ {
14709
+ inputs: [
14710
+ ],
14711
+ name: "lastTimeRewardApplicable",
14712
+ outputs: [
14713
+ {
14714
+ internalType: "uint256",
14715
+ name: "_time",
14716
+ type: "uint256"
14717
+ }
14718
+ ],
14719
+ stateMutability: "view",
14720
+ type: "function"
14721
+ },
14722
+ {
14723
+ inputs: [
14724
+ ],
14725
+ name: "left",
14726
+ outputs: [
14727
+ {
14728
+ internalType: "uint256",
14729
+ name: "_left",
14730
+ type: "uint256"
14731
+ }
14732
+ ],
14733
+ stateMutability: "view",
14734
+ type: "function"
14735
+ },
14736
+ {
14737
+ inputs: [
14738
+ {
14739
+ internalType: "uint256",
14740
+ name: "amount",
14741
+ type: "uint256"
14742
+ }
14743
+ ],
14744
+ name: "notifyRewardAmount",
14745
+ outputs: [
14746
+ ],
14747
+ stateMutability: "nonpayable",
14748
+ type: "function"
14749
+ },
14750
+ {
14751
+ inputs: [
14752
+ ],
14753
+ name: "rewardPerToken",
14754
+ outputs: [
14755
+ {
14756
+ internalType: "uint256",
14757
+ name: "_rewardPerToken",
14758
+ type: "uint256"
14759
+ }
14760
+ ],
14761
+ stateMutability: "view",
14762
+ type: "function"
14763
+ },
14764
+ {
14765
+ inputs: [
14766
+ ],
14767
+ name: "rewardToken",
14768
+ outputs: [
14769
+ {
14770
+ internalType: "address",
14771
+ name: "_token",
14772
+ type: "address"
14773
+ }
14774
+ ],
14775
+ stateMutability: "view",
14776
+ type: "function"
14777
+ },
14778
+ {
14779
+ inputs: [
14780
+ ],
14781
+ name: "stakingToken",
14782
+ outputs: [
14783
+ {
14784
+ internalType: "address",
14785
+ name: "_pool",
14786
+ type: "address"
14787
+ }
14788
+ ],
14789
+ stateMutability: "view",
14790
+ type: "function"
14791
+ },
14792
+ {
14793
+ inputs: [
14794
+ {
14795
+ internalType: "uint256",
14796
+ name: "_amount",
14797
+ type: "uint256"
14798
+ }
14799
+ ],
14800
+ name: "withdraw",
14801
+ outputs: [
14802
+ ],
14803
+ stateMutability: "nonpayable",
14804
+ type: "function"
14805
+ }
14806
+ ];
14807
+ var IVelodromeGaugeV2 = {
14808
+ abi: abi$m
14809
+ };
14810
+
14811
+ function call(_x, _x2, _x3, _x4) {
14812
+ return _call.apply(this, arguments);
14813
+ }
14814
+
14815
+ function _call() {
14816
+ _call = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(provider, abi, call, options) {
14817
+ var contract, params;
14818
+ return runtime_1.wrap(function _callee2$(_context2) {
14819
+ while (1) {
14820
+ switch (_context2.prev = _context2.next) {
14821
+ case 0:
14822
+ contract = new ethers.ethers.Contract(call[0], abi, provider);
14823
+ _context2.prev = 1;
14824
+ params = call[2] || [];
14825
+ _context2.next = 5;
14826
+ return contract[call[1]].apply(contract, params.concat([options || {}]));
14827
+
14828
+ case 5:
14829
+ return _context2.abrupt("return", _context2.sent);
14830
+
14831
+ case 8:
14832
+ _context2.prev = 8;
14833
+ _context2.t0 = _context2["catch"](1);
14834
+ return _context2.abrupt("return", Promise.reject(_context2.t0));
14835
+
14836
+ case 11:
14837
+ case "end":
14838
+ return _context2.stop();
14839
+ }
14840
+ }
14841
+ }, _callee2, null, [[1, 8]]);
14842
+ }));
14843
+ return _call.apply(this, arguments);
14844
+ }
14845
+
14846
+ var iVelodromeGaugeV1 = /*#__PURE__*/new ethers.ethers.utils.Interface(IVelodromeGaugeV1.abi);
14847
+ var iVelodromeGaugeV2 = /*#__PURE__*/new ethers.ethers.utils.Interface(IVelodromeGaugeV2.abi);
14848
+ function getVelodromeStakeTxData(amount, v2) {
14849
+ var depositParams = v2 ? ["deposit(uint256)", [amount]] : ["deposit", [amount, 0]];
14850
+ var iVelodromeGauge = v2 ? iVelodromeGaugeV2 : iVelodromeGaugeV1;
14851
+ return iVelodromeGauge.encodeFunctionData.apply(iVelodromeGauge, depositParams);
14852
+ }
14853
+ function getVelodromeClaimTxData(_x, _x2, _x3) {
14854
+ return _getVelodromeClaimTxData.apply(this, arguments);
14855
+ }
14856
+
14857
+ function _getVelodromeClaimTxData() {
14858
+ _getVelodromeClaimTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, gauge, v2) {
14859
+ var rewardAssetCount, rewardAssets;
14860
+ return runtime_1.wrap(function _callee$(_context) {
14861
+ while (1) {
14862
+ switch (_context.prev = _context.next) {
14863
+ case 0:
14864
+ if (!v2) {
14865
+ _context.next = 4;
14866
+ break;
14867
+ }
14868
+
14869
+ return _context.abrupt("return", iVelodromeGaugeV2.encodeFunctionData("getReward", [pool.address]));
14870
+
14871
+ case 4:
14872
+ _context.next = 6;
14873
+ return call(pool.signer, IVelodromeGaugeV1.abi, [gauge, "rewardsListLength", []]);
14874
+
14875
+ case 6:
14876
+ rewardAssetCount = _context.sent;
14877
+ _context.next = 9;
14878
+ return Promise.all(Array.from(Array(rewardAssetCount.toNumber()).keys()).map(function (e) {
14879
+ return call(pool.signer, IVelodromeGaugeV1.abi, [gauge, "rewards", [e]]);
14880
+ }));
14881
+
14882
+ case 9:
14883
+ rewardAssets = _context.sent;
14884
+ return _context.abrupt("return", iVelodromeGaugeV1.encodeFunctionData("getReward", [pool.address, rewardAssets]));
14885
+
14886
+ case 11:
14887
+ case "end":
14888
+ return _context.stop();
14889
+ }
14890
+ }
14891
+ }, _callee);
14892
+ }));
14893
+ return _getVelodromeClaimTxData.apply(this, arguments);
14894
+ }
14895
+
14896
+ function getBoard(_x, _x2, _x3) {
14897
+ return _getBoard.apply(this, arguments);
14898
+ }
14899
+
14900
+ function _getBoard() {
14901
+ _getBoard = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(network, market, expiry) {
14902
+ var lyra, optionMarket, filteredBoards;
14903
+ return runtime_1.wrap(function _callee$(_context) {
14904
+ while (1) {
14905
+ switch (_context.prev = _context.next) {
14906
+ case 0:
14907
+ lyra = new Lyra__default(lyraNetworkMap[network]);
14908
+ _context.next = 3;
14909
+ return lyra.market(market);
14910
+
14911
+ case 3:
14912
+ optionMarket = _context.sent;
14913
+ filteredBoards = optionMarket.liveBoards().filter(function (e) {
14914
+ return e.expiryTimestamp === expiry;
14915
+ });
14916
+
14917
+ if (!(filteredBoards.length === 0)) {
14918
+ _context.next = 7;
14919
+ break;
14920
+ }
14921
+
14922
+ throw new Error("no lyra board for expiry");
14923
+
14924
+ case 7:
14925
+ return _context.abrupt("return", filteredBoards[0]);
14926
+
14927
+ case 8:
14928
+ case "end":
14929
+ return _context.stop();
14930
+ }
14931
+ }
14932
+ }, _callee);
14933
+ }));
14934
+ return _getBoard.apply(this, arguments);
14935
+ }
14936
+
14937
+ function getExpiries(_x4, _x5) {
14938
+ return _getExpiries.apply(this, arguments);
14939
+ }
14940
+
14941
+ function _getExpiries() {
14942
+ _getExpiries = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(network, market) {
14943
+ var lyra, optionMarket;
14944
+ return runtime_1.wrap(function _callee2$(_context2) {
14945
+ while (1) {
14946
+ switch (_context2.prev = _context2.next) {
14947
+ case 0:
14948
+ lyra = new Lyra__default(lyraNetworkMap[network]);
14949
+ _context2.next = 3;
14950
+ return lyra.market(market);
14951
+
14952
+ case 3:
14953
+ optionMarket = _context2.sent;
14954
+ return _context2.abrupt("return", optionMarket.liveBoards().map(function (e) {
14955
+ return e.expiryTimestamp;
14956
+ }));
14957
+
14958
+ case 5:
14959
+ case "end":
14960
+ return _context2.stop();
14961
+ }
14962
+ }
14963
+ }, _callee2);
14964
+ }));
14965
+ return _getExpiries.apply(this, arguments);
14966
+ }
14967
+
14968
+ function getStrikes(_x6, _x7, _x8) {
14969
+ return _getStrikes.apply(this, arguments);
14970
+ }
14971
+
14972
+ function _getStrikes() {
14973
+ _getStrikes = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(network, market, expiry) {
14974
+ return runtime_1.wrap(function _callee3$(_context3) {
14975
+ while (1) {
14976
+ switch (_context3.prev = _context3.next) {
14977
+ case 0:
14978
+ _context3.next = 2;
14979
+ return getBoard(network, market, expiry);
14980
+
14981
+ case 2:
14982
+ return _context3.abrupt("return", _context3.sent.strikes());
14983
+
14984
+ case 3:
14985
+ case "end":
14986
+ return _context3.stop();
14987
+ }
14988
+ }
14989
+ }, _callee3);
14990
+ }));
14991
+ return _getStrikes.apply(this, arguments);
14992
+ }
14993
+
14994
+ function getStrike(_x9, _x10, _x11, _x12) {
14995
+ return _getStrike.apply(this, arguments);
14996
+ }
14997
+
14998
+ function _getStrike() {
14999
+ _getStrike = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(network, market, expiry, strike) {
15000
+ var strikes, filteredStrike;
15001
+ return runtime_1.wrap(function _callee4$(_context4) {
15002
+ while (1) {
15003
+ switch (_context4.prev = _context4.next) {
15004
+ case 0:
15005
+ _context4.next = 2;
15006
+ return getStrikes(network, market, expiry);
15007
+
15008
+ case 2:
15009
+ strikes = _context4.sent;
15010
+ filteredStrike = strikes.filter(function (e) {
15011
+ return parseFloat(ethers.ethers.utils.formatEther(e.strikePrice)) === strike;
15012
+ });
15013
+
15014
+ if (!(filteredStrike.length === 0)) {
15015
+ _context4.next = 6;
15016
+ break;
15017
+ }
15018
+
14744
15019
  throw new Error("no option found for strike price");
14745
15020
 
14746
15021
  case 6:
@@ -14756,7 +15031,7 @@ function _getStrike() {
14756
15031
  return _getStrike.apply(this, arguments);
14757
15032
  }
14758
15033
 
14759
- var abi$m = [
15034
+ var abi$n = [
14760
15035
  {
14761
15036
  inputs: [
14762
15037
  {
@@ -16108,7 +16383,7 @@ var abi$m = [
16108
16383
  }
16109
16384
  ];
16110
16385
  var IOptionMarketWrapper = {
16111
- abi: abi$m
16386
+ abi: abi$n
16112
16387
  };
16113
16388
 
16114
16389
  function getLyraTradeOptionType(isCall, isLong, isCoveredCall) {
@@ -16125,7 +16400,7 @@ function isLong(optionType) {
16125
16400
  return optionType === 0 || optionType === 1;
16126
16401
  }
16127
16402
 
16128
- var abi$n = [
16403
+ var abi$o = [
16129
16404
  {
16130
16405
  inputs: [
16131
16406
  {
@@ -18459,7 +18734,7 @@ var abi$n = [
18459
18734
  }
18460
18735
  ];
18461
18736
  var IOptionToken = {
18462
- abi: abi$n
18737
+ abi: abi$o
18463
18738
  };
18464
18739
 
18465
18740
  function getOptionPositions(_x, _x2) {
@@ -18597,7 +18872,7 @@ function _getLyraOptionTxData() {
18597
18872
  return _getLyraOptionTxData.apply(this, arguments);
18598
18873
  }
18599
18874
 
18600
- var abi$o = [
18875
+ var abi$p = [
18601
18876
  {
18602
18877
  inputs: [
18603
18878
  {
@@ -19142,7 +19417,7 @@ var abi$o = [
19142
19417
  }
19143
19418
  ];
19144
19419
  var ISynthetixFuturesMarketV2 = {
19145
- abi: abi$o
19420
+ abi: abi$p
19146
19421
  };
19147
19422
 
19148
19423
  function getFuturesChangeMarginTxData(amount) {
@@ -19205,6 +19480,143 @@ function _getFuturesCancelOrderTxData() {
19205
19480
  return _getFuturesCancelOrderTxData.apply(this, arguments);
19206
19481
  }
19207
19482
 
19483
+ // see https://stackoverflow.com/a/41102306
19484
+ var CAN_SET_PROTOTYPE = ("setPrototypeOf" in Object);
19485
+ var ApiError = /*#__PURE__*/function (_Error) {
19486
+ _inheritsLoose(ApiError, _Error);
19487
+
19488
+ function ApiError(message) {
19489
+ var _this;
19490
+
19491
+ _this = _Error.call(this, message != null ? message : "Api request failed") || this;
19492
+ _this.name = _this.constructor.name;
19493
+ if (CAN_SET_PROTOTYPE) Object.setPrototypeOf(_assertThisInitialized(_this), (this instanceof ApiError ? this.constructor : void 0).prototype);
19494
+ return _this;
19495
+ }
19496
+
19497
+ return ApiError;
19498
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
19499
+
19500
+ // in 0x, e.g. 0.03 for 3% slippage allowed
19501
+ // 1inch slippage 0.5% represented by 0.5
19502
+ // 0x slippage 0.5% represented by 0.005
19503
+
19504
+ var getZeroExSlippage = function getZeroExSlippage(slippage) {
19505
+ return Number(slippage) / 100;
19506
+ };
19507
+
19508
+ var getZeroExTradeTxData = /*#__PURE__*/function () {
19509
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(network, assetFrom, assetTo, amountIn, slippage, takerAddress) {
19510
+ var slippagePercentage, params, response;
19511
+ return runtime_1.wrap(function _callee$(_context) {
19512
+ while (1) {
19513
+ switch (_context.prev = _context.next) {
19514
+ case 0:
19515
+ if (slippage === void 0) {
19516
+ slippage = 0.5;
19517
+ }
19518
+
19519
+ if (process.env.ZEROEX_API_KEY) {
19520
+ _context.next = 3;
19521
+ break;
19522
+ }
19523
+
19524
+ throw new Error("ZEROEX_API_KEY not configured in .env file");
19525
+
19526
+ case 3:
19527
+ _context.prev = 3;
19528
+ slippagePercentage = getZeroExSlippage(slippage);
19529
+ params = {
19530
+ buyToken: assetTo,
19531
+ sellToken: assetFrom,
19532
+ sellAmount: amountIn.toString(),
19533
+ // necessary to skip quote validation is that in which the takerAddress refers to a smart contract
19534
+ skipValidation: true,
19535
+ // Used to enable RFQ-T liquidity
19536
+ intentOnFilling: true,
19537
+ takerAddress: takerAddress,
19538
+ slippagePercentage: slippagePercentage // excludedSourcesParam
19539
+
19540
+ };
19541
+ _context.next = 8;
19542
+ return axios.get("https://" + network + ".api.0x.org/swap/v1/quote", {
19543
+ params: params,
19544
+ headers: {
19545
+ "0x-api-key": process.env.ZEROEX_API_KEY
19546
+ }
19547
+ });
19548
+
19549
+ case 8:
19550
+ response = _context.sent;
19551
+ return _context.abrupt("return", response.data.data);
19552
+
19553
+ case 12:
19554
+ _context.prev = 12;
19555
+ _context.t0 = _context["catch"](3);
19556
+ throw new ApiError("Swap api request of 0x failed");
19557
+
19558
+ case 15:
19559
+ case "end":
19560
+ return _context.stop();
19561
+ }
19562
+ }
19563
+ }, _callee, null, [[3, 12]]);
19564
+ }));
19565
+
19566
+ return function getZeroExTradeTxData(_x, _x2, _x3, _x4, _x5, _x6) {
19567
+ return _ref.apply(this, arguments);
19568
+ };
19569
+ }();
19570
+
19571
+ var oneInchBaseUrl = "https://api.1inch.dev/swap/v5.2/";
19572
+ function getOneInchSwapTxData(_x, _x2, _x3, _x4, _x5) {
19573
+ return _getOneInchSwapTxData.apply(this, arguments);
19574
+ }
19575
+
19576
+ function _getOneInchSwapTxData() {
19577
+ _getOneInchSwapTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, assetFrom, assetTo, amountIn, slippage) {
19578
+ var chainId, apiUrl, response;
19579
+ return runtime_1.wrap(function _callee$(_context) {
19580
+ while (1) {
19581
+ switch (_context.prev = _context.next) {
19582
+ case 0:
19583
+ if (process.env.ONEINCH_API_KEY) {
19584
+ _context.next = 2;
19585
+ break;
19586
+ }
19587
+
19588
+ throw new Error("ONEINCH_API_KEY not configured in .env file");
19589
+
19590
+ case 2:
19591
+ chainId = networkChainIdMap[pool.network];
19592
+ apiUrl = "" + oneInchBaseUrl + chainId + "/swap?src=" + assetFrom + "&dst=" + assetTo + "&amount=" + amountIn.toString() + "&from=" + pool.address + "&slippage=" + slippage.toString() + "&disableEstimate=true";
19593
+ _context.prev = 4;
19594
+ _context.next = 7;
19595
+ return axios.get(apiUrl, {
19596
+ headers: {
19597
+ Authorization: "Bearer " + process.env.ONEINCH_API_KEY
19598
+ }
19599
+ });
19600
+
19601
+ case 7:
19602
+ response = _context.sent;
19603
+ return _context.abrupt("return", response.data.tx.data);
19604
+
19605
+ case 11:
19606
+ _context.prev = 11;
19607
+ _context.t0 = _context["catch"](4);
19608
+ throw new ApiError("Swap api request of 1inch failed");
19609
+
19610
+ case 14:
19611
+ case "end":
19612
+ return _context.stop();
19613
+ }
19614
+ }
19615
+ }, _callee, null, [[4, 11]]);
19616
+ }));
19617
+ return _getOneInchSwapTxData.apply(this, arguments);
19618
+ }
19619
+
19208
19620
  var Pool = /*#__PURE__*/function () {
19209
19621
  function Pool(network, signer, poolLogic, mangerLogic, utils, factory) {
19210
19622
  this.network = network;
@@ -19594,7 +20006,7 @@ var Pool = /*#__PURE__*/function () {
19594
20006
  /*#__PURE__*/
19595
20007
  function () {
19596
20008
  var _trade = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(dapp, assetFrom, assetTo, amountIn, slippage, options) {
19597
- var swapTxData, chainId, protocols, apiUrl, response, iSynthetix, assets, daoAddress, iUniswapV2Router, minAmountOut, tx;
20009
+ var swapTxData, iSynthetix, assets, daoAddress, iUniswapV2Router, minAmountOut, tx;
19598
20010
  return runtime_1.wrap(function _callee9$(_context9) {
19599
20011
  while (1) {
19600
20012
  switch (_context9.prev = _context9.next) {
@@ -19608,69 +20020,60 @@ var Pool = /*#__PURE__*/function () {
19608
20020
  }
19609
20021
 
19610
20022
  _context9.t0 = dapp;
19611
- _context9.next = _context9.t0 === exports.Dapp.ONEINCH ? 5 : _context9.t0 === exports.Dapp.BALANCER ? 17 : _context9.t0 === exports.Dapp.SYNTHETIX ? 21 : _context9.t0 === exports.Dapp.TOROS ? 28 : 32;
20023
+ _context9.next = _context9.t0 === exports.Dapp.ZEROEX ? 5 : _context9.t0 === exports.Dapp.ONEINCH ? 9 : _context9.t0 === exports.Dapp.BALANCER ? 13 : _context9.t0 === exports.Dapp.SYNTHETIX ? 17 : _context9.t0 === exports.Dapp.TOROS ? 24 : 28;
19612
20024
  break;
19613
20025
 
19614
20026
  case 5:
19615
- chainId = networkChainIdMap[this.network];
19616
- _context9.next = 8;
19617
- return getOneInchProtocols(chainId);
19618
-
19619
- case 8:
19620
- protocols = _context9.sent;
20027
+ _context9.next = 7;
20028
+ return getZeroExTradeTxData(this.network, assetFrom, assetTo, amountIn, slippage, this.address);
19621
20029
 
19622
- if (process.env.ONEINCH_API_URL) {
19623
- _context9.next = 11;
19624
- break;
19625
- }
20030
+ case 7:
20031
+ swapTxData = _context9.sent;
20032
+ return _context9.abrupt("break", 43);
19626
20033
 
19627
- throw new Error("ONEINCH_API_URL not configured in .env file");
20034
+ case 9:
20035
+ _context9.next = 11;
20036
+ return getOneInchSwapTxData(this, assetFrom, assetTo, amountIn, slippage);
19628
20037
 
19629
20038
  case 11:
19630
- apiUrl = process.env.ONEINCH_API_URL + "/" + chainId + "/swap?fromTokenAddress=" + assetFrom + "&toTokenAddress=" + assetTo + "&amount=" + amountIn.toString() + "&fromAddress=" + this.address + "&destReceiver=" + this.address + "&slippage=" + slippage.toString() + "&disableEstimate=true" + protocols;
19631
- _context9.next = 14;
19632
- return axios.get(apiUrl);
19633
-
19634
- case 14:
19635
- response = _context9.sent;
19636
- swapTxData = response.data.tx.data;
19637
- return _context9.abrupt("break", 47);
20039
+ swapTxData = _context9.sent;
20040
+ return _context9.abrupt("break", 43);
19638
20041
 
19639
- case 17:
19640
- _context9.next = 19;
20042
+ case 13:
20043
+ _context9.next = 15;
19641
20044
  return this.utils.getBalancerSwapTx(this, assetFrom, assetTo, amountIn, slippage);
19642
20045
 
19643
- case 19:
20046
+ case 15:
19644
20047
  swapTxData = _context9.sent;
19645
- return _context9.abrupt("break", 47);
20048
+ return _context9.abrupt("break", 43);
19646
20049
 
19647
- case 21:
20050
+ case 17:
19648
20051
  iSynthetix = new ethers.ethers.utils.Interface(ISynthetix.abi);
19649
20052
  assets = [assetFrom, assetTo].map(function (asset) {
19650
20053
  return ethers.ethers.utils.formatBytes32String(asset);
19651
20054
  });
19652
- _context9.next = 25;
20055
+ _context9.next = 21;
19653
20056
  return this.factory.owner();
19654
20057
 
19655
- case 25:
20058
+ case 21:
19656
20059
  daoAddress = _context9.sent;
19657
20060
  swapTxData = iSynthetix.encodeFunctionData(exports.Transaction.SWAP_SYNTHS, [assets[0], amountIn, assets[1], daoAddress, SYNTHETIX_TRACKING_CODE]);
19658
- return _context9.abrupt("break", 47);
20061
+ return _context9.abrupt("break", 43);
19659
20062
 
19660
- case 28:
19661
- _context9.next = 30;
20063
+ case 24:
20064
+ _context9.next = 26;
19662
20065
  return getEasySwapperTxData(this, assetFrom, assetTo, ethers.ethers.BigNumber.from(amountIn), slippage);
19663
20066
 
19664
- case 30:
20067
+ case 26:
19665
20068
  swapTxData = _context9.sent;
19666
- return _context9.abrupt("break", 47);
20069
+ return _context9.abrupt("break", 43);
19667
20070
 
19668
- case 32:
20071
+ case 28:
19669
20072
  iUniswapV2Router = new ethers.ethers.utils.Interface(IUniswapV2Router.abi);
19670
- _context9.next = 35;
20073
+ _context9.next = 31;
19671
20074
  return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
19672
20075
 
19673
- case 35:
20076
+ case 31:
19674
20077
  minAmountOut = _context9.sent;
19675
20078
  _context9.t1 = iUniswapV2Router;
19676
20079
  _context9.t2 = exports.Transaction.SWAP;
@@ -19678,23 +20081,23 @@ var Pool = /*#__PURE__*/function () {
19678
20081
  _context9.t4 = minAmountOut;
19679
20082
  _context9.t5 = [assetFrom, assetTo];
19680
20083
  _context9.t6 = this.address;
19681
- _context9.next = 44;
20084
+ _context9.next = 40;
19682
20085
  return getDeadline(this);
19683
20086
 
19684
- case 44:
20087
+ case 40:
19685
20088
  _context9.t7 = _context9.sent;
19686
20089
  _context9.t8 = [_context9.t3, _context9.t4, _context9.t5, _context9.t6, _context9.t7];
19687
20090
  swapTxData = _context9.t1.encodeFunctionData.call(_context9.t1, _context9.t2, _context9.t8);
19688
20091
 
19689
- case 47:
19690
- _context9.next = 49;
20092
+ case 43:
20093
+ _context9.next = 45;
19691
20094
  return this.poolLogic.execTransaction(routerAddress[this.network][dapp], swapTxData, options);
19692
20095
 
19693
- case 49:
20096
+ case 45:
19694
20097
  tx = _context9.sent;
19695
20098
  return _context9.abrupt("return", tx);
19696
20099
 
19697
- case 51:
20100
+ case 47:
19698
20101
  case "end":
19699
20102
  return _context9.stop();
19700
20103
  }
@@ -19903,30 +20306,34 @@ var Pool = /*#__PURE__*/function () {
19903
20306
  }
19904
20307
 
19905
20308
  _context13.t0 = dapp;
19906
- _context13.next = _context13.t0 === exports.Dapp.BALANCER ? 4 : _context13.t0 === exports.Dapp.VELODROME ? 7 : 9;
20309
+ _context13.next = _context13.t0 === exports.Dapp.BALANCER ? 4 : _context13.t0 === exports.Dapp.VELODROME ? 7 : _context13.t0 === exports.Dapp.VELODROMEV2 ? 9 : 11;
19907
20310
  break;
19908
20311
 
19909
20312
  case 4:
19910
20313
  rewardsGauge = new ethers.ethers.utils.Interface(IBalancerRewardsGauge.abi);
19911
20314
  stakeTxData = rewardsGauge.encodeFunctionData("deposit(uint256)", [amount]);
19912
- return _context13.abrupt("break", 10);
20315
+ return _context13.abrupt("break", 12);
19913
20316
 
19914
20317
  case 7:
19915
- stakeTxData = getVelodromeStakeTxData(amount);
19916
- return _context13.abrupt("break", 10);
20318
+ stakeTxData = getVelodromeStakeTxData(amount, false);
20319
+ return _context13.abrupt("break", 12);
19917
20320
 
19918
20321
  case 9:
20322
+ stakeTxData = getVelodromeStakeTxData(amount, true);
20323
+ return _context13.abrupt("break", 12);
20324
+
20325
+ case 11:
19919
20326
  throw new Error("dapp not supported");
19920
20327
 
19921
- case 10:
19922
- _context13.next = 12;
20328
+ case 12:
20329
+ _context13.next = 14;
19923
20330
  return this.poolLogic.execTransaction(gauge, stakeTxData, options);
19924
20331
 
19925
- case 12:
20332
+ case 14:
19926
20333
  tx = _context13.sent;
19927
20334
  return _context13.abrupt("return", tx);
19928
20335
 
19929
- case 14:
20336
+ case 16:
19930
20337
  case "end":
19931
20338
  return _context13.stop();
19932
20339
  }
@@ -19992,7 +20399,7 @@ var Pool = /*#__PURE__*/function () {
19992
20399
  return unStake;
19993
20400
  }()
19994
20401
  /**
19995
- * Unstake liquidity pool tokens from gauge contract
20402
+ * Unstake liquidity pool tokens from Velodrome or Balancer gauge
19996
20403
  * @param {string} gauge Gauge contract address
19997
20404
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
19998
20405
  * @param {any} options Transaction options
@@ -20854,38 +21261,43 @@ var Pool = /*#__PURE__*/function () {
20854
21261
  }
20855
21262
 
20856
21263
  _context30.t0 = dapp;
20857
- _context30.next = _context30.t0 === exports.Dapp.UNISWAPV3 ? 4 : _context30.t0 === exports.Dapp.ARRAKIS ? 8 : _context30.t0 === exports.Dapp.BALANCER ? 8 : _context30.t0 === exports.Dapp.VELODROME ? 12 : 15;
21264
+ _context30.next = _context30.t0 === exports.Dapp.UNISWAPV3 ? 4 : _context30.t0 === exports.Dapp.ARRAKIS ? 8 : _context30.t0 === exports.Dapp.BALANCER ? 8 : _context30.t0 === exports.Dapp.VELODROME ? 12 : _context30.t0 === exports.Dapp.VELODROMEV2 ? 15 : 18;
20858
21265
  break;
20859
21266
 
20860
21267
  case 4:
20861
21268
  contractAddress = nonfungiblePositionManagerAddress[this.network];
20862
21269
  iNonfungiblePositionManager = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
20863
21270
  txData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
20864
- return _context30.abrupt("break", 16);
21271
+ return _context30.abrupt("break", 19);
20865
21272
 
20866
21273
  case 8:
20867
21274
  contractAddress = tokenId;
20868
21275
  abi = new ethers.ethers.utils.Interface(ILiquidityGaugeV4.abi);
20869
21276
  txData = abi.encodeFunctionData("claim_rewards()", []);
20870
- return _context30.abrupt("break", 16);
21277
+ return _context30.abrupt("break", 19);
20871
21278
 
20872
21279
  case 12:
20873
21280
  contractAddress = tokenId;
20874
- txData = getVelodromeClaimTxData(this, tokenId);
20875
- return _context30.abrupt("break", 16);
21281
+ txData = getVelodromeClaimTxData(this, tokenId, false);
21282
+ return _context30.abrupt("break", 19);
20876
21283
 
20877
21284
  case 15:
21285
+ contractAddress = tokenId;
21286
+ txData = getVelodromeClaimTxData(this, tokenId, true);
21287
+ return _context30.abrupt("break", 19);
21288
+
21289
+ case 18:
20878
21290
  throw new Error("dapp not supported");
20879
21291
 
20880
- case 16:
20881
- _context30.next = 18;
21292
+ case 19:
21293
+ _context30.next = 21;
20882
21294
  return this.poolLogic.execTransaction(contractAddress, txData, options);
20883
21295
 
20884
- case 18:
21296
+ case 21:
20885
21297
  tx = _context30.sent;
20886
21298
  return _context30.abrupt("return", tx);
20887
21299
 
20888
- case 20:
21300
+ case 23:
20889
21301
  case "end":
20890
21302
  return _context30.stop();
20891
21303
  }
@@ -21062,6 +21474,113 @@ var Pool = /*#__PURE__*/function () {
21062
21474
 
21063
21475
  return removeLiquidityVelodrome;
21064
21476
  }()
21477
+ /**
21478
+ * Add liquidity to Velodrome V2 pool
21479
+ * @param {string} assetA First asset
21480
+ * @param {string} assetB Second asset
21481
+ * @param {BigNumber | string} amountA Amount first asset
21482
+ * @param {BigNumber | string} amountB Amount second asset
21483
+ * @param { boolean } isStable Is stable pool
21484
+ * @param {any} options Transaction options
21485
+ * @returns {Promise<any>} Transaction
21486
+ */
21487
+ ;
21488
+
21489
+ _proto.addLiquidityVelodromeV2 =
21490
+ /*#__PURE__*/
21491
+ function () {
21492
+ var _addLiquidityVelodromeV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee34(assetA, assetB, amountA, amountB, isStable, options) {
21493
+ var tx;
21494
+ return runtime_1.wrap(function _callee34$(_context34) {
21495
+ while (1) {
21496
+ switch (_context34.prev = _context34.next) {
21497
+ case 0:
21498
+ if (options === void 0) {
21499
+ options = null;
21500
+ }
21501
+
21502
+ _context34.t0 = this.poolLogic;
21503
+ _context34.t1 = routerAddress[this.network][exports.Dapp.VELODROMEV2];
21504
+ _context34.next = 5;
21505
+ return getVelodromeAddLiquidityTxData(this, assetA, assetB, amountA, amountB, isStable);
21506
+
21507
+ case 5:
21508
+ _context34.t2 = _context34.sent;
21509
+ _context34.t3 = options;
21510
+ _context34.next = 9;
21511
+ return _context34.t0.execTransaction.call(_context34.t0, _context34.t1, _context34.t2, _context34.t3);
21512
+
21513
+ case 9:
21514
+ tx = _context34.sent;
21515
+ return _context34.abrupt("return", tx);
21516
+
21517
+ case 11:
21518
+ case "end":
21519
+ return _context34.stop();
21520
+ }
21521
+ }
21522
+ }, _callee34, this);
21523
+ }));
21524
+
21525
+ function addLiquidityVelodromeV2(_x134, _x135, _x136, _x137, _x138, _x139) {
21526
+ return _addLiquidityVelodromeV.apply(this, arguments);
21527
+ }
21528
+
21529
+ return addLiquidityVelodromeV2;
21530
+ }()
21531
+ /**
21532
+ * Remove liquidity from Velodrome V2 pool
21533
+ * @param {string} assetA First asset
21534
+ * @param {string} assetB Second asset
21535
+ * @param {BigNumber | string} amount Amount of LP tokens
21536
+ * @param { boolean } isStable Is stable pool
21537
+ * @param {any} options Transaction options
21538
+ * @returns {Promise<any>} Transaction
21539
+ */
21540
+ ;
21541
+
21542
+ _proto.removeLiquidityVelodromeV2 =
21543
+ /*#__PURE__*/
21544
+ function () {
21545
+ var _removeLiquidityVelodromeV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee35(assetA, assetB, amount, isStable, options) {
21546
+ var tx;
21547
+ return runtime_1.wrap(function _callee35$(_context35) {
21548
+ while (1) {
21549
+ switch (_context35.prev = _context35.next) {
21550
+ case 0:
21551
+ if (options === void 0) {
21552
+ options = null;
21553
+ }
21554
+
21555
+ _context35.t0 = this.poolLogic;
21556
+ _context35.t1 = routerAddress[this.network][exports.Dapp.VELODROMEV2];
21557
+ _context35.next = 5;
21558
+ return getVelodromeRemoveLiquidityTxData(this, assetA, assetB, amount, isStable);
21559
+
21560
+ case 5:
21561
+ _context35.t2 = _context35.sent;
21562
+ _context35.t3 = options;
21563
+ _context35.next = 9;
21564
+ return _context35.t0.execTransaction.call(_context35.t0, _context35.t1, _context35.t2, _context35.t3);
21565
+
21566
+ case 9:
21567
+ tx = _context35.sent;
21568
+ return _context35.abrupt("return", tx);
21569
+
21570
+ case 11:
21571
+ case "end":
21572
+ return _context35.stop();
21573
+ }
21574
+ }
21575
+ }, _callee35, this);
21576
+ }));
21577
+
21578
+ function removeLiquidityVelodromeV2(_x140, _x141, _x142, _x143, _x144) {
21579
+ return _removeLiquidityVelodromeV.apply(this, arguments);
21580
+ }
21581
+
21582
+ return removeLiquidityVelodromeV2;
21583
+ }()
21065
21584
  /**
21066
21585
  * Trade options on lyra
21067
21586
  * @param {LyraOptionMarket} market Underlying market e.g. eth
@@ -21081,11 +21600,11 @@ var Pool = /*#__PURE__*/function () {
21081
21600
  _proto.tradeLyraOption =
21082
21601
  /*#__PURE__*/
21083
21602
  function () {
21084
- var _tradeLyraOption = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee34(market, expiry, strike, optionType, tradeType, optionAmount, assetIn, collateralChangeAmount, isCoveredCall, options) {
21603
+ var _tradeLyraOption = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee36(market, expiry, strike, optionType, tradeType, optionAmount, assetIn, collateralChangeAmount, isCoveredCall, options) {
21085
21604
  var swapxData, tx;
21086
- return runtime_1.wrap(function _callee34$(_context34) {
21605
+ return runtime_1.wrap(function _callee36$(_context36) {
21087
21606
  while (1) {
21088
- switch (_context34.prev = _context34.next) {
21607
+ switch (_context36.prev = _context36.next) {
21089
21608
  case 0:
21090
21609
  if (collateralChangeAmount === void 0) {
21091
21610
  collateralChangeAmount = "0";
@@ -21099,27 +21618,27 @@ var Pool = /*#__PURE__*/function () {
21099
21618
  options = null;
21100
21619
  }
21101
21620
 
21102
- _context34.next = 5;
21621
+ _context36.next = 5;
21103
21622
  return getLyraOptionTxData(this, market, optionType, expiry, strike, tradeType, optionAmount, assetIn, ethers.BigNumber.from(collateralChangeAmount), isCoveredCall);
21104
21623
 
21105
21624
  case 5:
21106
- swapxData = _context34.sent;
21107
- _context34.next = 8;
21625
+ swapxData = _context36.sent;
21626
+ _context36.next = 8;
21108
21627
  return this.poolLogic.execTransaction(routerAddress[this.network][exports.Dapp.LYRA], swapxData, options);
21109
21628
 
21110
21629
  case 8:
21111
- tx = _context34.sent;
21112
- return _context34.abrupt("return", tx);
21630
+ tx = _context36.sent;
21631
+ return _context36.abrupt("return", tx);
21113
21632
 
21114
21633
  case 10:
21115
21634
  case "end":
21116
- return _context34.stop();
21635
+ return _context36.stop();
21117
21636
  }
21118
21637
  }
21119
- }, _callee34, this);
21638
+ }, _callee36, this);
21120
21639
  }));
21121
21640
 
21122
- function tradeLyraOption(_x134, _x135, _x136, _x137, _x138, _x139, _x140, _x141, _x142, _x143) {
21641
+ function tradeLyraOption(_x145, _x146, _x147, _x148, _x149, _x150, _x151, _x152, _x153, _x154) {
21123
21642
  return _tradeLyraOption.apply(this, arguments);
21124
21643
  }
21125
21644
 
@@ -21134,26 +21653,26 @@ var Pool = /*#__PURE__*/function () {
21134
21653
  _proto.getLyraPositions =
21135
21654
  /*#__PURE__*/
21136
21655
  function () {
21137
- var _getLyraPositions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee35(market) {
21138
- return runtime_1.wrap(function _callee35$(_context35) {
21656
+ var _getLyraPositions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee37(market) {
21657
+ return runtime_1.wrap(function _callee37$(_context37) {
21139
21658
  while (1) {
21140
- switch (_context35.prev = _context35.next) {
21659
+ switch (_context37.prev = _context37.next) {
21141
21660
  case 0:
21142
- _context35.next = 2;
21661
+ _context37.next = 2;
21143
21662
  return getOptionPositions(this, market);
21144
21663
 
21145
21664
  case 2:
21146
- return _context35.abrupt("return", _context35.sent);
21665
+ return _context37.abrupt("return", _context37.sent);
21147
21666
 
21148
21667
  case 3:
21149
21668
  case "end":
21150
- return _context35.stop();
21669
+ return _context37.stop();
21151
21670
  }
21152
21671
  }
21153
- }, _callee35, this);
21672
+ }, _callee37, this);
21154
21673
  }));
21155
21674
 
21156
- function getLyraPositions(_x144) {
21675
+ function getLyraPositions(_x155) {
21157
21676
  return _getLyraPositions.apply(this, arguments);
21158
21677
  }
21159
21678
 
@@ -21171,32 +21690,32 @@ var Pool = /*#__PURE__*/function () {
21171
21690
  _proto.changeFuturesMargin =
21172
21691
  /*#__PURE__*/
21173
21692
  function () {
21174
- var _changeFuturesMargin = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee36(market, changeAmount, options) {
21693
+ var _changeFuturesMargin = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee38(market, changeAmount, options) {
21175
21694
  var tx;
21176
- return runtime_1.wrap(function _callee36$(_context36) {
21695
+ return runtime_1.wrap(function _callee38$(_context38) {
21177
21696
  while (1) {
21178
- switch (_context36.prev = _context36.next) {
21697
+ switch (_context38.prev = _context38.next) {
21179
21698
  case 0:
21180
21699
  if (options === void 0) {
21181
21700
  options = null;
21182
21701
  }
21183
21702
 
21184
- _context36.next = 3;
21703
+ _context38.next = 3;
21185
21704
  return this.poolLogic.execTransaction(market, getFuturesChangeMarginTxData(changeAmount), options);
21186
21705
 
21187
21706
  case 3:
21188
- tx = _context36.sent;
21189
- return _context36.abrupt("return", tx);
21707
+ tx = _context38.sent;
21708
+ return _context38.abrupt("return", tx);
21190
21709
 
21191
21710
  case 5:
21192
21711
  case "end":
21193
- return _context36.stop();
21712
+ return _context38.stop();
21194
21713
  }
21195
21714
  }
21196
- }, _callee36, this);
21715
+ }, _callee38, this);
21197
21716
  }));
21198
21717
 
21199
- function changeFuturesMargin(_x145, _x146, _x147) {
21718
+ function changeFuturesMargin(_x156, _x157, _x158) {
21200
21719
  return _changeFuturesMargin.apply(this, arguments);
21201
21720
  }
21202
21721
 
@@ -21214,37 +21733,37 @@ var Pool = /*#__PURE__*/function () {
21214
21733
  _proto.changeFuturesPosition =
21215
21734
  /*#__PURE__*/
21216
21735
  function () {
21217
- var _changeFuturesPosition = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee37(market, changeAmount, options) {
21736
+ var _changeFuturesPosition = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee39(market, changeAmount, options) {
21218
21737
  var txData, tx;
21219
- return runtime_1.wrap(function _callee37$(_context37) {
21738
+ return runtime_1.wrap(function _callee39$(_context39) {
21220
21739
  while (1) {
21221
- switch (_context37.prev = _context37.next) {
21740
+ switch (_context39.prev = _context39.next) {
21222
21741
  case 0:
21223
21742
  if (options === void 0) {
21224
21743
  options = null;
21225
21744
  }
21226
21745
 
21227
- _context37.next = 3;
21746
+ _context39.next = 3;
21228
21747
  return getFuturesChangePositionTxData(changeAmount, market, this);
21229
21748
 
21230
21749
  case 3:
21231
- txData = _context37.sent;
21232
- _context37.next = 6;
21750
+ txData = _context39.sent;
21751
+ _context39.next = 6;
21233
21752
  return this.poolLogic.execTransaction(market, txData, options);
21234
21753
 
21235
21754
  case 6:
21236
- tx = _context37.sent;
21237
- return _context37.abrupt("return", tx);
21755
+ tx = _context39.sent;
21756
+ return _context39.abrupt("return", tx);
21238
21757
 
21239
21758
  case 8:
21240
21759
  case "end":
21241
- return _context37.stop();
21760
+ return _context39.stop();
21242
21761
  }
21243
21762
  }
21244
- }, _callee37, this);
21763
+ }, _callee39, this);
21245
21764
  }));
21246
21765
 
21247
- function changeFuturesPosition(_x148, _x149, _x150) {
21766
+ function changeFuturesPosition(_x159, _x160, _x161) {
21248
21767
  return _changeFuturesPosition.apply(this, arguments);
21249
21768
  }
21250
21769
 
@@ -21261,37 +21780,37 @@ var Pool = /*#__PURE__*/function () {
21261
21780
  _proto.cancelFuturesOrder =
21262
21781
  /*#__PURE__*/
21263
21782
  function () {
21264
- var _cancelFuturesOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee38(market, options) {
21783
+ var _cancelFuturesOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee40(market, options) {
21265
21784
  var txData, tx;
21266
- return runtime_1.wrap(function _callee38$(_context38) {
21785
+ return runtime_1.wrap(function _callee40$(_context40) {
21267
21786
  while (1) {
21268
- switch (_context38.prev = _context38.next) {
21787
+ switch (_context40.prev = _context40.next) {
21269
21788
  case 0:
21270
21789
  if (options === void 0) {
21271
21790
  options = null;
21272
21791
  }
21273
21792
 
21274
- _context38.next = 3;
21793
+ _context40.next = 3;
21275
21794
  return getFuturesCancelOrderTxData(this);
21276
21795
 
21277
21796
  case 3:
21278
- txData = _context38.sent;
21279
- _context38.next = 6;
21797
+ txData = _context40.sent;
21798
+ _context40.next = 6;
21280
21799
  return this.poolLogic.execTransaction(market, txData, options);
21281
21800
 
21282
21801
  case 6:
21283
- tx = _context38.sent;
21284
- return _context38.abrupt("return", tx);
21802
+ tx = _context40.sent;
21803
+ return _context40.abrupt("return", tx);
21285
21804
 
21286
21805
  case 8:
21287
21806
  case "end":
21288
- return _context38.stop();
21807
+ return _context40.stop();
21289
21808
  }
21290
21809
  }
21291
- }, _callee38, this);
21810
+ }, _callee40, this);
21292
21811
  }));
21293
21812
 
21294
- function cancelFuturesOrder(_x151, _x152) {
21813
+ function cancelFuturesOrder(_x162, _x163) {
21295
21814
  return _cancelFuturesOrder.apply(this, arguments);
21296
21815
  }
21297
21816
 
@@ -21301,7 +21820,7 @@ var Pool = /*#__PURE__*/function () {
21301
21820
  return Pool;
21302
21821
  }();
21303
21822
 
21304
- var abi$p = [
21823
+ var abi$q = [
21305
21824
  {
21306
21825
  inputs: [
21307
21826
  {
@@ -21525,10 +22044,10 @@ var abi$p = [
21525
22044
  }
21526
22045
  ];
21527
22046
  var UniswapV2Factory = {
21528
- abi: abi$p
22047
+ abi: abi$q
21529
22048
  };
21530
22049
 
21531
- var abi$q = [
22050
+ var abi$r = [
21532
22051
  {
21533
22052
  anonymous: false,
21534
22053
  inputs: [
@@ -22272,7 +22791,7 @@ var evm = {
22272
22791
  }
22273
22792
  };
22274
22793
  var UniswapV2Pair = {
22275
- abi: abi$q,
22794
+ abi: abi$r,
22276
22795
  evm: evm,
22277
22796
  "interface": [
22278
22797
  {
@@ -23003,7 +23522,7 @@ var UniswapV2Pair = {
23003
23522
  ]
23004
23523
  };
23005
23524
 
23006
- var abi$r = [
23525
+ var abi$s = [
23007
23526
  {
23008
23527
  inputs: [
23009
23528
  {
@@ -24198,7 +24717,7 @@ var abi$r = [
24198
24717
  }
24199
24718
  ];
24200
24719
  var IBalancerV2Vault = {
24201
- abi: abi$r
24720
+ abi: abi$s
24202
24721
  };
24203
24722
 
24204
24723
  var Utils = /*#__PURE__*/function () {
@@ -24871,6 +25390,7 @@ Object.defineProperty(exports, 'ethers', {
24871
25390
  return ethers.ethers;
24872
25391
  }
24873
25392
  });
25393
+ exports.ApiError = ApiError;
24874
25394
  exports.Dhedge = Dhedge;
24875
25395
  exports.Pool = Pool;
24876
25396
  //# sourceMappingURL=v2-sdk.cjs.development.js.map