@ethereansos/interfaces-core 0.4.89 → 0.4.93

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/index.cjs.js CHANGED
@@ -7525,14 +7525,9 @@ function ownKeys(object, enumerableOnly) {
7525
7525
 
7526
7526
  if (Object.getOwnPropertySymbols) {
7527
7527
  var symbols = Object.getOwnPropertySymbols(object);
7528
-
7529
- if (enumerableOnly) {
7530
- symbols = symbols.filter(function (sym) {
7531
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
7532
- });
7533
- }
7534
-
7535
- keys.push.apply(keys, symbols);
7528
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
7529
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
7530
+ })), keys.push.apply(keys, symbols);
7536
7531
  }
7537
7532
 
7538
7533
  return keys;
@@ -7540,19 +7535,12 @@ function ownKeys(object, enumerableOnly) {
7540
7535
 
7541
7536
  function _objectSpread2(target) {
7542
7537
  for (var i = 1; i < arguments.length; i++) {
7543
- var source = arguments[i] != null ? arguments[i] : {};
7544
-
7545
- if (i % 2) {
7546
- ownKeys(Object(source), true).forEach(function (key) {
7547
- _defineProperty(target, key, source[key]);
7548
- });
7549
- } else if (Object.getOwnPropertyDescriptors) {
7550
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
7551
- } else {
7552
- ownKeys(Object(source)).forEach(function (key) {
7553
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
7554
- });
7555
- }
7538
+ var source = null != arguments[i] ? arguments[i] : {};
7539
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
7540
+ _defineProperty(target, key, source[key]);
7541
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
7542
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
7543
+ });
7556
7544
  }
7557
7545
 
7558
7546
  return target;
@@ -7561,17 +7549,11 @@ function _objectSpread2(target) {
7561
7549
  function _typeof(obj) {
7562
7550
  "@babel/helpers - typeof";
7563
7551
 
7564
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
7565
- _typeof = function (obj) {
7566
- return typeof obj;
7567
- };
7568
- } else {
7569
- _typeof = function (obj) {
7570
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
7571
- };
7572
- }
7573
-
7574
- return _typeof(obj);
7552
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
7553
+ return typeof obj;
7554
+ } : function (obj) {
7555
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
7556
+ }, _typeof(obj);
7575
7557
  }
7576
7558
 
7577
7559
  function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
@@ -7629,6 +7611,9 @@ function _defineProperties$2(target, props) {
7629
7611
  function _createClass$2(Constructor, protoProps, staticProps) {
7630
7612
  if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
7631
7613
  if (staticProps) _defineProperties$2(Constructor, staticProps);
7614
+ Object.defineProperty(Constructor, "prototype", {
7615
+ writable: false
7616
+ });
7632
7617
  return Constructor;
7633
7618
  }
7634
7619
 
@@ -7659,6 +7644,9 @@ function _inherits(subClass, superClass) {
7659
7644
  configurable: true
7660
7645
  }
7661
7646
  });
7647
+ Object.defineProperty(subClass, "prototype", {
7648
+ writable: false
7649
+ });
7662
7650
  if (superClass) _setPrototypeOf(subClass, superClass);
7663
7651
  }
7664
7652
 
@@ -32141,6 +32129,7 @@ var getEtherscanAddress = function getEtherscanAddress(postFix, chainId) {
32141
32129
  };
32142
32130
 
