@ethereansos/interfaces-core 0.4.82 → 0.4.86

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
@@ -32118,7 +32118,7 @@ function _getAddress() {
32118
32118
  }]
32119
32119
  }, {}, [30]);
32120
32120
 
32121
- var web3$1 = new Web3__default["default"]();
32121
+ var web3 = new Web3__default["default"]();
32122
32122
 
32123
32123
  var getEtherscanAddress = function getEtherscanAddress(postFix, chainId) {
32124
32124
  var address = 'http://';
@@ -32140,12 +32140,13 @@ var getEtherscanAddress = function getEtherscanAddress(postFix, chainId) {
32140
32140
  return address;
32141
32141
  };
32142
32142
 
32143
- function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, value) {
32143
+ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, value, additionalData) {
32144
+ additionalData = additionalData || {};
32144
32145
  var address = fromOrPlainPrivateKey;
32145
32146
  var privateKey;
32146
32147
 
32147
32148
  try {
32148
- address = web3$1.eth.accounts.privateKeyToAccount(fromOrPlainPrivateKey).address;
32149
+ address = web3.eth.accounts.privateKeyToAccount(fromOrPlainPrivateKey).address;
32149
32150
  privateKey = Buffer.from(fromOrPlainPrivateKey, 'hex');
32150
32151
  } catch (e) {}
32151
32152
 
@@ -32163,138 +32164,148 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
32163
32164
 
32164
32165
  case 4:
32165
32166
  nonce = _context2.sent;
32166
- nonce = web3$1.utils.toHex(nonce);
32167
+ nonce = web3.utils.toHex(nonce);
32167
32168
  tx.nonce = nonce;
32168
32169
  tx.from = address;
32169
32170
  to && (tx.to = to);
32170
32171
  tx.data = data;
32171
- tx.value = web3$1.utils.toHex(value || '0');
32172
- _context2.t0 = web3$1.utils;
32172
+ tx.value = web3.utils.toHex(value || '0');
32173
+ _context2.t0 = web3.utils;
32173
32174
  _context2.next = 14;
32174
32175
  return sendAsync(provider, 'eth_chainId');
32175
32176
 
32176
32177
  case 14:
32177
32178
  _context2.t1 = _context2.sent;
32178
32179
  tx.chainId = _context2.t0.toHex.call(_context2.t0, _context2.t1);
32179
- _context2.t2 = web3$1.utils;
32180
- _context2.next = 19;
32180
+ _context2.t2 = web3.utils;
32181
+ _context2.t3 = additionalData.gasLimit;
32182
+
32183
+ if (_context2.t3) {
32184
+ _context2.next = 22;
32185
+ break;
32186
+ }
32187
+
32188
+ _context2.next = 21;
32181
32189
  return sendAsync(provider, 'eth_getBlockByNumber', 'latest', false);
32182
32190
 
32183
- case 19:
32191
+ case 21:
32184
32192
  _context2.t3 = _context2.sent.gasLimit;
32185
- tx.gasLimit = _context2.t2.toHex.call(_context2.t2, _context2.t3);
32193
+
32194
+ case 22:
32195
+ _context2.t4 = _context2.t3;
32196
+ tx.gasLimit = _context2.t2.toHex.call(_context2.t2, _context2.t4);
32186
32197
 
32187
32198
  if (!provider.blockchainConnection) {
32188
- _context2.next = 41;
32199
+ _context2.next = 44;
32189
32200
  break;
32190
32201
  }
32191
32202
 
32192
- _context2.prev = 22;
32193
- _context2.t4 = provider.accounts.indexOf(tx.from) === -1;
32203
+ _context2.prev = 25;
32204
+ _context2.t5 = provider.accounts.indexOf(tx.from) === -1;
32194
32205
 
32195
- if (!_context2.t4) {
32196
- _context2.next = 27;
32206
+ if (!_context2.t5) {
32207
+ _context2.next = 30;
32197
32208
  break;
32198
32209
  }
32199
32210
 
32200
- _context2.next = 27;
32211
+ _context2.next = 30;
32201
32212
  return provider.blockchainConnection.unlockAccounts(tx.from);
32202
32213
 
32203
- case 27:
32204
- _context2.next = 31;
32214
+ case 30:
32215
+ _context2.next = 34;
32205
32216
  break;
32206
32217
 
32207
- case 29:
32208
- _context2.prev = 29;
32209
- _context2.t5 = _context2["catch"](22);
32210
-
32211
- case 31:
32212
- _context2.t6 = ok;
32213
- _context2.t7 = sendAsync;
32214
- _context2.t8 = provider;
32215
- _context2.next = 36;
32216
- return sendAsync(provider, 'eth_sendTransaction', tx);
32218
+ case 32:
32219
+ _context2.prev = 32;
32220
+ _context2.t6 = _context2["catch"](25);
32217
32221
 
32218
- case 36:
32219
- _context2.t9 = _context2.sent;
32222
+ case 34:
32223
+ _context2.t7 = ok;
32224
+ _context2.t8 = sendAsync;
32225
+ _context2.t9 = provider;
32220
32226
  _context2.next = 39;
32221
- return (0, _context2.t7)(_context2.t8, 'eth_getTransactionReceipt', _context2.t9);
32227
+ return sendAsync(provider, 'eth_sendTransaction', tx);
32222
32228
 
32223
32229
  case 39:
32224
32230
  _context2.t10 = _context2.sent;
32225
- return _context2.abrupt("return", (0, _context2.t6)(_context2.t10));
32231
+ _context2.next = 42;
32232
+ return (0, _context2.t8)(_context2.t9, 'eth_getTransactionReceipt', _context2.t10);
32226
32233
 
32227
- case 41:
32228
- if (!window.bypassEstimation) {
32229
- _context2.next = 45;
32234
+ case 42:
32235
+ _context2.t11 = _context2.sent;
32236
+ return _context2.abrupt("return", (0, _context2.t7)(_context2.t11));
32237
+
32238
+ case 44:
32239
+ if (!(window.bypassEstimation || additionalData.gasLimit)) {
32240
+ _context2.next = 48;
32230
32241
  break;
32231
32242
  }
32232
32243
 
32233
- _context2.t11 = tx.gasLimit;
32234
- _context2.next = 57;
32244
+ _context2.t12 = tx.gasLimit;
32245
+ _context2.next = 60;
32235
32246
  break;
32236
32247
 
32237
- case 45:
32238
- _context2.t12 = web3$1.utils;
32239
- _context2.t13 = web3$1.utils;
32240
- _context2.t14 = parseInt;
32248
+ case 48:
32249
+ _context2.t13 = web3.utils;
32250
+ _context2.t14 = web3.utils;
32241
32251
  _context2.t15 = parseInt;
32242
- _context2.next = 51;
32252
+ _context2.t16 = parseInt;
32253
+ _context2.next = 54;
32243
32254
  return sendAsync(provider, 'eth_estimateGas', tx);
32244
32255
 
32245
- case 51:
32246
- _context2.t16 = _context2.sent;
32247
- _context2.t17 = (0, _context2.t15)(_context2.t16);
32248
- _context2.t18 = _context2.t17 * 1.10269;
32249
- _context2.t19 = (0, _context2.t14)(_context2.t18);
32250
- _context2.t20 = _context2.t13.toBN.call(_context2.t13, _context2.t19).toString();
32251
- _context2.t11 = _context2.t12.toHex.call(_context2.t12, _context2.t20);
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);
32252
32263
 
32253
- case 57:
32254
- tx.gasLimit = _context2.t11;
32255
- _context2.t21 = !window.bypassEstimation;
32264
+ case 60:
32265
+ tx.gasLimit = _context2.t12;
32266
+ _context2.t22 = !window.bypassEstimation;
32256
32267
 
32257
- if (!_context2.t21) {
32258
- _context2.next = 62;
32268
+ if (!_context2.t22) {
32269
+ _context2.next = 65;
32259
32270
  break;
32260
32271
  }
32261
32272
 
32262
- _context2.next = 62;
32273
+ _context2.next = 65;
32263
32274
  return sendAsync(provider, 'eth_estimateGas', tx);
32264
32275
 
32265
- case 62:
32276
+ case 65:
32266
32277
  if (!privateKey) {
32267
- _context2.next = 77;
32278
+ _context2.next = 80;
32268
32279
  break;
32269
32280
  }
32270
32281
 
32271
- _context2.t22 = global.EthereumJSTransaction.Transaction;
32272
- _context2.t23 = tx;
32273
- _context2.t24 = parseInt;
32274
- _context2.next = 68;
32282
+ _context2.t23 = global.EthereumJSTransaction.Transaction;
32283
+ _context2.t24 = tx;
32284
+ _context2.t25 = parseInt;
32285
+ _context2.next = 71;
32275
32286
  return sendAsync(provider, 'eth_chainId');
32276
32287
 
32277
- case 68:
32278
- _context2.t25 = _context2.sent;
32279
- _context2.t26 = (0, _context2.t24)(_context2.t25);
32280
- _context2.t27 = {
32281
- chain: _context2.t26
32288
+ case 71:
32289
+ _context2.t26 = _context2.sent;
32290
+ _context2.t27 = (0, _context2.t25)(_context2.t26);
32291
+ _context2.t28 = {
32292
+ chain: _context2.t27
32282
32293
  };
32283
- transaction = new _context2.t22(_context2.t23, _context2.t27);
32294
+ transaction = new _context2.t23(_context2.t24, _context2.t28);
32284
32295
  transaction.sign(privateKey);
32285
32296
  serializedTx = '0x' + transaction.serialize().toString('hex');
32286
32297
  sendTransaction = sendAsync(provider, 'eth_sendRawTransaction', serializedTx);
32287
- _context2.next = 78;
32298
+ _context2.next = 81;
32288
32299
  break;
32289
32300
 
32290
- case 77:
32301
+ case 80:
32291
32302
  sendTransaction = sendAsync(provider, 'eth_sendTransaction', tx);
32292
32303
 
32293
- case 78:
32294
- _context2.next = 80;
32304
+ case 81:
32305
+ _context2.next = 83;
32295
32306
  return sendTransaction;
32296
32307
 
32297
- case 80:
32308
+ case 83:
32298
32309
  transactionHash = _context2.sent;
32299
32310
  console.log(new Date().toUTCString(), 'Transaction!', getEtherscanAddress('tx/' + transactionHash, tx.chainId));
32300
32311
 
@@ -32352,20 +32363,20 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
32352
32363
  }();
32353
32364
 
32354
32365
  setTimeout(timeout);
32355
- _context2.next = 89;
32366
+ _context2.next = 92;
32356
32367
  break;
32357
32368
 
32358
- case 86:
32359
- _context2.prev = 86;
32360
- _context2.t28 = _context2["catch"](0);
32361
- return _context2.abrupt("return", ko(_context2.t28));
32362
-
32363
32369
  case 89:
32370
+ _context2.prev = 89;
32371
+ _context2.t29 = _context2["catch"](0);
32372
+ return _context2.abrupt("return", ko(_context2.t29));
32373
+
32374
+ case 92:
32364
32375
  case "end":
32365
32376
  return _context2.stop();
32366
32377
  }
32367
32378
  }
32368
- }, _callee2, null, [[0, 86], [22, 29]]);
32379
+ }, _callee2, null, [[0, 89], [25, 32]]);
32369
32380
  }));
