@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.cjs.js
CHANGED
@@ -41493,7 +41493,7 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
|
|
41493
41493
|
|
41494
41494
|
case 64:
|
41495
41495
|
tx.gasLimit = _context2.t15;
|
41496
|
-
_context2.t25 = window.bypassEstimation;
|
41496
|
+
_context2.t25 = !window.bypassEstimation;
|
41497
41497
|
|
41498
41498
|
if (!_context2.t25) {
|
41499
41499
|
_context2.next = 69;
|
@@ -42681,6 +42681,8 @@ var useEthosContext = function useEthosContext() {
|
|
42681
42681
|
};
|
42682
42682
|
|
42683
42683
|
var Web3Context = /*#__PURE__*/React__default["default"].createContext('web3');
|
42684
|
+
var DEFAULT_BLOCK_INTERVAL = 15;
|
42685
|
+
var DEFAULT_BLOCK_INTERVAL_TIMEOUT = 40000;
|
42684
42686
|
var web3States = {
|
42685
42687
|
NOT_CONNECTED: NOT_CONNECTED,
|
42686
42688
|
CONNECTED: CONNECTED,
|
@@ -42702,7 +42704,11 @@ var Web3ContextProvider = function Web3ContextProvider(props) {
|
|
42702
42704
|
};
|
42703
42705
|
|
42704
42706
|
var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
42705
|
-
var children = _ref.children
|
42707
|
+
var children = _ref.children,
|
42708
|
+
blockInterval = _ref.blockInterval,
|
42709
|
+
blockIntervalTimeout = _ref.blockIntervalTimeout;
|
42710
|
+
var realBlockInterval = blockInterval || DEFAULT_BLOCK_INTERVAL;
|
42711
|
+
var realBlockIntervalTimeout = blockIntervalTimeout || DEFAULT_BLOCK_INTERVAL_TIMEOUT;
|
42706
42712
|
var context = useEthosContext();
|
42707
42713
|
|
42708
42714
|
var _useState = React.useState(ipfsHttpClient.create(context.ipfsHost)),
|
@@ -42742,9 +42748,68 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
42742
42748
|
contracts = _useState14[0],
|
42743
42749
|
setContracts = _useState14[1];
|
42744
42750
|
|
42751
|
+
var _useState15 = React.useState(0),
|
42752
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
42753
|
+
intervalId = _useState16[0],
|
42754
|
+
setIntervalId = _useState16[1];
|
42755
|
+
|
42756
|
+
var _useState17 = React.useState(0),
|
42757
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
42758
|
+
block = _useState18[0],
|
42759
|
+
setBlock = _useState18[1];
|
42760
|
+
|
42745
42761
|
React.useEffect(function () {
|
42746
42762
|
setIpfsHttpClient(ipfsHttpClient.create(context.ipfsHost));
|
42747
42763
|
}, [context]);
|
42764
|
+
|
42765
|
+
function tryUpdateBlock() {
|
42766
|
+
return _tryUpdateBlock.apply(this, arguments);
|
42767
|
+
}
|
42768
|
+
|
42769
|
+
function _tryUpdateBlock() {
|
42770
|
+
_tryUpdateBlock = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
42771
|
+
var currentBlock, currentBlockNumber;
|
42772
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
42773
|
+
while (1) {
|
42774
|
+
switch (_context.prev = _context.next) {
|
42775
|
+
case 0:
|
42776
|
+
_context.prev = 0;
|
42777
|
+
_context.next = 3;
|
42778
|
+
return sendAsync(wallet.ethereum, 'eth_getBlock', 'latest', true);
|
42779
|
+
|
42780
|
+
case 3:
|
42781
|
+
currentBlock = _context.sent;
|
42782
|
+
currentBlockNumber = parseInt(currentBlock.number);
|
42783
|
+
|
42784
|
+
if (currentBlockNumber - block >= realBlockInterval) {
|
42785
|
+
setBlock(currentBlockNumber);
|
42786
|
+
}
|
42787
|
+
|
42788
|
+
_context.next = 10;
|
42789
|
+
break;
|
42790
|
+
|
42791
|
+
case 8:
|
42792
|
+
_context.prev = 8;
|
42793
|
+
_context.t0 = _context["catch"](0);
|
42794
|
+
|
42795
|
+
case 10:
|
42796
|
+
case "end":
|
42797
|
+
return _context.stop();
|
42798
|
+
}
|
42799
|
+
}
|
42800
|
+
}, _callee, null, [[0, 8]]);
|
42801
|
+
}));
|
42802
|
+
return _tryUpdateBlock.apply(this, arguments);
|
42803
|
+
}
|
42804
|
+
|
42805
|
+
function resetBlockInterval() {
|
42806
|
+
intervalId && clearInterval(intervalId);
|
42807
|
+
setBlock(0);
|
42808
|
+
wallet && wallet.ethereum && tryUpdateBlock();
|
42809
|
+
wallet && wallet.ethereum && setIntervalId(setInterval(tryUpdateBlock, realBlockIntervalTimeout));
|
42810
|
+
}
|
42811
|
+
|
42812
|
+
React.useEffect(resetBlockInterval, [realBlockInterval, realBlockIntervalTimeout]);
|
42748
42813
|
React.useEffect(function () {
|
42749
42814
|
setConnectionStatus(wallet && wallet.ethereum ? CONNECTED : connectionStatus === CONNECTING ? CONNECTING : NOT_CONNECTED);
|
42750
42815
|
setWeb3Instance(wallet && wallet.ethereum && (web3Instance || new Web3__default["default"](wallet.ethereum)) || null);
|
@@ -42753,6 +42818,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
42753
42818
|
setContracts({});
|
42754
42819
|
setGlobalContracts(globalContractNames.map(newContractByName));
|
42755
42820
|
setChainId(wallet && wallet.chainId || null);
|
42821
|
+
resetBlockInterval();
|
42756
42822
|
}, [wallet && wallet.chainId]);
|
42757
42823
|
|
42758
42824
|
var setConnector = function setConnector(connector) {
|
@@ -42823,6 +42889,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
42823
42889
|
chainId: chainId,
|
42824
42890
|
chainName: wallet.networkName,
|
42825
42891
|
web3: web3Instance,
|
42892
|
+
block: block,
|
42826
42893
|
getGlobalContract: getGlobalContract,
|
42827
42894
|
newContract: newContract
|
42828
42895
|
}), wallet && wallet.error && {
|