Skip to content

Commit

Permalink
Ported ethernaut-interact-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
eternauta1337 committed Mar 2, 2024
1 parent 60f04a7 commit 2b846a6
Show file tree
Hide file tree
Showing 18 changed files with 4,310 additions and 25 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,27 @@ jobs:
npm run chain &
sleep 5
- run: cd packages/ethernaut-interact && npm t
ethernaut-interact-ui:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm run compile --if-present
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Start local chain
run: |
npm run chain &
sleep 5
- run: cd packages/ethernaut-interact-ui && npm t
ethernaut-challenges:
runs-on: ubuntu-latest
strategy:
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions packages/ethernaut-cli/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ require('dotenv').config({
path: require('path').resolve(__dirname, '../../.env'),
})

require('ethernaut-challenges')
require('ethernaut-ai')
require('ethernaut-ui')
require('ethernaut-util')
require('ethernaut-util-ui')
require('ethernaut-interact')
require('ethernaut-ai')
require('ethernaut-challenges')
require('ethernaut-interact-ui')
require('ethernaut-network')
require('ethernaut-network-ui')
require('ethernaut-wallet')
require('ethernaut-wallet-ui')
require('ethernaut-ui')
require('ethernaut-util-ui')

module.exports = {
solidity: '0.8.19',
Expand Down
23 changes: 23 additions & 0 deletions packages/ethernaut-interact-ui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "ethernaut-interact-ui",
"version": "1.0.0",
"description": "Ui expensions for the ethernaut-interact package",
"main": "src/index.js",
"scripts": {
"build": "npm run install:test",
"compile": "echo 'No compile step'",
"install:test": "cd test/fixture-projects/basic-project && npm install",
"test": "nyc mocha --exit --timeout 60000 --require 'test/setup.js' --recursive '../../**/*.test.js' --ignore '../../fixture-projects/**/*'"
},
"author": "",
"license": "ISC",
"devDependencies": {
"hardhat": "^2.20.0",
"mocha": "^10.3.0",
"nyc": "^15.1.0"
},
"directories": {
"test": "test"
},
"keywords": []
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs')
const path = require('path')
const storage = require('../../../internal/storage')
const EtherscanApi = require('../../../internal/etherscan')
const storage = require('ethernaut-interact/src/internal/storage')
const EtherscanApi = require('ethernaut-interact/src/internal/etherscan')
const prompt = require('common/src/prompt')
const spinner = require('common/src/spinner')
const debug = require('common/src/debug')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const storage = require('../../../internal/storage')
const storage = require('ethernaut-interact/src/internal/storage')
const debug = require('common/src/debug')
const { getNetworkName } = require('common/src/network')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const loadAbi = require('../load-abi')
const loadAbi = require('ethernaut-interact/src/tasks/contract/load-abi')
const {
getFunctionSignature,
getPopulatedFunctionSignature,
} = require('../../../internal/signatures')
} = require('ethernaut-interact/src/internal/signatures')
const debug = require('common/src/debug')
const prompt = require('common/src/prompt')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const loadAbi = require('../load-abi')
const loadAbi = require('ethernaut-interact/src/tasks/contract/load-abi')
const debug = require('common/src/debug')
const prompt = require('common/src/prompt')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const loadAbi = require('../load-abi')
const loadAbi = require('ethernaut-interact/src/tasks/contract/load-abi')
const debug = require('common/src/debug')

module.exports = async function autocompleteValue({ value, abi, fn }) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = function setup(hre) {
const contract = hre.scopes.interact.tasks.contract

contract.paramDefinitions.abi.autocomplete = require('../params/abi')
contract.paramDefinitions.address.autocomplete = require('../params/address')
contract.paramDefinitions.fn.autocomplete = require('../params/fn')
contract.paramDefinitions.params.autocomplete = require('../params/params')
contract.paramDefinitions.value.autocomplete = require('../params/value')
}
8 changes: 8 additions & 0 deletions packages/ethernaut-interact-ui/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { extendEnvironment } = require('hardhat/config')

require('ethernaut-ui/src/index')
require('ethernaut-interact/src/index')

extendEnvironment((hre) => {
require('./autocomplete/tasks/contract')(hre)
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @type import('hardhat/config').HardhatUserConfig */
require('@nomicfoundation/hardhat-ethers')
require('../../../src/index')

module.exports = {
solidity: '0.8.24',
defaultNetwork: 'local',
networks: {
local: {
url: 'http://localhost:8545',
},
},
}
Loading

0 comments on commit 2b846a6

Please sign in to comment.