This commit is contained in:
aozhiwei 2023-06-14 11:19:18 +08:00
parent 2fb6b8f513
commit 478508cb95
2 changed files with 22 additions and 2 deletions

View File

@ -152,7 +152,23 @@ function traverseMetaList(name, cb) {
} }
function getWeb3Conf(netId) { function getWeb3Conf(netId) {
const keys = Object.keys(web3ConfHash);
for (let i = 0; i < keys.length; ++i) {
if (keys[i] == netId) {
return web3ConfHash[keys[i]]['Web3'];
}
}
return null;
}
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;
} }
function getNetList() { function getNetList() {
@ -176,4 +192,6 @@ exports.traverseMetaList = traverseMetaList;
exports.callMetaStatic = callMetaStatic; exports.callMetaStatic = callMetaStatic;
exports.getWeb3Conf = getWeb3Conf; exports.getWeb3Conf = getWeb3Conf;
exports.getContractsConf = getContractsConf;
exports.getNetList = getNetList; exports.getNetList = getNetList;
exports.getNetDir = getNetDir;

View File

@ -14,8 +14,10 @@ class BlockChain extends BaseService {
#bc = null; #bc = null;
static async staticInit() { static async staticInit() {
metaFactory.getNetList().forEach((netId) => { metaFactory.getNetList().forEach(async (netId) => {
console.log(netId); const bc = new bcClass(netId);
netIdHash[netId] = bc;
await bc.init();
}); });
} }