@flarenetwork/multichain-wallet-connector 0.0.1-rc.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-wallets-DXRPNM7H.mjs","names":["MultiChain","createContext","MultichainContext","undefined","c","_c","React","JSX","MultiChain","useEffect","MultichainContext","MultichainProviderProps","multichain","children","ReactNode","Element","MultichainProvider","t0","$","t1","t2","mount","t3","MultiChain","useContext","MultichainContext","useMultichainContext","context","undefined","Error","WalletRegistryEntry","WalletSupportForChain","WalletType","evmCaip2s","objectEntries","objectFromEntries","defineWalletRegistry","Record","registry","T","walletRegistry","metamask","label","chains","canConnect","ledger","xaman","dcent","walletLabels","map","walletType","wallet","walletSupportForChain","Caip2","Chain","EvmChain","XrplChain","SupportedWalletChains","WalletType","ChainGuards","useMultichainContext","objectValues","walletSupportForChain","ChainSupportFilter","chainType","wallet","ChainForWallet","caip2","W","ChainSupportReturn","T","useChainSupport","filter","$","_c","multichain","allChains","t0","Symbol","for","bb0","configResolver","getConfigResolver","filterChainType","undefined","filterWallet","walletTypes","getWalletTypes","firstWallet","resolvedConfig","resolveForWallet","chains","_temp","_temp2","supportedCaip2s","t1","chain_1","includes","chain","chain_0","isXrplCaip2","isEvmCaip2","Caip2","Eip155Caip2","XRPlCaip2","EvmClient","XrpClient","WalletState","ValidWalletsForChain","useMultichainContext","objectEntries","useSelector","UseChainFound","exists","address","state","walletType","T","caip2","client","TClient","UseChainNotFound","UseChainOptions","wallet","UseEvmChainReturn","UseXrpChainReturn","useChain","options","$","_c","multichain","t0","getAggregateStore","wallets","_temp","t1","Symbol","for","bb0","context","connectionState","narrowedWalletType","connector","getConnector","getClient","activeAddress","t2","undefined","s","Caip2","LedgerComputedAddress","LedgerHDStandard","useMultichainContext","useState","LedgerSelectionState","selectedAddress","hdStandard","LedgerSelectionActions","selectAddress","address","setHdStandard","standard","clearSelection","UseLedgerSelectionOptions","initialHdStandard","initialSelections","Partial","Record","UseLedgerSelectionReturn","selection","selections","Readonly","DEFAULT_HD_STANDARD","useLedgerSelection","selectedCaip2","options","$","_c","multichain","t0","getConnector","getSession","session","resolvedHdStandard","t1","caip2","account","resolvedSelections","setSelections","t2","prev","t3","prev_0","next","t4","t5","MultiChainEvents","Subscription","useMultichainContext","useEffect","useRef","useMultichainEvents","options","$","_c","multichain","optionsRef","t0","current","t1","t2","subscriptions","wallets","getWalletTypes","walletType","connectSub","onWalletEvent","event","onConnect","caip2","address","activeAddress","availableAddresses","isReconnect","push","disconnectSub","onDisconnect","errorSub","event_0","onError","error","Error","message","chainChangedSub","event_1","onChainChanged","addressChangedSub","event_2","onAccountChanged","sub","unsubscribe","Caip2","Eip155Caip2","EvmClient","ResolvedWalletConfig","WalletMetadata","UniversalProvider","walletSupportForChain","SupportedWalletChains","WalletType","EIP1193Provider","Xumm","DcentConnector","DcentXrpClient","DcentXrplProvider","LedgerEvmClient","LedgerXrpClient","LedgerConnector","LedgerCaip2","LedgerConnectOptions","MetaMaskConnector","WalletConnectXrpClient","WalletConnectConnector","XamanConnector","XamanClient","MetaMaskProvider","WalletConnectProvider","XamanProvider","LedgerProvider","DcentProvider","ProviderMap","metamask","ledger","xaman","dcent","Provider","W","ClientMap","Client","ConnectOptionsMap","ConnectOptions","Connector","walletType","initialize","Promise","connect","args","disconnect","restoreConnection","switchChain","caip2","getClient","TClient","getProvider","TProvider","ConnectorConfig","metadata","resolvedConfig","WalletConnectConnectorConfig","projectId","XamanConnectorConfig","apiKey","ConnectorTypeMap","ConcreteConnectorMap","ConcreteConnector","ConnectWalletArgs","wallet","chains","chain","options","ChainSelectionMode","getChainSelectionMode","walletSupport","canConnect","needsChainForConnect","buildConnectArgs","length","Caip2","WalletType","walletSupportForChain","createStore","MultichainSelectionState","selectedWalletType","selectedCaip2s","INITIAL","createMultichainSelectionStore","fixedCaip2","getSelectionMode","walletType","canConnect","context","on","selectWallet","_ctx","preselect","clearWallet","toggleCaip2","ctx","caip2","mode","has","includes","filter","selected","setSelectedCaip2s","caip2s","length","reset","MultichainSelectionStore","ReturnType","Caip2","WalletState","WalletType","MultichainSelectionConfig","SelectionWallet","walletLabels","walletSupportForChain","isSingleChainMode","config","caip2","mode","includes","deriveSelectionWallets","walletTypes","walletStates","Partial","Record","chainOptions","map","type","state","name","caip2s","multiChain","canConnect","isConnecting","connectionState","isConnected","Caip2","WalletType","ReactNode","MultichainSelectionStore","MultichainSelectionConfig","MultichainSelectionMode","objectEntries","objectKeys","walletSupportForChain","createContext","useState","createMultichainSelectionStore","isSingleChainMode","MultichainSelectionContextValue","store","mode","fixedCaip2","chainOptions","Partial","Record","wallets","MultichainSelectionContext","buildChainOptions","options","walletType","setting","supported","chains","requested","filter","caip2","includes","MultichainSelectionProvider","t0","$","_c","config","children","t1","ctx","t2","Caip2","ConnectWalletArgs","WalletType","UseMultichainSelectionReturn","buildConnectArgs","getChainSelectionMode","useMultichainContext","walletSupportForChain","useSelector","useContext","MultichainSelectionContext","deriveSelectionWallets","useMultichainSelection","$","_c","ctx","Error","store","mode","fixedCaip2","chainOptions","wallets","walletTypes","selectedWalletType","selectedCaip2s","_temp","multichain","t0","getAggregateStore","walletStates","_temp2","t1","find","wallet","type","selectedWallet","t2","chainSelectionMode","t3","connectArgs","t4","walletType","state","caip2","preselectFor","t5","walletType_0","preselect","args","trigger","selectWallet","t6","clearWallet","t7","caip2_0","toggleCaip2","t8","caip2s","setSelectedCaip2s","t9","reset","t10","t11","availableCaip2s","base","t12","canConnect","const","snapshot_0","snapshot","context","ConcreteConnector","ConnectWalletArgs","WalletType","useMultichainContext","UseMultichainReturn","connect","args","Promise","disconnect","wallet","disconnectAll","getConnector","W","useMultichain","$","_c","multichain","t0","wallet_0","Caip2","WalletType","useMultichainContext","walletLabels","walletSupportForChain","WalletInfo","type","name","chains","singleChain","WalletSupportFilter","exclude","useWalletSupport","filter","$","_c","multichain","excludeList","t0","walletTypes","getWalletTypes","filtered","includes","map","_temp","type_0","canConnect","ConcreteConnector","WalletState","WalletType","useMultichainContext","useSelector","UseWalletReturn","state","connector","W","walletType","isConnected","isConnecting","useWallet","$","_c","multichain","t0","getAggregateStore","t1","s","context","wallets","t2","getConnector","t3","connectionState","t4","t5","WalletState","WalletType","useMultichainContext","useSelector","UseWalletsReturn","Array","state","type","useWallets","$","_c","multichain","walletTypes","getWalletTypes","t0","getAggregateStore","wallets","_temp","t1","map","s","context"],"sources":["../src/core/stores/multichain/multichain-context.tsx","../src/core/stores/multichain/multichain-provider.tsx","../src/core/stores/multichain/use-multichain-context.tsx","../src/core/wallets/wallet-registry.ts","../src/react/hooks/use-chain-support/use-chain-support.ts","../src/react/hooks/use-chain/use-chain.tsx","../src/react/hooks/use-ledger-selection/use-ledger-selection.ts","../src/react/hooks/use-multichain-events/use-multichain-events.tsx","../src/core/connectors/connector-types.ts","../src/react/hooks/use-wallet-selection/wallet-selection.store.ts","../src/react/hooks/use-wallet-selection/wallet-selection.utils.ts","../src/react/hooks/use-wallet-selection/wallet-selection.provider.tsx","../src/react/hooks/use-wallet-selection/use-wallet-selection.ts","../src/react/hooks/use-multichain/use-multichain.tsx","../src/react/hooks/use-wallet-support/use-wallet-support.ts","../src/react/hooks/use-wallet/use-wallet.tsx","../src/react/hooks/use-wallets/use-wallets.ts"],"sourcesContent":["import type { MultiChain } from \"../../multichain/multichain\";\r\nimport { createContext } from \"react\";\r\n\r\nexport const MultichainContext = createContext<MultiChain | undefined>(undefined);\r\n","\"use client\";\r\n\r\nimport type React from \"react\";\r\nimport type { JSX } from \"react\";\r\nimport type { MultiChain } from \"../../multichain/multichain\";\r\nimport { useEffect } from \"react\";\r\nimport { MultichainContext } from \"./multichain-context\";\r\n\r\ninterface MultichainProviderProps {\r\n multichain: MultiChain;\r\n children: React.ReactNode | JSX.Element | JSX.Element[];\r\n}\r\n\r\nexport const MultichainProvider = ({ multichain, children }: MultichainProviderProps): JSX.Element => {\r\n useEffect(() => {\r\n multichain.mount();\r\n }, [multichain]);\r\n\r\n return <MultichainContext.Provider value={multichain}>{children}</MultichainContext.Provider>;\r\n};\r\n","import type { MultiChain } from \"../../multichain/multichain\";\r\nimport { useContext } from \"react\";\r\nimport { MultichainContext } from \"./multichain-context\";\r\n\r\nexport const useMultichainContext = (): MultiChain => {\r\n const context = useContext(MultichainContext);\r\n if (context === undefined) {\r\n throw new Error(\"useMultichainContext must be used within a WalletContextProvider\");\r\n }\r\n\r\n return context;\r\n};\r\n","import type { WalletRegistryEntry, WalletSupportForChain, WalletType } from \"./wallet.types\";\r\nimport { evmCaip2s } from \"@chains/chain-registry\";\r\nimport { objectEntries, objectFromEntries } from \"@utils/utils\";\r\n\r\nexport function defineWalletRegistry<const T extends Record<string, WalletRegistryEntry>>(registry: T): T {\r\n return registry;\r\n}\r\n\r\nexport const walletRegistry = defineWalletRegistry({\r\n metamask: { label: \"MetaMask\", chains: evmCaip2s, canConnect: \"single-at-once\" },\r\n \"wallet-connect\": { label: \"WalletConnect\", chains: [...evmCaip2s, \"xrpl:0\", \"xrpl:1\"], canConnect: \"all-at-once\" },\r\n ledger: {\r\n label: \"Ledger\",\r\n chains: [\"eip155:1\", \"eip155:11155111\", \"eip155:14\", \"eip155:16\", \"eip155:114\", \"eip155:19\", \"xrpl:0\", \"xrpl:1\"],\r\n canConnect: \"single-at-once\",\r\n },\r\n xaman: { label: \"Xaman\", chains: [\"xrpl:0\", \"xrpl:1\"], canConnect: \"single-at-once\" },\r\n dcent: { label: \"D'CENT\", chains: [\"xrpl:0\", \"xrpl:1\"], canConnect: \"single-at-once\" },\r\n});\r\n\r\nexport const walletLabels: Record<WalletType, string> = objectFromEntries(\r\n objectEntries(walletRegistry).map(([walletType, wallet]) => [walletType, wallet.label])\r\n);\r\n\r\nexport const walletSupportForChain: WalletSupportForChain = objectFromEntries(\r\n objectEntries(walletRegistry).map(([walletType, wallet]) => [\r\n walletType,\r\n { chains: wallet.chains, canConnect: wallet.canConnect },\r\n ])\r\n) as WalletSupportForChain;\r\n","import type { Caip2, Chain, EvmChain, XrplChain } from \"@chains/chain.types\";\r\nimport type { SupportedWalletChains, WalletType } from \"@wallets/wallet.types\";\r\nimport { ChainGuards } from \"@chains/chain.utils\";\r\nimport { useMultichainContext } from \"@stores/multichain/use-multichain-context\";\r\nimport { objectValues } from \"@utils/utils\";\r\nimport { walletSupportForChain } from \"@wallets/wallet-registry\";\r\n\r\ntype ChainSupportFilter = { chainType: \"evm\" } | { chainType: \"xrpl\" } | { wallet: WalletType };\r\n\r\n/** Chain object narrowed to a specific wallet's supported chains */\r\ntype ChainForWallet<W extends WalletType> = Chain & { caip2: SupportedWalletChains<W>[number] };\r\n\r\ntype ChainSupportReturn<T extends ChainSupportFilter | undefined> = T extends { chainType: \"evm\" }\r\n ? EvmChain[]\r\n : T extends { chainType: \"xrpl\" }\r\n ? XrplChain[]\r\n : T extends { wallet: infer W extends WalletType }\r\n ? ChainForWallet<W>[]\r\n : Chain[];\r\n\r\n/**\r\n * Hook to access chain configuration.\r\n *\r\n * @example\r\n * ```tsx\r\n * // Get all chains\r\n * const allChains = useChainSupport();\r\n *\r\n * // Get EVM chains only\r\n * const evmChains = useChainSupport({ chainType: 'evm' });\r\n *\r\n * // Get XRPL chains only\r\n * const xrplChains = useChainSupport({ chainType: 'xrpl' });\r\n *\r\n * // Get chains supported by a wallet\r\n * const ledgerChains = useChainSupport({ wallet: 'ledger' });\r\n * ```\r\n */\r\nexport function useChainSupport<T extends ChainSupportFilter | undefined = undefined>(\r\n filter?: T\r\n): ChainSupportReturn<T> {\r\n const multichain = useMultichainContext();\r\n const configResolver = multichain.getConfigResolver();\r\n\r\n const filterChainType = filter && \"chainType\" in filter ? filter.chainType : undefined;\r\n const filterWallet = filter && \"wallet\" in filter ? filter.wallet : undefined;\r\n\r\n const walletTypes = multichain.getWalletTypes();\r\n const firstWallet = walletTypes[0];\r\n const resolvedConfig = firstWallet ? configResolver.resolveForWallet(firstWallet) : null;\r\n\r\n if (!resolvedConfig) {\r\n return [] as unknown as ChainSupportReturn<T>;\r\n }\r\n\r\n const allChains = objectValues(resolvedConfig.chains) as Chain[];\r\n\r\n if (!filterChainType && !filterWallet) {\r\n return allChains as ChainSupportReturn<T>;\r\n }\r\n\r\n if (filterChainType === \"evm\") {\r\n return allChains.filter((chain): chain is EvmChain => ChainGuards.isEvmCaip2(chain.caip2)) as ChainSupportReturn<T>;\r\n }\r\n\r\n if (filterChainType === \"xrpl\") {\r\n return allChains.filter((chain): chain is XrplChain =>\r\n ChainGuards.isXrplCaip2(chain.caip2)\r\n ) as ChainSupportReturn<T>;\r\n }\r\n\r\n if (filterWallet) {\r\n const supportedCaip2s = walletSupportForChain[filterWallet].chains as readonly Caip2[];\r\n return allChains.filter((chain) => supportedCaip2s.includes(chain.caip2)) as ChainSupportReturn<T>;\r\n }\r\n\r\n return allChains as ChainSupportReturn<T>;\r\n}\r\n","import type { Caip2, Eip155Caip2, XRPlCaip2 } from \"@chains/chain.types\";\r\nimport type { EvmClient } from \"@clients/evm/evm-client\";\r\nimport type { XrpClient } from \"@clients/xrp/xrp-client\";\r\nimport type { WalletState } from \"@stores/wallet-store/wallet-store\";\r\nimport type { ValidWalletsForChain } from \"@wallets/wallet.types\";\r\nimport { useMultichainContext } from \"@stores/multichain/use-multichain-context\";\r\nimport { objectEntries } from \"@utils/utils\";\r\nimport { useSelector } from \"@xstate/store-react\";\r\n\r\nexport interface UseChainFound<T extends Caip2, TClient> {\r\n exists: true;\r\n address: string;\r\n state: WalletState;\r\n walletType: ValidWalletsForChain<T>;\r\n caip2: T;\r\n client: TClient;\r\n}\r\n\r\nexport interface UseChainNotFound<T extends Caip2> {\r\n exists: false;\r\n address: undefined;\r\n state: undefined;\r\n walletType: undefined;\r\n caip2: T;\r\n client: null;\r\n}\r\n\r\nexport interface UseChainOptions<T extends Caip2> {\r\n wallet?: ValidWalletsForChain<T>;\r\n}\r\n\r\nexport type UseEvmChainReturn<T extends Eip155Caip2> = UseChainFound<T, EvmClient> | UseChainNotFound<T>;\r\nexport type UseXrpChainReturn<T extends XRPlCaip2> = UseChainFound<T, XrpClient> | UseChainNotFound<T>;\r\n\r\n/**\r\n * Hook to get the connected wallet for a specific chain.\r\n *\r\n * Returns the wallet state and a properly typed client based on the chain type.\r\n *\r\n * @example\r\n * ```tsx\r\n * // First connected wallet on the chain\r\n * const chain = useChain('eip155:14');\r\n *\r\n * // Specific wallet on the chain\r\n * const chain = useChain('eip155:14', { wallet: 'wallet-connect' });\r\n *\r\n * if (!chain.exists) return <NotConnected />;\r\n *\r\n * await chain.client.getBalance(chain.address);\r\n * ```\r\n */\r\nexport function useChain<T extends Eip155Caip2>(caip2: T, options?: UseChainOptions<T>): UseEvmChainReturn<T>;\r\nexport function useChain<T extends XRPlCaip2>(caip2: T, options?: UseChainOptions<T>): UseXrpChainReturn<T>;\r\nexport function useChain<T extends Caip2>(\r\n caip2: T,\r\n options?: UseChainOptions<T>\r\n): UseChainFound<T, unknown> | UseChainNotFound<T> {\r\n const multichain = useMultichainContext();\r\n const wallets = useSelector(multichain.getAggregateStore(), (s) => s.context.wallets);\r\n\r\n for (const [walletType, context] of objectEntries(wallets)) {\r\n if (options?.wallet && walletType !== options.wallet) continue;\r\n\r\n if (context?.caip2 === caip2 && context.connectionState === \"connected\") {\r\n const narrowedWalletType = walletType as ValidWalletsForChain<T>;\r\n const connector = multichain.getConnector(narrowedWalletType);\r\n const client = connector.getClient();\r\n\r\n return {\r\n exists: true,\r\n address: context.activeAddress!,\r\n state: context,\r\n walletType: narrowedWalletType,\r\n caip2,\r\n client,\r\n };\r\n }\r\n }\r\n\r\n return {\r\n exists: false,\r\n address: undefined,\r\n state: undefined,\r\n walletType: undefined,\r\n caip2,\r\n client: null,\r\n };\r\n}\r\n","import type { Caip2 } from \"@chains/chain.types\";\r\n\r\nimport type { LedgerComputedAddress, LedgerHDStandard } from \"@connectors/ledger/ledger.types\";\r\nimport { useMultichainContext } from \"@stores/multichain/use-multichain-context\";\r\nimport { useState } from \"react\";\r\n\r\nexport interface LedgerSelectionState {\r\n selectedAddress: LedgerComputedAddress | null;\r\n hdStandard: LedgerHDStandard;\r\n}\r\n\r\nexport interface LedgerSelectionActions {\r\n selectAddress: (address: LedgerComputedAddress) => void;\r\n setHdStandard: (standard: LedgerHDStandard) => void;\r\n clearSelection: () => void;\r\n}\r\n\r\nexport interface UseLedgerSelectionOptions {\r\n initialHdStandard: LedgerHDStandard;\r\n initialSelections: Partial<Record<Caip2, LedgerComputedAddress>>;\r\n}\r\n\r\nexport interface UseLedgerSelectionReturn {\r\n selection: LedgerSelectionState & LedgerSelectionActions;\r\n selections: Readonly<Partial<Record<Caip2, LedgerComputedAddress>>>;\r\n}\r\n\r\nconst DEFAULT_HD_STANDARD: LedgerHDStandard = \"bip44\";\r\n\r\nexport function useLedgerSelection(\r\n selectedCaip2: Caip2,\r\n options?: Partial<UseLedgerSelectionOptions>\r\n): UseLedgerSelectionReturn {\r\n const multichain = useMultichainContext();\r\n const session = multichain.getConnector(\"ledger\").getSession();\r\n\r\n const resolvedHdStandard = options?.initialHdStandard ?? session?.hdStandard ?? DEFAULT_HD_STANDARD;\r\n const resolvedSelections = options?.initialSelections ?? (session ? { [session.caip2]: session.account } : {});\r\n\r\n const [hdStandard, setHdStandard] = useState<LedgerHDStandard>(resolvedHdStandard);\r\n const [selections, setSelections] = useState<Partial<Record<Caip2, LedgerComputedAddress>>>(resolvedSelections);\r\n\r\n const selectedAddress = selections[selectedCaip2] ?? null;\r\n\r\n const selectAddress = (address: LedgerComputedAddress) => {\r\n setSelections((prev) => {\r\n if (prev[selectedCaip2] === address) return prev;\r\n return { ...prev, [selectedCaip2]: address };\r\n });\r\n };\r\n\r\n const clearSelection = () => {\r\n setSelections((prev) => {\r\n if (!prev[selectedCaip2]) return prev;\r\n const next = { ...prev };\r\n delete next[selectedCaip2];\r\n return next;\r\n });\r\n };\r\n\r\n const selection = {\r\n selectedAddress,\r\n hdStandard,\r\n selectAddress,\r\n setHdStandard,\r\n clearSelection,\r\n };\r\n\r\n return {\r\n selection,\r\n selections,\r\n };\r\n}\r\n","import type { MultiChainEvents } from \"@config/config-types\";\r\nimport type { Subscription } from \"@xstate/store\";\r\nimport { useMultichainContext } from \"@stores/multichain/use-multichain-context\";\r\nimport { useEffect, useRef } from \"react\";\r\n\r\nexport const useMultichainEvents = (options: MultiChainEvents): void => {\r\n const multichain = useMultichainContext();\r\n const optionsRef = useRef(options);\r\n\r\n useEffect(() => {\r\n optionsRef.current = options;\r\n });\r\n\r\n useEffect(() => {\r\n const subscriptions: Subscription[] = [];\r\n const wallets = multichain.getWalletTypes();\r\n\r\n for (const walletType of wallets) {\r\n const connectSub = multichain.onWalletEvent(walletType, \"walletConnected\", (event) => {\r\n optionsRef.current.onConnect?.({\r\n walletType,\r\n caip2: event.caip2,\r\n address: event.activeAddress,\r\n availableAddresses: event.availableAddresses,\r\n isReconnect: event.isReconnect,\r\n });\r\n });\r\n if (connectSub) subscriptions.push(connectSub);\r\n\r\n const disconnectSub = multichain.onWalletEvent(walletType, \"walletDisconnected\", () => {\r\n optionsRef.current.onDisconnect?.({ walletType });\r\n });\r\n if (disconnectSub) subscriptions.push(disconnectSub);\r\n\r\n const errorSub = multichain.onWalletEvent(walletType, \"walletError\", (event) => {\r\n optionsRef.current.onError?.({\r\n walletType,\r\n error: new Error(event.error.message),\r\n });\r\n });\r\n if (errorSub) subscriptions.push(errorSub);\r\n\r\n const chainChangedSub = multichain.onWalletEvent(walletType, \"walletChainChanged\", (event) => {\r\n optionsRef.current.onChainChanged?.({\r\n walletType,\r\n caip2: event.caip2,\r\n });\r\n });\r\n if (chainChangedSub) subscriptions.push(chainChangedSub);\r\n\r\n const addressChangedSub = multichain.onWalletEvent(walletType, \"walletAddressChanged\", (event) => {\r\n optionsRef.current.onAccountChanged?.({\r\n walletType,\r\n address: event.activeAddress,\r\n });\r\n });\r\n if (addressChangedSub) subscriptions.push(addressChangedSub);\r\n }\r\n\r\n return () => {\r\n for (const sub of subscriptions) {\r\n sub.unsubscribe();\r\n }\r\n };\r\n }, [multichain]);\r\n};\r\n","import type { Caip2, Eip155Caip2 } from \"@chains/chain.types\";\r\nimport type { EvmClient } from \"@clients/evm/evm-client\";\r\nimport type { ResolvedWalletConfig, WalletMetadata } from \"@config/config-types\";\r\nimport type UniversalProvider from \"@walletconnect/universal-provider\";\r\nimport type { walletSupportForChain } from \"@wallets/wallet-registry\";\r\nimport type { SupportedWalletChains, WalletType } from \"@wallets/wallet.types\";\r\n\r\nimport type { EIP1193Provider } from \"viem\";\r\nimport type { Xumm } from \"xumm\";\r\nimport type { DcentConnector } from \"./dcent/dcent-connector\";\r\nimport type { DcentXrpClient } from \"./dcent/dcent-xrpl-client\";\r\nimport type { DcentXrplProvider } from \"./dcent/dcent.types\";\r\nimport type { LedgerEvmClient } from \"./ledger/clients/ledger-evm-client\";\r\nimport type { LedgerXrpClient } from \"./ledger/clients/ledger-xrp-client\";\r\nimport type { LedgerConnector } from \"./ledger/ledger-connector\";\r\nimport type { LedgerCaip2, LedgerConnectOptions } from \"./ledger/ledger.types\";\r\nimport type { MetaMaskConnector } from \"./metamask/metamask-connector\";\r\nimport type { WalletConnectXrpClient } from \"./wallet-connect/clients/wallet-connect-xrpl-client\";\r\nimport type { WalletConnectConnector } from \"./wallet-connect/wallet-connect-connector\";\r\nimport type { XamanConnector } from \"./xaman/xaman-connector\";\r\nimport type { XamanClient } from \"./xaman/xaman-xrpl-client\";\r\n\r\nexport type MetaMaskProvider = EIP1193Provider;\r\nexport type WalletConnectProvider = UniversalProvider;\r\nexport type XamanProvider = Xumm;\r\nexport type LedgerProvider = \"ledger-provider\";\r\nexport type DcentProvider = DcentXrplProvider;\r\n\r\nexport interface ProviderMap {\r\n metamask: MetaMaskProvider;\r\n \"wallet-connect\": WalletConnectProvider;\r\n ledger: LedgerProvider;\r\n xaman: XamanProvider;\r\n dcent: DcentProvider;\r\n}\r\n\r\nexport type Provider<W extends WalletType> = ProviderMap[W];\r\n\r\nexport interface ClientMap {\r\n metamask: EvmClient;\r\n \"wallet-connect\": EvmClient | WalletConnectXrpClient;\r\n ledger: LedgerEvmClient | LedgerXrpClient;\r\n xaman: XamanClient;\r\n dcent: DcentXrpClient;\r\n}\r\n\r\nexport type Client<W extends WalletType> = ClientMap[W];\r\n\r\nexport interface ConnectOptionsMap {\r\n metamask: undefined;\r\n \"wallet-connect\": undefined;\r\n ledger: LedgerConnectOptions;\r\n xaman: undefined;\r\n dcent: undefined;\r\n}\r\n\r\nexport type ConnectOptions<W extends WalletType> = ConnectOptionsMap[W];\r\n\r\nexport interface Connector<W extends WalletType, TClient, TProvider = Provider<W>> {\r\n readonly walletType: W;\r\n initialize(): Promise<void>;\r\n connect(...args: never[]): Promise<void>;\r\n disconnect(): Promise<void>;\r\n restoreConnection(): Promise<void>;\r\n switchChain(caip2: SupportedWalletChains<W>[number]): Promise<void>;\r\n getClient(): TClient;\r\n getProvider(): TProvider;\r\n}\r\n\r\nexport interface ConnectorConfig<W extends WalletType = WalletType> {\r\n walletType: W;\r\n metadata: WalletMetadata;\r\n resolvedConfig: ResolvedWalletConfig;\r\n}\r\n\r\nexport interface WalletConnectConnectorConfig extends ConnectorConfig<\"wallet-connect\"> {\r\n projectId: string;\r\n}\r\n\r\nexport interface XamanConnectorConfig extends ConnectorConfig<\"xaman\"> {\r\n apiKey: string;\r\n}\r\n\r\nexport type ConnectorTypeMap<W extends WalletType = WalletType> = Connector<W, Client<W>, Provider<W>>;\r\n\r\n/**\r\n * Maps wallet types to their concrete connector classes.\r\n * Use this when you need the full connector API with specific connect signatures.\r\n */\r\nexport interface ConcreteConnectorMap {\r\n metamask: MetaMaskConnector;\r\n \"wallet-connect\": WalletConnectConnector;\r\n ledger: LedgerConnector;\r\n xaman: XamanConnector;\r\n dcent: DcentConnector;\r\n}\r\n\r\nexport type ConcreteConnector<W extends WalletType> = ConcreteConnectorMap[W];\r\n\r\nexport type ConnectWalletArgs =\r\n | { wallet: \"wallet-connect\"; chains: SupportedWalletChains<\"wallet-connect\"> }\r\n | { wallet: \"metamask\"; chain: Eip155Caip2 }\r\n | { wallet: \"ledger\"; chain: LedgerCaip2; options?: LedgerConnectOptions }\r\n | { wallet: \"xaman\" }\r\n | { wallet: \"dcent\" };\r\n\r\nexport type ChainSelectionMode = \"single\" | \"multi\" | null;\r\n\r\nexport function getChainSelectionMode(\r\n wallet: WalletType | null,\r\n walletSupport: typeof walletSupportForChain\r\n): ChainSelectionMode {\r\n if (!wallet) return null;\r\n return walletSupport[wallet].canConnect === \"all-at-once\" ? \"multi\" : \"single\";\r\n}\r\n\r\nexport function needsChainForConnect(wallet: WalletType): boolean {\r\n return wallet !== \"xaman\" && wallet !== \"dcent\";\r\n}\r\n\r\nexport function buildConnectArgs(wallet: WalletType | null, chains: Caip2[]): ConnectWalletArgs | null {\r\n if (!wallet) return null;\r\n\r\n switch (wallet) {\r\n case \"wallet-connect\":\r\n return chains.length ? { wallet, chains: chains as SupportedWalletChains<\"wallet-connect\"> } : null;\r\n case \"metamask\":\r\n return chains.length ? { wallet, chain: chains[0] as Eip155Caip2 } : null;\r\n case \"ledger\":\r\n return chains.length ? { wallet, chain: chains[0] as LedgerCaip2 } : null;\r\n case \"xaman\":\r\n return { wallet };\r\n case \"dcent\":\r\n return { wallet };\r\n }\r\n}\r\n","import type { Caip2 } from \"@chains/chain.types\";\r\nimport type { WalletType } from \"@wallets/wallet.types\";\r\nimport { walletSupportForChain } from \"@wallets/wallet-registry\";\r\nimport { createStore } from \"@xstate/store\";\r\n\r\nexport interface MultichainSelectionState {\r\n selectedWalletType: WalletType | null;\r\n selectedCaip2s: Caip2[];\r\n}\r\n\r\nconst INITIAL: MultichainSelectionState = {\r\n selectedWalletType: null,\r\n selectedCaip2s: [],\r\n};\r\n\r\nexport function createMultichainSelectionStore(fixedCaip2: Caip2 | null) {\r\n const getSelectionMode = (walletType: WalletType | null) =>\r\n walletType ? (walletSupportForChain[walletType].canConnect === \"all-at-once\" ? \"multi\" : \"single\") : null;\r\n\r\n return createStore({\r\n context: INITIAL,\r\n on: {\r\n selectWallet: (\r\n _ctx,\r\n { walletType, preselect }: { walletType: WalletType; preselect: Caip2[] }\r\n ): MultichainSelectionState => ({\r\n selectedWalletType: walletType,\r\n selectedCaip2s: preselect,\r\n }),\r\n\r\n clearWallet: (): MultichainSelectionState => INITIAL,\r\n\r\n toggleCaip2: (ctx, { caip2 }: { caip2: Caip2 }): MultichainSelectionState => {\r\n if (fixedCaip2) return ctx;\r\n\r\n const mode = getSelectionMode(ctx.selectedWalletType);\r\n if (mode === \"single\") {\r\n return { ...ctx, selectedCaip2s: ctx.selectedCaip2s[0] === caip2 ? [] : [caip2] };\r\n }\r\n\r\n const has = ctx.selectedCaip2s.includes(caip2);\r\n return {\r\n ...ctx,\r\n selectedCaip2s: has\r\n ? ctx.selectedCaip2s.filter((selected) => selected !== caip2)\r\n : [...ctx.selectedCaip2s, caip2],\r\n };\r\n },\r\n\r\n setSelectedCaip2s: (ctx, { caip2s }: { caip2s: Caip2[] }): MultichainSelectionState => {\r\n if (fixedCaip2) return { ...ctx, selectedCaip2s: [fixedCaip2] };\r\n\r\n const mode = getSelectionMode(ctx.selectedWalletType);\r\n if (mode === \"single\") {\r\n return { ...ctx, selectedCaip2s: caip2s.length ? [caip2s[0]] : [] };\r\n }\r\n\r\n return { ...ctx, selectedCaip2s: [...caip2s] };\r\n },\r\n\r\n reset: (): MultichainSelectionState => INITIAL,\r\n },\r\n });\r\n}\r\n\r\nexport type MultichainSelectionStore = ReturnType<typeof createMultichainSelectionStore>;\r\n","import type { Caip2 } from \"@chains/chain.types\";\r\nimport type { WalletState } from \"@stores/wallet-store/wallet-store\";\r\nimport type { WalletType } from \"@wallets/wallet.types\";\r\nimport type { MultichainSelectionConfig, SelectionWallet } from \"./wallet-selection.types\";\r\nimport { walletLabels, walletSupportForChain } from \"@wallets/wallet-registry\";\r\n\r\nexport function isSingleChainMode(\r\n config: MultichainSelectionConfig\r\n): config is MultichainSelectionConfig & { caip2: Caip2 } {\r\n return config.mode.includes(\"single-chain\");\r\n}\r\n\r\nexport function deriveSelectionWallets(\r\n walletTypes: WalletType[],\r\n walletStates: Partial<Record<WalletType, WalletState>>,\r\n chainOptions: Partial<Record<WalletType, Caip2[]>>\r\n): SelectionWallet[] {\r\n return walletTypes.map((type) => {\r\n const state = walletStates[type];\r\n return {\r\n type,\r\n name: walletLabels[type],\r\n caip2s: chainOptions[type] ?? [],\r\n multiChain: walletSupportForChain[type].canConnect === \"all-at-once\",\r\n isConnecting: state?.connectionState === \"connecting\",\r\n isConnected: state?.connectionState === \"connected\",\r\n caip2: state?.caip2 ?? null,\r\n };\r\n });\r\n}\r\n","import type { Caip2 } from \"@chains/chain.types\";\r\nimport type { WalletType } from \"@wallets/wallet.types\";\r\nimport type { ReactNode } from \"react\";\r\nimport type { MultichainSelectionStore } from \"./wallet-selection.store\";\r\nimport type { MultichainSelectionConfig, MultichainSelectionMode } from \"./wallet-selection.types\";\r\nimport { objectEntries, objectKeys } from \"@utils/utils\";\r\nimport { walletSupportForChain } from \"@wallets/wallet-registry\";\r\nimport { createContext, useState } from \"react\";\r\nimport { createMultichainSelectionStore } from \"./wallet-selection.store\";\r\nimport { isSingleChainMode } from \"./wallet-selection.utils\";\r\n\r\nexport interface MultichainSelectionContextValue {\r\n store: MultichainSelectionStore;\r\n mode: MultichainSelectionMode;\r\n fixedCaip2: Caip2 | null;\r\n chainOptions: Partial<Record<WalletType, Caip2[]>>;\r\n wallets: WalletType[];\r\n}\r\n\r\nexport const MultichainSelectionContext = createContext<MultichainSelectionContextValue | null>(null);\r\n\r\nfunction buildChainOptions(\r\n wallets: MultichainSelectionConfig[\"wallets\"],\r\n fixedCaip2: Caip2 | null\r\n): Partial<Record<WalletType, Caip2[]>> {\r\n const options: Partial<Record<WalletType, Caip2[]>> = {};\r\n\r\n for (const [walletType, setting] of objectEntries(wallets)) {\r\n if (!setting) continue;\r\n\r\n const supported = walletSupportForChain[walletType].chains as Caip2[];\r\n const requested = setting === \"all\" ? supported : setting.filter((caip2) => supported.includes(caip2));\r\n\r\n if (fixedCaip2) {\r\n if (requested.includes(fixedCaip2)) options[walletType] = [fixedCaip2];\r\n } else {\r\n options[walletType] = [...requested];\r\n }\r\n }\r\n\r\n return options;\r\n}\r\n\r\nexport function MultichainSelectionProvider({\r\n config,\r\n children,\r\n}: {\r\n config: MultichainSelectionConfig;\r\n children: ReactNode;\r\n}) {\r\n const [ctx] = useState(() => {\r\n const fixedCaip2: Caip2 | null = isSingleChainMode(config) ? config.caip2 : null;\r\n\r\n const chainOptions = buildChainOptions(config.wallets, fixedCaip2);\r\n\r\n return {\r\n store: createMultichainSelectionStore(fixedCaip2),\r\n mode: config.mode,\r\n fixedCaip2,\r\n chainOptions,\r\n wallets: objectKeys(chainOptions),\r\n };\r\n });\r\n\r\n return <MultichainSelectionContext.Provider value={ctx}>{children}</MultichainSelectionContext.Provider>;\r\n}\r\n","import type { Caip2 } from \"@chains/chain.types\";\r\nimport type { ConnectWalletArgs } from \"@connectors/connector-types\";\r\nimport type { WalletType } from \"@wallets/wallet.types\";\r\nimport type { UseMultichainSelectionReturn } from \"./wallet-selection.types\";\r\nimport { buildConnectArgs, getChainSelectionMode } from \"@connectors/connector-types\";\r\nimport { useMultichainContext } from \"@stores/multichain/use-multichain-context\";\r\nimport { walletSupportForChain } from \"@wallets/wallet-registry\";\r\nimport { useSelector } from \"@xstate/store-react\";\r\nimport { useContext } from \"react\";\r\nimport { MultichainSelectionContext } from \"./wallet-selection.provider\";\r\nimport { deriveSelectionWallets } from \"./wallet-selection.utils\";\r\n\r\nexport function useMultichainSelection(): UseMultichainSelectionReturn {\r\n const ctx = useContext(MultichainSelectionContext);\r\n if (!ctx) throw new Error(\"useMultichainSelection must be used within MultichainSelectionProvider\");\r\n\r\n const { store, mode, fixedCaip2, chainOptions, wallets: walletTypes } = ctx;\r\n const { selectedWalletType, selectedCaip2s } = useSelector(store, (snapshot) => snapshot.context);\r\n\r\n const multichain = useMultichainContext();\r\n const walletStates = useSelector(multichain.getAggregateStore(), (snapshot) => snapshot.context.wallets);\r\n\r\n const wallets = deriveSelectionWallets(walletTypes, walletStates, chainOptions);\r\n const selectedWallet = selectedWalletType\r\n ? (wallets.find((wallet) => wallet.type === selectedWalletType) ?? null)\r\n : null;\r\n\r\n const chainSelectionMode = getChainSelectionMode(selectedWalletType, walletSupportForChain);\r\n const connectArgs = buildConnectArgs(selectedWalletType, selectedCaip2s);\r\n\r\n const preselectFor = (walletType: WalletType): Caip2[] => {\r\n const state = walletStates[walletType];\r\n const caip2 = fixedCaip2 ?? state?.caip2;\r\n return caip2 ? [caip2] : [];\r\n };\r\n\r\n // TODO: Make hook generic over mode so single-chain consumers get compile-time non-nullable guarantee.\r\n const selectWallet = (walletType: WalletType): ConnectWalletArgs => {\r\n const preselect = preselectFor(walletType);\r\n const args = buildConnectArgs(walletType, preselect);\r\n if (!args)\r\n throw new Error(\r\n `Cannot build connect args for \"${walletType}\": no chains available. Ensure the wallet has chains configured or a chain is selected.`\r\n );\r\n store.trigger.selectWallet({ walletType, preselect });\r\n return args;\r\n };\r\n\r\n const clearWallet = (): void => store.trigger.clearWallet();\r\n const toggleCaip2 = (caip2: Caip2): void => store.trigger.toggleCaip2({ caip2 });\r\n const setSelectedCaip2s = (caip2s: Caip2[]): void => store.trigger.setSelectedCaip2s({ caip2s });\r\n const reset = (): void => store.trigger.reset();\r\n\r\n const base = {\r\n mode,\r\n fixedCaip2,\r\n wallets,\r\n selectedWalletType,\r\n selectedWallet,\r\n selectedCaip2s,\r\n availableCaip2s: selectedWallet?.caip2s ?? [],\r\n chainSelectionMode,\r\n selectWallet,\r\n clearWallet,\r\n toggleCaip2,\r\n setSelectedCaip2s,\r\n reset,\r\n };\r\n\r\n return connectArgs\r\n ? { ...base, canConnect: true as const, connectArgs }\r\n : { ...base, canConnect: false as const, connectArgs: null };\r\n}\r\n","import type { ConcreteConnector, ConnectWalletArgs } from \"@connectors/connector-types\";\r\nimport type { WalletType } from \"@wallets/wallet.types\";\r\nimport { useMultichainContext } from \"@stores/multichain/use-multichain-context\";\r\n\r\n/**\r\n * Return type for useMultichain hook.\r\n */\r\nexport interface UseMultichainReturn {\r\n /**\r\n * Connect a wallet with type-safe discriminated union arguments.\r\n *\r\n * Each wallet type has its own connection signature:\r\n * - wallet-connect: { wallet: \"wallet-connect\", chains: [...] }\r\n * - metamask: { wallet: \"metamask\", chain: \"eip155:...\" }\r\n * - ledger: { wallet: \"ledger\", chain: \"...\", options?: {...} }\r\n * - xaman: { wallet: \"xaman\" }\r\n */\r\n connect(args: ConnectWalletArgs): Promise<void>;\r\n /** Disconnect a specific wallet */\r\n disconnect(wallet: WalletType): Promise<void>;\r\n /** Disconnect all wallets */\r\n disconnectAll(): Promise<void>;\r\n /** Get connector for a wallet (for advanced operations) */\r\n getConnector<W extends WalletType>(wallet: W): ConcreteConnector<W>;\r\n}\r\n\r\n/**\r\n * Hook for wallet connection actions.\r\n *\r\n * Use this for connect/disconnect operations.\r\n * For connection state, use useWallet() instead.\r\n *\r\n * @example\r\n * ```tsx\r\n * const { connect, disconnect, getConnector } = useMultichain();\r\n *\r\n * // Connect MetaMask to a single chain\r\n * await connect({ wallet: 'metamask', chain: 'eip155:14' });\r\n *\r\n * // Connect WalletConnect to multiple chains\r\n * await connect({ wallet: 'wallet-connect', chains: ['eip155:14', 'eip155:1'] });\r\n *\r\n * // Connect Ledger with options\r\n * await connect({ wallet: 'ledger', chain: 'eip155:14', options: { bip44, ledgerHDStandard } });\r\n *\r\n * // Disconnect\r\n * await disconnect('metamask');\r\n *\r\n * // Get connector for advanced operations\r\n * const connector = getConnector('metamask');\r\n * const client = connector.getClient();\r\n * ```\r\n */\r\nexport function useMultichain(): UseMultichainReturn {\r\n const multichain = useMultichainContext();\r\n\r\n return {\r\n connect: (args) => multichain.connect(args),\r\n disconnect: (wallet) => multichain.disconnect(wallet),\r\n disconnectAll: () => multichain.disconnectAll(),\r\n getConnector: (wallet) => multichain.getConnector(wallet),\r\n };\r\n}\r\n","import type { Caip2 } from \"@chains/chain.types\";\r\nimport type { WalletType } from \"@wallets/wallet.types\";\r\nimport { useMultichainContext } from \"@stores/multichain/use-multichain-context\";\r\nimport { walletLabels, walletSupportForChain } from \"@wallets/wallet-registry\";\r\n/**\r\n * Wallet info with all support details.\r\n */\r\nexport interface WalletInfo {\r\n type: WalletType;\r\n name: string;\r\n chains: Caip2[];\r\n singleChain: boolean;\r\n}\r\n\r\n/**\r\n * Filter options for useWalletSupport hook.\r\n */\r\nexport interface WalletSupportFilter {\r\n exclude?: WalletType[];\r\n}\r\n\r\n/**\r\n * Hook to access wallet support configuration.\r\n *\r\n * @example\r\n * ```tsx\r\n * // Get all wallets\r\n * const wallets = useWalletSupport();\r\n *\r\n * // Exclude specific wallets\r\n * const simpleWallets = useWalletSupport({ exclude: ['ledger'] });\r\n *\r\n * // All wallet info with chains and mode\r\n * wallets // [{ type: 'metamask', name: 'MetaMask', chains: [...], singleChain: true }, ...]\r\n *\r\n * // Find specific wallet\r\n * const mm = wallets.find(w => w.type === 'metamask');\r\n * mm.chains // ['eip155:14', 'eip155:16', ...]\r\n * mm.singleChain // true\r\n * ```\r\n */\r\nexport function useWalletSupport(filter?: WalletSupportFilter): WalletInfo[] {\r\n const multichain = useMultichainContext();\r\n const excludeList = filter?.exclude;\r\n\r\n const walletTypes = multichain.getWalletTypes();\r\n\r\n const filtered = excludeList ? walletTypes.filter((type) => !excludeList.includes(type)) : walletTypes;\r\n\r\n return filtered.map((type) => ({\r\n type,\r\n name: walletLabels[type],\r\n chains: [...walletSupportForChain[type].chains] as Caip2[],\r\n singleChain: walletSupportForChain[type].canConnect === \"single-at-once\",\r\n }));\r\n}\r\n","import type { ConcreteConnector } from \"@connectors/connector-types\";\r\nimport type { WalletState } from \"@stores/wallet-store/wallet-store\";\r\nimport type { WalletType } from \"@wallets/wallet.types\";\r\nimport { useMultichainContext } from \"@stores/multichain/use-multichain-context\";\r\nimport { useSelector } from \"@xstate/store-react\";\r\n\r\n/**\r\n * Return type for useWallet hook.\r\n */\r\nexport interface UseWalletReturn<W extends WalletType> {\r\n /** Current wallet state */\r\n state: WalletState;\r\n /** Wallet connector for operations */\r\n connector: ConcreteConnector<W>;\r\n /** Wallet type */\r\n walletType: W;\r\n /** Whether wallet is connected */\r\n isConnected: boolean;\r\n /** Whether wallet is currently connecting */\r\n isConnecting: boolean;\r\n}\r\n\r\n/**\r\n * Hook to access a specific wallet's state and connector.\r\n *\r\n * @example\r\n * ```tsx\r\n * const { state, connector, isConnected } = useWallet('metamask');\r\n *\r\n * if (isConnected) {\r\n * const client = connector.getClient();\r\n * await client.getPublicClient().readContract({...});\r\n * }\r\n * ```\r\n */\r\nexport function useWallet<W extends WalletType>(walletType: W): UseWalletReturn<W> {\r\n const multichain = useMultichainContext();\r\n const state = useSelector(multichain.getAggregateStore(), (s) => s.context.wallets[walletType]);\r\n const connector = multichain.getConnector(walletType);\r\n\r\n return {\r\n state,\r\n connector,\r\n walletType,\r\n isConnected: state?.connectionState === \"connected\",\r\n isConnecting: state?.connectionState === \"connecting\",\r\n };\r\n}\r\n","import type { WalletState } from \"@stores/wallet-store/wallet-store\";\r\nimport type { WalletType } from \"@wallets/wallet.types\";\r\nimport { useMultichainContext } from \"@stores/multichain/use-multichain-context\";\r\nimport { useSelector } from \"@xstate/store-react\";\r\n\r\nexport type UseWalletsReturn = Array<{\r\n state: WalletState;\r\n type: WalletType;\r\n}>;\r\n\r\nexport const useWallets = (): UseWalletsReturn => {\r\n const multichain = useMultichainContext();\r\n const walletTypes = multichain.getWalletTypes();\r\n const wallets = useSelector(multichain.getAggregateStore(), (s) => s.context.wallets);\r\n\r\n return walletTypes.map((type) => ({ state: wallets[type], type }));\r\n};\r\n"],"mappings":";;;;;;;;AAGA,MAAaE,oBAAoBD,cAAsCE,OAAU;;;;ACUjF,MAAaa,sBAAqBC,OAAA;CAAA,MAAAC,IAAAb,EAAA,EAAA;CAAC,MAAA,EAAAO,YAAAC,aAAAI;CAAiD,IAAAE;CAAA,IAAAC;AAAA,KAAAF,EAAA,OAAAN,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