@ethereansos/interfaces-core 0.4.69 → 0.4.73
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 +69 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +69 -2
- 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,8 @@ var useEthosContext = function useEthosContext() {
|
|
42670
42670
|
};
|
42671
42671
|
|
42672
42672
|
var Web3Context = /*#__PURE__*/React.createContext('web3');
|
42673
|
+
var DEFAULT_BLOCK_INTERVAL = 15;
|
42674
|
+
var DEFAULT_BLOCK_INTERVAL_TIMEOUT = 40000;
|
42673
42675
|
var web3States = {
|
42674
42676
|
NOT_CONNECTED: NOT_CONNECTED,
|
42675
42677
|
CONNECTED: CONNECTED,
|
@@ -42691,7 +42693,11 @@ var Web3ContextProvider = function Web3ContextProvider(props) {
|
|
42691
42693
|
};
|
42692
42694
|
|
42693
42695
|
var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
42694
|
-
var children = _ref.children
|
42696
|
+
var children = _ref.children,
|
42697
|
+
blockInterval = _ref.blockInterval,
|
42698
|
+
blockIntervalTimeout = _ref.blockIntervalTimeout;
|
42699
|
+
var realBlockInterval = blockInterval || DEFAULT_BLOCK_INTERVAL;
|
42700
|
+
var realBlockIntervalTimeout = blockIntervalTimeout || DEFAULT_BLOCK_INTERVAL_TIMEOUT;
|
42695
42701
|
var context = useEthosContext();
|
42696
42702
|
|
42697
42703
|
var _useState = useState(create(context.ipfsHost)),
|
@@ -42731,9 +42737,68 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
42731
42737
|
contracts = _useState14[0],
|
42732
42738
|
setContracts = _useState14[1];
|
42733
42739
|
|
42740
|
+
var _useState15 = useState(0),
|
42741
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
42742
|
+
intervalId = _useState16[0],
|
42743
|
+
setIntervalId = _useState16[1];
|
42744
|
+
|
42745
|
+
var _useState17 = useState(0),
|
42746
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
42747
|
+
block = _useState18[0],
|
42748
|
+
setBlock = _useState18[1];
|
42749
|
+
|
42734
42750
|
useEffect(function () {
|
42735
42751
|
setIpfsHttpClient(create(context.ipfsHost));
|
42736
42752
|
}, [context]);
|
42753
|
+
|
42754
|
+
function tryUpdateBlock() {
|
42755
|
+
return _tryUpdateBlock.apply(this, arguments);
|
42756
|
+
}
|
42757
|
+
|
42758
|
+
function _tryUpdateBlock() {
|
42759
|
+
_tryUpdateBlock = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
42760
|
+
var currentBlock, currentBlockNumber;
|
42761
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
42762
|
+
while (1) {
|
42763
|
+
switch (_context.prev = _context.next) {
|
42764
|
+
case 0:
|
42765
|
+
_context.prev = 0;
|
42766
|
+
_context.next = 3;
|
42767
|
+
return sendAsync(wallet.ethereum, 'eth_getBlock', 'latest', true);
|
42768
|
+
|
42769
|
+
case 3:
|
42770
|
+
currentBlock = _context.sent;
|
42771
|
+
currentBlockNumber = parseInt(currentBlock.number);
|
42772
|
+
|
42773
|
+
if (currentBlockNumber - block >= realBlockInterval) {
|
42774
|
+
setBlock(currentBlockNumber);
|
42775
|
+
}
|
42776
|
+
|
42777
|
+
_context.next = 10;
|
42778
|
+
break;
|
42779
|
+
|
42780
|
+
case 8:
|
42781
|
+
_context.prev = 8;
|
42782
|
+
_context.t0 = _context["catch"](0);
|
42783
|
+
|
42784
|
+
case 10:
|
42785
|
+
case "end":
|
42786
|
+
return _context.stop();
|
42787
|
+
}
|
42788
|
+
}
|
42789
|
+
}, _callee, null, [[0, 8]]);
|
42790
|
+
}));
|
42791
|
+
return _tryUpdateBlock.apply(this, arguments);
|
42792
|
+
}
|
42793
|
+
|
42794
|
+
function resetBlockInterval() {
|
42795
|
+
intervalId && clearInterval(intervalId);
|
42796
|
+
setBlock(0);
|
42797
|
+
wallet && wallet.ethereum && tryUpdateBlock();
|
42798
|
+
wallet && wallet.ethereum && setIntervalId(setInterval(tryUpdateBlock, realBlockIntervalTimeout));
|
42799
|
+
}
|
42800
|
+
|
42801
|
+
useEffect(resetBlockInterval, [realBlockInterval, realBlockIntervalTimeout]);
|
42737
42802
|
useEffect(function () {
|
42738
42803
|
setConnectionStatus(wallet && wallet.ethereum ? CONNECTED : connectionStatus === CONNECTING ? CONNECTING : NOT_CONNECTED);
|
42739
42804
|
setWeb3Instance(wallet && wallet.ethereum && (web3Instance || new Web3(wallet.ethereum)) || null);
|
@@ -42742,6 +42807,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
42742
42807
|
setContracts({});
|
42743
42808
|
setGlobalContracts(globalContractNames.map(newContractByName));
|
42744
42809
|
setChainId(wallet && wallet.chainId || null);
|
42810
|
+
resetBlockInterval();
|
42745
42811
|
}, [wallet && wallet.chainId]);
|
42746
42812
|
|
42747
42813
|
var setConnector = function setConnector(connector) {
|
@@ -42812,6 +42878,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
42812
42878
|
chainId: chainId,
|
42813
42879
|
chainName: wallet.networkName,
|
42814
42880
|
web3: web3Instance,
|
42881
|
+
block: block,
|
42815
42882
|
getGlobalContract: getGlobalContract,
|
42816
42883
|
newContract: newContract
|
42817
42884
|
}), wallet && wallet.error && {
|