@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.esm.js
CHANGED
@@ -48764,6 +48764,7 @@ var useEthosContext = function useEthosContext() {
|
|
48764
48764
|
return context;
|
48765
48765
|
};
|
48766
48766
|
|
48767
|
+
var abi$8 = new AbiCoder();
|
48767
48768
|
var Web3Context = /*#__PURE__*/React.createContext('web3');
|
48768
48769
|
var DEFAULT_BLOCK_INTERVAL = 15;
|
48769
48770
|
var DEFAULT_BLOCK_INTERVAL_TIMEOUT = 40000;
|
@@ -48907,15 +48908,65 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
48907
48908
|
return _ref2.apply(this, arguments);
|
48908
48909
|
};
|
48909
48910
|
}(), [realBlockInterval]);
|
48911
|
+
var tryUpdateBlockDual = useCallback( /*#__PURE__*/function () {
|
48912
|
+
var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(provider, oldValue, setter, force) {
|
48913
|
+
var currentBlockNumber;
|
48914
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
48915
|
+
while (1) {
|
48916
|
+
switch (_context2.prev = _context2.next) {
|
48917
|
+
case 0:
|
48918
|
+
if (provider) {
|
48919
|
+
_context2.next = 2;
|
48920
|
+
break;
|
48921
|
+
}
|
48922
|
+
|
48923
|
+
return _context2.abrupt("return", setter(0));
|
48924
|
+
|
48925
|
+
case 2:
|
48926
|
+
_context2.prev = 2;
|
48927
|
+
_context2.next = 5;
|
48928
|
+
return sendAsync(provider, 'eth_call', {
|
48929
|
+
to: '0x4200000000000000000000000000000000000013',
|
48930
|
+
data: web3Utils.sha3('getL1BlockNumber()').substring(0, 10)
|
48931
|
+
});
|
48932
|
+
|
48933
|
+
case 5:
|
48934
|
+
currentBlockNumber = _context2.sent;
|
48935
|
+
currentBlockNumber = abi$8.decode(['uint256'], currentBlockNumber)[0].toString();
|
48936
|
+
currentBlockNumber = parseInt(currentBlockNumber);
|
48937
|
+
|
48938
|
+
if (force === true || currentBlockNumber - oldValue >= realBlockInterval) {
|
48939
|
+
setter(currentBlockNumber);
|
48940
|
+
}
|
48941
|
+
|
48942
|
+
_context2.next = 13;
|
48943
|
+
break;
|
48944
|
+
|
48945
|
+
case 11:
|
48946
|
+
_context2.prev = 11;
|
48947
|
+
_context2.t0 = _context2["catch"](2);
|
48948
|
+
|
48949
|
+
case 13:
|
48950
|
+
case "end":
|
48951
|
+
return _context2.stop();
|
48952
|
+
}
|
48953
|
+
}
|
48954
|
+
}, _callee2, null, [[2, 11]]);
|
48955
|
+
}));
|
48956
|
+
|
48957
|
+
return function (_x5, _x6, _x7, _x8) {
|
48958
|
+
return _ref3.apply(this, arguments);
|
48959
|
+
};
|
48960
|
+
}(), [realBlockInterval]);
|
48910
48961
|
var resetBlockInterval = useCallback(function () {
|
48911
48962
|
intervalId && clearInterval(intervalId);
|
48912
48963
|
tryUpdateBlock(wallet === null || wallet === void 0 ? void 0 : wallet.ethereum, block, setBlock, true);
|
48913
|
-
|
48964
|
+
tryUpdateBlockDual(dualProvider && (wallet === null || wallet === void 0 ? void 0 : wallet.ethereum), dualBlock, setDualBlock, true);
|
48914
48965
|
|
48915
48966
|
if (wallet && wallet.ethereum || dualProvider) {
|
48916
48967
|
setIntervalId(setInterval(function () {
|
48917
48968
|
wallet && wallet.ethereum && tryUpdateBlock(wallet.ethereum, block, setBlock);
|
48918
|
-
dualProvider &&
|
48969
|
+
dualProvider && wallet && wallet.ethereum && tryUpdateBlockDual(wallet.ethereum, dualBlock, setDualBlock);
|
48919
48970
|
}, realBlockIntervalTimeout));
|
48920
48971
|
}
|
48921
48972
|
}, [wallet, dualProvider, realBlockIntervalTimeout, intervalId]);
|
@@ -48988,31 +49039,31 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
48988
49039
|
};
|
48989
49040
|
|
48990
49041
|
window.setAccount = /*#__PURE__*/function () {
|
48991
|
-
var _setAccount = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function
|
48992
|
-
return regeneratorRuntime.wrap(function
|
49042
|
+
var _setAccount = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(acc) {
|
49043
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
48993
49044
|
while (1) {
|
48994
|
-
switch (
|
49045
|
+
switch (_context3.prev = _context3.next) {
|
48995
49046
|
case 0:
|
48996
49047
|
delete window.account;
|
48997
49048
|
acc && (window.account = acc);
|
48998
|
-
|
48999
|
-
|
49049
|
+
_context3.prev = 2;
|
49050
|
+
_context3.t0 = acc && window.ganache;
|
49000
49051
|
|
49001
|
-
if (!
|
49002
|
-
|
49052
|
+
if (!_context3.t0) {
|
49053
|
+
_context3.next = 7;
|
49003
49054
|
break;
|
49004
49055
|
}
|
49005
49056
|
|
49006
|
-
|
49057
|
+
_context3.next = 7;
|
49007
49058
|
return sendAsync(window.ganache, 'evm_addAccount', acc, 0);
|
49008
49059
|
|
49009
49060
|
case 7:
|
49010
|
-
|
49061
|
+
_context3.next = 11;
|
49011
49062
|
break;
|
49012
49063
|
|
49013
49064
|
case 9:
|
49014
|
-
|
49015
|
-
|
49065
|
+
_context3.prev = 9;
|
49066
|
+
_context3.t1 = _context3["catch"](2);
|
49016
49067
|
|
49017
49068
|
case 11:
|
49018
49069
|
setBlock(new Date().getTime());
|
@@ -49021,13 +49072,13 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
49021
49072
|
|
49022
49073
|
case 14:
|
49023
49074
|
case "end":
|
49024
|
-
return
|
49075
|
+
return _context3.stop();
|
49025
49076
|
}
|
49026
49077
|
}
|
49027
|
-
},
|
49078
|
+
}, _callee3, null, [[2, 9]]);
|
49028
49079
|
}));
|
49029
49080
|
|
49030
|
-
function setAccount(
|
49081
|
+
function setAccount(_x9) {
|
49031
49082
|
return _setAccount.apply(this, arguments);
|
49032
49083
|
}
|
49033
49084
|
|