Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apiFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ exports.APIs = (api) => {

let validCalls = {
'submitimports' : "submitImports",
'releasependingimport' : "releasePendingImport",
'submitacceptedimportvote' : "submitAcceptedImportVote",
"getinfo" : "getInfo",
'getexports' : "getExports",
'getcurrency' : "getCurrency",
Expand Down
34 changes: 34 additions & 0 deletions confFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,40 @@ const set_conf = (key, infuraLink, ethContract, chainName)=> {
}
};

const set_conf_values = (chainName, updates) => {
let chaintc = chainName.toUpperCase();
const ID = CONSTANTS.VETHIDHEXREVERSED[chaintc];
let confPath = rootPath(chainName, ID);
let fullPath = confPath + '/' + ID + '.conf';

if (!fs.existsSync(confPath)) {
fs.mkdirSync(confPath, { recursive: true });
}

let _data = "";
try {
_data = fs.readFileSync(fullPath, 'utf8');
} catch (error) {
if (error.code !== 'ENOENT') {
throw error;
}
}

let config = _data.length ? ini.parse(_data) : {};
for (const [key, value] of Object.entries(updates || {})) {
config[key] = value;
}

if (!fs.existsSync(fullPath)) {
fs.writeFileSync(fullPath, "", 'utf8');
}
fs.truncateSync(fullPath, 0);
for (const [key, value] of Object.entries(config)) {
fs.appendFileSync(fullPath, `${key}=${value}` + "\n");
}
};

exports.set_conf = set_conf;
exports.loadConfFile = loadConfFile;
exports.getVerusConf = getVerusConf;
exports.set_conf_values = set_conf_values;
3 changes: 2 additions & 1 deletion constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ module.exports = Object.freeze({
SubmitImports: 8,
NotarizationSerializer: 9,
UpgradeManager: 10,
LastIndex: 11
PendingImports: 11,
LastIndex: 12
},
IADDRESS: 102,
RADDRESS: 60,
Expand Down
Loading