Skip to content

Commit

Permalink
Bootstrap signer package
Browse files Browse the repository at this point in the history
  • Loading branch information
eternauta1337 committed Feb 28, 2024
1 parent 7ac0544 commit aa2eee9
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,21 @@ jobs:
- run: npm run build --if-present
- run: npm run compile --if-present
- run: cd packages/ethernaut-network && npm t
ethernaut-signer:
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
- run: cd packages/ethernaut-signer && npm t
ethernaut-cli:
runs-on: ubuntu-latest
strategy:
Expand Down
12 changes: 12 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions packages/ethernaut-cli/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require('ethernaut-interact')
require('ethernaut-ai')
require('ethernaut-challenges')
require('ethernaut-network')
require('ethernaut-signer')

module.exports = {
solidity: '0.8.19',
Expand Down
18 changes: 18 additions & 0 deletions packages/ethernaut-signer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "ethernaut-signer",
"version": "1.0.0",
"description": "Ethernaut CLI signer utility",
"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": {
"nyc": "^15.1.0",
"@nomicfoundation/hardhat-ethers": "^3.0.5"
}
}
15 changes: 15 additions & 0 deletions packages/ethernaut-signer/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { extendEnvironment } = require('hardhat/config')
const requireAll = require('common/src/require-all')
const spinner = require('common/src/spinner')
// const storage = require('./internal/storage')
// const { setActiveNetwork } = require('./internal/set-network')

requireAll(__dirname, 'tasks')

extendEnvironment((hre) => {
spinner.enable(!hre.hardhatArguments.verbose)

// storage.init()

// setActiveNetwork(hre)
})
4 changes: 4 additions & 0 deletions packages/ethernaut-signer/src/scopes/sig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const { scope } = require('hardhat/config')
const { description } = require('../../package.json')

module.exports = scope('sig', description)
16 changes: 16 additions & 0 deletions packages/ethernaut-signer/src/tasks/add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// const { types } = require('hardhat/config')
const output = require('common/src/output')
// const autocompleteUrl = require('./autocomplete/url')
// const storage = require('../internal/storage')

require('../scopes/sig')
.task('add', 'Adds a signer')
.setAction(async () => {
try {
console.log('add signer')
} catch (err) {
return output.errorBox(err)
}
})

// add.paramDefinitions.url.autocomplete = autocompleteUrl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type import('hardhat/config').HardhatUserConfig */
require('@nomicfoundation/hardhat-ethers')
require('../../../src/index')
require('../../../../ethernaut-ui/src/index')

module.exports = {
solidity: '0.8.24',
defaultNetwork: 'localhost',
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "basic-project",
"devDependencies": {
"@nomicfoundation/hardhat-ethers": "^3.0.5",
"ethers": "^6.11.1"
}
}
7 changes: 7 additions & 0 deletions packages/ethernaut-signer/test/scopes/sig.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const assert = require('assert')

describe('sig', function () {
it('has an "sig" scope', async function () {
assert.notEqual(hre.scopes['sig'], undefined)
})
})
4 changes: 4 additions & 0 deletions packages/ethernaut-signer/test/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const { loadProject, muteOutput } = require('common/src/setup-tests')

muteOutput()
loadProject('test/fixture-projects/basic-project')

0 comments on commit aa2eee9

Please sign in to comment.