Skip to content
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/grumpy-toes-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/wagmi-adapter": patch
---

Update dependencies, better storage management
5 changes: 5 additions & 0 deletions .changeset/quiet-gifts-lead.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Update dependencies
Comment on lines +2 to +5
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Confirm bump type (patch vs minor) and coverage of all affected packages

Per guidelines: patch for non‑API changes; minor for new/modified public API. PR notes mention new public exports (e.g., useAddConnectedWallet, ConnectionOptions, InAppWalletConnector) potentially re‑exported from the "thirdweb" package. If true, this changeset should be minor, and all packages with public API additions need their own changeset entries. As per coding guidelines.

Run to validate current exports and changeset entries:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Check for possibly new public exports in packages/thirdweb =="
rg -n --type=ts -C2 -g 'packages/**' -P '\bexport\s+(?:\{[^}]*\b(useAddConnectedWallet|ConnectionOptions|InAppWalletConnector)\b[^}]*\}|(const|function|type|interface)\s+(useAddConnectedWallet|ConnectionOptions|InAppWalletConnector))' || true

echo
echo "== List changeset entries referencing 'thirdweb' package and their bump type =="
rg -n -C2 -g '.changeset/*.md' -P '^"thirdweb"\s*:\s*(patch|minor|major)|^---$|^[^-].*$' || true

echo
echo "== Full list of changesets (package -> bump) =="
rg -n -g '.changeset/*.md' -P '^"[^"]+"\s*:\s*(patch|minor|major)' || true

echo
echo "If 'thirdweb' re-exports any of the above symbols, ensure its changeset uses 'minor'. Also verify any other packages with new exports have corresponding changesets."

Length of output: 3063


🏁 Script executed:

#!/bin/bash
set -euo pipefail

pkg=$(grep -m1 '"name"' packages/wagmi-adapter/package.json | sed 's/.*"name":[[:space:]]*"\([^"]*\)".*/\1/')
echo "wagmi-adapter package name: $pkg"
echo

echo "== Changeset entries for thirdweb and $pkg =="
rg --hidden -n -g '.changeset/*.md' -P "^\"(thirdweb|$pkg)\"\s*:\s*(patch|minor|major)" || true

echo
echo "== All changeset entries (including hidden) =="
rg --hidden -n -g '.changeset/*.md' -P '^"[^"]+"\s*:\s*(patch|minor|major)' || true

Length of output: 419


Use minor bumps for new public exports

  • .changeset/quiet-gifts-lead.md: change bump from patch to minor
  • .changeset/grumpy-toes-switch.md: change bump from patch to minor
🤖 Prompt for AI Agents
In .changeset/quiet-gifts-lead.md around lines 2 to 5 the changeset currently
uses a "patch" bump for "thirdweb" but the reviewer requests a minor bump for
new public exports; update the bump from "patch" to "minor" in this file and
make the equivalent change in .changeset/grumpy-toes-switch.md so both
changesets use "minor" instead of "patch".

1 change: 1 addition & 0 deletions apps/wagmi-demo/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_THIRDWEB_CLIENT_ID=
26 changes: 26 additions & 0 deletions apps/wagmi-demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.env
1 change: 1 addition & 0 deletions apps/wagmi-demo/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps = true
37 changes: 37 additions & 0 deletions apps/wagmi-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Thirdweb Wagmi Adapter

