@aptos-labs/wallet-adapter-react 7.2.8 → 7.2.9-xchaininit3.1

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.
package/README.md CHANGED
@@ -105,6 +105,53 @@ import { Network } from "@aptos-labs/ts-sdk";
105
105
  </AptosWalletAdapterProvider>
106
106
  ```
107
107
 
108
+ ### Cross-Chain Wallet Support
109
+
110
+ The adapter supports cross-chain wallets, allowing users to connect with Solana or EVM wallets and derive an Aptos account from them. This enables users to interact with your Aptos dapp using wallets they already have.
111
+
112
+ #### Install Cross-Chain Dependencies
113
+
114
+ Cross-chain support requires additional packages. Install only the ones you need:
115
+
116
+ **For Solana wallet support:**
117
+
118
+ ```bash
119
+ pnpm add @aptos-labs/derived-wallet-solana
120
+ ```
121
+
122
+ **For EVM wallet support (Ethereum, Polygon, etc.):**
123
+
124
+ ```bash
125
+ pnpm add @aptos-labs/derived-wallet-ethereum
126
+ ```
127
+
128
+ #### Enable Cross-Chain Wallets
129
+
130
+ Enable cross-chain support by adding the `crossChainWallets` config:
131
+
132
+ ```tsx
133
+ import { Network } from "@aptos-labs/ts-sdk";
134
+
135
+ <AptosWalletAdapterProvider
136
+ autoConnect={true}
137
+ dappConfig={{
138
+ network: Network.MAINNET,
139
+ aptosApiKey: "my-generated-api-key",
140
+ crossChainWallets: {
141
+ solana: true, // Enable Solana wallet support
142
+ evm: true, // Enable EVM wallet support
143
+ },
144
+ }}
145
+ onError={(error) => {
146
+ console.log("error", error);
147
+ }}
148
+ >
149
+ <App />
150
+ </AptosWalletAdapterProvider>;
151
+ ```
152
+
153
+ When enabled, compatible wallets like Phantom (Solana), MetaMask (Ethereum), and others will appear in the wallet list. Users can connect with these wallets, and the adapter will derive an Aptos account for them.
154
+
108
155
  #### Use Wallet
109
156
 
110
157
  On any page you want to use the wallet props, import `useWallet` from `@aptos-labs/wallet-adapter-react`
@@ -1 +1 @@
1
- {"version":3,"file":"WalletProvider.d.ts","sourceRoot":"","sources":["../src/WalletProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,UAAU,EAEV,aAAa,EAUb,UAAU,EAOX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,EAAE,EAA4C,MAAM,OAAO,CAAC;AAGhF,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC/C,WAAW,CAAC,EACR,OAAO,GACP,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC;AAcD,eAAO,MAAM,0BAA0B,EAAE,EAAE,CAAC,wBAAwB,CAuXnE,CAAC"}
1
+ {"version":3,"file":"WalletProvider.d.ts","sourceRoot":"","sources":["../src/WalletProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,UAAU,EAEV,aAAa,EAUb,UAAU,EAOX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,EAAE,EAA4C,MAAM,OAAO,CAAC;AAGhF,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC/C,WAAW,CAAC,EACR,OAAO,GACP,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC;AAcD,eAAO,MAAM,0BAA0B,EAAE,EAAE,CAAC,wBAAwB,CAwZnE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from "@aptos-labs/wallet-adapter-core";
2
+ export * from "@aptos-labs/derived-wallet-solana";
3
+ export * from "@aptos-labs/derived-wallet-ethereum";
2
4
  export * from "./WalletProvider";
3
5
  export * from "./components/AboutAptosConnect";
4
6
  export * from "./components/AboutPetraWeb";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kBAAkB,CAAC;AACjC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -82,6 +82,8 @@ __export(index_exports, {
82
82
  });
83
83
  module.exports = __toCommonJS(index_exports);
84
84
  __reExport(index_exports, require("@aptos-labs/wallet-adapter-core"), module.exports);
85
+ __reExport(index_exports, require("@aptos-labs/derived-wallet-solana"), module.exports);
86
+ __reExport(index_exports, require("@aptos-labs/derived-wallet-ethereum"), module.exports);
85
87
 
86
88
  // src/WalletProvider.tsx
87
89
  var import_wallet_adapter_core = require("@aptos-labs/wallet-adapter-core");
@@ -125,6 +127,7 @@ var AptosWalletAdapterProvider = ({
125
127
  const [walletCore, setWalletCore] = (0, import_react2.useState)();
126
128
  const [wallets, setWallets] = (0, import_react2.useState)([]);
127
129
  const [notDetectedWallets, setNotDetectedWallets] = (0, import_react2.useState)([]);
130
+ const derivationInitialized = (0, import_react2.useRef)(false);
128
131
  (0, import_react2.useEffect)(() => {
129
132
  const walletCore2 = new import_wallet_adapter_core.WalletCore(
130
133
  optInWallets,
@@ -180,6 +183,32 @@ var AptosWalletAdapterProvider = ({
180
183
  setIsLoading(false);
181
184
  }
182
185
  }, [autoConnect, wallets]);
186
+ (0, import_react2.useEffect)(() => {
187
+ var _a, _b;
188
+ if (!derivationInitialized.current) {
189
+ if ((_a = dappConfig == null ? void 0 : dappConfig.crossChainWallets) == null ? void 0 : _a.solana) {
190
+ const solanaModule = "@aptos-labs/derived-wallet-solana";
191
+ import(solanaModule).then(
192
+ ({ setupAutomaticSolanaWalletDerivation }) => {
193
+ setupAutomaticSolanaWalletDerivation({
194
+ defaultNetwork: dappConfig == null ? void 0 : dappConfig.network
195
+ });
196
+ }
197
+ );
198
+ }
199
+ if ((_b = dappConfig == null ? void 0 : dappConfig.crossChainWallets) == null ? void 0 : _b.evm) {
200
+ const ethereumModule = "@aptos-labs/derived-wallet-ethereum";
201
+ import(ethereumModule).then(
202
+ ({ setupAutomaticEthereumWalletDerivation }) => {
203
+ setupAutomaticEthereumWalletDerivation({
204
+ defaultNetwork: dappConfig == null ? void 0 : dappConfig.network
205
+ });
206
+ }
207
+ );
208
+ }
209
+ derivationInitialized.current = true;
210
+ }
211
+ }, [network]);
183
212
  const connect = (walletName) => __async(void 0, null, function* () {
184
213
  try {
185
214
  setIsLoading(true);
@@ -936,5 +965,8 @@ var WalletItem = Object.assign(Root4, {
936
965
  WalletContext,
937
966
  WalletItem,
938
967
  useWallet,
939
- ...require("@aptos-labs/wallet-adapter-core")
968
+ ...require("@aptos-labs/wallet-adapter-core"),
969
+ ...require("@aptos-labs/derived-wallet-solana"),
970
+ ...require("@aptos-labs/derived-wallet-ethereum")
940
971
  });
972
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -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 \"./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 // 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 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":";;;;;;;;;;;;;;;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,IACZ;AAAA,EACF;AACF;AAGO,IAAM,aAAa,OAAO,OAAOA,OAAM;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":["EXPLORE_ECOSYSTEM_URL","import_react","walletCore","network","wallet","wallets","import_react","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_jsx_runtime","import_react","import_jsx_runtime","EXPLORE_ECOSYSTEM_URL","educationScreens","educationScreenIndicators","Root","Trigger","import_react","import_react","import_jsx_runtime","import_jsx_runtime","Root","import_wallet_adapter_core","import_react_slot","import_react","import_jsx_runtime","Root"]}
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 const solanaModule = \"@aptos-labs/derived-wallet-solana\";\n import(solanaModule).then(\n ({ setupAutomaticSolanaWalletDerivation }) => {\n setupAutomaticSolanaWalletDerivation({\n defaultNetwork: dappConfig?.network,\n });\n }\n );\n }\n if (dappConfig?.crossChainWallets?.evm) {\n const ethereumModule = \"@aptos-labs/derived-wallet-ethereum\";\n import(ethereumModule).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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAc,4CAAd;AACA,0BAAc,8CADd;AAEA,0BAAc,gDAFd;;;ACAA,iCAqBO;AACP,IAAAC,gBAAwE;;;ACtBxE,m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;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":["EXPLORE_ECOSYSTEM_URL","import_react","walletCore","network","wallet","wallets","import_react","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_jsx_runtime","import_react","import_jsx_runtime","EXPLORE_ECOSYSTEM_URL","educationScreens","educationScreenIndicators","Root","Trigger","import_react","import_react","import_jsx_runtime","import_jsx_runtime","Root","import_wallet_adapter_core","import_react_slot","import_react","import_jsx_runtime","Root"]}
package/dist/index.mjs CHANGED
@@ -52,6 +52,8 @@ var __async = (__this, __arguments, generator) => {
52
52
 
53
53
  // src/index.tsx
54
54
  export * from "@aptos-labs/wallet-adapter-core";
55
+ export * from "@aptos-labs/derived-wallet-solana";
56
+ export * from "@aptos-labs/derived-wallet-ethereum";
55
57
 
56
58
  // src/WalletProvider.tsx
57
59
  import {
@@ -98,6 +100,7 @@ var AptosWalletAdapterProvider = ({
98
100
  const [walletCore, setWalletCore] = useState();
99
101
  const [wallets, setWallets] = useState([]);
100
102
  const [notDetectedWallets, setNotDetectedWallets] = useState([]);
103
+ const derivationInitialized = useRef(false);
101
104
  useEffect(() => {
102
105
  const walletCore2 = new WalletCore(
103
106
  optInWallets,
@@ -153,6 +156,32 @@ var AptosWalletAdapterProvider = ({
153
156
  setIsLoading(false);
154
157
  }
155
158
  }, [autoConnect, wallets]);
159
+ useEffect(() => {
160
+ var _a, _b;
161
+ if (!derivationInitialized.current) {
162
+ if ((_a = dappConfig == null ? void 0 : dappConfig.crossChainWallets) == null ? void 0 : _a.solana) {
163
+ const solanaModule = "@aptos-labs/derived-wallet-solana";
164
+ import(solanaModule).then(
165
+ ({ setupAutomaticSolanaWalletDerivation }) => {
166
+ setupAutomaticSolanaWalletDerivation({
167
+ defaultNetwork: dappConfig == null ? void 0 : dappConfig.network
168
+ });
169
+ }
170
+ );
171
+ }
172
+ if ((_b = dappConfig == null ? void 0 : dappConfig.crossChainWallets) == null ? void 0 : _b.evm) {
173
+ const ethereumModule = "@aptos-labs/derived-wallet-ethereum";
174
+ import(ethereumModule).then(
175
+ ({ setupAutomaticEthereumWalletDerivation }) => {
176
+ setupAutomaticEthereumWalletDerivation({
177
+ defaultNetwork: dappConfig == null ? void 0 : dappConfig.network
178
+ });
179
+ }
180
+ );
181
+ }
182
+ derivationInitialized.current = true;
183
+ }
184
+ }, [network]);
156
185
  const connect = (walletName) => __async(void 0, null, function* () {
157
186
  try {
158
187
  setIsLoading(true);
@@ -922,3 +951,4 @@ export {
922
951
  WalletItem,
923
952
  useWallet
924
953
  };
954
+ //# sourceMappingURL=index.mjs.map
@@ -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 \"./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 // 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 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;;;ACAd;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;;;AD8UI;AA5WJ,IAAM,eAKF;AAAA,EACF,WAAW;AAAA,EACX,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV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,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 \"@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 const solanaModule = \"@aptos-labs/derived-wallet-solana\";\n import(solanaModule).then(\n ({ setupAutomaticSolanaWalletDerivation }) => {\n setupAutomaticSolanaWalletDerivation({\n defaultNetwork: dappConfig?.network,\n });\n }\n );\n }\n if (dappConfig?.crossChainWallets?.evm) {\n const ethereumModule = \"@aptos-labs/derived-wallet-ethereum\";\n import(ethereumModule).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,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A,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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-labs/wallet-adapter-react",
3
- "version": "7.2.8",
3
+ "version": "7.2.9-xchaininit3.1",
4
4
  "description": "Aptos Wallet Adapter React Provider",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -34,14 +34,26 @@
34
34
  "eslint": "^8.57.1",
35
35
  "tsup": "^8.4.0",
36
36
  "typescript": "^5.8.3",
37
- "@aptos-labs/wallet-adapter-tsconfig": "0.0.2"
37
+ "@aptos-labs/wallet-adapter-tsconfig": "0.0.2",
38
+ "@aptos-labs/derived-wallet-solana": "^0.9.1",
39
+ "@aptos-labs/derived-wallet-ethereum": "^0.8.4"
38
40
  },
39
41
  "dependencies": {
40
42
  "@radix-ui/react-slot": "^1.0.2",
41
- "@aptos-labs/wallet-adapter-core": "7.10.2"
43
+ "@aptos-labs/wallet-adapter-core": "7.10.3-xchaininit3.1"
42
44
  },
43
45
  "peerDependencies": {
44
- "react": "^18.0.0 || ^19.0.0"
46
+ "react": "^18.0.0 || ^19.0.0",
47
+ "@aptos-labs/derived-wallet-solana": "^0.9.1",
48
+ "@aptos-labs/derived-wallet-ethereum": "^0.8.4"
49
+ },
50
+ "peerDependenciesMeta": {
51
+ "@aptos-labs/derived-wallet-solana": {
52
+ "optional": true
53
+ },
54
+ "@aptos-labs/derived-wallet-ethereum": {
55
+ "optional": true
56
+ }
45
57
  },
46
58
  "files": [
47
59
  "dist",
@@ -66,12 +66,15 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
66
66
  const [notDetectedWallets, setNotDetectedWallets] = useState<
67
67
  ReadonlyArray<AdapterNotDetectedWallet>
68
68
  >([]);
69
+ // Use a ref to ensure we only setup derivation once per mount/network change
70
+ // or to prevent double-registration in strict mode
71
+ const derivationInitialized = useRef(false);
69
72
  // Initialize WalletCore on first load
70
73
  useEffect(() => {
71
74
  const walletCore = new WalletCore(
72
75
  optInWallets,
73
76
  dappConfig,
74
- disableTelemetry,
77
+ disableTelemetry
75
78
  );
76
79
  setWalletCore(walletCore);
77
80
  }, []);
@@ -104,7 +107,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
104
107
 
105
108
  // Make sure the wallet is installed
106
109
  const selectedWallet = walletCore.wallets.find(
107
- (e) => e.name === walletName,
110
+ (e) => e.name === walletName
108
111
  ) as AdapterWallet | undefined;
109
112
  if (
110
113
  !selectedWallet ||
@@ -142,6 +145,48 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
142
145
  }
143
146
  }, [autoConnect, wallets]);
144
147
 
148
+ 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.
153
+ if (!derivationInitialized.current) {
154
+ // Use a wrapper function to prevent bundlers from statically analyzing the import
155
+ const dynamicImport = (moduleName: string) =>
156
+ new Function("m", "return import(m)")(moduleName) as Promise<any>;
157
+
158
+ if (dappConfig?.crossChainWallets?.solana) {
159
+ dynamicImport("@aptos-labs/derived-wallet-solana")
160
+ .then(({ setupAutomaticSolanaWalletDerivation }) => {
161
+ setupAutomaticSolanaWalletDerivation({
162
+ defaultNetwork: dappConfig?.network,
163
+ });
164
+ })
165
+ .catch(() => {
166
+ console.warn(
167
+ "Cross-chain Solana support enabled but @aptos-labs/derived-wallet-solana is not installed. " +
168
+ "Install it with: npm install @aptos-labs/derived-wallet-solana"
169
+ );
170
+ });
171
+ }
172
+ if (dappConfig?.crossChainWallets?.evm) {
173
+ dynamicImport("@aptos-labs/derived-wallet-ethereum")
174
+ .then(({ setupAutomaticEthereumWalletDerivation }) => {
175
+ setupAutomaticEthereumWalletDerivation({
176
+ defaultNetwork: dappConfig?.network,
177
+ });
178
+ })
179
+ .catch(() => {
180
+ console.warn(
181
+ "Cross-chain EVM support enabled but @aptos-labs/derived-wallet-ethereum is not installed. " +
182
+ "Install it with: npm install @aptos-labs/derived-wallet-ethereum"
183
+ );
184
+ });
185
+ }
186
+ derivationInitialized.current = true;
187
+ }
188
+ }, [network]);
189
+
145
190
  const connect = async (walletName: string): Promise<void> => {
146
191
  try {
147
192
  setIsLoading(true);
@@ -183,7 +228,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
183
228
  };
184
229
 
185
230
  const signAndSubmitTransaction = async (
186
- transaction: InputTransactionData,
231
+ transaction: InputTransactionData
187
232
  ): Promise<AptosSignAndSubmitTransactionOutput> => {
188
233
  try {
189
234
  if (!walletCore) {
@@ -223,7 +268,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
223
268
  };
224
269
 
225
270
  const submitTransaction = async (
226
- transaction: InputSubmitTransactionData,
271
+ transaction: InputSubmitTransactionData
227
272
  ): Promise<PendingTransactionResponse> => {
228
273
  if (!walletCore) {
229
274
  throw new Error("WalletCore is not initialized");
@@ -237,7 +282,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
237
282
  };
238
283
 
239
284
  const signMessage = async (
240
- message: AptosSignMessageInput,
285
+ message: AptosSignMessageInput
241
286
  ): Promise<AptosSignMessageOutput> => {
242
287
  if (!walletCore) {
243
288
  throw new Error("WalletCore is not initialized");
@@ -251,7 +296,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
251
296
  };
252
297
 
253
298
  const signMessageAndVerify = async (
254
- message: AptosSignMessageInput,
299
+ message: AptosSignMessageInput
255
300
  ): Promise<boolean> => {
256
301
  if (!walletCore) {
257
302
  throw new Error("WalletCore is not initialized");
@@ -338,7 +383,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
338
383
  // Manage current wallet state by removing optional duplications
339
384
  // as new wallets are coming
340
385
  const existingWalletIndex = wallets.findIndex(
341
- (wallet) => wallet.name == standardWallet.name,
386
+ (wallet) => wallet.name == standardWallet.name
342
387
  );
343
388
  if (existingWalletIndex !== -1) {
344
389
  // If wallet exists, replace it with the new wallet
@@ -354,12 +399,12 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
354
399
  };
355
400
 
356
401
  const handleStandardNotDetectedWalletsAdded = (
357
- notDetectedWallet: AdapterNotDetectedWallet,
402
+ notDetectedWallet: AdapterNotDetectedWallet
358
403
  ): void => {
359
404
  // Manage current wallet state by removing optional duplications
360
405
  // as new wallets are coming
361
406
  const existingWalletIndex = wallets.findIndex(
362
- (wallet) => wallet.name == notDetectedWallet.name,
407
+ (wallet) => wallet.name == notDetectedWallet.name
363
408
  );
364
409
  if (existingWalletIndex !== -1) {
365
410
  // If wallet exists, replace it with the new wallet
@@ -382,7 +427,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
382
427
  walletCore?.on("standardWalletsAdded", handleStandardWalletsAdded);
383
428
  walletCore?.on(
384
429
  "standardNotDetectedWalletAdded",
385
- handleStandardNotDetectedWalletsAdded,
430
+ handleStandardNotDetectedWalletsAdded
386
431
  );
387
432
  return () => {
388
433
  walletCore?.off("connect", handleConnect);
@@ -392,7 +437,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
392
437
  walletCore?.off("standardWalletsAdded", handleStandardWalletsAdded);
393
438
  walletCore?.off(
394
439
  "standardNotDetectedWalletAdded",
395
- handleStandardNotDetectedWalletsAdded,
440
+ handleStandardNotDetectedWalletsAdded
396
441
  );
397
442
  };
398
443
  }, [wallets, account]);
package/src/index.tsx CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from "@aptos-labs/wallet-adapter-core";
2
+ export * from "@aptos-labs/derived-wallet-solana";
3
+ export * from "@aptos-labs/derived-wallet-ethereum";
2
4
  export * from "./WalletProvider";
3
5
  export * from "./components/AboutAptosConnect";
4
6
  export * from "./components/AboutPetraWeb";