diff --git a/packages/client/src/types.ts b/packages/client/src/types.ts index e2f010c34..13b3e0f92 100644 --- a/packages/client/src/types.ts +++ b/packages/client/src/types.ts @@ -51,6 +51,7 @@ export type DelegableOperationHandler = ( result: DelegableOperationResult, ) => ResultAsync>; -export type OperationHandler = - | RestrictedOperationHandler - | DelegableOperationHandler; +export type OperationHandler< + T extends string = string, + E extends string = string, +> = T extends string ? DelegableOperationHandler : RestrictedOperationHandler; diff --git a/packages/client/src/viem/signer.ts b/packages/client/src/viem/signer.ts index bd70861ff..98be5afcd 100644 --- a/packages/client/src/viem/signer.ts +++ b/packages/client/src/viem/signer.ts @@ -15,13 +15,7 @@ import type { Account, Hash, Transport, WalletClient } from 'viem'; import { sendTransaction as sendEip1559Transaction } from 'viem/actions'; import { sendEip712Transaction } from 'viem/zksync'; import { SigningError, ValidationError } from '../errors'; -import { - type DelegableOperationHandler, - type OperationHandler, - type OperationResult, - type RestrictedOperationHandler, - isTransactionRequest, -} from '../types'; +import { type OperationHandler, type OperationResult, isTransactionRequest } from '../types'; async function sendTransaction( walletClient: WalletClient, @@ -69,15 +63,9 @@ function signWith( ); } -export function handleWith( - walletClient: WalletClient, -): DelegableOperationHandler; -export function handleWith( - walletClient: WalletClient, -): RestrictedOperationHandler; -export function handleWith( +export function handleWith( walletClient: WalletClient, -): OperationHandler { +): OperationHandler { return ( result: OperationResult, ): ResultAsync> => {