@abstract-foundation/agw-client
Version:
Abstract Global Wallet Client SDK
49 lines • 2.06 kB
TypeScript
import { type Account, type Address, type Chain, type Client, type Transport } from 'viem';
import { type ChainEIP712 } from 'viem/zksync';
export interface GetLinkedAgwReturnType {
agw: Address | undefined;
}
export interface GetLinkedAgwParameters {
address?: Address | undefined;
}
export interface IsLinkedAccountParameters {
address: Address;
}
/**
* Get the linked Abstract Global Wallet for an Ethereum Mainnet address.
*
* @example
* ```tsx
* import { linkableWalletActions } from "@abstract-foundation/agw-client";
* import { createWalletClient, custom } from "viem";
* import { sepolia } from "viem/chains";
*
* export default function CheckLinkedWallet() {
* async function checkLinkedWallet() {
* // Initialize a Viem Wallet client and extend it with linkableWalletActions
* const client = createWalletClient({
* chain: sepolia,
* transport: custom(window.ethereum!),
* }).extend(linkableWalletActions());
*
* // Check if an address has a linked AGW
* const { agw } = await client.getLinkedAgw();
*
* if (agw) {
* console.log("Linked AGW:", agw);
* } else {
* console.log("No linked AGW found");
* }
* }
*
* return <button onClick={checkLinkedWallet}>Check Linked AGW</button>;
* }
* ```
*
* @param parameters - Parameters for getting the linked AGW
* @param parameters.address - The Ethereum Mainnet address to check for a linked AGW. If not provided, defaults to the connected account's address
* @returns Object containing the address of the linked AGW, or undefined if no AGW is linked
*/
export declare function getLinkedAgw<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined>(client: Client<Transport, chain, account>, parameters: GetLinkedAgwParameters): Promise<GetLinkedAgwReturnType>;
export declare function isLinkedAccount(client: Client<Transport, ChainEIP712, Account>, parameters: IsLinkedAccountParameters): Promise<boolean>;
//# sourceMappingURL=getLinkedAgw.d.ts.map