@tuwaio/satellite-react 1.0.0-fix-adapters-independ-alpha.11.e869dab → 1.0.0-fix-optimization-alpha.1.d6a8b2d
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-AGENCROO.cjs → chunk-763QNVVF.cjs} +1 -2
- package/dist/{chunk-U2ZTZ52J.js → chunk-SBMWAROJ.js} +1 -2
- package/dist/{chunk-MTPOFZGM.cjs → chunk-SIMQ7Q3E.cjs} +1 -2
- package/dist/{chunk-P73K26ND.js → chunk-VT4KHGC6.js} +1 -2
- package/dist/evm/index.cjs +1 -2
- package/dist/evm/index.js +1 -2
- package/dist/index.cjs +1 -2
- package/dist/index.js +1 -2
- package/dist/solana/index.cjs +1 -2
- package/dist/solana/index.js +1 -2
- package/package.json +13 -13
- package/dist/chunk-AGENCROO.cjs.map +0 -1
- package/dist/chunk-MTPOFZGM.cjs.map +0 -1
- package/dist/chunk-P73K26ND.js.map +0 -1
- package/dist/chunk-U2ZTZ52J.js.map +0 -1
- package/dist/evm/index.cjs.map +0 -1
- package/dist/evm/index.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/solana/index.cjs.map +0 -1
- package/dist/solana/index.js.map +0 -1
|
@@ -1,2 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
//# sourceMappingURL=chunk-AGENCROO.cjs.map
|
|
1
|
+
'use strict';var chunkSIMQ7Q3E_cjs=require('./chunk-SIMQ7Q3E.cjs'),react=require('react'),satelliteCore=require('@tuwaio/satellite-core'),jsxRuntime=require('react/jsx-runtime');var i=({initializeAutoConnect:e,onError:t})=>{react.useEffect(()=>{(async()=>{try{await e();}catch(o){(t??(a=>console.error("Failed to initialize auto connect:",a)))(o);}})();},[]);};function v({children:e,autoConnect:t,...r}){let o=react.useMemo(()=>satelliteCore.createSatelliteConnectStore({...r}),[]);return i({initializeAutoConnect:()=>o.getState().initializeAutoConnect(t??!1)}),jsxRuntime.jsx(chunkSIMQ7Q3E_cjs.a.Provider,{value:o,children:e})}exports.a=i;exports.b=v;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-U2ZTZ52J.js.map
|
|
1
|
+
import {a}from'./chunk-VT4KHGC6.js';import {useEffect,useMemo}from'react';import {createSatelliteConnectStore}from'@tuwaio/satellite-core';import {jsx}from'react/jsx-runtime';var i=({initializeAutoConnect:e,onError:t})=>{useEffect(()=>{(async()=>{try{await e();}catch(o){(t??(a=>console.error("Failed to initialize auto connect:",a)))(o);}})();},[]);};function v({children:e,autoConnect:t,...r}){let o=useMemo(()=>createSatelliteConnectStore({...r}),[]);return i({initializeAutoConnect:()=>o.getState().initializeAutoConnect(t??!1)}),jsx(a.Provider,{value:o,children:e})}export{i as a,v as b};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
'use strict';var react=require('react'),zustand=require('zustand');var i=react.createContext(null),C=e=>{let t=react.useContext(i);if(!t)throw new Error("useSatelliteConnectStore must be used within a SatelliteConnectProvider");return zustand.useStore(t,e)};exports.a=i;exports.b=C
|
|
2
|
-
//# sourceMappingURL=chunk-MTPOFZGM.cjs.map
|
|
1
|
+
'use strict';var react=require('react'),zustand=require('zustand');var i=react.createContext(null),C=e=>{let t=react.useContext(i);if(!t)throw new Error("useSatelliteConnectStore must be used within a SatelliteConnectProvider");return zustand.useStore(t,e)};exports.a=i;exports.b=C;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import {createContext,useContext}from'react';import {useStore}from'zustand';var i=createContext(null),C=e=>{let t=useContext(i);if(!t)throw new Error("useSatelliteConnectStore must be used within a SatelliteConnectProvider");return useStore(t,e)};export{i as a,C as b}
|
|
2
|
-
//# sourceMappingURL=chunk-P73K26ND.js.map
|
|
1
|
+
import {createContext,useContext}from'react';import {useStore}from'zustand';var i=createContext(null),C=e=>{let t=useContext(i);if(!t)throw new Error("useSatelliteConnectStore must be used within a SatelliteConnectProvider");return useStore(t,e)};export{i as a,C as b};
|
package/dist/evm/index.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
'use strict';require('../chunk-
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
'use strict';require('../chunk-763QNVVF.cjs');var chunkSIMQ7Q3E_cjs=require('../chunk-SIMQ7Q3E.cjs'),react=require('react'),jsxRuntime=require('react/jsx-runtime');function w(t){let[r,f]=react.useState(null);return react.useEffect(()=>{(async()=>{try{let n=!1,a=null;try{let[c]=await Promise.all([import('@tuwaio/satellite-evm'),import('@wagmi/core'),import('viem')]);a=c.createEVMConnectionsWatcher,n=!0;}catch{n=!1;}if(n){let c=()=>{let i=chunkSIMQ7Q3E_cjs.b(e=>e.activeConnection),l=chunkSIMQ7Q3E_cjs.b(e=>e.disconnect),s=chunkSIMQ7Q3E_cjs.b(e=>e.connectionError),C=chunkSIMQ7Q3E_cjs.b(e=>e.updateActiveConnection);return react.useEffect(()=>a({wagmiConfig:t.wagmiConfig,siwe:t.siwe},{activeConnection:i,disconnect:l,connectionError:s,updateActiveConnection:C}),[i?.connectorType,t.siwe,s,t.wagmiConfig,l,C]),null};f(()=>c);}}catch(n){console.warn("Failed to load EVM watcher:",n);}})();},[]),r?jsxRuntime.jsx(r,{...t}):null}exports.EVMConnectorsWatcher=w;
|
package/dist/evm/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import'../chunk-
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import'../chunk-SBMWAROJ.js';import {b}from'../chunk-VT4KHGC6.js';import {useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';function w(t){let[r,f]=useState(null);return useEffect(()=>{(async()=>{try{let n=!1,a=null;try{let[c]=await Promise.all([import('@tuwaio/satellite-evm'),import('@wagmi/core'),import('viem')]);a=c.createEVMConnectionsWatcher,n=!0;}catch{n=!1;}if(n){let c=()=>{let i=b(e=>e.activeConnection),l=b(e=>e.disconnect),s=b(e=>e.connectionError),C=b(e=>e.updateActiveConnection);return useEffect(()=>a({wagmiConfig:t.wagmiConfig,siwe:t.siwe},{activeConnection:i,disconnect:l,connectionError:s,updateActiveConnection:C}),[i?.connectorType,t.siwe,s,t.wagmiConfig,l,C]),null};f(()=>c);}}catch(n){console.warn("Failed to load EVM watcher:",n);}})();},[]),r?jsx(r,{...t}):null}export{w as EVMConnectorsWatcher};
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
'use strict';var chunk763QNVVF_cjs=require('./chunk-763QNVVF.cjs'),chunkSIMQ7Q3E_cjs=require('./chunk-SIMQ7Q3E.cjs');Object.defineProperty(exports,"SatelliteConnectProvider",{enumerable:true,get:function(){return chunk763QNVVF_cjs.b}});Object.defineProperty(exports,"useInitializeAutoConnect",{enumerable:true,get:function(){return chunk763QNVVF_cjs.a}});Object.defineProperty(exports,"SatelliteStoreContext",{enumerable:true,get:function(){return chunkSIMQ7Q3E_cjs.a}});Object.defineProperty(exports,"useSatelliteConnectStore",{enumerable:true,get:function(){return chunkSIMQ7Q3E_cjs.b}});
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export{b as SatelliteConnectProvider,a as useInitializeAutoConnect}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export{b as SatelliteConnectProvider,a as useInitializeAutoConnect}from'./chunk-SBMWAROJ.js';export{a as SatelliteStoreContext,b as useSatelliteConnectStore}from'./chunk-VT4KHGC6.js';
|
package/dist/solana/index.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
'use strict';var chunkSIMQ7Q3E_cjs=require('../chunk-SIMQ7Q3E.cjs'),react=require('react'),jsxRuntime=require('react/jsx-runtime');function W(){let[c,m]=react.useState(null);return react.useEffect(()=>{(async()=>{try{let n=!1,r=null,l=null;try{let[a,o]=await Promise.all([import('@tuwaio/satellite-solana'),import('@wallet-standard/react')]);r=a.createSolanaConnectionsWatcher,l=o.useWallets,n=!0;}catch{n=!1;}if(n){let a=()=>{let o=l(),i=chunkSIMQ7Q3E_cjs.b(t=>t.activeConnection),s=chunkSIMQ7Q3E_cjs.b(t=>t.updateActiveConnection),u=chunkSIMQ7Q3E_cjs.b(t=>t.connectionError),p=chunkSIMQ7Q3E_cjs.b(t=>t.disconnect);return react.useEffect(()=>r({wallets:o},{activeConnection:i,disconnect:p,connectionError:u,updateActiveConnection:s}),[i?.connectorType,o,u,s,p]),null};m(()=>a);}}catch(n){console.warn("Failed to load Solana watcher:",n);}})();},[]),c?jsxRuntime.jsx(c,{}):null}exports.SolanaConnectorsWatcher=W;
|
package/dist/solana/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import {b}from'../chunk-
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import {b}from'../chunk-VT4KHGC6.js';import {useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';function W(){let[c,m]=useState(null);return useEffect(()=>{(async()=>{try{let n=!1,r=null,l=null;try{let[a,o]=await Promise.all([import('@tuwaio/satellite-solana'),import('@wallet-standard/react')]);r=a.createSolanaConnectionsWatcher,l=o.useWallets,n=!0;}catch{n=!1;}if(n){let a=()=>{let o=l(),i=b(t=>t.activeConnection),s=b(t=>t.updateActiveConnection),u=b(t=>t.connectionError),p=b(t=>t.disconnect);return useEffect(()=>r({wallets:o},{activeConnection:i,disconnect:p,connectionError:u,updateActiveConnection:s}),[i?.connectorType,o,u,s,p]),null};m(()=>a);}}catch(n){console.warn("Failed to load Solana watcher:",n);}})();},[]),c?jsx(c,{}):null}export{W as SolanaConnectorsWatcher};
|
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-optimization-alpha.1.d6a8b2d",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Oleksandr Tkach",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
}
|
|
57
57
|
],
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@tuwaio/orbit-core": ">=0.2",
|
|
60
|
-
"@tuwaio/orbit-evm": ">=0.2",
|
|
61
|
-
"@tuwaio/orbit-solana": ">=0.2",
|
|
62
|
-
"@tuwaio/satellite-core": ">=0.2",
|
|
63
|
-
"@tuwaio/satellite-evm": ">=0.2",
|
|
64
|
-
"@tuwaio/satellite-solana": ">=0.2",
|
|
59
|
+
"@tuwaio/orbit-core": ">=0.2.1",
|
|
60
|
+
"@tuwaio/orbit-evm": ">=0.2.3",
|
|
61
|
+
"@tuwaio/orbit-solana": ">=0.2.1",
|
|
62
|
+
"@tuwaio/satellite-core": ">=0.2.1",
|
|
63
|
+
"@tuwaio/satellite-evm": ">=0.2.3",
|
|
64
|
+
"@tuwaio/satellite-solana": ">=0.2.3",
|
|
65
65
|
"@wagmi/core": "3.x.x",
|
|
66
66
|
"viem": "2.x.x",
|
|
67
67
|
"@wallet-standard/react": "1.x.x",
|
|
@@ -113,9 +113,9 @@
|
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
115
|
"@types/react": "^19.2.7",
|
|
116
|
-
"@tuwaio/orbit-core": "
|
|
117
|
-
"@tuwaio/orbit-evm": "
|
|
118
|
-
"@tuwaio/orbit-solana": "
|
|
116
|
+
"@tuwaio/orbit-core": "^0.2.1",
|
|
117
|
+
"@tuwaio/orbit-evm": "^0.2.3",
|
|
118
|
+
"@tuwaio/orbit-solana": "^0.2.1",
|
|
119
119
|
"@wagmi/core": "^3.0.1",
|
|
120
120
|
"@wallet-standard/react": "^1.0.1",
|
|
121
121
|
"@wallet-standard/app": "^1.1.0",
|
|
@@ -131,9 +131,9 @@
|
|
|
131
131
|
"viem": "^2.43.3",
|
|
132
132
|
"typescript": "^5.9.3",
|
|
133
133
|
"zustand": "^5.0.9",
|
|
134
|
-
"@tuwaio/satellite-
|
|
135
|
-
"@tuwaio/satellite-solana": "^1.0.0-fix-
|
|
136
|
-
"@tuwaio/satellite-
|
|
134
|
+
"@tuwaio/satellite-core": "^1.0.0-fix-optimization-alpha.1.d6a8b2d",
|
|
135
|
+
"@tuwaio/satellite-solana": "^1.0.0-fix-optimization-alpha.1.d6a8b2d",
|
|
136
|
+
"@tuwaio/satellite-evm": "^1.0.0-fix-optimization-alpha.1.d6a8b2d"
|
|
137
137
|
},
|
|
138
138
|
"scripts": {
|
|
139
139
|
"start": "tsup src/index.ts --watch",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useInitializeAutoConnect.tsx","../src/providers/SatelliteConnectProvider.tsx"],"names":["useInitializeAutoConnect","initializeAutoConnect","onError","useEffect","error","e","SatelliteConnectProvider","children","autoConnect","parameters","store","useMemo","createSatelliteConnectStore","jsx","SatelliteStoreContext"],"mappings":"kLAyCO,IAAMA,EAA2B,CAAC,CAAE,qBAAA,CAAAC,CAAAA,CAAuB,OAAA,CAAAC,CAAQ,IAAwC,CAChHC,eAAAA,CAAU,IAAM,CAAA,CACqB,SAAY,CAC7C,GAAI,CACF,MAAMF,CAAAA,GACR,CAAA,MAASG,EAAO,CAAA,CAEOF,CAAAA,GAAaG,GAAa,OAAA,CAAQ,KAAA,CAAM,qCAAsCA,CAAC,CAAA,CAAA,EACvFD,CAAc,EAC7B,CACF,CAAA,IAGF,CAAA,CAAG,EAAE,EACP,ECLO,SAASE,CAAAA,CAAyB,CAAE,QAAA,CAAAC,CAAAA,CAAU,WAAA,CAAAC,CAAAA,CAAa,GAAGC,CAAW,EAAkC,CAEhH,IAAMC,EAAQC,aAAAA,CAAQ,IACbC,0CAAmD,CACxD,GAAGH,CACL,CAAC,CAAA,CAEA,EAAE,CAAA,CAEL,OAAAT,EAAyB,CACvB,qBAAA,CAAuB,IAAMU,CAAAA,CAAM,QAAA,EAAS,CAAE,qBAAA,CAAsBF,CAAAA,EAAe,CAAA,CAAK,CAC1F,CAAC,CAAA,CAEMK,eAACC,mBAAAA,CAAsB,QAAA,CAAtB,CAA+B,KAAA,CAAOJ,CAAAA,CAAQ,QAAA,CAAAH,CAAAA,CAAS,CACjE","file":"chunk-AGENCROO.cjs","sourcesContent":["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 connector auto-connection with error handling.\n *\n * @remarks\n * This hook handles the initial connection logic (e.g., checking for a previously\n * connected connector) 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/satelliteHook';\nimport { useInitializeAutoConnect } from '../hooks/useInitializeAutoConnect';\nimport { Connection, Connector } from '../types';\n\n/**\n * Props for SatelliteConnectProvider component\n */\nexport interface SatelliteConnectProviderProps extends SatelliteConnectStoreInitialParameters<Connector, Connection> {\n /** React child components */\n children: React.ReactNode;\n /** Whether to automatically connect to last used connector */\n autoConnect?: boolean;\n}\n\n/**\n * Provider component that manages connector connections and state\n *\n * @remarks\n * This component creates and provides the Satellite Connect store context to its children.\n * It handles connector 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 connector reconnection\n * @param props.adapter - Blockchain adapter(s) for connector 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, Connection>({\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 useInitializeAutoConnect({\n initializeAutoConnect: () => store.getState().initializeAutoConnect(autoConnect ?? false),\n });\n\n return <SatelliteStoreContext.Provider value={store}>{children}</SatelliteStoreContext.Provider>;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/satelliteHook.ts"],"names":["SatelliteStoreContext","createContext","useSatelliteConnectStore","selector","store","useContext","useStore"],"mappings":"uEAUaA,CAAAA,CAAwBC,mBAAAA,CACnC,IACF,CAAA,CAqBaC,EACXC,CAAAA,EACM,CAEN,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","file":"chunk-MTPOFZGM.cjs","sourcesContent":["import { ISatelliteConnectStore } from '@tuwaio/satellite-core';\nimport { createContext, useContext } from 'react';\nimport { StoreApi, useStore } from 'zustand';\n\nimport { Connection, Connector } 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, Connection>> | null>(\n null,\n);\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 connection\n * const activeConnection = useSatelliteConnectStore((state) => state.activeConnection);\n * ```\n */\nexport const useSatelliteConnectStore = <T>(\n selector: (state: ISatelliteConnectStore<Connector, Connection>) => T,\n): 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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/satelliteHook.ts"],"names":["SatelliteStoreContext","createContext","useSatelliteConnectStore","selector","store","useContext","useStore"],"mappings":"gFAUaA,CAAAA,CAAwBC,aAAAA,CACnC,IACF,CAAA,CAqBaC,EACXC,CAAAA,EACM,CAEN,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","file":"chunk-P73K26ND.js","sourcesContent":["import { ISatelliteConnectStore } from '@tuwaio/satellite-core';\nimport { createContext, useContext } from 'react';\nimport { StoreApi, useStore } from 'zustand';\n\nimport { Connection, Connector } 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, Connection>> | null>(\n null,\n);\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 connection\n * const activeConnection = useSatelliteConnectStore((state) => state.activeConnection);\n * ```\n */\nexport const useSatelliteConnectStore = <T>(\n selector: (state: ISatelliteConnectStore<Connector, Connection>) => T,\n): 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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useInitializeAutoConnect.tsx","../src/providers/SatelliteConnectProvider.tsx"],"names":["useInitializeAutoConnect","initializeAutoConnect","onError","useEffect","error","e","SatelliteConnectProvider","children","autoConnect","parameters","store","useMemo","createSatelliteConnectStore","jsx","SatelliteStoreContext"],"mappings":"+KAyCO,IAAMA,EAA2B,CAAC,CAAE,qBAAA,CAAAC,CAAAA,CAAuB,OAAA,CAAAC,CAAQ,IAAwC,CAChHC,SAAAA,CAAU,IAAM,CAAA,CACqB,SAAY,CAC7C,GAAI,CACF,MAAMF,CAAAA,GACR,CAAA,MAASG,EAAO,CAAA,CAEOF,CAAAA,GAAaG,GAAa,OAAA,CAAQ,KAAA,CAAM,qCAAsCA,CAAC,CAAA,CAAA,EACvFD,CAAc,EAC7B,CACF,CAAA,IAGF,CAAA,CAAG,EAAE,EACP,ECLO,SAASE,CAAAA,CAAyB,CAAE,QAAA,CAAAC,CAAAA,CAAU,WAAA,CAAAC,CAAAA,CAAa,GAAGC,CAAW,EAAkC,CAEhH,IAAMC,EAAQC,OAAAA,CAAQ,IACbC,4BAAmD,CACxD,GAAGH,CACL,CAAC,CAAA,CAEA,EAAE,CAAA,CAEL,OAAAT,EAAyB,CACvB,qBAAA,CAAuB,IAAMU,CAAAA,CAAM,QAAA,EAAS,CAAE,qBAAA,CAAsBF,CAAAA,EAAe,CAAA,CAAK,CAC1F,CAAC,CAAA,CAEMK,IAACC,CAAAA,CAAsB,QAAA,CAAtB,CAA+B,KAAA,CAAOJ,CAAAA,CAAQ,QAAA,CAAAH,CAAAA,CAAS,CACjE","file":"chunk-U2ZTZ52J.js","sourcesContent":["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 connector auto-connection with error handling.\n *\n * @remarks\n * This hook handles the initial connection logic (e.g., checking for a previously\n * connected connector) 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/satelliteHook';\nimport { useInitializeAutoConnect } from '../hooks/useInitializeAutoConnect';\nimport { Connection, Connector } from '../types';\n\n/**\n * Props for SatelliteConnectProvider component\n */\nexport interface SatelliteConnectProviderProps extends SatelliteConnectStoreInitialParameters<Connector, Connection> {\n /** React child components */\n children: React.ReactNode;\n /** Whether to automatically connect to last used connector */\n autoConnect?: boolean;\n}\n\n/**\n * Provider component that manages connector connections and state\n *\n * @remarks\n * This component creates and provides the Satellite Connect store context to its children.\n * It handles connector 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 connector reconnection\n * @param props.adapter - Blockchain adapter(s) for connector 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, Connection>({\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 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.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/evm/EVMConnectorsWatcher.tsx"],"names":["EVMConnectorsWatcher","props","WatcherComponent","setWatcherComponent","useState","useEffect","hasDependencies","createEVMConnectionsWatcher","satelliteEVM","Watcher","activeConnection","useSatelliteConnectStore","store","disconnect","connectionError","updateActiveConnection","error","jsx"],"mappings":"oKA0CO,SAASA,CAAAA,CAAqBC,EAAkC,CACrE,GAAM,CAACC,CAAAA,CAAkBC,CAAmB,CAAA,CAAIC,cAAAA,CAAgE,IAAI,CAAA,CA0DpH,OAvDAC,eAAAA,CAAU,IAAM,CAAA,CACM,SAAY,CAC9B,GAAI,CACF,IAAIC,CAAAA,CAAkB,GAClBC,CAAAA,CAAmC,IAAA,CAGvC,GAAI,CACF,GAAM,CAACC,CAAY,CAAA,CAAI,MAAM,OAAA,CAAQ,IAAI,CACvC,OAAO,uBAAuB,CAAA,CAC9B,OAAO,aAAa,CAAA,CACpB,OAAO,MAAM,CACf,CAAC,CAAA,CACDD,CAAAA,CAA8BC,CAAAA,CAAa,4BAC3CF,CAAAA,CAAkB,CAAA,EACpB,CAAA,KAAQ,CACNA,EAAkB,CAAA,EACpB,CAEA,GAAIA,CAAAA,CAAiB,CACnB,IAAMG,CAAAA,CAAU,IAAM,CACpB,IAAMC,CAAAA,CAAmBC,mBAAAA,CAA0BC,GAAUA,CAAAA,CAAM,gBAAgB,EAC7EC,CAAAA,CAAaF,mBAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,UAAU,CAAA,CACjEE,CAAAA,CAAkBH,mBAAAA,CAA0BC,CAAAA,EAAUA,EAAM,eAAe,CAAA,CAC3EG,CAAAA,CAAyBJ,mBAAAA,CAA0BC,GAAUA,CAAAA,CAAM,sBAAsB,CAAA,CAE/F,OAAAP,gBAAU,IACQE,CAAAA,CACd,CAAE,WAAA,CAAaN,EAAM,WAAA,CAAa,IAAA,CAAMA,CAAAA,CAAM,IAAK,EACnD,CAAE,gBAAA,CAAAS,CAAAA,CAAkB,UAAA,CAAAG,EAAY,eAAA,CAAAC,CAAAA,CAAiB,uBAAAC,CAAuB,CAC1E,EAIC,CACDL,CAAAA,EAAkB,aAAA,CAClBT,CAAAA,CAAM,KACNa,CAAAA,CACAb,CAAAA,CAAM,WAAA,CACNY,CAAAA,CACAE,CACF,CAAC,CAAA,CACM,IACT,CAAA,CACAZ,EAAoB,IAAMM,CAAO,EACnC,CACF,OAASO,CAAAA,CAAO,CACd,OAAA,CAAQ,IAAA,CAAK,8BAA+BA,CAAK,EACnD,CACF,CAAA,IAGF,CAAA,CAAG,EAAE,CAAA,CAGDd,EACKe,cAAAA,CAACf,CAAAA,CAAA,CAAkB,GAAGD,CAAAA,CAAO,EAI/B,IACT","file":"index.cjs","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { useSatelliteConnectStore } from '../index';\n\n/**\n * Props for the {@link EVMConnectorsWatcher} component.\n */\nexport interface EVMConnectorsWatcherProps {\n /**\n * The configuration object from `@wagmi/core`.\n * This is required to initialize the account watcher.\n */\n wagmiConfig: any; // Using 'any' to avoid direct import of @wagmi/core types\n\n /**\n * Optional object representing the Sign-In With Ethereum (SIWE) state.\n * If provided, the watcher will use this state to manage updates\n * and disconnections based on SIWE status.\n */\n siwe?: {\n /**\n * Flag indicating if the SIWE authentication request was rejected by the user.\n */\n isRejected: boolean;\n /**\n * Flag indicating if the user is successfully signed in via SIWE.\n */\n isSignedIn: boolean;\n /**\n * Flag indicating if the SIWE flow is enabled.\n */\n enabled?: boolean;\n };\n}\n\n/**\n * A dynamic version of the EVMConnectorsWatcher component that avoids static imports.\n * This component dynamically imports the dependencies only when they are available.\n *\n * @param props - The component's props. See {@link EVMConnectorsWatcherProps} for details.\n * @returns {null} This component does not render any UI.\n */\nexport function EVMConnectorsWatcher(props: EVMConnectorsWatcherProps) {\n const [WatcherComponent, setWatcherComponent] = useState<React.ComponentType<EVMConnectorsWatcherProps> | null>(null);\n\n // Load the actual watcher component dynamically\n useEffect(() => {\n const loadWatcher = async () => {\n try {\n let hasDependencies = false;\n let createEVMConnectionsWatcher: any = null;\n\n // Use dynamic imports\n try {\n const [satelliteEVM] = await Promise.all([\n import('@tuwaio/satellite-evm'),\n import('@wagmi/core'),\n import('viem'),\n ]);\n createEVMConnectionsWatcher = satelliteEVM.createEVMConnectionsWatcher;\n hasDependencies = true;\n } catch {\n hasDependencies = false;\n }\n\n if (hasDependencies) {\n const Watcher = () => {\n const activeConnection = useSatelliteConnectStore((store) => store.activeConnection);\n const disconnect = useSatelliteConnectStore((store) => store.disconnect);\n const connectionError = useSatelliteConnectStore((store) => store.connectionError);\n const updateActiveConnection = useSatelliteConnectStore((store) => store.updateActiveConnection);\n\n useEffect(() => {\n const unwatch = createEVMConnectionsWatcher(\n { wagmiConfig: props.wagmiConfig, siwe: props.siwe },\n { activeConnection, disconnect, connectionError, updateActiveConnection },\n );\n\n return unwatch;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n activeConnection?.connectorType,\n props.siwe,\n connectionError,\n props.wagmiConfig,\n disconnect,\n updateActiveConnection,\n ]);\n return null;\n };\n setWatcherComponent(() => Watcher);\n }\n } catch (error) {\n console.warn('Failed to load EVM watcher:', error);\n }\n };\n\n loadWatcher();\n }, []);\n\n // Render the actual watcher if it's loaded\n if (WatcherComponent) {\n return <WatcherComponent {...props} />;\n }\n\n // This is a headless component, so return null\n return null;\n}\n"]}
|
package/dist/evm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/evm/EVMConnectorsWatcher.tsx"],"names":["EVMConnectorsWatcher","props","WatcherComponent","setWatcherComponent","useState","useEffect","hasDependencies","createEVMConnectionsWatcher","satelliteEVM","Watcher","activeConnection","useSatelliteConnectStore","store","disconnect","connectionError","updateActiveConnection","error","jsx"],"mappings":"6IA0CO,SAASA,CAAAA,CAAqBC,EAAkC,CACrE,GAAM,CAACC,CAAAA,CAAkBC,CAAmB,CAAA,CAAIC,QAAAA,CAAgE,IAAI,CAAA,CA0DpH,OAvDAC,SAAAA,CAAU,IAAM,CAAA,CACM,SAAY,CAC9B,GAAI,CACF,IAAIC,CAAAA,CAAkB,GAClBC,CAAAA,CAAmC,IAAA,CAGvC,GAAI,CACF,GAAM,CAACC,CAAY,CAAA,CAAI,MAAM,OAAA,CAAQ,IAAI,CACvC,OAAO,uBAAuB,CAAA,CAC9B,OAAO,aAAa,CAAA,CACpB,OAAO,MAAM,CACf,CAAC,CAAA,CACDD,CAAAA,CAA8BC,CAAAA,CAAa,4BAC3CF,CAAAA,CAAkB,CAAA,EACpB,CAAA,KAAQ,CACNA,EAAkB,CAAA,EACpB,CAEA,GAAIA,CAAAA,CAAiB,CACnB,IAAMG,CAAAA,CAAU,IAAM,CACpB,IAAMC,CAAAA,CAAmBC,CAAAA,CAA0BC,GAAUA,CAAAA,CAAM,gBAAgB,EAC7EC,CAAAA,CAAaF,CAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,UAAU,CAAA,CACjEE,CAAAA,CAAkBH,CAAAA,CAA0BC,CAAAA,EAAUA,EAAM,eAAe,CAAA,CAC3EG,CAAAA,CAAyBJ,CAAAA,CAA0BC,GAAUA,CAAAA,CAAM,sBAAsB,CAAA,CAE/F,OAAAP,UAAU,IACQE,CAAAA,CACd,CAAE,WAAA,CAAaN,EAAM,WAAA,CAAa,IAAA,CAAMA,CAAAA,CAAM,IAAK,EACnD,CAAE,gBAAA,CAAAS,CAAAA,CAAkB,UAAA,CAAAG,EAAY,eAAA,CAAAC,CAAAA,CAAiB,uBAAAC,CAAuB,CAC1E,EAIC,CACDL,CAAAA,EAAkB,aAAA,CAClBT,CAAAA,CAAM,KACNa,CAAAA,CACAb,CAAAA,CAAM,WAAA,CACNY,CAAAA,CACAE,CACF,CAAC,CAAA,CACM,IACT,CAAA,CACAZ,EAAoB,IAAMM,CAAO,EACnC,CACF,OAASO,CAAAA,CAAO,CACd,OAAA,CAAQ,IAAA,CAAK,8BAA+BA,CAAK,EACnD,CACF,CAAA,IAGF,CAAA,CAAG,EAAE,CAAA,CAGDd,EACKe,GAAAA,CAACf,CAAAA,CAAA,CAAkB,GAAGD,CAAAA,CAAO,EAI/B,IACT","file":"index.js","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { useSatelliteConnectStore } from '../index';\n\n/**\n * Props for the {@link EVMConnectorsWatcher} component.\n */\nexport interface EVMConnectorsWatcherProps {\n /**\n * The configuration object from `@wagmi/core`.\n * This is required to initialize the account watcher.\n */\n wagmiConfig: any; // Using 'any' to avoid direct import of @wagmi/core types\n\n /**\n * Optional object representing the Sign-In With Ethereum (SIWE) state.\n * If provided, the watcher will use this state to manage updates\n * and disconnections based on SIWE status.\n */\n siwe?: {\n /**\n * Flag indicating if the SIWE authentication request was rejected by the user.\n */\n isRejected: boolean;\n /**\n * Flag indicating if the user is successfully signed in via SIWE.\n */\n isSignedIn: boolean;\n /**\n * Flag indicating if the SIWE flow is enabled.\n */\n enabled?: boolean;\n };\n}\n\n/**\n * A dynamic version of the EVMConnectorsWatcher component that avoids static imports.\n * This component dynamically imports the dependencies only when they are available.\n *\n * @param props - The component's props. See {@link EVMConnectorsWatcherProps} for details.\n * @returns {null} This component does not render any UI.\n */\nexport function EVMConnectorsWatcher(props: EVMConnectorsWatcherProps) {\n const [WatcherComponent, setWatcherComponent] = useState<React.ComponentType<EVMConnectorsWatcherProps> | null>(null);\n\n // Load the actual watcher component dynamically\n useEffect(() => {\n const loadWatcher = async () => {\n try {\n let hasDependencies = false;\n let createEVMConnectionsWatcher: any = null;\n\n // Use dynamic imports\n try {\n const [satelliteEVM] = await Promise.all([\n import('@tuwaio/satellite-evm'),\n import('@wagmi/core'),\n import('viem'),\n ]);\n createEVMConnectionsWatcher = satelliteEVM.createEVMConnectionsWatcher;\n hasDependencies = true;\n } catch {\n hasDependencies = false;\n }\n\n if (hasDependencies) {\n const Watcher = () => {\n const activeConnection = useSatelliteConnectStore((store) => store.activeConnection);\n const disconnect = useSatelliteConnectStore((store) => store.disconnect);\n const connectionError = useSatelliteConnectStore((store) => store.connectionError);\n const updateActiveConnection = useSatelliteConnectStore((store) => store.updateActiveConnection);\n\n useEffect(() => {\n const unwatch = createEVMConnectionsWatcher(\n { wagmiConfig: props.wagmiConfig, siwe: props.siwe },\n { activeConnection, disconnect, connectionError, updateActiveConnection },\n );\n\n return unwatch;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n activeConnection?.connectorType,\n props.siwe,\n connectionError,\n props.wagmiConfig,\n disconnect,\n updateActiveConnection,\n ]);\n return null;\n };\n setWatcherComponent(() => Watcher);\n }\n } catch (error) {\n console.warn('Failed to load EVM watcher:', error);\n }\n };\n\n loadWatcher();\n }, []);\n\n // Render the actual watcher if it's loaded\n if (WatcherComponent) {\n return <WatcherComponent {...props} />;\n }\n\n // This is a headless component, so return null\n return null;\n}\n"]}
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/solana/SolanaConnectorsWatcher.tsx"],"names":["SolanaConnectorsWatcher","WatcherComponent","setWatcherComponent","useState","useEffect","hasDependencies","createSolanaConnectionsWatcher","useWallets","satelliteSolana","wallets","Watcher","activeConnection","useSatelliteConnectStore","store","updateActiveConnection","connectionError","disconnect","error","jsx"],"mappings":"mIAUO,SAASA,CAAAA,EAA0B,CACxC,GAAM,CAACC,CAAAA,CAAkBC,CAAmB,EAAIC,cAAAA,CAAqC,IAAI,CAAA,CAkDzF,OA/CAC,gBAAU,IAAM,CAAA,CACM,SAAY,CAC9B,GAAI,CACF,IAAIC,CAAAA,CAAkB,CAAA,CAAA,CAClBC,EAAsC,IAAA,CACtCC,CAAAA,CAAkB,IAAA,CAEtB,GAAI,CACF,GAAM,CAACC,CAAAA,CAAiBC,CAAO,EAAI,MAAM,OAAA,CAAQ,GAAA,CAAI,CACnD,OAAO,0BAA0B,CAAA,CACjC,OAAO,wBAAwB,CACjC,CAAC,CAAA,CACDH,CAAAA,CAAiCE,CAAAA,CAAgB,+BACjDD,CAAAA,CAAaE,CAAAA,CAAQ,UAAA,CACrBJ,CAAAA,CAAkB,GACpB,CAAA,KAAQ,CACNA,CAAAA,CAAkB,CAAA,EACpB,CAEA,GAAIA,CAAAA,CAAiB,CACnB,IAAMK,EAAU,IAAM,CACpB,IAAMD,CAAAA,CAAUF,GAAW,CACrBI,CAAAA,CAAmBC,mBAAAA,CAA0BC,CAAAA,EAAUA,EAAM,gBAAgB,CAAA,CAC7EC,CAAAA,CAAyBF,mBAAAA,CAA0BC,GAAUA,CAAAA,CAAM,sBAAsB,CAAA,CACzFE,CAAAA,CAAkBH,oBAA0BC,CAAAA,EAAUA,CAAAA,CAAM,eAAe,CAAA,CAC3EG,EAAaJ,mBAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,UAAU,EACvE,OAAAT,eAAAA,CAAU,IACQE,CAAAA,CACd,CAAE,OAAA,CAAAG,CAAQ,CAAA,CACV,CAAE,iBAAAE,CAAAA,CAAkB,UAAA,CAAAK,CAAAA,CAAY,eAAA,CAAAD,EAAiB,sBAAA,CAAAD,CAAuB,CAC1E,CAAA,CAGC,CAACH,CAAAA,EAAkB,aAAA,CAAeF,CAAAA,CAASM,CAAAA,CAAiBD,EAAwBE,CAAU,CAAC,CAAA,CAC3F,IACT,EACAd,CAAAA,CAAoB,IAAMQ,CAAO,EACnC,CACF,CAAA,MAASO,CAAAA,CAAO,CACd,OAAA,CAAQ,KAAK,gCAAA,CAAkCA,CAAK,EACtD,CACF,KAGF,CAAA,CAAG,EAAE,EAGDhB,CAAAA,CACKiB,cAAAA,CAACjB,CAAAA,CAAA,EAAiB,EAIpB,IACT","file":"index.cjs","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { useSatelliteConnectStore } from '../hooks/satelliteHook';\n\n/**\n * A dynamic version of the SolanaConnectorsWatcher component that avoids static imports.\n * This component dynamically imports the dependencies only when they are available.\n *\n * @returns null - This is a headless component\n */\nexport function SolanaConnectorsWatcher() {\n const [WatcherComponent, setWatcherComponent] = useState<React.ComponentType | null>(null);\n\n // Load the actual watcher component dynamically\n useEffect(() => {\n const loadWatcher = async () => {\n try {\n let hasDependencies = false;\n let createSolanaConnectionsWatcher: any = null;\n let useWallets: any = null;\n // Use dynamic imports\n try {\n const [satelliteSolana, wallets] = await Promise.all([\n import('@tuwaio/satellite-solana'),\n import('@wallet-standard/react'),\n ]);\n createSolanaConnectionsWatcher = satelliteSolana.createSolanaConnectionsWatcher;\n useWallets = wallets.useWallets;\n hasDependencies = true;\n } catch {\n hasDependencies = false;\n }\n\n if (hasDependencies) {\n const Watcher = () => {\n const wallets = useWallets();\n const activeConnection = useSatelliteConnectStore((store) => store.activeConnection);\n const updateActiveConnection = useSatelliteConnectStore((store) => store.updateActiveConnection);\n const connectionError = useSatelliteConnectStore((store) => store.connectionError);\n const disconnect = useSatelliteConnectStore((store) => store.disconnect);\n useEffect(() => {\n const unwatch = createSolanaConnectionsWatcher(\n { wallets },\n { activeConnection, disconnect, connectionError, updateActiveConnection },\n );\n return unwatch;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeConnection?.connectorType, wallets, connectionError, updateActiveConnection, disconnect]);\n return null;\n };\n setWatcherComponent(() => Watcher);\n }\n } catch (error) {\n console.warn('Failed to load Solana watcher:', error);\n }\n };\n\n loadWatcher();\n }, []);\n\n // Render the actual watcher if it's loaded\n if (WatcherComponent) {\n return <WatcherComponent />;\n }\n\n // This is a headless component, so return null\n return null;\n}\n"]}
|
package/dist/solana/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/solana/SolanaConnectorsWatcher.tsx"],"names":["SolanaConnectorsWatcher","WatcherComponent","setWatcherComponent","useState","useEffect","hasDependencies","createSolanaConnectionsWatcher","useWallets","satelliteSolana","wallets","Watcher","activeConnection","useSatelliteConnectStore","store","updateActiveConnection","connectionError","disconnect","error","jsx"],"mappings":"gHAUO,SAASA,CAAAA,EAA0B,CACxC,GAAM,CAACC,CAAAA,CAAkBC,CAAmB,EAAIC,QAAAA,CAAqC,IAAI,CAAA,CAkDzF,OA/CAC,UAAU,IAAM,CAAA,CACM,SAAY,CAC9B,GAAI,CACF,IAAIC,CAAAA,CAAkB,CAAA,CAAA,CAClBC,EAAsC,IAAA,CACtCC,CAAAA,CAAkB,IAAA,CAEtB,GAAI,CACF,GAAM,CAACC,CAAAA,CAAiBC,CAAO,EAAI,MAAM,OAAA,CAAQ,GAAA,CAAI,CACnD,OAAO,0BAA0B,CAAA,CACjC,OAAO,wBAAwB,CACjC,CAAC,CAAA,CACDH,CAAAA,CAAiCE,CAAAA,CAAgB,+BACjDD,CAAAA,CAAaE,CAAAA,CAAQ,UAAA,CACrBJ,CAAAA,CAAkB,GACpB,CAAA,KAAQ,CACNA,CAAAA,CAAkB,CAAA,EACpB,CAEA,GAAIA,CAAAA,CAAiB,CACnB,IAAMK,EAAU,IAAM,CACpB,IAAMD,CAAAA,CAAUF,GAAW,CACrBI,CAAAA,CAAmBC,CAAAA,CAA0BC,CAAAA,EAAUA,EAAM,gBAAgB,CAAA,CAC7EC,CAAAA,CAAyBF,CAAAA,CAA0BC,GAAUA,CAAAA,CAAM,sBAAsB,CAAA,CACzFE,CAAAA,CAAkBH,EAA0BC,CAAAA,EAAUA,CAAAA,CAAM,eAAe,CAAA,CAC3EG,EAAaJ,CAAAA,CAA0BC,CAAAA,EAAUA,CAAAA,CAAM,UAAU,EACvE,OAAAT,SAAAA,CAAU,IACQE,CAAAA,CACd,CAAE,OAAA,CAAAG,CAAQ,CAAA,CACV,CAAE,iBAAAE,CAAAA,CAAkB,UAAA,CAAAK,CAAAA,CAAY,eAAA,CAAAD,EAAiB,sBAAA,CAAAD,CAAuB,CAC1E,CAAA,CAGC,CAACH,CAAAA,EAAkB,aAAA,CAAeF,CAAAA,CAASM,CAAAA,CAAiBD,EAAwBE,CAAU,CAAC,CAAA,CAC3F,IACT,EACAd,CAAAA,CAAoB,IAAMQ,CAAO,EACnC,CACF,CAAA,MAASO,CAAAA,CAAO,CACd,OAAA,CAAQ,KAAK,gCAAA,CAAkCA,CAAK,EACtD,CACF,KAGF,CAAA,CAAG,EAAE,EAGDhB,CAAAA,CACKiB,GAAAA,CAACjB,CAAAA,CAAA,EAAiB,EAIpB,IACT","file":"index.js","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { useSatelliteConnectStore } from '../hooks/satelliteHook';\n\n/**\n * A dynamic version of the SolanaConnectorsWatcher component that avoids static imports.\n * This component dynamically imports the dependencies only when they are available.\n *\n * @returns null - This is a headless component\n */\nexport function SolanaConnectorsWatcher() {\n const [WatcherComponent, setWatcherComponent] = useState<React.ComponentType | null>(null);\n\n // Load the actual watcher component dynamically\n useEffect(() => {\n const loadWatcher = async () => {\n try {\n let hasDependencies = false;\n let createSolanaConnectionsWatcher: any = null;\n let useWallets: any = null;\n // Use dynamic imports\n try {\n const [satelliteSolana, wallets] = await Promise.all([\n import('@tuwaio/satellite-solana'),\n import('@wallet-standard/react'),\n ]);\n createSolanaConnectionsWatcher = satelliteSolana.createSolanaConnectionsWatcher;\n useWallets = wallets.useWallets;\n hasDependencies = true;\n } catch {\n hasDependencies = false;\n }\n\n if (hasDependencies) {\n const Watcher = () => {\n const wallets = useWallets();\n const activeConnection = useSatelliteConnectStore((store) => store.activeConnection);\n const updateActiveConnection = useSatelliteConnectStore((store) => store.updateActiveConnection);\n const connectionError = useSatelliteConnectStore((store) => store.connectionError);\n const disconnect = useSatelliteConnectStore((store) => store.disconnect);\n useEffect(() => {\n const unwatch = createSolanaConnectionsWatcher(\n { wallets },\n { activeConnection, disconnect, connectionError, updateActiveConnection },\n );\n return unwatch;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeConnection?.connectorType, wallets, connectionError, updateActiveConnection, disconnect]);\n return null;\n };\n setWatcherComponent(() => Watcher);\n }\n } catch (error) {\n console.warn('Failed to load Solana watcher:', error);\n }\n };\n\n loadWatcher();\n }, []);\n\n // Render the actual watcher if it's loaded\n if (WatcherComponent) {\n return <WatcherComponent />;\n }\n\n // This is a headless component, so return null\n return null;\n}\n"]}
|