Skip to content

Commit

Permalink
feat: Viem 2.0 (#1610)
Browse files Browse the repository at this point in the history
* chore: canary

* chore: export types

* chore: remove unecessary type export

* chore: export version

* refactor: contract types

* chore: export

* refactor: generics

* refactor: contract types

* refactor: multicall types

* test: multicall types

* refactor: multicall response

* test: multicall types

* refactor: multicall results

* chore: export type

* chore: prettify type

* refactor: contract types

* refactor: contract function generics

* refactor: contract function args generic tweaks

* chore: prettify chain

* chore: update changeset

* chore: remove version export

* chore: restore version

* fix: type error

* refactor: abi types

* wip: types

* wip: types

* chore: fix type test

* chore: checkpoint

* fix: explicit undefined

* chore: ignore changes

* chore: export types

* refactor: simulate contract return type

* fix: transport generic

* refactor: eventName generics

* refactor: simplify poll options

* refactor: consolidate poll options

* fix: test

* chore: update snapshots

* ci: update version in snapshot

* ci: tweak

* chore: export abis

* chore: update snapshot

* chore: update snap

* chore: fix imports

* chore: enter alpha

* chore: update

* chore: add timeout

* chore: types

* chore: bump version

* chore: export types

* fix: type exports

* chore: bump version

* chore: clean up write contract types

* chore: bump version

* chore: update multicall type

* chore: bump version

* chore: version

* chore: export type

* chore: version

* chore: version

* ci: bump release timeout

* chore: version

* feat: refactor getContract

* docs: getContract

* chore: remove entrypoints

* chore: remove note

* fix

* fix: simulateContract account type

* fix

* chore: version

* refactor: chain

* chore: bump abitype

* chore: bump version

* chore: snaps

* docs: chains

* chore: snaps

* chore: snaps

* chore: bump version

* chore: add missing type

* chore: bump version

* test: update snaps

* chore: prettify chain

* refactor: defineChain

* refactor: defineChain type

* chore: remove

* docs: defineChain

* fix: downstream type error

* chore: beta

* chore: remove deprecated things

* docs: chains

* chore: update snaps

* refactor: contract function types

* chore: bump version

* feat: opstack (fees/gas actions) (#1469)

* wip: opstack init

* feat: total gas

* feat: total gas

* feat: imports

* docs: migration guide

* feat: exports

* docs: celo

* docs

* feat: fees

* feat: contract fee/gas estimation

* feat: exports

* feat: exports

* chore: docspath

* chore: update snaps

* docs: address

* docs: sidebar

* tests: fix

* fix: exports

* docs: fix links

* docs: typos

* Update site/docs/op-stack/client.md

Co-authored-by: Will Cory <willcory10@gmail.com>

* Update site/docs/op-stack/estimateContractL1Fee.md

Co-authored-by: Will Cory <willcory10@gmail.com>

* Update site/docs/op-stack/estimateContractL1Gas.md

Co-authored-by: Will Cory <willcory10@gmail.com>

* Update site/docs/op-stack/estimateContractTotalFee.md

Co-authored-by: Will Cory <willcory10@gmail.com>

* Update site/docs/op-stack/estimateContractL1Gas.md

Co-authored-by: Will Cory <willcory10@gmail.com>

* Update site/docs/op-stack/estimateContractL1Fee.md

Co-authored-by: Will Cory <willcory10@gmail.com>

* chore: export

* chore: pr review

* docs: updatE

---------

Co-authored-by: Will Cory <willcory10@gmail.com>

* chore: bump version

* docs: op stack

* docs: dead links

* refactor: rename

* chore: version

* fix: typo

* chore: merge

* refactor: opstack

* fix: types

* fix: type

* fix: downstream types

* chore: snaps

* chore: var fallback

* chore: bump version

* feat: loosen account requirement on estimateGas; tighten prepareTransactionResult type

* docs: update custom client example (#1492)

* refactor: retry & fallback errors

* refactor: wallet client retries

* fix: client extensions w/ chain formatters

* tests: update

* chore: upgrade ts

* chore: lockfile

* chore: merge conflicts

* feat: deposit transaction (op stack) (#1479)

* chore: var fallback

* feat: deposit transaction

* docs

* refactor: api, docs, etc

* refactor: anvil

* refactor: dump op addresses

* tweaks

* feat: prepareDepositTransaction

* feat: mint

* docs: prepare

* refactor: prepare -> build

* feat: extractEventLogs

* docs: remove

* docs: parseEventLogs

* feat: serializer

* refactor

* feat: parsers

* feat: source hash computation

* feat: fromOpaqueData

* feat: compute l2 hashes

* docs: deposit guide

* fix: waitForTxnReceipt

* docs: deposit guide

* chore: example

* chore: update examples

* chore: update snaps

* chore: lint

* update

* update

* chore: update snaps

---------

Co-authored-by: Tom Meagher <tom@meagher.co>

* feat: spread fallback opts

* chore: publish package

* fix: default types

* chore: version package

* chore: export type

* chore: version package

* chore: export types

* chore: publish package

* chore: upgrade playwright

* feat: export promise utils

* chore: publish package

* chore: publish package

* chore: version package

* docs: Add missing params for verifyMessage and verifyTypedData (#1574)

* feat: export getProof from root and from actions (#1571)

* feat: export getProof from root and from actions

* Create dry-bananas-smile.md

---------

Co-authored-by: jxom <jakemoxey@gmail.com>

* chore: update snapshots

* chore: update

* fix: txn receipt

* docs: update migration guide

* docs: ethers migration

* feat: add missing exports (#1583)

* fix: add missing exports

* chore: add changeset

* chore: rename fromOpaqueData

* chore: version package

* feat: opstack withdrawal (#1565)

* feat: initiateWithdrawal

* docs

* feat: buildInitiateWithdrawal

* feat: getSecondsToNextL2Output

* feat: utils

* docs: sidebar

* feat: getWithdrawalHashStorageSlot

* feat: getL2Output

* docs: update withdrawal

* chore: sepolia

* feat: buildProveWithdrawal

* feat: waitForL2Output

* feat: proveWithdrawal

* feat: readyToProve

* docs: dead links

* docs: sidebar

* feat: getTimeToFinalize

* refactor: getWithdrawals

* docs: fix

* docs: update

* feat: waitToFinalize

* feat: finalizeWithdrawal

* feat: getTimeToProve

* chore: period

* refactor

* refactor

* feat: getWithdrawalStatus + rest

* chore: remove example

* chore: clean

* chore: lockfile

* refactor: error type

* feat: estimate actions

* test: remove only

* docs: remove deadlink

* fix: ts 5.0.4 errors

* chore: version

* ci: trigger

* chore: remove changesets from prerelease

* fix: log formatting

* chore: version

* chore: add missing type export

* docs: update OP Stack docs in RC CHA-69 (#1612)

* feat: Add more docs to op

* Update site/op-stack/client.md

* Update site/op-stack/client.md

* Apply suggestions from code review

Co-authored-by: jxom  <jakemoxey@gmail.com>

---------

Co-authored-by: Will Cory <willcory@Wills-MacBook-Pro.local>
Co-authored-by: jxom <jakemoxey@gmail.com>

* chore: format

* fix: simulate types

* fix: test

* chore: version

* chore: tweak

* chore: version

* refactor: getContract client args

* chore: migration guide

* docs

* chore: changeset

---------

Co-authored-by: moxey.eth <jakemoxey@gmail.com>
Co-authored-by: Will Cory <willcory10@gmail.com>
Co-authored-by: Omar <omaraziz.dev@proton.me>
Co-authored-by: Vitor Marthendal Nunes <marthendalnunes@gmail.com>
Co-authored-by: Will Cory <willcory@Wills-MacBook-Pro.local>
Co-authored-by: jxom <jxom@users.noreply.github.com>
  • Loading branch information
7 people committed Jan 3, 2024
1 parent 6d59b95 commit 440b3ba
Show file tree
Hide file tree
Showing 561 changed files with 29,662 additions and 6,573 deletions.
11 changes: 11 additions & 0 deletions .changeset/flat-buses-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"viem": major
---

Viem 2.0 featuring:

- [Low-level OP Stack extensions](https://viem.sh/op-stack.html),
- Enhanced types,
- Miscellaneous improvements and bug fixes.

[Breaking Changes & Migration Guide](https://viem.sh/docs/migration-guide.html)
8 changes: 6 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
VITE_ACCOUNT_PRIVATE_KEY=
VITE_ANVIL_FORK_URL=
VITE_ANVIL_BLOCK_TIME=1
VITE_ANVIL_BLOCK_NUMBER=16280770
VITE_NETWORK_TRANSPORT_MODE=http
VITE_ANVIL_BLOCK_NUMBER_OPTIMISM=112157024
VITE_ANVIL_PORT=8545
VITE_ANVIL_PORT_OPTIMISM=8645
VITE_BATCH_JSON_RPC=false
VITE_BATCH_MULTICALL=false
VITE_ANVIL_PORT=8545
VITE_NETWORK_TRANSPORT_MODE=http
VITE_RPC_URL_OPTIMISM=
9 changes: 0 additions & 9 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ The [`Chain` type](../src/types/chain.ts) has a number of important attributes,

- `id`: The Chain ID for the network. This can be found by typing the network name into [ChainList](https://chainlist.org/). Example: "Ethereum Mainnet" has a Chain ID of `1`.
- `name`: A human readable name for the network. Example: "Binance Smart Chain Mainnet"
- `network`: An internal network label. Example: "bsc"
- `nativeCurrency`: The native currently of the network. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L20-L24).
- `rpcUrls`: A set of RPC URLs for the chain. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L4-L18).
- `blockExplorers`: A set of block explorers for the chain. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L30-L36).
Expand Down Expand Up @@ -266,22 +265,14 @@ import { defineChain } from '../../utils/chain/defineChain.js'

export const mainnet = /*#__PURE__*/ defineChain({
id: 1,
network: 'example',
name: 'Example Chain',
nativeCurrency: { name: 'Example', symbol: 'ETH', decimals: 18 },
rpcUrls: {
default: {
http: ['https://example.com'],
},
public: {
http: ['https://example.com'],
},
},
blockExplorers: {
etherscan: {
name: 'Etherscan',
url: 'https://etherscan.io',
},
default: {
name: 'Etherscan',
url: 'https://etherscan.io',
Expand Down
106 changes: 0 additions & 106 deletions .github/scripts/bench.ts

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/bench.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Main
name: Changesets
on:
push:
branches: [main]
branches: [main, rc]
workflow_dispatch:

concurrency:
Expand All @@ -15,7 +15,7 @@ jobs:
secrets: inherit

changesets:
name: Changesets
name: Create version pull request
runs-on: ubuntu-latest
timeout-minutes: 5

Expand All @@ -32,9 +32,9 @@ jobs:
- name: Create Version Pull Request
uses: changesets/action@v1
with:
version: bun run changeset:version
commit: 'chore: version package'
title: 'chore: version package'
version: bun run changeset:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -57,7 +57,8 @@ jobs:
- name: Publish to NPM
uses: changesets/action@v1
with:
publish: bun run changeset:release
createGithubReleases: ${{ github.ref == 'refs/heads/main' }}
publish: bun run changeset:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
58 changes: 0 additions & 58 deletions .github/workflows/on-pull-request.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/prune-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
registry-url: 'https://registry.npmjs.org'

- name: Prune tags
run: cd src && npm view --json | jq -r '.["dist-tags"] | to_entries | .[] | select(.key != "latest") | select(.key != "main") | select(.key != "alpha") | .key' | xargs -I % npm dist-tag rm viem %
run: cd src && npm view --json | jq -r '.["dist-tags"] | to_entries | .[] | select(.key != "latest") | select(.key != "main") | select(.key != "rc") | .key' | xargs -I % npm dist-tag rm viem %
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Pull request
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
branches:
- '!rc'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
verify:
name: Verify
uses: ./.github/workflows/verify.yml
secrets: inherit

size:
name: Size
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Report bundle size
uses: andresz1/size-limit-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
package_manager: bun
22 changes: 0 additions & 22 deletions .github/workflows/snapshot.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
max-parallel: 3
matrix:
Expand Down Expand Up @@ -156,7 +157,7 @@ jobs:

- name: Install Playwright Browsers
if: ${{ matrix.runtime == 'next' || matrix.runtime == 'sveltekit' || matrix.runtime == 'vite' }}
run: npx playwright@1.39.0 install --with-deps
run: npx playwright@1.40.1 install --with-deps

- name: Install dependencies
uses: ./.github/actions/install-dependencies
Expand Down
Loading

1 comment on commit 440b3ba

@vercel
Copy link

@vercel vercel bot commented on 440b3ba Jan 3, 2024

Choose a reason for hiding this comment

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

Please sign in to comment.