From c72489bd52f4692db2d287d2389b6786d937d780 Mon Sep 17 00:00:00 2001 From: Andrew Min Date: Thu, 12 Oct 2023 17:42:31 -0400 Subject: [PATCH] support getAddresses --- packages/viem/src/__tests__/index-test.ts | 5 +++++ packages/viem/src/index.ts | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/packages/viem/src/__tests__/index-test.ts b/packages/viem/src/__tests__/index-test.ts index 48637a12d..84f59c5f6 100644 --- a/packages/viem/src/__tests__/index-test.ts +++ b/packages/viem/src/__tests__/index-test.ts @@ -111,6 +111,11 @@ describe("TurnkeyAccount", () => { }); }); + testCase("returns correct address", async () => { + expect(walletClient.account.address).toEqual(expectedEthAddress); + expect(walletClient.getAddresses()).toEqual([expectedEthAddress]); + }); + testCase("it signs transactions", async () => { const request = await walletClient.prepareTransactionRequest({ account: turnkeyAccount, diff --git a/packages/viem/src/index.ts b/packages/viem/src/index.ts index d1c060c1d..eb3d999d7 100644 --- a/packages/viem/src/index.ts +++ b/packages/viem/src/index.ts @@ -46,6 +46,9 @@ export async function createAccount(input: { return toAccount({ address: ethereumAddress as Hex, + getAddresses: function (): Hex[] { + return [ethereumAddress as Hex]; + }, signMessage: function ({ message, }: { @@ -147,6 +150,9 @@ export async function createApiKeyAccount( return toAccount({ address: ethereumAddress as Hex, + getAddresses: function (): Hex[] { + return [ethereumAddress as Hex]; + }, signMessage: function ({ message, }: {