UNPKG

@abstract-foundation/agw-client

Version:
67 lines 2.55 kB
import { type Account, type Address, type Client, type Transport } from "viem"; import type { ChainEIP712 } from "viem/zksync"; export interface GetLinkedAccountsReturnType { linkedAccounts: Address[]; } export interface GetLinkedAccountsParameters { agwAddress: Address; } export interface IsLinkedAccountParameters { address: Address; } /** * Get all accounts linked to an Abstract Global Wallet. * * @example * ```tsx * import { useAbstractClient } from "@abstract-foundation/agw-react"; * * export default function LinkedAccounts() { * const { data: agwClient } = useAbstractClient(); * * async function fetchLinkedAccounts() { * if (!agwClient) return; * * const { linkedAccounts } = await agwClient.getLinkedAccounts({ * agwAddress: agwClient.account.address * }); * * console.log(linkedAccounts); // Array of linked account addresses * } * } * ``` * * @param parameters - Parameters for getting linked accounts * @param parameters.agwAddress - Address of the Abstract Global Wallet to check for linked accounts (required) * @returns An object containing an array of linked account addresses */ export declare function getLinkedAccounts<transport extends Transport = Transport, chain extends ChainEIP712 | undefined = ChainEIP712 | undefined, account extends Account | undefined = Account | undefined>(client: Client<transport, chain, account>, parameters: GetLinkedAccountsParameters): Promise<GetLinkedAccountsReturnType>; /** * Check if an address is linked to the connected Abstract Global Wallet. * * @example * ```tsx * import { useAbstractClient } from "@abstract-foundation/agw-react"; * * export default function CheckLinkedAccount() { * const { data: agwClient } = useAbstractClient(); * const addressToCheck = "0x..."; * * async function checkIfLinked() { * if (!agwClient) return; * * const isLinked = await agwClient.isLinkedAccount({ * address: addressToCheck * }); * * console.log(isLinked); // true or false * } * } * ``` * * @param parameters - Parameters for checking linked account * @param parameters.address - Address to check if linked to the connected wallet (required) * @returns Boolean indicating if the address is linked to the connected wallet */ export declare function isLinkedAccount(client: Client<Transport, ChainEIP712, Account>, parameters: IsLinkedAccountParameters): Promise<boolean>; //# sourceMappingURL=getLinkedAccounts.d.ts.map