Skip to content

Commit ef2895f

Browse files
authored
Implement support for EOA execution options in server wallets (#7429)
1 parent cf44dae commit ef2895f

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.changeset/ninety-coats-pick.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"thirdweb": patch
3+
"@thirdweb-dev/engine": patch
4+
---
5+
6+
Support EOA Execution Options for Server Wallets

packages/thirdweb/src/engine/server-wallet.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { verifyTypedData } from "src/auth/verify-typed-data.js";
12
import { beforeAll, describe, expect, it } from "vitest";
23
import { TEST_CLIENT } from "../../test/src/test-clients.js";
34
import { TEST_ACCOUNT_B } from "../../test/src/test-wallets.js";
@@ -78,6 +79,36 @@ describe.runIf(
7879
expect(signature).toBeDefined();
7980
});
8081

82+
it("should sign typed data for EOA execution options", async () => {
83+
const eoaServerWallet = Engine.serverWallet({
84+
address: process.env.ENGINE_CLOUD_WALLET_ADDRESS as string,
85+
chain: arbitrumSepolia,
86+
client: TEST_CLIENT,
87+
executionOptions: {
88+
address: process.env.ENGINE_CLOUD_WALLET_ADDRESS_EOA as string,
89+
type: "eoa",
90+
},
91+
vaultAccessToken: process.env.VAULT_TOKEN as string,
92+
});
93+
94+
const signature = await eoaServerWallet.signTypedData({
95+
...typedData.basic,
96+
});
97+
98+
expect(signature).toBeDefined();
99+
100+
const is_valid = await verifyTypedData({
101+
address: process.env.ENGINE_CLOUD_WALLET_ADDRESS_EOA as string,
102+
chain: arbitrumSepolia,
103+
client: TEST_CLIENT,
104+
...typedData.basic,
105+
106+
signature,
107+
});
108+
109+
expect(is_valid).toBe(true);
110+
});
111+
81112
it("should send a tx with regular API", async () => {
82113
const tx = await sendTransaction({
83114
account: serverWallet,

0 commit comments

Comments
 (0)