This commit is contained in:
aozhiwei 2023-07-03 22:10:50 +08:00
parent e6572a59f0
commit a4927c82b6
2 changed files with 12 additions and 10 deletions

View File

@ -33,6 +33,7 @@ class BlockChain {
async init() {
this.web3Conf = metaFactory.getWeb3Conf(this.netId);
console.log(this.web3Conf);
this.contractsConf = metaFactory.getContractsConf(this.netId);
this.netDir = metaFactory.getNetDir(this.netId);

View File

@ -157,28 +157,29 @@ function traverseMetaList(name, cb) {
}
}
function getWeb3Conf(netId) {
function getConf(netId) {
const keys = Object.keys(web3ConfHash);
for (let i = 0; i < keys.length; ++i) {
if (keys[i] == netId) {
return web3ConfHash[keys[i]]['Web3'];
const conf = web3ConfHash[keys[i]];
if (conf['net_id'] == netId) {
return conf;
}
}
return null;
}
function getWeb3Conf(netId) {
const conf = getConf(netId);
return conf ? conf['Web3'] : null;
}
function getWeb3BcSpiderConf() {
return web3BcSpiderConf;
}
function getContractsConf(netId) {
const keys = Object.keys(web3ConfHash);
for (let i = 0; i < keys.length; ++i) {
if (keys[i] == netId) {
return web3ConfHash[keys[i]]['Contract'];
}
}
return null;
const conf = getConf(netId);
return conf ? conf['Contract'] : null;
}
function getNetList() {