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: support Panic & custom contract errors #57

Merged
merged 7 commits into from
Feb 9, 2023
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
5 changes: 5 additions & 0 deletions .changeset/fifty-weeks-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"viem": patch
---

support `Panic` & custom contract errors
52 changes: 52 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 'Setup'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel like we use these steps in a lot of actions. Might make sense to create a composite action for them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

runs:
using: "composite"
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: ${{ matrix.pnpm-version }}
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node-version }}
- name: Cache pnpm
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: pnpm-
- name: Cache node_modules
uses: actions/cache@v3
id: cache-node-modules
with:
path: |
dist
node_modules
playgrounds/**/node_modules
site/node_modules
key: modules-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
profile: minimal
override: true
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Install Dependencies
shell: bash
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: pnpm i
- name: Build Contracts
shell: bash
if: steps.cache-node-modules.outputs.cache-hit == 'true'
run: pnpm contracts:build
- name: Link Dependencies
shell: bash
if: steps.cache-node-modules.outputs.cache-hit == 'true'
run: pnpm dev
68 changes: 4 additions & 64 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,8 @@ jobs:
pnpm-version: [7]
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: ${{ matrix.pnpm-version }}
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node-version }}
- name: Cache pnpm
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: pnpm-
- name: Cache node_modules
uses: actions/cache@v3
id: cache-node-modules
with:
path: |
dist
node_modules
playgrounds/**/node_modules
site/node_modules
key: modules-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install Dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: pnpm i
- name: Link Dependencies
if: steps.cache-node-modules.outputs.cache-hit == 'true'
run: pnpm dev
- name: Setup
uses: ./.github/actions/setup

bench:
name: Benchmark
Expand All @@ -57,40 +29,8 @@ jobs:
pnpm-version: [7]
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: ${{ matrix.pnpm-version }}
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
uses: actions/cache@v3
with:
path: |
dist
node_modules
playgrounds/**/node_modules
site/node_modules
key: modules-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
profile: minimal
override: true
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Launch Anvil
run: anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME &
env:
VITE_ANVIL_BLOCK_NUMBER: ${{ secrets.VITE_ANVIL_BLOCK_NUMBER }}
VITE_ANVIL_BLOCK_TIME: ${{ secrets.VITE_ANVIL_BLOCK_TIME }}
VITE_ANVIL_FORK_URL: ${{ secrets.VITE_ANVIL_FORK_URL }}
- name: Setup
uses: ./.github/actions/setup
- name: Bench
run: pnpm bench:ci
env:
Expand Down
128 changes: 10 additions & 118 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,8 @@ jobs:
pnpm-version: [7]
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: ${{ matrix.pnpm-version }}
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node-version }}
- name: Cache pnpm
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: pnpm-
- name: Cache node_modules
uses: actions/cache@v3
id: cache-node-modules
with:
path: |
dist
node_modules
playgrounds/**/node_modules
site/node_modules
key: modules-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install Dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: pnpm i
- name: Link Dependencies
if: steps.cache-node-modules.outputs.cache-hit == 'true'
run: pnpm dev
- name: Setup
uses: ./.github/actions/setup

lint:
name: Lint
Expand All @@ -60,25 +32,8 @@ jobs:
pnpm-version: [7]
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: ${{ matrix.pnpm-version }}
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
uses: actions/cache@v3
with:
path: |
dist
node_modules
playgrounds/**/node_modules
site/node_modules
key: modules-${{ hashFiles('pnpm-lock.yaml') }}
- name: Link
run: pnpm dev
- name: Setup
uses: ./.github/actions/setup
- name: Check types
run: pnpm typecheck
- name: Lint & format code
Expand Down Expand Up @@ -107,23 +62,8 @@ jobs:
pnpm-version: [7]
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: ${{ matrix.pnpm-version }}
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
uses: actions/cache@v3
with:
path: |
dist
node_modules
playgrounds/**/node_modules
site/node_modules
key: modules-${{ hashFiles('pnpm-lock.yaml') }}
- name: Setup
uses: ./.github/actions/setup
- name: Build
run: pnpm build

Expand All @@ -140,34 +80,8 @@ jobs:
transport-mode: ['http', 'webSocket']
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: ${{ matrix.pnpm-version }}
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
uses: actions/cache@v3
with:
path: |
dist
node_modules
playgrounds/**/node_modules
site/node_modules
key: modules-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
profile: minimal
override: true
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Setup
uses: ./.github/actions/setup
- name: Launch Anvil
run: anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME &
env:
Expand Down Expand Up @@ -201,30 +115,8 @@ jobs:
pnpm-version: [7]
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: ${{ matrix.pnpm-version }}
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
uses: actions/cache@v3
with:
path: |
dist
node_modules
playgrounds/**/node_modules
site/node_modules
key: modules-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
profile: minimal
override: true
- name: Setup
uses: ./.github/actions/setup
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
cache: 'pnpm'
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: pnpm i
run: pnpm i --ignore-scripts

- name: Create Release Pull Request or Publish to npm
id: changesets
Expand Down
29 changes: 2 additions & 27 deletions .github/workflows/size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,8 @@ jobs:
pnpm-version: [7]
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: ${{ matrix.pnpm-version }}
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node-version }}
- name: Cache pnpm
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: pnpm-
- name: Cache node_modules
uses: actions/cache@v3
id: cache-node-modules
with:
path: |
dist
node_modules
playgrounds/**/node_modules
site/node_modules
key: modules-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install Dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: pnpm i
- name: Setup
uses: ./.github/actions/setup
- uses: preactjs/compressed-size-action@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
2 changes: 1 addition & 1 deletion .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: pnpm i
run: pnpm i --ignore-scripts

- name: Publish to npm
uses: seek-oss/changesets-snapshot@v0
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ bench
.env.production.local
.envrc

# @wagmi/cli
generated.ts

actions/**
chains/**
clients/**
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "contracts/lib/forge-std"]
path = contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
2 changes: 2 additions & 0 deletions contracts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cache/
out/
1 change: 1 addition & 0 deletions contracts/lib/forge-std
Submodule forge-std added at 662ae0
Loading