Skip to content

Commit

Permalink
fix: make type really optional, add defaults for return type (#1338)
Browse files Browse the repository at this point in the history
  • Loading branch information
howydev authored Feb 10, 2025
1 parent aad98b8 commit 5afc25f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions account-kit/react/src/hooks/useSmartAccountClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";

import { type OptionalFields } from "@aa-sdk/core";
import type {
GetSmartAccountClientParams,
GetSmartAccountClientResult,
Expand All @@ -21,9 +21,12 @@ export type UseSmartAccountClientProps<
TAccount extends SupportedAccountTypes | undefined =
| SupportedAccountTypes
| undefined
> = GetSmartAccountClientParams<
TChain,
TAccount extends undefined ? "ModularAccountV2" : TAccount
> = OptionalFields<
GetSmartAccountClientParams<
TChain,
TAccount extends undefined ? "ModularAccountV2" : TAccount
>,
"type"
>;

export type UseSmartAccountClientResult<
Expand All @@ -33,9 +36,7 @@ export type UseSmartAccountClientResult<

export function useSmartAccountClient<
TChain extends Chain | undefined = Chain | undefined,
TAccount extends SupportedAccountTypes | undefined =
| SupportedAccountTypes
| undefined
TAccount extends SupportedAccountTypes | undefined = "ModularAccountV2"
>(
args: UseSmartAccountClientProps<TChain, TAccount>
): UseSmartAccountClientResult<
Expand Down Expand Up @@ -66,7 +67,7 @@ export function useSmartAccountClient<
*/
export function useSmartAccountClient({
accountParams,
type,
type = "ModularAccountV2",
...clientParams
}: UseSmartAccountClientProps): UseSmartAccountClientResult {
const {
Expand Down

0 comments on commit 5afc25f

Please sign in to comment.