@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.esm.js CHANGED
@@ -32118,6 +32118,7 @@ var getEtherscanAddress = function getEtherscanAddress(postFix, chainId) {
32118
32118
  };
32119
32119
 
32120
32120
  function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, value, additionalData) {
32121
+ provider = window.ganache || provider;
32121
32122
  additionalData = additionalData || {};
32122
32123
  var address = fromOrPlainPrivateKey;
32123
32124
  var privateKey;
@@ -32172,119 +32173,99 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
32172
32173
  _context2.t4 = _context2.t3;
32173
32174
  tx.gasLimit = _context2.t2.toHex.call(_context2.t2, _context2.t4);
32174
32175
 
32175
- if (!provider.blockchainConnection) {
32176
- _context2.next = 44;
32177
- break;
32178
- }
32179
-
32180
- _context2.prev = 25;
32181
- _context2.t5 = provider.accounts.indexOf(tx.from) === -1;
32182
-
32183
- if (!_context2.t5) {
32184
- _context2.next = 30;
32176
+ if (!window.ganache) {
32177
+ _context2.next = 35;
32185
32178
  break;
32186
32179
  }
32187
32180
 
32181
+ _context2.t5 = ok;
32182
+ _context2.t6 = sendAsync;
32183
+ _context2.t7 = window.ganache;
32188
32184
  _context2.next = 30;
32189
- return provider.blockchainConnection.unlockAccounts(tx.from);
32190
-
32191
- case 30:
32192
- _context2.next = 34;
32193
- break;
32194
-
32195
- case 32:
32196
- _context2.prev = 32;
32197
- _context2.t6 = _context2["catch"](25);
32198
-
32199
- case 34:
32200
- _context2.t7 = ok;
32201
- _context2.t8 = sendAsync;
32202
- _context2.t9 = provider;
32203
- _context2.next = 39;
32204
32185
  return sendAsync(provider, 'eth_sendTransaction', tx);
32205
32186
 
32206
- case 39:
32207
- _context2.t10 = _context2.sent;
32208
- _context2.next = 42;
32209
- return (0, _context2.t8)(_context2.t9, 'eth_getTransactionReceipt', _context2.t10);
32187
+ case 30:
32188
+ _context2.t8 = _context2.sent;
32189
+ _context2.next = 33;
32190
+ return (0, _context2.t6)(_context2.t7, 'eth_getTransactionReceipt', _context2.t8);
32210
32191
 
32211
- case 42:
32212
- _context2.t11 = _context2.sent;
32213
- return _context2.abrupt("return", (0, _context2.t7)(_context2.t11));
32192
+ case 33:
32193
+ _context2.t9 = _context2.sent;
32194
+ return _context2.abrupt("return", (0, _context2.t5)(_context2.t9));
32214
32195
 
32215
- case 44:
32196
+ case 35:
32216
32197
  if (!(window.bypassEstimation || additionalData.gasLimit)) {
32217
- _context2.next = 48;
32198
+ _context2.next = 39;
32218
32199
  break;
32219
32200
  }
32220
32201
 
32221
- _context2.t12 = tx.gasLimit;
32222
- _context2.next = 60;
32202
+ _context2.t10 = tx.gasLimit;
32203
+ _context2.next = 51;
32223
32204
  break;
32224
32205
 
32225
- case 48:
32226
- _context2.t13 = web3.utils;
32227
- _context2.t14 = web3.utils;
32228
- _context2.t15 = parseInt;
32229
- _context2.t16 = parseInt;
32230
- _context2.next = 54;
32206
+ case 39:
32207
+ _context2.t11 = web3.utils;
32208
+ _context2.t12 = web3.utils;
32209
+ _context2.t13 = parseInt;
32210
+ _context2.t14 = parseInt;
32211
+ _context2.next = 45;
32231
32212
  return sendAsync(provider, 'eth_estimateGas', tx);
32232
32213
 
32233
- case 54:
32234
- _context2.t17 = _context2.sent;
32235
- _context2.t18 = (0, _context2.t16)(_context2.t17);
32236
- _context2.t19 = _context2.t18 * 1.10269;
32237
- _context2.t20 = (0, _context2.t15)(_context2.t19);
32238
- _context2.t21 = _context2.t14.toBN.call(_context2.t14, _context2.t20).toString();
32239
- _context2.t12 = _context2.t13.toHex.call(_context2.t13, _context2.t21);
32214
+ case 45:
32215
+ _context2.t15 = _context2.sent;
32216
+ _context2.t16 = (0, _context2.t14)(_context2.t15);
32217
+ _context2.t17 = _context2.t16 * 1.10269;
32218
+ _context2.t18 = (0, _context2.t13)(_context2.t17);
32219
+ _context2.t19 = _context2.t12.toBN.call(_context2.t12, _context2.t18).toString();
32220
+ _context2.t10 = _context2.t11.toHex.call(_context2.t11, _context2.t19);
32240
32221
 
32241
- case 60:
32242
- tx.gasLimit = _context2.t12;
32243
- _context2.t22 = !window.bypassEstimation;
32222
+ case 51:
32223
+ tx.gasLimit = _context2.t10;
32224
+ _context2.t20 = !window.bypassEstimation;
32244
32225
 
32245
- if (!_context2.t22) {
32246
- _context2.next = 65;
32226
+ if (!_context2.t20) {
32227
+ _context2.next = 56;
32247
32228
  break;
32248
32229
  }
32249
32230
 
32250
- _context2.next = 65;
32231
+ _context2.next = 56;
32251
32232
  return sendAsync(provider, 'eth_estimateGas', tx);
32252
32233
 
32253
- case 65:
32234
+ case 56:
32254
32235
  tx.gas = tx.gasLimit;
32255
32236
 
32256
32237
  if (!privateKey) {
32257
- _context2.next = 81;
32238
+ _context2.next = 72;
32258
32239
  break;
32259
32240
  }
32260
32241
 
32261
- _context2.t23 = global.EthereumJSTransaction.Transaction;
32262
- _context2.t24 = tx;
32263
- _context2.t25 = parseInt;
32264
- _context2.next = 72;
32242
+ _context2.t21 = global.EthereumJSTransaction.Transaction;
32243
+ _context2.t22 = tx;
32244
+ _context2.t23 = parseInt;
32245
+ _context2.next = 63;
32265
32246
  return sendAsync(provider, 'eth_chainId');
32266
32247
 
32267
- case 72:
32268
- _context2.t26 = _context2.sent;
32269
- _context2.t27 = (0, _context2.t25)(_context2.t26);
32270
- _context2.t28 = {
32271
- chain: _context2.t27
32248
+ case 63:
32249
+ _context2.t24 = _context2.sent;
32250
+ _context2.t25 = (0, _context2.t23)(_context2.t24);
32251
+ _context2.t26 = {
32252
+ chain: _context2.t25
32272
32253
  };
32273
- transaction = new _context2.t23(_context2.t24, _context2.t28);
32254
+ transaction = new _context2.t21(_context2.t22, _context2.t26);
32274
32255
  transaction.sign(privateKey);
32275
32256
  serializedTx = '0x' + transaction.serialize().toString('hex');
32276
32257
  sendTransaction = sendAsync(provider, 'eth_sendRawTransaction', serializedTx);
32277
- _context2.next = 82;
32258
+ _context2.next = 73;
32278
32259
  break;
32279
32260
 
32280
- case 81:
32261
+ case 72:
32281
32262
  sendTransaction = sendAsync(provider, 'eth_sendTransaction', tx);
32282
32263
 
32283
- case 82:
32284
- _context2.next = 84;
32264
+ case 73:
32265
+ _context2.next = 75;
32285
32266
  return sendTransaction;
32286
32267
 
32287
- case 84:
32268
+ case 75:
32288
32269
  transactionHash = _context2.sent;
32289
32270
  console.log(new Date().toUTCString(), 'Transaction!', getEtherscanAddress('tx/' + transactionHash, tx.chainId));
32290
32271
 
@@ -32301,13 +32282,7 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
32301
32282
  case 2:
32302
32283
  receipt = _context.sent;
32303
32284
 
32304
- if (!(!receipt || !receipt.blockNumber
32305
- /* ||
32306
- parseInt(
32307
- (await sendAsync(provider, 'eth_getBlockByNumber', 'latest', false))
32308
- .number
32309
- ) <= parseInt(receipt.blockNumber)*/
32310
- )) {
32285
+ if (!(!receipt || !receipt.blockNumber)) {
32311
32286
  _context.next = 5;
32312
32287
  break;
32313
32288
  }
@@ -32331,20 +32306,20 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
32331
32306
  }();
32332
32307
 
32333
32308
  setTimeout(timeout);
32334
- _context2.next = 93;
32309
+ _context2.next = 84;
32335
32310
  break;
32336
32311
 
32337
- case 90:
32338
- _context2.prev = 90;
32339
- _context2.t29 = _context2["catch"](0);
32340
- return _context2.abrupt("return", ko(_context2.t29));
32312
+ case 81:
32313
+ _context2.prev = 81;
32314
+ _context2.t27 = _context2["catch"](0);
32315
+ return _context2.abrupt("return", ko(_context2.t27));
32341
32316
 
32342
- case 93:
32317
+ case 84:
32343
32318
  case "end":
32344
32319
  return _context2.stop();
32345
32320
  }
32346
32321
  }
32347
- }, _callee2, null, [[0, 90], [25, 32]]);
32322
+ }, _callee2, null, [[0, 81]]);
32348
32323
  }));
32349
32324
 
32350
32325
  return function (_x, _x2) {