UNPKG

@keyban/sdk-react

Version:

Keyban SDK React simplifies the integration of Keyban's MPC wallet in React apps with TypeScript support, flexible storage, and Ethereum blockchain integration.

1 lines 84.2 kB
{"version":3,"sources":["../src/promise.ts","../src/provider.tsx","../src/auth.tsx","../src/account.ts","../src/api.tsx","../src/components/FormattedBalance.tsx","../src/components/KeybanInput.tsx"],"names":["caches","CacheContext","React","PromiseCacheProvider","children","client","useKeybanClient","cache","updateWrappedPromise","wrapped","result","error","usePromise","key","promise","options","cached","loading","setLoading","refresh","reset","extra","KeybanContext","KeybanProvider","props","config","KeybanClient","jsx","KeybanAuthProvider","ctx","KeybanAuthContext","user","setUser","pendingUpdates","setPendingUpdates","wrapUpdate","cb","count","login","connection","logout","passwordLogin","input","passwordlessStart","passwordlessLogin","auth","useKeybanAuth","getPaginatedResults","data","node","usePaginationExtra","fetchMore","isPending","startTransition","updatePaginatedData","prev","mutationType","edge","isBefore","ignoreDeletions","GqlMutationType","insertIndex","isFirst","isLast","hasPreviousPage","hasNextPage","edges","useKeybanAccount","useKeybanAccountBalance","account","useSuspenseQuery","walletBalanceDocument","useSubscription","walletSubscriptionDocument","useKeybanAccountTokenBalances","subscribeToMore","walletTokenBalancesDocument","GqlTokenBalancesOrderBy","tokenBalancesSubscriptionDocument","subscriptionData","entity","useKeybanAccountTokenBalance","tokenAddress","id","walletTokenBalanceDocument","SdkError","SdkErrorTypes","useKeybanAccountNfts","walletNftsDocument","GqlNftBalancesOrderBy","nftBalancesSubscriptionDocument","useKeybanAccountNft","tokenId","walletNftDocument","useKeybanAccountTransferHistory","walletAssetTransfersDocument","GqlAssetTransfersOrderBy","assetTransfersSubscriptionDocument","useKeybanAccountOrders","walletOrdersDocument","GqlOrdersOrderBy","ordersSubscriptionDocument","orderTransaction","useKeybanApiStatus","useFormattedBalance","balance","token","formatBalance","FormattedBalance","KeybanInput","ref","className","style","type","inputMode","name","onFocus","onBlur","onInput","onChange","inputStyles","containerEl","setContainerEl","iframeUrl","value","iframeRef","focus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C,CAAAA,IAAU,CACV,MAEF,KAAK,QAAA,CACHC,CAAAA,IAAW,CACX,KACJ,CACF,CAAA,CAEA,OAAA,MAAA,CAAO,gBAAA,CAAiB,SAAA,CAAWQ,CAAQ,CAAA,CAEpC,IAAM,OAAO,mBAAA,CAAoB,SAAA,CAAWA,CAAQ,CAC7D,CAAA,CAAG,CAACX,CAAAA,CAASC,CAAAA,CAAQC,EAASC,CAAQ,CAAC,CAAA,CAEvC,GAAM,CAACa,EAAAA,CAAYH,CAAa,CAAA,CAAI/H,CAAAA,CAAM,QAAA,CAAmB,EAAE,CAAA,CAE/D,OACEmI,IAAAA,CAAC,KAAA,CAAA,CACC,QAASP,CAAAA,CACT,KAAA,CAAOd,CAAAA,CACP,SAAA,CAAW,CAACsB,CAAAA,CAAO,uBAAuB,CAAA,CAAG,GAAGF,EAAAA,CAAYrB,CAAS,CAAA,CAClE,MAAA,CAAO,OAAO,CAAA,CACd,IAAA,CAAK,GAAG,EACX,GAAA,CAAKW,CAAAA,CAEL,QAAA,CAAA,CAAA/F,GAAAA,CAAC,OAAA,CAAA,CACC,QAAA,CAAU,EAAA,CACV,QAAA,CAAQ,IAAA,CACR,QAAA,CAAQ,IAAA,CACR,SAAA,CAAW2G,CAAAA,CAAO,mBAAmB,CAAA,CACvC,CAAA,CAECb,GACC9F,GAAAA,CAAC,QAAA,CAAA,CACC,GAAA,CAAKkG,CAAAA,CACL,GAAA,CAAKF,CAAAA,CAAU,QAAA,EAAS,CACxB,KAAMR,CAAAA,CACN,SAAA,CAAWmB,CAAAA,CAAO,oBAAoB,CAAA,CACxC,CAAA,CAAA,CAEJ,CAEJ,CACF","file":"index.mjs","sourcesContent":["/**\n * @module Promise\n */\nimport { KeybanClient } from \"@keyban/sdk-base\";\nimport React from \"react\";\n\nimport { useKeybanClient } from \"~/provider\";\n\ntype Cache = Map<string, WrappedPromise<unknown>>;\n\n// We use a WeakMap so cache gets automatically removed when\n// client gets destroyed\nconst caches: WeakMap<KeybanClient, Cache> = new WeakMap();\n\nconst CacheContext = React.createContext<Cache>(new Map());\n\n/**\n * Provides a cache context for promises.\n * @param root0 - The props object.\n * @param root0.children - The child components.\n * @returns - The provider component.\n */\nexport function PromiseCacheProvider({ children }: React.PropsWithChildren) {\n const client = useKeybanClient();\n\n let cache = caches.get(client);\n if (!cache) {\n cache = new Map();\n caches.set(client, cache);\n }\n\n return React.createElement(CacheContext.Provider, { value: cache }, children);\n}\n\nenum PromiseState {\n Pending,\n Fulfilled,\n Rejected,\n}\n\ntype WrappedPromise<T> =\n | { status: PromiseState.Pending; value: null; promise: Promise<T> }\n | { status: PromiseState.Fulfilled; value: T; promise: Promise<T> }\n | { status: PromiseState.Rejected; value: Error; promise: Promise<T> };\n\nexport type UsePromiseOptions<B extends boolean> = {\n suspense: B;\n};\n\ntype PromiseResultExtra = {\n refresh: () => void;\n reset: () => void;\n loading: boolean;\n};\n\ntype PromiseResult<T> = {\n [S in PromiseState]: {\n readonly [PromiseState.Pending]: [null, null, PromiseResultExtra];\n readonly [PromiseState.Fulfilled]: [T, null, PromiseResultExtra];\n readonly [PromiseState.Rejected]: [null, Error, PromiseResultExtra];\n }[S];\n};\n\nexport type UsePromiseResult<T, B extends boolean> =\n | (B extends false ? PromiseResult<T>[PromiseState.Pending] : never)\n | PromiseResult<T>[PromiseState.Fulfilled]\n | PromiseResult<T>[PromiseState.Rejected];\n\nconst updateWrappedPromise = <T>(wrapped: WrappedPromise<T>) => {\n wrapped.promise\n .then((result) => {\n wrapped.status = PromiseState.Fulfilled;\n wrapped.value = result;\n\n return result;\n })\n .catch((error) => {\n wrapped.status = PromiseState.Rejected;\n wrapped.value = error;\n\n throw error;\n });\n};\n\n/**\n * A hook to manage promises with caching and suspense support.\n * @param key - The unique key to identify the promise.\n * @template T\n * @template B\n * @param promise - The function that returns the promise.\n * @param [options] - Options to configure the hook behavior.\n * @returns - The result of the promise with additional controls.\n */\nexport function usePromise<T, B extends boolean>(\n key: string,\n promise: () => Promise<T>,\n options?: UsePromiseOptions<B>,\n): UsePromiseResult<T, B> {\n const cache = React.useContext(CacheContext);\n let cached = cache.get(key) as WrappedPromise<T> | undefined;\n\n if (!cached) {\n cached = {\n status: PromiseState.Pending,\n value: null,\n promise: promise(),\n };\n\n updateWrappedPromise(cached);\n\n cache.set(key, cached);\n }\n\n const [loading, setLoading] = React.useState(\n cached.status === PromiseState.Pending,\n );\n React.useEffect(() => {\n cached.promise.finally(() => setLoading(false));\n }, [cached.promise]);\n\n const refresh = React.useCallback(() => {\n setLoading(true);\n\n cached.promise = promise();\n updateWrappedPromise(cached);\n }, [cached, promise]);\n\n const reset = React.useCallback(() => {\n setLoading(true);\n cache.delete(key);\n }, [cached, promise]);\n\n const extra: PromiseResultExtra = { refresh, reset, loading };\n\n switch (cached.status) {\n case PromiseState.Pending:\n if (options?.suspense) throw cached.promise;\n return [null, null, extra] as UsePromiseResult<T, B>;\n case PromiseState.Fulfilled:\n return [cached.value, null, extra];\n case PromiseState.Rejected:\n return [null, cached.value, extra];\n }\n}\n","/**\n * @module Provider\n */\n\nimport { KeybanClient, type KeybanClientConfig } from \"@keyban/sdk-base\";\nimport React from \"react\";\n\nimport { KeybanAuthProvider } from \"~/auth\";\n\nimport { PromiseCacheProvider } from \"./promise\";\n\nconst KeybanContext = React.createContext<KeybanClient | null>(null);\n\n/**\n * Defines the properties for the KeybanProvider component.\n *\n * Includes the Keyban client configuration and supports React children.\n * @see {@link KeybanClientConfig} for the available configuration options.\n */\nexport type KeybanProviderProps = React.PropsWithChildren<KeybanClientConfig>;\n\n/**\n * Provider component for the Keyban SDK.\n * This component wraps the application and provides Keyban SDK functionalities\n * to the components within the application. It is responsible for configuring\n * the Keyban client with the appropriate options and ensuring that the SDK is\n * accessible via the `useKeybanClient` hook.\n *\n * The configuration options for the Keyban SDK are specified via the {@link KeybanClientConfig}\n * type, which includes settings such as the API URL, blockchain network (`chain`), signing algorithm\n * (`signer`), and storage mechanism (`storage`).\n *\n * The provider supports dynamic updates to certain configuration options, such as `chain`,\n * allowing components to adjust the blockchain network or other configurations during the\n * application's lifecycle.\n *\n * Additionally, the `clientShareProvider` prop allows for the injection of a client share provider function.\n * This function is used to cipher the client's share of the end user and is stored securely within Keyban's infrastructure.\n * By utilizing this, Keyban as the server and client share cannot sign operations on behalf of the end users.\n * We recommend providing a unique key per client share to enhance security.\n *\n * You can use a custom implementation of a `ClientShareProvider` or the provided `KeybanClientShareProvider`.\n * @param props - The Keyban provider configuration options.\n * @throws {Error} If the configuration is invalid.\n * @returns - The provider component wrapping the children components.\n * @see {@link KeybanClientConfig} for the available configuration options.\n * @see {@link ClientShareProvider} for managing shared keys in client-side operations.\n * @example\n * ```tsx\n * import React from \"react\";\n * import { KeybanProvider, KeybanNetwork } from \"@keyban/sdk-react\";\n * import { MyClientShareProvider } from './ClientShareProvider';\n * import { KeybanClientShareProvider } from '@keyban/sdk-base';\n *\n * const App: React.FC = () => {\n *\n * return (\n * <KeybanProvider\n * appId=\"your-app-id\" // Your unique application ID from Keyban\n * network={KeybanNetwork.EthereumAnvil} // Specify the blockchain network (e.g., Testnet or Mainnet)\n * clientShareProvider={new MyClientShareProvider()} // Custom provider for client shares\n * >\n * <YourMainComponent />\n * </KeybanProvider>\n * );\n * };\n *\n * const AppWithKeybanClientShareProvider: React.FC = () => {\n *\n * return (\n * <KeybanProvider\n * appId=\"your-app-id\" // Your unique application ID from Keyban\n * network={KeybanNetwork.EthereumAnvil} // Specify the blockchain network (e.g., Testnet or Mainnet)\n * clientShareProvider={React.useMemo(() => new KeybanClientShareProvider(), [])} // Using KeybanClientShareProvider\n * >\n * <YourMainComponent />\n * </KeybanProvider>\n * );\n * };\n *\n * export default App;\n * ```\n */\nexport function KeybanProvider(props: KeybanProviderProps) {\n const { children, ...config } = props;\n\n const client = React.useMemo(\n () => new KeybanClient(config),\n Object.values(config),\n );\n\n return (\n <KeybanContext.Provider value={client}>\n <KeybanAuthProvider>\n <PromiseCacheProvider>{children}</PromiseCacheProvider>\n </KeybanAuthProvider>\n </KeybanContext.Provider>\n );\n}\n\n/**\n * Hook to access the Keyban SDK functionalities within a React component.\n *\n * The `useKeybanClient` hook allows you to access the initialized Keyban client,\n * enabling direct interaction with the SDK from functional React components. This hook\n * ensures that the Keyban client is available within the application's context and allows\n * you to utilize features such as account management, transactions, and blockchain queries.\n * @returns - The initialized Keyban client.\n * @throws {Error} If the hook is used outside of a {@link KeybanProvider}, indicating that\n * the context is not properly configured to provide the Keyban client.\n * @example\n * ```tsx\n * import React from 'react';\n * import { useKeybanClient } from \"@keyban/sdk-react\";\n *\n * const MyComponent: React.FC = () => {\n * const keybanClient = useKeybanClient();\n *\n * const handleCheckStatus = async () => {\n * try {\n * const status = await keybanClient.apiStatus();\n * console.log(`Keyban API Status: ${status}`);\n * } catch (error) {\n * console.error(\"Error checking Keyban API status:\", error);\n * }\n * };\n *\n * return (\n * <div>\n * <button onClick={handleCheckStatus}>Check API Status</button>\n * </div>\n * );\n * };\n *\n * export default MyComponent;\n * ```\n * @see {@link KeybanClient} For more details on the Keyban client.\n * @see {@link KeybanProvider} To understand how to set up the Keyban SDK context in your application.\n */\nexport const useKeybanClient = () => {\n const ctx = React.useContext(KeybanContext);\n if (!ctx)\n throw new Error(\n \"useKeybanClient hook must be used within a KeybanProvider\",\n );\n return ctx;\n};\n","import { AuthConnection, KeybanUser } from \"@keyban/sdk-base\";\nimport {\n PasswordlessLoginInput,\n PasswordlessStartInput,\n PasswordLoginInput,\n} from \"@keyban/sdk-base/rpc\";\nimport React from \"react\";\n\nimport { useKeybanClient } from \"~/provider\";\n\n/**\n * Represents the authentication state of the user.\n *\n * This type can be one of the following states:\n *\n * - **Unintialized**:\n * - `user`: `undefined`\n * - `isAuthenticated`: `undefined`\n *\n * - **Unauthenticated**:\n * - `user`: `null`\n * - `isAuthenticated`: `false`\n *\n * - **Authenticated**:\n * - `user`: `KeybanUser`\n * - `isAuthenticated`: `true`\n */\nexport type BaseAuth =\n | { user: undefined; isAuthenticated: undefined }\n | { user: null; isAuthenticated: false }\n | { user: KeybanUser; isAuthenticated: true };\n\n/**\n * Represents the authentication context, extending the base authentication state\n * with loading status and methods for various login/logout flows.\n * @property isLoading - Indicates whether an authentication operation is currently in progress.\n * @property login - Initiates the login process, optionally specifying a connection type.\n * @property passwordLogin - Initiates login using username and password.\n * @property passwordlessStart - Initiates the passwordless login flow by sending an OTP.\n * @property passwordlessLogin - Completes the passwordless login flow using the received OTP.\n */\nexport type AuthContext = BaseAuth & {\n /**\n * Indicates whether an authentication operation is currently in progress.\n * True while any login, logout or passwordless flow is pending.\n */\n isLoading: boolean;\n\n /**\n * Initiates the login process.\n * @param connection - Optional authentication connection type (e.g. \"email\", \"sms\").\n * @returns A promise that resolves when login completes.\n * @throws {Error} If login fails (network error or invalid credentials).\n */\n login: (connection?: AuthConnection) => Promise<void>;\n\n /**\n * Logs out the current user.\n * @returns A promise that resolves when logout completes.\n * @throws {Error} If logout fails.\n */\n logout: () => Promise<void>;\n\n /**\n * Initiates login using username and password.\n * @param input -\n * @returns A promise that resolves when authentication succeeds.\n * @throws {Error} If credentials are invalid or login fails.\n */\n passwordLogin(input: PasswordLoginInput): Promise<void>;\n\n /**\n * Initiates the passwordless login flow by sending an OTP.\n * @param input -\n * @returns A promise that resolves when the OTP is sent.\n * @throws {Error} If sending OTP fails (invalid username or rate limit).\n */\n passwordlessStart(input: PasswordlessStartInput): Promise<void>;\n\n /**\n * Completes the passwordless login flow using the received OTP.\n * @param input -\n * @returns A promise that resolves when authentication succeeds.\n * @throws {Error} If the phone number or OTP is invalid or expired.\n * - On invalid input: \"Wrong phone number or verification code.\"\n * - Backend may return other codes (e.g. expired OTP)\n */\n passwordlessLogin(input: PasswordlessLoginInput): Promise<void>;\n};\n\nconst KeybanAuthContext: React.Context<AuthContext | null> =\n React.createContext<AuthContext | null>(null);\n\n/**\n * KeybanAuthProvider\n * @param props - Component props\n * @param props.children - Children\n * @returns - JSX element\n * @private\n */\nexport function KeybanAuthProvider({ children }: React.PropsWithChildren) {\n const client = useKeybanClient();\n\n const [user, setUser] = React.useState<KeybanUser | null>();\n const [pendingUpdates, setPendingUpdates] = React.useState(0);\n\n const wrapUpdate = React.useCallback(\n async (cb?: () => Promise<unknown>) => {\n try {\n setPendingUpdates((count) => count + 1);\n await cb?.();\n await client.getUser().then(setUser);\n } finally {\n setPendingUpdates((count) => count - 1);\n }\n },\n [client],\n );\n\n React.useEffect(() => {\n wrapUpdate();\n }, [wrapUpdate]);\n\n const login = React.useCallback(\n (connection?: AuthConnection) => wrapUpdate(() => client.login(connection)),\n [client, wrapUpdate],\n );\n\n const logout = React.useCallback(\n () => wrapUpdate(() => client.logout()),\n [client, wrapUpdate],\n );\n\n const passwordLogin = React.useCallback(\n (input: PasswordLoginInput) =>\n wrapUpdate(() => client.passwordLogin(input)),\n [client, wrapUpdate],\n );\n\n const passwordlessStart = React.useCallback(\n (input: PasswordlessStartInput) => client.passwordlessStart(input),\n [client],\n );\n\n const passwordlessLogin = React.useCallback(\n (input: PasswordlessLoginInput) =>\n wrapUpdate(() => client.passwordlessLogin(input)),\n [client, wrapUpdate],\n );\n\n const auth = React.useMemo(\n () => ({\n login,\n logout,\n passwordLogin,\n passwordlessStart,\n passwordlessLogin,\n user,\n isAuthenticated: user === undefined ? undefined : user !== null,\n isLoading: user === undefined || Boolean(pendingUpdates),\n }),\n [\n pendingUpdates,\n login,\n logout,\n passwordLogin,\n passwordlessStart,\n passwordlessLogin,\n user,\n ],\n );\n\n return (\n <KeybanAuthContext.Provider value={auth as AuthContext}>\n {children}\n </KeybanAuthContext.Provider>\n );\n}\n\n/**\n * Custom hook to access the Keyban authentication context.\n *\n * This hook provides access to the authentication state and methods\n * managed by the `KeybanProvider`. It must be called within a component\n * that is a descendant of `KeybanProvider`.\n * @returns The Keyban authentication context object.\n * @throws {Error} If the hook is used outside of a `KeybanProvider`.\n * @example\n * ```tsx\n * import React from 'react';\n * import { useKeybanAuth } from './auth'; // Adjust the import path as needed\n *\n * function MyAuthenticatedComponent() {\n * const { isAuthenticated, user, login, logout } = useKeybanAuth();\n *\n * if (!isAuthenticated) {\n * return <button onClick={login}>Log In</button>;\n * }\n *\n * return (\n * <div>\n * <p>Welcome, {user?.name}!</p>\n * <button onClick={logout}>Log Out</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useKeybanAuth() {\n const ctx = React.useContext(KeybanAuthContext);\n if (!ctx)\n throw new Error(\"useKeybanAuth hook must be used within a KeybanProvider\");\n return ctx;\n}\n","/**\n * @module Account\n */\nimport { useSubscription, useSuspenseQuery } from \"@apollo/client\";\nimport {\n type Address,\n type KeybanAccount,\n type KeybanAssetTransfer,\n type KeybanNftBalance,\n type KeybanOrder,\n type KeybanTokenBalance,\n type PaginationArgs,\n SdkError,\n SdkErrorTypes,\n} from \"@keyban/sdk-base\";\nimport {\n assetTransfersSubscriptionDocument,\n GqlAssetTransfersOrderBy,\n GqlMutationType,\n GqlNftBalancesOrderBy,\n GqlOrdersOrderBy,\n type GqlPageInfo,\n GqlTokenBalancesOrderBy,\n nftBalancesSubscriptionDocument,\n ordersSubscriptionDocument,\n tokenBalancesSubscriptionDocument,\n walletAssetTransfersDocument,\n walletBalanceDocument,\n walletNftDocument,\n walletNftsDocument,\n walletOrdersDocument,\n walletSubscriptionDocument,\n walletTokenBalanceDocument,\n walletTokenBalancesDocument,\n} from \"@keyban/sdk-base/graphql\";\nimport React from \"react\";\n\nimport { useKeybanAuth } from \"~/auth\";\nimport { usePromise } from \"~/promise\";\nimport { useKeybanClient } from \"~/provider\";\n\n// Generic types\n\n/**\n * A tuple representing the result of an API call to the Keyban servers.\n *\n * Since all Keyban hooks use the [React Suspense API](https://react.dev/reference/react/Suspense),\n * there are only two possible states for the tuple: success and error.\n *\n * The tuple contains the following data:\n * - On **success**:\n * - The data result of the API call (of type `T`).\n * - `null` for the error.\n * - An optional extra object (of type `Extra`) allowing for additional interactions.\n * - On **error**:\n * - `null` for the data.\n * - An `Error` object representing the error.\n * - An optional extra object (of type `Extra`) allowing for additional interactions.\n * @template T - The type of the data returned on success.\n * @template Extra - The type of the optional extra object for additional interactions.\n * @remarks\n * The `ApiResult` type is designed to simplify handling asynchronous API responses in Keyban hooks.\n * It adheres to the pattern `[data, error, extra]`, where:\n * - `data`: The result of the API call if successful, or `null` if there was an error.\n * - `error`: `null` if the call was successful, or an `Error` object if there was an error.\n * - `extra`: An optional object providing additional information or methods, defaulting to `undefined` if not used.\n *\n * **Example Usage:**\n * ```typescript\n * const [data, error, extra] = useKeybanSomeHook();\n * if (error) {\n * // Handle the error\n * console.error(error);\n * } else {\n * // Use the data\n * console.log(data);\n * // Optionally use extra interactions\n * extra?.someMethod();\n * }\n * ```\n */\nexport type ApiResult<T, Extra = undefined> =\n | readonly [T, null, Extra]\n | readonly [null, Error, Extra];\n\n/**\n * An object representing a paginated data API result.\n * @template T - The data type being paginated\n */\nexport type PaginatedData<T> = {\n /** A boolean indicating wether the paginated data has a previous page or not. */\n hasPrevPage: boolean;\n /** A boolean indicating wether the paginated data has a next page or not. */\n hasNextPage: boolean;\n /** The number of total results. */\n totalCount: number;\n /** An array of the data. */\n nodes: T[];\n};\n\n/**\n * An object allowing extra interactions with the Keyban API.\n */\nexport type PaginationExtra = {\n /** A boolean indicating if the data is currently being fetched. */\n loading: boolean;\n /** A function to fetch more data when the result is a paginated data type. */\n fetchMore?: () => void;\n};\n\n// Utils\n\ntype GqlEdge<T extends { id: string }> = {\n cursor: string | null;\n node: T | null;\n};\ntype GqlPaginatedData<T extends { id: string }> = {\n pageInfo: GqlPageInfo;\n totalCount: number;\n edges: GqlEdge<T>[];\n};\n\n/**\n * Extracts paginated results from the given data.\n * @param data - The data containing pagination information and edges.\n * @param data.pageInfo - Information about the pagination state.\n * @param data.totalCount - The total number of results.\n * @param data.edges - The edges containing the nodes.\n * @returns - The paginated data.\n * @template T - The type of the data being paginated.\n */\nfunction getPaginatedResults<T extends { id: string }>(\n data: GqlPaginatedData<T>,\n): PaginatedData<T> {\n return {\n hasPrevPage: data.pageInfo.hasPreviousPage,\n hasNextPage: data.pageInfo.hasNextPage,\n totalCount: data.totalCount,\n nodes: data.edges\n .map(({ node }) => node)\n .filter(Boolean as unknown as <T>(x?: T | null) => x is T),\n };\n}\n\n/**\n * Provides extra pagination controls for fetching more data.\n * @param data - The data containing pagination information.\n * @param fetchMore - A function to fetch more data.\n * @returns - An object containing loading state and fetchMore function.\n */\nfunction usePaginationExtra<T extends { id: string }>(\n data: GqlPaginatedData<T>,\n fetchMore: (options: { variables: { after?: string | null } }) => unknown,\n): PaginationExtra {\n const [isPending, startTransition] = React.useTransition();\n\n return {\n loading: isPending,\n fetchMore: () => {\n startTransition(() => {\n fetchMore({ variables: { after: data.pageInfo.endCursor } });\n });\n },\n };\n}\n\n/**\n * Update paginated data with subscription update.\n * @param prev -\n * @param mutationType -\n * @param edge -\n * @param isBefore -\n * @param ignoreDeletions -\n * @returns - The updated paginated data\n */\nfunction updatePaginatedData<T extends { id: string }>(\n prev: GqlPaginatedData<T>,\n mutationType: GqlMutationType,\n edge: GqlEdge<T>,\n isBefore: (a: GqlEdge<T>) => boolean,\n ignoreDeletions: boolean,\n) {\n switch (mutationType) {\n // subql cannot differentiate between inserts and\n // updates when historical data are enabled\n case GqlMutationType.INSERT:\n case GqlMutationType.UPDATE: {\n if (prev.edges.find(({ node }) => node?.id === edge.node?.id))\n // This is an update for sure, apollo cache already updated\n // it with normalized cache, nothing more to do\n return prev;\n\n const insertIndex =\n prev.edges.findLastIndex((edge) => isBefore(edge)) + 1;\n\n const isFirst = insertIndex === 0;\n const isLast = insertIndex === prev.edges.length;\n const { hasPreviousPage, hasNextPage } = prev.pageInfo;\n\n if ((hasPreviousPage && isFirst) || (hasNextPage && isLast))\n // the entity is outside the range of known data, we cannot\n // update the totalCount since we cannot be not sure if\n // it's an update or an insert\n return {\n ...prev,\n totalCount:\n prev.totalCount + Number(mutationType === GqlMutationType.INSERT),\n };\n\n const edges = [...prev.edges]; // clone array\n edges.splice(insertIndex, 0, edge); // insert edge\n\n return {\n pageInfo: {\n ...prev.pageInfo,\n startCursor: edges[0].cursor,\n endCursor: edges[edges.length - 1].cursor,\n },\n totalCount: prev.totalCount + 1,\n edges,\n };\n }\n\n case GqlMutationType.DELETE: {\n // Most entities does not gets deleted ever, most of the time a delete\n // corresponds to subql updating historical data (delete then create\n // the same entity with a different block range), hence we can ignore\n // the event because we will recieve an update event soon (about the\n // said \"deleted\" entity). Ignoring the delete events prevents UI\n // flickering with data disapearing and reappearing right after.\n if (ignoreDeletions) return prev;\n\n const edges = prev.edges.filter(({ node }) => node?.id !== edge.node?.id);\n\n return {\n pageInfo: {\n ...prev.pageInfo,\n startCursor: edges[0]?.cursor ?? null,\n endCursor: edges[edges.length - 1]?.cursor ?? null,\n },\n totalCount: prev.totalCount - 1,\n edges,\n };\n }\n }\n}\n\n/**\n * Retrieves the current `KeybanAccount` associated with the Keyban client.\n *\n * This React hook allows you to access the user's Keyban account within a functional component.\n * It returns an `ApiResult` tuple containing the account data or an error if one occurred during retrieval.\n * @returns - An array containing the account data, error, and an undefined value.\n * @example\n * ```tsx\n * import { useKeybanAccount } from \"@keyban/sdk-react\";\n *\n * const MyComponent: React.FC = () => {\n * const [account, accountError] = useKeybanAccount();\n * if (accountError) throw accountError;\n *\n * return (\n * <div>\n * <p>Your wallet address: {account.address}</p>\n * </div>\n * );\n * };\n * ```\n * @remarks\n * - Ensure that your component is wrapped within a `KeybanProvider` to have access to the Keyban client context.\n * - The hook internally uses React Suspense and may throw a promise if the data is not yet available.\n * - Handle errors appropriately to ensure a good user experience.\n * @see {@link KeybanAccount}\n */\nexport function useKeybanAccount(): ApiResult<KeybanAccount> {\n const client = useKeybanClient();\n const auth = useKeybanAuth();\n\n const [data, error] = usePromise(\n `account:${auth.user?.sub}`,\n () => client.initialize(),\n { suspense: true },\n );\n\n return [data, error, undefined] as ApiResult<KeybanAccount>;\n}\n\n/**\n * Hook to retrieve and subscribe to the balance of a Keyban account.\n *\n * This React hook allows you to fetch the native balance of a Keyban account and automatically updates when the balance changes.\n * It returns an `ApiResult` tuple containing the balance or an error if one occurred during retrieval.\n * @param account - The `KeybanAccount` object representing the user account.\n * @returns - An `ApiResult<string>` tuple containing:\n * - **First element (`balance`)**: A `string` representing the account's native token balance in the smallest unit (e.g., wei for Ethereum). This value automatically updates when the balance changes.\n * - **Second element (`error`)**: An `Error` object if an error occurred during retrieval, or `null` if the balance was fetched successfully.\n *\n * **Return Structure:**\n * ```typescript\n * [balance: string, error: Error | null]\n * ```\n * - `balance`: The current balance of the Keyban account as a string.\n * - `error`: An `Error` object if there was an error fetching the balance, otherwise `null`.\n * @example\n * ```tsx\n * import { useKeybanAccount, useKeybanAccountBalance } from \"@keyban/sdk-react\";\n *\n * const AccountBalance: React.FC = () => {\n * const [account, accountError] = useKeybanAccount();\n * if (accountError) throw accountError;\n *\n * const [balance, balanceError] = useKeybanAccountBalance(account);\n * if (balanceError) throw balanceError;\n *\n * return <div>Balance: {balance}</div>;\n * };\n * ```\n * @remarks\n * - **Balance Format:** The balance is returned as a string representing the amount in the smallest denomination (e.g., wei). You may need to format it to a human-readable format (e.g., Ether) using utility functions.\n * - **Real-Time Updates:** The hook subscribes to balance changes, so your component will re-render automatically when the balance updates.\n * - **Error Handling:** Always check the `error` element to handle any issues that might occur during balance retrieval.\n * - Ensure that your component is wrapped within a `KeybanProvider` to have access to the Keyban client context.\n * @throws Will throw an error if used outside of a `KeybanProvider` or if there's an issue retrieving the balance.\n * @see {@link useKeybanAccount}\n * @see {@link KeybanAccount}\n */\nexport function useKeybanAccountBalance(\n account: KeybanAccount,\n): ApiResult<string> {\n const client = useKeybanClient();\n\n const { data, error } = useSuspenseQuery(walletBalanceDocument, {\n client: client.apolloClient,\n variables: { walletId: account.address },\n });\n\n useSubscription(walletSubscriptionDocument, {\n client: client.apolloClient,\n variables: {\n walletIds: [account.address],\n },\n onData({ client, data: { data } }) {\n // Setting up the subscription isn't enouth, in case of an insert, the\n // cache won't be updated.\n client.cache.updateQuery(\n {\n query: walletBalanceDocument,\n variables: { walletId: account.address },\n },\n () => ({ res: data!.sub!.entity