Skip to content

Commit

Permalink
chore: merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm committed Sep 4, 2023
2 parents 3bfb1e6 + 4875a2a commit 2a59ccf
Show file tree
Hide file tree
Showing 130 changed files with 2,906 additions and 1,601 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-eels-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"viem": patch
---

Added Vechain chain.
2 changes: 1 addition & 1 deletion .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ runs:
uses: actions/setup-node@v3
with:
cache: pnpm
node-version: 18
node-version: 20

- name: Set up foundry
uses: foundry-rs/foundry-toolchain@v1
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ jobs:
bench:
name: Benchmark
runs-on: ubuntu-latest
strategy:
matrix:
transport-mode: ['http', 'webSocket']

steps:
- name: Clone repository
Expand All @@ -27,7 +24,6 @@ jobs:
VITE_ANVIL_BLOCK_NUMBER: ${{ vars.VITE_ANVIL_BLOCK_NUMBER }}
VITE_ANVIL_BLOCK_TIME: ${{ vars.VITE_ANVIL_BLOCK_TIME }}
VITE_ANVIL_FORK_URL: ${{ secrets.VITE_ANVIL_FORK_URL }}
VITE_NETWORK_TRANSPORT_MODE: ${{ matrix.transport-mode }}

- name: Report benchmarks
run: pnpm bun ./.github/scripts/bench.ts
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,11 @@ jobs:
name: Test
runs-on: ubuntu-latest
strategy:
max-parallel: 3
matrix:
shard: [1, 2, 3, 4]
total-shards: [4]
transport-mode: ['http', 'webSocket']
include:
- batch-multicall: 'false'
- batch-multicall: 'true'
transport-mode: 'http'

shard: [1, 2, 3]
total-shards: [3]
steps:
- name: Clone repository
uses: actions/checkout@v3
Expand All @@ -100,14 +96,14 @@ jobs:
- name: Run tests
uses: nick-fields/retry@v2
with:
timeout_minutes: 30
timeout_minutes: 10
max_attempts: 3
command: pnpm test:ci --shard=${{ matrix.shard }}/${{ matrix.total-shards }}
env:
VITE_ANVIL_BLOCK_NUMBER: ${{ vars.VITE_ANVIL_BLOCK_NUMBER }}
VITE_ANVIL_BLOCK_TIME: ${{ vars.VITE_ANVIL_BLOCK_TIME }}
VITE_ANVIL_FORK_URL: ${{ secrets.VITE_ANVIL_FORK_URL }}
VITE_BATCH_MULTICALL: ${{ matrix.batch-multicall }}
VITE_BATCH_MULTICALL: ${{ matrix.multicall }}
VITE_NETWORK_TRANSPORT_MODE: ${{ matrix.transport-mode }}

- name: Upload coverage reports to Codecov
Expand Down
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,60 @@
# viem

## 1.10.1

### Patch Changes

