Skip to content

Commit 991a5a7

Browse files
committed
Implement support for EOA execution options in server wallets, including a new test case for signing typed data.
1 parent cf44dae commit 991a5a7

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
@@ -18,6 +18,7 @@ import {
1818
import { smartWallet } from "../wallets/smart/smart-wallet.js";
1919
import { generateAccount } from "../wallets/utils/generateAccount.js";
2020
import * as Engine from "./index.js";
21+
import { verifyTypedData } from "src/auth/verify-typed-data.js";
2122

2223
describe.runIf(
2324
process.env.TW_SECRET_KEY &&
@@ -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+
vaultAccessToken: process.env.VAULT_TOKEN as string,
88+
executionOptions: {
89+
type: "eoa",
90+
address: process.env.ENGINE_CLOUD_WALLET_ADDRESS_EOA as string,
91+
},
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)