Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

Commit cebd931

Browse files
Update page.mdx
Signed-off-by: Joaquim Verges <[email protected]>
1 parent 04460b6 commit cebd931

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

src/app/typescript/v5/adapters/page.mdx

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ import { ethers6Adapter } from "thirdweb/adapters/ethers6";
1818
import { sendTransaction } from "thirdweb";
1919

2020
// convert a ethers signer
21-
const ethersSigner: ethers.Signer = ...;
22-
const account = await ethers6Adapter.signer.fromEthers(ethersSigner);
21+
const signer: ethers.Signer = ...;
22+
const account = await ethers6Adapter.signer.fromEthers({
23+
signer,
24+
});
2325

2426
// use it with the thirdweb SDK
2527
await sendTransaction({
@@ -33,16 +35,22 @@ Similarly, you can use any wallets created with the thirdweb SDK with ethers.js
3335
```ts
3436
import { ethers6Adapter } from "thirdweb/adapters/ethers6";
3537
import { createThirdwebClient, embeddedWallet } from "thirdweb/wallets";
38+
import { sepolia } from "thirdweb/chains";
3639

3740
const client = createThirdwebClient({ clientId });
3841
const wallet = embeddedWallet();
42+
const chain = sepolia;
3943
const account = await wallet.connect({
4044
client,
4145
strategy: "google",
4246
});
4347

4448
// convert a thirdweb account to ethers signer
45-
const ethersSigner = await ethers6Adapter.signer.toEthers(client, account);
49+
const ethersSigner = await ethers6Adapter.signer.toEthers({
50+
client,
51+
chain,
52+
account
53+
});
4654
```
4755

4856
You can also convert ethers.js providers and contracts from and to the thirdweb SDK.
@@ -57,11 +65,17 @@ You can use an existing ethers.js v5 Signer with the thirdweb SDK by converting
5765
import { ethers5Adapter } from "thirdweb/adapters/ethers5";
5866

5967
// convert an ethers signer to a thirdweb account
60-
const ethersSigner: ethers.Signer = ...;
61-
const account = await ethers5Adapter.signer.fromEthers(ethersSigner);
68+
const signer: ethers.Signer = ...;
69+
const account = await ethers5Adapter.signer.fromEthers({
70+
signer,
71+
});
6272

6373
// convert a thirdweb account to ethers signer
64-
const ethersSigner = await ethers6Adapter.signer.toEthers(client, account);
74+
const ethersSigner = await ethers5Adapter.signer.toEthers({
75+
client,
76+
chain,
77+
account
78+
});
6579
```
6680

6781
You can also convert ethers.js providers and contracts from and to the thirdweb SDK.
@@ -84,9 +98,9 @@ const account = await viemAdapter.walletClient.fromViem({
8498

8599
// convert a thirdweb account to viem wallet client
86100
const viemClientWallet = viemAdapter.walletClient.toViem({
87-
client,
88-
chain,
89-
account,
101+
client,
102+
chain,
103+
account,
90104
});
91105
```
92106

0 commit comments

Comments
 (0)