- [`bf2f7ee1`](https://github.com/wagmi-dev/viem/commit/bf2f7ee124af5eb43f0541200e88bd4302680912) Thanks [@jxom](https://github.com/jxom)! - Updated dependencies:

- `@adraffy/ens-normalize`
- `@noble/curves`
- `@noble/hashes`
- `@scure/bip32`
- `@scure/bip39`
- `abitype`
- `isomorphic-ws`
- `ws`

## 1.10.0

### Minor Changes

- [#1110](https://github.com/wagmi-dev/viem/pull/1110) [`74c7d276`](https://github.com/wagmi-dev/viem/commit/74c7d276305d4e3db4a4902c247e191ead369abd) Thanks [@jxom](https://github.com/jxom)! - Amended `Chain` type to allow arbitrary `contracts` (as well as contracts that could be dependant on chain).

* [#1136](https://github.com/wagmi-dev/viem/pull/1136) [`16699c8c`](https://github.com/wagmi-dev/viem/commit/16699c8c92faccecc4dbd3353879ce5a512bbb35) Thanks [@jxom](https://github.com/jxom)! - Handle CAIP-25 "User Rejected" errors.

- [#1120](https://github.com/wagmi-dev/viem/pull/1120) [`0e4d9320`](https://github.com/wagmi-dev/viem/commit/0e4d932079a449fb7268c24eb0f6391e7b05076c) Thanks [@polygomic](https://github.com/polygomic)! - Added Plinga chain

* [#1108](https://github.com/wagmi-dev/viem/pull/1108) [`2327aa07`](https://github.com/wagmi-dev/viem/commit/2327aa0741bac51058d7038840bdc2895ead5456) Thanks [@simonzg](https://github.com/simonzg)! - Added Meter chain and Meter Testnet chain

- [#1128](https://github.com/wagmi-dev/viem/pull/1128) [`e1728054`](https://github.com/wagmi-dev/viem/commit/e17280544dc113c855166dae0ee634890c8a4e96) Thanks [@karangoraniya](https://github.com/karangoraniya)! - Added opBNB Mainnet and Testnet chains.

* [#1117](https://github.com/wagmi-dev/viem/pull/1117) [`a637ba2b`](https://github.com/wagmi-dev/viem/commit/a637ba2b5fc1ffacc1f483ea4be0121528faf3f4) Thanks [@rkalis](https://github.com/rkalis)! - Added `domainSeparator` to calculate domain separator from an EIP712 domain.

### Patch Changes

- [#1137](https://github.com/wagmi-dev/viem/pull/1137) [`4159c997`](https://github.com/wagmi-dev/viem/commit/4159c9979788798cca6ebb48f38e2284559850ff) Thanks [@jxom](https://github.com/jxom)! - Fixed an issue where non-standard "user rejected" errors where being coalesced into an `UnknownNodeError`.

* [`8605c1f1`](https://github.com/wagmi-dev/viem/commit/8605c1f1d048a2d924bd8b83a42b8ce5b0e65900) Thanks [@jxom](https://github.com/jxom)! - Handle `-32603` RPC error codes when deriving a `ContractFunctionRevertedError`.

- [#1109](https://github.com/wagmi-dev/viem/pull/1109) [`0a242120`](https://github.com/wagmi-dev/viem/commit/0a2421204f3878e016502f7e2ec98d043ef88cf6) Thanks [@jxom](https://github.com/jxom)! - Removed hardcoded `defaultPriorityFee` on OP Stack chains in favor of fetching it from `eth_maxPriorityFeePerGas`.

* [#1112](https://github.com/wagmi-dev/viem/pull/1112) [`7da52244`](https://github.com/wagmi-dev/viem/commit/7da5224467ca5a6368f27734a01b56f53c2c0106) Thanks [@RexCloud](https://github.com/RexCloud)! - Added multicall3 for Scroll Sepolia

- [#1139](https://github.com/wagmi-dev/viem/pull/1139) [`86230caf`](https://github.com/wagmi-dev/viem/commit/86230caf872f76975f7f6aaff53a9c9e3b8bfdc7) Thanks [@jxom](https://github.com/jxom)! - Fixed `VerifyMessageParameters` to accept a `raw` property.

* [#1138](https://github.com/wagmi-dev/viem/pull/1138) [`101c94f2`](https://github.com/wagmi-dev/viem/commit/101c94f2841056410ed4c32b76672f7fbd1ebabc) Thanks [@jxom](https://github.com/jxom)! - Amended Base chain `nativeCurreny.name` to "Ether".

- [#1048](https://github.com/wagmi-dev/viem/pull/1048) [`f33086ef`](https://github.com/wagmi-dev/viem/commit/f33086ef88a1c9650b2b0efa6a034490519eead8) Thanks [@brianathere](https://github.com/brianathere)! - Converted `isomorphic-ws` to a synchronous import.

## 1.9.5

### Patch Changes

- [#1105](https://github.com/wagmi-dev/viem/pull/1105) [`9661b9d8`](https://github.com/wagmi-dev/viem/commit/9661b9d8f4d747391f9ffb14b789c727a6831488) Thanks [@dschlabach](https://github.com/dschlabach)! - Added ENS Registry and ENS Universal Resolver for Sepolia.

* [#1102](https://github.com/wagmi-dev/viem/pull/1102) [`0edea858`](https://github.com/wagmi-dev/viem/commit/0edea858fe28bd9d7cb7c5b9b8ebde72025cf71d) Thanks [@rkalis](https://github.com/rkalis)! - Fixed bug regarding incorrect bigint->bytes32 conversion in hexToSignature

## 1.9.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/_template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
},
"devDependencies": {
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/blocks/fetching-blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
},
"devDependencies": {
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/blocks/watching-blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
},
"devDependencies": {
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/clients/public-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
},
"devDependencies": {
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/clients/wallet-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"@types/react-dom": "^18.0.10",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/contracts/deploying-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"@types/react-dom": "^18.0.10",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/contracts/multicall/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
},
"devDependencies": {
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/contracts/reading-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
},
"devDependencies": {
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/contracts/writing-to-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"@types/react-dom": "^18.0.10",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/ens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
},
"devDependencies": {
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/filters-and-logs/block-event-logs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
},
"devDependencies": {
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/filters-and-logs/event-logs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
},
"devDependencies": {
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/signing/typed-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"@types/react-dom": "^18.0.10",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/transactions/fetching-transactions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
},
"devDependencies": {
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/transactions/sending-transactions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"@types/react-dom": "^18.0.10",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "^5.0.3",
"vite": "^4.1.4"
"vite": "^4.4.2"
}
}
3 changes: 3 additions & 0 deletions examples/walletconnect/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Public Client Example

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/walletconnect)
12 changes: 12 additions & 0 deletions examples/walletconnect/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<h1>Wallet Client Example</h1>
<div id="root"></div>
<script type="module" src="/index.tsx"></script>
</body>
</html>
91 changes: 91 additions & 0 deletions examples/walletconnect/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { EthereumProvider } from '@walletconnect/ethereum-provider'
import React, { useEffect, useState } from 'react'
import ReactDOM from 'react-dom/client'
import {
http,
Address,
Hash,
TransactionReceipt,
createPublicClient,
createWalletClient,
custom,
parseEther,
stringify,
} from 'viem'
import { mainnet } from 'viem/chains'
import 'viem/window'

const projectId = 'fdb8164b4aa07b46f14e131f5c7c5903'

const provider = await EthereumProvider.init({
chains: [1],
projectId,
showQrModal: true,
})

const publicClient = createPublicClient({
chain: mainnet,
transport: http(),
})
const walletClient = createWalletClient({
chain: mainnet,
transport: custom(provider),
})

function Example() {
const [account, setAccount] = useState<Address>()
const [hash, setHash] = useState<Hash>()
const [receipt, setReceipt] = useState<TransactionReceipt>()

const addressInput = React.createRef<HTMLInputElement>()
const valueInput = React.createRef<HTMLInputElement>()

const connect = async () => {
await provider.connect()
const [address] = await walletClient.getAddresses()
setAccount(address)
}

const sendTransaction = async () => {
if (!account) return
const hash = await walletClient.sendTransaction({
account,
to: addressInput.current!.value as Address,
value: parseEther(valueInput.current!.value as `${number}`),
})
console.log('test', hash)
setHash(hash)
}

useEffect(() => {
;(async () => {
if (hash) {
const receipt = await publicClient.waitForTransactionReceipt({ hash })
setReceipt(receipt)
}
})()
}, [hash])

if (account)
return (
<>
<div>Connected: {account}</div>
<input ref={addressInput} placeholder="address" />
<input ref={valueInput} placeholder="value (ether)" />
<button onClick={sendTransaction}>Send</button>
{receipt && (
<div>
Receipt:{' '}
<pre>
<code>{stringify(receipt, null, 2)}</code>
</pre>
</div>
)}
</>
)
return <button onClick={connect}>Connect Wallet</button>
}

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<Example />,
)
23 changes: 23 additions & 0 deletions examples/walletconnect/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "example-walletconnect",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite"
},
"dependencies": {
"@walletconnect/ethereum-provider": "^2.10.0",
"@walletconnect/modal": "^2.6.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"viem": "latest"
},
"devDependencies": {
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "^5.0.3",
"vite": "^4.4.2"
}
}
Loading

0 comments on commit 2a59ccf

Please sign in to comment.