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() { async init() {
this.web3Conf = metaFactory.getWeb3Conf(this.netId); this.web3Conf = metaFactory.getWeb3Conf(this.netId);
console.log(this.web3Conf);
this.contractsConf = metaFactory.getContractsConf(this.netId); this.contractsConf = metaFactory.getContractsConf(this.netId);
this.netDir = metaFactory.getNetDir(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); const keys = Object.keys(web3ConfHash);
for (let i = 0; i < keys.length; ++i) { for (let i = 0; i < keys.length; ++i) {
if (keys[i] == netId) { const conf = web3ConfHash[keys[i]];
return web3ConfHash[keys[i]]['Web3']; if (conf['net_id'] == netId) {
return conf;
} }
} }
return null; return null;
} }
function getWeb3Conf(netId) {
const conf = getConf(netId);
return conf ? conf['Web3'] : null;
}
function getWeb3BcSpiderConf() { function getWeb3BcSpiderConf() {
return web3BcSpiderConf; return web3BcSpiderConf;
} }
function getContractsConf(netId) { function getContractsConf(netId) {
const keys = Object.keys(web3ConfHash); const conf = getConf(netId);
for (let i = 0; i < keys.length; ++i) { return conf ? conf['Contract'] : null;
if (keys[i] == netId) {
return web3ConfHash[keys[i]]['Contract'];
}
}
return null;
} }
function getNetList() { function getNetList() {