import { type ReactNode } from 'react'; /** * Who the current user is, supplied by the host app. On web these fields come * from wagmi + the Funkit config providers; React Native has no wagmi, so the * host passes them in directly. The transfer hooks read identity from here * instead of reaching into platform-specific providers. */ export interface FunkitIdentity { /** Funkit API key. */ apiKey: string; /** Fun user id (external user id). */ userId: string; /** The user's wallet address (default transfer recipient). */ walletAddress: string; /** How the user authenticated, if known (analytics only). */ loginType?: string; /** The host's email for this user; see {@link FunkitConfig.prefillFiatEmail}. */ prefillFiatEmail?: string; /** See {@link FunkitConfig.hideCryptoDeposit}. Defaulted to false here. */ hideCryptoDeposit: boolean; /** * Mints the identity assertion; resolved from * {@link FunkitConfig.getIdentityAssertionRef} at call time. */ getIdentityAssertion?: GetIdentityAssertion; } /** Mints a short-lived JWT asserting who the current user is. */ export type GetIdentityAssertion = () => Promise; /** * A ref holding the minter, as `useRef(async () => …)` returns it. Passing the * ref rather than the function keeps the provider config referentially stable * across the host's renders. */ export interface IdentityAssertionRef { readonly current: GetIdentityAssertion | null | undefined; } /** * Host-facing identity config, mirroring the identity-relevant subset of the * web SDK's `funkitConfig` ({@link https://github.com/fun-xyz}). The host passes * its `apiKey` and (optionally) the `externalUserId` that links Funkit users to * its own user system. `walletAddress` is supplied separately on * `` because — unlike web, which reads it from wagmi — RN has no * wallet provider, so the host owns the connected address. */ export interface FunkitConfig { /** Funkit API key. */ apiKey: string; /** * Stable id linking Funkit users to the host's user system. When set, the * Funkit `userId` is derived from it (web's `generateSyntheticUserId`); when * omitted, the wallet address is used as the id. */ externalUserId?: string; /** How the user authenticated, if known (analytics only). */ loginType?: string; /** * The host's email for this user. Prefilled into the Swapped fiat * onramp/offramp so it need not be retyped (web parity). * * Alongside {@link FunkitConfig.getIdentityAssertion} it is also the address * a fiat code screen names, since the assertion is what declares this user * to the rail — so set it to the email that assertion carries. Dropped when * it is not an address; it never blocks a flow. */ prefillFiatEmail?: string; /** * @deprecated Leave `crypto` out of `DepositFlowConfig.methods` instead. * Hides the built-in "Crypto" row on Add money; address generation still * runs, since the fiat rails derive their recipient from it. */ hideCryptoDeposit?: boolean; /** * Drop the "powered by Fun" mark from the foot of the flow. The design shows * it by default; a host whose agreement covers unbranded use turns it off. * Read through `useFunkitBranding`, not identity. */ hideAttribution?: boolean; /** * Stable ref to the function minting the short-lived identity assertion * every fiat request carries. Required when `DepositFlowConfig.methods` * names a fiat method. The minter must reject with a `code` of * `SESSION_EXPIRED`, `ACCOUNT_INELIGIBLE` or `TRANSIENT`. * * `current` is captured with the rest of the identity when a flow opens * and held for its life, so an assertion can never speak for a user the * open flow is not. Point it at another user only between flows. */ getIdentityAssertionRef?: IdentityAssertionRef; /** @deprecated Pass {@link getIdentityAssertionRef}. */ getIdentityAssertion?: GetIdentityAssertion; } /** * Stands in for `walletAddress` when the host supplies none. Not a valid * address — callers that surface it to the user must check for it. */ export declare const UNSET_WALLET_ADDRESS = "0x"; /** * Whether the host's address can be put in front of the user — offered as a * withdrawal recipient, the zero address burns the funds. */ export declare function isUsableWalletAddress(address: string | undefined): boolean; /** * Resolve the host's {@link FunkitConfig} + connected wallet address into the * internal {@link FunkitIdentity} the transfer hooks read. Mirrors the web * default (non-customer) path of `resolveUserId`/`resolveWalletAddress`: prefer * a synthetic id from `externalUserId`, else fall back to the wallet address; * missing values become {@link UNSET_WALLET_ADDRESS}, which disables the * transfer query (see `getCheckoutTokenTransferParams`). */ export declare function resolveFunkitIdentity(config: FunkitConfig, walletAddress: string | undefined): FunkitIdentity; export declare function FunkitIdentityProvider({ identity, children, }: { identity: FunkitIdentity; children: ReactNode; }): import("react").JSX.Element; export declare function useFunkitIdentity(): FunkitIdentity; //# sourceMappingURL=IdentityContext.d.ts.map