This is a demo of the [thirdweb Wagmi Adapter](https://github.com/thirdweb-dev/js/tree/main/packages/wagmi-adapter).

It demonstrates how to connect [in-app smart wallets](https://portal.thirdweb.com/connect/wallet/sign-in-methods/configure) to a Wagmi app.

Users connect with google, and obtain a ERC-4337 smart account that can be used to interact with the app without paying for gas.

```ts
// src/wagmi.ts
export const config = createConfig({
chains: [chain],
connectors: [
inAppWalletConnector({
client,
smartAccount: {
chain: thirdwebChain(chain),
sponsorGas: true,
},
}),
],
transports: {
[chain.id]: http(),
},
});
```

## Prerequisites

Copy the `.env.example` file to `.env` and set your Thirdweb client ID. You can get your client ID from the [thirdweb dashboard](https://thirdweb.com).

## How to run

```bash
pnpm install
pnpm dev
```
16 changes: 16 additions & 0 deletions apps/wagmi-demo/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
"extends": "//",
"overrides": [
{
"assist": {
"actions": {
"source": {
"useSortedKeys": "off"
}
}
},
"includes": ["package.json"]
}
]
}
12 changes: 12 additions & 0 deletions apps/wagmi-demo/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" />
<title>Create Wagmi</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
33 changes: 33 additions & 0 deletions apps/wagmi-demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "wagmi-inapp",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"fix": "biome check ./src --fix",
"format": "biome format ./src --write",
"lint": "biome check ./src"
},
"dependencies": {
"@tanstack/react-query": "5.81.5",
"@thirdweb-dev/wagmi-adapter": "workspace:*",
"react": "19.1.0",
"react-dom": "19.1.0",
"thirdweb": "workspace:*",
"viem": "2.37.9",
"wagmi": "2.17.5"
},
"devDependencies": {
"@biomejs/biome": "2.0.6",
"@types/react": "19.1.8",
"@types/react-dom": "19.1.6",
"@vitejs/plugin-react": "5.0.4",
"@wagmi/cli": "latest",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Pin @wagmi/cli to a specific version.

Using "latest" for @wagmi/cli creates non-deterministic builds. Lock files will resolve this at install time, but explicit pinning improves reproducibility and makes version updates explicit.

Replace with a specific version:

-    "@wagmi/cli": "latest",
+    "@wagmi/cli": "^2.1.0",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"@wagmi/cli": "latest",
"@wagmi/cli": "^2.1.0",
🤖 Prompt for AI Agents
In apps/wagmi-demo/package.json around line 26, the dependency for "@wagmi/cli"
is pinned to "latest" which makes builds non-deterministic; replace the "latest"
specifier with a specific published version (an exact version string, not a
range) appropriate for the project, update the lockfile by running your package
manager (npm/yarn/pnpm) to record the resolved version, and commit both
package.json and the updated lockfile so future installs are reproducible.

"buffer": "^6.0.3",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Move buffer to dependencies.

The buffer package is imported and used at runtime in main.tsx (globalThis.Buffer assignment), but it's listed in devDependencies. This will cause runtime failures in production builds.

Apply this diff:

   "dependencies": {
     "@tanstack/react-query": "5.90.2",
     "@thirdweb-dev/wagmi-adapter": "workspace:*",
+    "buffer": "^6.0.3",
     "react": "19.1.0",
     "react-dom": "19.1.0",
     "thirdweb": "workspace:*",
     "viem": "2.37.9",
     "wagmi": "2.17.5"
   },
   "devDependencies": {
     "@biomejs/biome": "2.0.6",
     "@types/react": "19.1.0",
     "@types/react-dom": "19.1.0",
     "@vitejs/plugin-react": "5.0.4",
     "@wagmi/cli": "latest",
-    "buffer": "^6.0.3",
     "typescript": "5.8.3",
     "vite": "7.1.7"
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"buffer": "^6.0.3",
"dependencies": {
"@tanstack/react-query": "5.90.2",
"@thirdweb-dev/wagmi-adapter": "workspace:*",
"buffer": "^6.0.3",
"react": "19.1.0",
"react-dom": "19.1.0",
"thirdweb": "workspace:*",
"viem": "2.37.9",
"wagmi": "2.17.5"
},
"devDependencies": {
"@biomejs/biome": "2.0.6",
"@types/react": "19.1.0",
"@types/react-dom": "19.1.0",
"@vitejs/plugin-react": "5.0.4",
"@wagmi/cli": "latest",
"typescript": "5.8.3",
"vite": "7.1.7"
}
🤖 Prompt for AI Agents
In apps/wagmi-demo/package.json around line 27, the buffer package is currently
listed under devDependencies but is required at runtime (used in main.tsx to set
globalThis.Buffer); move "buffer": "^6.0.3" from devDependencies into
dependencies so it is installed in production builds — update package.json
accordingly (or run your package manager: npm install --save buffer or yarn add
buffer) and then rebuild to ensure the runtime import succeeds.

"typescript": "5.8.3",
"vite": "7.1.7"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify vite version 7.1.7 availability.

The specified Vite version (7.1.7) appears to be ahead of commonly available releases. Confirm this version exists and is stable.


🌐 Web query:

What is the latest stable version of Vite as of October 2025?

💡 Result:

As of October 1, 2025, the latest stable Vite release is 7.1.4. [1][2]

Sources:
[1] npm package page for vite (shows v7.1.4).
[2] Vite blog announcing Vite 7.0 (June 24, 2025).


Replace the Vite version with the latest stable release (7.1.4)
The specified version (7.1.7) isn’t published; update apps/wagmi-demo/package.json to "vite": "7.1.4".

🤖 Prompt for AI Agents
In apps/wagmi-demo/package.json around line 29, the Vite dependency is set to an
unavailable version "7.1.7"; change it to the latest stable published release
"7.1.4" by updating the "vite" value to "7.1.4" and then run npm/yarn install to
refresh lockfile and verify the project builds.

}
}
112 changes: 112 additions & 0 deletions apps/wagmi-demo/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import type { ConnectionOptions } from "@thirdweb-dev/wagmi-adapter";
import { ConnectButton } from "thirdweb/react";
import {
useAccount,
useConnect,
useDisconnect,
useSendTransaction,
} from "wagmi";
import { chain, client } from "./wagmi.js";

function App() {
const account = useAccount();
const { connectors, connect, status, error } = useConnect();
const { disconnect } = useDisconnect();
const {
sendTransaction,
isPending,
isSuccess,
isError,
error: sendTxError,
data: sendTxData,
} = useSendTransaction();
return (
<>
<div>
<h2>Account</h2>

<div>
status: {account.status}
<br />
addresses: {JSON.stringify(account.addresses)}
<br />
chainId: {account.chainId}
</div>

{account.status === "connected" && (
<button type="button" onClick={() => disconnect()}>
Disconnect
</button>
)}
</div>

<div>
<h2>Connect</h2>
<ConnectButton
client={client}
onConnect={(wallet) => {
// auto connect to wagmi on tw connect
const twConnector = connectors.find(
(c) => c.id === "in-app-wallet",
);
if (twConnector) {
const options = {
wallet,
} satisfies ConnectionOptions;
connect({
connector: twConnector,
chainId: chain.id,
...options,
});
}
}}
/>
{connectors.map((connector) => (
<button
key={connector.uid}
onClick={() => {
if (connector.id === "in-app-wallet") {
const connectOptions = {
strategy: "google",
} satisfies ConnectionOptions;
connect({
connector,
chainId: chain.id,
...connectOptions,
});
} else {
connect({ connector, chainId: chain.id });
}
}}
type="button"
>
{connector.name}
</button>
))}
<div>{status}</div>
<div>{error?.message}</div>
</div>
{account && (
<div>
<h2>Transact</h2>
<button
onClick={() => sendTransaction({ to: account.address, value: 0n })}
type="button"
>
Send Tx
</button>
<div>{isPending ? "Sending..." : ""}</div>
<div>
{isSuccess
? `Success: ${sendTxData}`
: isError
? sendTxError?.message
: ""}
</div>
</div>
)}
</>
);
}

export default App;
21 changes: 21 additions & 0 deletions apps/wagmi-demo/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
:root {
background-color: #181818;
color: rgba(255, 255, 255, 0.87);
color-scheme: light dark;
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
font-synthesis: none;
font-weight: 400;
line-height: 1.5;
text-rendering: optimizeLegibility;

-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: light) {
:root {
background-color: #f8f8f8;
color: #181818;
}
}
28 changes: 28 additions & 0 deletions apps/wagmi-demo/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { Buffer } from "buffer";
import React from "react";
import ReactDOM from "react-dom/client";
import { WagmiProvider } from "wagmi";

import App from "./App.js";
import { config } from "./wagmi.js";

import "./index.css";
import { ThirdwebProvider } from "thirdweb/react";

globalThis.Buffer = Buffer;

const queryClient = new QueryClient();

// biome-ignore lint/style/noNonNullAssertion: always exists
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<ThirdwebProvider>
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<App />
</QueryClientProvider>
</WagmiProvider>
</ThirdwebProvider>
</React.StrictMode>,
);
1 change: 1 addition & 0 deletions apps/wagmi-demo/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
41 changes: 41 additions & 0 deletions apps/wagmi-demo/src/wagmi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { inAppWalletConnector } from "@thirdweb-dev/wagmi-adapter";
import { createThirdwebClient, defineChain as thirdwebChain } from "thirdweb";
import { createConfig, http } from "wagmi";
import { baseSepolia } from "wagmi/chains";

const clientId = import.meta.env.VITE_THIRDWEB_CLIENT_ID;

if (!clientId) {
throw new Error(
"VITE_THIRDWEB_CLIENT_ID is not set. Get your client ID from https://thirdweb.com",
);
}

export const client = createThirdwebClient({
clientId,
});

export const chain = baseSepolia;
export const thirdwebChainForWallet = thirdwebChain(baseSepolia.id);

export const config = createConfig({
chains: [chain],
connectors: [
inAppWalletConnector({
client,
smartAccount: {
chain: thirdwebChain(chain.id),
sponsorGas: true,
},
}),
],
transports: {
[chain.id]: http(),
},
});

declare module "wagmi" {
interface Register {
config: typeof config;
}
}
Loading
Loading