Skip to content

Commit eebb7c8

Browse files
committed
feat: Add comprehensive EIP1193 adapters with conversion and provider support
docs: Add code examples for EIP1193 wallet adapters
1 parent a7dc471 commit eebb7c8

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

.changeset/eleven-chicken-smile.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,46 @@
22
"thirdweb": minor
33
---
44

5-
Adds EIP1193 adapters
5+
Adds EIP1193 adapters that allow conversion between Thirdweb wallets and EIP-1193 providers:
6+
7+
- `EIP1193.fromProvider()`: Creates a Thirdweb wallet from any EIP-1193 compatible provider (like MetaMask, WalletConnect)
8+
- `EIP1193.toProvider()`: Converts a Thirdweb wallet into an EIP-1193 provider that can be used with any web3 library
9+
10+
Key features:
11+
- Full EIP-1193 compliance for seamless integration
12+
- Handles account management (connect, disconnect, chain switching)
13+
- Supports all standard Ethereum JSON-RPC methods
14+
- Comprehensive event system for state changes
15+
- Type-safe interfaces with full TypeScript support
16+
17+
Examples:
18+
19+
```ts
20+
// Convert MetaMask's provider to a Thirdweb wallet
21+
const wallet = EIP1193.fromProvider({
22+
provider: window.ethereum,
23+
walletId: "io.metamask"
24+
});
25+
26+
// Use like any other Thirdweb wallet
27+
const account = await wallet.connect({
28+
client: createThirdwebClient({ clientId: "..." })
29+
});
30+
31+
// Convert a Thirdweb wallet to an EIP-1193 provider
32+
const provider = EIP1193.toProvider({
33+
wallet,
34+
chain: ethereum,
35+
client: createThirdwebClient({ clientId: "..." })
36+
});
37+
38+
// Use with any EIP-1193 compatible library
39+
const accounts = await provider.request({
40+
method: "eth_requestAccounts"
41+
});
42+
43+
// Listen for events
44+
provider.on("accountsChanged", (accounts) => {
45+
console.log("Active accounts:", accounts);
46+
});
47+
```

0 commit comments

Comments
 (0)