@ethereansos/interfaces-core 0.4.117 → 0.4.120
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 +77 -24
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +77 -24
- 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;
|
|
@@ -48866,8 +48867,8 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
|
48866
48867
|
|
|
48867
48868
|
var _useState23 = React.useState(null),
|
|
48868
48869
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
48869
|
-
|
|
48870
|
-
|
|
48870
|
+
dualChainWeb3 = _useState24[0],
|
|
48871
|
+
setDualChainWeb3 = _useState24[1];
|
|
48871
48872
|
|
|
48872
48873
|
React.useEffect(function () {
|
|
48873
48874
|
setIpfsHttpClient(ipfsHttpClient.create(context.ipfsHost));
|
|
@@ -48919,19 +48920,69 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
|
48919
48920
|
return _ref2.apply(this, arguments);
|
|
48920
48921
|
};
|
|
48921
48922
|
}(), [realBlockInterval]);
|
|
48923
|
+
var tryUpdateDualChainBlock = React.useCallback( /*#__PURE__*/function () {
|
|
48924
|
+
var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(web3, 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 (web3 !== null && web3 !== void 0 && web3.currentProvider) {
|
|
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(web3.currentProvider, '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
|
+
tryUpdateDualChainBlock(dualChainWeb3 && (wallet === null || wallet === void 0 ? void 0 : wallet.ethereum), dualBlock, setDualBlock, true);
|
|
48926
48977
|
|
|
48927
|
-
if (wallet && wallet.ethereum ||
|
|
48978
|
+
if (wallet && wallet.ethereum || dualChainWeb3) {
|
|
48928
48979
|
setIntervalId(setInterval(function () {
|
|
48929
48980
|
wallet && wallet.ethereum && tryUpdateBlock(wallet.ethereum, block, setBlock);
|
|
48930
|
-
|
|
48981
|
+
dualChainWeb3 && wallet && wallet.ethereum && tryUpdateDualChainBlock(wallet.ethereum, dualBlock, setDualBlock);
|
|
48931
48982
|
}, realBlockIntervalTimeout));
|
|
48932
48983
|
}
|
|
48933
|
-
}, [wallet,
|
|
48934
|
-
React.useEffect(resetBlockInterval, [realBlockInterval, realBlockIntervalTimeout, wallet && wallet.ethereum,
|
|
48984
|
+
}, [wallet, dualChainWeb3, realBlockIntervalTimeout, intervalId]);
|
|
48985
|
+
React.useEffect(resetBlockInterval, [realBlockInterval, realBlockIntervalTimeout, wallet && wallet.ethereum, dualChainWeb3]);
|
|
48935
48986
|
React.useEffect(function () {
|
|
48936
48987
|
setConnectionStatus(wallet && wallet.ethereum ? CONNECTED : connectionStatus === CONNECTING ? CONNECTING : NOT_CONNECTED);
|
|
48937
48988
|
setWeb3Instance(wallet && wallet.ethereum && (web3Instance || new Web3__default["default"](wallet.ethereum)) || null);
|
|
@@ -48943,7 +48994,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
|
48943
48994
|
setChainId(actualChainId);
|
|
48944
48995
|
var actualDualChainId = actualChainId && context.dualChainId[actualChainId] || null;
|
|
48945
48996
|
setDualChainId(actualDualChainId);
|
|
48946
|
-
|
|
48997
|
+
setDualChainWeb3(actualDualChainId && new Web3__default["default"](context.chainProvider[actualDualChainId]) || null);
|
|
48947
48998
|
resetBlockInterval();
|
|
48948
48999
|
}, [wallet && wallet.chainId]);
|
|
48949
49000
|
|
|
@@ -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
|
|
|
@@ -49067,7 +49118,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
|
49067
49118
|
newContract: newContract,
|
|
49068
49119
|
dualChainId: dualChainId,
|
|
49069
49120
|
dualBlock: dualBlock,
|
|
49070
|
-
|
|
49121
|
+
dualChainWeb3: dualChainWeb3
|
|
49071
49122
|
}), wallet && wallet.error && {
|
|
49072
49123
|
errorMessage: wallet.error.message
|
|
49073
49124
|
});
|
|
@@ -64574,7 +64625,9 @@ function _getTokenPricesInDollarsOnCoingecko() {
|
|
|
64574
64625
|
}()));
|
|
64575
64626
|
|
|
64576
64627
|
case 6:
|
|
64577
|
-
res.data = _context3.sent.reduce(({
|
|
64628
|
+
res.data = _context3.sent.reduce(function (acc, it) {
|
|
64629
|
+
return _objectSpread2(_objectSpread2({}, acc), it);
|
|
64630
|
+
}, {});
|
|
64578
64631
|
|
|
64579
64632
|
case 7:
|
|
64580
64633
|
_context3.next = 11;
|