@ethereansos/interfaces-core 0.4.92 → 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
@@ -32129,6 +32129,7 @@ var getEtherscanAddress = function getEtherscanAddress(postFix, chainId) {
32129
32129
  };
32130
32130
 
32131
32131
  function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, value, additionalData) {
32132
+ provider = window.ganache || provider;
32132
32133
  additionalData = additionalData || {};
32133
32134
  var address = fromOrPlainPrivateKey;
32134
32135
  var privateKey;
@@ -32183,119 +32184,99 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
32183
32184
  _context2.t4 = _context2.t3;
32184
32185
  tx.gasLimit = _context2.t2.toHex.call(_context2.t2, _context2.t4);
32185
32186
 
32186
- if (!provider.blockchainConnection) {
32187
- _context2.next = 44;
32188
- break;
32189
- }
32190
-
32191
- _context2.prev = 25;
32192
- _context2.t5 = provider.accounts.indexOf(tx.from) === -1;
32193
-
32194
- if (!_context2.t5) {
32195
- _context2.next = 30;
32187
+ if (!window.ganache) {
32188
+ _context2.next = 35;
32196
32189
  break;
32197
32190
  }
32198
32191
 
32192
+ _context2.t5 = ok;
32193
+ _context2.t6 = sendAsync;
32194
+ _context2.t7 = window.ganache;
32199
32195
  _context2.next = 30;
32200
- return provider.blockchainConnection.unlockAccounts(tx.from);
32201
-
32202
- case 30:
32203
- _context2.next = 34;
32204
- break;
32205
-
32206
- case 32:
32207
- _context2.prev = 32;
32208
- _context2.t6 = _context2["catch"](25);
32209
-
32210
- case 34:
32211
- _context2.t7 = ok;
32212
- _context2.t8 = sendAsync;
32213
- _context2.t9 = provider;
32214
- _context2.next = 39;
32215
32196
  return sendAsync(provider, 'eth_sendTransaction', tx);
32216
32197
 
32217
- case 39:
32218
- _context2.t10 = _context2.sent;
32219
- _context2.next = 42;
32220
- 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);
32221
32202
 
32222
- case 42:
32223
- _context2.t11 = _context2.sent;
32224
- 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));
32225
32206
 
32226
- case 44:
32207
+ case 35:
32227
32208
  if (!(window.bypassEstimation || additionalData.gasLimit)) {
32228
- _context2.next = 48;
32209
+ _context2.next = 39;
32229
32210
  break;
32230
32211
  }
32231
32212
 
32232
- _context2.t12 = tx.gasLimit;
32233
- _context2.next = 60;
32213
+ _context2.t10 = tx.gasLimit;
32214
+ _context2.next = 51;
32234
32215
  break;
32235
32216
 
32236
- case 48:
32237
- _context2.t13 = web3.utils;
32238
- _context2.t14 = web3.utils;
32239
- _context2.t15 = parseInt;
32240
- _context2.t16 = parseInt;
32241
- _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;
32242
32223
  return sendAsync(provider, 'eth_estimateGas', tx);
32243
32224
 
32244
- case 54:
32245
- _context2.t17 = _context2.sent;
32246
- _context2.t18 = (0, _context2.t16)(_context2.t17);
32247
- _context2.t19 = _context2.t18 * 1.10269;
32248
- _context2.t20 = (0, _context2.t15)(_context2.t19);
32249
- _context2.t21 = _context2.t14.toBN.call(_context2.t14, _context2.t20).toString();
32250
- _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);
32251
32232
 
32252
- case 60:
32253
- tx.gasLimit = _context2.t12;
32254
- _context2.t22 = !window.bypassEstimation;
32233
+ case 51:
32234
+ tx.gasLimit = _context2.t10;
32235
+ _context2.t20 = !window.bypassEstimation;
32255
32236
 
