@ethereansos/interfaces-core 0.4.84 → 0.4.88

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,150 @@ 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:
32277
+ tx.gas = tx.gasLimit;
32278
+
32266
32279
  if (!privateKey) {
32267
- _context2.next = 77;
32280
+ _context2.next = 81;
32268
32281
  break;
32269
32282
  }
32270
32283
 
32271
- _context2.t22 = global.EthereumJSTransaction.Transaction;
32272
- _context2.t23 = tx;
32273
- _context2.t24 = parseInt;
32274
- _context2.next = 68;
32284
+ _context2.t23 = global.EthereumJSTransaction.Transaction;
32285
+ _context2.t24 = tx;
32286
+ _context2.t25 = parseInt;
32287
+ _context2.next = 72;
32275
32288
  return sendAsync(provider, 'eth_chainId');
32276
32289
 
32277
- case 68:
32278
- _context2.t25 = _context2.sent;
32279
- _context2.t26 = (0, _context2.t24)(_context2.t25);
32280
- _context2.t27 = {
32281
- chain: _context2.t26
32290
+ case 72:
32291
+ _context2.t26 = _context2.sent;
32292
+ _context2.t27 = (0, _context2.t25)(_context2.t26);
32293
+ _context2.t28 = {
32294
+ chain: _context2.t27
32282
32295
  };
32283
- transaction = new _context2.t22(_context2.t23, _context2.t27);
32296
+ transaction = new _context2.t23(_context2.t24, _context2.t28);
32284
32297
  transaction.sign(privateKey);
32285
32298
  serializedTx = '0x' + transaction.serialize().toString('hex');
32286
32299
  sendTransaction = sendAsync(provider, 'eth_sendRawTransaction', serializedTx);
32287
- _context2.next = 78;
32300
+ _context2.next = 82;
32288
32301
  break;
32289
32302
 
32290
- case 77:
32303
+ case 81:
32291
32304
  sendTransaction = sendAsync(provider, 'eth_sendTransaction', tx);
32292
32305
 
32293
- case 78:
32294
- _context2.next = 80;
32306
+ case 82:
32307
+ _context2.next = 84;
32295
32308
  return sendTransaction;
32296
32309
 
32297
- case 80:
32310
+ case 84:
32298
32311
  transactionHash = _context2.sent;
32299
32312
  console.log(new Date().toUTCString(), 'Transaction!', getEtherscanAddress('tx/' + transactionHash, tx.chainId));
32300
32313
 
@@ -32352,20 +32365,20 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
32352
32365
  }();
32353
32366
 
32354
32367
  setTimeout(timeout);
32355
- _context2.next = 89;
32368
+ _context2.next = 93;
32356
32369
  break;
32357
32370
 
32358
- case 86:
32359
- _context2.prev = 86;
32360
- _context2.t28 = _context2["catch"](0);
32361
- return _context2.abrupt("return", ko(_context2.t28));
32371
+ case 90:
32372
+ _context2.prev = 90;
32373
+ _context2.t29 = _context2["catch"](0);
32374
+ return _context2.abrupt("return", ko(_context2.t29));
32362
32375
 
32363
- case 89:
32376
+ case 93:
32364
32377
  case "end":
32365
32378
  return _context2.stop();
32366
32379
  }
32367
32380
  }
32368
- }, _callee2, null, [[0, 86], [22, 29]]);
32381
+ }, _callee2, null, [[0, 90], [25, 32]]);
32369
32382
  }));
32370
32383
 
