@ethereansos/interfaces-core 0.4.57 → 0.4.58

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
@@ -42711,35 +42711,63 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
42711
42711
  web3Instance = _useState6[0],
42712
42712
  setWeb3Instance = _useState6[1];
42713
42713
 
42714
- var _useState7 = useState([]),
42714
+ var _useState7 = useState(null),
42715
42715
  _useState8 = _slicedToArray(_useState7, 2),
42716
- globalContractNames = _useState8[0],
42717
- setGlobalContractNames = _useState8[1];
42716
+ chainId = _useState8[0],
42717
+ setChainId = _useState8[1];
42718
42718
 
42719
42719
  var _useState9 = useState([]),
42720
42720
  _useState10 = _slicedToArray(_useState9, 2),
42721
- globalContracts = _useState10[0],
42722
- setGlobalContracts = _useState10[1];
42721
+ globalContractNames = _useState10[0],
42722
+ setGlobalContractNames = _useState10[1];
42723
42723
 
42724
- var _useState11 = useState({}),
42724
+ var _useState11 = useState([]),
42725
42725
  _useState12 = _slicedToArray(_useState11, 2),
42726
- contracts = _useState12[0],
42727
- setContracts = _useState12[1];
42726
+ globalContracts = _useState12[0],
42727
+ setGlobalContracts = _useState12[1];
42728
+
42729
+ var _useState13 = useState({}),
42730
+ _useState14 = _slicedToArray(_useState13, 2),
42731
+ contracts = _useState14[0],
42732
+ setContracts = _useState14[1];
42728
42733
 
42729
42734
  useEffect(function () {
42730
42735
  setIpfsHttpClient(create(context.ipfsHost));
42731
42736
  }, [context]);
42732
42737
  useEffect(function () {
42733
42738
  setConnectionStatus(wallet && wallet.ethereum ? CONNECTED : connectionStatus || NOT_CONNECTED);
42734
- setWeb3Instance(wallet && wallet.ethereum && new Web3(wallet.ethereum) || null);
42739
+
42740
+ if (web3Instance && wallet) {
42741
+ setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
42742
+ var web3ChainId;
42743
+ return regeneratorRuntime.wrap(function _callee$(_context) {
42744
+ while (1) {
42745
+ switch (_context.prev = _context.next) {
42746
+ case 0:
42747
+ _context.t0 = parseInt;
42748
+ _context.next = 3;
42749
+ return sendAsync(web3Instance.currentProvider, 'eth_chainId');
42750
+
42751
+ case 3:
42752
+ _context.t1 = _context.sent;
42753
+ web3ChainId = (0, _context.t0)(_context.t1);
42754
+ web3ChainId !== wallet.chainId && setWeb3Instance(wallet && wallet.ethereum && new Web3(wallet.ethereum) || null);
42755
+
42756
+ case 6:
42757
+ case "end":
42758
+ return _context.stop();
42759
+ }
42760
+ }
42761
+ }, _callee);
42762
+ })));
42763
+ } else {
42764
+ setWeb3Instance(wallet && wallet.ethereum && new Web3(wallet.ethereum) || null);
42765
+ }
42735
42766
  }, [wallet]);
42736
42767
  useEffect(function () {
42737
- setContracts(function () {
42738
- return {};
42739
- });
42740
- setGlobalContracts(function () {
42741
- return globalContractNames.map(newContractByName);
42742
- });
42768
+ setContracts({});
42769
+ setGlobalContracts(globalContractNames.map(newContractByName));
42770
+ setChainId(wallet.chainId);
42743
42771
  }, [web3Instance]);
42744
42772
 
42745
42773
  var setConnector = function setConnector(connector) {
@@ -42796,7 +42824,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
42796
42824
  ipfsHttpClient: ipfsHttpClient
42797
42825
  }, wallet && connectionStatus === CONNECTED && {
42798
42826
  account: wallet.account,
42799
- chainId: wallet.chainId,
42827
+ chainId: chainId,
42800
42828
  chainName: wallet.networkName,
42801
42829
  web3: web3Instance,
42802
42830
  getGlobalContract: getGlobalContract,