32370
32381
 
32371
32382
  return function (_x, _x2) {
@@ -32522,8 +32533,6 @@ var getAllContracts = function getAllContracts() {
32522
32533
  return allContracts;
32523
32534
  };
32524
32535
 
32525
- var web3 = new Web3__default["default"]();
32526
-
32527
32536
  function blockchainCall() {
32528
32537
  return _blockchainCall.apply(this, arguments);
32529
32538
  }
@@ -32538,8 +32547,10 @@ function _blockchainCall() {
32538
32547
  data,
32539
32548
  fromForSend,
32540
32549
  to,
32550
+ dataInput,
32541
32551
  result,
32542
32552
  address,
32553
+ web3,
32543
32554
  _args3 = arguments;
32544
32555
  return regeneratorRuntime.wrap(function _callee3$(_context3) {
32545
32556
  while (1) {
@@ -32555,74 +32566,76 @@ function _blockchainCall() {
32555
32566
  method = (method.implementation ? method.get : method["new"] ? method["new"] : method).apply(void 0, _toConsumableArray(args));
32556
32567
  } catch (e) {
32557
32568
  data = args[args.length - 1];
32558
- from = data.from || from;
32569
+ from = data.fromOrPlainPrivateKey || data.from || from;
32559
32570
  value = data.value || value;
32560
32571
  blockNumber = data.blockNumber || blockNumber;
32561
- method = (method.implementation ? method.get : method["new"] ? method["new"] : method).apply(void 0, _toConsumableArray(args = args.slice(0, args.length - 1)));
32572
+ args = args.slice(0, args.length - 1);
32573
+ method = (method.implementation ? method.get : method["new"] ? method["new"] : method).apply(void 0, _toConsumableArray(args));
32562
32574
  }
32563
32575
 
32564
- _context3.prev = 6;
32565
-
32566
32576
  if (!(from === VOID_ETHEREUM_ADDRESS)) {
32567
- _context3.next = 13;
32577
+ _context3.next = 23;
32568
32578
  break;
32569
32579
  }
32570
32580
 
32571
- _context3.next = 10;
32572
- return getAddress({
32573
- provider: method._parent.currentProvider
32574
- });
32575
-
32576
- case 10:
32577
- _context3.t0 = _context3.sent;
32578
- _context3.next = 14;
32581
+ _context3.prev = 7;
32582
+ from = method._parent.currentProvider.accounts[0];
32583
+ _context3.next = 23;
32579
32584
  break;
32580
32585
 
32581
- case 13:
32582
- _context3.t0 = from;
32586
+ case 11:
32587
+ _context3.prev = 11;
32588
+ _context3.t0 = _context3["catch"](7);
32589
+ _context3.prev = 13;
32590
+ _context3.next = 16;
32591
+ return method._parent.currentProvider.request({
32592
+ method: 'eth_requestAccounts'
32593
+ });
32583
32594
 
32584
- case 14:
32585
- from = _context3.t0;
32586
- _context3.next = 21;
32595
+ case 16:
32596
+ from = _context3.sent[0];
32597
+ _context3.next = 23;
32587
32598
  break;
32588
32599
 
32589
- case 17:
32590
- _context3.prev = 17;
32591
- _context3.t1 = _context3["catch"](6);
32600
+ case 19:
32601
+ _context3.prev = 19;
32602
+ _context3.t1 = _context3["catch"](13);
32592
32603
  data = args[args.length - 1];
32593
32604
 
32594
32605
  if (data) {
32595
- from = data.from || from;
32606
+ from = data.fromOrPlainPrivateKey || data.from || from;
32596
32607
  value = data.value || value;
32597
32608
  blockNumber = data.blockNumber || blockNumber;
32598
32609
  }
32599
32610
 
32600
- case 21:
32611
+ case 23:
32601
32612
  fromForSend = from;
32602
32613
 
32603
32614
  try {
32604
- from = web3.eth.accounts.privateKeyToAccount(fromForSend).address;
32615
+ from = new Web3__default["default"](method._parent.currentProvider).eth.accounts.privateKeyToAccount(fromForSend).address;
32605
32616
  } catch (e) {}
32606
32617
 
32607
32618
  to = method._parent.options.address;
32619
+ dataInput = data;
32608
32620
  data = method.encodeABI();
32609
- _context3.next = 27;
32621
+ _context3.next = 30;
32610
32622
  return method._method.stateMutability === 'view' || method._method.stateMutability === 'pure' ? method.call({
32611
32623
  from: from,
32612
32624
  value: value
32613
- }, blockNumber) : sendBlockchainTransaction(method._parent.currentProvider, fromForSend, to, data, value);
32625
+ }, blockNumber) : sendBlockchainTransaction(method._parent.currentProvider, fromForSend, to, data, value, dataInput);
32614
32626
 
32615
- case 27:
32627
+ case 30:
32616
32628
  result = _context3.sent;
32617
32629
 
32618
32630
  if (to) {
32619
- _context3.next = 34;
32631
+ _context3.next = 38;
32620
32632
  break;
32621
32633
  }
32622
32634
 
32623
32635
  method._parent.options.address = result.contractAddress;
32624
32636
  address = method._parent.options.address;
32625
- _context3.next = 33;
32637
+ web3 = new Web3__default["default"](method._parent.currentProvider);
32638
+ _context3.next = 37;
32626
32639
  return new Promise( /*#__PURE__*/function () {
32627
32640
  var _ref = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ok) {
32628
32641
  var set;
@@ -32640,7 +32653,7 @@ function _blockchainCall() {
32640
32653
  _context.prev = 0;
32641
32654
  _context.t0 = web3.utils;
32642
32655
  _context.next = 4;
32643
- return sendAsync(method._parent.currentProvider, 'eth_getCode', address, 'latest');
32656
+ return web3.eth.getCode(address);
32644
32657
 
32645
32658
  case 4:
32646
32659
  _context.t1 = _context.sent;
@@ -32691,18 +32704,18 @@ function _blockchainCall() {
32691
32704
  };
32692
32705
  }());
32693
32706
 
32694
- case 33:
32707
+ case 37:
32695
32708
  return _context3.abrupt("return", method._parent);
32696
32709
 
32697
- case 34:
32710
+ case 38:
32698
32711
  return _context3.abrupt("return", result);
32699
32712
 
32700
- case 35:
32713
+ case 39:
32701
32714
  case "end":
32702
32715
  return _context3.stop();
32703
32716
  }
32704
32717
  }
32705
- }, _callee3, null, [[6, 17]]);
32718
+ }, _callee3, null, [[7, 11], [13, 19]]);
32706
32719
  }));
