UNPKG

@abstract-foundation/agw-client

Version:
48 lines 6.35 kB
import { type Account, type Address, type Chain, type Client, type GetChainIdReturnType, type Hash, type PrepareTransactionRequestReturnType, type PublicClient, type SendTransactionRequest, type SendTransactionReturnType, type SignMessageParameters, type SignMessageReturnType, type SignTypedDataParameters, type SignTypedDataReturnType, type Transport, type WalletActions, type WalletClient } from 'viem'; import { type SignTransactionReturnType } from 'viem/accounts'; import { type ChainEIP712, type Eip712WalletActions, type SendEip712TransactionParameters, type SignEip712TransactionParameters, type SignEip712TransactionReturnType } from 'viem/zksync'; import { type CreateSessionParameters, type CreateSessionReturnType } from './actions/createSession.js'; import { type GetLinkedAccountsParameters, type GetLinkedAccountsReturnType } from './actions/getLinkedAccounts.js'; import { type GetLinkedAgwParameters, type GetLinkedAgwReturnType, type IsLinkedAccountParameters } from './actions/getLinkedAgw.js'; import { type LinkToAgwParameters, type LinkToAgwReturnType } from './actions/linkToAgw.js'; import { type PrepareTransactionRequestParameters, type PrepareTransactionRequestRequest } from './actions/prepareTransaction.js'; import { type RevokeSessionsParameters, type RevokeSessionsReturnType } from './actions/revokeSessions.js'; import { type SessionClient } from './sessionClient.js'; import type { SessionConfig, SessionStatus } from './sessions.js'; import type { CustomPaymasterHandler } from './types/customPaymaster.js'; import type { SendTransactionBatchParameters } from './types/sendTransactionBatch.js'; import type { SignTransactionBatchParameters } from './types/signTransactionBatch.js'; export type AbstractWalletActions<chain extends ChainEIP712 | undefined = ChainEIP712 | undefined, account extends Account | undefined = Account | undefined> = Eip712WalletActions<chain, account> & { getChainId: () => Promise<GetChainIdReturnType>; getLinkedAccounts: (args: GetLinkedAccountsParameters) => Promise<GetLinkedAccountsReturnType>; isLinkedAccount: (args: IsLinkedAccountParameters) => Promise<boolean>; createSession: (args: CreateSessionParameters) => Promise<CreateSessionReturnType>; revokeSessions: (args: RevokeSessionsParameters) => Promise<RevokeSessionsReturnType>; signMessage: (args: Omit<SignMessageParameters, 'account'>) => Promise<SignMessageReturnType>; signTypedData: (args: Omit<SignTypedDataParameters, 'account' | 'privateKey'>) => Promise<SignTypedDataReturnType>; sendTransactionBatch: <const request extends SendTransactionRequest<ChainEIP712>>(args: SendTransactionBatchParameters<request>) => Promise<SendTransactionReturnType>; signTransactionBatch: (args: SignTransactionBatchParameters<chain, account>) => Promise<SignEip712TransactionReturnType>; prepareAbstractTransactionRequest: <chain extends ChainEIP712 | undefined = ChainEIP712 | undefined, account extends Account | undefined = Account | undefined, accountOverride extends Account | Address | undefined = undefined, chainOverride extends ChainEIP712 | undefined = ChainEIP712 | undefined, const request extends PrepareTransactionRequestRequest<chain, chainOverride> = PrepareTransactionRequestRequest<chain, chainOverride>>(args: PrepareTransactionRequestParameters<chain, account, chainOverride, accountOverride, request>) => Promise<PrepareTransactionRequestReturnType>; toSessionClient: (signer: Account, session: SessionConfig) => SessionClient; getSessionStatus: (sessionHashOrConfig: Hash | SessionConfig) => Promise<SessionStatus>; }; export type SessionClientActions<chain extends ChainEIP712 | undefined = ChainEIP712 | undefined, account extends Account | undefined = Account | undefined, chainOverride extends ChainEIP712 | undefined = undefined> = { sendTransaction: <const request extends SendTransactionRequest<chain, chainOverride>, chainOverride extends ChainEIP712 | undefined = undefined>(args: SendEip712TransactionParameters<chain, account, chainOverride, request>) => Promise<SendTransactionReturnType>; signTransaction: (args: SignEip712TransactionParameters<chain, account, chainOverride>) => Promise<SignTransactionReturnType>; writeContract: WalletActions<chain, account>['writeContract']; signTypedData: WalletActions<chain, account>['signTypedData']; getSessionStatus: () => Promise<SessionStatus>; }; export type LinkableWalletActions<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WalletActions<chain, account> & { linkToAgw: (args: LinkToAgwParameters) => Promise<LinkToAgwReturnType>; getLinkedAgw: () => Promise<GetLinkedAgwReturnType>; }; export interface LinkablePublicActions { getLinkedAgw: (args: GetLinkedAgwParameters) => Promise<GetLinkedAgwReturnType>; getLinkedAccounts: (args: GetLinkedAccountsParameters) => Promise<GetLinkedAccountsReturnType>; } export declare function sessionWalletActions(signerClient: WalletClient<Transport, ChainEIP712, Account>, publicClient: PublicClient<Transport, ChainEIP712>, session: SessionConfig, paymasterHandler?: CustomPaymasterHandler): (client: Client<Transport, ChainEIP712, Account>) => SessionClientActions<Chain, Account>; export declare function globalWalletActions<chain extends ChainEIP712 | undefined = ChainEIP712 | undefined, account extends Account | undefined = Account | undefined>(signerClient: WalletClient<Transport, ChainEIP712, Account>, publicClient: PublicClient<Transport, ChainEIP712>, isPrivyCrossApp?: boolean, customPaymasterHandler?: CustomPaymasterHandler): (client: Client<Transport, ChainEIP712, Account>) => AbstractWalletActions<Chain, Account>; export declare function linkableWalletActions<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined>(): (client: WalletClient<transport, chain, account>) => LinkableWalletActions<chain, account>; export declare function linkablePublicActions<transport extends Transport = Transport, chain extends ChainEIP712 | undefined = ChainEIP712 | undefined, account extends Account | undefined = Account | undefined>(): (client: Client<transport, chain, account>) => LinkablePublicActions; //# sourceMappingURL=walletActions.d.ts.map