Skip to content

Commit

Permalink
Merge pull request #17 from vechain/prepare-npm-publish
Browse files Browse the repository at this point in the history
Prepare npm publish
  • Loading branch information
freemanzMrojo authored Jul 30, 2024
2 parents 4316c82 + a52e353 commit 6697a61
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 5 deletions.
2 changes: 0 additions & 2 deletions contracts/.npmignore

This file was deleted.

18 changes: 15 additions & 3 deletions contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,31 @@
},
"repository": {
"type": "git",
"url": "https://github.com/eth-infinitism/account-abstraction"
"url": "https://github.com/vechain/account-abstraction"
},
"keywords": [
"vechain",
"solidity",
"ethereum",
"smart",
"contracts",
"accipt-abstraction",
"account-abstraction",
"eip-4337"
],
"files": [
"artifacts",
"core",
"dist",
"interfaces",
"samples",
"types",
"utils",
"index.ts",
"package.json"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/eth-infinitism/account-abstraction/issues"
"url": "https://github.com/vechain/account-abstraction/issues"
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.2",
Expand Down
17 changes: 17 additions & 0 deletions scripts/check-gas-reports
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# make sure gas reports are checked in with this commit
# dump report diff
# exit with "1" if there is a diff, zero if no diff

folder=${1:-reports}
git diff --color=always $folder
git diff ${folder} | grep -q .

if [ "$?" == 1 ]; then
#diff with no error - ok
exit
else
echo ERROR: found above unchecked reports.
exit 1
fi

5 changes: 5 additions & 0 deletions scripts/docker-gascalc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# run "yarn gas-calc" using geth with docker.
# (if you have geth running on localhost:8545, its faster with "HARDHAT_NETWORK=dev yarn gas-calc")
docker-compose -f `dirname $0`/docker-gascalc.yml up --abort-on-container-exit
docker-compose -f `dirname $0`/docker-gascalc.yml down

20 changes: 20 additions & 0 deletions scripts/docker-gascalc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '2'

services:
test:
image: node
container_name: gascalc
depends_on:
- localgeth
volumes:
- ..:/app
working_dir: /app
restart: "no"
environment:
- HARDHAT_NETWORK=localgeth
command: "yarn mocha-gascalc"

#configuration is a copy of github/.workflows/build.xml
localgeth:
image: dtr22/geth-dev
container_name: localgeth
15 changes: 15 additions & 0 deletions scripts/gascalc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# run gascalc, assuming "geth" is running on localhost, port 8545
cd `dirname $0`/..
function getClientVersion() {
curl -m 1 -s -d '{"method":"web3_clientVersion","params":[],"id":1234,"jsonrpc":"2.0"}' -H content-type:application/json localhost:8545
}

if [[ `getClientVersion` =~ "Geth" ]]; then
echo Using GETH on localhost:8545
HARDHAT_NETWORK=dev yarn mocha-gascalc
else
echo No GETH running on localhost:8545. Using docker..
./scripts/docker-gascalc
fi
5 changes: 5 additions & 0 deletions scripts/hh-wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -euo pipefail
export FORCE_COLOR=1
hardhat "$@" 2>&1 | `dirname $0`/solcErrors
6 changes: 6 additions & 0 deletions scripts/postpack-contracts-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash -xe
#echo postpack for "contracts" package
cd `dirname $0`/..
pwd
rm -rf contracts/artifacts contracts/types contracts/dist

19 changes: 19 additions & 0 deletions scripts/prepack-contracts-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash -xe
#echo prepack for "contracts" package

cd `dirname $0`/..
pwd
if git status contracts | grep -v 'nothing to commit'|tee /dev/stderr |grep -q Untracked; then
exit 1
fi

yarn clean
yarn compile
cd contracts

rm -rf artifacts types dist

mkdir -p artifacts
cp `find ../artifacts/contracts -type f | grep -v -E 'Test|dbg|gnosis|bls|IOracle'` artifacts/
npx typechain --target ethers-v5 --out-dir types artifacts/**
npx tsc index.ts -d --outDir dist
32 changes: 32 additions & 0 deletions scripts/sample-script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// When running the script with `npx hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
const hre = require('hardhat')

async function main () {
// Hardhat always runs the compile task when running scripts with its command
// line interface.
//
// If this script is run directly using `node` you may want to call compile
// manually to make sure everything is compiled
// await hre.run('compile');

// We get the contract to deploy
const Singleton = await hre.ethers.getContractFactory('Singleton')
const singleton = await Singleton.deploy()

await singleton.deployed()

console.log('Singleton deployed to:', singleton.address)
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
12 changes: 12 additions & 0 deletions scripts/solcErrors
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export LC_CTYPE=
#solc error ( unrecognized by idea
# --> contracts/UserOperation.sol:57:9:
#js error (recognized)
# at SimpleWallet._validateSignature (contracts/samples/SimpleWallet.sol:76)

perl -pe 's/--> (\S+):(\d+):(\d+):/at ($1:$2)/;' \
-e "s/.*(Solidity 0.8.\d+ is not fully supported yet|Learn.more at.*solidity-support).*\s*//;" \
-e "s/^\s*$//;" \
-e "s/\s*at .*node_modules.*\s*//;" \
-e "s/.*HH600.*\s*//"

0 comments on commit 6697a61

Please sign in to comment.