@tuwaio/satellite-react 1.0.0-fix-test-alpha.10.14c2d19 → 1.0.0-fix-test-alpha.12.37394ce
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -39
- package/dist/index.d.ts +18 -39
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var orbitCore=require('@tuwaio/orbit-core'),core=require('@wagmi/core'),react=require('react'),zustand=require('zustand'),react$1=require('@wallet-standard/react'),satelliteCore=require('@tuwaio/satellite-core'),jsxRuntime=require('react/jsx-runtime');var i=react.createContext(null),
|
|
1
|
+
'use strict';var orbitCore=require('@tuwaio/orbit-core'),core=require('@wagmi/core'),react=require('react'),zustand=require('zustand'),react$1=require('@wallet-standard/react'),satelliteCore=require('@tuwaio/satellite-core'),jsxRuntime=require('react/jsx-runtime');var i=react.createContext(null),n=e=>{let o=react.useContext(i);if(!o)throw new Error("useSatelliteConnectStore must be used within a SatelliteConnectProvider");return zustand.useStore(o,e)};function y({wagmiConfig:e}){let o=n(t=>t.updateActiveWallet);return core.watchAccount(e,{onChange:async t=>{o({walletType:`${orbitCore.OrbitAdapter.EVM}:${t?.connector?.type}`,address:t.address,chainId:t.chainId,rpcURL:t.chain?.rpcUrls.default.http[0],isConnected:t.isConnected});}}),null}function R(){let e=react$1.useWallets(),o=n(t=>t.updateActiveWallet);return react.useEffect(()=>{let t=e.filter(r=>r.accounts.length>0)[0];t&&o({address:t.accounts[0].address,isConnected:true,connectedAccount:t.accounts[0],connectedWallet:t});},[e]),null}var l=({initializeAutoConnect:e,onError:o})=>{react.useEffect(()=>{(async()=>{try{await e();}catch(r){(o??(a=>console.error("Failed to initialize auto connect:",a)))(r);}})();},[]);};function q({children:e,autoConnect:o,...t}){let r=react.useMemo(()=>satelliteCore.createSatelliteConnectStore({...t}),[]);return l({initializeAutoConnect:()=>r.getState().initializeAutoConnect(o??!1)}),jsxRuntime.jsx(i.Provider,{value:r,children:e})}exports.EVMWalletsWatcher=y;exports.SatelliteConnectProvider=q;exports.SatelliteStoreContext=i;exports.SolanaWalletsWatcher=R;exports.useInitializeAutoConnect=l;exports.useSatelliteConnectStore=n;//# sourceMappingURL=index.cjs.map
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/satteliteHook.ts","../src/components/EVMWalletsWatcher.tsx","../src/components/SolanaWalletsWatcher.tsx","../src/hooks/useInitializeConnectors.tsx","../src/providers/InitializeConnectorsProvider.tsx","../src/providers/SatelliteConnectProvider.tsx"],"names":["SatelliteStoreContext","createContext","useSatelliteConnectStore","selector","store","useContext","useStore","EVMWalletsWatcher","wagmiConfig","updateActiveWallet","state","watchAccount","account","OrbitAdapter","SolanaWalletsWatcher","wallets","useWallets","useEffect","activeWallet","wallet","useInitializeAppConnectors","initializeAppConnectors","onError","error","e","InitializeConnectorsProvider","autoConnect","SatelliteConnectProvider","children","parameters","useMemo","createSatelliteConnectStore","jsxs","jsx"],"mappings":"yQAQO,IAAMA,CAAAA,CAAwBC,mBAAAA,CAAuD,IAAI,CAAA,CAqBnFC,EAA+BC,CAAAA,EAAsD,CAEhG,IAAMC,CAAAA,CAAQC,gBAAAA,CAAWL,CAAqB,CAAA,CAG9C,GAAI,CAACI,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,yEAAyE,CAAA,CAI3F,OAAOE,gBAAAA,CAASF,EAAOD,CAAQ,CACjC,ECtBO,SAASI,CAAAA,CAAkB,CAAE,WAAA,CAAAC,CAAY,EAA4B,CAE1E,IAAMC,CAAAA,CAAqBP,CAAAA,CAA0BQ,CAAAA,EAAUA,CAAAA,CAAM,kBAAkB,CAAA,CAGvF,OAAAC,iB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,CAAQ,KAAA,CAAM,kCAAA,CAAoCA,CAAC,CAAA,CAAA,EACrFD,CAAc,EAC7B,CACF,CAAA,IAIF,CAAA,CAAG,EAAE,EACP,EC7BO,SAASE,CAAAA,CAA6B,CAAE,WAAA,CAAAC,CAAY,CAAA,CAAsC,CAE/F,IAAML,CAAAA,CAA0BnB,CAAAA,CAA0BQ,CAAAA,EAAUA,CAAAA,CAAM,uBAAuB,CAAA,CAGjG,OAAAU,CAAAA,CAA2B,CACzB,uBAAA,CAAyB,IAAMC,CAAAA,CAAwB,CAAE,WAAA,CAAAK,CAAY,CAAC,CACxE,CAAC,CAAA,CAGM,IACT,CCaO,SAASC,EAAyB,CAAE,QAAA,CAAAC,CAAAA,CAAU,WAAA,CAAAF,CAAAA,CAAa,GAAGG,CAAW,CAAA,CAAkC,CAEhH,IAAMzB,CAAAA,CAAQ0B,aAAAA,CAAQ,IACbC,yCAAAA,CAA4B,CACjC,GAAGF,CACL,CAAC,CAAA,CACA,EAAE,CAAA,CAEL,OACEG,eAAAA,CAAChC,CAAAA,CAAsB,QAAA,CAAtB,CAA+B,KAAA,CAAOI,CAAAA,CACrC,QAAA,CAAA,CAAA6B,cAAAA,CAACR,EAAA,CAA6B,WAAA,CAAaC,CAAAA,CAAa,CAAA,CACvDE,GACH,CAEJ","file":"index.cjs","sourcesContent":["import { ISatelliteConnectStore } from '@tuwaio/satellite-core';\nimport { createContext, useContext } from 'react';\nimport { StoreApi, useStore } from 'zustand';\n\n/**\n * React Context for providing Satellite Connect store throughout the application\n * @internal\n */\nexport const SatelliteStoreContext = createContext<StoreApi<ISatelliteConnectStore> | null>(null);\n\n/**\n * Custom hook for accessing the Satellite Connect store state\n *\n * @remarks\n * This hook provides type-safe access to the Satellite store state and must be used\n * within a component that is wrapped by SatelliteConnectProvider.\n *\n * @typeParam T - The type of the selected state slice\n * @param selector - Function that selects a slice of the store state\n * @returns Selected state slice\n *\n * @throws Error if used outside of SatelliteConnectProvider\n *\n * @example\n * ```tsx\n * // Get the active wallet\n * const activeWallet = useSatelliteConnectStore((state) => state.activeWallet);\n * ```\n */\nexport const useSatelliteConnectStore = <T>(selector: (state: ISatelliteConnectStore) => T): T => {\n // Get store instance from context\n const store = useContext(SatelliteStoreContext);\n\n // Ensure hook is used within provider\n if (!store) {\n throw new Error('useSatelliteConnectStore must be used within a SatelliteConnectProvider');\n }\n\n // Return selected state using Zustand's useStore\n return useStore(store, selector);\n};\n","import { OrbitAdapter } from '@tuwaio/orbit-core';\nimport { WalletType } from '@tuwaio/satellite-core';\nimport { Config, watchAccount } from '@wagmi/core';\n\nimport { useSatelliteConnectStore } from '../hooks/satteliteHook';\n\n/**\n * React component that watches for EVM wallet account changes and updates the Satellite store\n *\n * @remarks\n * This component acts as a bridge between Wagmi account state and Satellite store.\n * It doesn't render anything visible but maintains wallet state synchronization.\n *\n * @param props - Component properties\n * @param props.wagmiConfig - Wagmi configuration instance\n *\n * @returns null - This is a headless component\n **/\nexport function EVMWalletsWatcher({ wagmiConfig }: { wagmiConfig: Config }) {\n // Get the updateActiveWallet function from the Satellite store\n const updateActiveWallet = useSatelliteConnectStore((state) => state.updateActiveWallet);\n\n // Set up account change watcher\n watchAccount(wagmiConfig, {\n onChange: async (account) => {\n // Update the Satellite store with the new account information\n updateActiveWallet({\n // Combine EVM adapter key with connector type for wallet identification\n walletType: `${OrbitAdapter.EVM}:${account?.connector?.type}` as WalletType,\n // Update wallet address\n address: account.address,\n // Update chain ID\n chainId: account.chainId,\n // Update RPC URL using the first available HTTP URL\n rpcURL: account.chain?.rpcUrls.default.http[0],\n // Update connection status\n isConnected: account.isConnected,\n });\n },\n });\n\n // This is a headless component, so return null\n return null;\n}\n","import { useWallets } from '@wallet-standard/react';\nimport { useEffect } from 'react';\n\nimport { useSatelliteConnectStore } from '../hooks/satteliteHook';\n\n/**\n * React component that monitors Solana wallet connections and updates the Satellite store\n *\n * @remarks\n * This component watches for changes in connected Solana wallets using the Wallet Standard.\n * Currently handles the first active wallet only, with multi-wallet support planned for future.\n * It's a headless component that manages state synchronization between Wallet Standard and Satellite store.\n *\n * @returns null - This is a headless component\n *\n */\nexport function SolanaWalletsWatcher() {\n // Get all connected Solana wallets\n const wallets = useWallets();\n\n // Get the updateActiveWallet function from the Satellite store\n const updateActiveWallet = useSatelliteConnectStore((state) => state.updateActiveWallet);\n\n // Watch for changes in connected wallets\n useEffect(() => {\n // Currently only handling the first wallet with active accounts\n const activeWallet = wallets.filter((wallet) => wallet.accounts.length > 0)[0];\n\n if (activeWallet) {\n // Update the Satellite store with the active wallet information\n updateActiveWallet({\n // Use the first account's address\n // TODO: Implement support for multiple connected wallets\n address: activeWallet.accounts[0].address,\n // Set connection status\n isConnected: true,\n // Store Wallet Standard specific information\n connectedAccount: activeWallet.accounts[0],\n connectedWallet: activeWallet,\n });\n }\n }, [wallets]); // Re-run effect when wallets array changes\n\n // This is a headless component, so return null\n return null;\n}\n","import { useEffect } from 'react';\n\n/**\n * Props for useInitializeAppConnectors hook\n */\ninterface InitializeConnectorsProps {\n /** Function to initialize wallet connectors */\n initializeAppConnectors: () => Promise<void>;\n /** Optional error handler callback */\n onError?: (error: Error) => void;\n}\n\n/**\n * Custom hook for initializing wallet connectors with error handling\n *\n * @remarks\n * This hook handles the initialization of blockchain wallet connectors when a component mounts.\n * It provides default error handling with console.error if no custom handler is provided.\n * The initialization runs only once when the component mounts.\n *\n * @param props - Hook configuration\n * @param props.initializeAppConnectors - Async function that initializes the connectors\n * @param props.onError - Optional custom error handler\n *\n * @example\n * ```tsx\n * // Basic usage with default error handling\n * useInitializeAppConnectors({\n * initializeAppConnectors: store.initializeAppConnectors\n * });\n * // With custom error handling\n * useInitializeAppConnectors({\n * initializeAppConnectors: store.initializeAppConnectors,\n * onError: (error) => {\n * toast.error(`Failed to initialize wallets: ${error.message}`);\n * }\n * });\n * ```\n */\nexport const useInitializeAppConnectors = ({ initializeAppConnectors, onError }: InitializeConnectorsProps): void => {\n useEffect(() => {\n const initializeConnectors = async () => {\n try {\n await initializeAppConnectors();\n } catch (error) {\n // Use provided error handler or fallback to default console.error\n const errorHandler = onError ?? ((e: Error) => console.error('Failed to initialize connectors:', e));\n errorHandler(error as Error);\n }\n };\n\n // Initialize connectors when component mounts\n initializeConnectors();\n }, []); // Empty dependency array ensures single execution\n};\n","import { useSatelliteConnectStore } from '../hooks/satteliteHook';\nimport { useInitializeAppConnectors } from '../hooks/useInitializeConnectors';\n\n/**\n * Props for InitializeConnectorsProvider component\n */\ninterface InitializeConnectorsProviderProps {\n /** Whether to automatically connect to the last used wallet */\n autoConnect?: boolean;\n}\n\n/**\n * Provider component that handles wallet connectors initialization\n *\n * @remarks\n * This is a headless component that initializes wallet connectors when mounted.\n * It integrates with the Satellite Connect store and supports automatic reconnection\n * to the last used wallet via the autoConnect prop.\n *\n * @param props - Component properties\n * @param props.autoConnect - Optional flag to enable automatic wallet reconnection\n *\n * @returns null - This is a headless component\n *\n **/\nexport function InitializeConnectorsProvider({ autoConnect }: InitializeConnectorsProviderProps) {\n // Get the initialization function from the store\n const initializeAppConnectors = useSatelliteConnectStore((state) => state.initializeAppConnectors);\n\n // Initialize connectors with autoConnect configuration\n useInitializeAppConnectors({\n initializeAppConnectors: () => initializeAppConnectors({ autoConnect }),\n });\n\n // This is a headless component\n return null;\n}\n","import { createSatelliteConnectStore, SatelliteConnectStoreInitialParameters } from '@tuwaio/satellite-core';\nimport { useMemo } from 'react';\n\nimport { SatelliteStoreContext } from '../hooks/satteliteHook';\nimport { InitializeConnectorsProvider } from './InitializeConnectorsProvider';\n\n/**\n * Props for SatelliteConnectProvider component\n */\ninterface SatelliteConnectProviderProps extends SatelliteConnectStoreInitialParameters {\n /** React child components */\n children: React.ReactNode;\n /** Whether to automatically connect to last used wallet */\n autoConnect?: boolean;\n}\n\n/**\n * Provider component that manages wallet connections and state\n *\n * @remarks\n * This component creates and provides the Satellite Connect store context to its children.\n * It handles wallet connections, state management, and automatic reconnection functionality.\n * The store is memoized to ensure stable reference across renders.\n *\n * @param props - Component properties including store parameters and children\n * @param props.children - Child components that will have access to the store\n * @param props.autoConnect - Optional flag to enable automatic wallet reconnection\n * @param props.adapter - Blockchain adapter(s) for wallet interactions\n * @param props.callbackAfterConnected - Optional callback for successful connections\n *\n * @example\n * ```tsx\n * // Basic usage with single adapter\n * <SatelliteConnectProvider adapter={solanaAdapter}>\n * <App />\n * </SatelliteConnectProvider>\n *\n * // With auto-connect and multiple adapters\n * <SatelliteConnectProvider\n * adapter={[solanaAdapter, evmAdapter]}\n * autoConnect={true}\n * callbackAfterConnected={(wallet) => {\n * console.log('Wallet connected:', wallet.address);\n * }}\n * >\n * <App />\n * </SatelliteConnectProvider>\n * ```\n */\nexport function SatelliteConnectProvider({ children, autoConnect, ...parameters }: SatelliteConnectProviderProps) {\n // Create and memoize the store instance\n const store = useMemo(() => {\n return createSatelliteConnectStore({\n ...parameters,\n });\n }, []); // Empty dependency array as store should be created only once\n\n return (\n <SatelliteStoreContext.Provider value={store}>\n <InitializeConnectorsProvider autoConnect={autoConnect} />\n {children}\n </SatelliteStoreContext.Provider>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/hooks/satteliteHook.ts","../src/components/EVMWalletsWatcher.tsx","../src/components/SolanaWalletsWatcher.tsx","../src/hooks/useInitializeAutoConnect.tsx","../src/providers/SatelliteConnectProvider.tsx"],"names":["SatelliteStoreContext","createContext","useSatelliteConnectStore","selector","store","useContext","useStore","EVMWalletsWatcher","wagmiConfig","updateActiveWallet","state","watchAccount","account","OrbitAdapter","SolanaWalletsWatcher","wallets","useWallets","useEffect","activeWallet","wallet","useInitializeAutoConnect","initializeAutoConnect","onError","error","e","SatelliteConnectProvider","children","autoConnect","parameters","useMemo","createSatelliteConnectStore","jsx"],"mappings":"yQAQO,IAAMA,CAAAA,CAAwBC,mBAAAA,CAAuD,IAAI,CAAA,CAqBnFC,CAAAA,CAA+BC,CAAAA,EAAsD,CAEhG,IAAMC,CAAAA,CAAQC,gBAAAA,CAAWL,CAAqB,CAAA,CA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CACzC,eAAA,CAAiBA,CACnB,CAAC,EAEL,CAAA,CAAG,CAACH,CAAO,CAAC,CAAA,CAGL,IACT,CCJO,IAAMK,CAAAA,CAA2B,CAAC,CAAE,qBAAA,CAAAC,CAAAA,CAAuB,OAAA,CAAAC,CAAQ,CAAA,GAAwC,CAChHL,eAAAA,CAAU,IAAM,CAAA,CACqB,SAAY,CAC7C,GAAI,CACF,MAAMI,CAAAA,GACR,CAAA,MAASE,CAAAA,CAAO,CAAA,CAEOD,CAAAA,GAAaE,CAAAA,EAAa,OAAA,CAAQ,KAAA,CAAM,oCAAA,CAAsCA,CAAC,CAAA,CAAA,EACvFD,CAAc,EAC7B,CACF,CAAA,IAGF,CAAA,CAAG,EAAE,EACP,ECNO,SAASE,CAAAA,CAAyB,CAAE,QAAA,CAAAC,CAAAA,CAAU,WAAA,CAAAC,CAAAA,CAAa,GAAGC,CAAW,CAAA,CAAkC,CAEhH,IAAMxB,CAAAA,CAAQyB,aAAAA,CAAQ,IACbC,yCAAAA,CAA4B,CACjC,GAAGF,CACL,CAAC,CAAA,CACA,EAAE,CAAA,CAEL,OAAAR,CAAAA,CAAyB,CACvB,qBAAA,CAAuB,IAAMhB,CAAAA,CAAM,QAAA,EAAS,CAAE,qBAAA,CAAsBuB,CAAAA,EAAe,CAAA,CAAK,CAC1F,CAAC,CAAA,CAEMI,cAAAA,CAAC/B,CAAAA,CAAsB,QAAA,CAAtB,CAA+B,KAAA,CAAOI,CAAAA,CAAQ,QAAA,CAAAsB,EAAS,CACjE","file":"index.cjs","sourcesContent":["import { ISatelliteConnectStore } from '@tuwaio/satellite-core';\nimport { createContext, useContext } from 'react';\nimport { StoreApi, useStore } from 'zustand';\n\n/**\n * React Context for providing Satellite Connect store throughout the application\n * @internal\n */\nexport const SatelliteStoreContext = createContext<StoreApi<ISatelliteConnectStore> | null>(null);\n\n/**\n * Custom hook for accessing the Satellite Connect store state\n *\n * @remarks\n * This hook provides type-safe access to the Satellite store state and must be used\n * within a component that is wrapped by SatelliteConnectProvider.\n *\n * @typeParam T - The type of the selected state slice\n * @param selector - Function that selects a slice of the store state\n * @returns Selected state slice\n *\n * @throws Error if used outside of SatelliteConnectProvider\n *\n * @example\n * ```tsx\n * // Get the active wallet\n * const activeWallet = useSatelliteConnectStore((state) => state.activeWallet);\n * ```\n */\nexport const useSatelliteConnectStore = <T>(selector: (state: ISatelliteConnectStore) => T): T => {\n // Get store instance from context\n const store = useContext(SatelliteStoreContext);\n\n // Ensure hook is used within provider\n if (!store) {\n throw new Error('useSatelliteConnectStore must be used within a SatelliteConnectProvider');\n }\n\n // Return selected state using Zustand's useStore\n return useStore(store, selector);\n};\n","import { OrbitAdapter } from '@tuwaio/orbit-core';\nimport { WalletType } from '@tuwaio/satellite-core';\nimport { Config, watchAccount } from '@wagmi/core';\n\nimport { useSatelliteConnectStore } from '../hooks/satteliteHook';\n\n/**\n * React component that watches for EVM wallet account changes and updates the Satellite store\n *\n * @remarks\n * This component acts as a bridge between Wagmi account state and Satellite store.\n * It doesn't render anything visible but maintains wallet state synchronization.\n *\n * @param props - Component properties\n * @param props.wagmiConfig - Wagmi configuration instance\n *\n * @returns null - This is a headless component\n **/\nexport function EVMWalletsWatcher({ wagmiConfig }: { wagmiConfig: Config }) {\n // Get the updateActiveWallet function from the Satellite store\n const updateActiveWallet = useSatelliteConnectStore((state) => state.updateActiveWallet);\n\n // Set up account change watcher\n watchAccount(wagmiConfig, {\n onChange: async (account) => {\n // Update the Satellite store with the new account information\n updateActiveWallet({\n // Combine EVM adapter key with connector type for wallet identification\n walletType: `${OrbitAdapter.EVM}:${account?.connector?.type}` as WalletType,\n // Update wallet address\n address: account.address,\n // Update chain ID\n chainId: account.chainId,\n // Update RPC URL using the first available HTTP URL\n rpcURL: account.chain?.rpcUrls.default.http[0],\n // Update connection status\n isConnected: account.isConnected,\n });\n },\n });\n\n // This is a headless component, so return null\n return null;\n}\n","import { useWallets } from '@wallet-standard/react';\nimport { useEffect } from 'react';\n\nimport { useSatelliteConnectStore } from '../hooks/satteliteHook';\n\n/**\n * React component that monitors Solana wallet connections and updates the Satellite store\n *\n * @remarks\n * This component watches for changes in connected Solana wallets using the Wallet Standard.\n * Currently handles the first active wallet only, with multi-wallet support planned for future.\n * It's a headless component that manages state synchronization between Wallet Standard and Satellite store.\n *\n * @returns null - This is a headless component\n *\n */\nexport function SolanaWalletsWatcher() {\n // Get all connected Solana wallets\n const wallets = useWallets();\n\n // Get the updateActiveWallet function from the Satellite store\n const updateActiveWallet = useSatelliteConnectStore((state) => state.updateActiveWallet);\n\n // Watch for changes in connected wallets\n useEffect(() => {\n // Currently only handling the first wallet with active accounts\n const activeWallet = wallets.filter((wallet) => wallet.accounts.length > 0)[0];\n\n if (activeWallet) {\n // Update the Satellite store with the active wallet information\n updateActiveWallet({\n // Use the first account's address\n // TODO: Implement support for multiple connected wallets\n address: activeWallet.accounts[0].address,\n // Set connection status\n isConnected: true,\n // Store Wallet Standard specific information\n connectedAccount: activeWallet.accounts[0],\n connectedWallet: activeWallet,\n });\n }\n }, [wallets]); // Re-run effect when wallets array changes\n\n // This is a headless component, so return null\n return null;\n}\n","import { useEffect } from 'react';\n\n/**\n * Props for the useInitializeAutoConnect hook.\n */\ninterface InitializeAutoConnectProps {\n /** Function to initialize auto connect logic */\n initializeAutoConnect: () => Promise<void>;\n /** Optional error handler callback */\n onError?: (error: Error) => void;\n}\n\n/**\n * Custom hook for initializing wallet auto-connection with error handling.\n *\n * @remarks\n * This hook handles the initial connection logic (e.g., checking for a previously\n * connected wallet) when a component mounts.\n * It provides default error handling with console.error if no custom handler is provided.\n * The initialization runs only once when the component mounts.\n *\n * @param props - Hook configuration\n * @param props.initializeAutoConnect - Async function that executes the auto-connect logic\n * @param props.onError - Optional custom error handler\n *\n * @example\n * ```tsx\n * // Basic usage with default error handling\n * useInitializeAutoConnect({\n * initializeAutoConnect: store.initializeAutoConnect\n * });\n *\n * // With custom error handling\n * useInitializeAutoConnect({\n * initializeAutoConnect: store.initializeAutoConnect,\n * onError: (error) => {\n * toast.error(`Failed to auto-connect: ${error.message}`);\n * }\n * });\n * ```\n */\nexport const useInitializeAutoConnect = ({ initializeAutoConnect, onError }: InitializeAutoConnectProps): void => {\n useEffect(() => {\n const initializeAutoConnectLocal = async () => {\n try {\n await initializeAutoConnect();\n } catch (error) {\n // Use provided error handler or fallback to default console.error\n const errorHandler = onError ?? ((e: Error) => console.error('Failed to initialize auto connect:', e));\n errorHandler(error as Error);\n }\n };\n // Initialize auto connect when component mounts\n initializeAutoConnectLocal();\n }, []); // Empty dependency array ensures single execution\n};\n","import { createSatelliteConnectStore, SatelliteConnectStoreInitialParameters } from '@tuwaio/satellite-core';\nimport { useMemo } from 'react';\n\nimport { SatelliteStoreContext } from '../hooks/satteliteHook';\nimport { useInitializeAutoConnect } from '../hooks/useInitializeAutoConnect';\n\n/**\n * Props for SatelliteConnectProvider component\n */\ninterface SatelliteConnectProviderProps extends SatelliteConnectStoreInitialParameters {\n /** React child components */\n children: React.ReactNode;\n /** Whether to automatically connect to last used wallet */\n autoConnect?: boolean;\n}\n\n/**\n * Provider component that manages wallet connections and state\n *\n * @remarks\n * This component creates and provides the Satellite Connect store context to its children.\n * It handles wallet connections, state management, and automatic reconnection functionality.\n * The store is memoized to ensure stable reference across renders.\n *\n * @param props - Component properties including store parameters and children\n * @param props.children - Child components that will have access to the store\n * @param props.autoConnect - Optional flag to enable automatic wallet reconnection\n * @param props.adapter - Blockchain adapter(s) for wallet interactions\n * @param props.callbackAfterConnected - Optional callback for successful connections\n *\n * @example\n * ```tsx\n * // Basic usage with single adapter\n * <SatelliteConnectProvider adapter={solanaAdapter}>\n * <App />\n * </SatelliteConnectProvider>\n *\n * // With auto-connect and multiple adapters\n * <SatelliteConnectProvider\n * adapter={[solanaAdapter, evmAdapter]}\n * autoConnect={true}\n * callbackAfterConnected={(wallet) => {\n * console.log('Wallet connected:', wallet.address);\n * }}\n * >\n * <App />\n * </SatelliteConnectProvider>\n * ```\n */\nexport function SatelliteConnectProvider({ children, autoConnect, ...parameters }: SatelliteConnectProviderProps) {\n // Create and memoize the store instance\n const store = useMemo(() => {\n return createSatelliteConnectStore({\n ...parameters,\n });\n }, []); // Empty dependency array as store should be created only once\n\n useInitializeAutoConnect({\n initializeAutoConnect: () => store.getState().initializeAutoConnect(autoConnect ?? false),\n });\n\n return <SatelliteStoreContext.Provider value={store}>{children}</SatelliteStoreContext.Provider>;\n}\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -60,65 +60,44 @@ declare const SatelliteStoreContext: react.Context<StoreApi<ISatelliteConnectSto
|
|
|
60
60
|
declare const useSatelliteConnectStore: <T>(selector: (state: ISatelliteConnectStore) => T) => T;
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* Props for
|
|
63
|
+
* Props for the useInitializeAutoConnect hook.
|
|
64
64
|
*/
|
|
65
|
-
interface
|
|
66
|
-
/** Function to initialize
|
|
67
|
-
|
|
65
|
+
interface InitializeAutoConnectProps {
|
|
66
|
+
/** Function to initialize auto connect logic */
|
|
67
|
+
initializeAutoConnect: () => Promise<void>;
|
|
68
68
|
/** Optional error handler callback */
|
|
69
69
|
onError?: (error: Error) => void;
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
|
-
* Custom hook for initializing wallet
|
|
72
|
+
* Custom hook for initializing wallet auto-connection with error handling.
|
|
73
73
|
*
|
|
74
74
|
* @remarks
|
|
75
|
-
* This hook handles the
|
|
75
|
+
* This hook handles the initial connection logic (e.g., checking for a previously
|
|
76
|
+
* connected wallet) when a component mounts.
|
|
76
77
|
* It provides default error handling with console.error if no custom handler is provided.
|
|
77
78
|
* The initialization runs only once when the component mounts.
|
|
78
79
|
*
|
|
79
80
|
* @param props - Hook configuration
|
|
80
|
-
* @param props.
|
|
81
|
+
* @param props.initializeAutoConnect - Async function that executes the auto-connect logic
|
|
81
82
|
* @param props.onError - Optional custom error handler
|
|
82
83
|
*
|
|
83
84
|
* @example
|
|
84
85
|
* ```tsx
|
|
85
86
|
* // Basic usage with default error handling
|
|
86
|
-
*
|
|
87
|
-
*
|
|
87
|
+
* useInitializeAutoConnect({
|
|
88
|
+
* initializeAutoConnect: store.initializeAutoConnect
|
|
88
89
|
* });
|
|
90
|
+
*
|
|
89
91
|
* // With custom error handling
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
92
|
+
* useInitializeAutoConnect({
|
|
93
|
+
* initializeAutoConnect: store.initializeAutoConnect,
|
|
94
|
+
* onError: (error) => {
|
|
95
|
+
* toast.error(`Failed to auto-connect: ${error.message}`);
|
|
96
|
+
* }
|
|
95
97
|
* });
|
|
96
98
|
* ```
|
|
97
99
|
*/
|
|
98
|
-
declare const
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Props for InitializeConnectorsProvider component
|
|
102
|
-
*/
|
|
103
|
-
interface InitializeConnectorsProviderProps {
|
|
104
|
-
/** Whether to automatically connect to the last used wallet */
|
|
105
|
-
autoConnect?: boolean;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Provider component that handles wallet connectors initialization
|
|
109
|
-
*
|
|
110
|
-
* @remarks
|
|
111
|
-
* This is a headless component that initializes wallet connectors when mounted.
|
|
112
|
-
* It integrates with the Satellite Connect store and supports automatic reconnection
|
|
113
|
-
* to the last used wallet via the autoConnect prop.
|
|
114
|
-
*
|
|
115
|
-
* @param props - Component properties
|
|
116
|
-
* @param props.autoConnect - Optional flag to enable automatic wallet reconnection
|
|
117
|
-
*
|
|
118
|
-
* @returns null - This is a headless component
|
|
119
|
-
*
|
|
120
|
-
**/
|
|
121
|
-
declare function InitializeConnectorsProvider({ autoConnect }: InitializeConnectorsProviderProps): null;
|
|
100
|
+
declare const useInitializeAutoConnect: ({ initializeAutoConnect, onError }: InitializeAutoConnectProps) => void;
|
|
122
101
|
|
|
123
102
|
/**
|
|
124
103
|
* Props for SatelliteConnectProvider component
|
|
@@ -164,4 +143,4 @@ interface SatelliteConnectProviderProps extends SatelliteConnectStoreInitialPara
|
|
|
164
143
|
*/
|
|
165
144
|
declare function SatelliteConnectProvider({ children, autoConnect, ...parameters }: SatelliteConnectProviderProps): react_jsx_runtime.JSX.Element;
|
|
166
145
|
|
|
167
|
-
export { EVMWalletsWatcher,
|
|
146
|
+
export { EVMWalletsWatcher, SatelliteConnectProvider, SatelliteStoreContext, SolanaWalletsWatcher, useInitializeAutoConnect, useSatelliteConnectStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -60,65 +60,44 @@ declare const SatelliteStoreContext: react.Context<StoreApi<ISatelliteConnectSto
|
|
|
60
60
|
declare const useSatelliteConnectStore: <T>(selector: (state: ISatelliteConnectStore) => T) => T;
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* Props for
|
|
63
|
+
* Props for the useInitializeAutoConnect hook.
|
|
64
64
|
*/
|
|
65
|
-
interface
|
|
66
|
-
/** Function to initialize
|
|
67
|
-
|
|
65
|
+
interface InitializeAutoConnectProps {
|
|
66
|
+
/** Function to initialize auto connect logic */
|
|
67
|
+
initializeAutoConnect: () => Promise<void>;
|
|
68
68
|
/** Optional error handler callback */
|
|
69
69
|
onError?: (error: Error) => void;
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
|
-
* Custom hook for initializing wallet
|
|
72
|
+
* Custom hook for initializing wallet auto-connection with error handling.
|
|
73
73
|
*
|
|
74
74
|
* @remarks
|
|
75
|
-
* This hook handles the
|
|
75
|
+
* This hook handles the initial connection logic (e.g., checking for a previously
|
|
76
|
+
* connected wallet) when a component mounts.
|
|
76
77
|
* It provides default error handling with console.error if no custom handler is provided.
|
|
77
78
|
* The initialization runs only once when the component mounts.
|
|
78
79
|
*
|
|
79
80
|
* @param props - Hook configuration
|
|
80
|
-
* @param props.
|
|
81
|
+
* @param props.initializeAutoConnect - Async function that executes the auto-connect logic
|
|
81
82
|
* @param props.onError - Optional custom error handler
|
|
82
83
|
*
|
|
83
84
|
* @example
|
|
84
85
|
* ```tsx
|
|
85
86
|
* // Basic usage with default error handling
|
|
86
|
-
*
|
|
87
|
-
*
|
|
87
|
+
* useInitializeAutoConnect({
|
|
88
|
+
* initializeAutoConnect: store.initializeAutoConnect
|
|
88
89
|
* });
|
|
90
|
+
*
|
|
89
91
|
* // With custom error handling
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
92
|
+
* useInitializeAutoConnect({
|
|
93
|
+
* initializeAutoConnect: store.initializeAutoConnect,
|
|
94
|
+
* onError: (error) => {
|
|
95
|
+
* toast.error(`Failed to auto-connect: ${error.message}`);
|
|
96
|
+
* }
|
|
95
97
|
* });
|
|
96
98
|
* ```
|
|
97
99
|
*/
|
|
98
|
-
declare const
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Props for InitializeConnectorsProvider component
|
|
102
|
-
*/
|
|
103
|
-
interface InitializeConnectorsProviderProps {
|
|
104
|
-
/** Whether to automatically connect to the last used wallet */
|
|
105
|
-
autoConnect?: boolean;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Provider component that handles wallet connectors initialization
|
|
109
|
-
*
|
|
110
|
-
* @remarks
|
|
111
|
-
* This is a headless component that initializes wallet connectors when mounted.
|
|
112
|
-
* It integrates with the Satellite Connect store and supports automatic reconnection
|
|
113
|
-
* to the last used wallet via the autoConnect prop.
|
|
114
|
-
*
|
|
115
|
-
* @param props - Component properties
|
|
116
|
-
* @param props.autoConnect - Optional flag to enable automatic wallet reconnection
|
|
117
|
-
*
|
|
118
|
-
* @returns null - This is a headless component
|
|
119
|
-
*
|
|
120
|
-
**/
|
|
121
|
-
declare function InitializeConnectorsProvider({ autoConnect }: InitializeConnectorsProviderProps): null;
|
|
100
|
+
declare const useInitializeAutoConnect: ({ initializeAutoConnect, onError }: InitializeAutoConnectProps) => void;
|
|
122
101
|
|
|
123
102
|
/**
|
|
124
103
|
* Props for SatelliteConnectProvider component
|
|
@@ -164,4 +143,4 @@ interface SatelliteConnectProviderProps extends SatelliteConnectStoreInitialPara
|
|
|
164
143
|
*/
|
|
165
144
|
declare function SatelliteConnectProvider({ children, autoConnect, ...parameters }: SatelliteConnectProviderProps): react_jsx_runtime.JSX.Element;
|
|
166
145
|
|
|
167
|
-
export { EVMWalletsWatcher,
|
|
146
|
+
export { EVMWalletsWatcher, SatelliteConnectProvider, SatelliteStoreContext, SolanaWalletsWatcher, useInitializeAutoConnect, useSatelliteConnectStore };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {OrbitAdapter}from'@tuwaio/orbit-core';import {watchAccount}from'@wagmi/core';import {createContext,useContext,useEffect,useMemo}from'react';import {useStore}from'zustand';import {useWallets}from'@wallet-standard/react';import {createSatelliteConnectStore}from'@tuwaio/satellite-core';import {
|
|
1
|
+
import {OrbitAdapter}from'@tuwaio/orbit-core';import {watchAccount}from'@wagmi/core';import {createContext,useContext,useEffect,useMemo}from'react';import {useStore}from'zustand';import {useWallets}from'@wallet-standard/react';import {createSatelliteConnectStore}from'@tuwaio/satellite-core';import {jsx}from'react/jsx-runtime';var i=createContext(null),n=e=>{let o=useContext(i);if(!o)throw new Error("useSatelliteConnectStore must be used within a SatelliteConnectProvider");return useStore(o,e)};function y({wagmiConfig:e}){let o=n(t=>t.updateActiveWallet);return watchAccount(e,{onChange:async t=>{o({walletType:`${OrbitAdapter.EVM}:${t?.connector?.type}`,address:t.address,chainId:t.chainId,rpcURL:t.chain?.rpcUrls.default.http[0],isConnected:t.isConnected});}}),null}function R(){let e=useWallets(),o=n(t=>t.updateActiveWallet);return useEffect(()=>{let t=e.filter(r=>r.accounts.length>0)[0];t&&o({address:t.accounts[0].address,isConnected:true,connectedAccount:t.accounts[0],connectedWallet:t});},[e]),null}var l=({initializeAutoConnect:e,onError:o})=>{useEffect(()=>{(async()=>{try{await e();}catch(r){(o??(a=>console.error("Failed to initialize auto connect:",a)))(r);}})();},[]);};function q({children:e,autoConnect:o,...t}){let r=useMemo(()=>createSatelliteConnectStore({...t}),[]);return l({initializeAutoConnect:()=>r.getState().initializeAutoConnect(o??!1)}),jsx(i.Provider,{value:r,children:e})}export{y as EVMWalletsWatcher,q as SatelliteConnectProvider,i as SatelliteStoreContext,R as SolanaWalletsWatcher,l as useInitializeAutoConnect,n as useSatelliteConnectStore};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/satteliteHook.ts","../src/components/EVMWalletsWatcher.tsx","../src/components/SolanaWalletsWatcher.tsx","../src/hooks/useInitializeConnectors.tsx","../src/providers/InitializeConnectorsProvider.tsx","../src/providers/SatelliteConnectProvider.tsx"],"names":["SatelliteStoreContext","createContext","useSatelliteConnectStore","selector","store","useContext","useStore","EVMWalletsWatcher","wagmiConfig","updateActiveWallet","state","watchAccount","account","OrbitAdapter","SolanaWalletsWatcher","wallets","useWallets","useEffect","activeWallet","wallet","useInitializeAppConnectors","initializeAppConnectors","onError","error","e","InitializeConnectorsProvider","autoConnect","SatelliteConnectProvider","children","parameters","useMemo","createSatelliteConnectStore","jsxs","jsx"],"mappings":"6UAQO,IAAMA,CAAAA,CAAwBC,aAAAA,CAAuD,IAAI,CAAA,CAqBnFC,EAA+BC,CAAAA,EAAsD,CAEhG,IAAMC,CAAAA,CAAQC,UAAAA,CAAWL,CAAqB,CAAA,CAG9C,GAAI,CAACI,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,yEAAyE,CAAA,CAI3F,OAAOE,QAAAA,CAASF,EAAOD,CAAQ,CACjC,ECtBO,SAASI,CAAAA,CAAkB,CAAE,WAAA,CAAAC,CAAY,EAA4B,CAE1E,IAAMC,CAAAA,CAAqBP,CAAAA,CAA0BQ,CAAAA,EAAUA,CAAAA,CAAM,kBAAkB,CAAA,CAGvF,OAAAC,YAAAA,CAAaH,CAAAA,CAAa,CACxB,QAAA,CAAU,MAAOI,CAAAA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AAc,EAC7B,CACF,CAAA,IAIF,CAAA,CAAG,EAAE,EACP,EC7BO,SAASE,CAAAA,CAA6B,CAAE,WAAA,CAAAC,CAAY,CAAA,CAAsC,CAE/F,IAAML,CAAAA,CAA0BnB,CAAAA,CAA0BQ,CAAAA,EAAUA,CAAAA,CAAM,uBAAuB,CAAA,CAGjG,OAAAU,CAAAA,CAA2B,CACzB,uBAAA,CAAyB,IAAMC,CAAAA,CAAwB,CAAE,WAAA,CAAAK,CAAY,CAAC,CACxE,CAAC,CAAA,CAGM,IACT,CCaO,SAASC,EAAyB,CAAE,QAAA,CAAAC,CAAAA,CAAU,WAAA,CAAAF,CAAAA,CAAa,GAAGG,CAAW,CAAA,CAAkC,CAEhH,IAAMzB,CAAAA,CAAQ0B,OAAAA,CAAQ,IACbC,2BAAAA,CAA4B,CACjC,GAAGF,CACL,CAAC,CAAA,CACA,EAAE,CAAA,CAEL,OACEG,IAAAA,CAAChC,CAAAA,CAAsB,QAAA,CAAtB,CAA+B,KAAA,CAAOI,CAAAA,CACrC,QAAA,CAAA,CAAA6B,GAAAA,CAACR,EAAA,CAA6B,WAAA,CAAaC,CAAAA,CAAa,CAAA,CACvDE,GACH,CAEJ","file":"index.js","sourcesContent":["import { ISatelliteConnectStore } from '@tuwaio/satellite-core';\nimport { createContext, useContext } from 'react';\nimport { StoreApi, useStore } from 'zustand';\n\n/**\n * React Context for providing Satellite Connect store throughout the application\n * @internal\n */\nexport const SatelliteStoreContext = createContext<StoreApi<ISatelliteConnectStore> | null>(null);\n\n/**\n * Custom hook for accessing the Satellite Connect store state\n *\n * @remarks\n * This hook provides type-safe access to the Satellite store state and must be used\n * within a component that is wrapped by SatelliteConnectProvider.\n *\n * @typeParam T - The type of the selected state slice\n * @param selector - Function that selects a slice of the store state\n * @returns Selected state slice\n *\n * @throws Error if used outside of SatelliteConnectProvider\n *\n * @example\n * ```tsx\n * // Get the active wallet\n * const activeWallet = useSatelliteConnectStore((state) => state.activeWallet);\n * ```\n */\nexport const useSatelliteConnectStore = <T>(selector: (state: ISatelliteConnectStore) => T): T => {\n // Get store instance from context\n const store = useContext(SatelliteStoreContext);\n\n // Ensure hook is used within provider\n if (!store) {\n throw new Error('useSatelliteConnectStore must be used within a SatelliteConnectProvider');\n }\n\n // Return selected state using Zustand's useStore\n return useStore(store, selector);\n};\n","import { OrbitAdapter } from '@tuwaio/orbit-core';\nimport { WalletType } from '@tuwaio/satellite-core';\nimport { Config, watchAccount } from '@wagmi/core';\n\nimport { useSatelliteConnectStore } from '../hooks/satteliteHook';\n\n/**\n * React component that watches for EVM wallet account changes and updates the Satellite store\n *\n * @remarks\n * This component acts as a bridge between Wagmi account state and Satellite store.\n * It doesn't render anything visible but maintains wallet state synchronization.\n *\n * @param props - Component properties\n * @param props.wagmiConfig - Wagmi configuration instance\n *\n * @returns null - This is a headless component\n **/\nexport function EVMWalletsWatcher({ wagmiConfig }: { wagmiConfig: Config }) {\n // Get the updateActiveWallet function from the Satellite store\n const updateActiveWallet = useSatelliteConnectStore((state) => state.updateActiveWallet);\n\n // Set up account change watcher\n watchAccount(wagmiConfig, {\n onChange: async (account) => {\n // Update the Satellite store with the new account information\n updateActiveWallet({\n // Combine EVM adapter key with connector type for wallet identification\n walletType: `${OrbitAdapter.EVM}:${account?.connector?.type}` as WalletType,\n // Update wallet address\n address: account.address,\n // Update chain ID\n chainId: account.chainId,\n // Update RPC URL using the first available HTTP URL\n rpcURL: account.chain?.rpcUrls.default.http[0],\n // Update connection status\n isConnected: account.isConnected,\n });\n },\n });\n\n // This is a headless component, so return null\n return null;\n}\n","import { useWallets } from '@wallet-standard/react';\nimport { useEffect } from 'react';\n\nimport { useSatelliteConnectStore } from '../hooks/satteliteHook';\n\n/**\n * React component that monitors Solana wallet connections and updates the Satellite store\n *\n * @remarks\n * This component watches for changes in connected Solana wallets using the Wallet Standard.\n * Currently handles the first active wallet only, with multi-wallet support planned for future.\n * It's a headless component that manages state synchronization between Wallet Standard and Satellite store.\n *\n * @returns null - This is a headless component\n *\n */\nexport function SolanaWalletsWatcher() {\n // Get all connected Solana wallets\n const wallets = useWallets();\n\n // Get the updateActiveWallet function from the Satellite store\n const updateActiveWallet = useSatelliteConnectStore((state) => state.updateActiveWallet);\n\n // Watch for changes in connected wallets\n useEffect(() => {\n // Currently only handling the first wallet with active accounts\n const activeWallet = wallets.filter((wallet) => wallet.accounts.length > 0)[0];\n\n if (activeWallet) {\n // Update the Satellite store with the active wallet information\n updateActiveWallet({\n // Use the first account's address\n // TODO: Implement support for multiple connected wallets\n address: activeWallet.accounts[0].address,\n // Set connection status\n isConnected: true,\n // Store Wallet Standard specific information\n connectedAccount: activeWallet.accounts[0],\n connectedWallet: activeWallet,\n });\n }\n }, [wallets]); // Re-run effect when wallets array changes\n\n // This is a headless component, so return null\n return null;\n}\n","import { useEffect } from 'react';\n\n/**\n * Props for useInitializeAppConnectors hook\n */\ninterface InitializeConnectorsProps {\n /** Function to initialize wallet connectors */\n initializeAppConnectors: () => Promise<void>;\n /** Optional error handler callback */\n onError?: (error: Error) => void;\n}\n\n/**\n * Custom hook for initializing wallet connectors with error handling\n *\n * @remarks\n * This hook handles the initialization of blockchain wallet connectors when a component mounts.\n * It provides default error handling with console.error if no custom handler is provided.\n * The initialization runs only once when the component mounts.\n *\n * @param props - Hook configuration\n * @param props.initializeAppConnectors - Async function that initializes the connectors\n * @param props.onError - Optional custom error handler\n *\n * @example\n * ```tsx\n * // Basic usage with default error handling\n * useInitializeAppConnectors({\n * initializeAppConnectors: store.initializeAppConnectors\n * });\n * // With custom error handling\n * useInitializeAppConnectors({\n * initializeAppConnectors: store.initializeAppConnectors,\n * onError: (error) => {\n * toast.error(`Failed to initialize wallets: ${error.message}`);\n * }\n * });\n * ```\n */\nexport const useInitializeAppConnectors = ({ initializeAppConnectors, onError }: InitializeConnectorsProps): void => {\n useEffect(() => {\n const initializeConnectors = async () => {\n try {\n await initializeAppConnectors();\n } catch (error) {\n // Use provided error handler or fallback to default console.error\n const errorHandler = onError ?? ((e: Error) => console.error('Failed to initialize connectors:', e));\n errorHandler(error as Error);\n }\n };\n\n // Initialize connectors when component mounts\n initializeConnectors();\n }, []); // Empty dependency array ensures single execution\n};\n","import { useSatelliteConnectStore } from '../hooks/satteliteHook';\nimport { useInitializeAppConnectors } from '../hooks/useInitializeConnectors';\n\n/**\n * Props for InitializeConnectorsProvider component\n */\ninterface InitializeConnectorsProviderProps {\n /** Whether to automatically connect to the last used wallet */\n autoConnect?: boolean;\n}\n\n/**\n * Provider component that handles wallet connectors initialization\n *\n * @remarks\n * This is a headless component that initializes wallet connectors when mounted.\n * It integrates with the Satellite Connect store and supports automatic reconnection\n * to the last used wallet via the autoConnect prop.\n *\n * @param props - Component properties\n * @param props.autoConnect - Optional flag to enable automatic wallet reconnection\n *\n * @returns null - This is a headless component\n *\n **/\nexport function InitializeConnectorsProvider({ autoConnect }: InitializeConnectorsProviderProps) {\n // Get the initialization function from the store\n const initializeAppConnectors = useSatelliteConnectStore((state) => state.initializeAppConnectors);\n\n // Initialize connectors with autoConnect configuration\n useInitializeAppConnectors({\n initializeAppConnectors: () => initializeAppConnectors({ autoConnect }),\n });\n\n // This is a headless component\n return null;\n}\n","import { createSatelliteConnectStore, SatelliteConnectStoreInitialParameters } from '@tuwaio/satellite-core';\nimport { useMemo } from 'react';\n\nimport { SatelliteStoreContext } from '../hooks/satteliteHook';\nimport { InitializeConnectorsProvider } from './InitializeConnectorsProvider';\n\n/**\n * Props for SatelliteConnectProvider component\n */\ninterface SatelliteConnectProviderProps extends SatelliteConnectStoreInitialParameters {\n /** React child components */\n children: React.ReactNode;\n /** Whether to automatically connect to last used wallet */\n autoConnect?: boolean;\n}\n\n/**\n * Provider component that manages wallet connections and state\n *\n * @remarks\n * This component creates and provides the Satellite Connect store context to its children.\n * It handles wallet connections, state management, and automatic reconnection functionality.\n * The store is memoized to ensure stable reference across renders.\n *\n * @param props - Component properties including store parameters and children\n * @param props.children - Child components that will have access to the store\n * @param props.autoConnect - Optional flag to enable automatic wallet reconnection\n * @param props.adapter - Blockchain adapter(s) for wallet interactions\n * @param props.callbackAfterConnected - Optional callback for successful connections\n *\n * @example\n * ```tsx\n * // Basic usage with single adapter\n * <SatelliteConnectProvider adapter={solanaAdapter}>\n * <App />\n * </SatelliteConnectProvider>\n *\n * // With auto-connect and multiple adapters\n * <SatelliteConnectProvider\n * adapter={[solanaAdapter, evmAdapter]}\n * autoConnect={true}\n * callbackAfterConnected={(wallet) => {\n * console.log('Wallet connected:', wallet.address);\n * }}\n * >\n * <App />\n * </SatelliteConnectProvider>\n * ```\n */\nexport function SatelliteConnectProvider({ children, autoConnect, ...parameters }: SatelliteConnectProviderProps) {\n // Create and memoize the store instance\n const store = useMemo(() => {\n return createSatelliteConnectStore({\n ...parameters,\n });\n }, []); // Empty dependency array as store should be created only once\n\n return (\n <SatelliteStoreContext.Provider value={store}>\n <InitializeConnectorsProvider autoConnect={autoConnect} />\n {children}\n </SatelliteStoreContext.Provider>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/hooks/satteliteHook.ts","../src/components/EVMWalletsWatcher.tsx","../src/components/SolanaWalletsWatcher.tsx","../src/hooks/useInitializeAutoConnect.tsx","../src/providers/SatelliteConnectProvider.tsx"],"names":["SatelliteStoreContext","createContext","useSatelliteConnectStore","selector","store","useContext","useStore","EVMWalletsWatcher","wagmiConfig","updateActiveWallet","state","watchAccount","account","OrbitAdapter","SolanaWalletsWatcher","wallets","useWallets","useEffect","activeWallet","wallet","useInitializeAutoConnect","initializeAutoConnect","onError","error","e","SatelliteConnectProvider","children","autoConnect","parameters","useMemo","createSatelliteConnectStore","jsx"],"mappings":"wUAQO,IAAMA,CAAAA,CAAwBC,aAAAA,CAAuD,IAAI,CAAA,CAqBnFC,CAAAA,CAA+BC,CAAAA,EAAsD,CAEhG,IAAMC,CAAAA,CAAQC,UAAAA,CAAWL,CAAqB,CAAA,CAG9C,GAAI,CAACI,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,yEAAyE,CAAA,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A,CAGL,IACT,CCJO,IAAMK,CAAAA,CAA2B,CAAC,CAAE,qBAAA,CAAAC,CAAAA,CAAuB,OAAA,CAAAC,CAAQ,CAAA,GAAwC,CAChHL,SAAAA,CAAU,IAAM,CAAA,CACqB,SAAY,CAC7C,GAAI,CACF,MAAMI,CAAAA,GACR,CAAA,MAASE,CAAAA,CAAO,CAAA,CAEOD,CAAAA,GAAaE,CAAAA,EAAa,OAAA,CAAQ,KAAA,CAAM,oCAAA,CAAsCA,CAAC,CAAA,CAAA,EACvFD,CAAc,EAC7B,CACF,CAAA,IAGF,CAAA,CAAG,EAAE,EACP,ECNO,SAASE,CAAAA,CAAyB,CAAE,QAAA,CAAAC,CAAAA,CAAU,WAAA,CAAAC,CAAAA,CAAa,GAAGC,CAAW,CAAA,CAAkC,CAEhH,IAAMxB,CAAAA,CAAQyB,OAAAA,CAAQ,IACbC,2BAAAA,CAA4B,CACjC,GAAGF,CACL,CAAC,CAAA,CACA,EAAE,CAAA,CAEL,OAAAR,CAAAA,CAAyB,CACvB,qBAAA,CAAuB,IAAMhB,CAAAA,CAAM,QAAA,EAAS,CAAE,qBAAA,CAAsBuB,CAAAA,EAAe,CAAA,CAAK,CAC1F,CAAC,CAAA,CAEMI,GAAAA,CAAC/B,CAAAA,CAAsB,QAAA,CAAtB,CAA+B,KAAA,CAAOI,CAAAA,CAAQ,QAAA,CAAAsB,EAAS,CACjE","file":"index.js","sourcesContent":["import { ISatelliteConnectStore } from '@tuwaio/satellite-core';\nimport { createContext, useContext } from 'react';\nimport { StoreApi, useStore } from 'zustand';\n\n/**\n * React Context for providing Satellite Connect store throughout the application\n * @internal\n */\nexport const SatelliteStoreContext = createContext<StoreApi<ISatelliteConnectStore> | null>(null);\n\n/**\n * Custom hook for accessing the Satellite Connect store state\n *\n * @remarks\n * This hook provides type-safe access to the Satellite store state and must be used\n * within a component that is wrapped by SatelliteConnectProvider.\n *\n * @typeParam T - The type of the selected state slice\n * @param selector - Function that selects a slice of the store state\n * @returns Selected state slice\n *\n * @throws Error if used outside of SatelliteConnectProvider\n *\n * @example\n * ```tsx\n * // Get the active wallet\n * const activeWallet = useSatelliteConnectStore((state) => state.activeWallet);\n * ```\n */\nexport const useSatelliteConnectStore = <T>(selector: (state: ISatelliteConnectStore) => T): T => {\n // Get store instance from context\n const store = useContext(SatelliteStoreContext);\n\n // Ensure hook is used within provider\n if (!store) {\n throw new Error('useSatelliteConnectStore must be used within a SatelliteConnectProvider');\n }\n\n // Return selected state using Zustand's useStore\n return useStore(store, selector);\n};\n","import { OrbitAdapter } from '@tuwaio/orbit-core';\nimport { WalletType } from '@tuwaio/satellite-core';\nimport { Config, watchAccount } from '@wagmi/core';\n\nimport { useSatelliteConnectStore } from '../hooks/satteliteHook';\n\n/**\n * React component that watches for EVM wallet account changes and updates the Satellite store\n *\n * @remarks\n * This component acts as a bridge between Wagmi account state and Satellite store.\n * It doesn't render anything visible but maintains wallet state synchronization.\n *\n * @param props - Component properties\n * @param props.wagmiConfig - Wagmi configuration instance\n *\n * @returns null - This is a headless component\n **/\nexport function EVMWalletsWatcher({ wagmiConfig }: { wagmiConfig: Config }) {\n // Get the updateActiveWallet function from the Satellite store\n const updateActiveWallet = useSatelliteConnectStore((state) => state.updateActiveWallet);\n\n // Set up account change watcher\n watchAccount(wagmiConfig, {\n onChange: async (account) => {\n // Update the Satellite store with the new account information\n updateActiveWallet({\n // Combine EVM adapter key with connector type for wallet identification\n walletType: `${OrbitAdapter.EVM}:${account?.connector?.type}` as WalletType,\n // Update wallet address\n address: account.address,\n // Update chain ID\n chainId: account.chainId,\n // Update RPC URL using the first available HTTP URL\n rpcURL: account.chain?.rpcUrls.default.http[0],\n // Update connection status\n isConnected: account.isConnected,\n });\n },\n });\n\n // This is a headless component, so return null\n return null;\n}\n","import { useWallets } from '@wallet-standard/react';\nimport { useEffect } from 'react';\n\nimport { useSatelliteConnectStore } from '../hooks/satteliteHook';\n\n/**\n * React component that monitors Solana wallet connections and updates the Satellite store\n *\n * @remarks\n * This component watches for changes in connected Solana wallets using the Wallet Standard.\n * Currently handles the first active wallet only, with multi-wallet support planned for future.\n * It's a headless component that manages state synchronization between Wallet Standard and Satellite store.\n *\n * @returns null - This is a headless component\n *\n */\nexport function SolanaWalletsWatcher() {\n // Get all connected Solana wallets\n const wallets = useWallets();\n\n // Get the updateActiveWallet function from the Satellite store\n const updateActiveWallet = useSatelliteConnectStore((state) => state.updateActiveWallet);\n\n // Watch for changes in connected wallets\n useEffect(() => {\n // Currently only handling the first wallet with active accounts\n const activeWallet = wallets.filter((wallet) => wallet.accounts.length > 0)[0];\n\n if (activeWallet) {\n // Update the Satellite store with the active wallet information\n updateActiveWallet({\n // Use the first account's address\n // TODO: Implement support for multiple connected wallets\n address: activeWallet.accounts[0].address,\n // Set connection status\n isConnected: true,\n // Store Wallet Standard specific information\n connectedAccount: activeWallet.accounts[0],\n connectedWallet: activeWallet,\n });\n }\n }, [wallets]); // Re-run effect when wallets array changes\n\n // This is a headless component, so return null\n return null;\n}\n","import { useEffect } from 'react';\n\n/**\n * Props for the useInitializeAutoConnect hook.\n */\ninterface InitializeAutoConnectProps {\n /** Function to initialize auto connect logic */\n initializeAutoConnect: () => Promise<void>;\n /** Optional error handler callback */\n onError?: (error: Error) => void;\n}\n\n/**\n * Custom hook for initializing wallet auto-connection with error handling.\n *\n * @remarks\n * This hook handles the initial connection logic (e.g., checking for a previously\n * connected wallet) when a component mounts.\n * It provides default error handling with console.error if no custom handler is provided.\n * The initialization runs only once when the component mounts.\n *\n * @param props - Hook configuration\n * @param props.initializeAutoConnect - Async function that executes the auto-connect logic\n * @param props.onError - Optional custom error handler\n *\n * @example\n * ```tsx\n * // Basic usage with default error handling\n * useInitializeAutoConnect({\n * initializeAutoConnect: store.initializeAutoConnect\n * });\n *\n * // With custom error handling\n * useInitializeAutoConnect({\n * initializeAutoConnect: store.initializeAutoConnect,\n * onError: (error) => {\n * toast.error(`Failed to auto-connect: ${error.message}`);\n * }\n * });\n * ```\n */\nexport const useInitializeAutoConnect = ({ initializeAutoConnect, onError }: InitializeAutoConnectProps): void => {\n useEffect(() => {\n const initializeAutoConnectLocal = async () => {\n try {\n await initializeAutoConnect();\n } catch (error) {\n // Use provided error handler or fallback to default console.error\n const errorHandler = onError ?? ((e: Error) => console.error('Failed to initialize auto connect:', e));\n errorHandler(error as Error);\n }\n };\n // Initialize auto connect when component mounts\n initializeAutoConnectLocal();\n }, []); // Empty dependency array ensures single execution\n};\n","import { createSatelliteConnectStore, SatelliteConnectStoreInitialParameters } from '@tuwaio/satellite-core';\nimport { useMemo } from 'react';\n\nimport { SatelliteStoreContext } from '../hooks/satteliteHook';\nimport { useInitializeAutoConnect } from '../hooks/useInitializeAutoConnect';\n\n/**\n * Props for SatelliteConnectProvider component\n */\ninterface SatelliteConnectProviderProps extends SatelliteConnectStoreInitialParameters {\n /** React child components */\n children: React.ReactNode;\n /** Whether to automatically connect to last used wallet */\n autoConnect?: boolean;\n}\n\n/**\n * Provider component that manages wallet connections and state\n *\n * @remarks\n * This component creates and provides the Satellite Connect store context to its children.\n * It handles wallet connections, state management, and automatic reconnection functionality.\n * The store is memoized to ensure stable reference across renders.\n *\n * @param props - Component properties including store parameters and children\n * @param props.children - Child components that will have access to the store\n * @param props.autoConnect - Optional flag to enable automatic wallet reconnection\n * @param props.adapter - Blockchain adapter(s) for wallet interactions\n * @param props.callbackAfterConnected - Optional callback for successful connections\n *\n * @example\n * ```tsx\n * // Basic usage with single adapter\n * <SatelliteConnectProvider adapter={solanaAdapter}>\n * <App />\n * </SatelliteConnectProvider>\n *\n * // With auto-connect and multiple adapters\n * <SatelliteConnectProvider\n * adapter={[solanaAdapter, evmAdapter]}\n * autoConnect={true}\n * callbackAfterConnected={(wallet) => {\n * console.log('Wallet connected:', wallet.address);\n * }}\n * >\n * <App />\n * </SatelliteConnectProvider>\n * ```\n */\nexport function SatelliteConnectProvider({ children, autoConnect, ...parameters }: SatelliteConnectProviderProps) {\n // Create and memoize the store instance\n const store = useMemo(() => {\n return createSatelliteConnectStore({\n ...parameters,\n });\n }, []); // Empty dependency array as store should be created only once\n\n useInitializeAutoConnect({\n initializeAutoConnect: () => store.getState().initializeAutoConnect(autoConnect ?? false),\n });\n\n return <SatelliteStoreContext.Provider value={store}>{children}</SatelliteStoreContext.Provider>;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuwaio/satellite-react",
|
|
3
|
-
"version": "1.0.0-fix-test-alpha.
|
|
3
|
+
"version": "1.0.0-fix-test-alpha.12.37394ce",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Oleksandr Tkach",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"tsup": "^8.5.0",
|
|
59
59
|
"typescript": "^5.9.2",
|
|
60
60
|
"zustand": "^5.0.8",
|
|
61
|
-
"@tuwaio/orbit-core": "^1.0.0-fix-test-alpha.
|
|
62
|
-
"@tuwaio/
|
|
63
|
-
"@tuwaio/
|
|
61
|
+
"@tuwaio/orbit-core": "^1.0.0-fix-test-alpha.12.37394ce",
|
|
62
|
+
"@tuwaio/orbit-solana": "^1.0.0-fix-test-alpha.12.37394ce",
|
|
63
|
+
"@tuwaio/satellite-core": "^1.0.0-fix-test-alpha.12.37394ce"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"start": "tsup src/index.ts --watch",
|