aomi-para-provider
aomi/aomi-para-providerFreeComponent
Para-backed Aomi wallet kit provider with the existing Aomi AA path.
Install it
npx shadcn@latest add https://aomi.dev/r/aomi-para-provider.jsonSource
1"use client";23import {4 useCallback,5 useEffect,6 useMemo,7 useState,8 type ReactNode,9} from "react";10import {11 Environment,12 ParaProvider,13 useParaStatus,14 type TOAuthMethod,15} from "@getpara/react-sdk";16import "@getpara/react-sdk/styles.css";17import type {18 AuthConfig,19 AuthMethodId,20 ProvidersConfig,21} from "../../config/types";22import {23 registerWalletProvider,24 type WalletProviderPlugin,25} from "../plugin-registry";26import { AomiParaPluginProvider } from "./ParaPluginProvider";27import { AomiParaEvmRuntimeProvider } from "./para-evm-runtime-provider";28import { defaultOAuthMethods } from "./para-auth";29import { safeEnv } from "../../env";3031const PARA_STARTUP_TIMEOUT_MS = 4_000;3233/**34 * Defensive read of the Para SDK readiness signal, mirroring the other35 * `useSafe*` Para hooks: `useParaStatus()` throws if no Para context is mounted,36 * which we treat as "not ready".37 */38function useSafeParaReady(): boolean {39 try {40 return Boolean(useParaStatus().isReady);41 } catch {42 return false;43 }44}4546/**47 * Reports Para startup success from the SDK's real readiness signal rather than48 * from "children mounted".49 *50 * `useParaStatus().isReady` flips true only after the Para client's first-time51 * setup succeeds and stays false on startup failure — the true success/error52 * discriminator. Because `ParaProvider` renders its children even while53 * initializing (and even on error), keying readiness off "children rendered"54 * (the previous approach) fired `onReady` on failure too, wrongly suppressing55 * the startup banner. Gating on `isReady` fixes that direction.56 *57 * It also fixes the effect-ordering bug: child effects commit before the58 * parent's on mount. Since `isReady` starts false, this watcher does NOT call59 * `onReady` during the initial commit, so the parent's watchdog effect can no60 * longer be clobbered by (and then re-clobber) a ready flag set from a child.61 * `onReady` only fires later, on the async `isReady` false→true transition.62 */63function ParaStartupWatcher({64 children,65 onReady,66}: {67 children: ReactNode;68 onReady: () => void;69}) {70 const isReady = useSafeParaReady();71 useEffect(() => {72 if (isReady) onReady();73 }, [isReady, onReady]);74 return <>{children}</>;75}7677function toParaEnvironment(value?: "PROD" | "BETA") {78 if (!value) return Environment.BETA;79 return value === "PROD" ? Environment.PROD : Environment.BETA;80}8182function toParaOAuthMethods(83 methods: readonly AuthMethodId[] | undefined,84// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from aomi
All 34 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | aomi | Components | Free | 2 deps | |
| alertalert | aomi | Components | Free | 1 dep | |
| aomi-frameaomi-frame | aomi | Components | Free | 1 dep | |
| aomi-privy-provideraomi-privy-provider | aomi | Components | Free | 7 deps · 15 files | |
| aomi-wallet-kitaomi-wallet-kit | aomi | Components | Free | 8 deps · 59 files | |
| aomi-widgetaomi-widget | aomi | Components | Free | 2 deps | |
| assistant-threadassistant-thread | aomi | Components | Free | 6 deps · 26 files | |
| assistant-thread-listassistant-thread-list | aomi | Components | Free | 2 deps |