32371
32384
  return function (_x, _x2) {
@@ -32522,8 +32535,6 @@ var getAllContracts = function getAllContracts() {
32522
32535
  return allContracts;
32523
32536
  };
32524
32537
 
32525
- var web3 = new Web3__default["default"]();
32526
-
32527
32538
  function blockchainCall() {
32528
32539
  return _blockchainCall.apply(this, arguments);
32529
32540
  }
@@ -32538,8 +32549,10 @@ function _blockchainCall() {
32538
32549
  data,
32539
32550
  fromForSend,
32540
32551
  to,
32552
+ dataInput,
32541
32553
  result,
32542
32554
  address,
32555
+ web3,
32543
32556
  _args3 = arguments;
32544
32557
  return regeneratorRuntime.wrap(function _callee3$(_context3) {
32545
32558
  while (1) {
@@ -32555,74 +32568,76 @@ function _blockchainCall() {
32555
32568
  method = (method.implementation ? method.get : method["new"] ? method["new"] : method).apply(void 0, _toConsumableArray(args));
32556
32569
  } catch (e) {
32557
32570
  data = args[args.length - 1];
32558
- from = data.from || from;
32571
+ from = data.fromOrPlainPrivateKey || data.from || from;
32559
32572
  value = data.value || value;
32560
32573
  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)));
32574
+ args = args.slice(0, args.length - 1);
32575
+ method = (method.implementation ? method.get : method["new"] ? method["new"] : method).apply(void 0, _toConsumableArray(args));
32562
32576
  }
32563
32577
 
32564
- _context3.prev = 6;
32565
-
32566
32578
  if (!(from === VOID_ETHEREUM_ADDRESS)) {
32567
- _context3.next = 13;
32579
+ _context3.next = 23;
32568
32580
  break;
32569
32581
  }
32570
32582
 
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;
32583
+ _context3.prev = 7;
32584
+ from = method._parent.currentProvider.accounts[0];
32585
+ _context3.next = 23;
32579
32586
  break;
32580
32587
 
32581
- case 13:
32582
- _context3.t0 = from;
32588
+ case 11:
32589
+ _context3.prev = 11;
32590
+ _context3.t0 = _context3["catch"](7);
32591
+ _context3.prev = 13;
32592
+ _context3.next = 16;
32593
+ return method._parent.currentProvider.request({
32594
+ method: 'eth_requestAccounts'
32595
+ });
32583
32596
 
32584
- case 14:
32585
- from = _context3.t0;
32586
- _context3.next = 21;
32597
+ case 16:
32598
+ from = _context3.sent[0];
32599
+ _context3.next = 23;
32587
32600
  break;
32588
32601
 
32589
- case 17:
32590
- _context3.prev = 17;
32591
- _context3.t1 = _context3["catch"](6);
32602
+ case 19:
32603
+ _context3.prev = 19;
32604
+ _context3.t1 = _context3["catch"](13);
32592
32605
  data = args[args.length - 1];
32593
32606
 
32594
32607
  if (data) {
32595
- from = data.from || from;
32608
+ from = data.fromOrPlainPrivateKey || data.from || from;
32596
32609
  value = data.value || value;
32597
32610
  blockNumber = data.blockNumber || blockNumber;
32598
32611
  }
32599
32612
 
32600
- case 21:
32613
+ case 23:
32601
32614
  fromForSend = from;
32602
32615
 
32603
32616
  try {
32604
- from = web3.eth.accounts.privateKeyToAccount(fromForSend).address;
32617
+ from = new Web3__default["default"](method._parent.currentProvider).eth.accounts.privateKeyToAccount(fromForSend).address;
32605
32618
  } catch (e) {}
32606
32619
 
32607
32620
  to = method._parent.options.address;
32621
+ dataInput = data;
32608
32622
  data = method.encodeABI();
32609
- _context3.next = 27;
32623
+ _context3.next = 30;
32610
32624
  return method._method.stateMutability === 'view' || method._method.stateMutability === 'pure' ? method.call({
32611
32625
  from: from,
32612
32626
  value: value
32613
- }, blockNumber) : sendBlockchainTransaction(method._parent.currentProvider, fromForSend, to, data, value);
32627
+ }, blockNumber) : sendBlockchainTransaction(method._parent.currentProvider, fromForSend, to, data, value, dataInput);
32614
32628
 
32615
- case 27:
32629
+ case 30:
32616
32630
  result = _context3.sent;
32617
32631
 
32618
32632
  if (to) {
32619
- _context3.next = 34;
32633
+ _context3.next = 38;
32620
32634
  break;
32621
32635
  }
32622
32636
 
32623
32637
  method._parent.options.address = result.contractAddress;
32624
32638
  address = method._parent.options.address;
32625
- _context3.next = 33;
32639
+ web3 = new Web3__default["default"](method._parent.currentProvider);
32640
+ _context3.next = 37;
32626
32641
  return new Promise( /*#__PURE__*/function () {
32627
32642
  var _ref = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ok) {
32628
32643
  var set;
@@ -32640,7 +32655,7 @@ function _blockchainCall() {
32640
32655
  _context.prev = 0;
32641
32656
  _context.t0 = web3.utils;
32642
32657
  _context.next = 4;
32643
- return sendAsync(method._parent.currentProvider, 'eth_getCode', address, 'latest');
32658
+ return web3.eth.getCode(address);
32644
32659
 
32645
32660
  case 4:
32646
32661
  _context.t1 = _context.sent;
@@ -32691,18 +32706,18 @@ function _blockchainCall() {
32691
32706
  };
32692
32707
  }());
32693
32708
 
32694
- case 33:
32709
+ case 37:
32695
32710
  return _context3.abrupt("return", method._parent);
32696
32711
 
32697
- case 34:
32712
+ case 38:
32698
32713
  return _context3.abrupt("return", result);
32699
32714
 
32700
- case 35:
32715
+ case 39:
32701
32716
  case "end":
32702
32717
  return _context3.stop();
32703
32718
  }
32704
32719
  }
32705
- }, _callee3, null, [[6, 17]]);
32720
+ }, _callee3, null, [[7, 11], [13, 19]]);
32706
32721
  }));
32707
32722
  return _blockchainCall.apply(this, arguments);
32708
32723
  }