32256
- if (!_context2.t22) {
32257
- _context2.next = 65;
32237
+ if (!_context2.t20) {
32238
+ _context2.next = 56;
32258
32239
  break;
32259
32240
  }
32260
32241
 
32261
- _context2.next = 65;
32242
+ _context2.next = 56;
32262
32243
  return sendAsync(provider, 'eth_estimateGas', tx);
32263
32244
 
32264
- case 65:
32245
+ case 56:
32265
32246
  tx.gas = tx.gasLimit;
32266
32247
 
32267
32248
  if (!privateKey) {
32268
- _context2.next = 81;
32249
+ _context2.next = 72;
32269
32250
  break;
32270
32251
  }
32271
32252
 
32272
- _context2.t23 = global.EthereumJSTransaction.Transaction;
32273
- _context2.t24 = tx;
32274
- _context2.t25 = parseInt;
32275
- _context2.next = 72;
32253
+ _context2.t21 = global.EthereumJSTransaction.Transaction;
32254
+ _context2.t22 = tx;
32255
+ _context2.t23 = parseInt;
32256
+ _context2.next = 63;
32276
32257
  return sendAsync(provider, 'eth_chainId');
32277
32258
 
32278
- case 72:
32279
- _context2.t26 = _context2.sent;
32280
- _context2.t27 = (0, _context2.t25)(_context2.t26);
32281
- _context2.t28 = {
32282
- 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
32283
32264
  };
32284
- transaction = new _context2.t23(_context2.t24, _context2.t28);
32265
+ transaction = new _context2.t21(_context2.t22, _context2.t26);
32285
32266
  transaction.sign(privateKey);
32286
32267
  serializedTx = '0x' + transaction.serialize().toString('hex');
32287
32268
  sendTransaction = sendAsync(provider, 'eth_sendRawTransaction', serializedTx);
32288
- _context2.next = 82;
32269
+ _context2.next = 73;
32289
32270
  break;
32290
32271
 
32291
- case 81:
32272
+ case 72:
32292
32273
  sendTransaction = sendAsync(provider, 'eth_sendTransaction', tx);
32293
32274
 
32294
- case 82:
32295
- _context2.next = 84;
32275
+ case 73:
32276
+ _context2.next = 75;
32296
32277
  return sendTransaction;
32297
32278
 
32298
- case 84:
32279
+ case 75:
32299
32280
  transactionHash = _context2.sent;
32300
32281
  console.log(new Date().toUTCString(), 'Transaction!', getEtherscanAddress('tx/' + transactionHash, tx.chainId));
32301
32282
 
@@ -32312,13 +32293,7 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
32312
32293
  case 2:
32313
32294
  receipt = _context.sent;
32314
32295
 
32315
- if (!(!receipt || !receipt.blockNumber
32316
- /* ||
32317
- parseInt(
32318
- (await sendAsync(provider, 'eth_getBlockByNumber', 'latest', false))
32319
- .number
32320
- ) <= parseInt(receipt.blockNumber)*/
32321
- )) {
32296
+ if (!(!receipt || !receipt.blockNumber)) {
32322
32297
  _context.next = 5;
32323
32298
  break;
32324
32299
  }
@@ -32342,20 +32317,20 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
32342
32317
  }();
32343
32318
 
32344
32319
  setTimeout(timeout);
32345
- _context2.next = 93;
32320
+ _context2.next = 84;
32346
32321
  break;
32347
32322
 
32348
- case 90:
32349
- _context2.prev = 90;
32350
- _context2.t29 = _context2["catch"](0);
32351
- 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));
32352
32327
 
32353
- case 93:
32328
+ case 84:
32354
32329
  case "end":
32355
32330
  return _context2.stop();
32356
32331
  }
32357
32332
  }
32358
- }, _callee2, null, [[0, 90], [25, 32]]);
32333
+ }, _callee2, null, [[0, 81]]);
32359
32334
  }));
32360
32335
 
32361
32336
  return function (_x, _x2) {