@tuwaio/quasar-sdk 0.0.8 → 0.0.9

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/README.md CHANGED
@@ -43,14 +43,18 @@ const history = await quasar.pulsar.getHistory({ chainId: 1 });
43
43
 
44
44
  ## React Authentication Bridge
45
45
 
46
- The SDK provides a unified component to handle multi-chain authentication (EVM & Solana) with zero boilerplate.
46
+ The SDK provides React components to handle authentication with zero boilerplate. To prevent issues with missing optional peer dependencies at build time, the SDK exposes separate ecosystem entry points:
47
+
48
+ ### 1. EVM-Only Bridge (No Solana dependencies required)
49
+
50
+ If your project only supports EVM chains, import from the `/react/evm` subpath. This avoids compile-time errors if `@solana/react` is not installed.
47
51
 
48
52
  ```tsx
49
- import { QuasarAuthBridge } from '@tuwaio/quasar-sdk/react';
53
+ import { QuasarEvmAuthBridge } from '@tuwaio/quasar-sdk/react/evm';
50
54
 
51
55
  function MyApp() {
52
56
  return (
53
- <QuasarAuthBridge
57
+ <QuasarEvmAuthBridge
54
58
  activeConnection={activeConnection} // Structural interface for wallet state
55
59
  store={store} // Zustand store API
56
60
  wagmiConfig={config} // Wagmi config
@@ -61,6 +65,45 @@ function MyApp() {
61
65
  }
62
66
  ```
63
67
 
68
+ ### 2. Solana-Only Bridge (No EVM dependencies required)
69
+
70
+ If your project only supports Solana, import from the `/react/solana` subpath. This avoids compile-time errors if `@wagmi/core` is not installed.
71
+
72
+ ```tsx
73
+ import { QuasarSolanaAuthBridge } from '@tuwaio/quasar-sdk/react/solana';
74
+
75
+ function MyApp() {
76
+ return (
77
+ <QuasarSolanaAuthBridge
78
+ activeConnection={activeConnection} // Structural interface for wallet state
79
+ store={store} // Zustand store API
80
+ session={miniSession} // Current session state
81
+ setSession={setMiniSession} // Session setter
82
+ />
83
+ );
84
+ }
85
+ ```
86
+
87
+ ### 3. Unified Cross-Chain Bridge
88
+
89
+ If your project supports both ecosystems and has all peer dependencies installed, you can use the unified bridge:
90
+
91
+ ```tsx
92
+ import { QuasarAuthBridge } from '@tuwaio/quasar-sdk/react';
93
+
94
+ function MyApp() {
95
+ return (
96
+ <QuasarAuthBridge
97
+ activeConnection={activeConnection}
98
+ store={store}
99
+ wagmiConfig={config}
100
+ session={miniSession}
101
+ setSession={setMiniSession}
102
+ />
103
+ );
104
+ }
105
+ ```
106
+
64
107
  ## Modules
65
108
 
66
109
  ### Pulsar — `quasar.pulsar`