32707
32720
  return _blockchainCall.apply(this, arguments);
32708
32721
  }
@@ -34712,8 +34725,10 @@ function toEthereumSymbol(decimals) {
34712
34725
  */
34713
34726
 
34714
34727
  function toDecimals(number, decimals) {
34715
- number = numberToString(number.value || number || 0);
34716
- decimals = numberToString(decimals.value || decimals || 0);
34728
+ var _number, _decimals;
34729
+
34730
+ number = numberToString(((_number = number) === null || _number === void 0 ? void 0 : _number.value) || number || 0);
34731
+ decimals = numberToString(((_decimals = decimals) === null || _decimals === void 0 ? void 0 : _decimals.value) || decimals || 0);
34717
34732
 
34718
34733
  if (!number) {
34719
34734
  number = '0';
@@ -48493,6 +48508,12 @@ function _tryRetrieveMetadata() {
48493
48508
  return _tryRetrieveMetadata.apply(this, arguments);
48494
48509
  }
48495
48510
 
48511
+ var conversionEncode = {
48512
+ 100: '000064',
48513
+ 500: '0001f4',
48514
+ 3000: '000bb8',
48515
+ 10000: '002710'
48516
+ };
48496
48517
  function getTokenPriceInDollarsOnUniswap(_x, _x2, _x3, _x4) {
48497
48518
  return _getTokenPriceInDollarsOnUniswap.apply(this, arguments);
48498
48519
  }
@@ -48584,7 +48605,7 @@ function _getTokenPriceInDollarsOnUniswapV() {
48584
48605
  uniTokenWeth = new Token(chainId, wethAddress, 18, 'ETH', 'Ethereum');
48585
48606
  _context3.prev = 14;
48586
48607
  _context3.next = 17;
48587
- return Promise.all(Object.keys(TICK_SPACINGS).map( /*#__PURE__*/function () {
48608
+ return Promise.all(Object.keys(conversionEncode).map( /*#__PURE__*/function () {
48588
48609
  var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(fee) {
48589
48610
  var pool, slot0, price;
48590
48611
  return regeneratorRuntime.wrap(function _callee2$(_context2) {