@ethereansos/interfaces-core 0.4.68 → 0.4.72
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 +76 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +76 -11
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -41482,7 +41482,7 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
|
|
41482
41482
|
|
41483
41483
|
case 64:
|
41484
41484
|
tx.gasLimit = _context2.t15;
|
41485
|
-
_context2.t25 = window.bypassEstimation;
|
41485
|
+
_context2.t25 = !window.bypassEstimation;
|
41486
41486
|
|
41487
41487
|
if (!_context2.t25) {
|
41488
41488
|
_context2.next = 69;
|
@@ -42670,6 +42670,7 @@ var useEthosContext = function useEthosContext() {
|
|
42670
42670
|
};
|
42671
42671
|
|
42672
42672
|
var Web3Context = /*#__PURE__*/React.createContext('web3');
|
42673
|
+
var BLOCK_INTERVAL = 15;
|
42673
42674
|
var web3States = {
|
42674
42675
|
NOT_CONNECTED: NOT_CONNECTED,
|
42675
42676
|
CONNECTED: CONNECTED,
|
@@ -42731,9 +42732,60 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
42731
42732
|
contracts = _useState14[0],
|
42732
42733
|
setContracts = _useState14[1];
|
42733
42734
|
|
42735
|
+
var _useState15 = useState(0),
|
42736
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
42737
|
+
intervalId = _useState16[0],
|
42738
|
+
setIntervalId = _useState16[1];
|
42739
|
+
|
42740
|
+
var _useState17 = useState(0),
|
42741
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
42742
|
+
block = _useState18[0],
|
42743
|
+
setBlock = _useState18[1];
|
42744
|
+
|
42734
42745
|
useEffect(function () {
|
42735
42746
|
setIpfsHttpClient(create(context.ipfsHost));
|
42736
42747
|
}, [context]);
|
42748
|
+
|
42749
|
+
function updateBlock() {
|
42750
|
+
return _updateBlock.apply(this, arguments);
|
42751
|
+
}
|
42752
|
+
|
42753
|
+
function _updateBlock() {
|
42754
|
+
_updateBlock = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
42755
|
+
var currentBlock, currentBlockNumber;
|
42756
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
42757
|
+
while (1) {
|
42758
|
+
switch (_context.prev = _context.next) {
|
42759
|
+
case 0:
|
42760
|
+
_context.prev = 0;
|
42761
|
+
_context.next = 3;
|
42762
|
+
return sendAsync(wallet.ethereum, 'eth_getBlock', 'latest', true);
|
42763
|
+
|
42764
|
+
case 3:
|
42765
|
+
currentBlock = _context.sent;
|
42766
|
+
currentBlockNumber = parseInt(currentBlock.number);
|
42767
|
+
|
42768
|
+
if (currentBlockNumber - block >= BLOCK_INTERVAL) {
|
42769
|
+
setBlock(currentBlockNumber);
|
42770
|
+
}
|
42771
|
+
|
42772
|
+
_context.next = 10;
|
42773
|
+
break;
|
42774
|
+
|
42775
|
+
case 8:
|
42776
|
+
_context.prev = 8;
|
42777
|
+
_context.t0 = _context["catch"](0);
|
42778
|
+
|
42779
|
+
case 10:
|
42780
|
+
case "end":
|
42781
|
+
return _context.stop();
|
42782
|
+
}
|
42783
|
+
}
|
42784
|
+
}, _callee, null, [[0, 8]]);
|
42785
|
+
}));
|
42786
|
+
return _updateBlock.apply(this, arguments);
|
42787
|
+
}
|
42788
|
+
|
42737
42789
|
useEffect(function () {
|
42738
42790
|
setConnectionStatus(wallet && wallet.ethereum ? CONNECTED : connectionStatus === CONNECTING ? CONNECTING : NOT_CONNECTED);
|
42739
42791
|
setWeb3Instance(wallet && wallet.ethereum && (web3Instance || new Web3(wallet.ethereum)) || null);
|
@@ -42742,14 +42794,15 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
42742
42794
|
setContracts({});
|
42743
42795
|
setGlobalContracts(globalContractNames.map(newContractByName));
|
42744
42796
|
setChainId(wallet && wallet.chainId || null);
|
42797
|
+
intervalId && clearInterval(intervalId);
|
42798
|
+
setBlock(0);
|
42799
|
+
wallet && wallet.ethereum && updateBlock();
|
42800
|
+
wallet && wallet.ethereum && setIntervalId(setInterval(updateBlock, 35000));
|
42745
42801
|
}, [wallet && wallet.chainId]);
|
42746
42802
|
|
42747
42803
|
var setConnector = function setConnector(connector) {
|
42748
42804
|
setConnectionStatus(connector ? CONNECTING : NOT_CONNECTED);
|
42749
42805
|
wallet && connector && wallet.connect(connector.id);
|
42750
|
-
wallet && !connector && setContracts({});
|
42751
|
-
wallet && !connector && setGlobalContracts(globalContractNames.map(newContractByName));
|
42752
|
-
wallet && !connector && setChainId(wallet && wallet.chainId || null);
|
42753
42806
|
wallet && !connector && wallet.reset();
|
42754
42807
|
};
|
42755
42808
|
|
@@ -42774,14 +42827,25 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
42774
42827
|
var getGlobalContract = function getGlobalContract(contractName) {
|
42775
42828
|
var index = globalContractNames.indexOf(contractName);
|
42776
42829
|
|
42777
|
-
if (index === -1) {
|
42830
|
+
if (index === -1 || !globalContracts[index]) {
|
42778
42831
|
var contract = newContractByName(contractName);
|
42779
|
-
|
42780
|
-
|
42781
|
-
|
42782
|
-
|
42783
|
-
|
42784
|
-
|
42832
|
+
|
42833
|
+
if (index === -1) {
|
42834
|
+
contract && setGlobalContracts(function (oldValue) {
|
42835
|
+
return [].concat(_toConsumableArray(oldValue), [contract]);
|
42836
|
+
});
|
42837
|
+
contract && setGlobalContractNames(function (oldValue) {
|
42838
|
+
return [].concat(_toConsumableArray(oldValue), [contractName]);
|
42839
|
+
});
|
42840
|
+
} else if (contract) {
|
42841
|
+
var newGlobalContracts = _toConsumableArray(globalContracts);
|
42842
|
+
|
42843
|
+
newGlobalContracts[index] = contract;
|
42844
|
+
setGlobalContracts(function () {
|
42845
|
+
return newGlobalContracts;
|
42846
|
+
});
|
42847
|
+
}
|
42848
|
+
|
42785
42849
|
return contract;
|
42786
42850
|
}
|
42787
42851
|
|
@@ -42804,6 +42868,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
42804
42868
|
chainId: chainId,
|
42805
42869
|
chainName: wallet.networkName,
|
42806
42870
|
web3: web3Instance,
|
42871
|
+
block: block,
|
42807
42872
|
getGlobalContract: getGlobalContract,
|
42808
42873
|
newContract: newContract
|
42809
42874
|
}), wallet && wallet.error && {
|