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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import { ReactNode, FC } from "react";
3
3
  export interface AptosWalletProviderProps {
4
4
  children: ReactNode;
5
5
  optInWallets?: ReadonlyArray<AvailableWallets>;
6
+ hideWallets?: ReadonlyArray<AvailableWallets>;
6
7
  autoConnect?: boolean | ((core: WalletCore, adapter: AdapterWallet) => Promise<boolean>);
7
8
  dappConfig?: DappConfig;
8
9
  disableTelemetry?: boolean;
@@ -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,CAsZnE,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,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC9C,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,CA4bnE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"WalletItem.d.ts","sourceRoot":"","sources":["../../src/components/WalletItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,aAAa,EAGd,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EAAE,sBAAsB,EAA2B,MAAM,SAAS,CAAC;AAE1E,MAAM,WAAW,eAAgB,SAAQ,sBAAsB;IAC7D,yCAAyC;IACzC,MAAM,EAAE,aAAa,GAAG,wBAAwB,CAAC;IACjD,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAmGD,kHAAkH;AAClH,eAAO,MAAM,UAAU;;;;;CAKrB,CAAC"}
1
+ {"version":3,"file":"WalletItem.d.ts","sourceRoot":"","sources":["../../src/components/WalletItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,aAAa,EAId,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EAAE,sBAAsB,EAA2B,MAAM,SAAS,CAAC;AAE1E,MAAM,WAAW,eAAgB,SAAQ,sBAAsB;IAC7D,yCAAyC;IACzC,MAAM,EAAE,aAAa,GAAG,wBAAwB,CAAC;IACjD,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAuGD,kHAAkH;AAClH,eAAO,MAAM,UAAU;;;;;CAKrB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,4 @@
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";
4
2
  export * from "./WalletProvider";
5
3
  export * from "./components/AboutAptosConnect";
6
4
  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,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"}
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"}
package/dist/index.js CHANGED
@@ -92,8 +92,6 @@ __export(index_exports, {
92
92
  });
93
93
  module.exports = __toCommonJS(index_exports);
94
94
  __reExport(index_exports, require("@aptos-labs/wallet-adapter-core"), module.exports);
95
- __reExport(index_exports, require("@aptos-labs/derived-wallet-solana"), module.exports);
96
- __reExport(index_exports, require("@aptos-labs/derived-wallet-ethereum"), module.exports);
97
95
 
98
96
  // src/WalletProvider.tsx
99
97
  var import_wallet_adapter_core = require("@aptos-labs/wallet-adapter-core");
@@ -126,6 +124,7 @@ var initialState = {
126
124
  var AptosWalletAdapterProvider = ({
127
125
  children,
128
126
  optInWallets,
127
+ hideWallets,
129
128
  autoConnect = false,
130
129
  dappConfig,
131
130
  disableTelemetry = false,
@@ -136,20 +135,23 @@ var AptosWalletAdapterProvider = ({
136
135
  const [isLoading, setIsLoading] = (0, import_react2.useState)(true);
137
136
  const [walletCore, setWalletCore] = (0, import_react2.useState)();
138
137
  const [wallets, setWallets] = (0, import_react2.useState)([]);
138
+ const [hiddenWallets, setHiddenWallets] = (0, import_react2.useState)([]);
139
139
  const [notDetectedWallets, setNotDetectedWallets] = (0, import_react2.useState)([]);
140
140
  const derivationInitialized = (0, import_react2.useRef)(false);
141
141
  (0, import_react2.useEffect)(() => {
142
142
  const walletCore2 = new import_wallet_adapter_core.WalletCore(
143
143
  optInWallets,
144
144
  dappConfig,
145
- disableTelemetry
145
+ disableTelemetry,
146
+ hideWallets ? hideWallets : ["Petra Web"]
146
147
  );
147
148
  setWalletCore(walletCore2);
148
149
  }, []);
149
150
  (0, import_react2.useEffect)(() => {
150
- var _a, _b;
151
+ var _a, _b, _c;
151
152
  setWallets((_a = walletCore == null ? void 0 : walletCore.wallets) != null ? _a : []);
152
- setNotDetectedWallets((_b = walletCore == null ? void 0 : walletCore.notDetectedWallets) != null ? _b : []);
153
+ setHiddenWallets((_b = walletCore == null ? void 0 : walletCore.hiddenWallets) != null ? _b : []);
154
+ setNotDetectedWallets((_c = walletCore == null ? void 0 : walletCore.notDetectedWallets) != null ? _c : []);
153
155
  }, [walletCore]);
154
156
  (0, import_react2.useEffect)(() => {
155
157
  if (didAttemptAutoConnectRef.current || !(walletCore == null ? void 0 : walletCore.wallets.length)) {
@@ -196,6 +198,7 @@ var AptosWalletAdapterProvider = ({
196
198
  (0, import_react2.useEffect)(() => {
197
199
  var _a, _b;
198
200
  if (!derivationInitialized.current) {
201
+ const dynamicImport = (moduleName) => new Function("m", "return import(m)")(moduleName);
199
202
  if ((_a = dappConfig == null ? void 0 : dappConfig.crossChainWallets) == null ? void 0 : _a.solana) {
200
203
  import("@aptos-labs/derived-wallet-solana").then(
201
204
  ({ setupAutomaticSolanaWalletDerivation }) => {
@@ -206,7 +209,7 @@ var AptosWalletAdapterProvider = ({
206
209
  );
207
210
  }
208
211
  if ((_b = dappConfig == null ? void 0 : dappConfig.crossChainWallets) == null ? void 0 : _b.evm) {
209
- import("@aptos-labs/derived-wallet-ethereum").then(
212
+ dynamicImport("@aptos-labs/derived-wallet-ethereum").then(
210
213
  ({ setupAutomaticEthereumWalletDerivation }) => {
211
214
  setupAutomaticEthereumWalletDerivation({
212
215
  defaultNetwork: dappConfig == null ? void 0 : dappConfig.network
@@ -379,6 +382,20 @@ var AptosWalletAdapterProvider = ({
379
382
  setWallets((wallets2) => [...wallets2, standardWallet]);
380
383
  }
381
384
  };
385
+ const handleStandardWalletsHiddenAdded = (standardWallet) => {
386
+ const existingWalletIndex = hiddenWallets.findIndex(
387
+ (wallet2) => wallet2.name === standardWallet.name
388
+ );
389
+ if (existingWalletIndex !== -1) {
390
+ setHiddenWallets((hiddenWallets2) => [
391
+ ...hiddenWallets2.slice(0, existingWalletIndex),
392
+ standardWallet,
393
+ ...hiddenWallets2.slice(existingWalletIndex + 1)
394
+ ]);
395
+ } else {
396
+ setHiddenWallets((hiddenWallets2) => [...hiddenWallets2, standardWallet]);
397
+ }
398
+ };
382
399
  const handleStandardNotDetectedWalletsAdded = (notDetectedWallet) => {
383
400
  const existingWalletIndex = wallets.findIndex(
384
401
  (wallet2) => wallet2.name == notDetectedWallet.name
@@ -399,6 +416,10 @@ var AptosWalletAdapterProvider = ({
399
416
  walletCore == null ? void 0 : walletCore.on("networkChange", handleNetworkChange);
400
417
  walletCore == null ? void 0 : walletCore.on("disconnect", handleDisconnect);
401
418
  walletCore == null ? void 0 : walletCore.on("standardWalletsAdded", handleStandardWalletsAdded);
419
+ walletCore == null ? void 0 : walletCore.on(
420
+ "standardWalletsHiddenAdded",
421
+ handleStandardWalletsHiddenAdded
422
+ );
402
423
  walletCore == null ? void 0 : walletCore.on(
403
424
  "standardNotDetectedWalletAdded",
404
425
  handleStandardNotDetectedWalletsAdded
@@ -409,6 +430,10 @@ var AptosWalletAdapterProvider = ({
409
430
  walletCore == null ? void 0 : walletCore.off("networkChange", handleNetworkChange);
410
431
  walletCore == null ? void 0 : walletCore.off("disconnect", handleDisconnect);
411
432
  walletCore == null ? void 0 : walletCore.off("standardWalletsAdded", handleStandardWalletsAdded);
433
+ walletCore == null ? void 0 : walletCore.off(
434
+ "standardWalletsHiddenAdded",
435
+ handleStandardWalletsHiddenAdded
436
+ );
412
437
  walletCore == null ? void 0 : walletCore.off(
413
438
  "standardNotDetectedWalletAdded",
414
439
  handleStandardNotDetectedWalletsAdded
@@ -434,6 +459,7 @@ var AptosWalletAdapterProvider = ({
434
459
  wallet,
435
460
  wallets,
436
461
  notDetectedWallets,
462
+ hiddenWallets,
437
463
  isLoading
438
464
  },
439
465
  children
@@ -899,12 +925,14 @@ var WalletItemContext = (0, import_react11.createContext)(null);
899
925
  var Root4 = (0, import_react11.forwardRef)(
900
926
  ({ wallet, onConnect, className, asChild, children }, ref) => {
901
927
  const { connect } = useWallet();
902
- const connectWallet = (0, import_react11.useCallback)(() => {
903
- connect(wallet.name);
904
- onConnect == null ? void 0 : onConnect();
905
- }, [connect, wallet.name, onConnect]);
906
928
  const isWalletReady = wallet.readyState === import_wallet_adapter_core2.WalletReadyState.Installed;
907
929
  const mobileSupport = "deeplinkProvider" in wallet && wallet.deeplinkProvider;
930
+ const connectWallet = (0, import_react11.useCallback)(() => {
931
+ const connectionWallet = (0, import_wallet_adapter_core2.shouldUseFallbackWallet)(wallet) ? wallet.fallbackWallet : wallet;
932
+ if (!connectionWallet) return;
933
+ connect(connectionWallet.name);
934
+ onConnect == null ? void 0 : onConnect();
935
+ }, [wallet, connect, onConnect]);
908
936
  if (!isWalletReady && (0, import_wallet_adapter_core2.isRedirectable)() && !mobileSupport) return null;
909
937
  const Component = asChild ? import_react_slot2.Slot : "div";
910
938
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(WalletItemContext.Provider, { value: { wallet, connectWallet }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Component, { ref, className, children }) });
@@ -973,8 +1001,6 @@ var WalletItem = Object.assign(Root4, {
973
1001
  WalletContext,
974
1002
  WalletItem,
975
1003
  useWallet,
976
- ...require("@aptos-labs/wallet-adapter-core"),
977
- ...require("@aptos-labs/derived-wallet-solana"),
978
- ...require("@aptos-labs/derived-wallet-ethereum")
1004
+ ...require("@aptos-labs/wallet-adapter-core")
979
1005
  });
980
1006
  //# 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 \"@aptos-labs/derived-wallet-solana\";\nexport * from \"@aptos-labs/derived-wallet-ethereum\";\nexport * from \"./WalletProvider\";\nexport * from \"./components/AboutAptosConnect\";\nexport * from \"./components/AboutPetraWeb\";\nexport * from \"./components/AptosPrivacyPolicy\";\nexport * from \"./components/WalletItem\";\nexport * from \"./useWallet\";\n","import {\n AvailableWallets,\n DappConfig,\n AccountInfo,\n AdapterWallet,\n NetworkInfo,\n InputTransactionData,\n AptosSignAndSubmitTransactionOutput,\n AnyRawTransaction,\n InputGenerateTransactionOptions,\n AccountAuthenticator,\n AptosSignMessageInput,\n AptosSignMessageOutput,\n AdapterNotDetectedWallet,\n WalletCore,\n Network,\n InputSubmitTransactionData,\n PendingTransactionResponse,\n WalletReadyState,\n AptosSignInInput,\n AptosSignInOutput,\n} from \"@aptos-labs/wallet-adapter-core\";\nimport { ReactNode, FC, useState, useEffect, useCallback, useRef } from \"react\";\nimport { WalletContext } from \"./useWallet\";\n\nexport interface AptosWalletProviderProps {\n children: ReactNode;\n optInWallets?: ReadonlyArray<AvailableWallets>;\n autoConnect?:\n | boolean\n | ((core: WalletCore, adapter: AdapterWallet) => Promise<boolean>);\n dappConfig?: DappConfig;\n disableTelemetry?: boolean;\n onError?: (error: any) => void;\n}\n\nconst initialState: {\n account: AccountInfo | null;\n network: NetworkInfo | null;\n connected: boolean;\n wallet: AdapterWallet | null;\n} = {\n connected: false,\n account: null,\n network: null,\n wallet: null,\n};\n\nexport const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({\n children,\n optInWallets,\n autoConnect = false,\n dappConfig,\n disableTelemetry = false,\n onError,\n}: AptosWalletProviderProps) => {\n const didAttemptAutoConnectRef = useRef(false);\n\n const [{ account, network, connected, wallet }, setState] =\n useState(initialState);\n\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [walletCore, setWalletCore] = useState<WalletCore>();\n\n const [wallets, setWallets] = useState<ReadonlyArray<AdapterWallet>>([]);\n const [notDetectedWallets, setNotDetectedWallets] = useState<\n ReadonlyArray<AdapterNotDetectedWallet>\n >([]);\n // Use a ref to ensure we only setup derivation once per mount/network change\n // or to prevent double-registration in strict mode\n const derivationInitialized = useRef(false);\n // Initialize WalletCore on first load\n useEffect(() => {\n const walletCore = new WalletCore(\n optInWallets,\n dappConfig,\n disableTelemetry\n );\n setWalletCore(walletCore);\n }, []);\n\n // Update initial Wallets state once WalletCore has been initialized\n useEffect(() => {\n setWallets(walletCore?.wallets ?? []);\n setNotDetectedWallets(walletCore?.notDetectedWallets ?? []);\n }, [walletCore]);\n\n useEffect(() => {\n // Only attempt to auto connect once per render and only if there are wallets\n if (didAttemptAutoConnectRef.current || !walletCore?.wallets.length) {\n return;\n }\n didAttemptAutoConnectRef.current = true;\n\n // If auto connect is not set or is false, ignore the attempt\n if (!autoConnect) {\n setIsLoading(false);\n return;\n }\n\n // Make sure the user has a previously connected wallet\n const walletName = localStorage.getItem(\"AptosWalletName\");\n if (!walletName) {\n setIsLoading(false);\n return;\n }\n\n // Make sure the wallet is installed\n const selectedWallet = walletCore.wallets.find(\n (e) => e.name === walletName\n ) as AdapterWallet | undefined;\n if (\n !selectedWallet ||\n selectedWallet.readyState !== WalletReadyState.Installed\n ) {\n setIsLoading(false);\n return;\n }\n\n if (!connected) {\n (async () => {\n try {\n let shouldConnect = true;\n\n // Providing a function to autoConnect allows the dapp to determine\n // whether to attempt to connect to the wallet using the `signIn`\n // or `connect` method. If `signIn` is successful, the user can\n // return `false` and skip the `connect` method.\n if (typeof autoConnect === \"function\") {\n shouldConnect = await autoConnect(walletCore, selectedWallet);\n } else {\n shouldConnect = autoConnect;\n }\n\n if (shouldConnect) await connect(walletName);\n } catch (error) {\n if (onError) onError(error);\n return Promise.reject(error);\n } finally {\n setIsLoading(false);\n }\n })();\n } else {\n setIsLoading(false);\n }\n }, [autoConnect, wallets]);\n\n useEffect(() => {\n // Only run if not already initialized or if you want to support network switching\n // Note: derived-wallet-solana might not support \"un-setting\" listeners easily.\n // If it's safe to call multiple times, this is fine.\n // Usually, these setup functions are idempotent or replace previous listeners.\n if (!derivationInitialized.current) {\n if (dappConfig?.crossChainWallets?.solana) {\n import(\"@aptos-labs/derived-wallet-solana\").then(\n ({ setupAutomaticSolanaWalletDerivation }) => {\n setupAutomaticSolanaWalletDerivation({\n defaultNetwork: dappConfig?.network,\n });\n }\n );\n }\n if (dappConfig?.crossChainWallets?.evm) {\n import(\"@aptos-labs/derived-wallet-ethereum\").then(\n ({ setupAutomaticEthereumWalletDerivation }) => {\n setupAutomaticEthereumWalletDerivation({\n defaultNetwork: dappConfig?.network,\n });\n }\n );\n }\n derivationInitialized.current = true;\n }\n }, [network]);\n\n const connect = async (walletName: string): Promise<void> => {\n try {\n setIsLoading(true);\n await walletCore?.connect(walletName);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n } finally {\n setIsLoading(false);\n }\n };\n\n const signIn = async (args: {\n walletName: string;\n input: AptosSignInInput;\n }): Promise<AptosSignInOutput> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n\n try {\n setIsLoading(true);\n return await walletCore?.signIn(args);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n } finally {\n setIsLoading(false);\n }\n };\n\n const disconnect = async (): Promise<void> => {\n try {\n await walletCore?.disconnect();\n } catch (error) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signAndSubmitTransaction = async (\n transaction: InputTransactionData\n ): Promise<AptosSignAndSubmitTransactionOutput> => {\n try {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n return await walletCore.signAndSubmitTransaction(transaction);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signTransaction = async (args: {\n transactionOrPayload: AnyRawTransaction | InputTransactionData;\n asFeePayer?: boolean;\n options?: InputGenerateTransactionOptions & {\n expirationSecondsFromNow?: number;\n expirationTimestamp?: number;\n };\n }): Promise<{\n authenticator: AccountAuthenticator;\n rawTransaction: Uint8Array;\n }> => {\n const { transactionOrPayload, asFeePayer, options } = args;\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore.signTransaction({\n transactionOrPayload,\n asFeePayer,\n });\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const submitTransaction = async (\n transaction: InputSubmitTransactionData\n ): Promise<PendingTransactionResponse> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.submitTransaction(transaction);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signMessage = async (\n message: AptosSignMessageInput\n ): Promise<AptosSignMessageOutput> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.signMessage(message);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signMessageAndVerify = async (\n message: AptosSignMessageInput\n ): Promise<boolean> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.signMessageAndVerify(message);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const changeNetwork = async (network: Network) => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.changeNetwork(network);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n // Handle the adapter's connect event\n const handleConnect = (): void => {\n setState((state) => {\n return {\n ...state,\n connected: true,\n account: walletCore?.account || null,\n network: walletCore?.network || null,\n wallet: walletCore?.wallet || null,\n };\n });\n };\n\n // Handle the adapter's account change event\n const handleAccountChange = useCallback((): void => {\n if (!connected) return;\n if (!walletCore?.wallet) return;\n setState((state) => {\n return {\n ...state,\n account: walletCore?.account || null,\n };\n });\n }, [connected]);\n\n // Handle the adapter's network event\n const handleNetworkChange = useCallback((): void => {\n if (!connected) return;\n if (!walletCore?.wallet) return;\n setState((state) => {\n return {\n ...state,\n network: walletCore?.network || null,\n };\n });\n }, [connected]);\n\n useEffect(() => {\n if (connected) {\n walletCore?.onAccountChange();\n walletCore?.onNetworkChange();\n }\n }, [connected]);\n\n // Handle the adapter's disconnect event\n const handleDisconnect = (): void => {\n if (!connected) return;\n setState((state) => {\n return {\n ...state,\n connected: false,\n account: walletCore?.account || null,\n network: walletCore?.network || null,\n wallet: null,\n };\n });\n };\n\n const handleStandardWalletsAdded = (standardWallet: AdapterWallet): void => {\n // Manage current wallet state by removing optional duplications\n // as new wallets are coming\n const existingWalletIndex = wallets.findIndex(\n (wallet) => wallet.name == standardWallet.name\n );\n if (existingWalletIndex !== -1) {\n // If wallet exists, replace it with the new wallet\n setWallets((wallets) => [\n ...wallets.slice(0, existingWalletIndex),\n standardWallet,\n ...wallets.slice(existingWalletIndex + 1),\n ]);\n } else {\n // If wallet doesn't exist, add it to the array\n setWallets((wallets) => [...wallets, standardWallet]);\n }\n };\n\n const handleStandardNotDetectedWalletsAdded = (\n notDetectedWallet: AdapterNotDetectedWallet\n ): void => {\n // Manage current wallet state by removing optional duplications\n // as new wallets are coming\n const existingWalletIndex = wallets.findIndex(\n (wallet) => wallet.name == notDetectedWallet.name\n );\n if (existingWalletIndex !== -1) {\n // If wallet exists, replace it with the new wallet\n setNotDetectedWallets((wallets) => [\n ...wallets.slice(0, existingWalletIndex),\n notDetectedWallet,\n ...wallets.slice(existingWalletIndex + 1),\n ]);\n } else {\n // If wallet doesn't exist, add it to the array\n setNotDetectedWallets((wallets) => [...wallets, notDetectedWallet]);\n }\n };\n\n useEffect(() => {\n walletCore?.on(\"connect\", handleConnect);\n walletCore?.on(\"accountChange\", handleAccountChange);\n walletCore?.on(\"networkChange\", handleNetworkChange);\n walletCore?.on(\"disconnect\", handleDisconnect);\n walletCore?.on(\"standardWalletsAdded\", handleStandardWalletsAdded);\n walletCore?.on(\n \"standardNotDetectedWalletAdded\",\n handleStandardNotDetectedWalletsAdded\n );\n return () => {\n walletCore?.off(\"connect\", handleConnect);\n walletCore?.off(\"accountChange\", handleAccountChange);\n walletCore?.off(\"networkChange\", handleNetworkChange);\n walletCore?.off(\"disconnect\", handleDisconnect);\n walletCore?.off(\"standardWalletsAdded\", handleStandardWalletsAdded);\n walletCore?.off(\n \"standardNotDetectedWalletAdded\",\n handleStandardNotDetectedWalletsAdded\n );\n };\n }, [wallets, account]);\n\n return (\n <WalletContext.Provider\n value={{\n connect,\n signIn,\n disconnect,\n signAndSubmitTransaction,\n signTransaction,\n signMessage,\n signMessageAndVerify,\n changeNetwork,\n submitTransaction,\n account,\n network,\n connected,\n wallet,\n wallets,\n notDetectedWallets,\n isLoading,\n }}\n >\n {children}\n </WalletContext.Provider>\n );\n};\n","import { useContext, createContext } from \"react\";\nimport {\n AccountAuthenticator,\n AccountInfo,\n AdapterWallet,\n AnyRawTransaction,\n AptosSignAndSubmitTransactionOutput,\n InputTransactionData,\n NetworkInfo,\n AptosSignMessageInput,\n AptosSignMessageOutput,\n AdapterNotDetectedWallet,\n Network,\n AptosChangeNetworkOutput,\n PendingTransactionResponse,\n InputSubmitTransactionData,\n AptosSignInInput,\n AptosSignInOutput,\n} from \"@aptos-labs/wallet-adapter-core\";\n\nexport interface WalletContextState {\n connected: boolean;\n isLoading: boolean;\n account: AccountInfo | null;\n network: NetworkInfo | null;\n connect(walletName: string): void;\n signIn(args: {\n walletName: string;\n input: AptosSignInInput;\n }): Promise<AptosSignInOutput | void>;\n signAndSubmitTransaction(\n transaction: InputTransactionData,\n ): Promise<AptosSignAndSubmitTransactionOutput>;\n signTransaction(args: {\n transactionOrPayload: AnyRawTransaction | InputTransactionData;\n asFeePayer?: boolean;\n }): Promise<{\n authenticator: AccountAuthenticator;\n rawTransaction: Uint8Array;\n }>;\n signMessage(message: AptosSignMessageInput): Promise<AptosSignMessageOutput>;\n signMessageAndVerify(message: AptosSignMessageInput): Promise<boolean>;\n disconnect(): void;\n changeNetwork(network: Network): Promise<AptosChangeNetworkOutput>;\n submitTransaction(\n transaction: InputSubmitTransactionData,\n ): Promise<PendingTransactionResponse>;\n wallet: AdapterWallet | null;\n wallets: ReadonlyArray<AdapterWallet>;\n notDetectedWallets: ReadonlyArray<AdapterNotDetectedWallet>;\n}\n\nconst DEFAULT_CONTEXT = {\n connected: false,\n};\n\nexport const WalletContext = createContext<WalletContextState>(\n DEFAULT_CONTEXT as WalletContextState,\n);\n\nexport function useWallet(): WalletContextState {\n const context = useContext(WalletContext);\n if (!context) {\n throw new Error(\"useWallet must be used within a WalletContextState\");\n }\n return context;\n}\n","import {\n Dispatch,\n ForwardRefExoticComponent,\n ReactNode,\n RefAttributes,\n SVGProps,\n SetStateAction,\n createContext,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { LinkGraphic } from \"../graphics/LinkGraphic\";\nimport { WalletGraphic } from \"../graphics/WalletGraphic\";\nimport { Web3Graphic } from \"../graphics/Web3Graphic\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nconst EXPLORE_ECOSYSTEM_URL =\n \"https://aptosnetwork.com/ecosystem/directory/category/defi\";\n\nconst AboutAptosConnectContext = createContext<{\n screenIndex: number;\n setScreenIndex: Dispatch<SetStateAction<number>>;\n} | null>(null);\n\nfunction useAboutAptosConnectContext(displayName: string) {\n const context = useContext(AboutAptosConnectContext);\n\n if (!context) {\n throw new Error(\n `\\`${displayName}\\` must be used within \\`AboutAptosConnect\\``,\n );\n }\n\n return context;\n}\n\nconst educationScreens = [\n {\n Graphic: LinkGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h3\", {\n children: \"A better way to login.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Petra Web is a web3 wallet that uses a Social Login to create accounts on the Aptos blockchain.\",\n }),\n },\n {\n Graphic: WalletGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"What is a wallet?\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Wallets are a secure way to send, receive, and interact with digital assets like cryptocurrencies & NFTs.\",\n }),\n },\n {\n Graphic: Web3Graphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"Explore more of web3.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children: (\n <>\n Petra Web lets you take one account across any application built on\n Aptos.{\" \"}\n <a\n href={EXPLORE_ECOSYSTEM_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Explore the ecosystem\n </a>\n .\n </>\n ),\n }),\n },\n];\n\nconst educationScreenIndicators = Array(educationScreens.length)\n .fill(null)\n .map((_, index) =>\n createHeadlessComponent(\n \"AboutAptosConnect.ScreenIndicator\",\n \"button\",\n (displayName) => {\n const context = useAboutAptosConnectContext(displayName);\n const isActive = context.screenIndex - 1 === index;\n\n return {\n \"aria-label\": `Go to screen ${index + 1}`,\n \"aria-current\": isActive ? \"step\" : undefined,\n \"data-active\": isActive || undefined,\n onClick: () => {\n context.setScreenIndex(index + 1);\n },\n };\n },\n ),\n );\n\n/** @deprecated Use {@link AboutPetraWebEducationScreen} instead. */\nexport interface AboutAptosConnectEducationScreen {\n /** A component that renders an SVG to illustrate the idea of the current screen. */\n Graphic: ForwardRefExoticComponent<\n Omit<SVGProps<SVGSVGElement>, \"ref\"> & RefAttributes<SVGSVGElement>\n >;\n /** A headless component that renders the title of the current screen. */\n Title: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLHeadingElement>\n >;\n /** A headless component that renders the description text of the current screen. */\n Description: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLParagraphElement>\n >;\n /** The index of the current education screen. */\n screenIndex: number;\n /** The total number of education screens. */\n totalScreens: number;\n /**\n * An array of headless components for indicating the current screen of the set.\n * Each indicator will navigate the user to the screen it represents when clicked.\n */\n screenIndicators: typeof educationScreenIndicators;\n /**\n * A function that navigates the user to the previous education screen.\n * If the user is on the first education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n back: () => void;\n /**\n * A function that navigates the user to the next education screen.\n * If the user is on the last education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n next: () => void;\n /** A function that navigates the user to the initial wallet selection screen. */\n cancel: () => void;\n}\n\n/** @deprecated Use {@link AboutPetraWebProps} instead. */\nexport interface AboutAptosConnectProps {\n /**\n * A function for defining how each education screen should be rendered.\n * Each screen is modeled as a uniform set of headless components and utilities\n * that allow you to construct your UI and apply your own styles.\n */\n renderEducationScreen: (\n screen: AboutAptosConnectEducationScreen,\n ) => ReactNode;\n /**\n * The initial wallet selection UI that will be replaced by the education\n * screens when `AboutAptosConnect.Trigger` is clicked.\n */\n children?: ReactNode;\n}\n\nconst Root = ({ renderEducationScreen, children }: AboutAptosConnectProps) => {\n const [screenIndex, setScreenIndex] = useState(0);\n\n const currentEducationScreen: AboutAptosConnectEducationScreen = useMemo(\n () =>\n educationScreens.map((screen, i) => ({\n ...screen,\n screenIndex: i,\n totalScreens: educationScreens.length,\n screenIndicators: educationScreenIndicators,\n back: () => {\n setScreenIndex(screenIndex - 1);\n },\n next: () => {\n setScreenIndex(\n screenIndex === educationScreens.length ? 0 : screenIndex + 1,\n );\n },\n cancel: () => {\n setScreenIndex(0);\n },\n }))[screenIndex - 1],\n [screenIndex],\n );\n\n return (\n <AboutAptosConnectContext.Provider value={{ screenIndex, setScreenIndex }}>\n {screenIndex === 0\n ? children\n : renderEducationScreen(currentEducationScreen)}\n </AboutAptosConnectContext.Provider>\n );\n};\nRoot.displayName = \"AboutAptosConnect\";\n\nconst Trigger = createHeadlessComponent(\n \"AboutAptosConnect.Trigger\",\n \"button\",\n (displayName) => {\n const context = useAboutAptosConnectContext(displayName);\n\n return {\n onClick: () => {\n context.setScreenIndex(1);\n },\n };\n },\n);\n\n/**\n * A headless component for rendering education screens that explain the basics\n * of Aptos Connect and web3 wallets.\n *\n * @deprecated Use {@link AboutPetraWeb} instead.\n */\nexport const AboutAptosConnect = Object.assign(Root, {\n Trigger,\n});\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const LinkGraphic = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(\n (props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"102\"\n height=\"132\"\n viewBox=\"0 0 102 132\"\n fill=\"none\"\n {...props}\n >\n <g stroke=\"currentColor\" strokeMiterlimit=\"10\">\n <path d=\"M59.633 80.66c11.742-2.814 17.48-7.018 20.925-13.254l17.518-31.69c6.257-11.317 2.142-25.55-9.189-31.798C82.737.53 75.723.188 69.593 2.398M60.7 69.565a14.09 14.09 0 0 1-6.907-1.767l-.228-.108\" />\n <path d=\"m52.365 41.075 12.507-22.627a14.146 14.146 0 0 1 4.727-5.062M32.407 118.619a14.139 14.139 0 0 1-7.034-1.768c-6.857-3.78-9.353-12.402-5.561-19.25l16.634-30.1a14.097 14.097 0 0 1 4.518-4.923\" />\n <path d=\"M41.211 78.85c11.332 6.248 25.583 2.14 31.84-9.177l17.518-31.691c6.256-11.317 2.142-25.55-9.19-31.798-6.085-3.357-13.018-3.724-19.104-1.59A23.31 23.31 0 0 0 49.541 15.36L36.863 38.298l7.989 5.036 12.506-22.627c3.786-6.848 12.419-9.34 19.276-5.554 6.856 3.78 9.353 12.402 5.561 19.25l-16.634 30.1c-3.785 6.848-12.418 9.341-19.275 5.555l-5.075 8.791ZM29.5 130.447c12.361-1.37 19.2-6.994 22.966-13.804l12.678-22.936-8.305-5.239\" />\n <path d=\"m55.72 61.947-.442.764 5.511-9.55c-6.901-3.806-18.65-3.124-27.105.814M44.85 43.523l7.635-2.486m-4.221 23.264 7.217-1.723m-9.316 7.517 7.59-2.405m-.562-12.156 7.508-2.221m10.136-51.32L62.761 4.43M49.642 90.778l7.514-2.26m.474 7.448 7.514-2.26m-50.306-60.13c7.135 0 12.918-5.776 12.918-12.9 0-7.126-5.783-12.902-12.918-12.902-7.134 0-12.917 5.776-12.917 12.901s5.783 12.901 12.918 12.901Z\" />\n <path d=\"M15.724 7.774h3.197c7.135 0 12.918 5.776 12.918 12.901 0 7.126-5.783 12.901-12.918 12.901h-3.425m65.112 66.935h3.198c7.135 0 12.918 5.775 12.918 12.901 0 7.125-5.783 12.9-12.918 12.9h-3.425\" />\n <path d=\"M79.717 126.312c7.135 0 12.918-5.775 12.918-12.9s-5.783-12.901-12.918-12.901c-7.134 0-12.917 5.776-12.917 12.901s5.783 12.9 12.917 12.9ZM53.281 55.414c-11.33-6.248-25.582-2.14-31.839 9.177L3.924 96.281c-6.257 11.318-2.142 25.55 9.189 31.799 11.331 6.248 25.582 2.139 31.839-9.177l12.677-22.937-7.988-5.036-12.507 22.627c-3.785 6.848-12.418 9.341-19.275 5.554-6.857-3.781-9.353-12.402-5.561-19.25l16.633-30.1c3.786-6.848 12.419-9.341 19.276-5.555l5.074-8.792Z\" />\n </g>\n </svg>\n );\n },\n);\nLinkGraphic.displayName = \"LinkGraphic\";\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const WalletGraphic = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(\n (props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"128\"\n height=\"102\"\n viewBox=\"0 0 128 102\"\n fill=\"none\"\n {...props}\n >\n <path\n fill=\"currentColor\"\n d=\"m.96 25.93-.36-.35.36.85v-.5Zm7.79-7.81v-.5h-.21l-.15.15.36.35ZM1.3 26.28l7.79-7.8-.7-.71-7.8 7.8.7.71Zm7.44-7.66H10v-1H8.75v1Zm29.22 6.8h-37v1h37.01v-1Z\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M82.25 26.08c0 12.25-9.92 22.2-22.14 22.2a22.17 22.17 0 0 1-22.14-22.2H1.1v74.82h118.02V26.08H82.25Zm44.33 67.02h.33V18.27h-5.7\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M74.52 42.92a22.4 22.4 0 0 1-11.43 3.3 22.5 22.5 0 0 1-22.46-22.53H9.52M119.22 101l7.78-7.82m-7.88-67.1 7.79-7.81m-44.78 7.72 2.73-2.3m-46.89 2.39 2.39-2.4\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M9.86 23.69V5.72h107.97v18.04H84.65\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M117.83 20.46h3.39V1H13.25v4.72M9.36 23.69h31.78\"\n />\n </svg>\n );\n },\n);\nWalletGraphic.displayName = \"WalletGraphic\";\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const Web3Graphic = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(\n (props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"142\"\n height=\"108\"\n viewBox=\"0 0 142 108\"\n fill=\"none\"\n {...props}\n >\n <g stroke=\"currentColor\" strokeLinejoin=\"round\">\n <path d=\"m91.26 35.8.06-10.46L71.3 1v10.53L87 30.5m-36.11 5.24-.06-10.45L71.3 1v10.53L55 30.5\" />\n <path d=\"M71 59.55V49.17L50.83 25.3l.06 10.45L57 42.5m14 17.05V49.18l20.33-23.84-.07 10.45L86 42M1 59.68l.22-9.07 35.33-19.8-.1 9L9 55\" />\n <path d=\"M36.55 30.8s-.08 5.92-.1 9l.1-9ZM71 59.51v-9.07L36.55 30.8l-.1 9L63.5 55\" />\n <path d=\"M71 59.51v-9.07L36.44 70.78l-.1 9.14L55.5 68.5\" />\n <path d=\"M1.22 50.6a77387.2 77387.2 0 0 0 35.22 20.18l-.1 9.14L1 59.68l.23-9.07h-.01ZM141 59.68l-.23-9.07-35.33-19.8.11 9L133 55\" />\n <path d=\"m105.44 30.8.11 9-.1-9Z\" />\n <path d=\"M71 59.51v-9.07l34.44-19.64.11 9L78.5 55\" />\n <path d=\"M71 59.51v-9.07l34.56 20.34.1 9.14L87 69\" />\n <path d=\"M140.78 50.6a78487.3 78487.3 0 0 1-35.23 20.18l.11 9.14L141 59.68l-.23-9.07ZM50.83 80.15l.06-6.33 20.1-23.38H71v9.26L55 79\" />\n <path d=\"M71.3 97.6 50.89 73.81l-.06 9.33L71.3 107v-9.4Zm20.03-14.5-.07-9.33L71 50.44v9.26l16 18.8\" />\n <path d=\"m71.3 97.6 19.96-23.83.06 9.33L71.3 107v-9.4Z\" />\n </g>\n </svg>\n );\n },\n);\nWeb3Graphic.displayName = \"Web3Graphic\";\n","import { Slot } from \"@radix-ui/react-slot\";\nimport { ReactNode, cloneElement, forwardRef, isValidElement } from \"react\";\n\nexport interface HeadlessComponentProps {\n /** A class name for styling the element. */\n className?: string;\n /**\n * Whether to render as the child element instead of the default element provided.\n * All props will be merged into the child element.\n */\n asChild?: boolean;\n children?: ReactNode;\n}\n\n/**\n * Gets an HTML element type from its tag name\n * @example\n * HTMLElementFromTag<\"img\"> // resolved type: HTMLImageElement\n */\ntype HTMLElementFromTag<T extends keyof JSX.IntrinsicElements> =\n JSX.IntrinsicElements[T] extends React.ClassAttributes<infer Element>\n ? Element\n : HTMLElement;\n\nexport function createHeadlessComponent<\n TElement extends keyof JSX.IntrinsicElements,\n>(\n displayName: string,\n elementType: TElement,\n props?:\n | JSX.IntrinsicElements[TElement]\n | ((displayName: string) => JSX.IntrinsicElements[TElement]),\n) {\n const component = forwardRef<\n HTMLElementFromTag<TElement>,\n HeadlessComponentProps\n >(({ className, asChild, children }, ref) => {\n const Component = asChild ? Slot : elementType;\n\n const { children: defaultChildren, ...resolvedProps } =\n typeof props === \"function\" ? props(displayName) : (props ?? {});\n const resolvedChildren =\n /**\n * Use props' default children if no children are set in the component element's children and when asChild is true.\n */\n asChild && isValidElement(children) && !children.props.children\n ? cloneElement(children, {}, defaultChildren)\n : (children ?? defaultChildren);\n\n return (\n /**\n * Due to the complexity of the types at play, TypeScript reports the\n * following error for our JSX below:\n *\n * `Expression produces a union type that is too complex to represent.`\n *\n * We can safely ignore this error and retain accurate return types for\n * consumers of this function. The only drawback is that type-checking is\n * ignored for the JSX block below.\n */\n // @ts-expect-error\n <Component ref={ref} className={className} {...resolvedProps}>\n {resolvedChildren}\n </Component>\n );\n });\n component.displayName = displayName;\n\n return component;\n}\n","import {\n Dispatch,\n ForwardRefExoticComponent,\n ReactNode,\n RefAttributes,\n SVGProps,\n SetStateAction,\n createContext,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { LinkGraphic } from \"../graphics/LinkGraphic\";\nimport { WalletGraphic } from \"../graphics/WalletGraphic\";\nimport { Web3Graphic } from \"../graphics/Web3Graphic\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nexport const EXPLORE_ECOSYSTEM_URL =\n \"https://aptosnetwork.com/ecosystem/directory/category/defi\";\n\nconst AboutPetraWebContext = createContext<{\n screenIndex: number;\n setScreenIndex: Dispatch<SetStateAction<number>>;\n} | null>(null);\n\nfunction useAboutPetraWebContext(displayName: string) {\n const context = useContext(AboutPetraWebContext);\n\n if (!context) {\n throw new Error(`\\`${displayName}\\` must be used within \\`AboutPetraWeb\\``);\n }\n\n return context;\n}\n\nconst educationScreens = [\n {\n Graphic: LinkGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h3\", {\n children: \"A better way to login.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Petra Web is a web3 wallet that uses a Social Login to create accounts on the Aptos blockchain.\",\n }),\n },\n {\n Graphic: WalletGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"What is a wallet?\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Wallets are a secure way to send, receive, and interact with digital assets like cryptocurrencies & NFTs.\",\n }),\n },\n {\n Graphic: Web3Graphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"Explore more of web3.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children: (\n <>\n Petra Web lets you take one account across any application built on\n Aptos.{\" \"}\n <a\n href={EXPLORE_ECOSYSTEM_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Explore the ecosystem\n </a>\n .\n </>\n ),\n }),\n },\n];\n\nconst educationScreenIndicators = Array(educationScreens.length)\n .fill(null)\n .map((_, index) =>\n createHeadlessComponent(\n \"AboutPetraWeb.ScreenIndicator\",\n \"button\",\n (displayName) => {\n const context = useAboutPetraWebContext(displayName);\n const isActive = context.screenIndex - 1 === index;\n\n return {\n \"aria-label\": `Go to screen ${index + 1}`,\n \"aria-current\": isActive ? \"step\" : undefined,\n \"data-active\": isActive || undefined,\n onClick: () => {\n context.setScreenIndex(index + 1);\n },\n };\n },\n ),\n );\n\nexport interface AboutPetraWebEducationScreen {\n /** A component that renders an SVG to illustrate the idea of the current screen. */\n Graphic: ForwardRefExoticComponent<\n Omit<SVGProps<SVGSVGElement>, \"ref\"> & RefAttributes<SVGSVGElement>\n >;\n /** A headless component that renders the title of the current screen. */\n Title: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLHeadingElement>\n >;\n /** A headless component that renders the description text of the current screen. */\n Description: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLParagraphElement>\n >;\n /** The index of the current education screen. */\n screenIndex: number;\n /** The total number of education screens. */\n totalScreens: number;\n /**\n * An array of headless components for indicating the current screen of the set.\n * Each indicator will navigate the user to the screen it represents when clicked.\n */\n screenIndicators: typeof educationScreenIndicators;\n /**\n * A function that navigates the user to the previous education screen.\n * If the user is on the first education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n back: () => void;\n /**\n * A function that navigates the user to the next education screen.\n * If the user is on the last education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n next: () => void;\n /** A function that navigates the user to the initial wallet selection screen. */\n cancel: () => void;\n}\n\nexport interface AboutPetraWebProps {\n /**\n * A function for defining how each education screen should be rendered.\n * Each screen is modeled as a uniform set of headless components and utilities\n * that allow you to construct your UI and apply your own styles.\n */\n renderEducationScreen: (screen: AboutPetraWebEducationScreen) => ReactNode;\n /**\n * The initial wallet selection UI that will be replaced by the education\n * screens when `AboutPetraWeb.Trigger` is clicked.\n */\n children?: ReactNode;\n}\n\nconst Root = ({ renderEducationScreen, children }: AboutPetraWebProps) => {\n const [screenIndex, setScreenIndex] = useState(0);\n\n const currentEducationScreen: AboutPetraWebEducationScreen = useMemo(\n () =>\n educationScreens.map((screen, i) => ({\n ...screen,\n screenIndex: i,\n totalScreens: educationScreens.length,\n screenIndicators: educationScreenIndicators,\n back: () => {\n setScreenIndex(screenIndex - 1);\n },\n next: () => {\n setScreenIndex(\n screenIndex === educationScreens.length ? 0 : screenIndex + 1,\n );\n },\n cancel: () => {\n setScreenIndex(0);\n },\n }))[screenIndex - 1],\n [screenIndex],\n );\n\n return (\n <AboutPetraWebContext.Provider value={{ screenIndex, setScreenIndex }}>\n {screenIndex === 0\n ? children\n : renderEducationScreen(currentEducationScreen)}\n </AboutPetraWebContext.Provider>\n );\n};\nRoot.displayName = \"AboutPetraWeb\";\n\nconst Trigger = createHeadlessComponent(\n \"AboutPetraWeb.Trigger\",\n \"button\",\n (displayName) => {\n const context = useAboutPetraWebContext(displayName);\n\n return {\n onClick: () => {\n context.setScreenIndex(1);\n },\n };\n },\n);\n\n/**\n * A headless component for rendering education screens that explain the basics\n * of Petra Web and web3 wallets.\n */\nexport const AboutPetraWeb = Object.assign(Root, {\n Trigger,\n});\n","import { forwardRef } from \"react\";\nimport { SmallAptosLogo } from \"../graphics/SmallAptosLogo\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nexport const APTOS_PRIVACY_POLICY_URL = \"https://aptoslabs.com/privacy\";\n\nconst Root = createHeadlessComponent(\"AptosPrivacyPolicy.Root\", \"div\");\n\nconst Disclaimer = createHeadlessComponent(\n \"AptosPrivacyPolicy.Disclaimer\",\n \"span\",\n { children: \"By continuing, you agree to Aptos Labs'\" },\n);\n\nconst Link = createHeadlessComponent(\"AptosPrivacyPolicy.Disclaimer\", \"a\", {\n href: APTOS_PRIVACY_POLICY_URL,\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n children: \"Privacy Policy\",\n});\n\nconst PoweredBy = forwardRef<\n HTMLDivElement,\n Pick<HeadlessComponentProps, \"className\">\n>(({ className }, ref) => {\n return (\n <div ref={ref} className={className}>\n <span>Powered by</span>\n <SmallAptosLogo />\n <span>Aptos Labs</span>\n </div>\n );\n});\nPoweredBy.displayName = \"AptosPrivacyPolicy.PoweredBy\";\n\n/**\n * A headless component for rendering the Aptos Labs privacy policy disclaimer\n * that should be placed under the Petra Web login options.\n */\nexport const AptosPrivacyPolicy = Object.assign(Root, {\n Disclaimer,\n Link,\n PoweredBy,\n});\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const SmallAptosLogo = forwardRef<\n SVGSVGElement,\n SVGProps<SVGSVGElement>\n>((props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 12 12\"\n fill=\"none\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM7.17547 3.67976C7.13401 3.72309 7.07649 3.74757 7.01648 3.74757H3.00775C3.69185 2.83824 4.77995 2.25 6.00569 2.25C7.23142 2.25 8.31953 2.83824 9.00362 3.74757H8.28524C8.20824 3.74757 8.13498 3.71468 8.08401 3.65701L7.81608 3.35416C7.77618 3.30896 7.71882 3.28308 7.6585 3.28308H7.6454C7.58805 3.28308 7.53318 3.30646 7.49343 3.34792L7.17547 3.67976ZM8.05656 4.75897H7.39569C7.31869 4.75897 7.24543 4.72593 7.19447 4.66842L6.92638 4.36557C6.88647 4.32036 6.82896 4.29465 6.7688 4.29465C6.70863 4.29465 6.65112 4.32052 6.61121 4.36557L6.38131 4.6254C6.30603 4.71034 6.19801 4.75913 6.08454 4.75913H2.46703C2.36401 5.05278 2.29683 5.36296 2.27002 5.68467H5.68505C5.74506 5.68467 5.80258 5.66019 5.84404 5.61686L6.16201 5.28502C6.20175 5.24356 6.25662 5.22018 6.31398 5.22018H6.32707C6.38739 5.22018 6.44475 5.24606 6.48465 5.29126L6.75258 5.59411C6.80355 5.65178 6.87681 5.68467 6.95381 5.68467H9.74133C9.71452 5.3628 9.64734 5.05263 9.54431 4.75913H8.05641L8.05656 4.75897ZM4.33651 7.63095C4.39652 7.63095 4.45404 7.60648 4.4955 7.56315L4.81347 7.23131C4.85321 7.18985 4.90808 7.16647 4.96544 7.16647H4.97853C5.03885 7.16647 5.09621 7.19234 5.13611 7.23739L5.40404 7.54024C5.45501 7.59791 5.52827 7.6308 5.60527 7.6308H9.38285C9.52438 7.33839 9.62803 7.02463 9.68975 6.69591H6.06383C5.98683 6.69591 5.91357 6.66287 5.8626 6.60535L5.59467 6.3025C5.55477 6.2573 5.49725 6.23158 5.43709 6.23158C5.37692 6.23158 5.31941 6.25746 5.27951 6.3025L5.0496 6.56233C4.97432 6.64728 4.86631 6.69606 4.75268 6.69606H2.32147C2.3832 7.02479 2.487 7.33855 2.62837 7.63095H4.33651ZM5.57359 8.55745H4.59116C4.51417 8.55745 4.44091 8.52441 4.38994 8.46689L4.12201 8.16404C4.0821 8.11884 4.02459 8.09312 3.96442 8.09312C3.90426 8.09312 3.84675 8.119 3.80684 8.16404L3.57694 8.42387C3.50166 8.50882 3.39364 8.55761 3.28001 8.55761H3.26474C3.94915 9.29096 4.92378 9.74998 6.00596 9.74998C7.08815 9.74998 8.06262 9.29096 8.74719 8.55761H5.57359V8.55745Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n});\nSmallAptosLogo.displayName = \"SmallAptosLogo\";\n","import {\n AdapterNotDetectedWallet,\n AdapterWallet,\n WalletReadyState,\n isRedirectable,\n} from \"@aptos-labs/wallet-adapter-core\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { createContext, forwardRef, useCallback, useContext } from \"react\";\nimport { useWallet } from \"../useWallet\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nexport interface WalletItemProps extends HeadlessComponentProps {\n /** The wallet option to be displayed. */\n wallet: AdapterWallet | AdapterNotDetectedWallet;\n /** A callback to be invoked when the wallet is connected. */\n onConnect?: () => void;\n}\n\nfunction useWalletItemContext(displayName: string) {\n const context = useContext(WalletItemContext);\n\n if (!context) {\n throw new Error(`\\`${displayName}\\` must be used within \\`WalletItem\\``);\n }\n\n return context;\n}\n\nconst WalletItemContext = createContext<{\n wallet: AdapterWallet | AdapterNotDetectedWallet;\n connectWallet: () => void;\n} | null>(null);\n\nconst Root = forwardRef<HTMLDivElement, WalletItemProps>(\n ({ wallet, onConnect, className, asChild, children }, ref) => {\n const { connect } = useWallet();\n\n const connectWallet = useCallback(() => {\n connect(wallet.name);\n onConnect?.();\n }, [connect, wallet.name, onConnect]);\n\n const isWalletReady = wallet.readyState === WalletReadyState.Installed;\n\n const mobileSupport =\n \"deeplinkProvider\" in wallet && wallet.deeplinkProvider;\n\n if (!isWalletReady && isRedirectable() && !mobileSupport) return null;\n\n const Component = asChild ? Slot : \"div\";\n\n return (\n <WalletItemContext.Provider value={{ wallet, connectWallet }}>\n <Component ref={ref} className={className}>\n {children}\n </Component>\n </WalletItemContext.Provider>\n );\n },\n);\nRoot.displayName = \"WalletItem\";\n\nconst Icon = createHeadlessComponent(\n \"WalletItem.Icon\",\n \"img\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n src: context.wallet.icon,\n alt: `${context.wallet.name} icon`,\n };\n },\n);\n\nconst Name = createHeadlessComponent(\n \"WalletItem.Name\",\n \"div\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n children: context.wallet.name,\n };\n },\n);\n\nconst ConnectButton = createHeadlessComponent(\n \"WalletItem.ConnectButton\",\n \"button\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n onClick: context.connectWallet,\n children: \"Connect\",\n };\n },\n);\n\nconst InstallLink = createHeadlessComponent(\n \"WalletItem.InstallLink\",\n \"a\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n href: context.wallet.url,\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n children: \"Install\",\n };\n },\n);\n\n/** A headless component for rendering a wallet option's name, icon, and either connect button or install link. */\nexport const WalletItem = Object.assign(Root, {\n Icon,\n Name,\n ConnectButton,\n InstallLink,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;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B,WAAW;AAEhD,WAAO;AAAA,MACL,UAAU,QAAQ,OAAO;AAAA,IAC3B;AAAA,EACF;AACF;AAEA,IAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA,CAAC,gBAAgB;AACf,UAAM,UAAU,qBAAqB,WAAW;AAEhD,WAAO;AAAA,MACL,SAAS,QAAQ;AAAA,MACjB,UAAU;AAAA,IACZ;AAAA,EACF;AACF;AAEA,IAAM,cAAc;AAAA,EAClB;AAAA,EACA;AAAA,EACA,CAAC,gBAAgB;AACf,UAAM,UAAU,qBAAqB,WAAW;AAEhD,WAAO;AAAA,MACL,MAAM,QAAQ,OAAO;AAAA,MACrB,QAAQ;AAAA,MACR,KAAK;AAAA,MACL,UAAU;AAAA,IACZ;AAAA,EACF;AACF;AAGO,IAAM,aAAa,OAAO,OAAOA,OAAM;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":["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 \"./WalletProvider\";\nexport * from \"./components/AboutAptosConnect\";\nexport * from \"./components/AboutPetraWeb\";\nexport * from \"./components/AptosPrivacyPolicy\";\nexport * from \"./components/WalletItem\";\nexport * from \"./useWallet\";\n","import {\n AvailableWallets,\n DappConfig,\n AccountInfo,\n AdapterWallet,\n NetworkInfo,\n InputTransactionData,\n AptosSignAndSubmitTransactionOutput,\n AnyRawTransaction,\n InputGenerateTransactionOptions,\n AccountAuthenticator,\n AptosSignMessageInput,\n AptosSignMessageOutput,\n AdapterNotDetectedWallet,\n WalletCore,\n Network,\n InputSubmitTransactionData,\n PendingTransactionResponse,\n WalletReadyState,\n AptosSignInInput,\n AptosSignInOutput,\n} from \"@aptos-labs/wallet-adapter-core\";\nimport { ReactNode, FC, useState, useEffect, useCallback, useRef } from \"react\";\nimport { WalletContext } from \"./useWallet\";\n\nexport interface AptosWalletProviderProps {\n children: ReactNode;\n optInWallets?: ReadonlyArray<AvailableWallets>;\n hideWallets?: ReadonlyArray<AvailableWallets>;\n autoConnect?:\n | boolean\n | ((core: WalletCore, adapter: AdapterWallet) => Promise<boolean>);\n dappConfig?: DappConfig;\n disableTelemetry?: boolean;\n onError?: (error: any) => void;\n}\n\nconst initialState: {\n account: AccountInfo | null;\n network: NetworkInfo | null;\n connected: boolean;\n wallet: AdapterWallet | null;\n} = {\n connected: false,\n account: null,\n network: null,\n wallet: null,\n};\n\nexport const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({\n children,\n optInWallets,\n hideWallets,\n autoConnect = false,\n dappConfig,\n disableTelemetry = false,\n onError,\n}: AptosWalletProviderProps) => {\n const didAttemptAutoConnectRef = useRef(false);\n\n const [{ account, network, connected, wallet }, setState] =\n useState(initialState);\n\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [walletCore, setWalletCore] = useState<WalletCore>();\n\n const [wallets, setWallets] = useState<ReadonlyArray<AdapterWallet>>([]);\n const [hiddenWallets, setHiddenWallets] = useState<\n ReadonlyArray<AdapterWallet>\n >([]);\n const [notDetectedWallets, setNotDetectedWallets] = useState<\n ReadonlyArray<AdapterNotDetectedWallet>\n >([]);\n // Use a ref to ensure we only setup derivation once per mount/network change\n // or to prevent double-registration in strict mode\n const derivationInitialized = useRef(false);\n // Initialize WalletCore on first load\n useEffect(() => {\n const walletCore = new WalletCore(\n optInWallets,\n dappConfig,\n disableTelemetry,\n hideWallets ? hideWallets : [\"Petra Web\"],\n );\n setWalletCore(walletCore);\n }, []);\n\n // Update initial Wallets state once WalletCore has been initialized\n useEffect(() => {\n setWallets(walletCore?.wallets ?? []);\n setHiddenWallets(walletCore?.hiddenWallets ?? []);\n setNotDetectedWallets(walletCore?.notDetectedWallets ?? []);\n }, [walletCore]);\n\n useEffect(() => {\n // Only attempt to auto connect once per render and only if there are wallets\n if (didAttemptAutoConnectRef.current || !walletCore?.wallets.length) {\n return;\n }\n didAttemptAutoConnectRef.current = true;\n\n // If auto connect is not set or is false, ignore the attempt\n if (!autoConnect) {\n setIsLoading(false);\n return;\n }\n\n // Make sure the user has a previously connected wallet\n const walletName = localStorage.getItem(\"AptosWalletName\");\n if (!walletName) {\n setIsLoading(false);\n return;\n }\n\n // Make sure the wallet is installed\n const selectedWallet = walletCore.wallets.find(\n (e) => e.name === walletName,\n ) as AdapterWallet | undefined;\n if (\n !selectedWallet ||\n selectedWallet.readyState !== WalletReadyState.Installed\n ) {\n setIsLoading(false);\n return;\n }\n\n if (!connected) {\n (async () => {\n try {\n let shouldConnect = true;\n\n // Providing a function to autoConnect allows the dapp to determine\n // whether to attempt to connect to the wallet using the `signIn`\n // or `connect` method. If `signIn` is successful, the user can\n // return `false` and skip the `connect` method.\n if (typeof autoConnect === \"function\") {\n shouldConnect = await autoConnect(walletCore, selectedWallet);\n } else {\n shouldConnect = autoConnect;\n }\n\n if (shouldConnect) await connect(walletName);\n } catch (error) {\n if (onError) onError(error);\n return Promise.reject(error);\n } finally {\n setIsLoading(false);\n }\n })();\n } else {\n setIsLoading(false);\n }\n }, [autoConnect, wallets]);\n\n useEffect(() => {\n // Initialize cross-chain wallet support based on dappConfig flags.\n // Dynamically imports the packages to avoid bundling them when not used.\n if (!derivationInitialized.current) {\n // Use a wrapper function to prevent bundlers from statically analyzing the import\n const dynamicImport = (moduleName: string) =>\n new Function(\"m\", \"return import(m)\")(moduleName) as Promise<any>;\n\n if (dappConfig?.crossChainWallets?.solana) {\n import(\"@aptos-labs/derived-wallet-solana\").then(\n ({ setupAutomaticSolanaWalletDerivation }) => {\n setupAutomaticSolanaWalletDerivation({\n defaultNetwork: dappConfig?.network,\n });\n },\n );\n }\n if (dappConfig?.crossChainWallets?.evm) {\n dynamicImport(\"@aptos-labs/derived-wallet-ethereum\").then(\n ({ setupAutomaticEthereumWalletDerivation }) => {\n setupAutomaticEthereumWalletDerivation({\n defaultNetwork: dappConfig?.network,\n });\n },\n );\n }\n derivationInitialized.current = true;\n }\n }, [network]);\n\n const connect = async (walletName: string): Promise<void> => {\n try {\n setIsLoading(true);\n await walletCore?.connect(walletName);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n } finally {\n setIsLoading(false);\n }\n };\n\n const signIn = async (args: {\n walletName: string;\n input: AptosSignInInput;\n }): Promise<AptosSignInOutput> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n\n try {\n setIsLoading(true);\n return await walletCore?.signIn(args);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n } finally {\n setIsLoading(false);\n }\n };\n\n const disconnect = async (): Promise<void> => {\n try {\n await walletCore?.disconnect();\n } catch (error) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signAndSubmitTransaction = async (\n transaction: InputTransactionData,\n ): Promise<AptosSignAndSubmitTransactionOutput> => {\n try {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n return await walletCore.signAndSubmitTransaction(transaction);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signTransaction = async (args: {\n transactionOrPayload: AnyRawTransaction | InputTransactionData;\n asFeePayer?: boolean;\n options?: InputGenerateTransactionOptions & {\n expirationSecondsFromNow?: number;\n expirationTimestamp?: number;\n };\n }): Promise<{\n authenticator: AccountAuthenticator;\n rawTransaction: Uint8Array;\n }> => {\n const { transactionOrPayload, asFeePayer, options } = args;\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore.signTransaction({\n transactionOrPayload,\n asFeePayer,\n });\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const submitTransaction = async (\n transaction: InputSubmitTransactionData,\n ): Promise<PendingTransactionResponse> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.submitTransaction(transaction);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signMessage = async (\n message: AptosSignMessageInput,\n ): Promise<AptosSignMessageOutput> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.signMessage(message);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const signMessageAndVerify = async (\n message: AptosSignMessageInput,\n ): Promise<boolean> => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.signMessageAndVerify(message);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n const changeNetwork = async (network: Network) => {\n if (!walletCore) {\n throw new Error(\"WalletCore is not initialized\");\n }\n try {\n return await walletCore?.changeNetwork(network);\n } catch (error: any) {\n if (onError) onError(error);\n return Promise.reject(error);\n }\n };\n\n // Handle the adapter's connect event\n const handleConnect = (): void => {\n setState((state) => {\n return {\n ...state,\n connected: true,\n account: walletCore?.account || null,\n network: walletCore?.network || null,\n wallet: walletCore?.wallet || null,\n };\n });\n };\n\n // Handle the adapter's account change event\n const handleAccountChange = useCallback((): void => {\n if (!connected) return;\n if (!walletCore?.wallet) return;\n setState((state) => {\n return {\n ...state,\n account: walletCore?.account || null,\n };\n });\n }, [connected]);\n\n // Handle the adapter's network event\n const handleNetworkChange = useCallback((): void => {\n if (!connected) return;\n if (!walletCore?.wallet) return;\n setState((state) => {\n return {\n ...state,\n network: walletCore?.network || null,\n };\n });\n }, [connected]);\n\n useEffect(() => {\n if (connected) {\n walletCore?.onAccountChange();\n walletCore?.onNetworkChange();\n }\n }, [connected]);\n\n // Handle the adapter's disconnect event\n const handleDisconnect = (): void => {\n if (!connected) return;\n setState((state) => {\n return {\n ...state,\n connected: false,\n account: walletCore?.account || null,\n network: walletCore?.network || null,\n wallet: null,\n };\n });\n };\n\n const handleStandardWalletsAdded = (standardWallet: AdapterWallet): void => {\n // Manage current wallet state by removing optional duplications\n // as new wallets are coming\n const existingWalletIndex = wallets.findIndex(\n (wallet) => wallet.name == standardWallet.name,\n );\n if (existingWalletIndex !== -1) {\n // If wallet exists, replace it with the new wallet\n setWallets((wallets) => [\n ...wallets.slice(0, existingWalletIndex),\n standardWallet,\n ...wallets.slice(existingWalletIndex + 1),\n ]);\n } else {\n // If wallet doesn't exist, add it to the array\n setWallets((wallets) => [...wallets, standardWallet]);\n }\n };\n\n const handleStandardWalletsHiddenAdded = (\n standardWallet: AdapterWallet,\n ): void => {\n // Manage hidden wallet state by removing optional duplications\n // as new wallets are coming\n const existingWalletIndex = hiddenWallets.findIndex(\n (wallet) => wallet.name === standardWallet.name,\n );\n if (existingWalletIndex !== -1) {\n // If wallet exists, replace it with the new wallet\n setHiddenWallets((hiddenWallets) => [\n ...hiddenWallets.slice(0, existingWalletIndex),\n standardWallet,\n ...hiddenWallets.slice(existingWalletIndex + 1),\n ]);\n } else {\n // If wallet doesn't exist, add it to the array\n setHiddenWallets((hiddenWallets) => [...hiddenWallets, standardWallet]);\n }\n };\n\n const handleStandardNotDetectedWalletsAdded = (\n notDetectedWallet: AdapterNotDetectedWallet,\n ): void => {\n // Manage current wallet state by removing optional duplications\n // as new wallets are coming\n const existingWalletIndex = wallets.findIndex(\n (wallet) => wallet.name == notDetectedWallet.name,\n );\n if (existingWalletIndex !== -1) {\n // If wallet exists, replace it with the new wallet\n setNotDetectedWallets((wallets) => [\n ...wallets.slice(0, existingWalletIndex),\n notDetectedWallet,\n ...wallets.slice(existingWalletIndex + 1),\n ]);\n } else {\n // If wallet doesn't exist, add it to the array\n setNotDetectedWallets((wallets) => [...wallets, notDetectedWallet]);\n }\n };\n\n useEffect(() => {\n walletCore?.on(\"connect\", handleConnect);\n walletCore?.on(\"accountChange\", handleAccountChange);\n walletCore?.on(\"networkChange\", handleNetworkChange);\n walletCore?.on(\"disconnect\", handleDisconnect);\n walletCore?.on(\"standardWalletsAdded\", handleStandardWalletsAdded);\n walletCore?.on(\n \"standardWalletsHiddenAdded\",\n handleStandardWalletsHiddenAdded,\n );\n walletCore?.on(\n \"standardNotDetectedWalletAdded\",\n handleStandardNotDetectedWalletsAdded,\n );\n return () => {\n walletCore?.off(\"connect\", handleConnect);\n walletCore?.off(\"accountChange\", handleAccountChange);\n walletCore?.off(\"networkChange\", handleNetworkChange);\n walletCore?.off(\"disconnect\", handleDisconnect);\n walletCore?.off(\"standardWalletsAdded\", handleStandardWalletsAdded);\n walletCore?.off(\n \"standardWalletsHiddenAdded\",\n handleStandardWalletsHiddenAdded,\n );\n walletCore?.off(\n \"standardNotDetectedWalletAdded\",\n handleStandardNotDetectedWalletsAdded,\n );\n };\n }, [wallets, account]);\n\n return (\n <WalletContext.Provider\n value={{\n connect,\n signIn,\n disconnect,\n signAndSubmitTransaction,\n signTransaction,\n signMessage,\n signMessageAndVerify,\n changeNetwork,\n submitTransaction,\n account,\n network,\n connected,\n wallet,\n wallets,\n notDetectedWallets,\n hiddenWallets,\n isLoading,\n }}\n >\n {children}\n </WalletContext.Provider>\n );\n};\n","import { useContext, createContext } from \"react\";\nimport {\n AccountAuthenticator,\n AccountInfo,\n AdapterWallet,\n AnyRawTransaction,\n AptosSignAndSubmitTransactionOutput,\n InputTransactionData,\n NetworkInfo,\n AptosSignMessageInput,\n AptosSignMessageOutput,\n AdapterNotDetectedWallet,\n Network,\n AptosChangeNetworkOutput,\n PendingTransactionResponse,\n InputSubmitTransactionData,\n AptosSignInInput,\n AptosSignInOutput,\n} from \"@aptos-labs/wallet-adapter-core\";\n\nexport interface WalletContextState {\n connected: boolean;\n isLoading: boolean;\n account: AccountInfo | null;\n network: NetworkInfo | null;\n connect(walletName: string): void;\n signIn(args: {\n walletName: string;\n input: AptosSignInInput;\n }): Promise<AptosSignInOutput | void>;\n signAndSubmitTransaction(\n transaction: InputTransactionData,\n ): Promise<AptosSignAndSubmitTransactionOutput>;\n signTransaction(args: {\n transactionOrPayload: AnyRawTransaction | InputTransactionData;\n asFeePayer?: boolean;\n }): Promise<{\n authenticator: AccountAuthenticator;\n rawTransaction: Uint8Array;\n }>;\n signMessage(message: AptosSignMessageInput): Promise<AptosSignMessageOutput>;\n signMessageAndVerify(message: AptosSignMessageInput): Promise<boolean>;\n disconnect(): void;\n changeNetwork(network: Network): Promise<AptosChangeNetworkOutput>;\n submitTransaction(\n transaction: InputSubmitTransactionData,\n ): Promise<PendingTransactionResponse>;\n wallet: AdapterWallet | null;\n wallets: ReadonlyArray<AdapterWallet>;\n hiddenWallets: ReadonlyArray<AdapterWallet>;\n notDetectedWallets: ReadonlyArray<AdapterNotDetectedWallet>;\n}\n\nconst DEFAULT_CONTEXT = {\n connected: false,\n};\n\nexport const WalletContext = createContext<WalletContextState>(\n DEFAULT_CONTEXT as WalletContextState,\n);\n\nexport function useWallet(): WalletContextState {\n const context = useContext(WalletContext);\n if (!context) {\n throw new Error(\"useWallet must be used within a WalletContextState\");\n }\n return context;\n}\n","import {\n Dispatch,\n ForwardRefExoticComponent,\n ReactNode,\n RefAttributes,\n SVGProps,\n SetStateAction,\n createContext,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { LinkGraphic } from \"../graphics/LinkGraphic\";\nimport { WalletGraphic } from \"../graphics/WalletGraphic\";\nimport { Web3Graphic } from \"../graphics/Web3Graphic\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nconst EXPLORE_ECOSYSTEM_URL =\n \"https://aptosnetwork.com/ecosystem/directory/category/defi\";\n\nconst AboutAptosConnectContext = createContext<{\n screenIndex: number;\n setScreenIndex: Dispatch<SetStateAction<number>>;\n} | null>(null);\n\nfunction useAboutAptosConnectContext(displayName: string) {\n const context = useContext(AboutAptosConnectContext);\n\n if (!context) {\n throw new Error(\n `\\`${displayName}\\` must be used within \\`AboutAptosConnect\\``,\n );\n }\n\n return context;\n}\n\nconst educationScreens = [\n {\n Graphic: LinkGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h3\", {\n children: \"A better way to login.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Petra Web is a web3 wallet that uses a Social Login to create accounts on the Aptos blockchain.\",\n }),\n },\n {\n Graphic: WalletGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"What is a wallet?\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Wallets are a secure way to send, receive, and interact with digital assets like cryptocurrencies & NFTs.\",\n }),\n },\n {\n Graphic: Web3Graphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"Explore more of web3.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children: (\n <>\n Petra Web lets you take one account across any application built on\n Aptos.{\" \"}\n <a\n href={EXPLORE_ECOSYSTEM_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Explore the ecosystem\n </a>\n .\n </>\n ),\n }),\n },\n];\n\nconst educationScreenIndicators = Array(educationScreens.length)\n .fill(null)\n .map((_, index) =>\n createHeadlessComponent(\n \"AboutAptosConnect.ScreenIndicator\",\n \"button\",\n (displayName) => {\n const context = useAboutAptosConnectContext(displayName);\n const isActive = context.screenIndex - 1 === index;\n\n return {\n \"aria-label\": `Go to screen ${index + 1}`,\n \"aria-current\": isActive ? \"step\" : undefined,\n \"data-active\": isActive || undefined,\n onClick: () => {\n context.setScreenIndex(index + 1);\n },\n };\n },\n ),\n );\n\n/** @deprecated Use {@link AboutPetraWebEducationScreen} instead. */\nexport interface AboutAptosConnectEducationScreen {\n /** A component that renders an SVG to illustrate the idea of the current screen. */\n Graphic: ForwardRefExoticComponent<\n Omit<SVGProps<SVGSVGElement>, \"ref\"> & RefAttributes<SVGSVGElement>\n >;\n /** A headless component that renders the title of the current screen. */\n Title: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLHeadingElement>\n >;\n /** A headless component that renders the description text of the current screen. */\n Description: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLParagraphElement>\n >;\n /** The index of the current education screen. */\n screenIndex: number;\n /** The total number of education screens. */\n totalScreens: number;\n /**\n * An array of headless components for indicating the current screen of the set.\n * Each indicator will navigate the user to the screen it represents when clicked.\n */\n screenIndicators: typeof educationScreenIndicators;\n /**\n * A function that navigates the user to the previous education screen.\n * If the user is on the first education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n back: () => void;\n /**\n * A function that navigates the user to the next education screen.\n * If the user is on the last education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n next: () => void;\n /** A function that navigates the user to the initial wallet selection screen. */\n cancel: () => void;\n}\n\n/** @deprecated Use {@link AboutPetraWebProps} instead. */\nexport interface AboutAptosConnectProps {\n /**\n * A function for defining how each education screen should be rendered.\n * Each screen is modeled as a uniform set of headless components and utilities\n * that allow you to construct your UI and apply your own styles.\n */\n renderEducationScreen: (\n screen: AboutAptosConnectEducationScreen,\n ) => ReactNode;\n /**\n * The initial wallet selection UI that will be replaced by the education\n * screens when `AboutAptosConnect.Trigger` is clicked.\n */\n children?: ReactNode;\n}\n\nconst Root = ({ renderEducationScreen, children }: AboutAptosConnectProps) => {\n const [screenIndex, setScreenIndex] = useState(0);\n\n const currentEducationScreen: AboutAptosConnectEducationScreen = useMemo(\n () =>\n educationScreens.map((screen, i) => ({\n ...screen,\n screenIndex: i,\n totalScreens: educationScreens.length,\n screenIndicators: educationScreenIndicators,\n back: () => {\n setScreenIndex(screenIndex - 1);\n },\n next: () => {\n setScreenIndex(\n screenIndex === educationScreens.length ? 0 : screenIndex + 1,\n );\n },\n cancel: () => {\n setScreenIndex(0);\n },\n }))[screenIndex - 1],\n [screenIndex],\n );\n\n return (\n <AboutAptosConnectContext.Provider value={{ screenIndex, setScreenIndex }}>\n {screenIndex === 0\n ? children\n : renderEducationScreen(currentEducationScreen)}\n </AboutAptosConnectContext.Provider>\n );\n};\nRoot.displayName = \"AboutAptosConnect\";\n\nconst Trigger = createHeadlessComponent(\n \"AboutAptosConnect.Trigger\",\n \"button\",\n (displayName) => {\n const context = useAboutAptosConnectContext(displayName);\n\n return {\n onClick: () => {\n context.setScreenIndex(1);\n },\n };\n },\n);\n\n/**\n * A headless component for rendering education screens that explain the basics\n * of Aptos Connect and web3 wallets.\n *\n * @deprecated Use {@link AboutPetraWeb} instead.\n */\nexport const AboutAptosConnect = Object.assign(Root, {\n Trigger,\n});\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const LinkGraphic = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(\n (props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"102\"\n height=\"132\"\n viewBox=\"0 0 102 132\"\n fill=\"none\"\n {...props}\n >\n <g stroke=\"currentColor\" strokeMiterlimit=\"10\">\n <path d=\"M59.633 80.66c11.742-2.814 17.48-7.018 20.925-13.254l17.518-31.69c6.257-11.317 2.142-25.55-9.189-31.798C82.737.53 75.723.188 69.593 2.398M60.7 69.565a14.09 14.09 0 0 1-6.907-1.767l-.228-.108\" />\n <path d=\"m52.365 41.075 12.507-22.627a14.146 14.146 0 0 1 4.727-5.062M32.407 118.619a14.139 14.139 0 0 1-7.034-1.768c-6.857-3.78-9.353-12.402-5.561-19.25l16.634-30.1a14.097 14.097 0 0 1 4.518-4.923\" />\n <path d=\"M41.211 78.85c11.332 6.248 25.583 2.14 31.84-9.177l17.518-31.691c6.256-11.317 2.142-25.55-9.19-31.798-6.085-3.357-13.018-3.724-19.104-1.59A23.31 23.31 0 0 0 49.541 15.36L36.863 38.298l7.989 5.036 12.506-22.627c3.786-6.848 12.419-9.34 19.276-5.554 6.856 3.78 9.353 12.402 5.561 19.25l-16.634 30.1c-3.785 6.848-12.418 9.341-19.275 5.555l-5.075 8.791ZM29.5 130.447c12.361-1.37 19.2-6.994 22.966-13.804l12.678-22.936-8.305-5.239\" />\n <path d=\"m55.72 61.947-.442.764 5.511-9.55c-6.901-3.806-18.65-3.124-27.105.814M44.85 43.523l7.635-2.486m-4.221 23.264 7.217-1.723m-9.316 7.517 7.59-2.405m-.562-12.156 7.508-2.221m10.136-51.32L62.761 4.43M49.642 90.778l7.514-2.26m.474 7.448 7.514-2.26m-50.306-60.13c7.135 0 12.918-5.776 12.918-12.9 0-7.126-5.783-12.902-12.918-12.902-7.134 0-12.917 5.776-12.917 12.901s5.783 12.901 12.918 12.901Z\" />\n <path d=\"M15.724 7.774h3.197c7.135 0 12.918 5.776 12.918 12.901 0 7.126-5.783 12.901-12.918 12.901h-3.425m65.112 66.935h3.198c7.135 0 12.918 5.775 12.918 12.901 0 7.125-5.783 12.9-12.918 12.9h-3.425\" />\n <path d=\"M79.717 126.312c7.135 0 12.918-5.775 12.918-12.9s-5.783-12.901-12.918-12.901c-7.134 0-12.917 5.776-12.917 12.901s5.783 12.9 12.917 12.9ZM53.281 55.414c-11.33-6.248-25.582-2.14-31.839 9.177L3.924 96.281c-6.257 11.318-2.142 25.55 9.189 31.799 11.331 6.248 25.582 2.139 31.839-9.177l12.677-22.937-7.988-5.036-12.507 22.627c-3.785 6.848-12.418 9.341-19.275 5.554-6.857-3.781-9.353-12.402-5.561-19.25l16.633-30.1c3.786-6.848 12.419-9.341 19.276-5.555l5.074-8.792Z\" />\n </g>\n </svg>\n );\n },\n);\nLinkGraphic.displayName = \"LinkGraphic\";\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const WalletGraphic = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(\n (props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"128\"\n height=\"102\"\n viewBox=\"0 0 128 102\"\n fill=\"none\"\n {...props}\n >\n <path\n fill=\"currentColor\"\n d=\"m.96 25.93-.36-.35.36.85v-.5Zm7.79-7.81v-.5h-.21l-.15.15.36.35ZM1.3 26.28l7.79-7.8-.7-.71-7.8 7.8.7.71Zm7.44-7.66H10v-1H8.75v1Zm29.22 6.8h-37v1h37.01v-1Z\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M82.25 26.08c0 12.25-9.92 22.2-22.14 22.2a22.17 22.17 0 0 1-22.14-22.2H1.1v74.82h118.02V26.08H82.25Zm44.33 67.02h.33V18.27h-5.7\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M74.52 42.92a22.4 22.4 0 0 1-11.43 3.3 22.5 22.5 0 0 1-22.46-22.53H9.52M119.22 101l7.78-7.82m-7.88-67.1 7.79-7.81m-44.78 7.72 2.73-2.3m-46.89 2.39 2.39-2.4\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M9.86 23.69V5.72h107.97v18.04H84.65\"\n />\n <path\n stroke=\"currentColor\"\n strokeMiterlimit=\"10\"\n d=\"M117.83 20.46h3.39V1H13.25v4.72M9.36 23.69h31.78\"\n />\n </svg>\n );\n },\n);\nWalletGraphic.displayName = \"WalletGraphic\";\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const Web3Graphic = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(\n (props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"142\"\n height=\"108\"\n viewBox=\"0 0 142 108\"\n fill=\"none\"\n {...props}\n >\n <g stroke=\"currentColor\" strokeLinejoin=\"round\">\n <path d=\"m91.26 35.8.06-10.46L71.3 1v10.53L87 30.5m-36.11 5.24-.06-10.45L71.3 1v10.53L55 30.5\" />\n <path d=\"M71 59.55V49.17L50.83 25.3l.06 10.45L57 42.5m14 17.05V49.18l20.33-23.84-.07 10.45L86 42M1 59.68l.22-9.07 35.33-19.8-.1 9L9 55\" />\n <path d=\"M36.55 30.8s-.08 5.92-.1 9l.1-9ZM71 59.51v-9.07L36.55 30.8l-.1 9L63.5 55\" />\n <path d=\"M71 59.51v-9.07L36.44 70.78l-.1 9.14L55.5 68.5\" />\n <path d=\"M1.22 50.6a77387.2 77387.2 0 0 0 35.22 20.18l-.1 9.14L1 59.68l.23-9.07h-.01ZM141 59.68l-.23-9.07-35.33-19.8.11 9L133 55\" />\n <path d=\"m105.44 30.8.11 9-.1-9Z\" />\n <path d=\"M71 59.51v-9.07l34.44-19.64.11 9L78.5 55\" />\n <path d=\"M71 59.51v-9.07l34.56 20.34.1 9.14L87 69\" />\n <path d=\"M140.78 50.6a78487.3 78487.3 0 0 1-35.23 20.18l.11 9.14L141 59.68l-.23-9.07ZM50.83 80.15l.06-6.33 20.1-23.38H71v9.26L55 79\" />\n <path d=\"M71.3 97.6 50.89 73.81l-.06 9.33L71.3 107v-9.4Zm20.03-14.5-.07-9.33L71 50.44v9.26l16 18.8\" />\n <path d=\"m71.3 97.6 19.96-23.83.06 9.33L71.3 107v-9.4Z\" />\n </g>\n </svg>\n );\n },\n);\nWeb3Graphic.displayName = \"Web3Graphic\";\n","import { Slot } from \"@radix-ui/react-slot\";\nimport { ReactNode, cloneElement, forwardRef, isValidElement } from \"react\";\n\nexport interface HeadlessComponentProps {\n /** A class name for styling the element. */\n className?: string;\n /**\n * Whether to render as the child element instead of the default element provided.\n * All props will be merged into the child element.\n */\n asChild?: boolean;\n children?: ReactNode;\n}\n\n/**\n * Gets an HTML element type from its tag name\n * @example\n * HTMLElementFromTag<\"img\"> // resolved type: HTMLImageElement\n */\ntype HTMLElementFromTag<T extends keyof JSX.IntrinsicElements> =\n JSX.IntrinsicElements[T] extends React.ClassAttributes<infer Element>\n ? Element\n : HTMLElement;\n\nexport function createHeadlessComponent<\n TElement extends keyof JSX.IntrinsicElements,\n>(\n displayName: string,\n elementType: TElement,\n props?:\n | JSX.IntrinsicElements[TElement]\n | ((displayName: string) => JSX.IntrinsicElements[TElement]),\n) {\n const component = forwardRef<\n HTMLElementFromTag<TElement>,\n HeadlessComponentProps\n >(({ className, asChild, children }, ref) => {\n const Component = asChild ? Slot : elementType;\n\n const { children: defaultChildren, ...resolvedProps } =\n typeof props === \"function\" ? props(displayName) : (props ?? {});\n const resolvedChildren =\n /**\n * Use props' default children if no children are set in the component element's children and when asChild is true.\n */\n asChild && isValidElement(children) && !children.props.children\n ? cloneElement(children, {}, defaultChildren)\n : (children ?? defaultChildren);\n\n return (\n /**\n * Due to the complexity of the types at play, TypeScript reports the\n * following error for our JSX below:\n *\n * `Expression produces a union type that is too complex to represent.`\n *\n * We can safely ignore this error and retain accurate return types for\n * consumers of this function. The only drawback is that type-checking is\n * ignored for the JSX block below.\n */\n // @ts-expect-error\n <Component ref={ref} className={className} {...resolvedProps}>\n {resolvedChildren}\n </Component>\n );\n });\n component.displayName = displayName;\n\n return component;\n}\n","import {\n Dispatch,\n ForwardRefExoticComponent,\n ReactNode,\n RefAttributes,\n SVGProps,\n SetStateAction,\n createContext,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { LinkGraphic } from \"../graphics/LinkGraphic\";\nimport { WalletGraphic } from \"../graphics/WalletGraphic\";\nimport { Web3Graphic } from \"../graphics/Web3Graphic\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nexport const EXPLORE_ECOSYSTEM_URL =\n \"https://aptosnetwork.com/ecosystem/directory/category/defi\";\n\nconst AboutPetraWebContext = createContext<{\n screenIndex: number;\n setScreenIndex: Dispatch<SetStateAction<number>>;\n} | null>(null);\n\nfunction useAboutPetraWebContext(displayName: string) {\n const context = useContext(AboutPetraWebContext);\n\n if (!context) {\n throw new Error(`\\`${displayName}\\` must be used within \\`AboutPetraWeb\\``);\n }\n\n return context;\n}\n\nconst educationScreens = [\n {\n Graphic: LinkGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h3\", {\n children: \"A better way to login.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Petra Web is a web3 wallet that uses a Social Login to create accounts on the Aptos blockchain.\",\n }),\n },\n {\n Graphic: WalletGraphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"What is a wallet?\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children:\n \"Wallets are a secure way to send, receive, and interact with digital assets like cryptocurrencies & NFTs.\",\n }),\n },\n {\n Graphic: Web3Graphic,\n Title: createHeadlessComponent(\"EducationScreen.Title\", \"h2\", {\n children: \"Explore more of web3.\",\n }),\n Description: createHeadlessComponent(\"EducationScreen.Description\", \"p\", {\n children: (\n <>\n Petra Web lets you take one account across any application built on\n Aptos.{\" \"}\n <a\n href={EXPLORE_ECOSYSTEM_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Explore the ecosystem\n </a>\n .\n </>\n ),\n }),\n },\n];\n\nconst educationScreenIndicators = Array(educationScreens.length)\n .fill(null)\n .map((_, index) =>\n createHeadlessComponent(\n \"AboutPetraWeb.ScreenIndicator\",\n \"button\",\n (displayName) => {\n const context = useAboutPetraWebContext(displayName);\n const isActive = context.screenIndex - 1 === index;\n\n return {\n \"aria-label\": `Go to screen ${index + 1}`,\n \"aria-current\": isActive ? \"step\" : undefined,\n \"data-active\": isActive || undefined,\n onClick: () => {\n context.setScreenIndex(index + 1);\n },\n };\n },\n ),\n );\n\nexport interface AboutPetraWebEducationScreen {\n /** A component that renders an SVG to illustrate the idea of the current screen. */\n Graphic: ForwardRefExoticComponent<\n Omit<SVGProps<SVGSVGElement>, \"ref\"> & RefAttributes<SVGSVGElement>\n >;\n /** A headless component that renders the title of the current screen. */\n Title: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLHeadingElement>\n >;\n /** A headless component that renders the description text of the current screen. */\n Description: ForwardRefExoticComponent<\n HeadlessComponentProps & RefAttributes<HTMLParagraphElement>\n >;\n /** The index of the current education screen. */\n screenIndex: number;\n /** The total number of education screens. */\n totalScreens: number;\n /**\n * An array of headless components for indicating the current screen of the set.\n * Each indicator will navigate the user to the screen it represents when clicked.\n */\n screenIndicators: typeof educationScreenIndicators;\n /**\n * A function that navigates the user to the previous education screen.\n * If the user is on the first education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n back: () => void;\n /**\n * A function that navigates the user to the next education screen.\n * If the user is on the last education screen, they will be navigated to the\n * initial wallet selection screen.\n */\n next: () => void;\n /** A function that navigates the user to the initial wallet selection screen. */\n cancel: () => void;\n}\n\nexport interface AboutPetraWebProps {\n /**\n * A function for defining how each education screen should be rendered.\n * Each screen is modeled as a uniform set of headless components and utilities\n * that allow you to construct your UI and apply your own styles.\n */\n renderEducationScreen: (screen: AboutPetraWebEducationScreen) => ReactNode;\n /**\n * The initial wallet selection UI that will be replaced by the education\n * screens when `AboutPetraWeb.Trigger` is clicked.\n */\n children?: ReactNode;\n}\n\nconst Root = ({ renderEducationScreen, children }: AboutPetraWebProps) => {\n const [screenIndex, setScreenIndex] = useState(0);\n\n const currentEducationScreen: AboutPetraWebEducationScreen = useMemo(\n () =>\n educationScreens.map((screen, i) => ({\n ...screen,\n screenIndex: i,\n totalScreens: educationScreens.length,\n screenIndicators: educationScreenIndicators,\n back: () => {\n setScreenIndex(screenIndex - 1);\n },\n next: () => {\n setScreenIndex(\n screenIndex === educationScreens.length ? 0 : screenIndex + 1,\n );\n },\n cancel: () => {\n setScreenIndex(0);\n },\n }))[screenIndex - 1],\n [screenIndex],\n );\n\n return (\n <AboutPetraWebContext.Provider value={{ screenIndex, setScreenIndex }}>\n {screenIndex === 0\n ? children\n : renderEducationScreen(currentEducationScreen)}\n </AboutPetraWebContext.Provider>\n );\n};\nRoot.displayName = \"AboutPetraWeb\";\n\nconst Trigger = createHeadlessComponent(\n \"AboutPetraWeb.Trigger\",\n \"button\",\n (displayName) => {\n const context = useAboutPetraWebContext(displayName);\n\n return {\n onClick: () => {\n context.setScreenIndex(1);\n },\n };\n },\n);\n\n/**\n * A headless component for rendering education screens that explain the basics\n * of Petra Web and web3 wallets.\n */\nexport const AboutPetraWeb = Object.assign(Root, {\n Trigger,\n});\n","import { forwardRef } from \"react\";\nimport { SmallAptosLogo } from \"../graphics/SmallAptosLogo\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nexport const APTOS_PRIVACY_POLICY_URL = \"https://aptoslabs.com/privacy\";\n\nconst Root = createHeadlessComponent(\"AptosPrivacyPolicy.Root\", \"div\");\n\nconst Disclaimer = createHeadlessComponent(\n \"AptosPrivacyPolicy.Disclaimer\",\n \"span\",\n { children: \"By continuing, you agree to Aptos Labs'\" },\n);\n\nconst Link = createHeadlessComponent(\"AptosPrivacyPolicy.Disclaimer\", \"a\", {\n href: APTOS_PRIVACY_POLICY_URL,\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n children: \"Privacy Policy\",\n});\n\nconst PoweredBy = forwardRef<\n HTMLDivElement,\n Pick<HeadlessComponentProps, \"className\">\n>(({ className }, ref) => {\n return (\n <div ref={ref} className={className}>\n <span>Powered by</span>\n <SmallAptosLogo />\n <span>Aptos Labs</span>\n </div>\n );\n});\nPoweredBy.displayName = \"AptosPrivacyPolicy.PoweredBy\";\n\n/**\n * A headless component for rendering the Aptos Labs privacy policy disclaimer\n * that should be placed under the Petra Web login options.\n */\nexport const AptosPrivacyPolicy = Object.assign(Root, {\n Disclaimer,\n Link,\n PoweredBy,\n});\n","import { SVGProps, forwardRef } from \"react\";\n\nexport const SmallAptosLogo = forwardRef<\n SVGSVGElement,\n SVGProps<SVGSVGElement>\n>((props, ref) => {\n return (\n <svg\n ref={ref}\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 12 12\"\n fill=\"none\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM7.17547 3.67976C7.13401 3.72309 7.07649 3.74757 7.01648 3.74757H3.00775C3.69185 2.83824 4.77995 2.25 6.00569 2.25C7.23142 2.25 8.31953 2.83824 9.00362 3.74757H8.28524C8.20824 3.74757 8.13498 3.71468 8.08401 3.65701L7.81608 3.35416C7.77618 3.30896 7.71882 3.28308 7.6585 3.28308H7.6454C7.58805 3.28308 7.53318 3.30646 7.49343 3.34792L7.17547 3.67976ZM8.05656 4.75897H7.39569C7.31869 4.75897 7.24543 4.72593 7.19447 4.66842L6.92638 4.36557C6.88647 4.32036 6.82896 4.29465 6.7688 4.29465C6.70863 4.29465 6.65112 4.32052 6.61121 4.36557L6.38131 4.6254C6.30603 4.71034 6.19801 4.75913 6.08454 4.75913H2.46703C2.36401 5.05278 2.29683 5.36296 2.27002 5.68467H5.68505C5.74506 5.68467 5.80258 5.66019 5.84404 5.61686L6.16201 5.28502C6.20175 5.24356 6.25662 5.22018 6.31398 5.22018H6.32707C6.38739 5.22018 6.44475 5.24606 6.48465 5.29126L6.75258 5.59411C6.80355 5.65178 6.87681 5.68467 6.95381 5.68467H9.74133C9.71452 5.3628 9.64734 5.05263 9.54431 4.75913H8.05641L8.05656 4.75897ZM4.33651 7.63095C4.39652 7.63095 4.45404 7.60648 4.4955 7.56315L4.81347 7.23131C4.85321 7.18985 4.90808 7.16647 4.96544 7.16647H4.97853C5.03885 7.16647 5.09621 7.19234 5.13611 7.23739L5.40404 7.54024C5.45501 7.59791 5.52827 7.6308 5.60527 7.6308H9.38285C9.52438 7.33839 9.62803 7.02463 9.68975 6.69591H6.06383C5.98683 6.69591 5.91357 6.66287 5.8626 6.60535L5.59467 6.3025C5.55477 6.2573 5.49725 6.23158 5.43709 6.23158C5.37692 6.23158 5.31941 6.25746 5.27951 6.3025L5.0496 6.56233C4.97432 6.64728 4.86631 6.69606 4.75268 6.69606H2.32147C2.3832 7.02479 2.487 7.33855 2.62837 7.63095H4.33651ZM5.57359 8.55745H4.59116C4.51417 8.55745 4.44091 8.52441 4.38994 8.46689L4.12201 8.16404C4.0821 8.11884 4.02459 8.09312 3.96442 8.09312C3.90426 8.09312 3.84675 8.119 3.80684 8.16404L3.57694 8.42387C3.50166 8.50882 3.39364 8.55761 3.28001 8.55761H3.26474C3.94915 9.29096 4.92378 9.74998 6.00596 9.74998C7.08815 9.74998 8.06262 9.29096 8.74719 8.55761H5.57359V8.55745Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n});\nSmallAptosLogo.displayName = \"SmallAptosLogo\";\n","import {\n AdapterNotDetectedWallet,\n AdapterWallet,\n WalletReadyState,\n isRedirectable,\n shouldUseFallbackWallet,\n} from \"@aptos-labs/wallet-adapter-core\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { createContext, forwardRef, useCallback, useContext } from \"react\";\nimport { useWallet } from \"../useWallet\";\nimport { HeadlessComponentProps, createHeadlessComponent } from \"./utils\";\n\nexport interface WalletItemProps extends HeadlessComponentProps {\n /** The wallet option to be displayed. */\n wallet: AdapterWallet | AdapterNotDetectedWallet;\n /** A callback to be invoked when the wallet is connected. */\n onConnect?: () => void;\n}\n\nfunction useWalletItemContext(displayName: string) {\n const context = useContext(WalletItemContext);\n\n if (!context) {\n throw new Error(`\\`${displayName}\\` must be used within \\`WalletItem\\``);\n }\n\n return context;\n}\n\nconst WalletItemContext = createContext<{\n wallet: AdapterWallet | AdapterNotDetectedWallet;\n connectWallet: () => void;\n} | null>(null);\n\nconst Root = forwardRef<HTMLDivElement, WalletItemProps>(\n ({ wallet, onConnect, className, asChild, children }, ref) => {\n const { connect } = useWallet();\n\n const isWalletReady = wallet.readyState === WalletReadyState.Installed;\n\n const mobileSupport =\n \"deeplinkProvider\" in wallet && wallet.deeplinkProvider;\n\n const connectWallet = useCallback(() => {\n const connectionWallet = shouldUseFallbackWallet(wallet)\n ? wallet.fallbackWallet\n : wallet;\n if (!connectionWallet) return;\n connect(connectionWallet.name);\n onConnect?.();\n }, [wallet, connect, onConnect]);\n\n if (!isWalletReady && isRedirectable() && !mobileSupport) return null;\n\n const Component = asChild ? Slot : \"div\";\n\n return (\n <WalletItemContext.Provider value={{ wallet, connectWallet }}>\n <Component ref={ref} className={className}>\n {children}\n </Component>\n </WalletItemContext.Provider>\n );\n }\n);\nRoot.displayName = \"WalletItem\";\n\nconst Icon = createHeadlessComponent(\n \"WalletItem.Icon\",\n \"img\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n src: context.wallet.icon,\n alt: `${context.wallet.name} icon`,\n };\n }\n);\n\nconst Name = createHeadlessComponent(\n \"WalletItem.Name\",\n \"div\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n children: context.wallet.name,\n };\n }\n);\n\nconst ConnectButton = createHeadlessComponent(\n \"WalletItem.ConnectButton\",\n \"button\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n onClick: context.connectWallet,\n children: \"Connect\",\n };\n }\n);\n\nconst InstallLink = createHeadlessComponent(\n \"WalletItem.InstallLink\",\n \"a\",\n (displayName) => {\n const context = useWalletItemContext(displayName);\n\n return {\n href: context.wallet.url,\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n children: \"Install\",\n };\n }\n);\n\n/** A headless component for rendering a wallet option's name, icon, and either connect button or install link. */\nexport const WalletItem = Object.assign(Root, {\n Icon,\n Name,\n ConnectButton,\n InstallLink,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAc,4CAAd;;;ACAA,iCAqBO;AACP,IAAAC,gBAAwE;;;ACtBxE,mBAA0C;AAqD1C,IAAM,kB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PLORE_ECOSYSTEM_URL","import_react","walletCore","network","wallet","wallets","hiddenWallets","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,8 +52,6 @@ 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";
57
55
 
58
56
  // src/WalletProvider.tsx
59
57
  import {
@@ -89,6 +87,7 @@ var initialState = {
89
87
  var AptosWalletAdapterProvider = ({
90
88
  children,
91
89
  optInWallets,
90
+ hideWallets,
92
91
  autoConnect = false,
93
92
  dappConfig,
94
93
  disableTelemetry = false,
@@ -99,20 +98,23 @@ var AptosWalletAdapterProvider = ({
99
98
  const [isLoading, setIsLoading] = useState(true);
100
99
  const [walletCore, setWalletCore] = useState();
101
100
  const [wallets, setWallets] = useState([]);
101
+ const [hiddenWallets, setHiddenWallets] = useState([]);
102
102
  const [notDetectedWallets, setNotDetectedWallets] = useState([]);
103
103
  const derivationInitialized = useRef(false);
104
104
  useEffect(() => {
105
105
  const walletCore2 = new WalletCore(
106
106
  optInWallets,
107
107
  dappConfig,
108
- disableTelemetry
108
+ disableTelemetry,
109
+ hideWallets ? hideWallets : ["Petra Web"]
109
110
  );
110
111
  setWalletCore(walletCore2);
111
112
  }, []);
112
113
  useEffect(() => {
113
- var _a, _b;
114
+ var _a, _b, _c;
114
115
  setWallets((_a = walletCore == null ? void 0 : walletCore.wallets) != null ? _a : []);
115
- setNotDetectedWallets((_b = walletCore == null ? void 0 : walletCore.notDetectedWallets) != null ? _b : []);
116
+ setHiddenWallets((_b = walletCore == null ? void 0 : walletCore.hiddenWallets) != null ? _b : []);
117
+ setNotDetectedWallets((_c = walletCore == null ? void 0 : walletCore.notDetectedWallets) != null ? _c : []);
116
118
  }, [walletCore]);
117
119
  useEffect(() => {
118
120
  if (didAttemptAutoConnectRef.current || !(walletCore == null ? void 0 : walletCore.wallets.length)) {
@@ -159,6 +161,7 @@ var AptosWalletAdapterProvider = ({
159
161
  useEffect(() => {
160
162
  var _a, _b;
161
163
  if (!derivationInitialized.current) {
164
+ const dynamicImport = (moduleName) => new Function("m", "return import(m)")(moduleName);
162
165
  if ((_a = dappConfig == null ? void 0 : dappConfig.crossChainWallets) == null ? void 0 : _a.solana) {
163
166
  import("@aptos-labs/derived-wallet-solana").then(
164
167
  ({ setupAutomaticSolanaWalletDerivation }) => {
@@ -169,7 +172,7 @@ var AptosWalletAdapterProvider = ({
169
172
  );
170
173
  }
171
174
  if ((_b = dappConfig == null ? void 0 : dappConfig.crossChainWallets) == null ? void 0 : _b.evm) {
172
- import("@aptos-labs/derived-wallet-ethereum").then(
175
+ dynamicImport("@aptos-labs/derived-wallet-ethereum").then(
173
176
  ({ setupAutomaticEthereumWalletDerivation }) => {
174
177
  setupAutomaticEthereumWalletDerivation({
175
178
  defaultNetwork: dappConfig == null ? void 0 : dappConfig.network
@@ -342,6 +345,20 @@ var AptosWalletAdapterProvider = ({
342
345
  setWallets((wallets2) => [...wallets2, standardWallet]);
343
346
  }
344
347
  };
348
+ const handleStandardWalletsHiddenAdded = (standardWallet) => {
349
+ const existingWalletIndex = hiddenWallets.findIndex(
350
+ (wallet2) => wallet2.name === standardWallet.name
351
+ );
352
+ if (existingWalletIndex !== -1) {
353
+ setHiddenWallets((hiddenWallets2) => [
354
+ ...hiddenWallets2.slice(0, existingWalletIndex),
355
+ standardWallet,
356
+ ...hiddenWallets2.slice(existingWalletIndex + 1)
357
+ ]);
358
+ } else {
359
+ setHiddenWallets((hiddenWallets2) => [...hiddenWallets2, standardWallet]);
360
+ }
361
+ };
345
362
  const handleStandardNotDetectedWalletsAdded = (notDetectedWallet) => {
346
363
  const existingWalletIndex = wallets.findIndex(
347
364
  (wallet2) => wallet2.name == notDetectedWallet.name
@@ -362,6 +379,10 @@ var AptosWalletAdapterProvider = ({
362
379
  walletCore == null ? void 0 : walletCore.on("networkChange", handleNetworkChange);
363
380
  walletCore == null ? void 0 : walletCore.on("disconnect", handleDisconnect);
364
381
  walletCore == null ? void 0 : walletCore.on("standardWalletsAdded", handleStandardWalletsAdded);
382
+ walletCore == null ? void 0 : walletCore.on(
383
+ "standardWalletsHiddenAdded",
384
+ handleStandardWalletsHiddenAdded
385
+ );
365
386
  walletCore == null ? void 0 : walletCore.on(
366
387
  "standardNotDetectedWalletAdded",
367
388
  handleStandardNotDetectedWalletsAdded
@@ -372,6 +393,10 @@ var AptosWalletAdapterProvider = ({
372
393
  walletCore == null ? void 0 : walletCore.off("networkChange", handleNetworkChange);
373
394
  walletCore == null ? void 0 : walletCore.off("disconnect", handleDisconnect);
374
395
  walletCore == null ? void 0 : walletCore.off("standardWalletsAdded", handleStandardWalletsAdded);
396
+ walletCore == null ? void 0 : walletCore.off(
397
+ "standardWalletsHiddenAdded",
398
+ handleStandardWalletsHiddenAdded
399
+ );
375
400
  walletCore == null ? void 0 : walletCore.off(
376
401
  "standardNotDetectedWalletAdded",
377
402
  handleStandardNotDetectedWalletsAdded
@@ -397,6 +422,7 @@ var AptosWalletAdapterProvider = ({
397
422
  wallet,
398
423
  wallets,
399
424
  notDetectedWallets,
425
+ hiddenWallets,
400
426
  isLoading
401
427
  },
402
428
  children
@@ -859,7 +885,8 @@ var AptosPrivacyPolicy = Object.assign(Root3, {
859
885
  // src/components/WalletItem.tsx
860
886
  import {
861
887
  WalletReadyState as WalletReadyState2,
862
- isRedirectable
888
+ isRedirectable,
889
+ shouldUseFallbackWallet
863
890
  } from "@aptos-labs/wallet-adapter-core";
864
891
  import { Slot as Slot2 } from "@radix-ui/react-slot";
865
892
  import { createContext as createContext4, forwardRef as forwardRef7, useCallback as useCallback2, useContext as useContext4 } from "react";
@@ -875,12 +902,14 @@ var WalletItemContext = createContext4(null);
875
902
  var Root4 = forwardRef7(
876
903
  ({ wallet, onConnect, className, asChild, children }, ref) => {
877
904
  const { connect } = useWallet();
878
- const connectWallet = useCallback2(() => {
879
- connect(wallet.name);
880
- onConnect == null ? void 0 : onConnect();
881
- }, [connect, wallet.name, onConnect]);
882
905
  const isWalletReady = wallet.readyState === WalletReadyState2.Installed;
883
906
  const mobileSupport = "deeplinkProvider" in wallet && wallet.deeplinkProvider;
907
+ const connectWallet = useCallback2(() => {
908
+ const connectionWallet = shouldUseFallbackWallet(wallet) ? wallet.fallbackWallet : wallet;
909
+ if (!connectionWallet) return;
910
+ connect(connectionWallet.name);
911
+ onConnect == null ? void 0 : onConnect();
912
+ }, [wallet, connect, onConnect]);
884
913
  if (!isWalletReady && isRedirectable() && !mobileSupport) return null;
885
914
  const Component = asChild ? Slot2 : "div";
886
915
  return /* @__PURE__ */ jsx10(WalletItemContext.Provider, { value: { wallet, connectWallet }, children: /* @__PURE__ */ jsx10(Component, { ref, className, children }) });