Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// eslint-disable-next-line
const json = require(itxFile);
const itxStr = json[Object.keys(json).shift()];
const itxB64 = base64.unescape(itxStr);
debug('itxB64', itxB64);
const itxBuffer = Buffer.from(itxB64, 'base64');
debug('itxBuffer', itxBuffer);
const itxHex = bytesToHex(itxBuffer);
debug('itxHex', itxHex.slice(2).toUpperCase());
const DeployProtocolTx = client.getType('DeployProtocolTx');
const itxObj = DeployProtocolTx.deserializeBinary(itxBuffer).toObject();
itxObj.address = toItxAddress(itxObj, 'DeployProtocolTx');
shell.echo('transaction protocol detail', itxObj);
const hash = await client.sendDeployProtocolTx({
tx: {
nonce: 0,
itx: itxObj,
},
wallet: moderator,
});
shell.echo(`${symbols.success} transaction protocol deploy success`);
shell.echo(`${symbols.info} inspect tx with ${chalk.cyan(`forge tx ${hash}`)}`);
} catch (err) {
debug.error(err);
shell.echo(`${symbols.error} transaction protocol deploy failed`);
}
}