@@ -0,0 +1 @@
1
+ 'use strict';var chunkHVUZ52OX_js=require('./chunk-HVUZ52OX.js'),chunkOJCR5A56_js=require('./chunk-OJCR5A56.js'),core=require('@wagmi/core'),react=require('react'),jsxRuntime=require('react/jsx-runtime');function R({activeConnection:n,store:i,wagmiConfig:r,session:e,setSession:t,maxAge:s,onAddressMismatch:o}){return react.useEffect(()=>{e&&n?.address&&e.walletAddress!==n.address&&(console.log("[QuasarSDK] Address mismatch detected, clearing session..."),t(null),o?.());},[n?.address,e,t,o]),!n?.isConnected||!i?null:jsxRuntime.jsx(S,{wagmiConfig:r,store:i,session:e,setSession:t,maxAge:s})}function S({wagmiConfig:n,store:i,session:r,setSession:e,maxAge:t}){let s=react.useRef(r),o=react.useRef(e);react.useEffect(()=>{s.current=r;},[r]),react.useEffect(()=>{o.current=e;},[e]);let l=react.useCallback(async()=>{let u=i.getState().activeConnection;if(!u?.isConnected)throw new Error("[QuasarSDK] Wallet disconnected");let d=await core.getWalletClient(n);if(!d)throw new Error("[QuasarSDK] EVM Signer not found");return chunkOJCR5A56_js.h({isConnected:u.isConnected,address:u.address,chainType:"EVM",signer:d},{miniSession:s.current,setMiniSession:o.current},t)},[i,n,t]);return react.useEffect(()=>(chunkHVUZ52OX_js.a(l),()=>{chunkHVUZ52OX_js.a(null);}),[l]),null}exports.a=R;
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-UW6TWEYM.mjs';import {h}from'./chunk-SF2BM2YA.mjs';import {getWalletClient}from'@wagmi/core';import {useEffect,useRef,useCallback}from'react';import {jsx}from'react/jsx-runtime';function R({activeConnection:n,store:i,wagmiConfig:r,session:e,setSession:t,maxAge:s,onAddressMismatch:o}){return useEffect(()=>{e&&n?.address&&e.walletAddress!==n.address&&(console.log("[QuasarSDK] Address mismatch detected, clearing session..."),t(null),o?.());},[n?.address,e,t,o]),!n?.isConnected||!i?null:jsx(S,{wagmiConfig:r,store:i,session:e,setSession:t,maxAge:s})}function S({wagmiConfig:n,store:i,session:r,setSession:e,maxAge:t}){let s=useRef(r),o=useRef(e);useEffect(()=>{s.current=r;},[r]),useEffect(()=>{o.current=e;},[e]);let l=useCallback(async()=>{let u=i.getState().activeConnection;if(!u?.isConnected)throw new Error("[QuasarSDK] Wallet disconnected");let d=await getWalletClient(n);if(!d)throw new Error("[QuasarSDK] EVM Signer not found");return h({isConnected:u.isConnected,address:u.address,chainType:"EVM",signer:d},{miniSession:s.current,setMiniSession:o.current},t)},[i,n,t]);return useEffect(()=>(a(l),()=>{a(null);}),[l]),null}export{R as a};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-UW6TWEYM.mjs';import {h}from'./chunk-SF2BM2YA.mjs';import {useWalletAccountMessageSigner}from'@solana/react';import {useEffect,useRef,useCallback}from'react';import {jsx}from'react/jsx-runtime';function D({activeConnection:n,store:r,session:e,setSession:t,maxAge:i,onAddressMismatch:o}){return useEffect(()=>{e&&n?.address&&e.walletAddress!==n.address&&(console.log("[QuasarSDK] Address mismatch detected, clearing session..."),t(null),o?.());},[n?.address,e,t,o]),!n?.isConnected||!r?null:jsx(p,{connectedAccount:n.connectedAccount,store:r,session:e,setSession:t,maxAge:i})}function p({connectedAccount:n,store:r,session:e,setSession:t,maxAge:i}){let o=useWalletAccountMessageSigner(n),l=useRef(o),d=useRef(e),A=useRef(t);useEffect(()=>{l.current=o;},[o]),useEffect(()=>{d.current=e;},[e]),useEffect(()=>{A.current=t;},[t]);let S=useCallback(async()=>{let a=r.getState().activeConnection;if(!a?.isConnected)throw new Error("[QuasarSDK] Wallet disconnected");let f=l.current;if(!f)throw new Error("[QuasarSDK] Solana Message Signer not initialized.");return h({isConnected:a.isConnected,address:a.address,chainType:"SOLANA",signer:f},{miniSession:d.current,setMiniSession:A.current},i)},[r,i]);return useEffect(()=>(a(S),()=>{a(null);}),[S]),null}export{D as a};
@@ -0,0 +1 @@
1
+ 'use strict';var n=null;function t(e){n=e;}async function r(){for(let e=0;e<15;e++){if(n)return n();await new Promise(i=>setTimeout(i,200));}throw new Error("[QuasarSDK] Auth helper not initialized. Ensure QuasarAuthBridge is mounted and wallet is connected.")}exports.a=t;exports.b=r;
@@ -0,0 +1 @@
1
+ 'use strict';var chunkHVUZ52OX_js=require('./chunk-HVUZ52OX.js'),chunkOJCR5A56_js=require('./chunk-OJCR5A56.js'),react$1=require('@solana/react'),react=require('react'),jsxRuntime=require('react/jsx-runtime');function D({activeConnection:n,store:r,session:e,setSession:t,maxAge:i,onAddressMismatch:o}){return react.useEffect(()=>{e&&n?.address&&e.walletAddress!==n.address&&(console.log("[QuasarSDK] Address mismatch detected, clearing session..."),t(null),o?.());},[n?.address,e,t,o]),!n?.isConnected||!r?null:jsxRuntime.jsx(p,{connectedAccount:n.connectedAccount,store:r,session:e,setSession:t,maxAge:i})}function p({connectedAccount:n,store:r,session:e,setSession:t,maxAge:i}){let o=react$1.useWalletAccountMessageSigner(n),l=react.useRef(o),d=react.useRef(e),A=react.useRef(t);react.useEffect(()=>{l.current=o;},[o]),react.useEffect(()=>{d.current=e;},[e]),react.useEffect(()=>{A.current=t;},[t]);let S=react.useCallback(async()=>{let a=r.getState().activeConnection;if(!a?.isConnected)throw new Error("[QuasarSDK] Wallet disconnected");let f=l.current;if(!f)throw new Error("[QuasarSDK] Solana Message Signer not initialized.");return chunkOJCR5A56_js.h({isConnected:a.isConnected,address:a.address,chainType:"SOLANA",signer:f},{miniSession:d.current,setMiniSession:A.current},i)},[r,i]);return react.useEffect(()=>(chunkHVUZ52OX_js.a(S),()=>{chunkHVUZ52OX_js.a(null);}),[S]),null}exports.a=D;
@@ -0,0 +1 @@
1
+ var n=null;function t(e){n=e;}async function r(){for(let e=0;e<15;e++){if(n)return n();await new Promise(i=>setTimeout(i,200));}throw new Error("[QuasarSDK] Auth helper not initialized. Ensure QuasarAuthBridge is mounted and wallet is connected.")}export{t as a,r as b};
@@ -0,0 +1,56 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { Config } from '@wagmi/core';
3
+ import { StoreApi } from 'zustand';
4
+ import { b as MiniSessionAuth } from '../types-Ctaain6g.mjs';
5
+ import { Q as QuasarActiveConnection } from '../shared-CFhEPXTt.mjs';
6
+ export { g as getMiniSessionAuth } from '../shared-CFhEPXTt.mjs';
7
+
8
+ /**
9
+ * Props for the QuasarEvmAuthBridge component.
10
+ *
11
+ * @public
12
+ */
13
+ interface QuasarEvmAuthBridgeProps {
14
+ /** The active connection object (usually from useSatelliteConnectStore). */
15
+ activeConnection: QuasarActiveConnection | null | undefined;
16
+ /** The state store API (usually from SatelliteStoreContext). */
17
+ store: StoreApi<unknown>;
18
+ /** The Wagmi configuration instance for EVM signing. */
19
+ wagmiConfig: Config;
20
+ /** The current Mini-Session authentication data from your state store. */
21
+ session: MiniSessionAuth | null;
22
+ /** Callback to update the session in your state store. */
23
+ setSession: (session: MiniSessionAuth | null) => void;
24
+ /**
25
+ * Maximum session age in milliseconds. Must be the same value passed to
26
+ * `verifyMiniSession` — this is the single source of truth for session lifetime.
27
+ * Defaults to 5 minutes.
28
+ */
29
+ maxAge?: number;
30
+ /** Optional callback triggered when an address mismatch is detected. */
31
+ onAddressMismatch?: () => void;
32
+ }
33
+ /**
34
+ * The Quasar EVM Authentication Bridge.
35
+ *
36
+ * This component orchestrates signature requests specifically for EVM wallets,
37
+ * avoiding any Solana library dependencies.
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * import { QuasarEvmAuthBridge } from '@tuwaio/quasar-sdk/react/evm';
42
+ *
43
+ * <QuasarEvmAuthBridge
44
+ * activeConnection={activeConnection}
45
+ * store={store}
46
+ * wagmiConfig={config}
47
+ * session={auth.miniSession}
48
+ * setSession={auth.setMiniSession}
49
+ * />
50
+ * ```
51
+ *
52
+ * @public
53
+ */
54
+ declare function QuasarEvmAuthBridge({ activeConnection, store, wagmiConfig, session, setSession, maxAge, onAddressMismatch, }: QuasarEvmAuthBridgeProps): react_jsx_runtime.JSX.Element | null;
55
+
56
+ export { QuasarActiveConnection, QuasarEvmAuthBridge, type QuasarEvmAuthBridgeProps };
@@ -0,0 +1,56 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { Config } from '@wagmi/core';
3
+ import { StoreApi } from 'zustand';
4
+ import { b as MiniSessionAuth } from '../types-Ctaain6g.js';
5
+ import { Q as QuasarActiveConnection } from '../shared-BeprN_w-.js';
6
+ export { g as getMiniSessionAuth } from '../shared-BeprN_w-.js';
7
+
8
+ /**
9
+ * Props for the QuasarEvmAuthBridge component.
10
+ *
11
+ * @public
12
+ */
13
+ interface QuasarEvmAuthBridgeProps {
14
+ /** The active connection object (usually from useSatelliteConnectStore). */
15
+ activeConnection: QuasarActiveConnection | null | undefined;
16
+ /** The state store API (usually from SatelliteStoreContext). */
17
+ store: StoreApi<unknown>;
18
+ /** The Wagmi configuration instance for EVM signing. */
19
+ wagmiConfig: Config;
20
+ /** The current Mini-Session authentication data from your state store. */
21
+ session: MiniSessionAuth | null;
22
+ /** Callback to update the session in your state store. */
23
+ setSession: (session: MiniSessionAuth | null) => void;
24
+ /**
25
+ * Maximum session age in milliseconds. Must be the same value passed to
26
+ * `verifyMiniSession` — this is the single source of truth for session lifetime.
27
+ * Defaults to 5 minutes.
28
+ */
29
+ maxAge?: number;
30
+ /** Optional callback triggered when an address mismatch is detected. */
31
+ onAddressMismatch?: () => void;
32
+ }
33
+ /**
34
+ * The Quasar EVM Authentication Bridge.
35
+ *
36
+ * This component orchestrates signature requests specifically for EVM wallets,
37
+ * avoiding any Solana library dependencies.
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * import { QuasarEvmAuthBridge } from '@tuwaio/quasar-sdk/react/evm';
42
+ *
43
+ * <QuasarEvmAuthBridge
44
+ * activeConnection={activeConnection}
45
+ * store={store}
46
+ * wagmiConfig={config}
47
+ * session={auth.miniSession}
48
+ * setSession={auth.setMiniSession}
49
+ * />
50
+ * ```
51
+ *
52
+ * @public
53
+ */
54
+ declare function QuasarEvmAuthBridge({ activeConnection, store, wagmiConfig, session, setSession, maxAge, onAddressMismatch, }: QuasarEvmAuthBridgeProps): react_jsx_runtime.JSX.Element | null;
55
+
56
+ export { QuasarActiveConnection, QuasarEvmAuthBridge, type QuasarEvmAuthBridgeProps };
@@ -0,0 +1 @@
1
+ 'use strict';var chunk7F6I4FHE_js=require('../chunk-7F6I4FHE.js'),chunkHVUZ52OX_js=require('../chunk-HVUZ52OX.js');require('../chunk-OJCR5A56.js');Object.defineProperty(exports,"QuasarEvmAuthBridge",{enumerable:true,get:function(){return chunk7F6I4FHE_js.a}});Object.defineProperty(exports,"getMiniSessionAuth",{enumerable:true,get:function(){return chunkHVUZ52OX_js.b}});
@@ -0,0 +1 @@
1
+ export{a as QuasarEvmAuthBridge}from'../chunk-EDXCZKX7.mjs';export{b as getMiniSessionAuth}from'../chunk-UW6TWEYM.mjs';import'../chunk-SF2BM2YA.mjs';
@@ -0,0 +1,52 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { StoreApi } from 'zustand';
3
+ import { b as MiniSessionAuth } from '../types-Ctaain6g.mjs';
4
+ import { Q as QuasarActiveConnection } from '../shared-CFhEPXTt.mjs';
5
+ export { g as getMiniSessionAuth } from '../shared-CFhEPXTt.mjs';
6
+
7
+ /**
8
+ * Props for the QuasarSolanaAuthBridge component.
9
+ *
10
+ * @public
11
+ */
12
+ interface QuasarSolanaAuthBridgeProps {
13
+ /** The active connection object (usually from useSatelliteConnectStore). */
14
+ activeConnection: QuasarActiveConnection | null | undefined;
15
+ /** The state store API (usually from SatelliteStoreContext). */
16
+ store: StoreApi<unknown>;
17
+ /** The current Mini-Session authentication data from your state store. */
18
+ session: MiniSessionAuth | null;
19
+ /** Callback to update the session in your state store. */
20
+ setSession: (session: MiniSessionAuth | null) => void;
21
+ /**
22
+ * Maximum session age in milliseconds. Must be the same value passed to
23
+ * `verifyMiniSession` — this is the single source of truth for session lifetime.
24
+ * Defaults to 5 minutes.
25
+ */
26
+ maxAge?: number;
27
+ /** Optional callback triggered when an address mismatch is detected. */
28
+ onAddressMismatch?: () => void;
29
+ }
30
+ /**
31
+ * The Quasar Solana Authentication Bridge.
32
+ *
33
+ * This component orchestrates signature requests specifically for Solana wallets,
34
+ * avoiding any EVM / Wagmi library dependencies.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * import { QuasarSolanaAuthBridge } from '@tuwaio/quasar-sdk/react/solana';
39
+ *
40
+ * <QuasarSolanaAuthBridge
41
+ * activeConnection={activeConnection}
42
+ * store={store}
43
+ * session={auth.miniSession}
44
+ * setSession={auth.setMiniSession}
45
+ * />
46
+ * ```
47
+ *
48
+ * @public
49
+ */
50
+ declare function QuasarSolanaAuthBridge({ activeConnection, store, session, setSession, maxAge, onAddressMismatch, }: QuasarSolanaAuthBridgeProps): react_jsx_runtime.JSX.Element | null;
51
+
52
+ export { QuasarActiveConnection, QuasarSolanaAuthBridge, type QuasarSolanaAuthBridgeProps };
@@ -0,0 +1,52 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { StoreApi } from 'zustand';
3
+ import { b as MiniSessionAuth } from '../types-Ctaain6g.js';
4
+ import { Q as QuasarActiveConnection } from '../shared-BeprN_w-.js';
5
+ export { g as getMiniSessionAuth } from '../shared-BeprN_w-.js';
6
+
7
+ /**
8
+ * Props for the QuasarSolanaAuthBridge component.
9
+ *
10
+ * @public
11
+ */
12
+ interface QuasarSolanaAuthBridgeProps {
13
+ /** The active connection object (usually from useSatelliteConnectStore). */
14
+ activeConnection: QuasarActiveConnection | null | undefined;
15
+ /** The state store API (usually from SatelliteStoreContext). */
16
+ store: StoreApi<unknown>;
17
+ /** The current Mini-Session authentication data from your state store. */
18
+ session: MiniSessionAuth | null;
19
+ /** Callback to update the session in your state store. */
20
+ setSession: (session: MiniSessionAuth | null) => void;
21
+ /**
22
+ * Maximum session age in milliseconds. Must be the same value passed to
23
+ * `verifyMiniSession` — this is the single source of truth for session lifetime.
24
+ * Defaults to 5 minutes.
25
+ */
26
+ maxAge?: number;
27
+ /** Optional callback triggered when an address mismatch is detected. */
28
+ onAddressMismatch?: () => void;
29
+ }
30
+ /**
31
+ * The Quasar Solana Authentication Bridge.
32
+ *
33
+ * This component orchestrates signature requests specifically for Solana wallets,
34
+ * avoiding any EVM / Wagmi library dependencies.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * import { QuasarSolanaAuthBridge } from '@tuwaio/quasar-sdk/react/solana';
39
+ *
40
+ * <QuasarSolanaAuthBridge
41
+ * activeConnection={activeConnection}
42
+ * store={store}
43
+ * session={auth.miniSession}
44
+ * setSession={auth.setMiniSession}
45
+ * />
46
+ * ```
47
+ *
48
+ * @public
49
+ */
50
+ declare function QuasarSolanaAuthBridge({ activeConnection, store, session, setSession, maxAge, onAddressMismatch, }: QuasarSolanaAuthBridgeProps): react_jsx_runtime.JSX.Element | null;
51
+
52
+ export { QuasarActiveConnection, QuasarSolanaAuthBridge, type QuasarSolanaAuthBridgeProps };
@@ -0,0 +1 @@
1
+ 'use strict';var chunkRZ4TLBSP_js=require('../chunk-RZ4TLBSP.js'),chunkHVUZ52OX_js=require('../chunk-HVUZ52OX.js');require('../chunk-OJCR5A56.js');Object.defineProperty(exports,"QuasarSolanaAuthBridge",{enumerable:true,get:function(){return chunkRZ4TLBSP_js.a}});Object.defineProperty(exports,"getMiniSessionAuth",{enumerable:true,get:function(){return chunkHVUZ52OX_js.b}});
@@ -0,0 +1 @@
1
+ export{a as QuasarSolanaAuthBridge}from'../chunk-ERWWKRPN.mjs';export{b as getMiniSessionAuth}from'../chunk-UW6TWEYM.mjs';import'../chunk-SF2BM2YA.mjs';
package/dist/react.d.mts CHANGED
@@ -1,37 +1,15 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Config } from '@wagmi/core';
3
- import { UiWalletAccount } from '@wallet-standard/react';
4
3
  import { StoreApi } from 'zustand';
