@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 +46 -3
- package/dist/chunk-7F6I4FHE.js +1 -0
- package/dist/chunk-EDXCZKX7.mjs +1 -0
- package/dist/chunk-ERWWKRPN.mjs +1 -0
- package/dist/chunk-HVUZ52OX.js +1 -0
- package/dist/chunk-RZ4TLBSP.js +1 -0
- package/dist/chunk-UW6TWEYM.mjs +1 -0
- package/dist/react/evm.d.mts +56 -0
- package/dist/react/evm.d.ts +56 -0
- package/dist/react/evm.js +1 -0
- package/dist/react/evm.mjs +1 -0
- package/dist/react/solana.d.mts +52 -0
- package/dist/react/solana.d.ts +52 -0
- package/dist/react/solana.js +1 -0
- package/dist/react/solana.mjs +1 -0
- package/dist/react.d.mts +12 -46
- package/dist/react.d.ts +12 -46
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/dist/shared-BeprN_w-.d.ts +35 -0
- package/dist/shared-CFhEPXTt.d.mts +35 -0
- package/package.json +11 -1
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
|
|
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 {
|
|
53
|
+
import { QuasarEvmAuthBridge } from '@tuwaio/quasar-sdk/react/evm';
|
|
50
54
|
|
|
51
55
|
function MyApp() {
|
|
52
56
|
return (
|
|
53
|
-
<
|
|
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
|
-
*
|
|
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
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
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
|
-
*
|
|
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 {
|
|
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
|
-
*
|
|
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
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
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
|
-
*
|
|
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 {
|
|
60
|
+
export { QuasarActiveConnection, QuasarAuthBridge, type QuasarAuthBridgeProps };
|
package/dist/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
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 {
|
|
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.
|
|
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": {
|