@privy-io/js-sdk-core
Version:
Vanilla JS client for the Privy Auth API
29 lines (26 loc) • 1.61 kB
text/typescript
import { SmartAccountClient } from 'permissionless';
import { Chain, EIP1193Provider, PublicClient, HttpTransport, Transport, SendTransactionParameters, Hash, SignMessageParameters, Hex, TypedData, SignTypedDataParameters } from 'viem';
import { SmartAccount, SendUserOperationParameters } from 'viem/account-abstraction';
import { SmartWalletType } from '@privy-io/public-api';
type Call = {
readonly to?: any;
readonly value?: any;
readonly data?: any;
};
declare const signerToSmartAccountClient: <chain extends Chain>({ owner, smartWalletType, chain, publicClient, bundlerUrl, paymasterUrl, paymasterContext, }: {
owner: EIP1193Provider;
smartWalletType: SmartWalletType;
chain: chain;
publicClient: PublicClient;
bundlerUrl: string;
paymasterUrl?: string;
paymasterContext?: Record<string, any>;
}) => Promise<SmartAccountClient<HttpTransport, chain>>;
type SmartWalletClientType = Omit<SmartAccountClient<Transport, Chain, SmartAccount>, 'sendTransaction' | 'signMessage' | 'signTypedData'> & {
sendTransaction: (args: Omit<SendTransactionParameters<Chain, SmartAccount>, 'kzg'> | SendUserOperationParameters<SmartAccount, undefined, Call[]>) => Promise<Hash>;
signMessage: (args: Omit<SignMessageParameters, 'account'>) => Promise<Hex>;
signTypedData: <const TTypedData extends TypedData | {
[key: string]: unknown;
}, TPrimaryType extends string>(args: Omit<SignTypedDataParameters<TTypedData, TPrimaryType, SmartAccount>, 'account'>) => Promise<Hex>;
};
export { type Call, type SmartWalletClientType, signerToSmartAccountClient };