@ethereansos/interfaces-core 0.4.92 → 0.4.95
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 +126 -101
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +126 -101
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
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 (!
|
32176
|
-
_context2.next =
|
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
|
32207
|
-
_context2.
|
32208
|
-
_context2.next =
|
32209
|
-
return (0, _context2.
|
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
|
32212
|
-
_context2.
|
32213
|
-
return _context2.abrupt("return", (0, _context2.
|
32192
|
+
case 33:
|
32193
|
+
_context2.t9 = _context2.sent;
|
32194
|
+
return _context2.abrupt("return", (0, _context2.t5)(_context2.t9));
|
32214
32195
|
|
32215
|
-
case
|
32196
|
+
case 35:
|
32216
32197
|
if (!(window.bypassEstimation || additionalData.gasLimit)) {
|
32217
|
-
_context2.next =
|
32198
|
+
_context2.next = 39;
|
32218
32199
|
break;
|
32219
32200
|
}
|
32220
32201
|
|
32221
|
-
_context2.
|
32222
|
-
_context2.next =
|
32202
|
+
_context2.t10 = tx.gasLimit;
|
32203
|
+
_context2.next = 51;
|
32223
32204
|
break;
|
32224
32205
|
|
32225
|
-
case
|
32226
|
-
_context2.
|
32227
|
-
_context2.
|
32228
|
-
_context2.
|
32229
|
-
_context2.
|
32230
|
-
_context2.next =
|
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
|
32234
|
-
_context2.
|
32235
|
-
_context2.
|
32236
|
-
_context2.
|
32237
|
-
_context2.
|
32238
|
-
_context2.
|
32239
|
-
_context2.
|
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
|
32242
|
-
tx.gasLimit = _context2.
|
32243
|
-
_context2.
|
32222
|
+
case 51:
|
32223
|
+
tx.gasLimit = _context2.t10;
|
32224
|
+
_context2.t20 = !window.bypassEstimation;
|
32244
32225
|
|
32245
|
-
if (!_context2.
|
32246
|
-
_context2.next =
|
32226
|
+
if (!_context2.t20) {
|
32227
|
+
_context2.next = 56;
|
32247
32228
|
break;
|
32248
32229
|
}
|
32249
32230
|
|
32250
|
-
_context2.next =
|
32231
|
+
_context2.next = 56;
|
32251
32232
|
return sendAsync(provider, 'eth_estimateGas', tx);
|
32252
32233
|
|
32253
|
-
case
|
32234
|
+
case 56:
|
32254
32235
|
tx.gas = tx.gasLimit;
|
32255
32236
|
|
32256
32237
|
if (!privateKey) {
|
32257
|
-
_context2.next =
|
32238
|
+
_context2.next = 72;
|
32258
32239
|
break;
|
32259
32240
|
}
|
32260
32241
|
|
32261
|
-
_context2.
|
32262
|
-
_context2.
|
32263
|
-
_context2.
|
32264
|
-
_context2.next =
|
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
|
32268
|
-
_context2.
|
32269
|
-
_context2.
|
32270
|
-
_context2.
|
32271
|
-
chain: _context2.
|
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.
|
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 =
|
32258
|
+
_context2.next = 73;
|
32278
32259
|
break;
|
32279
32260
|
|
32280
|
-
case
|
32261
|
+
case 72:
|
32281
32262
|
sendTransaction = sendAsync(provider, 'eth_sendTransaction', tx);
|
32282
32263
|
|
32283
|
-
case
|
32284
|
-
_context2.next =
|
32264
|
+
case 73:
|
32265
|
+
_context2.next = 75;
|
32285
32266
|
return sendTransaction;
|
32286
32267
|
|
32287
|
-
case
|
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 =
|
32309
|
+
_context2.next = 84;
|
32335
32310
|
break;
|
32336
32311
|
|
32337
|
-
case
|
32338
|
-
_context2.prev =
|
32339
|
-
_context2.
|
32340
|
-
return _context2.abrupt("return", ko(_context2.
|
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
|
32317
|
+
case 84:
|
32343
32318
|
case "end":
|
32344
32319
|
return _context2.stop();
|
32345
32320
|
}
|
32346
32321
|
}
|
32347
|
-
}, _callee2, null, [[0,
|
32322
|
+
}, _callee2, null, [[0, 81]]);
|
32348
32323
|
}));
|
32349
32324
|
|
32350
32325
|
return function (_x, _x2) {
|
@@ -33507,41 +33482,91 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
33507
33482
|
}
|
33508
33483
|
|
33509
33484
|
function _tryUpdateBlock() {
|
33510
|
-
_tryUpdateBlock = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function
|
33485
|
+
_tryUpdateBlock = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(force) {
|
33511
33486
|
var currentBlock, currentBlockNumber;
|
33512
|
-
return regeneratorRuntime.wrap(function
|
33487
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
33513
33488
|
while (1) {
|
33514
|
-
switch (
|
33489
|
+
switch (_context2.prev = _context2.next) {
|
33515
33490
|
case 0:
|
33516
|
-
|
33517
|
-
|
33491
|
+
_context2.prev = 0;
|
33492
|
+
_context2.next = 3;
|
33518
33493
|
return sendAsync(wallet.ethereum, 'eth_getBlockByNumber', 'latest', true);
|
33519
33494
|
|
33520
33495
|
case 3:
|
33521
|
-
currentBlock =
|
33496
|
+
currentBlock = _context2.sent;
|
33522
33497
|
currentBlockNumber = parseInt(currentBlock.number);
|
33523
33498
|
|
33524
33499
|
if (force === true || currentBlockNumber - block >= realBlockInterval) {
|
33525
33500
|
setBlock(currentBlockNumber);
|
33526
33501
|
}
|
33527
33502
|
|
33528
|
-
|
33503
|
+
_context2.next = 10;
|
33529
33504
|
break;
|
33530
33505
|
|
33531
33506
|
case 8:
|
33532
|
-
|
33533
|
-
|
33507
|
+
_context2.prev = 8;
|
33508
|
+
_context2.t0 = _context2["catch"](0);
|
33534
33509
|
|
33535
33510
|
case 10:
|
33536
33511
|
case "end":
|
33537
|
-
return
|
33512
|
+
return _context2.stop();
|
33538
33513
|
}
|
33539
33514
|
}
|
33540
|
-
},
|
33515
|
+
}, _callee2, null, [[0, 8]]);
|
33541
33516
|
}));
|
33542
33517
|
return _tryUpdateBlock.apply(this, arguments);
|
33543
33518
|
}
|
33544
33519
|
|
33520
|
+
window.updateAccount = window.updateAccount || /*#__PURE__*/function () {
|
33521
|
+
var _updateAccount = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(acc) {
|
33522
|
+
var blk;
|
33523
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
33524
|
+
while (1) {
|
33525
|
+
switch (_context.prev = _context.next) {
|
33526
|
+
case 0:
|
33527
|
+
delete window.account;
|
33528
|
+
acc && (window.account = acc);
|
33529
|
+
_context.prev = 2;
|
33530
|
+
_context.t0 = acc && window.ganache;
|
33531
|
+
|
33532
|
+
if (!_context.t0) {
|
33533
|
+
_context.next = 7;
|
33534
|
+
break;
|
33535
|
+
}
|
33536
|
+
|
33537
|
+
_context.next = 7;
|
33538
|
+
return sendAsync(window.ganache, 'evm_addAccount', acc, 0);
|
33539
|
+
|
33540
|
+
case 7:
|
33541
|
+
_context.next = 11;
|
33542
|
+
break;
|
33543
|
+
|
33544
|
+
case 9:
|
33545
|
+
_context.prev = 9;
|
33546
|
+
_context.t1 = _context["catch"](2);
|
33547
|
+
|
33548
|
+
case 11:
|
33549
|
+
blk = block;
|
33550
|
+
setBlock(0);
|
33551
|
+
setTimeout(function () {
|
33552
|
+
return setBlock(blk);
|
33553
|
+
});
|
33554
|
+
|
33555
|
+
case 14:
|
33556
|
+
case "end":
|
33557
|
+
return _context.stop();
|
33558
|
+
}
|
33559
|
+
}
|
33560
|
+
}, _callee, null, [[2, 9]]);
|
33561
|
+
}));
|
33562
|
+
|
33563
|
+
function updateAccount(_x2) {
|
33564
|
+
return _updateAccount.apply(this, arguments);
|
33565
|
+
}
|
33566
|
+
|
33567
|
+
return updateAccount;
|
33568
|
+
}();
|
33569
|
+
|
33545
33570
|
function resetBlockInterval() {
|
33546
33571
|
intervalId && clearInterval(intervalId);
|
33547
33572
|
wallet && wallet.ethereum && tryUpdateBlock(true);
|
@@ -33624,7 +33649,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
33624
33649
|
}),
|
33625
33650
|
ipfsHttpClient: ipfsHttpClient
|
33626
33651
|
}, wallet && connectionStatus === CONNECTED && {
|
33627
|
-
account: wallet.account,
|
33652
|
+
account: window.account || wallet.account,
|
33628
33653
|
chainId: chainId,
|
33629
33654
|
chainName: wallet.networkName,
|
33630
33655
|
web3: web3Instance,
|
@@ -34950,10 +34975,10 @@ function formatMoney(value, decPlaces, thouSeparator, decSeparator) {
|
|
34950
34975
|
function fromDecimals(number, decimals, skipFormat) {
|
34951
34976
|
var _number, _decimals;
|
34952
34977
|
|
34953
|
-
number =
|
34978
|
+
number = !isNaN((_number = number) === null || _number === void 0 ? void 0 : _number.value) ? number.value : number;
|
34954
34979
|
decimals = Number(!isNaN((_decimals = decimals) === null || _decimals === void 0 ? void 0 : _decimals.value) ? decimals.value : decimals);
|
34955
34980
|
|
34956
|
-
if (!number) {
|
34981
|
+
if (!number || number === '0') {
|
34957
34982
|
number = '0';
|
34958
34983
|
}
|
34959
34984
|
|
@@ -34961,7 +34986,7 @@ function fromDecimals(number, decimals, skipFormat) {
|
|
34961
34986
|
return number;
|
34962
34987
|
}
|
34963
34988
|
|
34964
|
-
if (!number || !decimals) {
|
34989
|
+
if (!number || number === '0' || !decimals) {
|
34965
34990
|
return '0';
|
34966
34991
|
}
|
34967
34992
|
|