32143
32131
  function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, value, additionalData) {
32132
+ provider = window.ganache || provider;
32144
32133
  additionalData = additionalData || {};
32145
32134
  var address = fromOrPlainPrivateKey;
32146
32135
  var privateKey;
@@ -32195,119 +32184,99 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
32195
32184
  _context2.t4 = _context2.t3;
32196
32185
  tx.gasLimit = _context2.t2.toHex.call(_context2.t2, _context2.t4);
32197
32186
 
32198
- if (!provider.blockchainConnection) {
32199
- _context2.next = 44;
32200
- break;
32201
- }
32202
-
32203
- _context2.prev = 25;
32204
- _context2.t5 = provider.accounts.indexOf(tx.from) === -1;
32205
-
32206
- if (!_context2.t5) {
32207
- _context2.next = 30;
32187
+ if (!window.ganache) {
32188
+ _context2.next = 35;
32208
32189
  break;
32209
32190
  }
32210
32191
 
32192
+ _context2.t5 = ok;
32193
+ _context2.t6 = sendAsync;
32194
+ _context2.t7 = window.ganache;
32211
32195
  _context2.next = 30;
32212
- return provider.blockchainConnection.unlockAccounts(tx.from);
32213
-
32214
- case 30:
32215
- _context2.next = 34;
32216
- break;
32217
-
32218
- case 32:
32219
- _context2.prev = 32;
32220
- _context2.t6 = _context2["catch"](25);
32221
-
32222
- case 34:
32223
- _context2.t7 = ok;
32224
- _context2.t8 = sendAsync;
32225
- _context2.t9 = provider;
32226
- _context2.next = 39;
32227
32196
  return sendAsync(provider, 'eth_sendTransaction', tx);
32228
32197
 
32229
- case 39:
32230
- _context2.t10 = _context2.sent;
32231
- _context2.next = 42;
32232
- return (0, _context2.t8)(_context2.t9, 'eth_getTransactionReceipt', _context2.t10);
32198
+ case 30:
32199
+ _context2.t8 = _context2.sent;
32200
+ _context2.next = 33;
32201
+ return (0, _context2.t6)(_context2.t7, 'eth_getTransactionReceipt', _context2.t8);
32233
32202
 
32234
- case 42:
32235
- _context2.t11 = _context2.sent;
32236
- return _context2.abrupt("return", (0, _context2.t7)(_context2.t11));
32203
+ case 33:
32204
+ _context2.t9 = _context2.sent;
32205
+ return _context2.abrupt("return", (0, _context2.t5)(_context2.t9));
32237
32206
 
32238
- case 44:
32207
+ case 35:
32239
32208
  if (!(window.bypassEstimation || additionalData.gasLimit)) {
32240
- _context2.next = 48;
32209
+ _context2.next = 39;
32241
32210
  break;
32242
32211
  }
32243
32212
 
32244
- _context2.t12 = tx.gasLimit;
32245
- _context2.next = 60;
32213
+ _context2.t10 = tx.gasLimit;
32214
+ _context2.next = 51;
32246
32215
  break;
32247
32216
 
32248
- case 48:
32249
- _context2.t13 = web3.utils;
32250
- _context2.t14 = web3.utils;
32251
- _context2.t15 = parseInt;
32252
- _context2.t16 = parseInt;
32253
- _context2.next = 54;
32217
+ case 39:
32218
+ _context2.t11 = web3.utils;
32219
+ _context2.t12 = web3.utils;
32220
+ _context2.t13 = parseInt;
32221
+ _context2.t14 = parseInt;
32222
+ _context2.next = 45;
32254
32223
  return sendAsync(provider, 'eth_estimateGas', tx);
32255
32224
 
32256
- case 54:
32257
- _context2.t17 = _context2.sent;
32258
- _context2.t18 = (0, _context2.t16)(_context2.t17);
32259
- _context2.t19 = _context2.t18 * 1.10269;
32260
- _context2.t20 = (0, _context2.t15)(_context2.t19);
32261
- _context2.t21 = _context2.t14.toBN.call(_context2.t14, _context2.t20).toString();
32262
- _context2.t12 = _context2.t13.toHex.call(_context2.t13, _context2.t21);
32225
+ case 45:
32226
+ _context2.t15 = _context2.sent;
32227
+ _context2.t16 = (0, _context2.t14)(_context2.t15);
32228
+ _context2.t17 = _context2.t16 * 1.10269;
32229
+ _context2.t18 = (0, _context2.t13)(_context2.t17);
32230
+ _context2.t19 = _context2.t12.toBN.call(_context2.t12, _context2.t18).toString();
32231
+ _context2.t10 = _context2.t11.toHex.call(_context2.t11, _context2.t19);
32263
32232
 
32264
- case 60:
32265
- tx.gasLimit = _context2.t12;
32266
- _context2.t22 = !window.bypassEstimation;
32233
+ case 51:
32234
+ tx.gasLimit = _context2.t10;
32235
+ _context2.t20 = !window.bypassEstimation;
32267
32236
 
32268
- if (!_context2.t22) {
32269
- _context2.next = 65;
32237
+ if (!_context2.t20) {
32238
+ _context2.next = 56;
32270
32239
  break;
32271
32240
  }
32272
32241
 
32273
- _context2.next = 65;
32242
+ _context2.next = 56;
32274
32243
  return sendAsync(provider, 'eth_estimateGas', tx);
32275
32244
 
32276
- case 65:
32245
+ case 56:
32277
32246
  tx.gas = tx.gasLimit;
32278
32247
 
32279
32248
  if (!privateKey) {
32280
- _context2.next = 81;
32249
+ _context2.next = 72;
32281
32250
  break;
32282
32251
  }
32283
32252
 
32284
- _context2.t23 = global.EthereumJSTransaction.Transaction;
32285
- _context2.t24 = tx;
32286
- _context2.t25 = parseInt;
32287
- _context2.next = 72;
32253
+ _context2.t21 = global.EthereumJSTransaction.Transaction;
32254
+ _context2.t22 = tx;
32255
+ _context2.t23 = parseInt;
32256
+ _context2.next = 63;
32288
32257
  return sendAsync(provider, 'eth_chainId');
32289
32258
 
32290
- case 72:
32291
- _context2.t26 = _context2.sent;
32292
- _context2.t27 = (0, _context2.t25)(_context2.t26);
32293
- _context2.t28 = {
32294
- chain: _context2.t27
32259
+ case 63:
32260
+ _context2.t24 = _context2.sent;
32261
+ _context2.t25 = (0, _context2.t23)(_context2.t24);
32262
+ _context2.t26 = {
32263
+ chain: _context2.t25
32295
32264
  };
32296
- transaction = new _context2.t23(_context2.t24, _context2.t28);
32265
+ transaction = new _context2.t21(_context2.t22, _context2.t26);
32297
32266
  transaction.sign(privateKey);
32298
32267
  serializedTx = '0x' + transaction.serialize().toString('hex');
32299
32268
  sendTransaction = sendAsync(provider, 'eth_sendRawTransaction', serializedTx);
32300
- _context2.next = 82;
32269
+ _context2.next = 73;
32301
32270
  break;
32302
32271
 
32303
- case 81:
32272
+ case 72:
32304
32273
  sendTransaction = sendAsync(provider, 'eth_sendTransaction', tx);
32305
32274
 
32306
- case 82:
32307
- _context2.next = 84;
32275
+ case 73:
32276
+ _context2.next = 75;
32308
32277
  return sendTransaction;
32309
32278
 
32310
- case 84:
32279
+ case 75:
32311
32280
  transactionHash = _context2.sent;
32312
32281
  console.log(new Date().toUTCString(), 'Transaction!', getEtherscanAddress('tx/' + transactionHash, tx.chainId));
32313
32282
 
@@ -32323,35 +32292,18 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
32323
32292
 
32324
32293
  case 2:
32325
32294
  receipt = _context.sent;
32326
- _context.t0 = !receipt || !receipt.blockNumber;
32327
-
32328
- if (_context.t0) {
32329
- _context.next = 12;
32330
- break;
32331
- }
32332
-
32333
- _context.t1 = parseInt;
32334
- _context.next = 8;
32335
- return sendAsync(provider, 'eth_getBlockByNumber', 'latest', false);
32336
32295
 
32337
- case 8:
32338
- _context.t2 = _context.sent.number;
32339
- _context.t3 = (0, _context.t1)(_context.t2);
32340
- _context.t4 = parseInt(receipt.blockNumber);
32341
- _context.t0 = _context.t3 <= _context.t4;
32342
-
32343
- case 12:
32344
- if (!_context.t0) {
32345
- _context.next = 14;
32296
+ if (!(!receipt || !receipt.blockNumber)) {
32297
+ _context.next = 5;
32346
32298
  break;
32347
32299
  }
32348
32300
 
32349
32301
  return _context.abrupt("return", setTimeout(timeout, 3000));
32350
32302
 
32351
- case 14:
32303
+ case 5:
32352
32304
  return _context.abrupt("return", ok(receipt));
32353
32305
 
32354
- case 15:
32306
+ case 6:
32355
32307
  case "end":
32356
32308
  return _context.stop();
32357
32309
  }
@@ -32365,20 +32317,20 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
32365
32317
  }();
32366
32318
 
32367
32319
  setTimeout(timeout);
32368
- _context2.next = 93;
32320
+ _context2.next = 84;
32369
32321
  break;
32370
32322
 
32371
- case 90:
32372
- _context2.prev = 90;
32373
- _context2.t29 = _context2["catch"](0);
32374
- return _context2.abrupt("return", ko(_context2.t29));
32323
+ case 81:
32324
+ _context2.prev = 81;
32325
+ _context2.t27 = _context2["catch"](0);
32326
+ return _context2.abrupt("return", ko(_context2.t27));
32375
32327
 
32376
- case 93:
32328
+ case 84:
32377
32329
  case "end":
32378
32330
  return _context2.stop();
32379
32331
  }
32380
32332
  }
32381
- }, _callee2, null, [[0, 90], [25, 32]]);
32333
+ }, _callee2, null, [[0, 81]]);
32382
32334
  }));
