UNPKG

@radish-la/world-auth

Version:

Extending World Auth SDK for React

45 lines (38 loc) 1.62 kB
import { M as MiniKitUser, W as WalletSession } from './types.d-BUdjzSVV.js'; import * as react_jsx_runtime from 'react/jsx-runtime'; import { PropsWithChildren } from 'react'; import '@worldcoin/minikit-js'; declare const generateUUID: () => string; declare const useWorldAuth: ({ onWrongEnvironment, onLoginSuccess, onLoginError, }?: { onWrongEnvironment?: () => void; onLoginSuccess?: (user: MiniKitUser) => void; onLoginError?: (error: Error) => void; }) => { signIn: () => Promise<MiniKitUser | null>; /** Connected wallet address */ address: `0x${string}` | undefined; user: MiniKitUser | null; /** (WARN) Force set world user your self*/ recklesslySetUser: (args_0: MiniKitUser | ((prev: MiniKitUser | null) => MiniKitUser | null) | null) => void; signOut: () => void; /** `true` when login modal is open in Mini App */ isConnecting: boolean; /** `true` when MiniKit is found and installed */ isMiniApp: boolean; isConnected: boolean; }; /** * Get the connected users to the mini app. * If not connected, user is null. */ declare const useWorldUser: () => MiniKitUser | null; type Settings = { appId?: string; appName: string; onWrongEnvironment?: () => void; withValidator: (session: WalletSession) => Promise<{ isValid: boolean; }>; }; declare function WorldAppProvider({ children, appId, appName, withValidator, onWrongEnvironment, }: PropsWithChildren<Settings>): react_jsx_runtime.JSX.Element; export { MiniKitUser, WalletSession, WorldAppProvider, generateUUID as generateNonce, useWorldAuth, useWorldUser };