-
Notifications
You must be signed in to change notification settings - Fork 619
[Multi] Update dependencies, improve wagmi adapter #8167
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@thirdweb-dev/wagmi-adapter": patch | ||
| --- | ||
|
|
||
| Update dependencies, better storage management |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "thirdweb": patch | ||
| --- | ||
|
|
||
| Update dependencies | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| VITE_THIRDWEB_CLIENT_ID= |
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| legacy-peer-deps = true |
| 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 | ||
| ``` |
| 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"] | ||
| } | ||
| ] | ||
| } |
| 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> |
| 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", | ||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pin @wagmi/cli to a specific version. Using Replace with a specific version: - "@wagmi/cli": "latest",
+ "@wagmi/cli": "^2.1.0",📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| "buffer": "^6.0.3", | ||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move buffer to dependencies. The 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
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| "typescript": "5.8.3", | ||||||||||||||||||||||||||||||||||||||||||
| "vite": "7.1.7" | ||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify 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: 💡 Result: As of October 1, 2025, the latest stable Vite release is 7.1.4. [1][2] Sources: Replace the Vite version with the latest stable release (7.1.4) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| 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; |
| 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; | ||
| } | ||
| } |
| 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>, | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /// <reference types="vite/client" /> |
| 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; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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:
Length of output: 3063
🏁 Script executed:
Length of output: 419
Use minor bumps for new public exports
🤖 Prompt for AI Agents