Skip to content

Commit 8fb8a75

Browse files
Joe-Thirdwebsaminacodesgraphite-app[bot]
authored
[Portal] Block native to thridweb guide (#6977)
Signed-off-by: samina <57885104+saminacodes@users.noreply.github.com> Co-authored-by: samina <57885104+saminacodes@users.noreply.github.com> Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
1 parent 106ca3c commit 8fb8a75

File tree

3 files changed

+231
-1
lines changed

3 files changed

+231
-1
lines changed

apps/portal/src/app/connect/sidebar.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,16 @@ export const sidebar: SideBar = {
207207
},
208208
{
209209
name: "Web3 Onboard",
210-
href: `${walletSlug}/web3-onboard`,
210+
links: [
211+
{
212+
name: "Overview",
213+
href: `${walletSlug}/web3-onboard/overview`,
214+
},
215+
{
216+
name: "Migration Guide",
217+
href: `${walletSlug}/web3-onboard/migration-guide`,
218+
},
219+
],
211220
},
212221
{
213222
name: "Migrate to thirdweb",
Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
import {Steps, Step} from "@doc";
2+
3+
# Migration Guide: Blocknative to thirdweb
4+
5+
## Introduction
6+
7+
Learn how to migrate from Blocknative's Web3Onboard to thirdweb while maintaining the same wallet support. Following thirdweb's acquisition of Web3Onboard in January 2025, this migration will enable you to leverage thirdweb's enhanced features while ensuring a seamless transition for your users.
8+
9+
## Benefits of Migration
10+
11+
- Over 500+ wallet connections
12+
- Enhanced wallet connection experience
13+
- Access to thirdweb's broader ecosystem of tools
14+
- Ongoing support and updates from thirdweb
15+
16+
## Prerequisites
17+
18+
- An existing project using Blocknative/Web3Onboard
19+
20+
## Migration Steps
21+
<Steps>
22+
<Step title="Update Dependencies">
23+
24+
First, remove the Blocknative packages and install the thirdweb packages:
25+
26+
```bash
27+
# Remove Blocknative packages
28+
npm uninstall bnc-onboard @web3-onboard/core @web3-onboard/injected-wallets
29+
30+
# Install thirdweb unified package
31+
npm install thirdweb
32+
33+
```
34+
</Step>
35+
36+
<Step title = "Update Configuration (React)">
37+
Replace your Blocknative configuration with thirdweb's:
38+
39+
### Before (with Blocknative):
40+
41+
```jsx
42+
import Onboard from '@web3-onboard/core';
43+
import injectedModule from '@web3-onboard/injected-wallets';
44+
45+
const injected = injectedModule();
46+
47+
const onboard = Onboard({
48+
wallets: [injected],
49+
chains: [
50+
{
51+
id: '0x1',
52+
token: 'ETH',
53+
label: 'Ethereum Mainnet',
54+
rpcUrl: 'https://mainnet.infura.io/v3/your-key'
55+
}
56+
]
57+
});
58+
59+
// Connect wallet
60+
const wallets = await onboard.connectWallet();
61+
62+
```
63+
64+
### After (with thirdweb):
65+
66+
1. Create your thirdweb project here.
67+
2. Wrap your application with the `<ThirdwebProvider/>`
68+
69+
```jsx
70+
import { ThirdwebProvider, ConnectButton } from "thirdweb/react";
71+
import { createThirdwebClient } from "thirdweb";
72+
73+
const client = createThirdwebClient({
74+
clientId: "YOUR_CLIENT_ID", // Get one from thirdweb.com/dashboard
75+
});
76+
77+
function App() {
78+
return (
79+
<ThirdwebProvider >
80+
{/* Your app content */}
81+
</ThirdwebProvider>
82+
);
83+
}
84+
85+
```
86+
</Step>
87+
88+
<Step title ="Custom Wallet Configuration">
89+
90+
If you need to support specific wallets:
91+
92+
```jsx
93+
import {
94+
ThirdwebProvider,
95+
ConnectButton
96+
} from "thirdweb/react";
97+
import { createWallet } from "thirdweb/wallets";
98+
import { createThirdwebClient } from "thirdweb";
99+
100+
const client = createThirdwebClient({
101+
clientId: "YOUR_CLIENT_ID", // Get one from thirdweb.com/dashboard
102+
});
103+
104+
const wallets = [
105+
createWallet("io.metamask"), // Add your wallet in wallet list
106+
// add other wallets...
107+
];
108+
109+
function App() {
110+
return (
111+
<ThirdwebProvider>
112+
<ConnectButton
113+
client={client}
114+
wallets={wallets}/>
115+
</ThirdwebProvider>
116+
);
117+
}
118+
119+
```
120+
</Step>
121+
122+
<Step title ="Update Wallet Connection Logic">
123+
124+
Replace the wallet connection logic:
125+
126+
### Before (with Blocknative):
127+
128+
```jsx
129+
const connectWallet = async () => {
130+
const wallets = await onboard.connectWallet();
131+
if (wallets[0]) {
132+
const provider = wallets[0].provider;
133+
// Use the provider
134+
}
135+
};
136+
137+
```
138+
139+
### After (with thirdweb):
140+
141+
```jsx
142+
import { useActiveWallet, useDisconnect, useConnect } from "thirdweb/react";
143+
144+
function WalletConnect() {
145+
const wallet = useActiveWallet();
146+
const { connect } = useConnect();
147+
const { disconnect } = useDisconnect();
148+
149+
if (wallet) {
150+
return (
151+
<div>
152+
<p>Connected: {wallet.address}</p>
153+
<button onClick={() => disconnect()}>Disconnect</button>
154+
</div>
155+
);
156+
}
157+
158+
return <button
159+
onClick={() =>
160+
connect(async () => {
161+
// instantiate wallet
162+
const wallet = createWallet("io.metamask");
163+
// connect wallet
164+
await wallet.connect({
165+
client,
166+
});
167+
// return the wallet
168+
return wallet;
169+
})
170+
}
171+
>
172+
Connect
173+
</button>;
174+
}
175+
176+
```
177+
</Step>
178+
179+
<Step title = "Multi-chain Support">
180+
181+
Configure multi-chain support with thirdweb:
182+
183+
```jsx
184+
import { ThirdwebProvider } from "thirdweb/react";
185+
import { createThirdwebClient } from "thirdweb";
186+
import { ethereum, polygon, optimism, arbitrum } from "thirdweb/chains";
187+
188+
const client = createThirdwebClient({
189+
clientId: "YOUR_CLIENT_ID",
190+
});
191+
192+
function App() {
193+
return (
194+
<ThirdwebProvider>
195+
<ConnectButton client={client} chains={[ethereum, polygon, optimism, arbitrum]}/>
196+
</ThirdwebProvider>
197+
);
198+
}
199+
200+
```
201+
</Step>
202+
203+
</Steps>
204+
205+
### Common Issues
206+
207+
- **Wallet not connecting**: Ensure you've properly configured the ThirdwebProvider
208+
- **Missing wallets**: Check that you've added all wallet types to [supported wallets](https://portal.thirdweb.com/typescript/v5/supported-wallets)
209+
- **Chain not available**: Verify that the chain is properly configured and [supported by thirdweb](https://thirdweb.com/chainlist)
210+
211+
### Support Resources
212+
213+
- [thirdweb Documentation](https://portal.thirdweb.com/connect)
214+
215+
## Next Steps
216+
217+
After successfully migrating, consider exploring additional thirdweb features:
218+
219+
- [Smart wallets and account abstraction](https://portal.thirdweb.com/connect/account-abstraction/overview)
220+
- [In-app wallets for easier onboarding](https://portal.thirdweb.com/connect/wallet/sign-in-methods/configure)
221+
- [Gas-less transactions](https://portal.thirdweb.com/react/v5/account-abstraction/get-started)

0 commit comments

Comments
 (0)