@aptos-labs/wallet-adapter-react 8.0.0-xchaininit2.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.tsx","../src/WalletProvider.tsx","../src/useWallet.tsx","../src/components/AboutAptosConnect.tsx","../src/graphics/LinkGraphic.tsx","../src/graphics/WalletGraphic.tsx","../src/graphics/Web3Graphic.tsx","../src/components/utils.tsx","../src/components/AboutPetraWeb.tsx","../src/components/AptosPrivacyPolicy.tsx","../src/graphics/SmallAptosLogo.tsx","../src/components/WalletItem.tsx"],"sourcesContent":["export * from \"@aptos-labs/wallet-adapter-core\";\nexport * from \"@aptos-labs/derived-wallet-solana\";\nexport * from \"@aptos-labs/derived-wallet-ethereum\";\nexport * from \"./WalletProvider\";\nexport * from \"./components/AboutAptosConnect\";\nexport * from \"./components/AboutPetraWeb\";\nexport * from \"./components/AptosPrivacyPolicy\";\nexport * from \"./components/WalletItem\";\nexport * from \"./useWallet\";\n","import {\n AvailableWallets,\n DappConfig,\n AccountInfo,\n AdapterWallet,\n NetworkInfo,\n InputTransactionData,\n AptosSignAndSubmitTransactionOutput,\n AnyRawTransaction,\n InputGenerateTransactionOptions,\n AccountAuthenticator,\n AptosSignMessageInput,\n AptosSignMessageOutput,\n AdapterNotDetectedWallet,\n WalletCore,\n Network,\n InputSubmitTransactionData,\n PendingTransactionResponse,\n WalletReadyState,\n AptosSignInInput,\n AptosSignInOutput,\n} from \"@aptos-labs/wallet-adapter-core\";\nimport { ReactNode, FC, useState, useEffect, useCallback, useRef } from \"react\";\nimport { WalletContext } from \"./useWallet\";\n\nexport interface AptosWalletProviderProps {\n children: ReactNode;\n optInWallets?: ReadonlyArray<AvailableWallets>;\n autoConnect?:\n | boolean\n | ((core: WalletCore, adapter: AdapterWallet) => Promise<boolean>);\n dappConfig?: DappConfig;\n disableTelemetry?: boolean;\n onError?: (error: any) => void;\n}\n\nconst initialState: {\n account: AccountInfo | null;\n network: NetworkInfo | null;\n connected: boolean;\n wallet: AdapterWallet | null;\n} = {\n connected: false,\n account: null,\n network: null,\n wallet: null,\n};\n\nexport const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({\n children,\n optInWallets,\n autoConnect = false,\n dappConfig,\n disableTelemetry = false,\n onError,\n}: AptosWalletProviderProps) => {\n const didAttemptAutoConnectRef = useRef(false);\n\n const [{ account, network, connected, wallet }, setState] =\n useState(initialState);\n\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [walletCore, setWalletCore] = useState<WalletCore>();\n\n const [wallets, setWallets] = useState<ReadonlyArray<AdapterWallet>>([]);\n const [notDetectedWallets, setNotDetectedWallets] = useState<\n ReadonlyArray<AdapterNotDetectedWallet>\n >([]);\n // Use a ref to ensure we only setup derivation once per mount/network change\n // or to prevent double-registration in strict mode\n const derivationInitialized = useRef(false);\n // Initialize WalletCore on first load\n useEffect(() => {\n const walletCore = new WalletCore(\n optInWallets,\n dappConfig,\n disableTelemetry\n );\n setWalletCore(walletCore);\n }, []);\n\n // Update initial Wallets state once WalletCore has been initialized\n useEffect(() => {\n setWallets(walletCore?.wallets ?? []);\n setNotDetectedWallets(walletCore?.notDetectedWallets ?? []);\n }, [walletCore]);\n\n useEffect(() => {\n // Only attempt to auto connect once per render and only if there are wallets\n if (didAttemptAutoConnectRef.current || !walletCore?.wallets.length) {\n return;\n }\n didAttemptAutoConnectRef.current = true;\n\n // If auto connect is not set or is false, ignore the attempt\n if (!autoConnect) {\n setIsLoading(false);\n return;\n }\n\n // Make sure the user has a previously connected wallet\n const walletName = localStorage.getItem(\"AptosWalletName\");\n if (!walletName) {\n setIsLoading(false);\n return;\n }\n\n // Make sure the wallet is installed\n const selectedWallet = walletCore.wallets.find(\n (e) => e.name === walletName\n ) as AdapterWallet | undefined;\n if (\n !selectedWallet ||\n selectedWallet.readyState !== WalletReadyState.Installed\n ) {\n setIsLoading(false);\n return;\n }\n\n if (!connected) {\n (async () => {\n try {\n let shouldConnect = true;\n\n // Providing a function to autoConnect allows the dapp to determine\n // whether to attempt to connect to the wallet using the `signIn`\n // or `connect` method. If `signIn` is successful, the user can\n // return `false` and skip the `connect` method.\n if (typeof autoConnect === \"function\") {\n shouldConnect = await autoConnect(walletCore, selectedWallet);\n } else {\n shouldConnect = autoConnect;\n }\n\n if (shouldConnect) await connect(walletName);\n } catch (error) {\n if (onError) onError(error);\n return Promise.reject(error);\n } finally {\n setIsLoading(false);\n }\n })();\n } else {\n setIsLoading(false);\n }\n }, [autoConnect, wallets]);\n\n useEffect(() => {\n // Only run if not already initialized or if you want to support network switching\n // Note: derived-wallet-solana might not support \"un-setting\" listeners easily.\n // If it's safe to call multiple times, this is fine.\n // Usually, these setup functions are idempotent or replace previous listeners.\n if (!derivationInitialized.current) {\n if (dappConfig?.crossChainWallets?.solana) {\n import(\"@aptos-labs/derived-wallet-solana\").then(\n ({ setupAutomaticSolanaWalletDerivation }) => {\n setupAutomaticSolanaWalletDerivation({\n defaultNetwork: dappConfig?.network,\n });\n }\n );\n }\n if (dappConfig?.crossChainWallets?.evm) {\n import(\"@aptos-labs/derived-wallet-ethereum\").then(\n ({ setupAutomaticEthereumWalletDerivation }) => {\n setupAutomaticEthereumWalletDerivation({\n defaultNetwork: dappConfig?.network,\n });\n }\n );\n }\n derivationInitialized.current = true;\n }\n }, [network]);\n\n const connect = async (walletName: string): Promise<void> => {\n try {\n setIsLoading(true);\n await walletCore?.connect(walletName);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n } finally {\n setIsLoading(false);\n }\n };\n\n const signIn = async (args: {\n walletName: string;\n input: AptosSignInInput;\n }): Promise<AptosSignInOutput> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n\n try {\n setIsLoading(true);\n return await walletCore?.signIn(args);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n } finally {\n setIsLoading(false);\n }\n };\n\n const disconnect = async (): Promise<void> => {\n try {\n await walletCore?.disconnect();\n } catch (error) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signAndSubmitTransaction = async (\n transaction: InputTransactionData\n ): Promise<AptosSignAndSubmitTransactionOutput> => {\n try {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n return await walletCore.signAndSubmitTransaction(transaction);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signTransaction = async (args: {\n transactionOrPayload: AnyRawTransaction | InputTransactionData;\n asFeePayer?: boolean;\n options?: InputGenerateTransactionOptions & {\n expirationSecondsFromNow?: number;\n expirationTimestamp?: number;\n };\n }): Promise<{\n authenticator: AccountAuthenticator;\n rawTransaction: Uint8Array;\n }> => {\n const { transactionOrPayload, asFeePayer, options } = args;\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore.signTransaction({\n transactionOrPayload,\n asFeePayer,\n });\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const submitTransaction = async (\n transaction: InputSubmitTransactionData\n ): Promise<PendingTransactionResponse> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.submitTransaction(transaction);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signMessage = async (\n message: AptosSignMessageInput\n ): Promise<AptosSignMessageOutput> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.signMessage(message);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signMessageAndVerify = async (\n message: AptosSignMessageInput\n ): Promise<boolean> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.signMessageAndVerify(message);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const changeNetwork = async (network: Network) => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.changeNetwork(network);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n // Handle the adapter's connect event\n const handleConnect = (): void => {\n setState((state) => {\n return {\n ...state,\n connected: true,\n account: walletCore?.account || null,\n network: walletCore?.network || null,\n wallet: walletCore?.wallet || null,\n };\n });\n };\n\n // Handle the adapter's account change event\n const handleAccountChange = useCallback((): void => {\n if (!connected) return;\n if (!walletCore?.wallet) return;\n setState((state) => {\n return {\n ...state,\n account: walletCore?.account || null,\n };\n });\n }, [connected]);\n\n // Handle the adapter's network event\n const handleNetworkChange = useCallback((): void => {\n if (!connected) return;\n if (!walletCore?.wallet) return;\n setState((state) => {\n return {\n ...state,\n network: walletCore?.network || null,\n };\n });\n }, [connected]);\n\n useEffect(() => {\n if (connected) {\n walletCore?.onAccountChange();\n walletCore?.onNetworkChange();\n }\n }, [connected]);\n\n // Handle the adapter's disconnect event\n const handleDisconnect = (): void => {\n if (!connected) return;\n setState((state) => {\n return {\n ...state,\n connected: false,\n account: walletCore?.account || null,\n network: walletCore?.network || null,\n wallet: null,\n };\n });\n };\n\n const handleStandardWalletsAdded = (standardWallet: AdapterWallet): void => {\n // Manage current wallet state by removing optional duplications\n // as new wallets are coming\n const existingWalletIndex = wallets.findIndex(\n (wallet) => wallet.name == standardWallet.name\n );\n if (existingWalletIndex !== -1) {\n // If wallet exists, replace it with the new wallet\n setWallets((wallets) => [\n ...wallets.slice(0, existingWalletIndex),\n standardWallet,\n ...wallets.slice(existingWalletIndex + 1),\n ]);\n } else {\n // If wallet doesn't exist, add it to the array\n setWallets((wallets) => [...wallets, standardWallet]);\n }\n };\n\n const handleStandardNotDetectedWalletsAdded = (\n notDetectedWallet: AdapterNotDetectedWallet\n ): void => {\n // Manage current wallet state by removing optional duplications\n // as new wallets are coming\n const existingWalletIndex = wallets.findIndex(\n (wallet) => wallet.name == notDetectedWallet.name\n );\n if (existingWalletIndex !== -1) {\n // If wallet exists, replace it with the new wallet\n setNotDetectedWallets((wallets) => [\n ...wallets.slice(0, existingWalletIndex),\n notDetectedWallet,\n ...wallets.slice(existingWalletIndex + 1),\n ]);\n } else {\n // If wallet doesn't exist, add it to the array\n setNotDetectedWallets((wallets) => [...wallets, notDetectedWallet]);\n }\n };\n\n useEffect(() => {\n walletCore?.on(\"connect\", handleConnect);\n walletCore?.on(\"accountChange\", handleAccountChange);\n walletCore?.on(\"networkChange\", handleNetworkChange);\n walletCore?.on(\"disconnect\", handleDisconnect);\n walletCore?.on(\"standardWalletsAdded\", handleStandardWalletsAdded);\n walletCore?.on(\n \"standardNotDetectedWalletAdded\",\n handleStandardNotDetectedWalletsAdded\n );\n return () => {\n walletCore?.off(\"connect\", handleConnect);\n walletCore?.off(\"accountChange\", handleAccountChange);\n walletCore?.off(\"networkChange\", handleNetworkChange);\n walletCore?.off(\"disconnect\", handleDisconnect);\n walletCore?.off(\"standardWalletsAdded\", handleStandardWalletsAdded);\n walletCore?.off(\n \"standardNotDetectedWalletAdded\",\n handleStandardNotDetectedWalletsAdded\n );\n };\n }, [wallets, account]);\n\n return (\n <WalletContext.Provider\n value={{\n connect,\n signIn,\n disconnect,\n signAndSubmitTransaction,\n signTransaction,\n signMessage,\n signMessageAndVerify,\n changeNetwork,\n submitTransaction,\n account,\n network,\n connected,\n wallet,\n wallets,\n notDetectedWallets,\n isLoading,\n }}\n >\n {children}\n </WalletContext.Provider>\n );\n};\n","import { useContext, createContext } from \"react\";\nimport {\n AccountAuthenticator,\n AccountInfo,\n AdapterWallet,\n AnyRawTransaction,\n AptosSignAndSubmitTransactionOutput,\n InputTransactionData,\n NetworkInfo,\n AptosSignMessageInput,\n AptosSignMessageOutput,\n AdapterNotDetectedWallet,\n Network,\n AptosChangeNetworkOutput,\n PendingTransactionResponse,\n InputSubmitTransactionData,\n AptosSignInInput,\n AptosSignInOutput,\n} from \"@aptos-labs/wallet-adapter-core\";\n\nexport interface WalletContextState {\n connected: boolean;\n isLoading: boolean;\n account: AccountInfo | null;\n network: NetworkInfo | null;\n connect(walletName: string): void;\n signIn(args: {\n walletName: string;\n input: AptosSignInInput;\n }): Promise<AptosSignInOutput | void>;\n signAndSubmitTransaction(\n transaction: InputTransactionData,\n ): Promise<AptosSignAndSubmitTransactionOutput>;\n signTransaction(args: {\n transactionOrPayload: AnyRawTransaction | InputTransactionData;\n asFeePayer?: boolean;\n }): Promise<{\n authenticator: AccountAuthenticator;\n rawTransaction: Uint8Array;\n }>;\n signMessage(message: AptosSignMessageInput): Promise<AptosSignMessageOutput>;\n signMessageAndVerify(message: AptosSignMessageInput): Promise<boolean>;\n disconnect(): void;\n changeNetwork(network: Network): Promise<AptosChangeNetworkOutput>;\n submitTransaction(\n transaction: InputSubmitTransactionData,\n ): Promise<PendingTransactionResponse>;\n wallet: AdapterWallet | null;\n wallets: ReadonlyArray<AdapterWallet>;\n notDetectedWallets: ReadonlyArray<AdapterNotDetectedWallet>;\n}\n\nconst DEFAULT_CONTEXT = {\n connected: false,\n};\n\nexport const WalletContext = createContext<WalletContextState>(\n DEFAULT_CONTEXT as WalletContextState,\n);\n\nexport function useWallet(): WalletContextState {\n const context = useContext(WalletContext);\n if (!context) {\n throw new Error(\"useWallet must be used within a WalletContextState\");\n }\n return context;\n}\n","import {\n Dispatch,\n ForwardRefExoticComponent,\n ReactNode,\n RefAttributes,\n SVGProps,\n SetStateAction,\n createContext,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { LinkGraphic } from \"../graphics/LinkGraphic\";\nimport { WalletGraphic } from \"../graphics/WalletGraphic\";\nimport { Web3Graphic } from \"../graphics/Web3Graphic\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nconst EXPLORE_ECOSYSTEM_URL =\n \"https://aptosnetwork.com/ecosystem/directory/category/defi\";\n\nconst AboutAptosConnectContext = createContext<{\n screenIndex: number;\n setScreenIndex: Dispatch<SetStateAction<number>>;\n} | null>(null);\n\nfunction useAboutAptosConnectContext(displayName: string) {\n const context = useContext(AboutAptosConnectContext);\n\n if (!context) {\n throw new Error(\n `\\`${displayName}\\` must be used within \\`AboutAptosConnect\\``,\n );\n }\n\n return context;\n}\n\nconst educationScreens = [\n {\n Graphic: LinkGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h3\", {\n children: \"A better way to login.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Petra Web is a web3 wallet that uses a Social Login to create accounts on the Aptos blockchain.\",\n }),\n },\n {\n Graphic: WalletGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"What is a wallet?\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Wallets are a secure way to send, receive, and interact with digital assets like cryptocurrencies & NFTs.\",\n }),\n },\n {\n Graphic: Web3Graphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"Explore more of web3.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children: (\n <>\n Petra Web lets you take one account across any application built on\n Aptos.{\" \"}\n <a\n href={EXPLORE_ECOSYSTEM_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Explore the ecosystem\n </a>\n .\n </>\n ),\n }),\n },\n];\n\nconst educationScreenIndicators = Array(educationScreens.length)\n .fill(null)\n .map((_, index) =>\n createHeadlessComponent(\n \"AboutAptosConnect.ScreenIndicator\",\n \"button\",\n (displayName) => {\n const context = useAboutAptosConnectContext(displayName);\n const isActive = context.screenIndex - 1 === index;\n\n return {\n \"aria-label\": `Go to screen ${index + 1}`,\n \"aria-current\": isActive ? \"step\" : undefined,\n \"data-active\": isActive || undefined,\n onClick: () => {\n context.setScreenIndex(index + 1);\n },\n };\n },\n ),\n );\n\n/** @deprecated Use {@link AboutPetraWebEducationScreen} instead. */\nexport interface AboutAptosConnectEducationScreen {\n /** A component that renders an SVG to illustrate the idea of the current screen. */\n Graphic: ForwardRefExoticComponent<\n Omit<SVGProps<SVGSVGElement>, \"ref\"> & RefAttributes<SVGSVGElement>\n >;\n /** A headless component that renders the title of the current screen. */\n Title: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLHeadingElement>\n >;\n /** A headless component that renders the description text of the current screen. */\n Description: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLParagraphElement>\n >;\n /** The index of the current education screen. */\n screenIndex: number;\n /** The total number of education screens. */\n totalScreens: number;\n /**\n * An array of headless components for indicating the current screen of the set.\n * Each indicator will navigate the user to the screen it represents when clicked.\n */\n screenIndicators: typeof educationScreenIndicators;\n /**\n * A function that navigates the user to the previous education screen.\n * If the user is on the first education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n back: () => void;\n /**\n * A function that navigates the user to the next education screen.\n * If the user is on the last education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n next: () => void;\n /** A function that navigates the user to the initial wallet selection screen. */\n cancel: () => void;\n}\n\n/** @deprecated Use {@link AboutPetraWebProps} instead. */\nexport interface AboutAptosConnectProps {\n /**\n * A function for defining how each education screen should be rendered.\n * Each screen is modeled as a uniform set of headless components and utilities\n * that allow you to construct your UI and apply your own styles.\n */\n renderEducationScreen: (\n screen: AboutAptosConnectEducationScreen,\n ) => ReactNode;\n /**\n * The initial wallet selection UI that will be replaced by the education\n * screens when `AboutAptosConnect.Trigger` is clicked.\n */\n children?: ReactNode;\n}\n\nconst Root = ({ renderEducationScreen, children }: AboutAptosConnectProps) => {\n const [screenIndex, setScreenIndex] = useState(0);\n\n const currentEducationScreen: AboutAptosConnectEducationScreen = useMemo(\n () =>\n educationScreens.map((screen, i) => ({\n ...screen,\n screenIndex: i,\n totalScreens: educationScreens.length,\n screenIndicators: educationScreenIndicators,\n back: () => {\n setScreenIndex(screenIndex - 1);\n },\n next: () => {\n setScreenIndex(\n screenIndex === educationScreens.length ? 0 : screenIndex + 1,\n );\n },\n cancel: () => {\n setScreenIndex(0);\n },\n }))[screenIndex - 1],\n [screenIndex],\n );\n\n return (\n <AboutAptosConnectContext.Provider value={{ screenIndex, setScreenIndex }}>\n {screenIndex === 0\n ? children\n : renderEducationScreen(currentEducationScreen)}\n </AboutAptosConnectContext.Provider>\n );\n};\nRoot.displayName = \"AboutAptosConnect\";\n\nconst Trigger = createHeadlessComponent(\n \"AboutAptosConnect.Trigger\",\n \"button\",\n (displayName) => {\n const context = useAboutAptosConnectContext(displayName);\n\n return {\n onClick: () => {\n context.setScreenIndex(1);\n },\n };\n },\n);\n\n/**\n * A headless component for rendering education screens that explain the basics\n * of Aptos Connect and web3 wallets.\n *\n * @deprecated Use {@link AboutPetraWeb} instead.\n */\nexport const AboutAptosConnect = Object.assign(Root, {\n Trigger,\n});\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const LinkGraphic = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(\n (props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"102\"\n height=\"132\"\n viewBox=\"0 0 102 132\"\n fill=\"none\"\n {...props}\n >\n <g stroke=\"currentColor\" strokeMiterlimit=\"10\">\n <path d=\"M59.633 80.66c11.742-2.814 17.48-7.018 20.925-13.254l17.518-31.69c6.257-11.317 2.142-25.55-9.189-31.798C82.737.53 75.723.188 69.593 2.398M60.7 69.565a14.09 14.09 0 0 1-6.907-1.767l-.228-.108\" />\n <path d=\"m52.365 41.075 12.507-22.627a14.146 14.146 0 0 1 4.727-5.062M32.407 118.619a14.139 14.139 0 0 1-7.034-1.768c-6.857-3.78-9.353-12.402-5.561-19.25l16.634-30.1a14.097 14.097 0 0 1 4.518-4.923\" />\n <path d=\"M41.211 78.85c11.332 6.248 25.583 2.14 31.84-9.177l17.518-31.691c6.256-11.317 2.142-25.55-9.19-31.798-6.085-3.357-13.018-3.724-19.104-1.59A23.31 23.31 0 0 0 49.541 15.36L36.863 38.298l7.989 5.036 12.506-22.627c3.786-6.848 12.419-9.34 19.276-5.554 6.856 3.78 9.353 12.402 5.561 19.25l-16.634 30.1c-3.785 6.848-12.418 9.341-19.275 5.555l-5.075 8.791ZM29.5 130.447c12.361-1.37 19.2-6.994 22.966-13.804l12.678-22.936-8.305-5.239\" />\n <path d=\"m55.72 61.947-.442.764 5.511-9.55c-6.901-3.806-18.65-3.124-27.105.814M44.85 43.523l7.635-2.486m-4.221 23.264 7.217-1.723m-9.316 7.517 7.59-2.405m-.562-12.156 7.508-2.221m10.136-51.32L62.761 4.43M49.642 90.778l7.514-2.26m.474 7.448 7.514-2.26m-50.306-60.13c7.135 0 12.918-5.776 12.918-12.9 0-7.126-5.783-12.902-12.918-12.902-7.134 0-12.917 5.776-12.917 12.901s5.783 12.901 12.918 12.901Z\" />\n <path d=\"M15.724 7.774h3.197c7.135 0 12.918 5.776 12.918 12.901 0 7.126-5.783 12.901-12.918 12.901h-3.425m65.112 66.935h3.198c7.135 0 12.918 5.775 12.918 12.901 0 7.125-5.783 12.9-12.918 12.9h-3.425\" />\n <path d=\"M79.717 126.312c7.135 0 12.918-5.775 12.918-12.9s-5.783-12.901-12.918-12.901c-7.134 0-12.917 5.776-12.917 12.901s5.783 12.9 12.917 12.9ZM53.281 55.414c-11.33-6.248-25.582-2.14-31.839 9.177L3.924 96.281c-6.257 11.318-2.142 25.55 9.189 31.799 11.331 6.248 25.582 2.139 31.839-9.177l12.677-22.937-7.988-5.036-12.507 22.627c-3.785 6.848-12.418 9.341-19.275 5.554-6.857-3.781-9.353-12.402-5.561-19.25l16.633-30.1c3.786-6.848 12.419-9.341 19.276-5.555l5.074-8.792Z\" />\n </g>\n </svg>\n );\n },\n);\nLinkGraphic.displayName = \"LinkGraphic\";\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const WalletGraphic = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(\n (props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"128\"\n height=\"102\"\n viewBox=\"0 0 128 102\"\n fill=\"none\"\n {...props}\n >\n <path\n fill=\"currentColor\"\n d=\"m.96 25.93-.36-.35.36.85v-.5Zm7.79-7.81v-.5h-.21l-.15.15.36.35ZM1.3 26.28l7.79-7.8-.7-.71-7.8 7.8.7.71Zm7.44-7.66H10v-1H8.75v1Zm29.22 6.8h-37v1h37.01v-1Z\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M82.25 26.08c0 12.25-9.92 22.2-22.14 22.2a22.17 22.17 0 0 1-22.14-22.2H1.1v74.82h118.02V26.08H82.25Zm44.33 67.02h.33V18.27h-5.7\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M74.52 42.92a22.4 22.4 0 0 1-11.43 3.3 22.5 22.5 0 0 1-22.46-22.53H9.52M119.22 101l7.78-7.82m-7.88-67.1 7.79-7.81m-44.78 7.72 2.73-2.3m-46.89 2.39 2.39-2.4\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M9.86 23.69V5.72h107.97v18.04H84.65\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M117.83 20.46h3.39V1H13.25v4.72M9.36 23.69h31.78\"\n />\n </svg>\n );\n },\n);\nWalletGraphic.displayName = \"WalletGraphic\";\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const Web3Graphic = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(\n (props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"142\"\n height=\"108\"\n viewBox=\"0 0 142 108\"\n fill=\"none\"\n {...props}\n >\n <g stroke=\"currentColor\" strokeLinejoin=\"round\">\n <path d=\"m91.26 35.8.06-10.46L71.3 1v10.53L87 30.5m-36.11 5.24-.06-10.45L71.3 1v10.53L55 30.5\" />\n <path d=\"M71 59.55V49.17L50.83 25.3l.06 10.45L57 42.5m14 17.05V49.18l20.33-23.84-.07 10.45L86 42M1 59.68l.22-9.07 35.33-19.8-.1 9L9 55\" />\n <path d=\"M36.55 30.8s-.08 5.92-.1 9l.1-9ZM71 59.51v-9.07L36.55 30.8l-.1 9L63.5 55\" />\n <path d=\"M71 59.51v-9.07L36.44 70.78l-.1 9.14L55.5 68.5\" />\n <path d=\"M1.22 50.6a77387.2 77387.2 0 0 0 35.22 20.18l-.1 9.14L1 59.68l.23-9.07h-.01ZM141 59.68l-.23-9.07-35.33-19.8.11 9L133 55\" />\n <path d=\"m105.44 30.8.11 9-.1-9Z\" />\n <path d=\"M71 59.51v-9.07l34.44-19.64.11 9L78.5 55\" />\n <path d=\"M71 59.51v-9.07l34.56 20.34.1 9.14L87 69\" />\n <path d=\"M140.78 50.6a78487.3 78487.3 0 0 1-35.23 20.18l.11 9.14L141 59.68l-.23-9.07ZM50.83 80.15l.06-6.33 20.1-23.38H71v9.26L55 79\" />\n <path d=\"M71.3 97.6 50.89 73.81l-.06 9.33L71.3 107v-9.4Zm20.03-14.5-.07-9.33L71 50.44v9.26l16 18.8\" />\n <path d=\"m71.3 97.6 19.96-23.83.06 9.33L71.3 107v-9.4Z\" />\n </g>\n </svg>\n );\n },\n);\nWeb3Graphic.displayName = \"Web3Graphic\";\n","import { Slot } from \"@radix-ui/react-slot\";\nimport { ReactNode, cloneElement, forwardRef, isValidElement } from \"react\";\n\nexport interface HeadlessComponentProps {\n /** A class name for styling the element. */\n className?: string;\n /**\n * Whether to render as the child element instead of the default element provided.\n * All props will be merged into the child element.\n */\n asChild?: boolean;\n children?: ReactNode;\n}\n\n/**\n * Gets an HTML element type from its tag name\n * @example\n * HTMLElementFromTag<\"img\"> // resolved type: HTMLImageElement\n */\ntype HTMLElementFromTag<T extends keyof JSX.IntrinsicElements> =\n JSX.IntrinsicElements[T] extends React.ClassAttributes<infer Element>\n ? Element\n : HTMLElement;\n\nexport function createHeadlessComponent<\n TElement extends keyof JSX.IntrinsicElements,\n>(\n displayName: string,\n elementType: TElement,\n props?:\n | JSX.IntrinsicElements[TElement]\n | ((displayName: string) => JSX.IntrinsicElements[TElement]),\n) {\n const component = forwardRef<\n HTMLElementFromTag<TElement>,\n HeadlessComponentProps\n >(({ className, asChild, children }, ref) => {\n const Component = asChild ? Slot : elementType;\n\n const { children: defaultChildren, ...resolvedProps } =\n typeof props === \"function\" ? props(displayName) : (props ?? {});\n const resolvedChildren =\n /**\n * Use props' default children if no children are set in the component element's children and when asChild is true.\n */\n asChild && isValidElement(children) && !children.props.children\n ? cloneElement(children, {}, defaultChildren)\n : (children ?? defaultChildren);\n\n return (\n /**\n * Due to the complexity of the types at play, TypeScript reports the\n * following error for our JSX below:\n *\n * `Expression produces a union type that is too complex to represent.`\n *\n * We can safely ignore this error and retain accurate return types for\n * consumers of this function. The only drawback is that type-checking is\n * ignored for the JSX block below.\n */\n // @ts-expect-error\n <Component ref={ref} className={className} {...resolvedProps}>\n {resolvedChildren}\n </Component>\n );\n });\n component.displayName = displayName;\n\n return component;\n}\n","import {\n Dispatch,\n ForwardRefExoticComponent,\n ReactNode,\n RefAttributes,\n SVGProps,\n SetStateAction,\n createContext,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { LinkGraphic } from \"../graphics/LinkGraphic\";\nimport { WalletGraphic } from \"../graphics/WalletGraphic\";\nimport { Web3Graphic } from \"../graphics/Web3Graphic\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nexport const EXPLORE_ECOSYSTEM_URL =\n \"https://aptosnetwork.com/ecosystem/directory/category/defi\";\n\nconst AboutPetraWebContext = createContext<{\n screenIndex: number;\n setScreenIndex: Dispatch<SetStateAction<number>>;\n} | null>(null);\n\nfunction useAboutPetraWebContext(displayName: string) {\n const context = useContext(AboutPetraWebContext);\n\n if (!context) {\n throw new Error(`\\`${displayName}\\` must be used within \\`AboutPetraWeb\\``);\n }\n\n return context;\n}\n\nconst educationScreens = [\n {\n Graphic: LinkGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h3\", {\n children: \"A better way to login.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Petra Web is a web3 wallet that uses a Social Login to create accounts on the Aptos blockchain.\",\n }),\n },\n {\n Graphic: WalletGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"What is a wallet?\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Wallets are a secure way to send, receive, and interact with digital assets like cryptocurrencies & NFTs.\",\n }),\n },\n {\n Graphic: Web3Graphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"Explore more of web3.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children: (\n <>\n Petra Web lets you take one account across any application built on\n Aptos.{\" \"}\n <a\n href={EXPLORE_ECOSYSTEM_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Explore the ecosystem\n </a>\n .\n </>\n ),\n }),\n },\n];\n\nconst educationScreenIndicators = Array(educationScreens.length)\n .fill(null)\n .map((_, index) =>\n createHeadlessComponent(\n \"AboutPetraWeb.ScreenIndicator\",\n \"button\",\n (displayName) => {\n const context = useAboutPetraWebContext(displayName);\n const isActive = context.screenIndex - 1 === index;\n\n return {\n \"aria-label\": `Go to screen ${index + 1}`,\n \"aria-current\": isActive ? \"step\" : undefined,\n \"data-active\": isActive || undefined,\n onClick: () => {\n context.setScreenIndex(index + 1);\n },\n };\n },\n ),\n );\n\nexport interface AboutPetraWebEducationScreen {\n /** A component that renders an SVG to illustrate the idea of the current screen. */\n Graphic: ForwardRefExoticComponent<\n Omit<SVGProps<SVGSVGElement>, \"ref\"> & RefAttributes<SVGSVGElement>\n >;\n /** A headless component that renders the title of the current screen. */\n Title: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLHeadingElement>\n >;\n /** A headless component that renders the description text of the current screen. */\n Description: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLParagraphElement>\n >;\n /** The index of the current education screen. */\n screenIndex: number;\n /** The total number of education screens. */\n totalScreens: number;\n /**\n * An array of headless components for indicating the current screen of the set.\n * Each indicator will navigate the user to the screen it represents when clicked.\n */\n screenIndicators: typeof educationScreenIndicators;\n /**\n * A function that navigates the user to the previous education screen.\n * If the user is on the first education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n back: () => void;\n /**\n * A function that navigates the user to the next education screen.\n * If the user is on the last education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n next: () => void;\n /** A function that navigates the user to the initial wallet selection screen. */\n cancel: () => void;\n}\n\nexport interface AboutPetraWebProps {\n /**\n * A function for defining how each education screen should be rendered.\n * Each screen is modeled as a uniform set of headless components and utilities\n * that allow you to construct your UI and apply your own styles.\n */\n renderEducationScreen: (screen: AboutPetraWebEducationScreen) => ReactNode;\n /**\n * The initial wallet selection UI that will be replaced by the education\n * screens when `AboutPetraWeb.Trigger` is clicked.\n */\n children?: ReactNode;\n}\n\nconst Root = ({ renderEducationScreen, children }: AboutPetraWebProps) => {\n const [screenIndex, setScreenIndex] = useState(0);\n\n const currentEducationScreen: AboutPetraWebEducationScreen = useMemo(\n () =>\n educationScreens.map((screen, i) => ({\n ...screen,\n screenIndex: i,\n totalScreens: educationScreens.length,\n screenIndicators: educationScreenIndicators,\n back: () => {\n setScreenIndex(screenIndex - 1);\n },\n next: () => {\n setScreenIndex(\n screenIndex === educationScreens.length ? 0 : screenIndex + 1,\n );\n },\n cancel: () => {\n setScreenIndex(0);\n },\n }))[screenIndex - 1],\n [screenIndex],\n );\n\n return (\n <AboutPetraWebContext.Provider value={{ screenIndex, setScreenIndex }}>\n {screenIndex === 0\n ? children\n : renderEducationScreen(currentEducationScreen)}\n </AboutPetraWebContext.Provider>\n );\n};\nRoot.displayName = \"AboutPetraWeb\";\n\nconst Trigger = createHeadlessComponent(\n \"AboutPetraWeb.Trigger\",\n \"button\",\n (displayName) => {\n const context = useAboutPetraWebContext(displayName);\n\n return {\n onClick: () => {\n context.setScreenIndex(1);\n },\n };\n },\n);\n\n/**\n * A headless component for rendering education screens that explain the basics\n * of Petra Web and web3 wallets.\n */\nexport const AboutPetraWeb = Object.assign(Root, {\n Trigger,\n});\n","import { forwardRef } from \"react\";\nimport { SmallAptosLogo } from \"../graphics/SmallAptosLogo\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nexport const APTOS_PRIVACY_POLICY_URL = \"https://aptoslabs.com/privacy\";\n\nconst Root = createHeadlessComponent(\"AptosPrivacyPolicy.Root\", \"div\");\n\nconst Disclaimer = createHeadlessComponent(\n \"AptosPrivacyPolicy.Disclaimer\",\n \"span\",\n { children: \"By continuing, you agree to Aptos Labs'\" },\n);\n\nconst Link = createHeadlessComponent(\"AptosPrivacyPolicy.Disclaimer\", \"a\", {\n href: APTOS_PRIVACY_POLICY_URL,\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n children: \"Privacy Policy\",\n});\n\nconst PoweredBy = forwardRef<\n HTMLDivElement,\n Pick<HeadlessComponentProps, \"className\">\n>(({ className }, ref) => {\n return (\n <div ref={ref} className={className}>\n <span>Powered by</span>\n <SmallAptosLogo />\n <span>Aptos Labs</span>\n </div>\n );\n});\nPoweredBy.displayName = \"AptosPrivacyPolicy.PoweredBy\";\n\n/**\n * A headless component for rendering the Aptos Labs privacy policy disclaimer\n * that should be placed under the Petra Web login options.\n */\nexport const AptosPrivacyPolicy = Object.assign(Root, {\n Disclaimer,\n Link,\n PoweredBy,\n});\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const SmallAptosLogo = forwardRef<\n SVGSVGElement,\n SVGProps<SVGSVGElement>\n>((props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 12 12\"\n fill=\"none\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM7.17547 3.67976C7.13401 3.72309 7.07649 3.74757 7.01648 3.74757H3.00775C3.69185 2.83824 4.77995 2.25 6.00569 2.25C7.23142 2.25 8.31953 2.83824 9.00362 3.74757H8.28524C8.20824 3.74757 8.13498 3.71468 8.08401 3.65701L7.81608 3.35416C7.77618 3.30896 7.71882 3.28308 7.6585 3.28308H7.6454C7.58805 3.28308 7.53318 3.30646 7.49343 3.34792L7.17547 3.67976ZM8.05656 4.75897H7.39569C7.31869 4.75897 7.24543 4.72593 7.19447 4.66842L6.92638 4.36557C6.88647 4.32036 6.82896 4.29465 6.7688 4.29465C6.70863 4.29465 6.65112 4.32052 6.61121 4.36557L6.38131 4.6254C6.30603 4.71034 6.19801 4.75913 6.08454 4.75913H2.46703C2.36401 5.05278 2.29683 5.36296 2.27002 5.68467H5.68505C5.74506 5.68467 5.80258 5.66019 5.84404 5.61686L6.16201 5.28502C6.20175 5.24356 6.25662 5.22018 6.31398 5.22018H6.32707C6.38739 5.22018 6.44475 5.24606 6.48465 5.29126L6.75258 5.59411C6.80355 5.65178 6.87681 5.68467 6.95381 5.68467H9.74133C9.71452 5.3628 9.64734 5.05263 9.54431 4.75913H8.05641L8.05656 4.75897ZM4.33651 7.63095C4.39652 7.63095 4.45404 7.60648 4.4955 7.56315L4.81347 7.23131C4.85321 7.18985 4.90808 7.16647 4.96544 7.16647H4.97853C5.03885 7.16647 5.09621 7.19234 5.13611 7.23739L5.40404 7.54024C5.45501 7.59791 5.52827 7.6308 5.60527 7.6308H9.38285C9.52438 7.33839 9.62803 7.02463 9.68975 6.69591H6.06383C5.98683 6.69591 5.91357 6.66287 5.8626 6.60535L5.59467 6.3025C5.55477 6.2573 5.49725 6.23158 5.43709 6.23158C5.37692 6.23158 5.31941 6.25746 5.27951 6.3025L5.0496 6.56233C4.97432 6.64728 4.86631 6.69606 4.75268 6.69606H2.32147C2.3832 7.02479 2.487 7.33855 2.62837 7.63095H4.33651ZM5.57359 8.55745H4.59116C4.51417 8.55745 4.44091 8.52441 4.38994 8.46689L4.12201 8.16404C4.0821 8.11884 4.02459 8.09312 3.96442 8.09312C3.90426 8.09312 3.84675 8.119 3.80684 8.16404L3.57694 8.42387C3.50166 8.50882 3.39364 8.55761 3.28001 8.55761H3.26474C3.94915 9.29096 4.92378 9.74998 6.00596 9.74998C7.08815 9.74998 8.06262 9.29096 8.74719 8.55761H5.57359V8.55745Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n});\nSmallAptosLogo.displayName = \"SmallAptosLogo\";\n","import {\n AdapterNotDetectedWallet,\n AdapterWallet,\n WalletReadyState,\n isRedirectable,\n} from \"@aptos-labs/wallet-adapter-core\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { createContext, forwardRef, useCallback, useContext } from \"react\";\nimport { useWallet } from \"../useWallet\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nexport interface WalletItemProps extends HeadlessComponentProps {\n /** The wallet option to be displayed. */\n wallet: AdapterWallet | AdapterNotDetectedWallet;\n /** A callback to be invoked when the wallet is connected. */\n onConnect?: () => void;\n}\n\nfunction useWalletItemContext(displayName: string) {\n const context = useContext(WalletItemContext);\n\n if (!context) {\n throw new Error(`\\`${displayName}\\` must be used within \\`WalletItem\\``);\n }\n\n return context;\n}\n\nconst WalletItemContext = createContext<{\n wallet: AdapterWallet | AdapterNotDetectedWallet;\n connectWallet: () => void;\n} | null>(null);\n\nconst Root = forwardRef<HTMLDivElement, WalletItemProps>(\n ({ wallet, onConnect, className, asChild, children }, ref) => {\n const { connect } = useWallet();\n\n const connectWallet = useCallback(() => {\n connect(wallet.name);\n onConnect?.();\n }, [connect, wallet.name, onConnect]);\n\n const isWalletReady = wallet.readyState === WalletReadyState.Installed;\n\n const mobileSupport =\n \"deeplinkProvider\" in wallet && wallet.deeplinkProvider;\n\n if (!isWalletReady && isRedirectable() && !mobileSupport) return null;\n\n const Component = asChild ? Slot : \"div\";\n\n return (\n <WalletItemContext.Provider value={{ wallet, connectWallet }}>\n <Component ref={ref} className={className}>\n {children}\n </Component>\n </WalletItemContext.Provider>\n );\n },\n);\nRoot.displayName = \"WalletItem\";\n\nconst Icon = createHeadlessComponent(\n \"WalletItem.Icon\",\n \"img\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n src: context.wallet.icon,\n alt: `${context.wallet.name} icon`,\n };\n },\n);\n\nconst Name = createHeadlessComponent(\n \"WalletItem.Name\",\n \"div\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n children: context.wallet.name,\n };\n },\n);\n\nconst ConnectButton = createHeadlessComponent(\n \"WalletItem.ConnectButton\",\n \"button\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n onClick: context.connectWallet,\n children: \"Connect\",\n };\n },\n);\n\nconst InstallLink = createHeadlessComponent(\n \"WalletItem.InstallLink\",\n \"a\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n href: context.wallet.url,\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n children: \"Install\",\n };\n },\n);\n\n/** A headless component for rendering a wallet option's name, icon, and either connect button or install link. */\nexport const WalletItem = Object.assign(Root, {\n Icon,\n Name,\n ConnectButton,\n InstallLink,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,cAAc;AACd,cAAc;;;ACFd;AAAA,EAcE;AAAA,EAIA;AAAA,OAGK;AACP,SAAwB,UAAU,WAAW,aAAa,cAAc;;;ACtBxE,SAAS,YAAY,qBAAqB;AAoD1C,IAAM,kBAAkB;AAAA,EACtB,WAAW;AACb;AAEO,IAAM,gBAAgB;AAAA,EAC3B;AACF;AAEO,SAAS,YAAgC;AAC9C,QAAM,UAAU,WAAW,aAAa;AACxC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAO;AACT;;;AD6WI;AA3YJ,IAAM,eAKF;AAAA,EACF,WAAW;AAAA,EACX,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV;AAEO,IAAM,6BAA2D,CAAC;AAAA,EACvE;AAAA,EACA;AAA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,OAAO;AAAA,MACpB,KAAK,GAAG,QAAQ,OAAO,IAAI;AAAA,IAC7B;AAAA,EACF;AACF;AAEA,IAAM,OAAO;AAAA,EACX;AAAA,EACA;AAAA,EACA,CAAC,gBAAgB;AACf,UAAM,UAAU,qBAAqB,WAAW;AAEhD,WAAO;AAAA,MACL,UAAU,QAAQ,OAAO;AAAA,IAC3B;AAAA,EACF;AACF;AAEA,IAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA,CAAC,gBAAgB;AACf,UAAM,UAAU,qBAAqB,WAAW;AAEhD,WAAO;AAAA,MACL,SAAS,QAAQ;AAAA,MACjB,UAAU;AAAA,IACZ;AAAA,EACF;AACF;AAEA,IAAM,cAAc;AAAA,EAClB;AAAA,EACA;AAAA,EACA,CAAC,gBAAgB;AACf,UAAM,UAAU,qBAAqB,WAAW;AAEhD,WAAO;AAAA,MACL,MAAM,QAAQ,OAAO;AAAA,MACrB,QAAQ;AAAA,MACR,KAAK;AAAA,MACL,UAAU;AAAA,IACZ;AAAA,EACF;AACF;AAGO,IAAM,aAAa,OAAO,OAAOA,OAAM;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":["walletCore","network","wallet","wallets","createContext","useContext","useState","jsx","forwardRef","jsx","jsxs","forwardRef","forwardRef","jsx","jsxs","forwardRef","forwardRef","jsx","forwardRef","jsx","jsxs","createContext","useContext","useState","createContext","useContext","useMemo","useState","Fragment","jsx","jsxs","EXPLORE_ECOSYSTEM_URL","createContext","useContext","educationScreens","educationScreenIndicators","Root","useState","useMemo","Trigger","forwardRef","forwardRef","jsx","forwardRef","jsx","jsxs","Root","forwardRef","WalletReadyState","Slot","createContext","forwardRef","useCallback","useContext","jsx","useContext","createContext","Root","forwardRef","useCallback","WalletReadyState","Slot"]}
1
+ {"version":3,"sources":["../src/index.tsx","../src/WalletProvider.tsx","../src/useWallet.tsx","../src/components/AboutAptosConnect.tsx","../src/graphics/LinkGraphic.tsx","../src/graphics/WalletGraphic.tsx","../src/graphics/Web3Graphic.tsx","../src/components/utils.tsx","../src/components/AboutPetraWeb.tsx","../src/components/AptosPrivacyPolicy.tsx","../src/graphics/SmallAptosLogo.tsx","../src/components/WalletItem.tsx"],"sourcesContent":["export * from \"@aptos-labs/wallet-adapter-core\";\nexport * from \"./WalletProvider\";\nexport * from \"./components/AboutAptosConnect\";\nexport * from \"./components/AboutPetraWeb\";\nexport * from \"./components/AptosPrivacyPolicy\";\nexport * from \"./components/WalletItem\";\nexport * from \"./useWallet\";\n","import {\n AvailableWallets,\n DappConfig,\n AccountInfo,\n AdapterWallet,\n NetworkInfo,\n InputTransactionData,\n AptosSignAndSubmitTransactionOutput,\n AnyRawTransaction,\n InputGenerateTransactionOptions,\n AccountAuthenticator,\n AptosSignMessageInput,\n AptosSignMessageOutput,\n AdapterNotDetectedWallet,\n WalletCore,\n Network,\n InputSubmitTransactionData,\n PendingTransactionResponse,\n WalletReadyState,\n AptosSignInInput,\n AptosSignInOutput,\n} from \"@aptos-labs/wallet-adapter-core\";\nimport { ReactNode, FC, useState, useEffect, useCallback, useRef } from \"react\";\nimport { WalletContext } from \"./useWallet\";\n\nexport interface AptosWalletProviderProps {\n children: ReactNode;\n optInWallets?: ReadonlyArray<AvailableWallets>;\n hideWallets?: ReadonlyArray<AvailableWallets>;\n autoConnect?:\n | boolean\n | ((core: WalletCore, adapter: AdapterWallet) => Promise<boolean>);\n dappConfig?: DappConfig;\n disableTelemetry?: boolean;\n onError?: (error: any) => void;\n}\n\nconst initialState: {\n account: AccountInfo | null;\n network: NetworkInfo | null;\n connected: boolean;\n wallet: AdapterWallet | null;\n} = {\n connected: false,\n account: null,\n network: null,\n wallet: null,\n};\n\nexport const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({\n children,\n optInWallets,\n hideWallets,\n autoConnect = false,\n dappConfig,\n disableTelemetry = false,\n onError,\n}: AptosWalletProviderProps) => {\n const didAttemptAutoConnectRef = useRef(false);\n\n const [{ account, network, connected, wallet }, setState] =\n useState(initialState);\n\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [walletCore, setWalletCore] = useState<WalletCore>();\n\n const [wallets, setWallets] = useState<ReadonlyArray<AdapterWallet>>([]);\n const [hiddenWallets, setHiddenWallets] = useState<\n ReadonlyArray<AdapterWallet>\n >([]);\n const [notDetectedWallets, setNotDetectedWallets] = useState<\n ReadonlyArray<AdapterNotDetectedWallet>\n >([]);\n // Use a ref to ensure we only setup derivation once per mount/network change\n // or to prevent double-registration in strict mode\n const derivationInitialized = useRef(false);\n // Initialize WalletCore on first load\n useEffect(() => {\n const walletCore = new WalletCore(\n optInWallets,\n dappConfig,\n disableTelemetry,\n hideWallets ? hideWallets : [\"Petra Web\"],\n );\n setWalletCore(walletCore);\n }, []);\n\n // Update initial Wallets state once WalletCore has been initialized\n useEffect(() => {\n setWallets(walletCore?.wallets ?? []);\n setHiddenWallets(walletCore?.hiddenWallets ?? []);\n setNotDetectedWallets(walletCore?.notDetectedWallets ?? []);\n }, [walletCore]);\n\n useEffect(() => {\n // Only attempt to auto connect once per render and only if there are wallets\n if (didAttemptAutoConnectRef.current || !walletCore?.wallets.length) {\n return;\n }\n didAttemptAutoConnectRef.current = true;\n\n // If auto connect is not set or is false, ignore the attempt\n if (!autoConnect) {\n setIsLoading(false);\n return;\n }\n\n // Make sure the user has a previously connected wallet\n const walletName = localStorage.getItem(\"AptosWalletName\");\n if (!walletName) {\n setIsLoading(false);\n return;\n }\n\n // Make sure the wallet is installed\n const selectedWallet = walletCore.wallets.find(\n (e) => e.name === walletName,\n ) as AdapterWallet | undefined;\n if (\n !selectedWallet ||\n selectedWallet.readyState !== WalletReadyState.Installed\n ) {\n setIsLoading(false);\n return;\n }\n\n if (!connected) {\n (async () => {\n try {\n let shouldConnect = true;\n\n // Providing a function to autoConnect allows the dapp to determine\n // whether to attempt to connect to the wallet using the `signIn`\n // or `connect` method. If `signIn` is successful, the user can\n // return `false` and skip the `connect` method.\n if (typeof autoConnect === \"function\") {\n shouldConnect = await autoConnect(walletCore, selectedWallet);\n } else {\n shouldConnect = autoConnect;\n }\n\n if (shouldConnect) await connect(walletName);\n } catch (error) {\n if (onError) onError(error);\n return Promise.reject(error);\n } finally {\n setIsLoading(false);\n }\n })();\n } else {\n setIsLoading(false);\n }\n }, [autoConnect, wallets]);\n\n useEffect(() => {\n // Initialize cross-chain wallet support based on dappConfig flags.\n // Dynamically imports the packages to avoid bundling them when not used.\n if (!derivationInitialized.current) {\n // Use a wrapper function to prevent bundlers from statically analyzing the import\n const dynamicImport = (moduleName: string) =>\n new Function(\"m\", \"return import(m)\")(moduleName) as Promise<any>;\n\n if (dappConfig?.crossChainWallets?.solana) {\n import(\"@aptos-labs/derived-wallet-solana\").then(\n ({ setupAutomaticSolanaWalletDerivation }) => {\n setupAutomaticSolanaWalletDerivation({\n defaultNetwork: dappConfig?.network,\n });\n },\n );\n }\n if (dappConfig?.crossChainWallets?.evm) {\n dynamicImport(\"@aptos-labs/derived-wallet-ethereum\").then(\n ({ setupAutomaticEthereumWalletDerivation }) => {\n setupAutomaticEthereumWalletDerivation({\n defaultNetwork: dappConfig?.network,\n });\n },\n );\n }\n derivationInitialized.current = true;\n }\n }, [network]);\n\n const connect = async (walletName: string): Promise<void> => {\n try {\n setIsLoading(true);\n await walletCore?.connect(walletName);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n } finally {\n setIsLoading(false);\n }\n };\n\n const signIn = async (args: {\n walletName: string;\n input: AptosSignInInput;\n }): Promise<AptosSignInOutput> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n\n try {\n setIsLoading(true);\n return await walletCore?.signIn(args);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n } finally {\n setIsLoading(false);\n }\n };\n\n const disconnect = async (): Promise<void> => {\n try {\n await walletCore?.disconnect();\n } catch (error) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signAndSubmitTransaction = async (\n transaction: InputTransactionData,\n ): Promise<AptosSignAndSubmitTransactionOutput> => {\n try {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n return await walletCore.signAndSubmitTransaction(transaction);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signTransaction = async (args: {\n transactionOrPayload: AnyRawTransaction | InputTransactionData;\n asFeePayer?: boolean;\n options?: InputGenerateTransactionOptions & {\n expirationSecondsFromNow?: number;\n expirationTimestamp?: number;\n };\n }): Promise<{\n authenticator: AccountAuthenticator;\n rawTransaction: Uint8Array;\n }> => {\n const { transactionOrPayload, asFeePayer, options } = args;\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore.signTransaction({\n transactionOrPayload,\n asFeePayer,\n });\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const submitTransaction = async (\n transaction: InputSubmitTransactionData,\n ): Promise<PendingTransactionResponse> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.submitTransaction(transaction);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signMessage = async (\n message: AptosSignMessageInput,\n ): Promise<AptosSignMessageOutput> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.signMessage(message);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signMessageAndVerify = async (\n message: AptosSignMessageInput,\n ): Promise<boolean> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.signMessageAndVerify(message);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const changeNetwork = async (network: Network) => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.changeNetwork(network);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n // Handle the adapter's connect event\n const handleConnect = (): void => {\n setState((state) => {\n return {\n ...state,\n connected: true,\n account: walletCore?.account || null,\n network: walletCore?.network || null,\n wallet: walletCore?.wallet || null,\n };\n });\n };\n\n // Handle the adapter's account change event\n const handleAccountChange = useCallback((): void => {\n if (!connected) return;\n if (!walletCore?.wallet) return;\n setState((state) => {\n return {\n ...state,\n account: walletCore?.account || null,\n };\n });\n }, [connected]);\n\n // Handle the adapter's network event\n const handleNetworkChange = useCallback((): void => {\n if (!connected) return;\n if (!walletCore?.wallet) return;\n setState((state) => {\n return {\n ...state,\n network: walletCore?.network || null,\n };\n });\n }, [connected]);\n\n useEffect(() => {\n if (connected) {\n walletCore?.onAccountChange();\n walletCore?.onNetworkChange();\n }\n }, [connected]);\n\n // Handle the adapter's disconnect event\n const handleDisconnect = (): void => {\n if (!connected) return;\n setState((state) => {\n return {\n ...state,\n connected: false,\n account: walletCore?.account || null,\n network: walletCore?.network || null,\n wallet: null,\n };\n });\n };\n\n const handleStandardWalletsAdded = (standardWallet: AdapterWallet): void => {\n // Manage current wallet state by removing optional duplications\n // as new wallets are coming\n const existingWalletIndex = wallets.findIndex(\n (wallet) => wallet.name == standardWallet.name,\n );\n if (existingWalletIndex !== -1) {\n // If wallet exists, replace it with the new wallet\n setWallets((wallets) => [\n ...wallets.slice(0, existingWalletIndex),\n standardWallet,\n ...wallets.slice(existingWalletIndex + 1),\n ]);\n } else {\n // If wallet doesn't exist, add it to the array\n setWallets((wallets) => [...wallets, standardWallet]);\n }\n };\n\n const handleStandardWalletsHiddenAdded = (\n standardWallet: AdapterWallet,\n ): void => {\n // Manage hidden wallet state by removing optional duplications\n // as new wallets are coming\n const existingWalletIndex = hiddenWallets.findIndex(\n (wallet) => wallet.name === standardWallet.name,\n );\n if (existingWalletIndex !== -1) {\n // If wallet exists, replace it with the new wallet\n setHiddenWallets((hiddenWallets) => [\n ...hiddenWallets.slice(0, existingWalletIndex),\n standardWallet,\n ...hiddenWallets.slice(existingWalletIndex + 1),\n ]);\n } else {\n // If wallet doesn't exist, add it to the array\n setHiddenWallets((hiddenWallets) => [...hiddenWallets, standardWallet]);\n }\n };\n\n const handleStandardNotDetectedWalletsAdded = (\n notDetectedWallet: AdapterNotDetectedWallet,\n ): void => {\n // Manage current wallet state by removing optional duplications\n // as new wallets are coming\n const existingWalletIndex = wallets.findIndex(\n (wallet) => wallet.name == notDetectedWallet.name,\n );\n if (existingWalletIndex !== -1) {\n // If wallet exists, replace it with the new wallet\n setNotDetectedWallets((wallets) => [\n ...wallets.slice(0, existingWalletIndex),\n notDetectedWallet,\n ...wallets.slice(existingWalletIndex + 1),\n ]);\n } else {\n // If wallet doesn't exist, add it to the array\n setNotDetectedWallets((wallets) => [...wallets, notDetectedWallet]);\n }\n };\n\n useEffect(() => {\n walletCore?.on(\"connect\", handleConnect);\n walletCore?.on(\"accountChange\", handleAccountChange);\n walletCore?.on(\"networkChange\", handleNetworkChange);\n walletCore?.on(\"disconnect\", handleDisconnect);\n walletCore?.on(\"standardWalletsAdded\", handleStandardWalletsAdded);\n walletCore?.on(\n \"standardWalletsHiddenAdded\",\n handleStandardWalletsHiddenAdded,\n );\n walletCore?.on(\n \"standardNotDetectedWalletAdded\",\n handleStandardNotDetectedWalletsAdded,\n );\n return () => {\n walletCore?.off(\"connect\", handleConnect);\n walletCore?.off(\"accountChange\", handleAccountChange);\n walletCore?.off(\"networkChange\", handleNetworkChange);\n walletCore?.off(\"disconnect\", handleDisconnect);\n walletCore?.off(\"standardWalletsAdded\", handleStandardWalletsAdded);\n walletCore?.off(\n \"standardWalletsHiddenAdded\",\n handleStandardWalletsHiddenAdded,\n );\n walletCore?.off(\n \"standardNotDetectedWalletAdded\",\n handleStandardNotDetectedWalletsAdded,\n );\n };\n }, [wallets, account]);\n\n return (\n <WalletContext.Provider\n value={{\n connect,\n signIn,\n disconnect,\n signAndSubmitTransaction,\n signTransaction,\n signMessage,\n signMessageAndVerify,\n changeNetwork,\n submitTransaction,\n account,\n network,\n connected,\n wallet,\n wallets,\n notDetectedWallets,\n hiddenWallets,\n isLoading,\n }}\n >\n {children}\n </WalletContext.Provider>\n );\n};\n","import { useContext, createContext } from \"react\";\nimport {\n AccountAuthenticator,\n AccountInfo,\n AdapterWallet,\n AnyRawTransaction,\n AptosSignAndSubmitTransactionOutput,\n InputTransactionData,\n NetworkInfo,\n AptosSignMessageInput,\n AptosSignMessageOutput,\n AdapterNotDetectedWallet,\n Network,\n AptosChangeNetworkOutput,\n PendingTransactionResponse,\n InputSubmitTransactionData,\n AptosSignInInput,\n AptosSignInOutput,\n} from \"@aptos-labs/wallet-adapter-core\";\n\nexport interface WalletContextState {\n connected: boolean;\n isLoading: boolean;\n account: AccountInfo | null;\n network: NetworkInfo | null;\n connect(walletName: string): void;\n signIn(args: {\n walletName: string;\n input: AptosSignInInput;\n }): Promise<AptosSignInOutput | void>;\n signAndSubmitTransaction(\n transaction: InputTransactionData,\n ): Promise<AptosSignAndSubmitTransactionOutput>;\n signTransaction(args: {\n transactionOrPayload: AnyRawTransaction | InputTransactionData;\n asFeePayer?: boolean;\n }): Promise<{\n authenticator: AccountAuthenticator;\n rawTransaction: Uint8Array;\n }>;\n signMessage(message: AptosSignMessageInput): Promise<AptosSignMessageOutput>;\n signMessageAndVerify(message: AptosSignMessageInput): Promise<boolean>;\n disconnect(): void;\n changeNetwork(network: Network): Promise<AptosChangeNetworkOutput>;\n submitTransaction(\n transaction: InputSubmitTransactionData,\n ): Promise<PendingTransactionResponse>;\n wallet: AdapterWallet | null;\n wallets: ReadonlyArray<AdapterWallet>;\n hiddenWallets: ReadonlyArray<AdapterWallet>;\n notDetectedWallets: ReadonlyArray<AdapterNotDetectedWallet>;\n}\n\nconst DEFAULT_CONTEXT = {\n connected: false,\n};\n\nexport const WalletContext = createContext<WalletContextState>(\n DEFAULT_CONTEXT as WalletContextState,\n);\n\nexport function useWallet(): WalletContextState {\n const context = useContext(WalletContext);\n if (!context) {\n throw new Error(\"useWallet must be used within a WalletContextState\");\n }\n return context;\n}\n","import {\n Dispatch,\n ForwardRefExoticComponent,\n ReactNode,\n RefAttributes,\n SVGProps,\n SetStateAction,\n createContext,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { LinkGraphic } from \"../graphics/LinkGraphic\";\nimport { WalletGraphic } from \"../graphics/WalletGraphic\";\nimport { Web3Graphic } from \"../graphics/Web3Graphic\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nconst EXPLORE_ECOSYSTEM_URL =\n \"https://aptosnetwork.com/ecosystem/directory/category/defi\";\n\nconst AboutAptosConnectContext = createContext<{\n screenIndex: number;\n setScreenIndex: Dispatch<SetStateAction<number>>;\n} | null>(null);\n\nfunction useAboutAptosConnectContext(displayName: string) {\n const context = useContext(AboutAptosConnectContext);\n\n if (!context) {\n throw new Error(\n `\\`${displayName}\\` must be used within \\`AboutAptosConnect\\``,\n );\n }\n\n return context;\n}\n\nconst educationScreens = [\n {\n Graphic: LinkGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h3\", {\n children: \"A better way to login.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Petra Web is a web3 wallet that uses a Social Login to create accounts on the Aptos blockchain.\",\n }),\n },\n {\n Graphic: WalletGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"What is a wallet?\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Wallets are a secure way to send, receive, and interact with digital assets like cryptocurrencies & NFTs.\",\n }),\n },\n {\n Graphic: Web3Graphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"Explore more of web3.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children: (\n <>\n Petra Web lets you take one account across any application built on\n Aptos.{\" \"}\n <a\n href={EXPLORE_ECOSYSTEM_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Explore the ecosystem\n </a>\n .\n </>\n ),\n }),\n },\n];\n\nconst educationScreenIndicators = Array(educationScreens.length)\n .fill(null)\n .map((_, index) =>\n createHeadlessComponent(\n \"AboutAptosConnect.ScreenIndicator\",\n \"button\",\n (displayName) => {\n const context = useAboutAptosConnectContext(displayName);\n const isActive = context.screenIndex - 1 === index;\n\n return {\n \"aria-label\": `Go to screen ${index + 1}`,\n \"aria-current\": isActive ? \"step\" : undefined,\n \"data-active\": isActive || undefined,\n onClick: () => {\n context.setScreenIndex(index + 1);\n },\n };\n },\n ),\n );\n\n/** @deprecated Use {@link AboutPetraWebEducationScreen} instead. */\nexport interface AboutAptosConnectEducationScreen {\n /** A component that renders an SVG to illustrate the idea of the current screen. */\n Graphic: ForwardRefExoticComponent<\n Omit<SVGProps<SVGSVGElement>, \"ref\"> & RefAttributes<SVGSVGElement>\n >;\n /** A headless component that renders the title of the current screen. */\n Title: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLHeadingElement>\n >;\n /** A headless component that renders the description text of the current screen. */\n Description: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLParagraphElement>\n >;\n /** The index of the current education screen. */\n screenIndex: number;\n /** The total number of education screens. */\n totalScreens: number;\n /**\n * An array of headless components for indicating the current screen of the set.\n * Each indicator will navigate the user to the screen it represents when clicked.\n */\n screenIndicators: typeof educationScreenIndicators;\n /**\n * A function that navigates the user to the previous education screen.\n * If the user is on the first education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n back: () => void;\n /**\n * A function that navigates the user to the next education screen.\n * If the user is on the last education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n next: () => void;\n /** A function that navigates the user to the initial wallet selection screen. */\n cancel: () => void;\n}\n\n/** @deprecated Use {@link AboutPetraWebProps} instead. */\nexport interface AboutAptosConnectProps {\n /**\n * A function for defining how each education screen should be rendered.\n * Each screen is modeled as a uniform set of headless components and utilities\n * that allow you to construct your UI and apply your own styles.\n */\n renderEducationScreen: (\n screen: AboutAptosConnectEducationScreen,\n ) => ReactNode;\n /**\n * The initial wallet selection UI that will be replaced by the education\n * screens when `AboutAptosConnect.Trigger` is clicked.\n */\n children?: ReactNode;\n}\n\nconst Root = ({ renderEducationScreen, children }: AboutAptosConnectProps) => {\n const [screenIndex, setScreenIndex] = useState(0);\n\n const currentEducationScreen: AboutAptosConnectEducationScreen = useMemo(\n () =>\n educationScreens.map((screen, i) => ({\n ...screen,\n screenIndex: i,\n totalScreens: educationScreens.length,\n screenIndicators: educationScreenIndicators,\n back: () => {\n setScreenIndex(screenIndex - 1);\n },\n next: () => {\n setScreenIndex(\n screenIndex === educationScreens.length ? 0 : screenIndex + 1,\n );\n },\n cancel: () => {\n setScreenIndex(0);\n },\n }))[screenIndex - 1],\n [screenIndex],\n );\n\n return (\n <AboutAptosConnectContext.Provider value={{ screenIndex, setScreenIndex }}>\n {screenIndex === 0\n ? children\n : renderEducationScreen(currentEducationScreen)}\n </AboutAptosConnectContext.Provider>\n );\n};\nRoot.displayName = \"AboutAptosConnect\";\n\nconst Trigger = createHeadlessComponent(\n \"AboutAptosConnect.Trigger\",\n \"button\",\n (displayName) => {\n const context = useAboutAptosConnectContext(displayName);\n\n return {\n onClick: () => {\n context.setScreenIndex(1);\n },\n };\n },\n);\n\n/**\n * A headless component for rendering education screens that explain the basics\n * of Aptos Connect and web3 wallets.\n *\n * @deprecated Use {@link AboutPetraWeb} instead.\n */\nexport const AboutAptosConnect = Object.assign(Root, {\n Trigger,\n});\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const LinkGraphic = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(\n (props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"102\"\n height=\"132\"\n viewBox=\"0 0 102 132\"\n fill=\"none\"\n {...props}\n >\n <g stroke=\"currentColor\" strokeMiterlimit=\"10\">\n <path d=\"M59.633 80.66c11.742-2.814 17.48-7.018 20.925-13.254l17.518-31.69c6.257-11.317 2.142-25.55-9.189-31.798C82.737.53 75.723.188 69.593 2.398M60.7 69.565a14.09 14.09 0 0 1-6.907-1.767l-.228-.108\" />\n <path d=\"m52.365 41.075 12.507-22.627a14.146 14.146 0 0 1 4.727-5.062M32.407 118.619a14.139 14.139 0 0 1-7.034-1.768c-6.857-3.78-9.353-12.402-5.561-19.25l16.634-30.1a14.097 14.097 0 0 1 4.518-4.923\" />\n <path d=\"M41.211 78.85c11.332 6.248 25.583 2.14 31.84-9.177l17.518-31.691c6.256-11.317 2.142-25.55-9.19-31.798-6.085-3.357-13.018-3.724-19.104-1.59A23.31 23.31 0 0 0 49.541 15.36L36.863 38.298l7.989 5.036 12.506-22.627c3.786-6.848 12.419-9.34 19.276-5.554 6.856 3.78 9.353 12.402 5.561 19.25l-16.634 30.1c-3.785 6.848-12.418 9.341-19.275 5.555l-5.075 8.791ZM29.5 130.447c12.361-1.37 19.2-6.994 22.966-13.804l12.678-22.936-8.305-5.239\" />\n <path d=\"m55.72 61.947-.442.764 5.511-9.55c-6.901-3.806-18.65-3.124-27.105.814M44.85 43.523l7.635-2.486m-4.221 23.264 7.217-1.723m-9.316 7.517 7.59-2.405m-.562-12.156 7.508-2.221m10.136-51.32L62.761 4.43M49.642 90.778l7.514-2.26m.474 7.448 7.514-2.26m-50.306-60.13c7.135 0 12.918-5.776 12.918-12.9 0-7.126-5.783-12.902-12.918-12.902-7.134 0-12.917 5.776-12.917 12.901s5.783 12.901 12.918 12.901Z\" />\n <path d=\"M15.724 7.774h3.197c7.135 0 12.918 5.776 12.918 12.901 0 7.126-5.783 12.901-12.918 12.901h-3.425m65.112 66.935h3.198c7.135 0 12.918 5.775 12.918 12.901 0 7.125-5.783 12.9-12.918 12.9h-3.425\" />\n <path d=\"M79.717 126.312c7.135 0 12.918-5.775 12.918-12.9s-5.783-12.901-12.918-12.901c-7.134 0-12.917 5.776-12.917 12.901s5.783 12.9 12.917 12.9ZM53.281 55.414c-11.33-6.248-25.582-2.14-31.839 9.177L3.924 96.281c-6.257 11.318-2.142 25.55 9.189 31.799 11.331 6.248 25.582 2.139 31.839-9.177l12.677-22.937-7.988-5.036-12.507 22.627c-3.785 6.848-12.418 9.341-19.275 5.554-6.857-3.781-9.353-12.402-5.561-19.25l16.633-30.1c3.786-6.848 12.419-9.341 19.276-5.555l5.074-8.792Z\" />\n </g>\n </svg>\n );\n },\n);\nLinkGraphic.displayName = \"LinkGraphic\";\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const WalletGraphic = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(\n (props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"128\"\n height=\"102\"\n viewBox=\"0 0 128 102\"\n fill=\"none\"\n {...props}\n >\n <path\n fill=\"currentColor\"\n d=\"m.96 25.93-.36-.35.36.85v-.5Zm7.79-7.81v-.5h-.21l-.15.15.36.35ZM1.3 26.28l7.79-7.8-.7-.71-7.8 7.8.7.71Zm7.44-7.66H10v-1H8.75v1Zm29.22 6.8h-37v1h37.01v-1Z\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M82.25 26.08c0 12.25-9.92 22.2-22.14 22.2a22.17 22.17 0 0 1-22.14-22.2H1.1v74.82h118.02V26.08H82.25Zm44.33 67.02h.33V18.27h-5.7\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M74.52 42.92a22.4 22.4 0 0 1-11.43 3.3 22.5 22.5 0 0 1-22.46-22.53H9.52M119.22 101l7.78-7.82m-7.88-67.1 7.79-7.81m-44.78 7.72 2.73-2.3m-46.89 2.39 2.39-2.4\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M9.86 23.69V5.72h107.97v18.04H84.65\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M117.83 20.46h3.39V1H13.25v4.72M9.36 23.69h31.78\"\n />\n </svg>\n );\n },\n);\nWalletGraphic.displayName = \"WalletGraphic\";\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const Web3Graphic = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(\n (props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"142\"\n height=\"108\"\n viewBox=\"0 0 142 108\"\n fill=\"none\"\n {...props}\n >\n <g stroke=\"currentColor\" strokeLinejoin=\"round\">\n <path d=\"m91.26 35.8.06-10.46L71.3 1v10.53L87 30.5m-36.11 5.24-.06-10.45L71.3 1v10.53L55 30.5\" />\n <path d=\"M71 59.55V49.17L50.83 25.3l.06 10.45L57 42.5m14 17.05V49.18l20.33-23.84-.07 10.45L86 42M1 59.68l.22-9.07 35.33-19.8-.1 9L9 55\" />\n <path d=\"M36.55 30.8s-.08 5.92-.1 9l.1-9ZM71 59.51v-9.07L36.55 30.8l-.1 9L63.5 55\" />\n <path d=\"M71 59.51v-9.07L36.44 70.78l-.1 9.14L55.5 68.5\" />\n <path d=\"M1.22 50.6a77387.2 77387.2 0 0 0 35.22 20.18l-.1 9.14L1 59.68l.23-9.07h-.01ZM141 59.68l-.23-9.07-35.33-19.8.11 9L133 55\" />\n <path d=\"m105.44 30.8.11 9-.1-9Z\" />\n <path d=\"M71 59.51v-9.07l34.44-19.64.11 9L78.5 55\" />\n <path d=\"M71 59.51v-9.07l34.56 20.34.1 9.14L87 69\" />\n <path d=\"M140.78 50.6a78487.3 78487.3 0 0 1-35.23 20.18l.11 9.14L141 59.68l-.23-9.07ZM50.83 80.15l.06-6.33 20.1-23.38H71v9.26L55 79\" />\n <path d=\"M71.3 97.6 50.89 73.81l-.06 9.33L71.3 107v-9.4Zm20.03-14.5-.07-9.33L71 50.44v9.26l16 18.8\" />\n <path d=\"m71.3 97.6 19.96-23.83.06 9.33L71.3 107v-9.4Z\" />\n </g>\n </svg>\n );\n },\n);\nWeb3Graphic.displayName = \"Web3Graphic\";\n","import { Slot } from \"@radix-ui/react-slot\";\nimport { ReactNode, cloneElement, forwardRef, isValidElement } from \"react\";\n\nexport interface HeadlessComponentProps {\n /** A class name for styling the element. */\n className?: string;\n /**\n * Whether to render as the child element instead of the default element provided.\n * All props will be merged into the child element.\n */\n asChild?: boolean;\n children?: ReactNode;\n}\n\n/**\n * Gets an HTML element type from its tag name\n * @example\n * HTMLElementFromTag<\"img\"> // resolved type: HTMLImageElement\n */\ntype HTMLElementFromTag<T extends keyof JSX.IntrinsicElements> =\n JSX.IntrinsicElements[T] extends React.ClassAttributes<infer Element>\n ? Element\n : HTMLElement;\n\nexport function createHeadlessComponent<\n TElement extends keyof JSX.IntrinsicElements,\n>(\n displayName: string,\n elementType: TElement,\n props?:\n | JSX.IntrinsicElements[TElement]\n | ((displayName: string) => JSX.IntrinsicElements[TElement]),\n) {\n const component = forwardRef<\n HTMLElementFromTag<TElement>,\n HeadlessComponentProps\n >(({ className, asChild, children }, ref) => {\n const Component = asChild ? Slot : elementType;\n\n const { children: defaultChildren, ...resolvedProps } =\n typeof props === \"function\" ? props(displayName) : (props ?? {});\n const resolvedChildren =\n /**\n * Use props' default children if no children are set in the component element's children and when asChild is true.\n */\n asChild && isValidElement(children) && !children.props.children\n ? cloneElement(children, {}, defaultChildren)\n : (children ?? defaultChildren);\n\n return (\n /**\n * Due to the complexity of the types at play, TypeScript reports the\n * following error for our JSX below:\n *\n * `Expression produces a union type that is too complex to represent.`\n *\n * We can safely ignore this error and retain accurate return types for\n * consumers of this function. The only drawback is that type-checking is\n * ignored for the JSX block below.\n */\n // @ts-expect-error\n <Component ref={ref} className={className} {...resolvedProps}>\n {resolvedChildren}\n </Component>\n );\n });\n component.displayName = displayName;\n\n return component;\n}\n","import {\n Dispatch,\n ForwardRefExoticComponent,\n ReactNode,\n RefAttributes,\n SVGProps,\n SetStateAction,\n createContext,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { LinkGraphic } from \"../graphics/LinkGraphic\";\nimport { WalletGraphic } from \"../graphics/WalletGraphic\";\nimport { Web3Graphic } from \"../graphics/Web3Graphic\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nexport const EXPLORE_ECOSYSTEM_URL =\n \"https://aptosnetwork.com/ecosystem/directory/category/defi\";\n\nconst AboutPetraWebContext = createContext<{\n screenIndex: number;\n setScreenIndex: Dispatch<SetStateAction<number>>;\n} | null>(null);\n\nfunction useAboutPetraWebContext(displayName: string) {\n const context = useContext(AboutPetraWebContext);\n\n if (!context) {\n throw new Error(`\\`${displayName}\\` must be used within \\`AboutPetraWeb\\``);\n }\n\n return context;\n}\n\nconst educationScreens = [\n {\n Graphic: LinkGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h3\", {\n children: \"A better way to login.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Petra Web is a web3 wallet that uses a Social Login to create accounts on the Aptos blockchain.\",\n }),\n },\n {\n Graphic: WalletGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"What is a wallet?\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Wallets are a secure way to send, receive, and interact with digital assets like cryptocurrencies & NFTs.\",\n }),\n },\n {\n Graphic: Web3Graphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"Explore more of web3.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children: (\n <>\n Petra Web lets you take one account across any application built on\n Aptos.{\" \"}\n <a\n href={EXPLORE_ECOSYSTEM_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Explore the ecosystem\n </a>\n .\n </>\n ),\n }),\n },\n];\n\nconst educationScreenIndicators = Array(educationScreens.length)\n .fill(null)\n .map((_, index) =>\n createHeadlessComponent(\n \"AboutPetraWeb.ScreenIndicator\",\n \"button\",\n (displayName) => {\n const context = useAboutPetraWebContext(displayName);\n const isActive = context.screenIndex - 1 === index;\n\n return {\n \"aria-label\": `Go to screen ${index + 1}`,\n \"aria-current\": isActive ? \"step\" : undefined,\n \"data-active\": isActive || undefined,\n onClick: () => {\n context.setScreenIndex(index + 1);\n },\n };\n },\n ),\n );\n\nexport interface AboutPetraWebEducationScreen {\n /** A component that renders an SVG to illustrate the idea of the current screen. */\n Graphic: ForwardRefExoticComponent<\n Omit<SVGProps<SVGSVGElement>, \"ref\"> & RefAttributes<SVGSVGElement>\n >;\n /** A headless component that renders the title of the current screen. */\n Title: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLHeadingElement>\n >;\n /** A headless component that renders the description text of the current screen. */\n Description: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLParagraphElement>\n >;\n /** The index of the current education screen. */\n screenIndex: number;\n /** The total number of education screens. */\n totalScreens: number;\n /**\n * An array of headless components for indicating the current screen of the set.\n * Each indicator will navigate the user to the screen it represents when clicked.\n */\n screenIndicators: typeof educationScreenIndicators;\n /**\n * A function that navigates the user to the previous education screen.\n * If the user is on the first education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n back: () => void;\n /**\n * A function that navigates the user to the next education screen.\n * If the user is on the last education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n next: () => void;\n /** A function that navigates the user to the initial wallet selection screen. */\n cancel: () => void;\n}\n\nexport interface AboutPetraWebProps {\n /**\n * A function for defining how each education screen should be rendered.\n * Each screen is modeled as a uniform set of headless components and utilities\n * that allow you to construct your UI and apply your own styles.\n */\n renderEducationScreen: (screen: AboutPetraWebEducationScreen) => ReactNode;\n /**\n * The initial wallet selection UI that will be replaced by the education\n * screens when `AboutPetraWeb.Trigger` is clicked.\n */\n children?: ReactNode;\n}\n\nconst Root = ({ renderEducationScreen, children }: AboutPetraWebProps) => {\n const [screenIndex, setScreenIndex] = useState(0);\n\n const currentEducationScreen: AboutPetraWebEducationScreen = useMemo(\n () =>\n educationScreens.map((screen, i) => ({\n ...screen,\n screenIndex: i,\n totalScreens: educationScreens.length,\n screenIndicators: educationScreenIndicators,\n back: () => {\n setScreenIndex(screenIndex - 1);\n },\n next: () => {\n setScreenIndex(\n screenIndex === educationScreens.length ? 0 : screenIndex + 1,\n );\n },\n cancel: () => {\n setScreenIndex(0);\n },\n }))[screenIndex - 1],\n [screenIndex],\n );\n\n return (\n <AboutPetraWebContext.Provider value={{ screenIndex, setScreenIndex }}>\n {screenIndex === 0\n ? children\n : renderEducationScreen(currentEducationScreen)}\n </AboutPetraWebContext.Provider>\n );\n};\nRoot.displayName = \"AboutPetraWeb\";\n\nconst Trigger = createHeadlessComponent(\n \"AboutPetraWeb.Trigger\",\n \"button\",\n (displayName) => {\n const context = useAboutPetraWebContext(displayName);\n\n return {\n onClick: () => {\n context.setScreenIndex(1);\n },\n };\n },\n);\n\n/**\n * A headless component for rendering education screens that explain the basics\n * of Petra Web and web3 wallets.\n */\nexport const AboutPetraWeb = Object.assign(Root, {\n Trigger,\n});\n","import { forwardRef } from \"react\";\nimport { SmallAptosLogo } from \"../graphics/SmallAptosLogo\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nexport const APTOS_PRIVACY_POLICY_URL = \"https://aptoslabs.com/privacy\";\n\nconst Root = createHeadlessComponent(\"AptosPrivacyPolicy.Root\", \"div\");\n\nconst Disclaimer = createHeadlessComponent(\n \"AptosPrivacyPolicy.Disclaimer\",\n \"span\",\n { children: \"By continuing, you agree to Aptos Labs'\" },\n);\n\nconst Link = createHeadlessComponent(\"AptosPrivacyPolicy.Disclaimer\", \"a\", {\n href: APTOS_PRIVACY_POLICY_URL,\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n children: \"Privacy Policy\",\n});\n\nconst PoweredBy = forwardRef<\n HTMLDivElement,\n Pick<HeadlessComponentProps, \"className\">\n>(({ className }, ref) => {\n return (\n <div ref={ref} className={className}>\n <span>Powered by</span>\n <SmallAptosLogo />\n <span>Aptos Labs</span>\n </div>\n );\n});\nPoweredBy.displayName = \"AptosPrivacyPolicy.PoweredBy\";\n\n/**\n * A headless component for rendering the Aptos Labs privacy policy disclaimer\n * that should be placed under the Petra Web login options.\n */\nexport const AptosPrivacyPolicy = Object.assign(Root, {\n Disclaimer,\n Link,\n PoweredBy,\n});\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const SmallAptosLogo = forwardRef<\n SVGSVGElement,\n SVGProps<SVGSVGElement>\n>((props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 12 12\"\n fill=\"none\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM7.17547 3.67976C7.13401 3.72309 7.07649 3.74757 7.01648 3.74757H3.00775C3.69185 2.83824 4.77995 2.25 6.00569 2.25C7.23142 2.25 8.31953 2.83824 9.00362 3.74757H8.28524C8.20824 3.74757 8.13498 3.71468 8.08401 3.65701L7.81608 3.35416C7.77618 3.30896 7.71882 3.28308 7.6585 3.28308H7.6454C7.58805 3.28308 7.53318 3.30646 7.49343 3.34792L7.17547 3.67976ZM8.05656 4.75897H7.39569C7.31869 4.75897 7.24543 4.72593 7.19447 4.66842L6.92638 4.36557C6.88647 4.32036 6.82896 4.29465 6.7688 4.29465C6.70863 4.29465 6.65112 4.32052 6.61121 4.36557L6.38131 4.6254C6.30603 4.71034 6.19801 4.75913 6.08454 4.75913H2.46703C2.36401 5.05278 2.29683 5.36296 2.27002 5.68467H5.68505C5.74506 5.68467 5.80258 5.66019 5.84404 5.61686L6.16201 5.28502C6.20175 5.24356 6.25662 5.22018 6.31398 5.22018H6.32707C6.38739 5.22018 6.44475 5.24606 6.48465 5.29126L6.75258 5.59411C6.80355 5.65178 6.87681 5.68467 6.95381 5.68467H9.74133C9.71452 5.3628 9.64734 5.05263 9.54431 4.75913H8.05641L8.05656 4.75897ZM4.33651 7.63095C4.39652 7.63095 4.45404 7.60648 4.4955 7.56315L4.81347 7.23131C4.85321 7.18985 4.90808 7.16647 4.96544 7.16647H4.97853C5.03885 7.16647 5.09621 7.19234 5.13611 7.23739L5.40404 7.54024C5.45501 7.59791 5.52827 7.6308 5.60527 7.6308H9.38285C9.52438 7.33839 9.62803 7.02463 9.68975 6.69591H6.06383C5.98683 6.69591 5.91357 6.66287 5.8626 6.60535L5.59467 6.3025C5.55477 6.2573 5.49725 6.23158 5.43709 6.23158C5.37692 6.23158 5.31941 6.25746 5.27951 6.3025L5.0496 6.56233C4.97432 6.64728 4.86631 6.69606 4.75268 6.69606H2.32147C2.3832 7.02479 2.487 7.33855 2.62837 7.63095H4.33651ZM5.57359 8.55745H4.59116C4.51417 8.55745 4.44091 8.52441 4.38994 8.46689L4.12201 8.16404C4.0821 8.11884 4.02459 8.09312 3.96442 8.09312C3.90426 8.09312 3.84675 8.119 3.80684 8.16404L3.57694 8.42387C3.50166 8.50882 3.39364 8.55761 3.28001 8.55761H3.26474C3.94915 9.29096 4.92378 9.74998 6.00596 9.74998C7.08815 9.74998 8.06262 9.29096 8.74719 8.55761H5.57359V8.55745Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n});\nSmallAptosLogo.displayName = \"SmallAptosLogo\";\n","import {\n AdapterNotDetectedWallet,\n AdapterWallet,\n WalletReadyState,\n isRedirectable,\n shouldUseFallbackWallet,\n} from \"@aptos-labs/wallet-adapter-core\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { createContext, forwardRef, useCallback, useContext } from \"react\";\nimport { useWallet } from \"../useWallet\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nexport interface WalletItemProps extends HeadlessComponentProps {\n /** The wallet option to be displayed. */\n wallet: AdapterWallet | AdapterNotDetectedWallet;\n /** A callback to be invoked when the wallet is connected. */\n onConnect?: () => void;\n}\n\nfunction useWalletItemContext(displayName: string) {\n const context = useContext(WalletItemContext);\n\n if (!context) {\n throw new Error(`\\`${displayName}\\` must be used within \\`WalletItem\\``);\n }\n\n return context;\n}\n\nconst WalletItemContext = createContext<{\n wallet: AdapterWallet | AdapterNotDetectedWallet;\n connectWallet: () => void;\n} | null>(null);\n\nconst Root = forwardRef<HTMLDivElement, WalletItemProps>(\n ({ wallet, onConnect, className, asChild, children }, ref) => {\n const { connect } = useWallet();\n\n const isWalletReady = wallet.readyState === WalletReadyState.Installed;\n\n const mobileSupport =\n \"deeplinkProvider\" in wallet && wallet.deeplinkProvider;\n\n const connectWallet = useCallback(() => {\n const connectionWallet = shouldUseFallbackWallet(wallet)\n ? wallet.fallbackWallet\n : wallet;\n if (!connectionWallet) return;\n connect(connectionWallet.name);\n onConnect?.();\n }, [wallet, connect, onConnect]);\n\n if (!isWalletReady && isRedirectable() && !mobileSupport) return null;\n\n const Component = asChild ? Slot : \"div\";\n\n return (\n <WalletItemContext.Provider value={{ wallet, connectWallet }}>\n <Component ref={ref} className={className}>\n {children}\n </Component>\n </WalletItemContext.Provider>\n );\n }\n);\nRoot.displayName = \"WalletItem\";\n\nconst Icon = createHeadlessComponent(\n \"WalletItem.Icon\",\n \"img\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n src: context.wallet.icon,\n alt: `${context.wallet.name} icon`,\n };\n }\n);\n\nconst Name = createHeadlessComponent(\n \"WalletItem.Name\",\n \"div\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n children: context.wallet.name,\n };\n }\n);\n\nconst ConnectButton = createHeadlessComponent(\n \"WalletItem.ConnectButton\",\n \"button\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n onClick: context.connectWallet,\n children: \"Connect\",\n };\n }\n);\n\nconst InstallLink = createHeadlessComponent(\n \"WalletItem.InstallLink\",\n \"a\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n href: context.wallet.url,\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n children: \"Install\",\n };\n }\n);\n\n/** A headless component for rendering a wallet option's name, icon, and either connect button or install link. */\nexport const WalletItem = Object.assign(Root, {\n Icon,\n Name,\n ConnectButton,\n InstallLink,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;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X;AAAA,EACA;AAAA,EACA,CAAC,gBAAgB;AACf,UAAM,UAAU,qBAAqB,WAAW;AAEhD,WAAO;AAAA,MACL,KAAK,QAAQ,OAAO;AAAA,MACpB,KAAK,GAAG,QAAQ,OAAO,IAAI;AAAA,IAC7B;AAAA,EACF;AACF;AAEA,IAAM,OAAO;AAAA,EACX;AAAA,EACA;AAAA,EACA,CAAC,gBAAgB;AACf,UAAM,UAAU,qBAAqB,WAAW;AAEhD,WAAO;AAAA,MACL,UAAU,QAAQ,OAAO;AAAA,IAC3B;AAAA,EACF;AACF;AAEA,IAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA,CAAC,gBAAgB;AACf,UAAM,UAAU,qBAAqB,WAAW;AAEhD,WAAO;AAAA,MACL,SAAS,QAAQ;AAAA,MACjB,UAAU;AAAA,IACZ;AAAA,EACF;AACF;AAEA,IAAM,cAAc;AAAA,EAClB;AAAA,EACA;AAAA,EACA,CAAC,gBAAgB;AACf,UAAM,UAAU,qBAAqB,WAAW;AAEhD,WAAO;AAAA,MACL,MAAM,QAAQ,OAAO;AAAA,MACrB,QAAQ;AAAA,MACR,KAAK;AAAA,MACL,UAAU;AAAA,IACZ;AAAA,EACF;AACF;AAGO,IAAM,aAAa,OAAO,OAAOA,OAAM;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":["walletCore","network","wallet","wallets","hiddenWallets","createContext","useContext","useState","jsx","forwardRef","jsx","jsxs","forwardRef","forwardRef","jsx","jsxs","forwardRef","forwardRef","jsx","forwardRef","jsx","jsxs","createContext","useContext","useState","createContext","useContext","useMemo","useState","Fragment","jsx","jsxs","EXPLORE_ECOSYSTEM_URL","createContext","useContext","educationScreens","educationScreenIndicators","Root","useState","useMemo","Trigger","forwardRef","forwardRef","jsx","forwardRef","jsx","jsxs","Root","forwardRef","WalletReadyState","Slot","createContext","forwardRef","useCallback","useContext","jsx","useContext","createContext","Root","forwardRef","WalletReadyState","useCallback","Slot"]}
@@ -24,6 +24,7 @@ export interface WalletContextState {
24
24
  submitTransaction(transaction: InputSubmitTransactionData): Promise<PendingTransactionResponse>;
25
25
  wallet: AdapterWallet | null;
26
26
  wallets: ReadonlyArray<AdapterWallet>;
27
+ hiddenWallets: ReadonlyArray<AdapterWallet>;
27
28
  notDetectedWallets: ReadonlyArray<AdapterNotDetectedWallet>;
28
29
  }
29
30
  export declare const WalletContext: import("react").Context<WalletContextState>;
@@ -1 +1 @@
1
- {"version":3,"file":"useWallet.d.ts","sourceRoot":"","sources":["../src/useWallet.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,mCAAmC,EACnC,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,OAAO,EACP,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,MAAM,CAAC,IAAI,EAAE;QACX,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,gBAAgB,CAAC;KACzB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IACtC,wBAAwB,CACtB,WAAW,EAAE,oBAAoB,GAChC,OAAO,CAAC,mCAAmC,CAAC,CAAC;IAChD,eAAe,CAAC,IAAI,EAAE;QACpB,oBAAoB,EAAE,iBAAiB,GAAG,oBAAoB,CAAC;QAC/D,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,GAAG,OAAO,CAAC;QACV,aAAa,E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UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,gBAAgB,CAAC;KACzB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IACtC,wBAAwB,CACtB,WAAW,EAAE,oBAAoB,GAChC,OAAO,CAAC,mCAAmC,CAAC,CAAC;IAChD,eAAe,CAAC,IAAI,EAAE;QACpB,oBAAoB,EAAE,iBAAiB,GAAG,oBAAoB,CAAC;QAC/D,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,GAAG,OAAO,CAAC;QACV,aAAa,EAAE,oBAAoB,CAAC;QACpC,cAAc,EAAE,UAAU,CAAC;KAC5B,CAAC,CAAC;IACH,WAAW,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC7E,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvE,UAAU,IAAI,IAAI,CAAC;IACnB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACnE,iBAAiB,CACf,WAAW,EAAE,0BAA0B,GACtC,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACvC,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IACtC,aAAa,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAC5C,kBAAkB,EAAE,aAAa,CAAC,wBAAwB,CAAC,CAAC;CAC7D;AAMD,eAAO,MAAM,aAAa,6CAEzB,CAAC;AAEF,wBAAgB,SAAS,IAAI,kBAAkB,CAM9C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-labs/wallet-adapter-react",
3
- "version": "8.0.0-xchaininit2.0",
3
+ "version": "8.0.0",
4
4
  "description": "Aptos Wallet Adapter React Provider",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -35,12 +35,12 @@
35
35
  "tsup": "^8.4.0",
36
36
  "typescript": "^5.8.3",
37
37
  "@aptos-labs/derived-wallet-ethereum": "^0.8.4",
38
- "@aptos-labs/wallet-adapter-tsconfig": "0.0.2",
39
- "@aptos-labs/derived-wallet-solana": "^0.9.1"
38
+ "@aptos-labs/derived-wallet-solana": "^0.9.1",
39
+ "@aptos-labs/wallet-adapter-tsconfig": "0.0.2"
40
40
  },
41
41
  "dependencies": {
42
42
  "@radix-ui/react-slot": "^1.0.2",
43
- "@aptos-labs/wallet-adapter-core": "8.0.0-xchaininit2.0"
43
+ "@aptos-labs/wallet-adapter-core": "8.0.0"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "react": "^18.0.0 || ^19.0.0",
@@ -26,6 +26,7 @@ import { WalletContext } from "./useWallet";
26
26
  export interface AptosWalletProviderProps {
27
27
  children: ReactNode;
28
28
  optInWallets?: ReadonlyArray<AvailableWallets>;
29
+ hideWallets?: ReadonlyArray<AvailableWallets>;
29
30
  autoConnect?:
30
31
  | boolean
31
32
  | ((core: WalletCore, adapter: AdapterWallet) => Promise<boolean>);
@@ -49,6 +50,7 @@ const initialState: {
49
50
  export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
50
51
  children,
51
52
  optInWallets,
53
+ hideWallets,
52
54
  autoConnect = false,
53
55
  dappConfig,
54
56
  disableTelemetry = false,
@@ -63,6 +65,9 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
63
65
  const [walletCore, setWalletCore] = useState<WalletCore>();
64
66
 
65
67
  const [wallets, setWallets] = useState<ReadonlyArray<AdapterWallet>>([]);
68
+ const [hiddenWallets, setHiddenWallets] = useState<
69
+ ReadonlyArray<AdapterWallet>
70
+ >([]);
66
71
  const [notDetectedWallets, setNotDetectedWallets] = useState<
67
72
  ReadonlyArray<AdapterNotDetectedWallet>
68
73
  >([]);
@@ -74,7 +79,8 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
74
79
  const walletCore = new WalletCore(
75
80
  optInWallets,
76
81
  dappConfig,
77
- disableTelemetry
82
+ disableTelemetry,
83
+ hideWallets ? hideWallets : ["Petra Web"],
78
84
  );
79
85
  setWalletCore(walletCore);
80
86
  }, []);
@@ -82,6 +88,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
82
88
  // Update initial Wallets state once WalletCore has been initialized
83
89
  useEffect(() => {
84
90
  setWallets(walletCore?.wallets ?? []);
91
+ setHiddenWallets(walletCore?.hiddenWallets ?? []);
85
92
  setNotDetectedWallets(walletCore?.notDetectedWallets ?? []);
86
93
  }, [walletCore]);
87
94
 
@@ -107,7 +114,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
107
114
 
108
115
  // Make sure the wallet is installed
109
116
  const selectedWallet = walletCore.wallets.find(
110
- (e) => e.name === walletName
117
+ (e) => e.name === walletName,
111
118
  ) as AdapterWallet | undefined;
112
119
  if (
113
120
  !selectedWallet ||
@@ -146,27 +153,29 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
146
153
  }, [autoConnect, wallets]);
147
154
 
148
155
  useEffect(() => {
149
- // Only run if not already initialized or if you want to support network switching
150
- // Note: derived-wallet-solana might not support "un-setting" listeners easily.
151
- // If it's safe to call multiple times, this is fine.
152
- // Usually, these setup functions are idempotent or replace previous listeners.
156
+ // Initialize cross-chain wallet support based on dappConfig flags.
157
+ // Dynamically imports the packages to avoid bundling them when not used.
153
158
  if (!derivationInitialized.current) {
159
+ // Use a wrapper function to prevent bundlers from statically analyzing the import
160
+ const dynamicImport = (moduleName: string) =>
161
+ new Function("m", "return import(m)")(moduleName) as Promise<any>;
162
+
154
163
  if (dappConfig?.crossChainWallets?.solana) {
155
164
  import("@aptos-labs/derived-wallet-solana").then(
156
165
  ({ setupAutomaticSolanaWalletDerivation }) => {
157
166
  setupAutomaticSolanaWalletDerivation({
158
167
  defaultNetwork: dappConfig?.network,
159
168
  });
160
- }
169
+ },
161
170
  );
162
171
  }
163
172
  if (dappConfig?.crossChainWallets?.evm) {
164
- import("@aptos-labs/derived-wallet-ethereum").then(
173
+ dynamicImport("@aptos-labs/derived-wallet-ethereum").then(
165
174
  ({ setupAutomaticEthereumWalletDerivation }) => {
166
175
  setupAutomaticEthereumWalletDerivation({
167
176
  defaultNetwork: dappConfig?.network,
168
177
  });
169
- }
178
+ },
170
179
  );
171
180
  }
172
181
  derivationInitialized.current = true;
@@ -214,7 +223,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
214
223
  };
215
224
 
216
225
  const signAndSubmitTransaction = async (
217
- transaction: InputTransactionData
226
+ transaction: InputTransactionData,
218
227
  ): Promise<AptosSignAndSubmitTransactionOutput> => {
219
228
  try {
220
229
  if (!walletCore) {
@@ -254,7 +263,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
254
263
  };
255
264
 
256
265
  const submitTransaction = async (
257
- transaction: InputSubmitTransactionData
266
+ transaction: InputSubmitTransactionData,
258
267
  ): Promise<PendingTransactionResponse> => {
259
268
  if (!walletCore) {
260
269
  throw new Error("WalletCore is not initialized");
@@ -268,7 +277,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
268
277
  };
269
278
 
270
279
  const signMessage = async (
271
- message: AptosSignMessageInput
280
+ message: AptosSignMessageInput,
272
281
  ): Promise<AptosSignMessageOutput> => {
273
282
  if (!walletCore) {
274
283
  throw new Error("WalletCore is not initialized");
@@ -282,7 +291,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
282
291
  };
283
292
 
284
293
  const signMessageAndVerify = async (
285
- message: AptosSignMessageInput
294
+ message: AptosSignMessageInput,
286
295
  ): Promise<boolean> => {
287
296
  if (!walletCore) {
288
297
  throw new Error("WalletCore is not initialized");
@@ -369,7 +378,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
369
378
  // Manage current wallet state by removing optional duplications
370
379
  // as new wallets are coming
371
380
  const existingWalletIndex = wallets.findIndex(
372
- (wallet) => wallet.name == standardWallet.name
381
+ (wallet) => wallet.name == standardWallet.name,
373
382
  );
374
383
  if (existingWalletIndex !== -1) {
375
384
  // If wallet exists, replace it with the new wallet
@@ -384,13 +393,34 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
384
393
  }
385
394
  };
386
395
 
396
+ const handleStandardWalletsHiddenAdded = (
397
+ standardWallet: AdapterWallet,
398
+ ): void => {
399
+ // Manage hidden wallet state by removing optional duplications
400
+ // as new wallets are coming
401
+ const existingWalletIndex = hiddenWallets.findIndex(
402
+ (wallet) => wallet.name === standardWallet.name,
403
+ );
404
+ if (existingWalletIndex !== -1) {
405
+ // If wallet exists, replace it with the new wallet
406
+ setHiddenWallets((hiddenWallets) => [
407
+ ...hiddenWallets.slice(0, existingWalletIndex),
408
+ standardWallet,
409
+ ...hiddenWallets.slice(existingWalletIndex + 1),
410
+ ]);
411
+ } else {
412
+ // If wallet doesn't exist, add it to the array
413
+ setHiddenWallets((hiddenWallets) => [...hiddenWallets, standardWallet]);
414
+ }
415
+ };
416
+
387
417
  const handleStandardNotDetectedWalletsAdded = (
388
- notDetectedWallet: AdapterNotDetectedWallet
418
+ notDetectedWallet: AdapterNotDetectedWallet,
389
419
  ): void => {
390
420
  // Manage current wallet state by removing optional duplications
391
421
  // as new wallets are coming
392
422
  const existingWalletIndex = wallets.findIndex(
393
- (wallet) => wallet.name == notDetectedWallet.name
423
+ (wallet) => wallet.name == notDetectedWallet.name,
394
424
  );
395
425
  if (existingWalletIndex !== -1) {
396
426
  // If wallet exists, replace it with the new wallet
@@ -411,9 +441,13 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
411
441
  walletCore?.on("networkChange", handleNetworkChange);
412
442
  walletCore?.on("disconnect", handleDisconnect);
413
443
  walletCore?.on("standardWalletsAdded", handleStandardWalletsAdded);
444
+ walletCore?.on(
445
+ "standardWalletsHiddenAdded",
446
+ handleStandardWalletsHiddenAdded,
447
+ );
414
448
  walletCore?.on(
415
449
  "standardNotDetectedWalletAdded",
416
- handleStandardNotDetectedWalletsAdded
450
+ handleStandardNotDetectedWalletsAdded,
417
451
  );
418
452
  return () => {
419
453
  walletCore?.off("connect", handleConnect);
@@ -421,9 +455,13 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
421
455
  walletCore?.off("networkChange", handleNetworkChange);
422
456
  walletCore?.off("disconnect", handleDisconnect);
423
457
  walletCore?.off("standardWalletsAdded", handleStandardWalletsAdded);
458
+ walletCore?.off(
459
+ "standardWalletsHiddenAdded",
460
+ handleStandardWalletsHiddenAdded,
461
+ );
424
462
  walletCore?.off(
425
463
  "standardNotDetectedWalletAdded",
426
- handleStandardNotDetectedWalletsAdded
464
+ handleStandardNotDetectedWalletsAdded,
427
465
  );
428
466
  };
429
467
  }, [wallets, account]);
@@ -446,6 +484,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
446
484
  wallet,
447
485
  wallets,
448
486
  notDetectedWallets,
487
+ hiddenWallets,
449
488
  isLoading,
450
489
  }}
451
490
  >