@worldcoin/minikit-react
Version:
minikit-react is a set of hooks for building mini-apps
103 lines (97 loc) • 5.98 kB
text/typescript
import * as react_jsx_runtime from 'react/jsx-runtime';
import { Transport, Chain, Account, Address, RpcSchema, TransactionReceipt, PublicClient, ParseAccount } from 'viem';
/**
* Checks if a user is Orb verified
*
* @param walletAddress - The wallet address of the user
* @param rpcUrl - Your preferred RPC node URL, https://worldchain-mainnet.g.alchemy.com/public by default
*/
declare const useIsUserVerified: (walletAddress: string, rpcUrl?: string) => {
isUserVerified: boolean | null;
isLoading: boolean;
isError: any;
};
type SearchUsernameResponseBodySuccess = Array<{
address: string;
profile_picture_url: string | null;
username: string;
}>;
type GetSearchedUsernameResult = Awaited<ReturnType<typeof getSearchedUsername>>;
declare const getSearchedUsername: (username: string) => Promise<{
status: number;
data: SearchUsernameResponseBodySuccess;
error?: undefined;
} | {
status: number;
error: string;
data?: undefined;
}>;
type Props = {
value: string;
handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
setSearchedUsernames: (searchedUsernames: GetSearchedUsernameResult) => void;
className?: string;
inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
};
/**
* Simple component that allows users to search for usernames.
*
* It is encouraged to build your own components, using this as a base/reference
*
* You can add more <input /> props/override existing ones by passing inputProps.
* Debounce delay is 300ms.
*/
declare const UsernameSearch: ({ value, handleChange, setSearchedUsernames, className, inputProps, }: Props) => react_jsx_runtime.JSX.Element;
type AppConfig = {
app_id: string;
apiBaseUrl?: string;
};
type BaseReceiptOptions<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | Address | undefined = undefined, rpcSchema extends RpcSchema | undefined = undefined> = {
client: PublicClient<transport, chain, ParseAccount<accountOrAddress>, rpcSchema>;
confirmations?: number;
timeout?: number;
pollingInterval?: number;
};
type UseTransactionReceiptOptions<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | Address | undefined = undefined, rpcSchema extends RpcSchema | undefined = undefined> = BaseReceiptOptions<transport, chain, accountOrAddress, rpcSchema> & {
appConfig: AppConfig;
transactionId: string;
};
type UseUserOperationReceiptOptions<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | Address | undefined = undefined, rpcSchema extends RpcSchema | undefined = undefined> = BaseReceiptOptions<transport, chain, accountOrAddress, rpcSchema> & {
userOpHash: string;
apiBaseUrl?: string;
};
type UseTransactionReceiptResult = {
transactionHash?: `0x${string}`;
receipt?: TransactionReceipt;
isError: boolean;
isLoading: boolean;
isSuccess: boolean;
error?: Error;
retrigger: () => void;
};
/**
* @deprecated Use `useTransactionReceipt` instead — imperative `poll()` API, no external state needed.
*/
declare function useWaitForTransactionReceipt<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | Address | undefined = undefined, rpcSchema extends RpcSchema | undefined = undefined>(options: UseTransactionReceiptOptions<transport, chain, accountOrAddress, rpcSchema>): UseTransactionReceiptResult;
/**
* @deprecated Use `useUserOperationReceipt` instead — imperative `poll()` API, no external state needed.
*/
declare function useWaitForUserOperationReceipt<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | Address | undefined = undefined, rpcSchema extends RpcSchema | undefined = undefined>(options: UseUserOperationReceiptOptions<transport, chain, accountOrAddress, rpcSchema>): UseTransactionReceiptResult;
type ReceiptResult = {
transactionHash: `0x${string}`;
receipt: TransactionReceipt;
};
type UsePollingReturn = {
poll: (id: string) => Promise<ReceiptResult>;
isLoading: boolean;
reset: () => void;
};
type UserOperationReceiptOptions<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | Address | undefined = undefined, rpcSchema extends RpcSchema | undefined = undefined> = BaseReceiptOptions<transport, chain, accountOrAddress, rpcSchema> & {
apiBaseUrl?: string;
};
declare function useUserOperationReceipt<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | Address | undefined = undefined, rpcSchema extends RpcSchema | undefined = undefined>(options: UserOperationReceiptOptions<transport, chain, accountOrAddress, rpcSchema>): UsePollingReturn;
type TransactionReceiptOptions<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | Address | undefined = undefined, rpcSchema extends RpcSchema | undefined = undefined> = BaseReceiptOptions<transport, chain, accountOrAddress, rpcSchema> & {
appConfig: AppConfig;
};
declare function useTransactionReceipt<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | Address | undefined = undefined, rpcSchema extends RpcSchema | undefined = undefined>(options: TransactionReceiptOptions<transport, chain, accountOrAddress, rpcSchema>): UsePollingReturn;
export { type AppConfig, type GetSearchedUsernameResult, type ReceiptResult, UsernameSearch, useIsUserVerified, useTransactionReceipt, useUserOperationReceipt, useWaitForTransactionReceipt, useWaitForUserOperationReceipt };