@ethereansos/interfaces-core 0.4.94 → 0.4.97

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
@@ -33493,41 +33493,86 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
33493
33493
  }
33494
33494
 
33495
33495
  function _tryUpdateBlock() {
33496
- _tryUpdateBlock = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(force) {
33496
+ _tryUpdateBlock = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(force) {
33497
33497
  var currentBlock, currentBlockNumber;
33498
- return regeneratorRuntime.wrap(function _callee$(_context) {
33498
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
33499
33499
  while (1) {
33500
- switch (_context.prev = _context.next) {
33500
+ switch (_context2.prev = _context2.next) {
33501
33501
  case 0:
33502
- _context.prev = 0;
33503
- _context.next = 3;
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 = _context.sent;
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
- _context.next = 10;
33514
+ _context2.next = 10;
33515
33515
  break;
33516
33516
 
33517
33517
  case 8:
33518
- _context.prev = 8;
33519
- _context.t0 = _context["catch"](0);
33518
+ _context2.prev = 8;
33519
+ _context2.t0 = _context2["catch"](0);
33520
33520
 
33521
33521
  case 10:
33522
33522
  case "end":
33523
- return _context.stop();
33523
+ return _context2.stop();
33524
33524
  }
33525
33525
  }
33526
- }, _callee, null, [[0, 8]]);
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
+ setTimeout(resetBlockInterval);
33560
+
33561
+ case 12:
33562
+ case "end":
33563
+ return _context.stop();
33564
+ }
33565
+ }
33566
+ }, _callee, null, [[2, 9]]);
33567
+ }));
33568
+
33569
+ function updateAccount(_x2) {
33570
+ return _updateAccount.apply(this, arguments);
33571
+ }
33572
+
33573
+ return updateAccount;
33574
+ }();
33575
+
33531
33576
  function resetBlockInterval() {
33532
33577
  intervalId && clearInterval(intervalId);
33533
33578
  wallet && wallet.ethereum && tryUpdateBlock(true);
@@ -33610,7 +33655,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
33610
33655
  }),
33611
33656
  ipfsHttpClient: ipfsHttpClient$1
33612
33657
  }, wallet && connectionStatus === CONNECTED && {
33613
- account: wallet.account,
33658
+ account: window.account || wallet.account,
33614
33659
  chainId: chainId,
33615
33660
  chainName: wallet.networkName,
33616
33661
  web3: web3Instance,