32383
32335
 
32384
32336
  return function (_x, _x2) {
@@ -34709,7 +34661,7 @@ var symbols = {
34709
34661
  */
34710
34662
 
34711
34663
  function toEthereumSymbol(decimals) {
34712
- var d = '1' + new Array(decimals + 1).join('0');
34664
+ var d = '1' + new Array(parseInt(decimals) + 1).join('0');
34713
34665
  return (Object.entries(symbols).find(function (_ref) {
34714
34666
  var _ref2 = _slicedToArray(_ref, 2);
34715
34667
  _ref2[0];
@@ -44773,6 +44725,7 @@ var POOL_INIT_CODE_HASH = '0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea8932
44773
44725
  exports.FeeAmount = void 0;
44774
44726
 
44775
44727
  (function (FeeAmount) {
44728
+ FeeAmount[FeeAmount["LOWEST"] = 100] = "LOWEST";
44776
44729
  FeeAmount[FeeAmount["LOW"] = 500] = "LOW";
44777
44730
  FeeAmount[FeeAmount["MEDIUM"] = 3000] = "MEDIUM";
44778
44731
  FeeAmount[FeeAmount["HIGH"] = 10000] = "HIGH";
@@ -44782,7 +44735,7 @@ exports.FeeAmount = void 0;
44782
44735
  */
44783
44736
 
44784
44737
 
44785
- var TICK_SPACINGS = (_TICK_SPACINGS = {}, _TICK_SPACINGS[exports.FeeAmount.LOW] = 10, _TICK_SPACINGS[exports.FeeAmount.MEDIUM] = 60, _TICK_SPACINGS[exports.FeeAmount.HIGH] = 200, _TICK_SPACINGS);
44738
+ var TICK_SPACINGS = (_TICK_SPACINGS = {}, _TICK_SPACINGS[exports.FeeAmount.LOWEST] = 1, _TICK_SPACINGS[exports.FeeAmount.LOW] = 10, _TICK_SPACINGS[exports.FeeAmount.MEDIUM] = 60, _TICK_SPACINGS[exports.FeeAmount.HIGH] = 200, _TICK_SPACINGS);
44786
44739
 
44787
44740
  var NEGATIVE_ONE = /*#__PURE__*/JSBI.BigInt(-1);
44788
44741
  var ZERO = /*#__PURE__*/JSBI.BigInt(0);
@@ -45313,7 +45266,7 @@ var TickList = /*#__PURE__*/function () {
45313
45266
  } else {
45314
45267
  var _wordPos = compressed + 1 >> 8;
45315
45268
 
45316
- var maximum = (_wordPos + 1 << 8) * tickSpacing - 1;
45269
+ var maximum = ((_wordPos + 1 << 8) - 1) * tickSpacing;
45317
45270
 
45318
45271
  if (this.isAtOrAboveLargest(ticks, tick)) {
45319
45272
  return [maximum, false];
@@ -45508,6 +45461,23 @@ function nearestUsableTick(tick, tickSpacing) {
45508
45461
  if (rounded < TickMath.MIN_TICK) return rounded + tickSpacing;else if (rounded > TickMath.MAX_TICK) return rounded - tickSpacing;else return rounded;
45509
45462
  }
45510
45463
 
45464
+ var Q128 = /*#__PURE__*/JSBI.exponentiate( /*#__PURE__*/JSBI.BigInt(2), /*#__PURE__*/JSBI.BigInt(128));
45465
+ var PositionLibrary = /*#__PURE__*/function () {
45466
+ /**
45467
+ * Cannot be constructed.
45468
+ */
45469
+ function PositionLibrary() {} // replicates the portions of Position#update required to compute unaccounted fees
45470
+
45471
+
45472
+ PositionLibrary.getTokensOwed = function getTokensOwed(feeGrowthInside0LastX128, feeGrowthInside1LastX128, liquidity, feeGrowthInside0X128, feeGrowthInside1X128) {
45473
+ var tokensOwed0 = JSBI.divide(JSBI.multiply(subIn256(feeGrowthInside0X128, feeGrowthInside0LastX128), liquidity), Q128);
45474
+ var tokensOwed1 = JSBI.divide(JSBI.multiply(subIn256(feeGrowthInside1X128, feeGrowthInside1LastX128), liquidity), Q128);
45475
+ return [tokensOwed0, tokensOwed1];
45476
+ };
45477
+
45478
+ return PositionLibrary;
45479
+ }();
45480
+
45511
45481
  /**
45512
45482
  * Returns a price object corresponding to the input tick and the base/quote token
45513
45483
  * Inputs must be tokens because the address order is used to interpret the price represented by the tick
@@ -45546,6 +45516,51 @@ function priceToClosestTick(price) {
45546
45516
  return tick;
45547
45517
  }
45548
45518
 
45519
+ var Q256 = /*#__PURE__*/JSBI.exponentiate( /*#__PURE__*/JSBI.BigInt(2), /*#__PURE__*/JSBI.BigInt(256));
45520
+ function subIn256(x, y) {
45521
+ var difference = JSBI.subtract(x, y);
45522
+
45523
+ if (JSBI.lessThan(difference, ZERO)) {
45524
+ return JSBI.add(Q256, difference);
45525
+ } else {
45526
+ return difference;
45527
+ }
45528
+ }
45529
+ var TickLibrary = /*#__PURE__*/function () {
45530
+ /**
45531
+ * Cannot be constructed.
45532
+ */
45533
+ function TickLibrary() {}
45534
+
45535
+ TickLibrary.getFeeGrowthInside = function getFeeGrowthInside(feeGrowthOutsideLower, feeGrowthOutsideUpper, tickLower, tickUpper, tickCurrent, feeGrowthGlobal0X128, feeGrowthGlobal1X128) {
45536
+ var feeGrowthBelow0X128;
45537
+ var feeGrowthBelow1X128;
45538
+
45539
+ if (tickCurrent >= tickLower) {
45540
+ feeGrowthBelow0X128 = feeGrowthOutsideLower.feeGrowthOutside0X128;
45541
+ feeGrowthBelow1X128 = feeGrowthOutsideLower.feeGrowthOutside1X128;
45542
+ } else {
45543
+ feeGrowthBelow0X128 = subIn256(feeGrowthGlobal0X128, feeGrowthOutsideLower.feeGrowthOutside0X128);
45544
+ feeGrowthBelow1X128 = subIn256(feeGrowthGlobal1X128, feeGrowthOutsideLower.feeGrowthOutside1X128);
45545
+ }
45546
+
45547
+ var feeGrowthAbove0X128;
45548
+ var feeGrowthAbove1X128;
45549
+
45550
+ if (tickCurrent < tickUpper) {
45551
+ feeGrowthAbove0X128 = feeGrowthOutsideUpper.feeGrowthOutside0X128;
45552
+ feeGrowthAbove1X128 = feeGrowthOutsideUpper.feeGrowthOutside1X128;
45553
+ } else {
45554
+ feeGrowthAbove0X128 = subIn256(feeGrowthGlobal0X128, feeGrowthOutsideUpper.feeGrowthOutside0X128);
45555
+ feeGrowthAbove1X128 = subIn256(feeGrowthGlobal1X128, feeGrowthOutsideUpper.feeGrowthOutside1X128);
45556
+ }
45557
+
45558
+ return [subIn256(subIn256(feeGrowthGlobal0X128, feeGrowthBelow0X128), feeGrowthAbove0X128), subIn256(subIn256(feeGrowthGlobal1X128, feeGrowthBelow1X128), feeGrowthAbove1X128)];
45559
+ };
45560
+
45561
+ return TickLibrary;
45562
+ }();
45563
+
45549
45564
  var Tick = function Tick(_ref) {
45550
45565
  var index = _ref.index,
45551
45566
  liquidityGross = _ref.liquidityGross,
@@ -49158,15 +49173,18 @@ exports.Percent = Percent;
49158
49173
  exports.PluginsContextProvider = PluginsContextProvider;
49159
49174
  exports.Pool = Pool;
49160
49175
  exports.Position = Position;
49176
+ exports.PositionLibrary = PositionLibrary;
49161
49177
  exports.Price = Price;
49162
49178
  exports.Route = Route;
49163
49179
  exports.SelfPermit = SelfPermit;
49164
49180
  exports.SqrtPriceMath = SqrtPriceMath;
49165
49181
  exports.Staker = Staker;
49182
+ exports.SwapMath = SwapMath;
49166
49183
  exports.SwapQuoter = SwapQuoter;
49167
49184
  exports.SwapRouter = SwapRouter;
49168
49185
  exports.TICK_SPACINGS = TICK_SPACINGS;
49169
49186
  exports.Tick = Tick;
49187
+ exports.TickLibrary = TickLibrary;
49170
49188
  exports.TickList = TickList;
49171
49189
  exports.TickListDataProvider = TickListDataProvider;
49172
49190
  exports.TickMath = TickMath;
@@ -49244,6 +49262,7 @@ exports.split = split;
49244
49262
  exports.sqrt = sqrt;
49245
49263
  exports.stringToLines = toLines;
49246
49264
  exports.sub = sub;
49265
+ exports.subIn256 = subIn256;
49247
49266
  exports.swap = swap;
49248
49267
  exports.tickToPrice = tickToPrice;
49249
49268
  exports.toDecimals = toDecimals;