5
4
  import { b as MiniSessionAuth } from './types-Ctaain6g.mjs';
5
+ import { Q as QuasarActiveConnection } from './shared-CFhEPXTt.mjs';
6
+ export { g as getMiniSessionAuth } from './shared-CFhEPXTt.mjs';
6
7
 
7
8
  /**
8
- * Structural interface for an active wallet connection.
9
- * @public
10
- */
11
- interface QuasarActiveConnection {
12
- /** Whether the wallet is currently connected. */
13
- isConnected: boolean;
14
- /** The active wallet address. */
15
- address: string;
16
- /** The chain ID (number for EVM, string for Solana). */
17
- chainId: string | number;
18
- /** The UiWalletAccount object (required for Solana signing). */
19
- connectedAccount?: UiWalletAccount;
20
- }
21
- /**
22
- * Static utility to retrieve or trigger a Mini-Session authentication.
23
- * This is the primary way for services outside the React tree to get an auth token.
24
- *
25
- * @returns A promise resolving to the valid Mini-Session Auth.
26
- * @throws {Error} If the bridge is not mounted or the wallet is disconnected.
9
+ * Props for the unified QuasarAuthBridge component.
27
10
  *
28
11
  * @public
29
12
  */
30
- declare function getMiniSessionAuth(): Promise<MiniSessionAuth>;
31
- /**
32
- * Props for the QuasarAuthBridge component.
33
- * @public
34
- */
35
13
  interface QuasarAuthBridgeProps {
36
14
  /** The active connection object (usually from useSatelliteConnectStore). */
37
15
  activeConnection: QuasarActiveConnection | null | undefined;
@@ -47,36 +25,24 @@ interface QuasarAuthBridgeProps {
47
25
  * Maximum session age in milliseconds. Must be the same value passed to
48
26
  * `verifyMiniSession` — this is the single source of truth for session lifetime.
49
27
  * Defaults to 5 minutes.
50
- *
51
- * @example
52
- * ```tsx
53
- * const TOKEN_EXPIRATION = 86400 * 1000; // 24 hours in ms
54
- *
55
- * <QuasarAuthBridge maxAge={TOKEN_EXPIRATION} ... />
56
- *
57
- * // Later, for verification:
58
- * verifyMiniSession({ ...auth, maxAge: TOKEN_EXPIRATION });
59
- * ```
60
28
  */
61
29
  maxAge?: number;
62
30
  /** Optional callback triggered when an address mismatch is detected. */
63
31
  onAddressMismatch?: () => void;
64
32
  }
65
33
  /**
66
- * The Quasar Authentication Bridge.
67
- *
68
- * This component orchestrates signature requests across Solana and EVM ecosystems.
69
- * It decouples the SDK from specific library hooks by accepting connection data as props.
34
+ * The Unified Quasar Authentication Bridge.
70
35
  *
71
- * It automatically handles:
72
- * 1. Signature generation for both Solana and EVM wallets.
73
- * 2. Session caching and synchronization with your state store.
74
- * 3. Address mismatch protection (clearing sessions when the wallet changes).
36
+ * This component acts as a unified cross-chain coordinator. It dynamically
37
+ * renders either the EVM or Solana specific bridges based on the connection type.
38
+ * Note: importing this component requires having both `@wagmi/core` and `@solana/react` installed.
39
+ * If you only need EVM or Solana bindings, import directly from the corresponding subpath:
40
+ * - `@tuwaio/quasar-sdk/react/evm`
41
+ * - `@tuwaio/quasar-sdk/react/solana`
75
42
  *
76
43
  * @example
77
44
  * ```tsx
78
- * const activeConnection = useSatelliteConnectStore(s => s.activeConnection);
79
- * const store = useContext(SatelliteStoreContext);
45
+ * import { QuasarAuthBridge } from '@tuwaio/quasar-sdk/react';
80
46
  *
81
47
  * <QuasarAuthBridge
82
48
  * activeConnection={activeConnection}
@@ -91,4 +57,4 @@ interface QuasarAuthBridgeProps {
91
57
  */
92
58
  declare function QuasarAuthBridge({ activeConnection, store, wagmiConfig, session, setSession, maxAge, onAddressMismatch, }: QuasarAuthBridgeProps): react_jsx_runtime.JSX.Element | null;
93
59
 
94
- export { type QuasarActiveConnection, QuasarAuthBridge, type QuasarAuthBridgeProps, getMiniSessionAuth };
60
+ export { QuasarActiveConnection, QuasarAuthBridge, type QuasarAuthBridgeProps };
package/dist/react.d.ts CHANGED
@@ -1,37 +1,15 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Config } from '@wagmi/core';
3
- import { UiWalletAccount } from '@wallet-standard/react';
4
3
  import { StoreApi } from 'zustand';
