UNPKG

@worldcoin/minikit-js

Version:

minikit-js is our SDK for building mini-apps.

56 lines (53 loc) 1.7 kB
import { W as WorldAppProvider } from '../provider-DeDUsLbs.js'; /** * World App Wagmi Connector * * Thin wrapper that delegates to the shared EIP-1193 provider from * `@worldcoin/minikit-js`. All auth and RPC logic lives in the provider; * this connector just adapts the interface for wagmi. */ type WorldAppConnectorOptions = { /** Custom name for the connector */ name?: string; }; /** * Create a World App connector for Wagmi * * When running inside World App, this connector uses native MiniKit commands * via the shared EIP-1193 provider. It should be placed first in the * connectors list so it's used automatically in World App. * * @example * ```typescript * import { createConfig } from 'wagmi'; * import { worldApp } from '@worldcoin/minikit-js/wagmi'; * * const wagmiConfig = createConfig({ * connectors: [ * worldApp(), // Uses native MiniKit in World App * injected(), // Fallback for web * walletConnect({ ... }), * ], * // ... * }); * ``` */ declare function worldApp(options?: WorldAppConnectorOptions): (config: any) => { id: string; name: string; type: "worldApp"; setup(): Promise<void>; connect(_parameters?: any): Promise<any>; disconnect(): Promise<void>; getAccounts(): Promise<readonly `0x${string}`[]>; getChainId(): Promise<number>; getProvider(): Promise<WorldAppProvider>; isAuthorized(): Promise<boolean>; switchChain({ chainId }: { chainId: number; }): Promise<any>; onAccountsChanged(_accounts: string[]): void; onChainChanged(_chainId: string): void; onDisconnect(): void; }; export { type WorldAppConnectorOptions, worldApp };