1
This commit is contained in:
parent
2d24984588
commit
0d9ce62ef6
@ -26,13 +26,14 @@ class BlockChain {
|
||||
async init() {
|
||||
this.web3Conf = metaFactory.getWeb3Conf(this.netId);
|
||||
this.contractsConf = metaFactory.getContractsConf(this.netId);
|
||||
this.netDir = metaFactory.getNetDir(this.netId);
|
||||
|
||||
this.web3 = new Web3(this.getRpcUrl());
|
||||
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, data.json);
|
||||
(this.getUserAddress(), data.address, this.netDir + data.json);
|
||||
}
|
||||
event.emitEvent(C.BC_INITIALIZED_EVENT);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ const log = require('j7/log');
|
||||
const metaClassList = [];
|
||||
const metaClasses = {};
|
||||
const web3ConfHash = {};
|
||||
let configDir = './config/';
|
||||
|
||||
function registerMetaClass(fileName, primKey, wrapClass) {
|
||||
const metaClass = {
|
||||
@ -68,7 +69,7 @@ function load() {
|
||||
}
|
||||
|
||||
function init() {
|
||||
let configDir = './config/';
|
||||
configDir = './config/';
|
||||
if (utils.isOnlineEnv()) {
|
||||
configDir = '../config/';
|
||||
} else if (utils.getArgv('env') == 'dev'){
|
||||
@ -150,6 +151,11 @@ function getWeb3Conf(netId) {
|
||||
|
||||
}
|
||||
|
||||
function getNetDir(netId) {
|
||||
const netDir = configDir + 'nets/' + netId + '/';
|
||||
return netDir;
|
||||
}
|
||||
|
||||
exports.init = init;
|
||||
|
||||
exports.getMetaByKey = getMetaByKey;
|
||||
|
Loading…
x
Reference in New Issue
Block a user