This commit is contained in:
aozhiwei 2023-07-15 14:36:42 +08:00
parent 3f52ed5f58
commit 1688743a2e
3 changed files with 26 additions and 3 deletions

View File

@ -40,11 +40,25 @@ class BlockChain {
this.web3.eth.handleRevert = true;
this.web3.eth.accounts.wallet.add(this.getPrivateKey());
for (const data of this.contractsConf) {
this[`${data.name}Instance`] = await this.initInstance
(this.getUserAddress(), data.address, this.netDir + data.json);
try {
this[`${data.name}Instance`] = await this.initInstance
(this.getUserAddress(), data.address, this.netDir + data.json);
} catch (err) {
if (utils.isOnlineEnv()) {
throw new Error(err);
} else {
if (data.name == 'AridropNft') {
log.warning('load contract file error:' + err);
}
}
}
}
const chainId = await this.web3.eth.getChainId();
if (chainId != this.netId) {
throw new Error(util.format('net id error %s %s',
chainId,
this.netId
));
log.warning(util.format('net id error %s %s',
chainId,
this.netId

View File

@ -23,6 +23,14 @@ function registerMetaClass(fileName, primKey, wrapClass) {
metaClasses[wrapClass] = metaClass;
}
function checkNetData(net) {
net['Events'].forEach(
(item) => {
console.log(item);
}
);
}
function load() {
metaClassList.forEach((metaClass) => {
const json = utils.readJsonFromFile(metaClass['fileName']);
@ -126,6 +134,7 @@ async function init() {
'refresh_erc1155': net['refresh_erc1155'],
'refresh_erc20': net['refresh_erc20'],
};
checkNetData(web3ConfHash[netId]);
});
}
});

@ -1 +1 @@
Subproject commit 727a3ffd5c809eced13837594ac9288415b0118b
Subproject commit e294ca4ebe3c603359c8dd349590f336a94383c1