5
4
  import { b as MiniSessionAuth } from './types-Ctaain6g.js';
5
+ import { Q as QuasarActiveConnection } from './shared-BeprN_w-.js';
6
+ export { g as getMiniSessionAuth } from './shared-BeprN_w-.js';
6
7
 
7
8
  /**
8
- * Structural interface for an active wallet connection.
9
- * @public
10
- */
11
- interface QuasarActiveConnection {
12
- /** Whether the wallet is currently connected. */
13
- isConnected: boolean;
14
- /** The active wallet address. */
15
- address: string;
16
- /** The chain ID (number for EVM, string for Solana). */
17
- chainId: string | number;
18
- /** The UiWalletAccount object (required for Solana signing). */
19
- connectedAccount?: UiWalletAccount;
20
- }
21
- /**
22
- * Static utility to retrieve or trigger a Mini-Session authentication.
23
- * This is the primary way for services outside the React tree to get an auth token.
24
- *
25
- * @returns A promise resolving to the valid Mini-Session Auth.
26
- * @throws {Error} If the bridge is not mounted or the wallet is disconnected.
9
+ * Props for the unified QuasarAuthBridge component.
27
10
  *
28
11
  * @public
29
12
  */
30
- declare function getMiniSessionAuth(): Promise<MiniSessionAuth>;
31
- /**
32
- * Props for the QuasarAuthBridge component.
33
- * @public
34
- */
35
13
  interface QuasarAuthBridgeProps {
36
14
  /** The active connection object (usually from useSatelliteConnectStore). */
37
15
  activeConnection: QuasarActiveConnection | null | undefined;
@@ -47,36 +25,24 @@ interface QuasarAuthBridgeProps {
47
25
  * Maximum session age in milliseconds. Must be the same value passed to
48
26
  * `verifyMiniSession` — this is the single source of truth for session lifetime.
49
27
  * Defaults to 5 minutes.
50
- *
51
- * @example
52
- * ```tsx
53
- * const TOKEN_EXPIRATION = 86400 * 1000; // 24 hours in ms
54
- *
55
- * <QuasarAuthBridge maxAge={TOKEN_EXPIRATION} ... />
56
- *
57
- * // Later, for verification:
58
- * verifyMiniSession({ ...auth, maxAge: TOKEN_EXPIRATION });
59
- * ```
60
28
  */
61
29
  maxAge?: number;
62
30
  /** Optional callback triggered when an address mismatch is detected. */
63
31
  onAddressMismatch?: () => void;
64
32
  }
65
33
  /**
66
- * The Quasar Authentication Bridge.
67
- *
68
- * This component orchestrates signature requests across Solana and EVM ecosystems.
69
- * It decouples the SDK from specific library hooks by accepting connection data as props.
34
+ * The Unified Quasar Authentication Bridge.
70
35
  *
71
- * It automatically handles:
72
- * 1. Signature generation for both Solana and EVM wallets.
73
- * 2. Session caching and synchronization with your state store.
74
- * 3. Address mismatch protection (clearing sessions when the wallet changes).
36
+ * This component acts as a unified cross-chain coordinator. It dynamically
37
+ * renders either the EVM or Solana specific bridges based on the connection type.
38
+ * Note: importing this component requires having both `@wagmi/core` and `@solana/react` installed.
39
+ * If you only need EVM or Solana bindings, import directly from the corresponding subpath:
40
+ * - `@tuwaio/quasar-sdk/react/evm`
41
+ * - `@tuwaio/quasar-sdk/react/solana`
75
42
  *
76
43
  * @example
77
44
  * ```tsx
78
- * const activeConnection = useSatelliteConnectStore(s => s.activeConnection);
79
- * const store = useContext(SatelliteStoreContext);
45
+ * import { QuasarAuthBridge } from '@tuwaio/quasar-sdk/react';
80
46
  *
81
47
  * <QuasarAuthBridge
82
48
  * activeConnection={activeConnection}
@@ -91,4 +57,4 @@ interface QuasarAuthBridgeProps {
91
57
  */
92
58
  declare function QuasarAuthBridge({ activeConnection, store, wagmiConfig, session, setSession, maxAge, onAddressMismatch, }: QuasarAuthBridgeProps): react_jsx_runtime.JSX.Element | null;
93
59
 
94
- export { type QuasarActiveConnection, QuasarAuthBridge, type QuasarAuthBridgeProps, getMiniSessionAuth };
60
+ export { QuasarActiveConnection, QuasarAuthBridge, type QuasarAuthBridgeProps };
package/dist/react.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkOJCR5A56_js=require('./chunk-OJCR5A56.js'),react$1=require('@solana/react'),core=require('@wagmi/core'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var u=null;async function K(){for(let n=0;n<15;n++){if(u)return u();await new Promise(t=>setTimeout(t,200));}throw new Error("[QuasarSDK] Auth helper not initialized. Ensure QuasarAuthBridge is mounted and wallet is connected.")}function x({activeConnection:n,store:t,wagmiConfig:r,session:e,setSession:i,maxAge:o,onAddressMismatch:s}){let d=typeof n?.chainId=="string"?"SOLANA":"EVM";return react.useEffect(()=>{e&&n?.address&&e.walletAddress!==n.address&&(console.log("[QuasarSDK] Address mismatch detected, clearing session..."),i(null),s?.());},[n?.address,e,i,s]),!n?.isConnected||!t?null:d==="SOLANA"?jsxRuntime.jsx(M,{connectedAccount:n.connectedAccount,store:t,session:e,setSession:i,maxAge:o}):jsxRuntime.jsx(Q,{wagmiConfig:r,store:t,session:e,setSession:i,maxAge:o})}function M({connectedAccount:n,store:t,session:r,setSession:e,maxAge:i}){let o=react$1.useWalletAccountMessageSigner(n),s=react.useRef(o),c=react.useRef(r),d=react.useRef(e);react.useEffect(()=>{s.current=o;},[o]),react.useEffect(()=>{c.current=r;},[r]),react.useEffect(()=>{d.current=e;},[e]);let l=react.useCallback(async()=>{let g=t.getState().activeConnection;if(!g?.isConnected)throw new Error("[QuasarSDK] Wallet disconnected");let h=s.current;if(!h)throw new Error("[QuasarSDK] Solana Message Signer not initialized.");return chunkOJCR5A56_js.h({isConnected:g.isConnected,address:g.address,chainType:"SOLANA",signer:h},{miniSession:c.current,setMiniSession:d.current},i)},[t,i]);return react.useEffect(()=>(u=l,()=>{u===l&&(u=null);}),[l]),null}function Q({wagmiConfig:n,store:t,session:r,setSession:e,maxAge:i}){let o=react.useRef(r),s=react.useRef(e);react.useEffect(()=>{o.current=r;},[r]),react.useEffect(()=>{s.current=e;},[e]);let c=react.useCallback(async()=>{let l=t.getState().activeConnection;if(!l?.isConnected)throw new Error("[QuasarSDK] Wallet disconnected");let A=await core.getWalletClient(n);if(!A)throw new Error("[QuasarSDK] EVM Signer not found");return chunkOJCR5A56_js.h({isConnected:l.isConnected,address:l.address,chainType:"EVM",signer:A},{miniSession:o.current,setMiniSession:s.current},i)},[t,n,i]);return react.useEffect(()=>(u=c,()=>{u===c&&(u=null);}),[c]),null}exports.QuasarAuthBridge=x;exports.getMiniSessionAuth=K;
1
+ 'use strict';var chunk7F6I4FHE_js=require('./chunk-7F6I4FHE.js'),chunkRZ4TLBSP_js=require('./chunk-RZ4TLBSP.js'),chunkHVUZ52OX_js=require('./chunk-HVUZ52OX.js');require('./chunk-OJCR5A56.js');var react=require('react'),jsxRuntime=require('react/jsx-runtime');function C({activeConnection:r,store:e,wagmiConfig:d,session:i,setSession:o,maxAge:n,onAddressMismatch:s}){let m=typeof r?.chainId=="string"?"SOLANA":"EVM";return react.useEffect(()=>{i&&r?.address&&i.walletAddress!==r.address&&(console.log("[QuasarSDK] Address mismatch detected, clearing session..."),o(null),s?.());},[r?.address,i,o,s]),!r?.isConnected||!e?null:m==="SOLANA"?jsxRuntime.jsx(chunkRZ4TLBSP_js.a,{activeConnection:r,store:e,session:i,setSession:o,maxAge:n}):jsxRuntime.jsx(chunk7F6I4FHE_js.a,{activeConnection:r,store:e,wagmiConfig:d,session:i,setSession:o,maxAge:n})}Object.defineProperty(exports,"getMiniSessionAuth",{enumerable:true,get:function(){return chunkHVUZ52OX_js.b}});exports.QuasarAuthBridge=C;
package/dist/react.mjs CHANGED
@@ -1 +1 @@
1
- import {h}from'./chunk-SF2BM2YA.mjs';import {useWalletAccountMessageSigner}from'@solana/react';import {getWalletClient}from'@wagmi/core';import {useEffect,useRef,useCallback}from'react';import {jsx}from'react/jsx-runtime';var u=null;async function K(){for(let n=0;n<15;n++){if(u)return u();await new Promise(t=>setTimeout(t,200));}throw new Error("[QuasarSDK] Auth helper not initialized. Ensure QuasarAuthBridge is mounted and wallet is connected.")}function x({activeConnection:n,store:t,wagmiConfig:r,session:e,setSession:i,maxAge:o,onAddressMismatch:s}){let d=typeof n?.chainId=="string"?"SOLANA":"EVM";return useEffect(()=>{e&&n?.address&&e.walletAddress!==n.address&&(console.log("[QuasarSDK] Address mismatch detected, clearing session..."),i(null),s?.());},[n?.address,e,i,s]),!n?.isConnected||!t?null:d==="SOLANA"?jsx(M,{connectedAccount:n.connectedAccount,store:t,session:e,setSession:i,maxAge:o}):jsx(Q,{wagmiConfig:r,store:t,session:e,setSession:i,maxAge:o})}function M({connectedAccount:n,store:t,session:r,setSession:e,maxAge:i}){let o=useWalletAccountMessageSigner(n),s=useRef(o),c=useRef(r),d=useRef(e);useEffect(()=>{s.current=o;},[o]),useEffect(()=>{c.current=r;},[r]),useEffect(()=>{d.current=e;},[e]);let l=useCallback(async()=>{let g=t.getState().activeConnection;if(!g?.isConnected)throw new Error("[QuasarSDK] Wallet disconnected");let h$1=s.current;if(!h$1)throw new Error("[QuasarSDK] Solana Message Signer not initialized.");return h({isConnected:g.isConnected,address:g.address,chainType:"SOLANA",signer:h$1},{miniSession:c.current,setMiniSession:d.current},i)},[t,i]);return useEffect(()=>(u=l,()=>{u===l&&(u=null);}),[l]),null}function Q({wagmiConfig:n,store:t,session:r,setSession:e,maxAge:i}){let o=useRef(r),s=useRef(e);useEffect(()=>{o.current=r;},[r]),useEffect(()=>{s.current=e;},[e]);let c=useCallback(async()=>{let l=t.getState().activeConnection;if(!l?.isConnected)throw new Error("[QuasarSDK] Wallet disconnected");let A=await getWalletClient(n);if(!A)throw new Error("[QuasarSDK] EVM Signer not found");return h({isConnected:l.isConnected,address:l.address,chainType:"EVM",signer:A},{miniSession:o.current,setMiniSession:s.current},i)},[t,n,i]);return useEffect(()=>(u=c,()=>{u===c&&(u=null);}),[c]),null}export{x as QuasarAuthBridge,K as getMiniSessionAuth};
1
+ import {a as a$1}from'./chunk-EDXCZKX7.mjs';import {a}from'./chunk-ERWWKRPN.mjs';export{b as getMiniSessionAuth}from'./chunk-UW6TWEYM.mjs';import'./chunk-SF2BM2YA.mjs';import {useEffect}from'react';import {jsx}from'react/jsx-runtime';function C({activeConnection:r,store:e,wagmiConfig:d,session:i,setSession:o,maxAge:n,onAddressMismatch:s}){let m=typeof r?.chainId=="string"?"SOLANA":"EVM";return useEffect(()=>{i&&r?.address&&i.walletAddress!==r.address&&(console.log("[QuasarSDK] Address mismatch detected, clearing session..."),o(null),s?.());},[r?.address,i,o,s]),!r?.isConnected||!e?null:m==="SOLANA"?jsx(a,{activeConnection:r,store:e,session:i,setSession:o,maxAge:n}):jsx(a$1,{activeConnection:r,store:e,wagmiConfig:d,session:i,setSession:o,maxAge:n})}export{C as QuasarAuthBridge};
@@ -0,0 +1,35 @@
1
+ import { b as MiniSessionAuth } from './types-Ctaain6g.js';
2
+
3
+ /**
4
+ * @module react/shared
5
+ * @description Shared React-agnostic state and type definitions for Quasar React Bridges.
6
+ */
7
+
8
+ /**
9
+ * Structural interface for the active wallet connection state.
10
+ * Used to decoupling the SDK from specific library hooks.
11
+ *
12
+ * @public
13
+ */
14
+ interface QuasarActiveConnection {
15
+ /** Whether the wallet is currently connected. */
16
+ isConnected: boolean;
17
+ /** The active wallet address. */
18
+ address: string;
19
+ /** The chain ID (number for EVM, string for Solana). */
20
+ chainId: string | number;
21
+ /** The UiWalletAccount object (required for Solana signing). */
22
+ connectedAccount?: any;
23
+ }
24
+ /**
25
+ * Static utility to retrieve or trigger a Mini-Session authentication.
26
+ * This is the primary way for services outside the React tree to get an auth token.
27
+ *
28
+ * @returns A promise resolving to the valid Mini-Session Auth.
29
+ * @throws {Error} If the bridge is not mounted or the wallet is disconnected.
30
+ *
31
+ * @public
32
+ */
33
+ declare function getMiniSessionAuth(): Promise<MiniSessionAuth>;
34
+
35
+ export { type QuasarActiveConnection as Q, getMiniSessionAuth as g };
@@ -0,0 +1,35 @@
1
+ import { b as MiniSessionAuth } from './types-Ctaain6g.mjs';
2
+
3
+ /**
4
+ * @module react/shared
5
+ * @description Shared React-agnostic state and type definitions for Quasar React Bridges.
6
+ */
7
+
8
+ /**
9
+ * Structural interface for the active wallet connection state.
10
+ * Used to decoupling the SDK from specific library hooks.
11
+ *
12
+ * @public
13
+ */
14
+ interface QuasarActiveConnection {
15
+ /** Whether the wallet is currently connected. */
16
+ isConnected: boolean;
17
+ /** The active wallet address. */
18
+ address: string;
19
+ /** The chain ID (number for EVM, string for Solana). */
20
+ chainId: string | number;
21
+ /** The UiWalletAccount object (required for Solana signing). */
22
+ connectedAccount?: any;
23
+ }
24
+ /**
25
+ * Static utility to retrieve or trigger a Mini-Session authentication.
26
+ * This is the primary way for services outside the React tree to get an auth token.
27
+ *
28
+ * @returns A promise resolving to the valid Mini-Session Auth.
29
+ * @throws {Error} If the bridge is not mounted or the wallet is disconnected.
30
+ *
31
+ * @public
32
+ */
33
+ declare function getMiniSessionAuth(): Promise<MiniSessionAuth>;
34
+
35
+ export { type QuasarActiveConnection as Q, getMiniSessionAuth as g };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuwaio/quasar-sdk",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "private": false,
5
5
  "author": "Oleksandr Tkach",
6
6
  "license": "Apache-2.0",
@@ -18,6 +18,16 @@
18
18
  "types": "./dist/react.d.ts",
19
19
  "import": "./dist/react.mjs",
20
20
  "require": "./dist/react.js"
21
+ },
22
+ "./react/evm": {
23
+ "types": "./dist/react/evm.d.ts",
24
+ "import": "./dist/react/evm.mjs",
25
+ "require": "./dist/react/evm.js"
26
+ },
27
+ "./react/solana": {
28
+ "types": "./dist/react/solana.d.ts",
29
+ "import": "./dist/react/solana.mjs",
30
+ "require": "./dist/react/solana.js"
21
31
  }
22
32
  },
23
33
  "publishConfig": {