startale-aa-sdk
Version:
SDK for startale account integration with support for account abstraction, ERC-7579, ERC-4337.
66 lines • 3.52 kB
TypeScript
import { type BundlerRpcSchema, type Chain, type Client, type OneOf, type Prettify, type RpcSchema, type Transport } from "viem";
import { type BundlerActions, type BundlerClientConfig } from "viem/account-abstraction";
import type { AnyData, ModularSmartAccount } from "../modules/utils/Types";
import { type SCSActions } from "./decorators/bundler";
import { type Erc7579Actions } from "./decorators/erc7579";
import { type SmartAccountActions } from "./decorators/smartAccount";
/**
* Startale Account Client type
*/
export type StartaleAccountClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends ModularSmartAccount | undefined = ModularSmartAccount | undefined, client extends Client | undefined = Client | undefined, rpcSchema extends RpcSchema | undefined = undefined> = Prettify<Client<transport, chain extends Chain ? chain : client extends Client<AnyData, infer chain> ? chain : undefined, account, rpcSchema extends RpcSchema ? [...BundlerRpcSchema, ...rpcSchema] : BundlerRpcSchema, BundlerActions<account>>> & BundlerActions<ModularSmartAccount> & SCSActions & Erc7579Actions<ModularSmartAccount> & SmartAccountActions<chain, ModularSmartAccount> & {
/**
* Whether to use the test bundler. Conditionally used by the `getGasFeeValues` decorator.
*/
mock: boolean;
/**
* The Smart account associated with this client
*/
account: ModularSmartAccount;
/**
* Optional client for additional functionality
*/
client?: client | Client | undefined;
/**
* Optional paymaster configuration
*/
paymaster?: BundlerClientConfig["paymaster"] | undefined;
/**
* Optional paymaster context
*/
paymasterContext?: unknown;
/**
* Optional user operation configuration
*/
userOperation?: BundlerClientConfig["userOperation"] | undefined;
};
type SCSBundlerClientConfig = Omit<BundlerClientConfig, "transport"> & {
/**
* Whether to use the test bundler. Conditionally used by the `getGasFeeValues` decorator.
*/
mock?: boolean;
} & OneOf<{
transport: Transport;
} | {
bundlerUrl: string;
} | {
apiKey?: string;
}>;
/**
* Creates SCS Bundler Client with a given Transport configured for a Chain.
*
* @param parameters - Configuration for the SCS Bundler Client
* @returns SCS Bundler Client
*
* @example
* import { createSCSBundlerClient, http } from 'startale-aa-sdk'
* import { mainnet } from 'viem/chains'
*
* const bundlerClient = createSCSBundlerClient({ chain: mainnet });
*/
export declare const createSCSBundlerClient: (parameters: SCSBundlerClientConfig) => StartaleAccountClient<Transport, Chain | undefined, ModularSmartAccount | undefined, Client | undefined, undefined>;
export declare const createSmartAccountClient: (parameters: SCSBundlerClientConfig) => StartaleAccountClient<Transport, Chain | undefined, ModularSmartAccount | undefined, Client | undefined, undefined>;
export declare const createStartaleAccountClient: (parameters: SCSBundlerClientConfig) => StartaleAccountClient<Transport, Chain | undefined, ModularSmartAccount | undefined, Client | undefined, undefined>;
export declare const createStartaleSessionClient: (parameters: SCSBundlerClientConfig) => StartaleAccountClient<Transport, Chain | undefined, ModularSmartAccount | undefined, Client | undefined, undefined>;
export type SCSBundlerClient = StartaleAccountClient;
export {};
//# sourceMappingURL=createSCSBundlerClient.d.ts.map