@ethereansos/interfaces-core 0.4.52 → 0.4.56
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 +30 -31
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +30 -31
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -42693,55 +42693,54 @@ var Web3ContextProvider = function Web3ContextProvider(props) {
|
|
42693
42693
|
var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
42694
42694
|
var children = _ref.children;
|
42695
42695
|
var context = useEthosContext();
|
42696
|
-
var wallet = useWallet();
|
42697
42696
|
|
42698
|
-
var _useState = useState(
|
42697
|
+
var _useState = useState(create(context.ipfsHost)),
|
42699
42698
|
_useState2 = _slicedToArray(_useState, 2),
|
42700
|
-
|
42701
|
-
|
42699
|
+
ipfsHttpClient = _useState2[0],
|
42700
|
+
setIpfsHttpClient = _useState2[1];
|
42701
|
+
|
42702
|
+
var wallet = useWallet();
|
42702
42703
|
|
42703
|
-
var _useState3 = useState(
|
42704
|
+
var _useState3 = useState(NOT_CONNECTED),
|
42704
42705
|
_useState4 = _slicedToArray(_useState3, 2),
|
42705
|
-
|
42706
|
-
|
42706
|
+
connectionStatus = _useState4[0],
|
42707
|
+
setConnectionStatus = _useState4[1];
|
42707
42708
|
|
42708
42709
|
var _useState5 = useState(null),
|
42709
42710
|
_useState6 = _slicedToArray(_useState5, 2),
|
42710
42711
|
web3Instance = _useState6[0],
|
42711
42712
|
setWeb3Instance = _useState6[1];
|
42712
42713
|
|
42713
|
-
var _useState7 = useState(
|
42714
|
+
var _useState7 = useState([]),
|
42714
42715
|
_useState8 = _slicedToArray(_useState7, 2),
|
42715
|
-
|
42716
|
-
|
42716
|
+
globalContractNames = _useState8[0],
|
42717
|
+
setGlobalContractNames = _useState8[1];
|
42717
42718
|
|
42718
42719
|
var _useState9 = useState([]),
|
42719
42720
|
_useState10 = _slicedToArray(_useState9, 2),
|
42720
|
-
|
42721
|
-
|
42721
|
+
globalContracts = _useState10[0],
|
42722
|
+
setGlobalContracts = _useState10[1];
|
42722
42723
|
|
42723
|
-
var _useState11 = useState(
|
42724
|
+
var _useState11 = useState({}),
|
42724
42725
|
_useState12 = _slicedToArray(_useState11, 2),
|
42725
|
-
|
42726
|
-
|
42726
|
+
contracts = _useState12[0],
|
42727
|
+
setContracts = _useState12[1];
|
42727
42728
|
|
42728
|
-
var _useState13 = useState({}),
|
42729
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
42730
|
-
contracts = _useState14[0],
|
42731
|
-
setContracts = _useState14[1];
|
42732
|
-
|
42733
|
-
useEffect(function () {
|
42734
|
-
setConnectionStatus(wallet && wallet.ethereum ? CONNECTED : connectionStatus || NOT_CONNECTED);
|
42735
|
-
setWeb3Instance(wallet && wallet.ethereum && new Web3(wallet.ethereum) || null);
|
42736
|
-
setChainId(wallet && wallet.chainId || null);
|
42737
|
-
}, [wallet]);
|
42738
42729
|
useEffect(function () {
|
42739
42730
|
setIpfsHttpClient(create(context.ipfsHost));
|
42740
42731
|
}, [context]);
|
42741
42732
|
useEffect(function () {
|
42742
|
-
|
42743
|
-
|
42744
|
-
}, [
|
42733
|
+
setConnectionStatus(wallet && wallet.ethereum ? CONNECTED : connectionStatus || NOT_CONNECTED);
|
42734
|
+
setWeb3Instance(wallet && wallet.ethereum && new Web3(wallet.ethereum) || null);
|
42735
|
+
}, [web3Instance]);
|
42736
|
+
useEffect(function () {
|
42737
|
+
setContracts(function () {
|
42738
|
+
return {};
|
42739
|
+
});
|
42740
|
+
setGlobalContracts(function () {
|
42741
|
+
return globalContractNames.map(newContractByName);
|
42742
|
+
});
|
42743
|
+
}, [web3Instance]);
|
42745
42744
|
|
42746
42745
|
var setConnector = function setConnector(connector) {
|
42747
42746
|
setConnectionStatus(connector ? CONNECTING : NOT_CONNECTED);
|
@@ -42753,7 +42752,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
42753
42752
|
address = address ? web3Utils.toChecksumAddress(address) : '';
|
42754
42753
|
var key = web3Utils.sha3(JSON.stringify(abi) + address);
|
42755
42754
|
var contract = contracts[key];
|
42756
|
-
contract = contract || new web3Instance.eth.Contract(abi, address);
|
42755
|
+
contract = contract || web3Instance && new web3Instance.eth.Contract(abi, address);
|
42757
42756
|
contract && setContracts(function (oldValue) {
|
42758
42757
|
return _objectSpread2(_objectSpread2({}, oldValue), {}, _defineProperty({}, key, contract));
|
42759
42758
|
});
|
@@ -42763,7 +42762,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
42763
42762
|
var newContractByName = function newContractByName(contractName) {
|
42764
42763
|
return newContract(context[contractName[0].toUpperCase() + contractName.substring(1) + 'ABI'], getNetworkElement({
|
42765
42764
|
context: context,
|
42766
|
-
chainId: chainId
|
42765
|
+
chainId: wallet.chainId
|
42767
42766
|
}, contractName + 'Address'));
|
42768
42767
|
};
|
42769
42768
|
|
@@ -42797,7 +42796,7 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
42797
42796
|
ipfsHttpClient: ipfsHttpClient
|
42798
42797
|
}, wallet && connectionStatus === CONNECTED && {
|
42799
42798
|
account: wallet.account,
|
42800
|
-
chainId: chainId,
|
42799
|
+
chainId: wallet.chainId,
|
42801
42800
|
chainName: wallet.networkName,
|
42802
42801
|
web3: web3Instance,
|
42803
42802
|
getGlobalContract: getGlobalContract,
|