@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.esm.js CHANGED
@@ -33482,41 +33482,86 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
33482
33482
  }
33483
33483
 
33484
33484
  function _tryUpdateBlock() {
33485
- _tryUpdateBlock = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(force) {
33485
+ _tryUpdateBlock = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(force) {
33486
33486
  var currentBlock, currentBlockNumber;
33487
- return regeneratorRuntime.wrap(function _callee$(_context) {
33487
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
33488
33488
  while (1) {
33489
- switch (_context.prev = _context.next) {
33489
+ switch (_context2.prev = _context2.next) {
33490
33490
  case 0:
33491
- _context.prev = 0;
33492
- _context.next = 3;
33491
+ _context2.prev = 0;
33492
+ _context2.next = 3;
33493
33493
  return sendAsync(wallet.ethereum, 'eth_getBlockByNumber', 'latest', true);
33494
33494
 
33495
33495
  case 3:
33496
- currentBlock = _context.sent;
33496
+ currentBlock = _context2.sent;
33497
33497
  currentBlockNumber = parseInt(currentBlock.number);
33498
33498
 
33499
33499
  if (force === true || currentBlockNumber - block >= realBlockInterval) {
33500
33500
  setBlock(currentBlockNumber);
33501
33501
  }
33502
33502
 
33503
- _context.next = 10;
33503
+ _context2.next = 10;
33504
33504
  break;
33505
33505
 
33506
33506
  case 8:
33507
- _context.prev = 8;
33508
- _context.t0 = _context["catch"](0);
33507
+ _context2.prev = 8;
33508
+ _context2.t0 = _context2["catch"](0);
33509
33509
 
33510
33510
  case 10:
33511
33511
  case "end":
33512
- return _context.stop();
33512
+ return _context2.stop();
33513
33513
  }
33514
33514
  }
33515
- }, _callee, null, [[0, 8]]);
33515
+ }, _callee2, null, [[0, 8]]);
33516
33516
  }));
33517
33517
  return _tryUpdateBlock.apply(this, arguments);
33518
33518
  }
33519
33519
 
33520
+ window.updateAccount = window.updateAccount || /*#__PURE__*/function () {
33521
+ var _updateAccount = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(acc) {
33522
+ return regeneratorRuntime.wrap(function _callee$(_context) {
33523
+ while (1) {
33524
+ switch (_context.prev = _context.next) {
33525
+ case 0:
33526
+ delete window.account;
33527
+ acc && (window.account = acc);
33528
+ _context.prev = 2;
33529
+ _context.t0 = acc && window.ganache;
33530
+
33531
+ if (!_context.t0) {
33532
+ _context.next = 7;
33533
+ break;
33534
+ }
33535
+
33536
+ _context.next = 7;
33537
+ return sendAsync(window.ganache, 'evm_addAccount', acc, 0);
33538
+
33539
+ case 7:
33540
+ _context.next = 11;
33541
+ break;
33542
+
33543
+ case 9:
33544
+ _context.prev = 9;
33545
+ _context.t1 = _context["catch"](2);
33546
+
33547
+ case 11:
33548
+ setTimeout(resetBlockInterval);
33549
+
33550
+ case 12:
33551
+ case "end":
33552
+ return _context.stop();
33553
+ }
33554
+ }
33555
+ }, _callee, null, [[2, 9]]);
33556
+ }));
33557
+
33558
+ function updateAccount(_x2) {
33559
+ return _updateAccount.apply(this, arguments);
33560
+ }
33561
+
33562
+ return updateAccount;
33563
+ }();
33564
+
33520
33565
  function resetBlockInterval() {
33521
33566
  intervalId && clearInterval(intervalId);
33522
33567
  wallet && wallet.ethereum && tryUpdateBlock(true);
@@ -33599,7 +33644,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
33599
33644
  }),
33600
33645
  ipfsHttpClient: ipfsHttpClient
33601
33646
  }, wallet && connectionStatus === CONNECTED && {
33602
- account: wallet.account,
33647
+ account: window.account || wallet.account,
33603
33648
  chainId: chainId,
33604
33649
  chainName: wallet.networkName,
33605
33650
  web3: web3Instance,