@ethereansos/interfaces-core 0.4.118 → 0.4.119
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 +67 -16
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +67 -16
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
@@ -48776,6 +48776,7 @@ var useEthosContext = function useEthosContext() {
|
|
48776
48776
|
return context;
|
48777
48777
|
};
|
48778
48778
|
|
48779
|
+
var abi$8 = new AbiCoder();
|
48779
48780
|
var Web3Context = /*#__PURE__*/React__default["default"].createContext('web3');
|
48780
48781
|
var DEFAULT_BLOCK_INTERVAL = 15;
|
48781
48782
|
var DEFAULT_BLOCK_INTERVAL_TIMEOUT = 40000;
|
@@ -48919,15 +48920,65 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
48919
48920
|
return _ref2.apply(this, arguments);
|
48920
48921
|
};
|
48921
48922
|
}(), [realBlockInterval]);
|
48923
|
+
var tryUpdateBlockDual = React.useCallback( /*#__PURE__*/function () {
|
48924
|
+
var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(provider, oldValue, setter, force) {
|
48925
|
+
var currentBlockNumber;
|
48926
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
48927
|
+
while (1) {
|
48928
|
+
switch (_context2.prev = _context2.next) {
|
48929
|
+
case 0:
|
48930
|
+
if (provider) {
|
48931
|
+
_context2.next = 2;
|
48932
|
+
break;
|
48933
|
+
}
|
48934
|
+
|
48935
|
+
return _context2.abrupt("return", setter(0));
|
48936
|
+
|
48937
|
+
case 2:
|
48938
|
+
_context2.prev = 2;
|
48939
|
+
_context2.next = 5;
|
48940
|
+
return sendAsync(provider, 'eth_call', {
|
48941
|
+
to: '0x4200000000000000000000000000000000000013',
|
48942
|
+
data: web3Utils__default["default"].sha3('getL1BlockNumber()').substring(0, 10)
|
48943
|
+
});
|
48944
|
+
|
48945
|
+
case 5:
|
48946
|
+
currentBlockNumber = _context2.sent;
|
48947
|
+
currentBlockNumber = abi$8.decode(['uint256'], currentBlockNumber)[0].toString();
|
48948
|
+
currentBlockNumber = parseInt(currentBlockNumber);
|
48949
|
+
|
48950
|
+
if (force === true || currentBlockNumber - oldValue >= realBlockInterval) {
|
48951
|
+
setter(currentBlockNumber);
|
48952
|
+
}
|
48953
|
+
|
48954
|
+
_context2.next = 13;
|
48955
|
+
break;
|
48956
|
+
|
48957
|
+
case 11:
|
48958
|
+
_context2.prev = 11;
|
48959
|
+
_context2.t0 = _context2["catch"](2);
|
48960
|
+
|
48961
|
+
case 13:
|
48962
|
+
case "end":
|
48963
|
+
return _context2.stop();
|
48964
|
+
}
|
48965
|
+
}
|
48966
|
+
}, _callee2, null, [[2, 11]]);
|
48967
|
+
}));
|
48968
|
+
|
48969
|
+
return function (_x5, _x6, _x7, _x8) {
|
48970
|
+
return _ref3.apply(this, arguments);
|
48971
|
+
};
|
48972
|
+
}(), [realBlockInterval]);
|
48922
48973
|
var resetBlockInterval = React.useCallback(function () {
|
48923
48974
|
intervalId && clearInterval(intervalId);
|
48924
48975
|
tryUpdateBlock(wallet === null || wallet === void 0 ? void 0 : wallet.ethereum, block, setBlock, true);
|
48925
|
-
|
48976
|
+
tryUpdateBlockDual(dualProvider && (wallet === null || wallet === void 0 ? void 0 : wallet.ethereum), dualBlock, setDualBlock, true);
|
48926
48977
|
|
48927
48978
|
if (wallet && wallet.ethereum || dualProvider) {
|
48928
48979
|
setIntervalId(setInterval(function () {
|
48929
48980
|
wallet && wallet.ethereum && tryUpdateBlock(wallet.ethereum, block, setBlock);
|
48930
|
-
dualProvider &&
|
48981
|
+
dualProvider && wallet && wallet.ethereum && tryUpdateBlockDual(wallet.ethereum, dualBlock, setDualBlock);
|
48931
48982
|
}, realBlockIntervalTimeout));
|
48932
48983
|
}
|
48933
48984
|
}, [wallet, dualProvider, realBlockIntervalTimeout, intervalId]);
|
@@ -49000,31 +49051,31 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
49000
49051
|
};
|
49001
49052
|
|
49002
49053
|
window.setAccount = /*#__PURE__*/function () {
|
49003
|
-
var _setAccount = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function
|
49004
|
-
return regeneratorRuntime.wrap(function
|
49054
|
+
var _setAccount = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(acc) {
|
49055
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
49005
49056
|
while (1) {
|
49006
|
-
switch (
|
49057
|
+
switch (_context3.prev = _context3.next) {
|
49007
49058
|
case 0:
|
49008
49059
|
delete window.account;
|
49009
49060
|
acc && (window.account = acc);
|
49010
|
-
|
49011
|
-
|
49061
|
+
_context3.prev = 2;
|
49062
|
+
_context3.t0 = acc && window.ganache;
|
49012
49063
|
|
49013
|
-
if (!
|
49014
|
-
|
49064
|
+
if (!_context3.t0) {
|
49065
|
+
_context3.next = 7;
|
49015
49066
|
break;
|
49016
49067
|
}
|
49017
49068
|
|
49018
|
-
|
49069
|
+
_context3.next = 7;
|
49019
49070
|
return sendAsync(window.ganache, 'evm_addAccount', acc, 0);
|
49020
49071
|
|
49021
49072
|
case 7:
|
49022
|
-
|
49073
|
+
_context3.next = 11;
|
49023
49074
|
break;
|
49024
49075
|
|
49025
49076
|
case 9:
|
49026
|
-
|
49027
|
-
|
49077
|
+
_context3.prev = 9;
|
49078
|
+
_context3.t1 = _context3["catch"](2);
|
49028
49079
|
|
49029
49080
|
case 11:
|
49030
49081
|
setBlock(new Date().getTime());
|
@@ -49033,13 +49084,13 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
49033
49084
|
|
49034
49085
|
case 14:
|
49035
49086
|
case "end":
|
49036
|
-
return
|
49087
|
+
return _context3.stop();
|
49037
49088
|
}
|
49038
49089
|
}
|
49039
|
-
},
|
49090
|
+
}, _callee3, null, [[2, 9]]);
|
49040
49091
|
}));
|
49041
49092
|
|
49042
|
-
function setAccount(
|
49093
|
+
function setAccount(_x9) {
|
49043
49094
|
return _setAccount.apply(this, arguments);
|
49044
49095
|
}
|
49045
49096
|
|