const path = require('path'); module.exports = { tags: async (tln) => [], env: async (tln, env) => { env.HARDHAT_HOME = env.TLN_COMPONENT_HOME; env.PATH = [path.join(env.TLN_COMPONENT_HOME, 'node_modules', '.bin'), env.PATH].join(path.delimiter); }, options: async (tln, args) => { args .prefix('TLN_HARDHAT') .option('gateway', { describe: 'Gateway to Ethereum Network', default: 'alchemy', type: 'string' }) .option('network', { describe: 'Network to connect', default: 'localhost', type: 'string' }) .option('script', { describe: 'Script tu run', default: null, type: 'string' }) ; }, dotenvs: async (tln) => [], inherits: async (tln) => [], depends: async (tln) => [], steps: async (tln) => [ { id: 'version', builder: async (tln, script) => { const id = script.env.TLN_COMPONENT_ID; const home = script.env.TLN_COMPONENT_HOME; const {name, version} = tln.unpackId(id); if (version) { script.set([` echo [hardhat] && npx hardhat --version `]); } }}, { id: 'mnemonics', builder: async (tln, script) => { script.set([ `npx mnemonics` ]); }}, { id: 'build', builder: async (tln, script) => { script.set([ `npx hardhat compile` ]); }}, { id: 'test', builder: async (tln, script) => { script.set([ `npx hardhat test` ]); }}, { id: 'serve', builder: async (tln, script) => { script.set([ `npx hardhat node` ]); }}, { id: 'run', builder: async (tln, script) => { script.set([ `npx hardhat run --network ${script.env.TLN_HARDHAT_NETWORK} ${script.env.TLN_HARDHAT_SCRIPT}` ]); }}, { id: 'console', builder: async (tln, script) => { script.set([ `npx hardhat console --network ${script.env.TLN_HARDHAT_NETWORK}` ]); }}, { id: 'install', desc: '', builder: async (tln, script) => { const id = script.env.TLN_COMPONENT_ID; const home = script.env.TLN_COMPONENT_HOME; const {name, version} = tln.unpackId(id); if (version && tln.canInstallComponent(tln, id, home)) { script.set([ `npm install --save-dev hardhat@${version}`, ]) } } } ], components: async (tln) => require('./components.js') }