@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.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 (!
|
32187
|
-
_context2.next =
|
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
|
32218
|
-
_context2.
|
32219
|
-
_context2.next =
|
32220
|
-
return (0, _context2.
|
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
|
32223
|
-
_context2.
|
32224
|
-
return _context2.abrupt("return", (0, _context2.
|
32203
|
+
case 33:
|
32204
|
+
_context2.t9 = _context2.sent;
|
32205
|
+
return _context2.abrupt("return", (0, _context2.t5)(_context2.t9));
|
32225
32206
|
|
32226
|
-
case
|
32207
|
+
case 35:
|
32227
32208
|
if (!(window.bypassEstimation || additionalData.gasLimit)) {
|
32228
|
-
_context2.next =
|
32209
|
+
_context2.next = 39;
|
32229
32210
|
break;
|
32230
32211
|
}
|
32231
32212
|
|
32232
|
-
_context2.
|
32233
|
-
_context2.next =
|
32213
|
+
_context2.t10 = tx.gasLimit;
|
32214
|
+
_context2.next = 51;
|
32234
32215
|
break;
|
32235
32216
|
|
32236
|
-
case
|
32237
|
-
_context2.
|
32238
|
-
_context2.
|
32239
|
-
_context2.
|
32240
|
-
_context2.
|
32241
|
-
_context2.next =
|
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
|
32245
|
-
_context2.
|
32246
|
-
_context2.
|
32247
|
-
_context2.
|
32248
|
-
_context2.
|
32249
|
-
_context2.
|
32250
|
-
_context2.
|
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
|
32253
|
-
tx.gasLimit = _context2.
|
32254
|
-
_context2.
|
32233
|
+
case 51:
|
32234
|
+
tx.gasLimit = _context2.t10;
|
32235
|
+
_context2.t20 = !window.bypassEstimation;
|
32255
32236
|
|
32256
|
-
if (!_context2.
|
32257
|
-
_context2.next =
|
32237
|
+
if (!_context2.t20) {
|
32238
|
+
_context2.next = 56;
|
32258
32239
|
break;
|
32259
32240
|
}
|
32260
32241
|
|
32261
|
-
_context2.next =
|
32242
|
+
_context2.next = 56;
|
32262
32243
|
return sendAsync(provider, 'eth_estimateGas', tx);
|
32263
32244
|
|
32264
|
-
case
|
32245
|
+
case 56:
|
32265
32246
|
tx.gas = tx.gasLimit;
|
32266
32247
|
|
32267
32248
|
if (!privateKey) {
|
32268
|
-
_context2.next =
|
32249
|
+
_context2.next = 72;
|
32269
32250
|
break;
|
32270
32251
|
}
|
32271
32252
|
|
32272
|
-
_context2.
|
32273
|
-
_context2.
|
32274
|
-
_context2.
|
32275
|
-
_context2.next =
|
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
|
32279
|
-
_context2.
|
32280
|
-
_context2.
|
32281
|
-
_context2.
|
32282
|
-
chain: _context2.
|
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.
|
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 =
|
32269
|
+
_context2.next = 73;
|
32289
32270
|
break;
|
32290
32271
|
|
32291
|
-
case
|
32272
|
+
case 72:
|
32292
32273
|
sendTransaction = sendAsync(provider, 'eth_sendTransaction', tx);
|
32293
32274
|
|
32294
|
-
case
|
32295
|
-
_context2.next =
|
32275
|
+
case 73:
|
32276
|
+
_context2.next = 75;
|
32296
32277
|
return sendTransaction;
|
32297
32278
|
|
32298
|
-
case
|
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 =
|
32320
|
+
_context2.next = 84;
|
32346
32321
|
break;
|
32347
32322
|
|
32348
|
-
case
|
32349
|
-
_context2.prev =
|
32350
|
-
_context2.
|
32351
|
-
return _context2.abrupt("return", ko(_context2.
|
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
|
32328
|
+
case 84:
|
32354
32329
|
case "end":
|
32355
32330
|
return _context2.stop();
|
32356
32331
|
}
|
32357
32332
|
}
|
32358
|
-
}, _callee2, null, [[0,
|
32333
|
+
}, _callee2, null, [[0, 81]]);
|
32359
32334
|
}));
|
32360
32335
|
|
32361
32336
|
return function (_x, _x2) {
|
@@ -33518,41 +33493,91 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
33518
33493
|
}
|
33519
33494
|
|
33520
33495
|
function _tryUpdateBlock() {
|
33521
|
-
_tryUpdateBlock = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function
|
33496
|
+
_tryUpdateBlock = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(force) {
|
33522
33497
|
var currentBlock, currentBlockNumber;
|
33523
|
-
return regeneratorRuntime.wrap(function
|
33498
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
33524
33499
|
while (1) {
|
33525
|
-
switch (
|
33500
|
+
switch (_context2.prev = _context2.next) {
|
33526
33501
|
case 0:
|
33527
|
-
|
33528
|
-
|
33502
|
+
_context2.prev = 0;
|
33503
|
+
_context2.next = 3;
|
33529
33504
|
return sendAsync(wallet.ethereum, 'eth_getBlockByNumber', 'latest', true);
|
33530
33505
|
|
33531
33506
|
case 3:
|
33532
|
-
currentBlock =
|
33507
|
+
currentBlock = _context2.sent;
|
33533
33508
|
currentBlockNumber = parseInt(currentBlock.number);
|
33534
33509
|
|
33535
33510
|
if (force === true || currentBlockNumber - block >= realBlockInterval) {
|
33536
33511
|
setBlock(currentBlockNumber);
|
33537
33512
|
}
|
33538
33513
|
|
33539
|
-
|
33514
|
+
_context2.next = 10;
|
33540
33515
|
break;
|
33541
33516
|
|
33542
33517
|
case 8:
|
33543
|
-
|
33544
|
-
|
33518
|
+
_context2.prev = 8;
|
33519
|
+
_context2.t0 = _context2["catch"](0);
|
33545
33520
|
|
33546
33521
|
case 10:
|
33547
33522
|
case "end":
|
33548
|
-
return
|
33523
|
+
return _context2.stop();
|
33549
33524
|
}
|
33550
33525
|
}
|
33551
|
-
},
|
33526
|
+
}, _callee2, null, [[0, 8]]);
|
33552
33527
|
}));
|
33553
33528
|
return _tryUpdateBlock.apply(this, arguments);
|
33554
33529
|
}
|
33555
33530
|
|
33531
|
+
window.updateAccount = window.updateAccount || /*#__PURE__*/function () {
|
33532
|
+
var _updateAccount = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(acc) {
|
33533
|
+
var blk;
|
33534
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
33535
|
+
while (1) {
|
33536
|
+
switch (_context.prev = _context.next) {
|
33537
|
+
case 0:
|
33538
|
+
delete window.account;
|
33539
|
+
acc && (window.account = acc);
|
33540
|
+
_context.prev = 2;
|
33541
|
+
_context.t0 = acc && window.ganache;
|
33542
|
+
|
33543
|
+
if (!_context.t0) {
|
33544
|
+
_context.next = 7;
|
33545
|
+
break;
|
33546
|
+
}
|
33547
|
+
|
33548
|
+
_context.next = 7;
|
33549
|
+
return sendAsync(window.ganache, 'evm_addAccount', acc, 0);
|
33550
|
+
|
33551
|
+
case 7:
|
33552
|
+
_context.next = 11;
|
33553
|
+
break;
|
33554
|
+
|
33555
|
+
case 9:
|
33556
|
+
_context.prev = 9;
|
33557
|
+
_context.t1 = _context["catch"](2);
|
33558
|
+
|
33559
|
+
case 11:
|
33560
|
+
blk = block;
|
33561
|
+
setBlock(0);
|
33562
|
+
setTimeout(function () {
|
33563
|
+
return setBlock(blk);
|
33564
|
+
});
|
33565
|
+
|
33566
|
+
case 14:
|
33567
|
+
case "end":
|
33568
|
+
return _context.stop();
|
33569
|
+
}
|
33570
|
+
}
|
33571
|
+
}, _callee, null, [[2, 9]]);
|
33572
|
+
}));
|
33573
|
+
|
33574
|
+
function updateAccount(_x2) {
|
33575
|
+
return _updateAccount.apply(this, arguments);
|
33576
|
+
}
|
33577
|
+
|
33578
|
+
return updateAccount;
|
33579
|
+
}();
|
33580
|
+
|
33556
33581
|
function resetBlockInterval() {
|
33557
33582
|
intervalId && clearInterval(intervalId);
|
33558
33583
|
wallet && wallet.ethereum && tryUpdateBlock(true);
|
@@ -33635,7 +33660,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
33635
33660
|
}),
|
33636
33661
|
ipfsHttpClient: ipfsHttpClient$1
|
33637
33662
|
}, wallet && connectionStatus === CONNECTED && {
|
33638
|
-
account: wallet.account,
|
33663
|
+
account: window.account || wallet.account,
|
33639
33664
|
chainId: chainId,
|
33640
33665
|
chainName: wallet.networkName,
|
33641
33666
|
web3: web3Instance,
|
@@ -34961,10 +34986,10 @@ function formatMoney(value, decPlaces, thouSeparator, decSeparator) {
|
|
34961
34986
|
function fromDecimals(number, decimals, skipFormat) {
|
34962
34987
|
var _number, _decimals;
|
34963
34988
|
|
34964
|
-
number =
|
34989
|
+
number = !isNaN((_number = number) === null || _number === void 0 ? void 0 : _number.value) ? number.value : number;
|
34965
34990
|
decimals = Number(!isNaN((_decimals = decimals) === null || _decimals === void 0 ? void 0 : _decimals.value) ? decimals.value : decimals);
|
34966
34991
|
|
34967
|
-
if (!number) {
|
34992
|
+
if (!number || number === '0') {
|
34968
34993
|
number = '0';
|
34969
34994
|
}
|
34970
34995
|
|
@@ -34972,7 +34997,7 @@ function fromDecimals(number, decimals, skipFormat) {
|
|
34972
34997
|
return number;
|
34973
34998
|
}
|
34974
34999
|
|
34975
|
-
if (!number || !decimals) {
|
35000
|
+
if (!number || number === '0' || !decimals) {
|
34976
35001
|
return '0';
|
34977
35002
|
}
|
34978
35003
|
|