Skip to content

Commit

Permalink
feat: upgrade viem to v2 (#2284)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Ingersoll <kingersoll@gmail.com>
  • Loading branch information
tash-2s and holic authored Feb 23, 2024
1 parent 3d65968 commit d7b1c58
Show file tree
Hide file tree
Showing 54 changed files with 257 additions and 243 deletions.
29 changes: 29 additions & 0 deletions .changeset/twelve-gorillas-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
"@latticexyz/block-logs-stream": minor
"@latticexyz/cli": minor
"@latticexyz/common": minor
"@latticexyz/config": minor
"@latticexyz/dev-tools": minor
"@latticexyz/faucet": minor
"@latticexyz/protocol-parser": minor
"@latticexyz/schema-type": minor
"@latticexyz/store-indexer": minor
"@latticexyz/store-sync": minor
"@latticexyz/store": minor
"@latticexyz/world": minor
"create-mud": minor
---

Upgraded all packages and templates to viem v2.7.12 and abitype v1.0.0.

Some viem APIs have changed and we've updated `getContract` to reflect those changes and keep it aligned with viem. It's one small code change:

```diff
const worldContract = getContract({
address: worldAddress,
abi: IWorldAbi,
- publicClient,
- walletClient,
+ client: { public: publicClient, wallet: walletClient },
});
```
2 changes: 1 addition & 1 deletion e2e/packages/client-vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"react": "^18.2.0",
"rxjs": "7.5.5",
"threads": "^1.7.0",
"viem": "1.14.0"
"viem": "2.7.12"
},
"devDependencies": {
"rimraf": "^3.0.2",
Expand Down
3 changes: 1 addition & 2 deletions e2e/packages/client-vanilla/src/mud/setupNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ export async function setupNetwork() {
const worldContract = getContract({
address: networkConfig.worldAddress as Hex,
abi: IWorldAbi,
publicClient,
walletClient: burnerWalletClient,
client: { public: publicClient, wallet: burnerWalletClient },
});

const { components, latestBlock$, storedBlockLogs$, waitForTransaction } = await syncToRecs({
Expand Down
4 changes: 2 additions & 2 deletions e2e/packages/sync-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
"@latticexyz/store-sync": "link:../../../packages/store-sync",
"@latticexyz/utils": "link:../../../packages/utils",
"@viem/anvil": "^0.0.6",
"abitype": "0.9.8",
"abitype": "1.0.0",
"chalk": "^5.2.0",
"dotenv": "^16.0.3",
"drizzle-orm": "^0.28.5",
"execa": "^7.1.1",
"happy-dom": "^12.10.3",
"postgres": "3.3.5",
"typescript": "5.1.6",
"viem": "1.14.0",
"viem": "2.7.12",
"vite": "^4.2.1",
"vitest": "0.34.6",
"zod": "^3.22.2"
Expand Down
3 changes: 1 addition & 2 deletions e2e/packages/test-data/generateLogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ export async function generateLogs(
const worldContract = getContract({
address: worldAddress,
abi: IWorldAbi,
publicClient,
walletClient,
client: { public: publicClient, wallet: walletClient },
});

const lastTx = await transactionHook(worldContract);
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/test-data/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 21 additions & 30 deletions e2e/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/minimal/packages/client-phaser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"styled-components": "^5.3.10",
"threads": "^1.7.0",
"use-resize-observer": "^9.1.0",
"viem": "1.14.0",
"viem": "2.7.12",
"vite": "^4.2.1",
"zustand": "^4.3.8"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ export async function setupNetwork() {
const worldContract = getContract({
address: networkConfig.worldAddress as Hex,
abi: IWorldAbi,
publicClient,
walletClient: burnerWalletClient,
client: { public: publicClient, wallet: burnerWalletClient },
onWrite: (write) => write$.next(write),
});

Expand Down
2 changes: 1 addition & 1 deletion examples/minimal/packages/client-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"react-dom": "^18.2.0",
"rxjs": "7.5.5",
"threads": "^1.7.0",
"viem": "1.14.0"
"viem": "2.7.12"
},
"devDependencies": {
"@types/react": "18.2.22",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export async function setupNetwork() {
const worldContract = getContract({
address: networkConfig.worldAddress as Hex,
abi: IWorldAbi,
publicClient,
walletClient: burnerWalletClient,
client: { public: publicClient, wallet: burnerWalletClient },
onWrite: (write) => write$.next(write),
});

Expand Down
2 changes: 1 addition & 1 deletion examples/minimal/packages/client-vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"react": "^18.2.0",
"rxjs": "7.5.5",
"threads": "^1.7.0",
"viem": "1.14.0"
"viem": "2.7.12"
},
"devDependencies": {
"vite": "^4.2.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ export async function setupNetwork() {
const worldContract = getContract({
address: networkConfig.worldAddress as Hex,
abi: IWorldAbi,
publicClient,
walletClient: burnerWalletClient,
client: { public: publicClient, wallet: burnerWalletClient },
onWrite: (write) => write$.next(write),
});

Expand Down
Loading

0 comments on commit d7b1c58

Please sign in to comment.