diff --git a/README.md b/README.md index d936824..e3503d8 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,14 @@ A utility package that performs simulation and estimations of all ERC-4337 User Operation gas limits. +## Quickstart: + +```sh +bun add @biconomy/gas-estimations viem +``` + ## Usage + ### Create a Gas Estimator You can create the gas estimator for you chain of choice in multiple ways. @@ -155,3 +162,23 @@ This will publish a canary version to npm with a temporary version number. The o [Canary Release](https://www.npmjs.com/package/@biconomy/gas-estimations) **Note:** You need to have appropriate npm permissions to publish the package. + +## Linking & Developing + +To link the package to your project, run: + +```sh +bun run dev +``` + +Then in your linked project, update your package.json dependencies to point to the local SDK: + +```json +{ + "dependencies": { + "@biconomy/gas-estimations": "file:../../entry-point-gas-estimations" + } +} +``` + +This will run the package in watch mode, and will automatically update the package in your linked project. diff --git a/TESTING.md b/TESTING.md index 840ac85..83dc406 100644 --- a/TESTING.md +++ b/TESTING.md @@ -9,7 +9,7 @@ Here's how to setup & run a E2E for a selected network. > 💡 For the purpose of this example we will assume we are testing Base Sepolia (84532) 1. **Create a `test.json` file in the `config` directory**: You can use `test-example.json` as a reference. - - `bun run init:testConfig` will create and saturate the `test.json` file with API keys from environment variables. + - `bun run init:tests` will create and saturate the `test.json` file with API keys from environment variables. 2. **Get a private RPC URL from one of the providers**: E2E tests require proper private RPC URLs and usually don't work with public RPC URLs because they don't support RPC features such as state overrides or trace calls. **Alchemy** is a good first choice. 3. **Add the private RPC URL to the `test.json` file:** The config should look something like this: ```json diff --git a/bun.lockb b/bun.lockb index 4cc75d5..1508d13 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 71663d5..cff0429 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ } }, "scripts": { + "dev": "bun link && bun run build:types && bun run build:watch", "format": "biome format . --write", "lint": "biome check .", "lint:fix": "bun run lint --apply", @@ -23,8 +24,8 @@ "build:types": "tsc --emitDeclarationOnly", "build:js": "tsup src/index.ts --format esm,cjs --dts --outDir dist --clean", "build:watch": "tsup src/index.ts --format esm,cjs --dts --outDir dist --watch", - "test": "vitest --run --reporter=verbose", - "test:coverage": "vitest --run --reporter=verbose --coverage", + "test": "vitest -c ./vitest.config.ts --run --reporter=verbose", + "test:coverage": "CI=true vitest -c ./vitest.config.ts --run --reporter=verbose --coverage", "changeset": "changeset", "changeset:release": "bun run build && changeset publish", "changeset:version": "changeset version && bun install --lockfile-only", @@ -32,7 +33,7 @@ "docs": "typedoc --tsconfig ./tsconfig.json", "docs:deploy": "bun run docs && gh-pages -d docs", "size": "size-limit", - "init:testConfig": "bun run scripts/populate:testConfig.ts" + "init:tests": "bun run scripts/init:tests.ts" }, "dependencies": { "zod": "^3.24.1", @@ -64,7 +65,7 @@ "vitest": "^3.0.1" }, "peerDependencies": { - "viem": "^2.22.8" + "viem": "^2.22.9" }, "commitlint": { "extends": [ diff --git a/scripts/populate:testConfig.ts b/scripts/init:tests.ts similarity index 100% rename from scripts/populate:testConfig.ts rename to scripts/init:tests.ts diff --git a/vitest.config.ts b/vitest.config.ts index 203ad34..e9ab091 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,5 +1,7 @@ -import { join } from "node:path" import { defineConfig } from "vitest/config" +import { config } from "dotenv" + +config() export default defineConfig({ test: {