@tuwaio/satellite-react 0.3.10 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 'use strict';require('../chunk-ALI6B44Y.cjs');var chunk6DPJBCEF_cjs=require('../chunk-6DPJBCEF.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,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=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(()=>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=M;
1
+ 'use strict';require('../chunk-ALI6B44Y.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,6 +1,7 @@
1
1
  import { OrbitAdapter } from '@tuwaio/orbit-core';
2
2
  import { EVMConnection, ConnectorEVM } from '@tuwaio/satellite-evm';
3
3
  import * as react from 'react';
4
+ import { SatelliteSiwxState } from '@tuwaio/satellite-core';
4
5
 
5
6
  /**
6
7
  * Props for the {@link EVMConnectorsWatcher} component.
@@ -12,22 +13,17 @@ interface EVMConnectorsWatcherProps {
12
13
  */
13
14
  wagmiConfig: any;
14
15
  /**
15
- * Optional object representing the Sign-In With Ethereum (SIWE) state.
16
- * If provided, the watcher will use this state to manage updates
17
- * and disconnections based on SIWE status.
16
+ * Optional Sign-In With X (SIWX) session state.
17
+ * If provided, the watcher will manage updates and disconnections based on SIWX status.
18
+ * Directly compatible with `useSiwxSession()` from `@tuwaio/siwx-react`.
19
+ */
20
+ siwx?: SatelliteSiwxState;
21
+ /**
22
+ * @deprecated Legacy SIWE prop alias for backwards compatibility
18
23
  */
19
24
  siwe?: {
20
- /**
21
- * Flag indicating if the SIWE authentication request was rejected by the user.
22
- */
23
- isRejected: boolean;
24
- /**
25
- * Flag indicating if the user is successfully signed in via SIWE.
26
- */
27
- isSignedIn: boolean;
28
- /**
29
- * Flag indicating if the SIWE flow is enabled.
30
- */
25
+ isRejected?: boolean;
26
+ isSignedIn?: boolean;
31
27
  enabled?: boolean;
32
28
  };
33
29
  }
@@ -37,6 +33,21 @@ interface EVMConnectorsWatcherProps {
37
33
  *
38
34
  * @param props - The component's props. See {@link EVMConnectorsWatcherProps} for details.
39
35
  * @returns {null} This component does not render any UI.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * import { useSiwxSession } from '@tuwaio/siwx-react';
40
+ * import { EVMConnectorsWatcher } from '@tuwaio/satellite-react/evm';
41
+ *
42
+ * function WatcherContainer() {
43
+ * const siwxSession = useSiwxSession();
44
+ * return <EVMConnectorsWatcher wagmiConfig={wagmiConfig} siwx={siwxSession} />;
45
+ * }
46
+ * ```
47
+ *
48
+ * @remarks
49
+ * Monitors Wagmi account and network changes. Automatically disconnects wallet state if SIWX
50
+ * session validation fails or is rejected.
40
51
  */
41
52
  declare function EVMConnectorsWatcher(props: EVMConnectorsWatcherProps): react.JSX.Element | null;
42
53
 
@@ -1,6 +1,7 @@
1
1
  import { OrbitAdapter } from '@tuwaio/orbit-core';
2
2
  import { EVMConnection, ConnectorEVM } from '@tuwaio/satellite-evm';
3
3
  import * as react from 'react';
4
+ import { SatelliteSiwxState } from '@tuwaio/satellite-core';
4
5
 
5
6
  /**
6
7
  * Props for the {@link EVMConnectorsWatcher} component.
@@ -12,22 +13,17 @@ interface EVMConnectorsWatcherProps {
12
13
  */
13
14
  wagmiConfig: any;
14
15
  /**
15
- * Optional object representing the Sign-In With Ethereum (SIWE) state.
16
- * If provided, the watcher will use this state to manage updates
17
- * and disconnections based on SIWE status.
16
+ * Optional Sign-In With X (SIWX) session state.
17
+ * If provided, the watcher will manage updates and disconnections based on SIWX status.
18
+ * Directly compatible with `useSiwxSession()` from `@tuwaio/siwx-react`.
19
+ */
20
+ siwx?: SatelliteSiwxState;
21
+ /**
22
+ * @deprecated Legacy SIWE prop alias for backwards compatibility
18
23
  */
19
24
  siwe?: {
20
- /**
21
- * Flag indicating if the SIWE authentication request was rejected by the user.
22
- */
23
- isRejected: boolean;
24
- /**
25
- * Flag indicating if the user is successfully signed in via SIWE.
26
- */
27
- isSignedIn: boolean;
28
- /**
29
- * Flag indicating if the SIWE flow is enabled.
30
- */
25
+ isRejected?: boolean;
26
+ isSignedIn?: boolean;
31
27
  enabled?: boolean;
32
28
  };
33
29
  }
@@ -37,6 +33,21 @@ interface EVMConnectorsWatcherProps {
37
33
  *
38
34
  * @param props - The component's props. See {@link EVMConnectorsWatcherProps} for details.
39
35
  * @returns {null} This component does not render any UI.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * import { useSiwxSession } from '@tuwaio/siwx-react';
40
+ * import { EVMConnectorsWatcher } from '@tuwaio/satellite-react/evm';
41
+ *
42
+ * function WatcherContainer() {
43
+ * const siwxSession = useSiwxSession();
44
+ * return <EVMConnectorsWatcher wagmiConfig={wagmiConfig} siwx={siwxSession} />;
45
+ * }
46
+ * ```
47
+ *
48
+ * @remarks
49
+ * Monitors Wagmi account and network changes. Automatically disconnects wallet state if SIWX
50
+ * session validation fails or is rejected.
40
51
  */
41
52
  declare function EVMConnectorsWatcher(props: EVMConnectorsWatcherProps): react.JSX.Element | null;
42
53
 
package/dist/evm/index.js CHANGED
@@ -1 +1 @@
1
- import'../chunk-O4B7H2P6.js';import {b}from'../chunk-H5TQSDNK.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,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{V as EVMConnectorsWatcher};
1
+ import'../chunk-O4B7H2P6.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 +1 @@
1
- 'use strict';var chunk6DPJBCEF_cjs=require('../chunk-6DPJBCEF.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=chunk6DPJBCEF_cjs.b(t=>t.activeConnection),s=chunk6DPJBCEF_cjs.b(t=>t.updateActiveConnection),u=chunk6DPJBCEF_cjs.b(t=>t.connectionError),p=chunk6DPJBCEF_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;
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,14 +1,42 @@
1
1
  import { OrbitAdapter } from '@tuwaio/orbit-core';
2
2
  import { SolanaConnection, ConnectorSolana } from '@tuwaio/satellite-solana';
3
3
  import * as react from 'react';
4
+ import { SatelliteSiwxState } from '@tuwaio/satellite-core';
4
5
 
6
+ /**
7
+ * Props for the {@link SolanaConnectorsWatcher} component.
8
+ */
9
+ interface SolanaConnectorsWatcherProps {
10
+ /**
11
+ * Optional Sign-In With X (SIWX) session state.
12
+ * If provided, the watcher will manage updates and disconnections based on SIWX status.
13
+ * Directly compatible with `useSiwxSession()` from `@tuwaio/siwx-react`.
14
+ */
15
+ siwx?: SatelliteSiwxState;
16
+ }
5
17
  /**
6
18
  * A dynamic version of the SolanaConnectorsWatcher component that avoids static imports.
7
19
  * This component dynamically imports the dependencies only when they are available.
8
20
  *
21
+ * @param props - Component props containing optional SIWX session state.
9
22
  * @returns null - This is a headless component
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * import { useSiwxSession } from '@tuwaio/siwx-react';
27
+ * import { SolanaConnectorsWatcher } from '@tuwaio/satellite-react/solana';
28
+ *
29
+ * function WatcherContainer() {
30
+ * const siwxSession = useSiwxSession();
31
+ * return <SolanaConnectorsWatcher siwx={siwxSession} />;
32
+ * }
33
+ * ```
34
+ *
35
+ * @remarks
36
+ * Monitors Wallet Standard account changes. Automatically disconnects wallet state if SIWX
37
+ * session validation fails or is rejected.
10
38
  */
11
- declare function SolanaConnectorsWatcher(): react.JSX.Element | null;
39
+ declare function SolanaConnectorsWatcher(props?: SolanaConnectorsWatcherProps): react.JSX.Element | null;
12
40
 
13
41
  declare module '@tuwaio/satellite-react' {
14
42
  interface AllConnections {
@@ -19,4 +47,4 @@ declare module '@tuwaio/satellite-react' {
19
47
  }
20
48
  }
21
49
 
22
- export { SolanaConnectorsWatcher };
50
+ export { SolanaConnectorsWatcher, type SolanaConnectorsWatcherProps };
@@ -1,14 +1,42 @@
1
1
  import { OrbitAdapter } from '@tuwaio/orbit-core';
2
2
  import { SolanaConnection, ConnectorSolana } from '@tuwaio/satellite-solana';
3
3
  import * as react from 'react';
4
+ import { SatelliteSiwxState } from '@tuwaio/satellite-core';
4
5
 
6
+ /**
7
+ * Props for the {@link SolanaConnectorsWatcher} component.
8
+ */
9
+ interface SolanaConnectorsWatcherProps {
10
+ /**
11
+ * Optional Sign-In With X (SIWX) session state.
12
+ * If provided, the watcher will manage updates and disconnections based on SIWX status.
13
+ * Directly compatible with `useSiwxSession()` from `@tuwaio/siwx-react`.
14
+ */
15
+ siwx?: SatelliteSiwxState;
16
+ }
5
17
  /**
6
18
  * A dynamic version of the SolanaConnectorsWatcher component that avoids static imports.
7
19
  * This component dynamically imports the dependencies only when they are available.
8
20
  *
21
+ * @param props - Component props containing optional SIWX session state.
9
22
  * @returns null - This is a headless component
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * import { useSiwxSession } from '@tuwaio/siwx-react';
27
+ * import { SolanaConnectorsWatcher } from '@tuwaio/satellite-react/solana';
28
+ *
29
+ * function WatcherContainer() {
30
+ * const siwxSession = useSiwxSession();
31
+ * return <SolanaConnectorsWatcher siwx={siwxSession} />;
32
+ * }
33
+ * ```
34
+ *
35
+ * @remarks
36
+ * Monitors Wallet Standard account changes. Automatically disconnects wallet state if SIWX
37
+ * session validation fails or is rejected.
10
38
  */
11
- declare function SolanaConnectorsWatcher(): react.JSX.Element | null;
39
+ declare function SolanaConnectorsWatcher(props?: SolanaConnectorsWatcherProps): react.JSX.Element | null;
12
40
 
13
41
  declare module '@tuwaio/satellite-react' {
14
42
  interface AllConnections {
@@ -19,4 +47,4 @@ declare module '@tuwaio/satellite-react' {
19
47
  }
20
48
  }
21
49
 
22
- export { SolanaConnectorsWatcher };
50
+ export { SolanaConnectorsWatcher, type SolanaConnectorsWatcherProps };
@@ -1 +1 @@
1
- import {b}from'../chunk-H5TQSDNK.js';import {useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';function y(){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{y as SolanaConnectorsWatcher};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuwaio/satellite-react",
3
- "version": "0.3.10",
3
+ "version": "0.4.0",
4
4
  "private": false,
5
5
  "author": "Oleksandr Tkach",
6
6
  "license": "Apache-2.0",
@@ -66,6 +66,10 @@
66
66
  "@tuwaio/satellite-core": ">=0.3.2",
67
67
  "@tuwaio/satellite-evm": ">=0.3.2",
68
68
  "@tuwaio/satellite-solana": ">=0.3.2",
69
+ "@tuwaio/siwx-core": ">=0.1.0",
70
+ "@tuwaio/siwx-react": ">=0.1.0",
71
+ "@tuwaio/siwx-evm": ">=0.1.0",
72
+ "@tuwaio/siwx-solana": ">=0.1.0",
69
73
  "@wagmi/core": "3.x.x",
70
74
  "viem": "2.x.x",
71
75
  "@wallet-standard/react": "1.x.x",
@@ -108,6 +112,18 @@
108
112
  "@tuwaio/satellite-solana": {
109
113
  "optional": true
110
114
  },
115
+ "@tuwaio/siwx-core": {
116
+ "optional": true
117
+ },
118
+ "@tuwaio/siwx-react": {
119
+ "optional": true
120
+ },
121
+ "@tuwaio/siwx-evm": {
122
+ "optional": true
123
+ },
124
+ "@tuwaio/siwx-solana": {
125
+ "optional": true
126
+ },
111
127
  "@wallet-standard/react": {
112
128
  "optional": true
113
129
  },
@@ -116,10 +132,14 @@
116
132
  }
117
133
  },
118
134
  "devDependencies": {
119
- "@types/react": "^19.2.17",
135
+ "@types/react": "^19.2.18",
120
136
  "@tuwaio/orbit-core": "^0.2.15",
121
- "@tuwaio/orbit-evm": "^0.2.20",
137
+ "@tuwaio/orbit-evm": "^0.2.22",
122
138
  "@tuwaio/orbit-solana": "^0.2.13",
139
+ "@tuwaio/siwx-core": "^0.1.0",
140
+ "@tuwaio/siwx-react": "^0.1.0",
141
+ "@tuwaio/siwx-evm": "^0.1.0",
142
+ "@tuwaio/siwx-solana": "^0.1.0",
123
143
  "@wagmi/core": "^3.6.4",
124
144
  "@wallet-standard/react": "^1.0.3",
125
145
  "@wallet-standard/app": "^1.1.1",
@@ -129,19 +149,19 @@
129
149
  "@wallet-standard/ui": "^1.0.3",
130
150
  "@wallet-standard/ui-registry": "^1.1.1",
131
151
  "gill": "^0.14.0",
132
- "immer": "^11.1.15",
152
+ "immer": "^11.1.16",
133
153
  "react": "^19.2.8",
134
154
  "tsup": "^8.5.1",
135
- "viem": "^2.55.8",
155
+ "viem": "^2.55.11",
136
156
  "typescript": "^6.0.3",
137
157
  "zustand": "^5.0.14",
138
- "@tuwaio/satellite-core": "^0.3.8",
139
- "@tuwaio/satellite-solana": "^0.3.11",
140
- "@tuwaio/satellite-evm": "^0.3.9"
158
+ "@tuwaio/satellite-core": "^0.4.0",
159
+ "@tuwaio/satellite-evm": "^0.4.0",
160
+ "@tuwaio/satellite-solana": "^0.4.0"
141
161
  },
142
162
  "scripts": {
143
163
  "start": "tsup src/index.ts --watch",
144
164
  "build": "tsup",
145
- "test": "vitest"
165
+ "test": "vitest run --passWithNoTests"
146
166
  }
147
167
  }