@tuwaio/satellite-react 1.0.0-fix-test-alpha.66.83cea0e → 1.0.0-fix-watchers-alpha.1.39245f5
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/chunk-3WMGCMYX.js +2 -0
- package/dist/chunk-3WMGCMYX.js.map +1 -0
- package/dist/chunk-YC7F3NGW.cjs +2 -0
- package/dist/chunk-YC7F3NGW.cjs.map +1 -0
- package/dist/evm/index.cjs +1 -1
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +2 -4
- package/dist/evm/index.d.ts +2 -4
- package/dist/evm/index.js +1 -1
- package/dist/evm/index.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/solana/index.cjs +1 -1
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +2 -5
- package/dist/solana/index.d.ts +2 -5
- package/dist/solana/index.js +1 -1
- package/dist/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {createContext,useContext,useEffect,useMemo}from'react';import {useStore}from'zustand';import {createSatelliteConnectStore}from'@tuwaio/satellite-core';import {jsx}from'react/jsx-runtime';var r=createContext(null),A=e=>{let t=useContext(r);if(!t)throw new Error("useSatelliteConnectStore must be used within a SatelliteConnectProvider");return useStore(t,e)};var i=({initializeAutoConnect:e,onError:t})=>{useEffect(()=>{(async()=>{try{await e();}catch(o){(t??(l=>console.error("Failed to initialize auto connect:",l)))(o);}})();},[]);};function b({children:e,autoConnect:t,...n}){let o=useMemo(()=>createSatelliteConnectStore({...n}),[]);return useEffect(()=>{o.getState().disconnectAll();},[]),i({initializeAutoConnect:()=>o.getState().initializeAutoConnect(t??!1)}),jsx(r.Provider,{value:o,children:e})}export{r as a,A as b,i as c,b as d};//# sourceMappingURL=chunk-3WMGCMYX.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-3WMGCMYX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/satteliteHook.ts","../src/hooks/useInitializeAutoConnect.tsx","../src/providers/SatelliteConnectProvider.tsx"],"names":["SatelliteStoreContext","createContext","useSatelliteConnectStore","selector","store","useContext","useStore","useInitializeAutoConnect","initializeAutoConnect","onError","useEffect","error","e","SatelliteConnectProvider","children","autoConnect","parameters","useMemo","createSatelliteConnectStore","jsx"],"mappings":"uMAUaA,CAAAA,CAAwBC,aAAAA,CAA0E,IAAI,CAAA,CAqBtGC,EAA+BC,CAAAA,EAAyE,CAEnH,IAAMC,CAAAA,CAAQC,UAAAA,CAAWL,CAAqB,CAAA,CAG9C,GAAI,CAACI,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,yEAAyE,CAAA,CAI3F,OAAOE,QAAAA,CAASF,CAAAA,CAAOD,CAAQ,CACjC,ECDO,IAAMI,CAAAA,CAA2B,CAAC,CAAE,qBAAA,CAAAC,CAAAA,CAAuB,OAAA,CAAAC,CAAQ,CAAA,GAAwC,CAChHC,SAAAA,CAAU,IAAM,EACqB,SAAY,CAC7C,GAAI,CACF,MAAMF,CAAAA,GACR,CAAA,MAASG,CAAAA,CAAO,EAEOF,CAAAA,GAAaG,CAAAA,EAAa,OAAA,CAAQ,KAAA,CAAM,qCAAsCA,CAAC,CAAA,CAAA,EACvFD,CAAc,EAC7B,CACF,CAAA,IAGF,CAAA,CAAG,EAAE,EACP,ECLO,SAASE,CAAAA,CAAyB,CAAE,SAAAC,CAAAA,CAAU,WAAA,CAAAC,CAAAA,CAAa,GAAGC,CAAW,CAAA,CAAkC,CAEhH,IAAMZ,CAAAA,CAAQa,QAAQ,IACbC,2BAAAA,CAA+C,CACpD,GAAGF,CACL,CAAC,CAAA,CAEA,EAAE,CAAA,CAGL,OAAAN,SAAAA,CAAU,IAAM,CACdN,CAAAA,CAAM,QAAA,EAAS,CAAE,aAAA,GAEnB,CAAA,CAAG,EAAE,CAAA,CAELG,EAAyB,CACvB,qBAAA,CAAuB,IAAMH,CAAAA,CAAM,UAAS,CAAE,qBAAA,CAAsBW,CAAAA,EAAe,CAAA,CAAK,CAC1F,CAAC,CAAA,CAEMI,GAAAA,CAACnB,CAAAA,CAAsB,SAAtB,CAA+B,KAAA,CAAOI,CAAAA,CAAQ,QAAA,CAAAU,EAAS,CACjE","file":"chunk-3WMGCMYX.js","sourcesContent":["import { ISatelliteConnectStore } from '@tuwaio/satellite-core';\nimport { createContext, useContext } from 'react';\nimport { StoreApi, useStore } from 'zustand';\n\nimport { Connector, Wallet } from '../types';\n\n/**\n * React Context for providing Satellite Connect store throughout the application\n * @internal\n */\nexport const SatelliteStoreContext = createContext<StoreApi<ISatelliteConnectStore<Connector, Wallet>> | 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<Connector, Wallet>) => 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 { 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 { useEffect, useMemo } from 'react';\n\nimport { SatelliteStoreContext } from '../hooks/satteliteHook';\nimport { useInitializeAutoConnect } from '../hooks/useInitializeAutoConnect';\nimport { Connector, Wallet } from '../types';\n\n/**\n * Props for SatelliteConnectProvider component\n */\nexport interface SatelliteConnectProviderProps extends SatelliteConnectStoreInitialParameters<Connector, Wallet> {\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<Connector, Wallet>({\n ...parameters,\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []); // Empty dependency array as store should be created only once\n\n // Disconnect from any existing wallets on mount\n useEffect(() => {\n store.getState().disconnectAll();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useInitializeAutoConnect({\n initializeAutoConnect: () => store.getState().initializeAutoConnect(autoConnect ?? false),\n });\n\n return <SatelliteStoreContext.Provider value={store}>{children}</SatelliteStoreContext.Provider>;\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var react=require('react'),zustand=require('zustand'),satelliteCore=require('@tuwaio/satellite-core'),jsxRuntime=require('react/jsx-runtime');var r=react.createContext(null),A=e=>{let t=react.useContext(r);if(!t)throw new Error("useSatelliteConnectStore must be used within a SatelliteConnectProvider");return zustand.useStore(t,e)};var i=({initializeAutoConnect:e,onError:t})=>{react.useEffect(()=>{(async()=>{try{await e();}catch(o){(t??(l=>console.error("Failed to initialize auto connect:",l)))(o);}})();},[]);};function b({children:e,autoConnect:t,...n}){let o=react.useMemo(()=>satelliteCore.createSatelliteConnectStore({...n}),[]);return react.useEffect(()=>{o.getState().disconnectAll();},[]),i({initializeAutoConnect:()=>o.getState().initializeAutoConnect(t??!1)}),jsxRuntime.jsx(r.Provider,{value:o,children:e})}exports.a=r;exports.b=A;exports.c=i;exports.d=b;//# sourceMappingURL=chunk-YC7F3NGW.cjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-YC7F3NGW.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/satteliteHook.ts","../src/hooks/useInitializeAutoConnect.tsx","../src/providers/SatelliteConnectProvider.tsx"],"names":["SatelliteStoreContext","createContext","useSatelliteConnectStore","selector","store","useContext","useStore","useInitializeAutoConnect","initializeAutoConnect","onError","useEffect","error","e","SatelliteConnectProvider","children","autoConnect","parameters","useMemo","createSatelliteConnectStore","jsx"],"mappings":"+JAUaA,CAAAA,CAAwBC,mBAAAA,CAA0E,IAAI,CAAA,CAqBtGC,EAA+BC,CAAAA,EAAyE,CAEnH,IAAMC,CAAAA,CAAQC,gBAAAA,CAAWL,CAAqB,CAAA,CAG9C,GAAI,CAACI,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,yEAAyE,CAAA,CAI3F,OAAOE,gBAAAA,CAASF,CAAAA,CAAOD,CAAQ,CACjC,ECDO,IAAMI,CAAAA,CAA2B,CAAC,CAAE,qBAAA,CAAAC,CAAAA,CAAuB,OAAA,CAAAC,CAAQ,CAAA,GAAwC,CAChHC,eAAAA,CAAU,IAAM,EACqB,SAAY,CAC7C,GAAI,CACF,MAAMF,CAAAA,GACR,CAAA,MAASG,CAAAA,CAAO,EAEOF,CAAAA,GAAaG,CAAAA,EAAa,OAAA,CAAQ,KAAA,CAAM,qCAAsCA,CAAC,CAAA,CAAA,EACvFD,CAAc,EAC7B,CACF,CAAA,IAGF,CAAA,CAAG,EAAE,EACP,ECLO,SAASE,CAAAA,CAAyB,CAAE,SAAAC,CAAAA,CAAU,WAAA,CAAAC,CAAAA,CAAa,GAAGC,CAAW,CAAA,CAAkC,CAEhH,IAAMZ,CAAAA,CAAQa,cAAQ,IACbC,yCAAAA,CAA+C,CACpD,GAAGF,CACL,CAAC,CAAA,CAEA,EAAE,CAAA,CAGL,OAAAN,eAAAA,CAAU,IAAM,CACdN,CAAAA,CAAM,QAAA,EAAS,CAAE,aAAA,GAEnB,CAAA,CAAG,EAAE,CAAA,CAELG,EAAyB,CACvB,qBAAA,CAAuB,IAAMH,CAAAA,CAAM,UAAS,CAAE,qBAAA,CAAsBW,CAAAA,EAAe,CAAA,CAAK,CAC1F,CAAC,CAAA,CAEMI,cAAAA,CAACnB,CAAAA,CAAsB,SAAtB,CAA+B,KAAA,CAAOI,CAAAA,CAAQ,QAAA,CAAAU,EAAS,CACjE","file":"chunk-YC7F3NGW.cjs","sourcesContent":["import { ISatelliteConnectStore } from '@tuwaio/satellite-core';\nimport { createContext, useContext } from 'react';\nimport { StoreApi, useStore } from 'zustand';\n\nimport { Connector, Wallet } from '../types';\n\n/**\n * React Context for providing Satellite Connect store throughout the application\n * @internal\n */\nexport const SatelliteStoreContext = createContext<StoreApi<ISatelliteConnectStore<Connector, Wallet>> | 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<Connector, Wallet>) => 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 { 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 { useEffect, useMemo } from 'react';\n\nimport { SatelliteStoreContext } from '../hooks/satteliteHook';\nimport { useInitializeAutoConnect } from '../hooks/useInitializeAutoConnect';\nimport { Connector, Wallet } from '../types';\n\n/**\n * Props for SatelliteConnectProvider component\n */\nexport interface SatelliteConnectProviderProps extends SatelliteConnectStoreInitialParameters<Connector, Wallet> {\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<Connector, Wallet>({\n ...parameters,\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []); // Empty dependency array as store should be created only once\n\n // Disconnect from any existing wallets on mount\n useEffect(() => {\n store.getState().disconnectAll();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\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/evm/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var orbitCore=require('@tuwaio/orbit-core'),core=require('@wagmi/core'),react=require('react');function V({wagmiConfig:
|
|
1
|
+
'use strict';var chunkYC7F3NGW_cjs=require('../chunk-YC7F3NGW.cjs'),orbitCore=require('@tuwaio/orbit-core'),core=require('@wagmi/core'),react=require('react');function V({wagmiConfig:c,siwe:n}){let a=chunkYC7F3NGW_cjs.b(t=>t.activeWallet),o=chunkYC7F3NGW_cjs.b(t=>t.disconnect),l=chunkYC7F3NGW_cjs.b(t=>t.walletConnectionError),s=chunkYC7F3NGW_cjs.b(t=>t.updateActiveWallet);return react.useEffect(()=>{n?.enabled&&!n?.isSignedIn&&n?.isRejected&&o();},[n,o]),react.useEffect(()=>core.watchAccount(c,{onChange:e=>{if(e?.status==="disconnected"&&o(),a&&orbitCore.getAdapterFromWalletType(a.walletType)!==orbitCore.OrbitAdapter.EVM||!e.address||l)return;if(n?.enabled?n.isSignedIn:true){let d=a?.walletType,p=d?{walletType:d,address:e.address,chainId:e.chainId,rpcURL:e.chain?.rpcUrls.default.http[0],isConnected:e.isConnected}:{address:e.address,chainId:e.chainId,rpcURL:e.chain?.rpcUrls.default.http[0],isConnected:e.isConnected};s(p);}}}),[a?.walletType,n,l]),null}exports.EVMWalletsWatcher=V;//# sourceMappingURL=index.cjs.map
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/evm/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/evm/EVMWalletsWatcher.tsx"],"names":["EVMWalletsWatcher","wagmiConfig","
|
|
1
|
+
{"version":3,"sources":["../../src/evm/EVMWalletsWatcher.tsx"],"names":["EVMWalletsWatcher","wagmiConfig","siwe","activeWallet","useSatelliteConnectStore","store","disconnect","walletConnectionError","updateActiveWallet","useEffect","watchAccount","account","getAdapterFromWalletType","OrbitAdapter","walletType","walletUpdate"],"mappings":"+JAMO,SAASA,CAAAA,CAAkB,CAChC,WAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CACF,EAQG,CACD,IAAMC,CAAAA,CAAeC,mBAAAA,CAA0BC,GAAUA,CAAAA,CAAM,YAAY,CAAA,CACrEC,CAAAA,CAAaF,oBAA0BC,CAAAA,EAAUA,CAAAA,CAAM,UAAU,CAAA,CACjEE,EAAwBH,mBAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,qBAAqB,EACvFG,CAAAA,CAAqBJ,mBAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,kBAAkB,CAAA,CAEvF,OAAAI,eAAAA,CAAU,IAAM,CACVP,CAAAA,EAAM,OAAA,EAAW,CAACA,CAAAA,EAAM,YAAcA,CAAAA,EAAM,UAAA,EAC9CI,CAAAA,GAEJ,EAAG,CAACJ,CAAAA,CAAMI,CAAU,CAAC,EAErBG,eAAAA,CAAU,IAqCQC,iBAAAA,CAAaT,CAAAA,CAAa,CAAE,QAAA,CApCqBU,CAAAA,EAAY,CAK3E,GAJIA,CAAAA,EAAS,SAAW,cAAA,EACtBL,CAAAA,EAAW,CAIVH,CAAAA,EAAgBS,mCAAyBT,CAAAA,CAAa,UAAU,CAAA,GAAMU,sBAAAA,CAAa,KACpF,CAACF,CAAAA,CAAQ,OAAA,EACTJ,CAAAA,CAEA,OAKF,GAFqBL,CAAAA,EAAM,OAAA,CAAUA,CAAAA,CAAK,WAAa,IAAA,CAErC,CAChB,IAAMY,CAAAA,CAAaX,GAAc,UAAA,CAC3BY,CAAAA,CAAeD,CAAAA,CACjB,CACE,WAAAA,CAAAA,CACA,OAAA,CAASH,CAAAA,CAAQ,OAAA,CACjB,QAASA,CAAAA,CAAQ,OAAA,CACjB,OAAQA,CAAAA,CAAQ,KAAA,EAAO,QAAQ,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAC7C,YAAaA,CAAAA,CAAQ,WACvB,CAAA,CACA,CACE,QAASA,CAAAA,CAAQ,OAAA,CACjB,OAAA,CAASA,CAAAA,CAAQ,QACjB,MAAA,CAAQA,CAAAA,CAAQ,KAAA,EAAO,OAAA,CAAQ,QAAQ,IAAA,CAAK,CAAC,CAAA,CAC7C,WAAA,CAAaA,EAAQ,WACvB,CAAA,CAEJH,CAAAA,CAAmBO,CAAY,EACjC,CACF,CAE0E,CAAC,CAAA,CAI1E,CAACZ,CAAAA,EAAc,UAAA,CAAYD,EAAMK,CAAqB,CAAC,EAEnD,IACT","file":"index.cjs","sourcesContent":["import { getAdapterFromWalletType, OrbitAdapter } from '@tuwaio/orbit-core';\nimport { Config, watchAccount, WatchAccountParameters } from '@wagmi/core';\nimport { useEffect } from 'react';\n\nimport { useSatelliteConnectStore } from '../index';\n\nexport function EVMWalletsWatcher({\n wagmiConfig,\n siwe,\n}: {\n wagmiConfig: Config;\n\n siwe?: {\n isRejected: boolean;\n isSignedIn: boolean;\n enabled?: boolean;\n };\n}) {\n const activeWallet = useSatelliteConnectStore((store) => store.activeWallet);\n const disconnect = useSatelliteConnectStore((store) => store.disconnect);\n const walletConnectionError = useSatelliteConnectStore((store) => store.walletConnectionError);\n const updateActiveWallet = useSatelliteConnectStore((store) => store.updateActiveWallet);\n\n useEffect(() => {\n if (siwe?.enabled && !siwe?.isSignedIn && siwe?.isRejected) {\n disconnect();\n }\n }, [siwe, disconnect]);\n\n useEffect(() => {\n const handleAccountChange: WatchAccountParameters['onChange'] = (account) => {\n if (account?.status === 'disconnected') {\n disconnect();\n }\n\n if (\n (activeWallet && getAdapterFromWalletType(activeWallet.walletType) !== OrbitAdapter.EVM) ||\n !account.address ||\n walletConnectionError\n ) {\n return;\n }\n\n const shouldUpdate = siwe?.enabled ? siwe.isSignedIn : true;\n\n if (shouldUpdate) {\n const walletType = activeWallet?.walletType;\n const walletUpdate = walletType\n ? {\n walletType,\n address: account.address,\n chainId: account.chainId,\n rpcURL: account.chain?.rpcUrls.default.http[0],\n isConnected: account.isConnected,\n }\n : {\n address: account.address,\n chainId: account.chainId,\n rpcURL: account.chain?.rpcUrls.default.http[0],\n isConnected: account.isConnected,\n };\n\n updateActiveWallet(walletUpdate);\n }\n };\n\n const unwatch = watchAccount(wagmiConfig, { onChange: handleAccountChange });\n\n return unwatch;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeWallet?.walletType, siwe, walletConnectionError]);\n\n return null;\n}\n"]}
|
package/dist/evm/index.d.cts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
2
|
-
import {
|
|
3
|
-
import { ISatelliteConnectStore } from '@tuwaio/satellite-core';
|
|
2
|
+
import { EVMWallet, ConnectorEVM } from '@tuwaio/satellite-evm';
|
|
4
3
|
import { Config } from '@wagmi/core';
|
|
5
4
|
|
|
6
|
-
declare function EVMWalletsWatcher({ wagmiConfig,
|
|
5
|
+
declare function EVMWalletsWatcher({ wagmiConfig, siwe, }: {
|
|
7
6
|
wagmiConfig: Config;
|
|
8
|
-
store: Pick<ISatelliteConnectStore<ConnectorEVM, EVMWallet>, 'activeWallet' | 'updateActiveWallet' | 'walletConnectionError' | 'disconnect'>;
|
|
9
7
|
siwe?: {
|
|
10
8
|
isRejected: boolean;
|
|
11
9
|
isSignedIn: boolean;
|
package/dist/evm/index.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
2
|
-
import {
|
|
3
|
-
import { ISatelliteConnectStore } from '@tuwaio/satellite-core';
|
|
2
|
+
import { EVMWallet, ConnectorEVM } from '@tuwaio/satellite-evm';
|
|
4
3
|
import { Config } from '@wagmi/core';
|
|
5
4
|
|
|
6
|
-
declare function EVMWalletsWatcher({ wagmiConfig,
|
|
5
|
+
declare function EVMWalletsWatcher({ wagmiConfig, siwe, }: {
|
|
7
6
|
wagmiConfig: Config;
|
|
8
|
-
store: Pick<ISatelliteConnectStore<ConnectorEVM, EVMWallet>, 'activeWallet' | 'updateActiveWallet' | 'walletConnectionError' | 'disconnect'>;
|
|
9
7
|
siwe?: {
|
|
10
8
|
isRejected: boolean;
|
|
11
9
|
isSignedIn: boolean;
|
package/dist/evm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {getAdapterFromWalletType,OrbitAdapter}from'@tuwaio/orbit-core';import {watchAccount}from'@wagmi/core';import {useEffect}from'react';function V({wagmiConfig:
|
|
1
|
+
import {b}from'../chunk-3WMGCMYX.js';import {getAdapterFromWalletType,OrbitAdapter}from'@tuwaio/orbit-core';import {watchAccount}from'@wagmi/core';import {useEffect}from'react';function V({wagmiConfig:c,siwe:n}){let a=b(t=>t.activeWallet),o=b(t=>t.disconnect),l=b(t=>t.walletConnectionError),s=b(t=>t.updateActiveWallet);return useEffect(()=>{n?.enabled&&!n?.isSignedIn&&n?.isRejected&&o();},[n,o]),useEffect(()=>watchAccount(c,{onChange:e=>{if(e?.status==="disconnected"&&o(),a&&getAdapterFromWalletType(a.walletType)!==OrbitAdapter.EVM||!e.address||l)return;if(n?.enabled?n.isSignedIn:true){let d=a?.walletType,p=d?{walletType:d,address:e.address,chainId:e.chainId,rpcURL:e.chain?.rpcUrls.default.http[0],isConnected:e.isConnected}:{address:e.address,chainId:e.chainId,rpcURL:e.chain?.rpcUrls.default.http[0],isConnected:e.isConnected};s(p);}}}),[a?.walletType,n,l]),null}export{V as EVMWalletsWatcher};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/evm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/evm/EVMWalletsWatcher.tsx"],"names":["EVMWalletsWatcher","wagmiConfig","
|
|
1
|
+
{"version":3,"sources":["../../src/evm/EVMWalletsWatcher.tsx"],"names":["EVMWalletsWatcher","wagmiConfig","siwe","activeWallet","useSatelliteConnectStore","store","disconnect","walletConnectionError","updateActiveWallet","useEffect","watchAccount","account","getAdapterFromWalletType","OrbitAdapter","walletType","walletUpdate"],"mappings":"iLAMO,SAASA,CAAAA,CAAkB,CAChC,WAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CACF,EAQG,CACD,IAAMC,CAAAA,CAAeC,CAAAA,CAA0BC,GAAUA,CAAAA,CAAM,YAAY,CAAA,CACrEC,CAAAA,CAAaF,EAA0BC,CAAAA,EAAUA,CAAAA,CAAM,UAAU,CAAA,CACjEE,EAAwBH,CAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,qBAAqB,EACvFG,CAAAA,CAAqBJ,CAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,kBAAkB,CAAA,CAEvF,OAAAI,SAAAA,CAAU,IAAM,CACVP,CAAAA,EAAM,OAAA,EAAW,CAACA,CAAAA,EAAM,YAAcA,CAAAA,EAAM,UAAA,EAC9CI,CAAAA,GAEJ,EAAG,CAACJ,CAAAA,CAAMI,CAAU,CAAC,EAErBG,SAAAA,CAAU,IAqCQC,YAAAA,CAAaT,CAAAA,CAAa,CAAE,QAAA,CApCqBU,CAAAA,EAAY,CAK3E,GAJIA,CAAAA,EAAS,SAAW,cAAA,EACtBL,CAAAA,EAAW,CAIVH,CAAAA,EAAgBS,yBAAyBT,CAAAA,CAAa,UAAU,CAAA,GAAMU,YAAAA,CAAa,KACpF,CAACF,CAAAA,CAAQ,OAAA,EACTJ,CAAAA,CAEA,OAKF,GAFqBL,CAAAA,EAAM,OAAA,CAAUA,CAAAA,CAAK,WAAa,IAAA,CAErC,CAChB,IAAMY,CAAAA,CAAaX,GAAc,UAAA,CAC3BY,CAAAA,CAAeD,CAAAA,CACjB,CACE,WAAAA,CAAAA,CACA,OAAA,CAASH,CAAAA,CAAQ,OAAA,CACjB,QAASA,CAAAA,CAAQ,OAAA,CACjB,OAAQA,CAAAA,CAAQ,KAAA,EAAO,QAAQ,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAC7C,YAAaA,CAAAA,CAAQ,WACvB,CAAA,CACA,CACE,QAASA,CAAAA,CAAQ,OAAA,CACjB,OAAA,CAASA,CAAAA,CAAQ,QACjB,MAAA,CAAQA,CAAAA,CAAQ,KAAA,EAAO,OAAA,CAAQ,QAAQ,IAAA,CAAK,CAAC,CAAA,CAC7C,WAAA,CAAaA,EAAQ,WACvB,CAAA,CAEJH,CAAAA,CAAmBO,CAAY,EACjC,CACF,CAE0E,CAAC,CAAA,CAI1E,CAACZ,CAAAA,EAAc,UAAA,CAAYD,EAAMK,CAAqB,CAAC,EAEnD,IACT","file":"index.js","sourcesContent":["import { getAdapterFromWalletType, OrbitAdapter } from '@tuwaio/orbit-core';\nimport { Config, watchAccount, WatchAccountParameters } from '@wagmi/core';\nimport { useEffect } from 'react';\n\nimport { useSatelliteConnectStore } from '../index';\n\nexport function EVMWalletsWatcher({\n wagmiConfig,\n siwe,\n}: {\n wagmiConfig: Config;\n\n siwe?: {\n isRejected: boolean;\n isSignedIn: boolean;\n enabled?: boolean;\n };\n}) {\n const activeWallet = useSatelliteConnectStore((store) => store.activeWallet);\n const disconnect = useSatelliteConnectStore((store) => store.disconnect);\n const walletConnectionError = useSatelliteConnectStore((store) => store.walletConnectionError);\n const updateActiveWallet = useSatelliteConnectStore((store) => store.updateActiveWallet);\n\n useEffect(() => {\n if (siwe?.enabled && !siwe?.isSignedIn && siwe?.isRejected) {\n disconnect();\n }\n }, [siwe, disconnect]);\n\n useEffect(() => {\n const handleAccountChange: WatchAccountParameters['onChange'] = (account) => {\n if (account?.status === 'disconnected') {\n disconnect();\n }\n\n if (\n (activeWallet && getAdapterFromWalletType(activeWallet.walletType) !== OrbitAdapter.EVM) ||\n !account.address ||\n walletConnectionError\n ) {\n return;\n }\n\n const shouldUpdate = siwe?.enabled ? siwe.isSignedIn : true;\n\n if (shouldUpdate) {\n const walletType = activeWallet?.walletType;\n const walletUpdate = walletType\n ? {\n walletType,\n address: account.address,\n chainId: account.chainId,\n rpcURL: account.chain?.rpcUrls.default.http[0],\n isConnected: account.isConnected,\n }\n : {\n address: account.address,\n chainId: account.chainId,\n rpcURL: account.chain?.rpcUrls.default.http[0],\n isConnected: account.isConnected,\n };\n\n updateActiveWallet(walletUpdate);\n }\n };\n\n const unwatch = watchAccount(wagmiConfig, { onChange: handleAccountChange });\n\n return unwatch;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeWallet?.walletType, siwe, walletConnectionError]);\n\n return null;\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkYC7F3NGW_cjs=require('./chunk-YC7F3NGW.cjs');Object.defineProperty(exports,"SatelliteConnectProvider",{enumerable:true,get:function(){return chunkYC7F3NGW_cjs.d}});Object.defineProperty(exports,"SatelliteStoreContext",{enumerable:true,get:function(){return chunkYC7F3NGW_cjs.a}});Object.defineProperty(exports,"useInitializeAutoConnect",{enumerable:true,get:function(){return chunkYC7F3NGW_cjs.c}});Object.defineProperty(exports,"useSatelliteConnectStore",{enumerable:true,get:function(){return chunkYC7F3NGW_cjs.b}});//# sourceMappingURL=index.cjs.map
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export{d as SatelliteConnectProvider,a as SatelliteStoreContext,c as useInitializeAutoConnect,b as useSatelliteConnectStore}from'./chunk-3WMGCMYX.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/dist/solana/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var orbitCore=require('@tuwaio/orbit-core'),react=require('@wallet-standard/react'),react$1=require('react');function
|
|
1
|
+
'use strict';var chunkYC7F3NGW_cjs=require('../chunk-YC7F3NGW.cjs'),orbitCore=require('@tuwaio/orbit-core'),react=require('@wallet-standard/react'),react$1=require('react');function C(){let l=react.useWallets(),o=chunkYC7F3NGW_cjs.b(t=>t.activeWallet),a=chunkYC7F3NGW_cjs.b(t=>t.updateActiveWallet),r=chunkYC7F3NGW_cjs.b(t=>t.walletConnectionError),n=chunkYC7F3NGW_cjs.b(t=>t.disconnect);return react$1.useEffect(()=>{if(o&&orbitCore.getAdapterFromWalletType(o.walletType)===orbitCore.OrbitAdapter.SOLANA){let t=l.filter(i=>orbitCore.getWalletTypeFromConnectorName(orbitCore.OrbitAdapter.SOLANA,orbitCore.formatWalletName(i.name))===o.walletType)[0];r||a({address:t?.accounts[0]?.address,isConnected:t?.accounts.length>0,connectedAccount:t?.accounts[0],connectedWallet:t}),t?.accounts.length===0&&n();}},[o?.walletType,l,r,a,n]),null}exports.SolanaWalletsWatcher=C;//# sourceMappingURL=index.cjs.map
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/solana/SolanaWalletsWatcher.tsx"],"names":["SolanaWalletsWatcher","
|
|
1
|
+
{"version":3,"sources":["../../src/solana/SolanaWalletsWatcher.tsx"],"names":["SolanaWalletsWatcher","wallets","useWallets","activeWalletFromStore","useSatelliteConnectStore","store","updateActiveWallet","walletConnectionError","disconnect","useEffect","getAdapterFromWalletType","OrbitAdapter","activeWallet","w","getWalletTypeFromConnectorName","formatWalletName"],"mappings":"6KAsBO,SAASA,CAAAA,EAAuB,CACrC,IAAMC,CAAAA,CAAUC,gBAAAA,EAAW,CAErBC,CAAAA,CAAwBC,mBAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,YAAY,CAAA,CAC9EC,CAAAA,CAAqBF,mBAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,kBAAkB,CAAA,CACjFE,CAAAA,CAAwBH,mBAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,qBAAqB,CAAA,CACvFG,CAAAA,CAAaJ,mBAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,UAAU,CAAA,CAGvE,OAAAI,iBAAAA,CAAU,IAAM,CACd,GAAIN,CAAAA,EAAyBO,kCAAAA,CAAyBP,CAAAA,CAAsB,UAAU,CAAA,GAAMQ,sBAAAA,CAAa,OAAQ,CAC/G,IAAMC,CAAAA,CAAeX,CAAAA,CAAQ,MAAA,CAC1BY,CAAAA,EACCC,wCAAAA,CAA+BH,sBAAAA,CAAa,MAAA,CAAQI,0BAAAA,CAAiBF,CAAAA,CAAE,IAAI,CAAC,CAAA,GAC5EV,CAAAA,CAAsB,UAC1B,CAAA,CAAE,CAAC,CAAA,CAEEI,CAAAA,EAGHD,CAAAA,CAAmB,CAEjB,OAAA,CAASM,CAAAA,EAAc,QAAA,CAAS,CAAC,CAAA,EAAG,OAAA,CAEpC,WAAA,CAAaA,CAAAA,EAAc,SAAS,MAAA,CAAS,CAAA,CAG7C,gBAAA,CAAkBA,CAAAA,EAAc,QAAA,CAAS,CAAC,CAAA,CAC1C,eAAA,CAAiBA,CACnB,CAAC,CAAA,CAECA,CAAAA,EAAc,QAAA,CAAS,MAAA,GAAW,CAAA,EAEpCJ,CAAAA,GAEJ,CAEF,CAAA,CAAG,CAACL,CAAAA,EAAuB,UAAA,CAAYF,CAAAA,CAASM,CAAAA,CAAuBD,CAAAA,CAAoBE,CAAU,CAAC,CAAA,CAG/F,IACT","file":"index.cjs","sourcesContent":["import {\n formatWalletName,\n getAdapterFromWalletType,\n getWalletTypeFromConnectorName,\n OrbitAdapter,\n} from '@tuwaio/orbit-core';\nimport { useWallets } from '@wallet-standard/react';\nimport { useEffect } from 'react';\n\nimport { useSatelliteConnectStore } from '../index';\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 const wallets = useWallets();\n\n const activeWalletFromStore = useSatelliteConnectStore((store) => store.activeWallet);\n const updateActiveWallet = useSatelliteConnectStore((store) => store.updateActiveWallet);\n const walletConnectionError = useSatelliteConnectStore((store) => store.walletConnectionError);\n const disconnect = useSatelliteConnectStore((store) => store.disconnect);\n\n // Watch for changes in connected wallets\n useEffect(() => {\n if (activeWalletFromStore && getAdapterFromWalletType(activeWalletFromStore.walletType) === OrbitAdapter.SOLANA) {\n const activeWallet = wallets.filter(\n (w) =>\n getWalletTypeFromConnectorName(OrbitAdapter.SOLANA, formatWalletName(w.name)) ===\n activeWalletFromStore.walletType,\n )[0];\n\n if (!walletConnectionError) {\n // Update the Satellite store with the active wallet information\n\n updateActiveWallet({\n // Use the first account's address\n address: activeWallet?.accounts[0]?.address,\n // Set connection status\n isConnected: activeWallet?.accounts.length > 0,\n // Store Wallet Standard specific information\n // @ts-expect-error - wallet type is not set fully on the package level\n connectedAccount: activeWallet?.accounts[0],\n connectedWallet: activeWallet,\n });\n }\n if (activeWallet?.accounts.length === 0) {\n // If the wallet is disconnected from the wallet provider, disconnect from Satellite store as well\n disconnect();\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeWalletFromStore?.walletType, wallets, walletConnectionError, updateActiveWallet, disconnect]); // Re-run effect when wallets array changes\n\n // This is a headless component, so return null\n return null;\n}\n"]}
|
package/dist/solana/index.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
2
|
-
import {
|
|
3
|
-
import { ISatelliteConnectStore } from '@tuwaio/satellite-core';
|
|
2
|
+
import { SolanaWallet, ConnectorSolana } from '@tuwaio/satellite-solana';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* React component that monitors Solana wallet connections and updates the Satellite store
|
|
@@ -13,9 +12,7 @@ import { ISatelliteConnectStore } from '@tuwaio/satellite-core';
|
|
|
13
12
|
* @returns null - This is a headless component
|
|
14
13
|
*
|
|
15
14
|
*/
|
|
16
|
-
declare function SolanaWalletsWatcher(
|
|
17
|
-
store: Pick<ISatelliteConnectStore<ConnectorSolana, SolanaWallet>, 'activeWallet' | 'updateActiveWallet' | 'walletConnectionError' | 'disconnect'>;
|
|
18
|
-
}): null;
|
|
15
|
+
declare function SolanaWalletsWatcher(): null;
|
|
19
16
|
|
|
20
17
|
declare module '@tuwaio/satellite-react' {
|
|
21
18
|
interface AllWallets {
|
package/dist/solana/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
2
|
-
import {
|
|
3
|
-
import { ISatelliteConnectStore } from '@tuwaio/satellite-core';
|
|
2
|
+
import { SolanaWallet, ConnectorSolana } from '@tuwaio/satellite-solana';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* React component that monitors Solana wallet connections and updates the Satellite store
|
|
@@ -13,9 +12,7 @@ import { ISatelliteConnectStore } from '@tuwaio/satellite-core';
|
|
|
13
12
|
* @returns null - This is a headless component
|
|
14
13
|
*
|
|
15
14
|
*/
|
|
16
|
-
declare function SolanaWalletsWatcher(
|
|
17
|
-
store: Pick<ISatelliteConnectStore<ConnectorSolana, SolanaWallet>, 'activeWallet' | 'updateActiveWallet' | 'walletConnectionError' | 'disconnect'>;
|
|
18
|
-
}): null;
|
|
15
|
+
declare function SolanaWalletsWatcher(): null;
|
|
19
16
|
|
|
20
17
|
declare module '@tuwaio/satellite-react' {
|
|
21
18
|
interface AllWallets {
|
package/dist/solana/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {getAdapterFromWalletType,OrbitAdapter,getWalletTypeFromConnectorName,formatWalletName}from'@tuwaio/orbit-core';import {useWallets}from'@wallet-standard/react';import {useEffect}from'react';function
|
|
1
|
+
import {b}from'../chunk-3WMGCMYX.js';import {getAdapterFromWalletType,OrbitAdapter,getWalletTypeFromConnectorName,formatWalletName}from'@tuwaio/orbit-core';import {useWallets}from'@wallet-standard/react';import {useEffect}from'react';function C(){let l=useWallets(),o=b(t=>t.activeWallet),a=b(t=>t.updateActiveWallet),r=b(t=>t.walletConnectionError),n=b(t=>t.disconnect);return useEffect(()=>{if(o&&getAdapterFromWalletType(o.walletType)===OrbitAdapter.SOLANA){let t=l.filter(i=>getWalletTypeFromConnectorName(OrbitAdapter.SOLANA,formatWalletName(i.name))===o.walletType)[0];r||a({address:t?.accounts[0]?.address,isConnected:t?.accounts.length>0,connectedAccount:t?.accounts[0],connectedWallet:t}),t?.accounts.length===0&&n();}},[o?.walletType,l,r,a,n]),null}export{C as SolanaWalletsWatcher};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/solana/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/solana/SolanaWalletsWatcher.tsx"],"names":["SolanaWalletsWatcher","
|
|
1
|
+
{"version":3,"sources":["../../src/solana/SolanaWalletsWatcher.tsx"],"names":["SolanaWalletsWatcher","wallets","useWallets","activeWalletFromStore","useSatelliteConnectStore","store","updateActiveWallet","walletConnectionError","disconnect","useEffect","getAdapterFromWalletType","OrbitAdapter","activeWallet","w","getWalletTypeFromConnectorName","formatWalletName"],"mappings":"0OAsBO,SAASA,CAAAA,EAAuB,CACrC,IAAMC,CAAAA,CAAUC,UAAAA,EAAW,CAErBC,CAAAA,CAAwBC,CAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,YAAY,CAAA,CAC9EC,CAAAA,CAAqBF,CAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,kBAAkB,CAAA,CACjFE,CAAAA,CAAwBH,CAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,qBAAqB,CAAA,CACvFG,CAAAA,CAAaJ,CAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,UAAU,CAAA,CAGvE,OAAAI,SAAAA,CAAU,IAAM,CACd,GAAIN,CAAAA,EAAyBO,wBAAAA,CAAyBP,CAAAA,CAAsB,UAAU,CAAA,GAAMQ,YAAAA,CAAa,OAAQ,CAC/G,IAAMC,CAAAA,CAAeX,CAAAA,CAAQ,MAAA,CAC1BY,CAAAA,EACCC,8BAAAA,CAA+BH,YAAAA,CAAa,MAAA,CAAQI,gBAAAA,CAAiBF,CAAAA,CAAE,IAAI,CAAC,CAAA,GAC5EV,CAAAA,CAAsB,UAC1B,CAAA,CAAE,CAAC,CAAA,CAEEI,CAAAA,EAGHD,CAAAA,CAAmB,CAEjB,OAAA,CAASM,CAAAA,EAAc,QAAA,CAAS,CAAC,CAAA,EAAG,OAAA,CAEpC,WAAA,CAAaA,CAAAA,EAAc,SAAS,MAAA,CAAS,CAAA,CAG7C,gBAAA,CAAkBA,CAAAA,EAAc,QAAA,CAAS,CAAC,CAAA,CAC1C,eAAA,CAAiBA,CACnB,CAAC,CAAA,CAECA,CAAAA,EAAc,QAAA,CAAS,MAAA,GAAW,CAAA,EAEpCJ,CAAAA,GAEJ,CAEF,CAAA,CAAG,CAACL,CAAAA,EAAuB,UAAA,CAAYF,CAAAA,CAASM,CAAAA,CAAuBD,CAAAA,CAAoBE,CAAU,CAAC,CAAA,CAG/F,IACT","file":"index.js","sourcesContent":["import {\n formatWalletName,\n getAdapterFromWalletType,\n getWalletTypeFromConnectorName,\n OrbitAdapter,\n} from '@tuwaio/orbit-core';\nimport { useWallets } from '@wallet-standard/react';\nimport { useEffect } from 'react';\n\nimport { useSatelliteConnectStore } from '../index';\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 const wallets = useWallets();\n\n const activeWalletFromStore = useSatelliteConnectStore((store) => store.activeWallet);\n const updateActiveWallet = useSatelliteConnectStore((store) => store.updateActiveWallet);\n const walletConnectionError = useSatelliteConnectStore((store) => store.walletConnectionError);\n const disconnect = useSatelliteConnectStore((store) => store.disconnect);\n\n // Watch for changes in connected wallets\n useEffect(() => {\n if (activeWalletFromStore && getAdapterFromWalletType(activeWalletFromStore.walletType) === OrbitAdapter.SOLANA) {\n const activeWallet = wallets.filter(\n (w) =>\n getWalletTypeFromConnectorName(OrbitAdapter.SOLANA, formatWalletName(w.name)) ===\n activeWalletFromStore.walletType,\n )[0];\n\n if (!walletConnectionError) {\n // Update the Satellite store with the active wallet information\n\n updateActiveWallet({\n // Use the first account's address\n address: activeWallet?.accounts[0]?.address,\n // Set connection status\n isConnected: activeWallet?.accounts.length > 0,\n // Store Wallet Standard specific information\n // @ts-expect-error - wallet type is not set fully on the package level\n connectedAccount: activeWallet?.accounts[0],\n connectedWallet: activeWallet,\n });\n }\n if (activeWallet?.accounts.length === 0) {\n // If the wallet is disconnected from the wallet provider, disconnect from Satellite store as well\n disconnect();\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeWalletFromStore?.walletType, wallets, walletConnectionError, updateActiveWallet, disconnect]); // Re-run effect when wallets array changes\n\n // This is a headless component, so return null\n return null;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuwaio/satellite-react",
|
|
3
|
-
"version": "1.0.0-fix-
|
|
3
|
+
"version": "1.0.0-fix-watchers-alpha.1.39245f5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Oleksandr Tkach",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -136,9 +136,9 @@
|
|
|
136
136
|
"viem": "^2.38.3",
|
|
137
137
|
"typescript": "^5.9.3",
|
|
138
138
|
"zustand": "^5.0.8",
|
|
139
|
-
"@tuwaio/satellite-
|
|
140
|
-
"@tuwaio/satellite-
|
|
141
|
-
"@tuwaio/satellite-
|
|
139
|
+
"@tuwaio/satellite-core": "^1.0.0-fix-watchers-alpha.1.39245f5",
|
|
140
|
+
"@tuwaio/satellite-evm": "^1.0.0-fix-watchers-alpha.1.39245f5",
|
|
141
|
+
"@tuwaio/satellite-solana": "^1.0.0-fix-watchers-alpha.1.39245f5"
|
|
142
142
|
},
|
|
143
143
|
"scripts": {
|
|
144
144
|
"start": "tsup src/index.ts --watch",
|