@privy-io/react-auth
Version:
React client for the Privy Auth API
71 lines (66 loc) • 3.12 kB
TypeScript
import * as react_jsx_runtime from 'react/jsx-runtime';
import react__default from 'react';
import { e as SendTransactionModalUIOptions, f as SignMessageModalUIOptions } from './types-D7U23FgR.js';
import { SmartAccountClient } from 'permissionless';
import { EIP1193Provider, Chain, PublicClient, HttpTransport, WalletClient, PaymasterRpcSchema, SendTransactionParameters, Hash, SignableMessage, Hex, TypedData, SignTypedDataParameters } from 'viem';
import { SmartAccount, SendUserOperationParameters } from 'viem/account-abstraction';
import { SmartWalletType } from '@privy-io/js-sdk-core';
import '@coinbase/wallet-sdk';
import '@simplewebauthn/browser';
import '@solana/kit';
import '@privy-io/api-types';
import '@base-org/account';
import '@wallet-standard/base';
import '@solana/wallet-standard-features';
import '@wallet-standard/features';
import 'eventemitter3';
type Call = {
readonly to?: any;
readonly value?: any;
readonly data?: any;
};
declare const signerToSmartAccountClient: ({ owner, smartWalletType, smartWalletVersion, chain, publicClient, bundlerUrl, paymasterUrl, paymasterContext, }: {
owner: EIP1193Provider;
smartWalletType: SmartWalletType;
smartWalletVersion?: string;
chain: Chain;
publicClient: PublicClient;
bundlerUrl: string;
paymasterUrl?: string;
paymasterContext?: Record<string, any>;
}) => Promise<SmartAccountClient<HttpTransport, Chain, SmartAccount, WalletClient, PaymasterRpcSchema>>;
type SmartWalletClientType = Omit<Awaited<ReturnType<typeof signerToSmartAccountClient>>, 'sendTransaction' | 'signMessage'> & {
sendTransaction: (input: SendTransactionParameters<Chain, SmartAccount> | SendUserOperationParameters<SmartAccount, undefined, Call[]>, options?: {
uiOptions?: SendTransactionModalUIOptions;
}) => Promise<Hash>;
signMessage: (input: {
message: SignableMessage;
}, options?: {
uiOptions?: SignMessageModalUIOptions;
}) => Promise<Hex>;
signTypedData: <const TTypedData extends TypedData | {
[key: string]: unknown;
}, TPrimaryType extends string, TAccount extends SmartAccount | undefined = SmartAccount | undefined>(input: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>, options?: {
uiOptions?: SignMessageModalUIOptions;
}) => Promise<Hex>;
};
interface SmartWalletClientTypeWithSwitchChain extends SmartWalletClientType {
switchChain: (args: {
id: number;
}) => Promise<void>;
}
interface SmartWalletsInterface {
client?: SmartWalletClientTypeWithSwitchChain;
getClientForChain: ({ id }: {
id: number;
}) => Promise<SmartWalletClientType | undefined>;
}
interface SmartWalletsProviderProps {
config?: {
paymasterContext?: Record<string, any>;
};
children: react__default.ReactNode;
}
declare const SmartWalletsProvider: ({ config, children }: SmartWalletsProviderProps) => react_jsx_runtime.JSX.Element;
declare const useSmartWallets: () => SmartWalletsInterface;
export { type SmartWalletClientType, SmartWalletsProvider, type SmartWalletsProviderProps, useSmartWallets };