UNPKG

@abstract-foundation/agw-react

Version:
34 lines 3.62 kB
import { type SessionConfig } from '@abstract-foundation/agw-client/sessions'; import type { MutateOptions } from '@tanstack/query-core'; import type { ChainIdParameter, Compute, ConnectorParameter, SelectChains, UnionCompute } from '@wagmi/core/internal'; import { type Account, type Address, type Chain, type DeriveChain, type FormattedTransactionRequest, type GetChainParameter, type Hash, type Hex, type Prettify, type UnionEvaluate, type UnionOmit, type WriteContractErrorType } from 'viem'; import type { GetAccountParameter } from 'viem/_types/types/account'; import { type Config } from 'wagmi'; export declare function createSessionMutationOptions<config extends Config>(config: config): { readonly mutationFn: (variables: UnionCompute<(SelectChains<config, config["chains"][number]["id"]> extends infer T extends readonly Chain[] ? { [key in keyof T]: innerCreateSessionVariables<SelectChains<config, config["chains"][number]["id"]>[key], Account, SelectChains<config, config["chains"][number]["id"]>[key], DeriveChain<SelectChains<config, config["chains"][number]["id"]>[key], SelectChains<config, config["chains"][number]["id"]>[key]>>; } : never)[number] & { chainId?: config["chains"][number]["id"] | (config["chains"][number]["id"] extends infer T_1 ? T_1 extends config["chains"][number]["id"] ? T_1 extends config["chains"][number]["id"] ? T_1 : undefined : never : never) | undefined; } & ConnectorParameter>) => Promise<{ transactionHash: `0x${string}`; session: SessionConfig; }>; readonly mutationKey: readonly ["createSession"]; }; type innerCreateSessionVariables<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined, chainOverride extends Chain | undefined = Chain | undefined, derivedChain extends Chain | undefined = DeriveChain<chain, chainOverride>> = GetChainParameter<chain, chainOverride> & Prettify<GetAccountParameter<account, Account | Address, true, true> & { /** Data to append to the end of the calldata. Useful for adding a ["domain" tag](https://opensea.notion.site/opensea/Seaport-Order-Attributions-ec2d69bf455041a5baa490941aad307f). */ dataSuffix?: Hex | undefined; }> & UnionEvaluate<UnionOmit<FormattedTransactionRequest<derivedChain>, 'data' | 'from' | 'to' | 'value'>> & { session: SessionConfig; paymaster?: Address; paymasterInput?: Hex; }; export interface CreateSessionData { transactionHash: Hash | undefined; session: SessionConfig; } export type CreateSessionVariables<config extends Config, chainId extends config['chains'][number]['id'] = config['chains'][number]['id'], chains extends readonly Chain[] = SelectChains<config, chainId>> = UnionCompute<{ [key in keyof chains]: innerCreateSessionVariables<chains[key], Account, chains[key]>; }[number] & Compute<ChainIdParameter<config, chainId>> & ConnectorParameter>; export type CreateSessionMutate<config extends Config, context = unknown> = <chainId extends config['chains'][number]['id']>(variables: CreateSessionVariables<config, chainId>, options?: MutateOptions<CreateSessionData, WriteContractErrorType, CreateSessionVariables<config, chainId>, context> | undefined) => void; export type CreateSessionMutateAsync<config extends Config, context = unknown> = <chainId extends config['chains'][number]['id']>(variables: CreateSessionVariables<config, chainId>, options?: MutateOptions<CreateSessionData, WriteContractErrorType, CreateSessionVariables<config, chainId>, context> | undefined) => Promise<CreateSessionData>; export {}; //# sourceMappingURL=createSession.d.ts.map