From 549b830a64b4c44e0bb9d6cda07c0c5c53ac0f22 Mon Sep 17 00:00:00 2001 From: Szabolcs Szentes Date: Fri, 5 Apr 2024 15:43:02 +0200 Subject: [PATCH] fixing the getPublicClient --- src/utils/getPublicClient.ts | 10 +++------- src/utils/signTypedDataV4.ts | 4 +--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/utils/getPublicClient.ts b/src/utils/getPublicClient.ts index b0768ef..4f16617 100644 --- a/src/utils/getPublicClient.ts +++ b/src/utils/getPublicClient.ts @@ -3,13 +3,9 @@ import { PublicClient, publicActions } from "viem"; import { PublicOrWalletClient } from "../lib/types"; export const getPublicClient = (client: PublicOrWalletClient): PublicClient => { - let publicClient: PublicClient; - if (client.type === "walletClient") { - publicClient = client.extend(publicActions) as PublicClient; - } else { - // publicClient - publicClient = client as PublicClient; - } + const publicClient: PublicClient = client.extend( + publicActions + ) as PublicClient; return publicClient; }; diff --git a/src/utils/signTypedDataV4.ts b/src/utils/signTypedDataV4.ts index 55d23d8..550bb39 100644 --- a/src/utils/signTypedDataV4.ts +++ b/src/utils/signTypedDataV4.ts @@ -6,8 +6,6 @@ import { CallWithSyncFeeConcurrentERC2771PayloadToSign, } from "../lib/erc2771/types"; -import { isWalletClient } from "./isSigner"; - export const signTypedDataV4 = async ( client: PublicOrWalletClient, payload: @@ -16,7 +14,7 @@ export const signTypedDataV4 = async ( | SponsoredCallConcurrentERC2771PayloadToSign | CallWithSyncFeeConcurrentERC2771PayloadToSign ): Promise => { - if (!isWalletClient(client) || !client.account) { + if (!client.account) { throw new Error( "The provided client is not a wallet client, or account not found on the client. Please, provide an account during the client creation." );