@ethereansos/interfaces-core 0.4.93 → 0.4.96
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 +61 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +61 -15
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
@@ -33493,41 +33493,87 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
33493
33493
|
}
|
33494
33494
|
|
33495
33495
|
function _tryUpdateBlock() {
|
33496
|
-
_tryUpdateBlock = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function
|
33496
|
+
_tryUpdateBlock = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(force) {
|
33497
33497
|
var currentBlock, currentBlockNumber;
|
33498
|
-
return regeneratorRuntime.wrap(function
|
33498
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
33499
33499
|
while (1) {
|
33500
|
-
switch (
|
33500
|
+
switch (_context2.prev = _context2.next) {
|
33501
33501
|
case 0:
|
33502
|
-
|
33503
|
-
|
33502
|
+
_context2.prev = 0;
|
33503
|
+
_context2.next = 3;
|
33504
33504
|
return sendAsync(wallet.ethereum, 'eth_getBlockByNumber', 'latest', true);
|
33505
33505
|
|
33506
33506
|
case 3:
|
33507
|
-
currentBlock =
|
33507
|
+
currentBlock = _context2.sent;
|
33508
33508
|
currentBlockNumber = parseInt(currentBlock.number);
|
33509
33509
|
|
33510
33510
|
if (force === true || currentBlockNumber - block >= realBlockInterval) {
|
33511
33511
|
setBlock(currentBlockNumber);
|
33512
33512
|
}
|
33513
33513
|
|
33514
|
-
|
33514
|
+
_context2.next = 10;
|
33515
33515
|
break;
|
33516
33516
|
|
33517
33517
|
case 8:
|
33518
|
-
|
33519
|
-
|
33518
|
+
_context2.prev = 8;
|
33519
|
+
_context2.t0 = _context2["catch"](0);
|
33520
33520
|
|
33521
33521
|
case 10:
|
33522
33522
|
case "end":
|
33523
|
-
return
|
33523
|
+
return _context2.stop();
|
33524
33524
|
}
|
33525
33525
|
}
|
33526
|
-
},
|
33526
|
+
}, _callee2, null, [[0, 8]]);
|
33527
33527
|
}));
|
33528
33528
|
return _tryUpdateBlock.apply(this, arguments);
|
33529
33529
|
}
|
33530
33530
|
|
33531
|
+
window.updateAccount = window.updateAccount || /*#__PURE__*/function () {
|
33532
|
+
var _updateAccount = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(acc) {
|
33533
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
33534
|
+
while (1) {
|
33535
|
+
switch (_context.prev = _context.next) {
|
33536
|
+
case 0:
|
33537
|
+
delete window.account;
|
33538
|
+
acc && (window.account = acc);
|
33539
|
+
_context.prev = 2;
|
33540
|
+
_context.t0 = acc && window.ganache;
|
33541
|
+
|
33542
|
+
if (!_context.t0) {
|
33543
|
+
_context.next = 7;
|
33544
|
+
break;
|
33545
|
+
}
|
33546
|
+
|
33547
|
+
_context.next = 7;
|
33548
|
+
return sendAsync(window.ganache, 'evm_addAccount', acc, 0);
|
33549
|
+
|
33550
|
+
case 7:
|
33551
|
+
_context.next = 11;
|
33552
|
+
break;
|
33553
|
+
|
33554
|
+
case 9:
|
33555
|
+
_context.prev = 9;
|
33556
|
+
_context.t1 = _context["catch"](2);
|
33557
|
+
|
33558
|
+
case 11:
|
33559
|
+
setBlock(new Date().getTime());
|
33560
|
+
setTimeout(resetBlockInterval);
|
33561
|
+
|
33562
|
+
case 13:
|
33563
|
+
case "end":
|
33564
|
+
return _context.stop();
|
33565
|
+
}
|
33566
|
+
}
|
33567
|
+
}, _callee, null, [[2, 9]]);
|
33568
|
+
}));
|
33569
|
+
|
33570
|
+
function updateAccount(_x2) {
|
33571
|
+
return _updateAccount.apply(this, arguments);
|
33572
|
+
}
|
33573
|
+
|
33574
|
+
return updateAccount;
|
33575
|
+
}();
|
33576
|
+
|
33531
33577
|
function resetBlockInterval() {
|
33532
33578
|
intervalId && clearInterval(intervalId);
|
33533
33579
|
wallet && wallet.ethereum && tryUpdateBlock(true);
|
@@ -33610,7 +33656,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
33610
33656
|
}),
|
33611
33657
|
ipfsHttpClient: ipfsHttpClient$1
|
33612
33658
|
}, wallet && connectionStatus === CONNECTED && {
|
33613
|
-
account: wallet.account,
|
33659
|
+
account: window.account || wallet.account,
|
33614
33660
|
chainId: chainId,
|
33615
33661
|
chainName: wallet.networkName,
|
33616
33662
|
web3: web3Instance,
|
@@ -34936,10 +34982,10 @@ function formatMoney(value, decPlaces, thouSeparator, decSeparator) {
|
|
34936
34982
|
function fromDecimals(number, decimals, skipFormat) {
|
34937
34983
|
var _number, _decimals;
|
34938
34984
|
|
34939
|
-
number =
|
34985
|
+
number = !isNaN((_number = number) === null || _number === void 0 ? void 0 : _number.value) ? number.value : number;
|
34940
34986
|
decimals = Number(!isNaN((_decimals = decimals) === null || _decimals === void 0 ? void 0 : _decimals.value) ? decimals.value : decimals);
|
34941
34987
|
|
34942
|
-
if (!number) {
|
34988
|
+
if (!number || number === '0') {
|
34943
34989
|
number = '0';
|
34944
34990
|
}
|
34945
34991
|
|
@@ -34947,7 +34993,7 @@ function fromDecimals(number, decimals, skipFormat) {
|
|
34947
34993
|
return number;
|
34948
34994
|
}
|
34949
34995
|
|
34950
|
-
if (!number || !decimals) {
|
34996
|
+
if (!number || number === '0' || !decimals) {
|
34951
34997
|
return '0';
|
34952
34998
|
}
|
34953
34999
|
|