|
| 1 | +import { verifyTypedData } from "src/auth/verify-typed-data.js"; |
1 | 2 | import { beforeAll, describe, expect, it } from "vitest";
|
2 | 3 | import { TEST_CLIENT } from "../../test/src/test-clients.js";
|
3 | 4 | import { TEST_ACCOUNT_B } from "../../test/src/test-wallets.js";
|
@@ -78,6 +79,36 @@ describe.runIf(
|
78 | 79 | expect(signature).toBeDefined();
|
79 | 80 | });
|
80 | 81 |
|
| 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 | + |
81 | 112 | it("should send a tx with regular API", async () => {
|
82 | 113 | const tx = await sendTransaction({
|
83 | 114 | account: serverWallet,
|
|
0 commit comments