diff --git a/packages/ethernaut-network/src/tasks/add.js b/packages/ethernaut-network/src/tasks/add.js index e09a1a8f..f31bc10b 100644 --- a/packages/ethernaut-network/src/tasks/add.js +++ b/packages/ethernaut-network/src/tasks/add.js @@ -1,6 +1,6 @@ const { types } = require('hardhat/config') const output = require('common/src/output') -const autocompleteProvider = require('./autocomplete/provider') +const autocompleteUrl = require('./autocomplete/url') const storage = require('../internal/storage') const add = require('../scopes/net') @@ -12,12 +12,12 @@ const add = require('../scopes/net') types.string, ) .addOptionalParam( - 'provider', + 'url', 'The url of the network provider, e.g. https://ethereum-rpc.publicnode.com. Note: Environment variables may be included, e.g. https://eth-mainnet.alchemyapi.io/v2/${INFURA_API_KEY}. Make sure to specify these in your .env file.', undefined, types.string, ) - .setAction(async ({ alias, provider }) => { + .setAction(async ({ alias, url }) => { try { const validateAlias = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/ if (!validateAlias.test(alias)) { @@ -33,15 +33,15 @@ const add = require('../scopes/net') } networks[alias] = { - url: provider, + url, } storage.storeNetworks(networks) - output.resultBox(`Added network ${alias} with provider ${provider}`) + output.resultBox(`Added network ${alias} with provider ${url}`) } catch (err) { return output.errorBox(err) } }) -add.paramDefinitions.provider.autocomplete = autocompleteProvider +add.paramDefinitions.url.autocomplete = autocompleteUrl diff --git a/packages/ethernaut-network/src/tasks/autocomplete/provider.js b/packages/ethernaut-network/src/tasks/autocomplete/url.js similarity index 91% rename from packages/ethernaut-network/src/tasks/autocomplete/provider.js rename to packages/ethernaut-network/src/tasks/autocomplete/url.js index 093f8e82..158acef0 100644 --- a/packages/ethernaut-network/src/tasks/autocomplete/provider.js +++ b/packages/ethernaut-network/src/tasks/autocomplete/url.js @@ -6,8 +6,8 @@ const strategies = { MANUAL: 'Enter url manually', } -module.exports = async function autocompleteProvider({ provider }) { - if (provider) return undefined +module.exports = async function autocompleteProvider({ url }) { + if (url) return undefined const choice = await selectStrategy() switch (choice) { diff --git a/packages/ethernaut-network/test/tasks/add.test.js b/packages/ethernaut-network/test/tasks/add.test.js index bdf1e0e1..5bf5a6f7 100644 --- a/packages/ethernaut-network/test/tasks/add.test.js +++ b/packages/ethernaut-network/test/tasks/add.test.js @@ -18,7 +18,7 @@ describe('add', function () { describe('when all params are specified', function () { before('run add', async function () { await terminal.run( - 'npx hardhat net add test__1 --provider http://localhost:8545', + 'npx hardhat net add test__1 --url http://localhost:8545', ) })