in cli-functions.js [66:91]
export async function createAccount(config, type = 'path') {
let configPath = config;
if (type === 'data') {
const filename = path.join(os.tmpdir(), `config-${crypto.randomUUID()}.tmp`);
fs.writeFileSync(filename, config);
configPath = filename;
}
const command = 'rescontract';
const args = ['create', '--config', configPath];
try {
const result = await handleExecFile(command, args);
if (type === 'data') {
fs.unlinkSync(configPath);
}
const address = result.match(/address: \"(0x[0-9a-fA-F]+)\"/)[1];
return address;
} catch (error) {
if (type === 'data' && fs.existsSync(configPath)) {
fs.unlinkSync(configPath);
}
throw error;
}
}