Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/convert to esm #65

Merged
merged 6 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
'semi': ['error', 'never'],
'quotes': ['error', 'single'],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off'
'@typescript-eslint/no-unused-vars': 'off',
},
ignorePatterns: ['node_modules', './src/validation/tracer.js', '.eslintrc.js', 'scripts' ],
overrides: [
Expand All @@ -25,4 +25,8 @@ module.exports = {
excludedFiles: './lib/**',
},
],
parserOptions: {
'ecmaVersion': 'latest',
'sourceType': 'module'
},
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ WORKDIR /usr/app
# Copy files from the previous build stage
COPY --from=build_deps /usr/app .

ENTRYPOINT ["node", "./dist/cjs/src/index.js"]
ENTRYPOINT ["node", "./dist/esm/src/index.js"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</p>

<p align="center">
A lightweight ERC4337 bundler node designed specifically for Node.js environment; with a focus on minimal resource consumption, high performance, and minimal dependencies.
A lightweight ERC4337 bundler node designed specifically for Node.js environment; with a focus on minimal resource consumption, and minimal dependencies.
</p>

<p align="center">
Expand Down
37 changes: 11 additions & 26 deletions e2e/send-userop.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import dotenv from 'dotenv'
import { Wallet, providers, ethers, BigNumber, utils } from 'ethers'
import { IENTRY_POINT_ABI } from '../src/abis'
import { UserOperation } from '../src/types'
import { packUserOp, deepHexlify } from '../src/utils'
import { globalCounterABI, simpleAccountABI, simpleAccountFactoryABI } from './abi.e2e'
import { Logger } from '../src/logger'

import { IENTRY_POINT_ABI } from '../src/abis/index.js'
import { Logger } from '../src/logger/index.js'
import { UserOperation } from '../src/types/index.js'
import { packUserOp, deepHexlify } from '../src/utils/index.js'

import {
globalCounterABI,
simpleAccountABI,
simpleAccountFactoryABI,
} from './abi.e2e.js'
dotenv.config()

const provider = new providers.StaticJsonRpcProvider('http://localhost:8545')
Expand Down Expand Up @@ -33,27 +39,6 @@ const simpleAccountFactory = new ethers.Contract(
)
const simpleAccountInterface = new utils.Interface(simpleAccountABI)

// Helper functions
const ethNodeUp = async () => {
try {
await provider.send('web3_clientVersion', [])
return true
} catch (e) {
Logger.error('Local Ethereum node is down')
return false
}
}

const bundlerNodeUp = async () => {
try {
await bundlerProvider.send('web3_clientVersion', [])
return true
} catch (e) {
Logger.error('Local Bundler node is down')
return false
}
}

const getCfFactoryData = (owner: string) => {
const salt = BigNumber.from(Math.floor(Math.random() * 10000000)).toNumber() // a random salt
return {
Expand Down
25 changes: 0 additions & 25 deletions jest.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion nodemon.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"watch": ["src"],
"ext": "ts,json",
"ignore": [],
"exec": "ts-node ./src/index.ts --httpApi web3,eth,debug --txMode base | pino-pretty"
"exec": "node --loader ts-node/esm ./src/index.ts --httpApi web3,eth,debug --txMode base | pino-pretty"
}
Loading
Loading