From 8db726386029c24c840e75b7b848eb3721671ea3 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 29 Feb 2024 11:10:11 -0300 Subject: [PATCH] Fixes --- packages/ethernaut-network/src/tasks/info.js | 8 +++++++- packages/ethernaut-network/src/tasks/node.js | 15 +++++++++++++-- .../ethernaut-network/test/scopes/net.test.js | 7 ------- .../ethernaut-network/test/scopes/network.test.js | 7 +++++++ .../ethernaut-ui/src/internal/make-interactive.js | 2 +- .../test/tasks/navigate-scope.test.js | 4 ++-- packages/ethernaut-wallet/src/tasks/info.js | 8 +++++++- packages/ethernaut-wallet/src/tasks/sign.js | 8 +++++++- 8 files changed, 44 insertions(+), 15 deletions(-) delete mode 100644 packages/ethernaut-network/test/scopes/net.test.js create mode 100644 packages/ethernaut-network/test/scopes/network.test.js diff --git a/packages/ethernaut-network/src/tasks/info.js b/packages/ethernaut-network/src/tasks/info.js index d719b39d..4dc77072 100644 --- a/packages/ethernaut-network/src/tasks/info.js +++ b/packages/ethernaut-network/src/tasks/info.js @@ -1,3 +1,4 @@ +const { types } = require('hardhat/config') const output = require('common/src/output') const storage = require('../internal/storage') const { chains } = require('common/src/chains') @@ -6,7 +7,12 @@ const autocompleteAlias = require('./autocomplete/alias') const info = require('../scopes/network') .task('info', 'Provides information about a network') - .addOptionalPositionalParam('alias', 'The name or url of the network') + .addOptionalPositionalParam( + 'alias', + 'The name or url of the network', + undefined, + types.string, + ) .setAction(async ({ alias }, hre) => { try { if (!alias) { diff --git a/packages/ethernaut-network/src/tasks/node.js b/packages/ethernaut-network/src/tasks/node.js index 0bc347b8..04153423 100644 --- a/packages/ethernaut-network/src/tasks/node.js +++ b/packages/ethernaut-network/src/tasks/node.js @@ -1,3 +1,4 @@ +const { types } = require('hardhat/config') const output = require('common/src/output') const { execSync } = require('child_process') const { isUrl } = require('common/src/url') @@ -7,8 +8,18 @@ const applyEnvVars = require('../internal/apply-env-vars') const local = require('../scopes/network') .task('node', 'Starts a local development chain, potentially with a fork.') - .addOptionalParam('fork', 'The alias or url of the network to fork') - .addOptionalParam('port', 'The port to run the local chain on') + .addOptionalParam( + 'fork', + 'The alias or url of the network to fork', + undefined, + types.string, + ) + .addOptionalParam( + 'port', + 'The port to run the local chain on', + undefined, + types.string, + ) .setAction(async ({ fork, port }) => { try { const forkUrl = getForkUrl(fork) diff --git a/packages/ethernaut-network/test/scopes/net.test.js b/packages/ethernaut-network/test/scopes/net.test.js deleted file mode 100644 index 4c331b51..00000000 --- a/packages/ethernaut-network/test/scopes/net.test.js +++ /dev/null @@ -1,7 +0,0 @@ -const assert = require('assert') - -describe('net', function () { - it('has an "net" scope', async function () { - assert.notEqual(hre.scopes['net'], undefined) - }) -}) diff --git a/packages/ethernaut-network/test/scopes/network.test.js b/packages/ethernaut-network/test/scopes/network.test.js new file mode 100644 index 00000000..69a717c1 --- /dev/null +++ b/packages/ethernaut-network/test/scopes/network.test.js @@ -0,0 +1,7 @@ +const assert = require('assert') + +describe('network', function () { + it('has an "network" scope', async function () { + assert.notEqual(hre.scopes['network'], undefined) + }) +}) diff --git a/packages/ethernaut-ui/src/internal/make-interactive.js b/packages/ethernaut-ui/src/internal/make-interactive.js index 663fdf54..e294bf16 100644 --- a/packages/ethernaut-ui/src/internal/make-interactive.js +++ b/packages/ethernaut-ui/src/internal/make-interactive.js @@ -35,7 +35,7 @@ function makeInteractive(task) { ) { return } - debug.log(`Making task "${task.name}" interactive`, 'ui') + debug.log(`Making task "${task.name}" interactive`, 'ui-deep') // TODO: Ai doesn't know how to handle flags // TODO: This wont really work until I can parse args diff --git a/packages/ethernaut-ui/test/tasks/navigate-scope.test.js b/packages/ethernaut-ui/test/tasks/navigate-scope.test.js index dcb6c656..b58b38a0 100644 --- a/packages/ethernaut-ui/test/tasks/navigate-scope.test.js +++ b/packages/ethernaut-ui/test/tasks/navigate-scope.test.js @@ -32,8 +32,8 @@ describe('navigate scope', function () { }) it('does not show utils', async function () { - terminal.notHas('to-bytes') - terminal.notHas('to-string') + terminal.notHas('bytes') + terminal.notHas('string') terminal.notHas('unit') }) diff --git a/packages/ethernaut-wallet/src/tasks/info.js b/packages/ethernaut-wallet/src/tasks/info.js index 2104e6bb..24154899 100644 --- a/packages/ethernaut-wallet/src/tasks/info.js +++ b/packages/ethernaut-wallet/src/tasks/info.js @@ -1,10 +1,16 @@ +const { types } = require('hardhat/config') const output = require('common/src/output') const storage = require('../internal/storage') const autocompleteAlias = require('./autocomplete/alias') const info = require('../scopes/wallet') .task('info', 'Shows information about a wallet') - .addOptionalPositionalParam('alias', 'The name of the wallet') + .addOptionalPositionalParam( + 'alias', + 'The name of the wallet', + undefined, + types.string, + ) .setAction(async ({ alias }, hre) => { try { if (!alias) { diff --git a/packages/ethernaut-wallet/src/tasks/sign.js b/packages/ethernaut-wallet/src/tasks/sign.js index 6892cefa..afd63c02 100644 --- a/packages/ethernaut-wallet/src/tasks/sign.js +++ b/packages/ethernaut-wallet/src/tasks/sign.js @@ -1,10 +1,16 @@ +const { types } = require('hardhat/config') const output = require('common/src/output') const storage = require('../internal/storage') const { getWallet } = require('../internal/signers') require('../scopes/wallet') .task('sign', 'Signs a message with a wallet') - .addOptionalPositionalParam('message', 'The message to sign') + .addOptionalPositionalParam( + 'message', + 'The message to sign', + undefined, + types.string, + ) .setAction(async ({ message }) => { try { const signers = storage.readSigners()