@tuwaio/satellite-react 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import {createContext,useContext}from'react';import {useStore}from'zustand';var e=Symbol.for("tuwaio.satellite.context"),o=globalThis,a=o[e]||(o[e]=createContext(null)),m=n=>{let t=useContext(a);if(!t)throw new Error("useSatelliteConnectStore must be used within a SatelliteConnectProvider");return useStore(t,n)};export{a,m as b};
@@ -0,0 +1 @@
1
+ 'use strict';var react=require('react'),zustand=require('zustand');var e=Symbol.for("tuwaio.satellite.context"),o=globalThis,a=o[e]||(o[e]=react.createContext(null)),u=n=>{let t=react.useContext(a);if(!t)throw new Error("useSatelliteConnectStore must be used within a SatelliteConnectProvider");return zustand.useStore(t,n)};exports.a=a;exports.b=u;
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-EYVLQZ24.js';import {useEffect,useMemo}from'react';import {createSatelliteConnectStore}from'@tuwaio/satellite-core';import {jsx}from'react/jsx-runtime';var l=({initializeAutoConnect:t,onError:n})=>{useEffect(()=>{(async()=>{try{await t();}catch(o){(n??(a=>console.error("Failed to initialize auto connect:",a)))(o);}})();},[]);};function E({children:t,autoConnect:n,...e}){let o=useMemo(()=>createSatelliteConnectStore({...e}),[]);return useEffect(()=>{o.getState().updateParameters(e);},[e,o]),l({initializeAutoConnect:()=>o.getState().initializeAutoConnect(n??!1)}),jsx(a.Provider,{value:o,children:t})}export{l as a,E as b};
@@ -0,0 +1 @@
1
+ 'use strict';var chunkG2YC6JBO_cjs=require('./chunk-G2YC6JBO.cjs'),react=require('react'),satelliteCore=require('@tuwaio/satellite-core'),jsxRuntime=require('react/jsx-runtime');var c=({initializeAutoConnect:t,onError:n})=>{react.useEffect(()=>{(async()=>{try{await t();}catch(o){(n??(l=>console.error("Failed to initialize auto connect:",l)))(o);}})();},[]);};function y({children:t,autoConnect:n,...e}){let o=react.useMemo(()=>satelliteCore.createSatelliteConnectStore({...e}),[]);return react.useEffect(()=>{o.getState().updateParameters(e);},[e,o]),c({initializeAutoConnect:()=>o.getState().initializeAutoConnect(n??!1)}),jsxRuntime.jsx(chunkG2YC6JBO_cjs.a.Provider,{value:o,children:t})}exports.a=c;exports.b=y;
@@ -1 +1 @@
1
- 'use strict';require('../chunk-PF2SJS7F.cjs');var chunk6DPJBCEF_cjs=require('../chunk-6DPJBCEF.cjs'),react=require('react'),jsxRuntime=require('react/jsx-runtime');function M(t){let[r,w]=react.useState(null);return react.useEffect(()=>{(async()=>{try{let n=!1,i=null;try{let[c]=await Promise.all([import('@tuwaio/satellite-evm'),import('@wagmi/core'),import('viem')]);i=c.createEVMConnectionsWatcher,n=!0;}catch{n=!1;}if(n){let c=()=>{let a=chunk6DPJBCEF_cjs.b(e=>e.activeConnection),l=chunk6DPJBCEF_cjs.b(e=>e.disconnect),s=chunk6DPJBCEF_cjs.b(e=>e.connectionError),C=chunk6DPJBCEF_cjs.b(e=>e.updateActiveConnection);return react.useEffect(()=>i({wagmiConfig:t.wagmiConfig,siwx:t.siwx,siwe:t.siwe},{activeConnection:a,disconnect:l,connectionError:s,updateActiveConnection:C}),[a?.connectorType,t.siwx,t.siwe,s,t.wagmiConfig,l,C]),null};w(()=>c);}}catch(n){console.warn("Failed to load EVM watcher:",n);}})();},[]),r?jsxRuntime.jsx(r,{...t}):null}exports.EVMConnectorsWatcher=M;
1
+ 'use strict';require('../chunk-YTP4ADBV.cjs');var chunkG2YC6JBO_cjs=require('../chunk-G2YC6JBO.cjs'),react=require('react'),jsxRuntime=require('react/jsx-runtime');function M(t){let[r,f]=react.useState(null);return react.useEffect(()=>{(async()=>{try{let n=!1,i=null;try{let[c]=await Promise.all([import('@tuwaio/satellite-evm'),import('@wagmi/core'),import('viem')]);i=c.createEVMConnectionsWatcher,n=!0;}catch{n=!1;}if(n){let c=()=>{let a=chunkG2YC6JBO_cjs.b(e=>e.activeConnection),l=chunkG2YC6JBO_cjs.b(e=>e.disconnect),s=chunkG2YC6JBO_cjs.b(e=>e.connectionError),C=chunkG2YC6JBO_cjs.b(e=>e.updateActiveConnection);return react.useEffect(()=>i({wagmiConfig:t.wagmiConfig,siwx:t.siwx,siwe:t.siwe},{activeConnection:a,disconnect:l,connectionError:s,updateActiveConnection:C}),[a?.connectorType,t.siwx,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=M;
package/dist/evm/index.js CHANGED
@@ -1 +1 @@
1
- import'../chunk-3ZDGAX5W.js';import {b}from'../chunk-H5TQSDNK.js';import {useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';function V(t){let[r,w]=useState(null);return useEffect(()=>{(async()=>{try{let n=!1,i=null;try{let[c]=await Promise.all([import('@tuwaio/satellite-evm'),import('@wagmi/core'),import('viem')]);i=c.createEVMConnectionsWatcher,n=!0;}catch{n=!1;}if(n){let c=()=>{let a=b(e=>e.activeConnection),l=b(e=>e.disconnect),s=b(e=>e.connectionError),C=b(e=>e.updateActiveConnection);return useEffect(()=>i({wagmiConfig:t.wagmiConfig,siwx:t.siwx,siwe:t.siwe},{activeConnection:a,disconnect:l,connectionError:s,updateActiveConnection:C}),[a?.connectorType,t.siwx,t.siwe,s,t.wagmiConfig,l,C]),null};w(()=>c);}}catch(n){console.warn("Failed to load EVM watcher:",n);}})();},[]),r?jsx(r,{...t}):null}export{V as EVMConnectorsWatcher};
1
+ import'../chunk-UDS7MUYZ.js';import {b}from'../chunk-EYVLQZ24.js';import {useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';function V(t){let[r,f]=useState(null);return useEffect(()=>{(async()=>{try{let n=!1,i=null;try{let[c]=await Promise.all([import('@tuwaio/satellite-evm'),import('@wagmi/core'),import('viem')]);i=c.createEVMConnectionsWatcher,n=!0;}catch{n=!1;}if(n){let c=()=>{let a=b(e=>e.activeConnection),l=b(e=>e.disconnect),s=b(e=>e.connectionError),C=b(e=>e.updateActiveConnection);return useEffect(()=>i({wagmiConfig:t.wagmiConfig,siwx:t.siwx,siwe:t.siwe},{activeConnection:a,disconnect:l,connectionError:s,updateActiveConnection:C}),[a?.connectorType,t.siwx,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{V as EVMConnectorsWatcher};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkPF2SJS7F_cjs=require('./chunk-PF2SJS7F.cjs'),chunk6DPJBCEF_cjs=require('./chunk-6DPJBCEF.cjs');Object.defineProperty(exports,"SatelliteConnectProvider",{enumerable:true,get:function(){return chunkPF2SJS7F_cjs.b}});Object.defineProperty(exports,"useInitializeAutoConnect",{enumerable:true,get:function(){return chunkPF2SJS7F_cjs.a}});Object.defineProperty(exports,"SatelliteStoreContext",{enumerable:true,get:function(){return chunk6DPJBCEF_cjs.a}});Object.defineProperty(exports,"useSatelliteConnectStore",{enumerable:true,get:function(){return chunk6DPJBCEF_cjs.b}});
1
+ 'use strict';var chunkYTP4ADBV_cjs=require('./chunk-YTP4ADBV.cjs'),chunkG2YC6JBO_cjs=require('./chunk-G2YC6JBO.cjs');Object.defineProperty(exports,"SatelliteConnectProvider",{enumerable:true,get:function(){return chunkYTP4ADBV_cjs.b}});Object.defineProperty(exports,"useInitializeAutoConnect",{enumerable:true,get:function(){return chunkYTP4ADBV_cjs.a}});Object.defineProperty(exports,"SatelliteStoreContext",{enumerable:true,get:function(){return chunkG2YC6JBO_cjs.a}});Object.defineProperty(exports,"useSatelliteConnectStore",{enumerable:true,get:function(){return chunkG2YC6JBO_cjs.b}});
package/dist/index.d.cts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as react from 'react';
2
- import * as _tuwaio_satellite_core from '@tuwaio/satellite-core';
3
- import { BaseConnector, ISatelliteConnectStore, SatelliteConnectStoreInitialParameters } from '@tuwaio/satellite-core';
2
+ import { ISatelliteConnectStore, SatelliteConnectStoreInitialParameters } from '@tuwaio/satellite-core';
4
3
  import { StoreApi } from 'zustand';
5
4
 
6
5
  /**
@@ -18,23 +17,19 @@ interface AllConnections {
18
17
  */
19
18
  interface AllConnectors {
20
19
  }
21
-
22
20
  /**
23
21
  * Union type for all supported connection types.
24
22
  * It's created from the values of the AllConnections interface.
25
23
  * e.g., { evm: EVMConnection, solana: SolanaConnection } -> EVMConnection | SolanaConnection
26
24
  */
27
- type Connection = [keyof AllConnections] extends [never] ? BaseConnector : AllConnections[keyof AllConnections];
25
+ type Connection = AllConnections[keyof AllConnections];
28
26
  /**
29
27
  * Union type for all supported connector types.
30
28
  */
31
- type Connector = [keyof AllConnectors] extends [never] ? any : AllConnectors[keyof AllConnectors];
29
+ type Connector = AllConnectors[keyof AllConnectors];
32
30
 
33
- /**
34
- * React Context for providing Satellite Connect store throughout the application
35
- * @internal
36
- */
37
- declare const SatelliteStoreContext: react.Context<StoreApi<ISatelliteConnectStore<any, _tuwaio_satellite_core.BaseConnector>> | null>;
31
+ type SatelliteContextType = StoreApi<ISatelliteConnectStore<Connector, Connection>> | null;
32
+ declare const SatelliteStoreContext: react.Context<SatelliteContextType>;
38
33
  /**
39
34
  * Custom hook for accessing the Satellite Connect store state
40
35
  *
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as react from 'react';
2
- import * as _tuwaio_satellite_core from '@tuwaio/satellite-core';
3
- import { BaseConnector, ISatelliteConnectStore, SatelliteConnectStoreInitialParameters } from '@tuwaio/satellite-core';
2
+ import { ISatelliteConnectStore, SatelliteConnectStoreInitialParameters } from '@tuwaio/satellite-core';
4
3
  import { StoreApi } from 'zustand';
5
4
 
6
5
  /**
@@ -18,23 +17,19 @@ interface AllConnections {
18
17
  */
19
18
  interface AllConnectors {
20
19
  }
21
-
22
20
  /**
23
21
  * Union type for all supported connection types.
24
22
  * It's created from the values of the AllConnections interface.
25
23
  * e.g., { evm: EVMConnection, solana: SolanaConnection } -> EVMConnection | SolanaConnection
26
24
  */
27
- type Connection = [keyof AllConnections] extends [never] ? BaseConnector : AllConnections[keyof AllConnections];
25
+ type Connection = AllConnections[keyof AllConnections];
28
26
  /**
29
27
  * Union type for all supported connector types.
30
28
  */
31
- type Connector = [keyof AllConnectors] extends [never] ? any : AllConnectors[keyof AllConnectors];
29
+ type Connector = AllConnectors[keyof AllConnectors];
32
30
 
33
- /**
34
- * React Context for providing Satellite Connect store throughout the application
35
- * @internal
36
- */
37
- declare const SatelliteStoreContext: react.Context<StoreApi<ISatelliteConnectStore<any, _tuwaio_satellite_core.BaseConnector>> | null>;
31
+ type SatelliteContextType = StoreApi<ISatelliteConnectStore<Connector, Connection>> | null;
32
+ declare const SatelliteStoreContext: react.Context<SatelliteContextType>;
38
33
  /**
39
34
  * Custom hook for accessing the Satellite Connect store state
40
35
  *
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{b as SatelliteConnectProvider,a as useInitializeAutoConnect}from'./chunk-3ZDGAX5W.js';export{a as SatelliteStoreContext,b as useSatelliteConnectStore}from'./chunk-H5TQSDNK.js';
1
+ export{b as SatelliteConnectProvider,a as useInitializeAutoConnect}from'./chunk-UDS7MUYZ.js';export{a as SatelliteStoreContext,b as useSatelliteConnectStore}from'./chunk-EYVLQZ24.js';
@@ -1 +1 @@
1
- 'use strict';var chunk6DPJBCEF_cjs=require('../chunk-6DPJBCEF.cjs'),react=require('react'),jsxRuntime=require('react/jsx-runtime');function A(o={}){let[c,h]=react.useState(null);return react.useEffect(()=>{(async()=>{try{let e=!1,l=null,i=null;try{let[r,a]=await Promise.all([import('@tuwaio/satellite-solana'),import('@wallet-standard/react')]);l=r.createSolanaConnectionsWatcher,i=a.useWallets,e=!0;}catch{e=!1;}if(e){let r=()=>{let a=i(),s=chunk6DPJBCEF_cjs.b(t=>t.activeConnection),u=chunk6DPJBCEF_cjs.b(t=>t.updateActiveConnection),S=chunk6DPJBCEF_cjs.b(t=>t.connectionError),p=chunk6DPJBCEF_cjs.b(t=>t.disconnect);return react.useEffect(()=>l({wallets:a,siwx:o.siwx},{activeConnection:s,disconnect:p,connectionError:S,updateActiveConnection:u}),[s?.connectorType,a,o.siwx,S,u,p]),null};h(()=>r);}}catch(e){console.warn("Failed to load Solana watcher:",e);}})();},[o.siwx]),c?jsxRuntime.jsx(c,{...o}):null}exports.SolanaConnectorsWatcher=A;
1
+ 'use strict';var chunkG2YC6JBO_cjs=require('../chunk-G2YC6JBO.cjs'),react=require('react'),jsxRuntime=require('react/jsx-runtime');function x(o={}){let[c,m]=react.useState(null);return react.useEffect(()=>{(async()=>{try{let e=!1,l=null,i=null;try{let[r,a]=await Promise.all([import('@tuwaio/satellite-solana'),import('@wallet-standard/react')]);l=r.createSolanaConnectionsWatcher,i=a.useWallets,e=!0;}catch{e=!1;}if(e){let r=()=>{let a=i(),s=chunkG2YC6JBO_cjs.b(t=>t.activeConnection),p=chunkG2YC6JBO_cjs.b(t=>t.updateActiveConnection),u=chunkG2YC6JBO_cjs.b(t=>t.connectionError),S=chunkG2YC6JBO_cjs.b(t=>t.disconnect);return react.useEffect(()=>l({wallets:a,siwx:o.siwx},{activeConnection:s,disconnect:S,connectionError:u,updateActiveConnection:p}),[s?.connectorType,a,o.siwx,u,p,S]),null};m(()=>r);}}catch(e){console.warn("Failed to load Solana watcher:",e);}})();},[o.siwx]),c?jsxRuntime.jsx(c,{...o}):null}exports.SolanaConnectorsWatcher=x;
@@ -1 +1 @@
1
- import {b}from'../chunk-H5TQSDNK.js';import {useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';function y(o={}){let[c,h]=useState(null);return useEffect(()=>{(async()=>{try{let e=!1,l=null,i=null;try{let[r,a]=await Promise.all([import('@tuwaio/satellite-solana'),import('@wallet-standard/react')]);l=r.createSolanaConnectionsWatcher,i=a.useWallets,e=!0;}catch{e=!1;}if(e){let r=()=>{let a=i(),s=b(t=>t.activeConnection),u=b(t=>t.updateActiveConnection),S=b(t=>t.connectionError),p=b(t=>t.disconnect);return useEffect(()=>l({wallets:a,siwx:o.siwx},{activeConnection:s,disconnect:p,connectionError:S,updateActiveConnection:u}),[s?.connectorType,a,o.siwx,S,u,p]),null};h(()=>r);}}catch(e){console.warn("Failed to load Solana watcher:",e);}})();},[o.siwx]),c?jsx(c,{...o}):null}export{y as SolanaConnectorsWatcher};
1
+ import {b}from'../chunk-EYVLQZ24.js';import {useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';function y(o={}){let[c,m]=useState(null);return useEffect(()=>{(async()=>{try{let e=!1,l=null,i=null;try{let[r,a]=await Promise.all([import('@tuwaio/satellite-solana'),import('@wallet-standard/react')]);l=r.createSolanaConnectionsWatcher,i=a.useWallets,e=!0;}catch{e=!1;}if(e){let r=()=>{let a=i(),s=b(t=>t.activeConnection),p=b(t=>t.updateActiveConnection),u=b(t=>t.connectionError),S=b(t=>t.disconnect);return useEffect(()=>l({wallets:a,siwx:o.siwx},{activeConnection:s,disconnect:S,connectionError:u,updateActiveConnection:p}),[s?.connectorType,a,o.siwx,u,p,S]),null};m(()=>r);}}catch(e){console.warn("Failed to load Solana watcher:",e);}})();},[o.siwx]),c?jsx(c,{...o}):null}export{y as SolanaConnectorsWatcher};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuwaio/satellite-react",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "private": false,
5
5
  "author": "Oleksandr Tkach",
6
6
  "license": "Apache-2.0",
@@ -155,9 +155,9 @@
155
155
  "viem": "^2.55.11",
156
156
  "typescript": "^6.0.3",
157
157
  "zustand": "^5.0.14",
158
- "@tuwaio/satellite-core": "^0.4.1",
159
- "@tuwaio/satellite-solana": "^0.4.1",
160
- "@tuwaio/satellite-evm": "^0.4.1"
158
+ "@tuwaio/satellite-evm": "^0.4.2",
159
+ "@tuwaio/satellite-solana": "^0.4.2",
160
+ "@tuwaio/satellite-core": "^0.4.1"
161
161
  },
162
162
  "scripts": {
163
163
  "start": "tsup src/index.ts --watch",
@@ -1 +0,0 @@
1
- import {a}from'./chunk-H5TQSDNK.js';import {useEffect,useMemo}from'react';import {createSatelliteConnectStore}from'@tuwaio/satellite-core';import {jsx}from'react/jsx-runtime';var l=({initializeAutoConnect:t,onError:n})=>{useEffect(()=>{(async()=>{try{await t();}catch(e){(n??(a=>console.error("Failed to initialize auto connect:",a)))(e);}})();},[]);};function E({children:t,autoConnect:n,...o}){let e=useMemo(()=>createSatelliteConnectStore({...o}),[]);return useEffect(()=>{e.getState().updateParameters(o);},[o,e]),l({initializeAutoConnect:()=>e.getState().initializeAutoConnect(n??!1)}),jsx(a.Provider,{value:e,children:t})}export{l as a,E as b};
@@ -1 +0,0 @@
1
- 'use strict';var react=require('react'),zustand=require('zustand');var i=react.createContext(null),s=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=s;
@@ -1 +0,0 @@
1
- import {createContext,useContext}from'react';import {useStore}from'zustand';var i=createContext(null),a=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,a as b};
@@ -1 +0,0 @@
1
- 'use strict';var chunk6DPJBCEF_cjs=require('./chunk-6DPJBCEF.cjs'),react=require('react'),satelliteCore=require('@tuwaio/satellite-core'),jsxRuntime=require('react/jsx-runtime');var c=({initializeAutoConnect:t,onError:n})=>{react.useEffect(()=>{(async()=>{try{await t();}catch(e){(n??(l=>console.error("Failed to initialize auto connect:",l)))(e);}})();},[]);};function y({children:t,autoConnect:n,...o}){let e=react.useMemo(()=>satelliteCore.createSatelliteConnectStore({...o}),[]);return react.useEffect(()=>{e.getState().updateParameters(o);},[o,e]),c({initializeAutoConnect:()=>e.getState().initializeAutoConnect(n??!1)}),jsxRuntime.jsx(chunk6DPJBCEF_cjs.a.Provider,{value:e,children:t})}exports.a=c;exports.b=y;