@tuwaio/quasar-sdk 0.0.18 → 0.1.1
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 +56 -166
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +69 -170
- package/dist/index.d.ts +69 -170
- package/dist/index.js +2 -1
- package/package.json +9 -55
- package/dist/chunk-C3D4A4ZL.cjs +0 -1
- package/dist/chunk-C6JAMIC3.js +0 -1
- package/dist/chunk-GZ7OST4D.js +0 -1
- package/dist/chunk-NJH5FYLU.cjs +0 -2
- package/dist/chunk-RSHZA2NR.js +0 -1
- package/dist/chunk-UIDJZGQ7.cjs +0 -1
- package/dist/chunk-VABKD4LZ.js +0 -1
- package/dist/chunk-VLHVLJGE.cjs +0 -1
- package/dist/chunk-YPUBFZPR.js +0 -2
- package/dist/chunk-YUZXHNP6.cjs +0 -1
- package/dist/react/evm.cjs +0 -1
- package/dist/react/evm.d.cts +0 -56
- package/dist/react/evm.d.ts +0 -56
- package/dist/react/evm.js +0 -1
- package/dist/react/shared.cjs +0 -1
- package/dist/react/shared.d.cts +0 -59
- package/dist/react/shared.d.ts +0 -59
- package/dist/react/shared.js +0 -1
- package/dist/react/solana.cjs +0 -1
- package/dist/react/solana.d.cts +0 -52
- package/dist/react/solana.d.ts +0 -52
- package/dist/react/solana.js +0 -1
- package/dist/react.cjs +0 -1
- package/dist/react.d.cts +0 -60
- package/dist/react.d.ts +0 -60
- package/dist/react.js +0 -1
- package/dist/types-C4cwIvHT.d.cts +0 -190
- package/dist/types-C4cwIvHT.d.ts +0 -190
package/dist/chunk-GZ7OST4D.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {h}from'./chunk-C6JAMIC3.js';import {b}from'./chunk-RSHZA2NR.js';import {getWalletClient}from'@wagmi/core';import {useEffect,useRef,useCallback}from'react';import {jsx}from'react/jsx-runtime';function D({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(()=>(b(l),()=>{b(null);}),[l]),null}export{D as a};
|
package/dist/chunk-NJH5FYLU.cjs
DELETED
package/dist/chunk-RSHZA2NR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-YPUBFZPR.js';var r=null;function a(e){r=e;}async function o(){for(let e=0;e<15;e++){if(r)return r();await new Promise(n=>setTimeout(n,200));}throw new Error("[QuasarSDK] Auth helper not initialized. Ensure QuasarAuthBridge is mounted and wallet is connected.")}async function u(e){await o();let n=e||a$1;try{let t=await fetch(`${n}/v1/engine/monitoring/health`,{method:"GET",cache:"no-store"});if(!t.ok)throw new Error(`[QuasarSDK] API Health check failed with status: ${t.status}`)}catch(t){throw new Error("[QuasarSDK] Quasar Cloud Engine is currently unreachable.",{cause:t})}}export{r as a,a as b,o as c,u as d};
|
package/dist/chunk-UIDJZGQ7.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var zustand=require('zustand'),middleware=require('zustand/middleware');var m=(t=>(t.EVM="EVM",t.SOLANA="SOLANA",t))(m||{});var u=300*1e3,w=60*1e3,y=30*1e3;function f(e){return `Mini-Session Login: ${e}`}async function p(e){let r=new Date().toISOString(),t=f(r);if(e.chainType==="EVM"){let i=e.signer;try{return {signature:await i.signMessage({account:e.walletAddress,message:t}),timestamp:r}}catch(n){throw new Error(`[SDK] EVM signing failed: ${n.message}`,{cause:n})}}if(e.chainType==="SOLANA"){let i=e.signer,n;try{n=await import('gill');}catch(s){throw new Error('[SDK] Peer dependency "gill" is required for Solana signing.',{cause:s})}try{let a=n.getUtf8Encoder().encode(t),o;if(i.modifyAndSignMessages){let g=n.createSignableMessage(a),d=(await i.modifyAndSignMessages([g]))[0].signatures[i.address];if(!d)throw new Error(`[SDK] Signature missing for address: ${i.address}`);o=d;}else if(i.signMessages){let S=(await i.signMessages([a]))[0];if(!S?.signature)throw new Error("[SDK] Wallet returned invalid signMessages output.");o=S.signature;}else if(i.signMessage)o=await i.signMessage(a);else throw new Error("[SDK] Signer lacks message signing capabilities.");return {signature:n.getSignatureFromBytes(o),timestamp:r}}catch(s){throw new Error(`[SDK] Solana signing failed: ${s.message}`,{cause:s})}}throw new Error(`[SDK] Unsupported chain type: ${e.chainType}`)}async function v(e){let r=new Date(e.timestamp).getTime(),t=Date.now();if(isNaN(r))throw new Error("[SDK] Invalid timestamp format. Use ISO string.");let i=e.maxAge??u;if(t-r>i)throw new Error("[SDK] Signature expired. Please sign a fresh message.");if(r>t+w)throw new Error("[SDK] Timestamp is in the future. Check your system clock.");let n=f(e.timestamp);if(e.chainType==="EVM"){let s;try{s=await import('viem');}catch(a){throw new Error('[SDK] Peer dependency "viem" is required for EVM verification.',{cause:a})}return await s.verifyMessage({address:e.walletAddress,message:n,signature:e.signature})}if(e.chainType==="SOLANA"){let s;try{s=await import('gill');}catch(a){throw new Error('[SDK] Peer dependency "gill" is required for Solana verification.',{cause:a})}try{let a=s.address(e.walletAddress);return await s.verifySignatureForAddress(a,e.signature,n)}catch{return false}}return false}var c=null;function C(e="mini-session-storage"){return zustand.create()(middleware.persist(r=>({miniSession:null,setMiniSession:t=>r({miniSession:t}),clearSession:()=>r({miniSession:null})}),{name:e}))}async function N(e,r,t=u){let{isConnected:i,address:n,chainType:s,signer:a}=e;if(!i||!n)throw new Error("[SDK] Wallet not connected. Please connect your wallet first.");let o=r.miniSession;if(o&&o.walletAddress===n&&o.chainType===s){let l=Date.now(),g=new Date(o.timestamp).getTime();if(l-g<t-y)return o}return c||(c=p({signer:a,walletAddress:n,chainType:s}).then(l=>{let g={...l,chainType:s,walletAddress:n};return r.setMiniSession(g),g}).finally(()=>{c=null;})),c}exports.a=m;exports.b=u;exports.c=y;exports.d=f;exports.e=p;exports.f=v;exports.g=C;exports.h=N;
|
package/dist/chunk-VABKD4LZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {h}from'./chunk-C6JAMIC3.js';import {b}from'./chunk-RSHZA2NR.js';import {useWalletAccountMessageSigner}from'@solana/react';import {useEffect,useRef,useCallback}from'react';import {jsx}from'react/jsx-runtime';function P({activeConnection:n,store:i,session:e,setSession:t,maxAge:s,onAddressMismatch:r}){return useEffect(()=>{e&&n?.address&&e.walletAddress!==n.address&&(console.log("[QuasarSDK] Address mismatch detected, clearing session..."),t(null),r?.());},[n?.address,e,t,r]),!n?.isConnected||!i?null:jsx(p,{connectedAccount:n.connectedAccount,store:i,session:e,setSession:t,maxAge:s})}function p({connectedAccount:n,store:i,session:e,setSession:t,maxAge:s}){let r=useWalletAccountMessageSigner(n),c=useRef(r),d=useRef(e),A=useRef(t);useEffect(()=>{c.current=r;},[r]),useEffect(()=>{d.current=e;},[e]),useEffect(()=>{A.current=t;},[t]);let S=useCallback(async()=>{let a=i.getState().activeConnection;if(!a?.isConnected)throw new Error("[QuasarSDK] Wallet disconnected");let g=c.current;if(!g)throw new Error("[QuasarSDK] Solana Message Signer not initialized.");return h({isConnected:a.isConnected,address:a.address,chainType:"SOLANA",signer:g},{miniSession:d.current,setMiniSession:A.current},s)},[i,s]);return useEffect(()=>(b(S),()=>{b(null);}),[S]),null}export{P as a};
|
package/dist/chunk-VLHVLJGE.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkUIDJZGQ7_cjs=require('./chunk-UIDJZGQ7.cjs'),chunkC3D4A4ZL_cjs=require('./chunk-C3D4A4ZL.cjs'),core=require('@wagmi/core'),react=require('react'),jsxRuntime=require('react/jsx-runtime');function D({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 chunkUIDJZGQ7_cjs.h({isConnected:u.isConnected,address:u.address,chainType:"EVM",signer:d},{miniSession:s.current,setMiniSession:o.current},t)},[i,n,t]);return react.useEffect(()=>(chunkC3D4A4ZL_cjs.b(l),()=>{chunkC3D4A4ZL_cjs.b(null);}),[l]),null}exports.a=D;
|
package/dist/chunk-YPUBFZPR.js
DELETED
package/dist/chunk-YUZXHNP6.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkUIDJZGQ7_cjs=require('./chunk-UIDJZGQ7.cjs'),chunkC3D4A4ZL_cjs=require('./chunk-C3D4A4ZL.cjs'),react$1=require('@solana/react'),react=require('react'),jsxRuntime=require('react/jsx-runtime');function P({activeConnection:n,store:i,session:e,setSession:t,maxAge:s,onAddressMismatch:r}){return react.useEffect(()=>{e&&n?.address&&e.walletAddress!==n.address&&(console.log("[QuasarSDK] Address mismatch detected, clearing session..."),t(null),r?.());},[n?.address,e,t,r]),!n?.isConnected||!i?null:jsxRuntime.jsx(p,{connectedAccount:n.connectedAccount,store:i,session:e,setSession:t,maxAge:s})}function p({connectedAccount:n,store:i,session:e,setSession:t,maxAge:s}){let r=react$1.useWalletAccountMessageSigner(n),c=react.useRef(r),d=react.useRef(e),A=react.useRef(t);react.useEffect(()=>{c.current=r;},[r]),react.useEffect(()=>{d.current=e;},[e]),react.useEffect(()=>{A.current=t;},[t]);let S=react.useCallback(async()=>{let a=i.getState().activeConnection;if(!a?.isConnected)throw new Error("[QuasarSDK] Wallet disconnected");let g=c.current;if(!g)throw new Error("[QuasarSDK] Solana Message Signer not initialized.");return chunkUIDJZGQ7_cjs.h({isConnected:a.isConnected,address:a.address,chainType:"SOLANA",signer:g},{miniSession:d.current,setMiniSession:A.current},s)},[i,s]);return react.useEffect(()=>(chunkC3D4A4ZL_cjs.b(S),()=>{chunkC3D4A4ZL_cjs.b(null);}),[S]),null}exports.a=P;
|
package/dist/react/evm.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkVLHVLJGE_cjs=require('../chunk-VLHVLJGE.cjs');require('../chunk-UIDJZGQ7.cjs');var chunkC3D4A4ZL_cjs=require('../chunk-C3D4A4ZL.cjs');require('../chunk-NJH5FYLU.cjs');Object.defineProperty(exports,"QuasarEvmAuthBridge",{enumerable:true,get:function(){return chunkVLHVLJGE_cjs.a}});Object.defineProperty(exports,"getMiniSessionAuth",{enumerable:true,get:function(){return chunkC3D4A4ZL_cjs.c}});Object.defineProperty(exports,"preFlightTxCheck",{enumerable:true,get:function(){return chunkC3D4A4ZL_cjs.d}});
|
package/dist/react/evm.d.cts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { Config } from '@wagmi/core';
|
|
3
|
-
import { StoreApi } from 'zustand';
|
|
4
|
-
import { b as MiniSessionAuth } from '../types-C4cwIvHT.cjs';
|
|
5
|
-
import { QuasarActiveConnection } from './shared.cjs';
|
|
6
|
-
export { getMiniSessionAuth, preFlightTxCheck } from './shared.cjs';
|
|
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.Element | null;
|
|
55
|
-
|
|
56
|
-
export { QuasarActiveConnection, QuasarEvmAuthBridge, type QuasarEvmAuthBridgeProps };
|
package/dist/react/evm.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { Config } from '@wagmi/core';
|
|
3
|
-
import { StoreApi } from 'zustand';
|
|
4
|
-
import { b as MiniSessionAuth } from '../types-C4cwIvHT.js';
|
|
5
|
-
import { QuasarActiveConnection } from './shared.js';
|
|
6
|
-
export { getMiniSessionAuth, preFlightTxCheck } from './shared.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.Element | null;
|
|
55
|
-
|
|
56
|
-
export { QuasarActiveConnection, QuasarEvmAuthBridge, type QuasarEvmAuthBridgeProps };
|
package/dist/react/evm.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as QuasarEvmAuthBridge}from'../chunk-GZ7OST4D.js';import'../chunk-C6JAMIC3.js';export{c as getMiniSessionAuth,d as preFlightTxCheck}from'../chunk-RSHZA2NR.js';import'../chunk-YPUBFZPR.js';
|
package/dist/react/shared.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkC3D4A4ZL_cjs=require('../chunk-C3D4A4ZL.cjs');require('../chunk-NJH5FYLU.cjs');Object.defineProperty(exports,"authHelperReference",{enumerable:true,get:function(){return chunkC3D4A4ZL_cjs.a}});Object.defineProperty(exports,"getMiniSessionAuth",{enumerable:true,get:function(){return chunkC3D4A4ZL_cjs.c}});Object.defineProperty(exports,"preFlightTxCheck",{enumerable:true,get:function(){return chunkC3D4A4ZL_cjs.d}});Object.defineProperty(exports,"setAuthHelperReference",{enumerable:true,get:function(){return chunkC3D4A4ZL_cjs.b}});
|
package/dist/react/shared.d.cts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { b as MiniSessionAuth } from '../types-C4cwIvHT.cjs';
|
|
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
|
-
* A static reference to the current auth helper.
|
|
26
|
-
* This allows non-React code (like Pulsar sync) to trigger authentication.
|
|
27
|
-
*
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
30
|
-
declare let authHelperReference: (() => Promise<MiniSessionAuth>) | null;
|
|
31
|
-
/**
|
|
32
|
-
* Sets the static reference to the authentication helper.
|
|
33
|
-
*
|
|
34
|
-
* @param ref - The authentication helper callback function, or null.
|
|
35
|
-
* @internal
|
|
36
|
-
*/
|
|
37
|
-
declare function setAuthHelperReference(ref: (() => Promise<MiniSessionAuth>) | null): void;
|
|
38
|
-
/**
|
|
39
|
-
* Static utility to retrieve or trigger a Mini-Session authentication.
|
|
40
|
-
* This is the primary way for services outside the React tree to get an auth token.
|
|
41
|
-
*
|
|
42
|
-
* @returns A promise resolving to the valid Mini-Session Auth.
|
|
43
|
-
* @throws {Error} If the bridge is not mounted or the wallet is disconnected.
|
|
44
|
-
*
|
|
45
|
-
* @public
|
|
46
|
-
*/
|
|
47
|
-
declare function getMiniSessionAuth(): Promise<MiniSessionAuth>;
|
|
48
|
-
/**
|
|
49
|
-
* Pre-flight check before initiating a transaction.
|
|
50
|
-
* Ensures the local Mini-Session is valid (or prompts for one) and verifies Quasar Engine health.
|
|
51
|
-
*
|
|
52
|
-
* @param customApiUrl - Optional custom API URL to override the default.
|
|
53
|
-
* @throws {Error} If the session check fails or Quasar is unreachable.
|
|
54
|
-
*
|
|
55
|
-
* @public
|
|
56
|
-
*/
|
|
57
|
-
declare function preFlightTxCheck(customApiUrl?: string): Promise<void>;
|
|
58
|
-
|
|
59
|
-
export { type QuasarActiveConnection, authHelperReference, getMiniSessionAuth, preFlightTxCheck, setAuthHelperReference };
|
package/dist/react/shared.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { b as MiniSessionAuth } from '../types-C4cwIvHT.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
|
-
* A static reference to the current auth helper.
|
|
26
|
-
* This allows non-React code (like Pulsar sync) to trigger authentication.
|
|
27
|
-
*
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
30
|
-
declare let authHelperReference: (() => Promise<MiniSessionAuth>) | null;
|
|
31
|
-
/**
|
|
32
|
-
* Sets the static reference to the authentication helper.
|
|
33
|
-
*
|
|
34
|
-
* @param ref - The authentication helper callback function, or null.
|
|
35
|
-
* @internal
|
|
36
|
-
*/
|
|
37
|
-
declare function setAuthHelperReference(ref: (() => Promise<MiniSessionAuth>) | null): void;
|
|
38
|
-
/**
|
|
39
|
-
* Static utility to retrieve or trigger a Mini-Session authentication.
|
|
40
|
-
* This is the primary way for services outside the React tree to get an auth token.
|
|
41
|
-
*
|
|
42
|
-
* @returns A promise resolving to the valid Mini-Session Auth.
|
|
43
|
-
* @throws {Error} If the bridge is not mounted or the wallet is disconnected.
|
|
44
|
-
*
|
|
45
|
-
* @public
|
|
46
|
-
*/
|
|
47
|
-
declare function getMiniSessionAuth(): Promise<MiniSessionAuth>;
|
|
48
|
-
/**
|
|
49
|
-
* Pre-flight check before initiating a transaction.
|
|
50
|
-
* Ensures the local Mini-Session is valid (or prompts for one) and verifies Quasar Engine health.
|
|
51
|
-
*
|
|
52
|
-
* @param customApiUrl - Optional custom API URL to override the default.
|
|
53
|
-
* @throws {Error} If the session check fails or Quasar is unreachable.
|
|
54
|
-
*
|
|
55
|
-
* @public
|
|
56
|
-
*/
|
|
57
|
-
declare function preFlightTxCheck(customApiUrl?: string): Promise<void>;
|
|
58
|
-
|
|
59
|
-
export { type QuasarActiveConnection, authHelperReference, getMiniSessionAuth, preFlightTxCheck, setAuthHelperReference };
|
package/dist/react/shared.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as authHelperReference,c as getMiniSessionAuth,d as preFlightTxCheck,b as setAuthHelperReference}from'../chunk-RSHZA2NR.js';import'../chunk-YPUBFZPR.js';
|
package/dist/react/solana.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkYUZXHNP6_cjs=require('../chunk-YUZXHNP6.cjs');require('../chunk-UIDJZGQ7.cjs');var chunkC3D4A4ZL_cjs=require('../chunk-C3D4A4ZL.cjs');require('../chunk-NJH5FYLU.cjs');Object.defineProperty(exports,"QuasarSolanaAuthBridge",{enumerable:true,get:function(){return chunkYUZXHNP6_cjs.a}});Object.defineProperty(exports,"getMiniSessionAuth",{enumerable:true,get:function(){return chunkC3D4A4ZL_cjs.c}});Object.defineProperty(exports,"preFlightTxCheck",{enumerable:true,get:function(){return chunkC3D4A4ZL_cjs.d}});
|
package/dist/react/solana.d.cts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { StoreApi } from 'zustand';
|
|
3
|
-
import { b as MiniSessionAuth } from '../types-C4cwIvHT.cjs';
|
|
4
|
-
import { QuasarActiveConnection } from './shared.cjs';
|
|
5
|
-
export { getMiniSessionAuth, preFlightTxCheck } from './shared.cjs';
|
|
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.Element | null;
|
|
51
|
-
|
|
52
|
-
export { QuasarActiveConnection, QuasarSolanaAuthBridge, type QuasarSolanaAuthBridgeProps };
|
package/dist/react/solana.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { StoreApi } from 'zustand';
|
|
3
|
-
import { b as MiniSessionAuth } from '../types-C4cwIvHT.js';
|
|
4
|
-
import { QuasarActiveConnection } from './shared.js';
|
|
5
|
-
export { getMiniSessionAuth, preFlightTxCheck } from './shared.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.Element | null;
|
|
51
|
-
|
|
52
|
-
export { QuasarActiveConnection, QuasarSolanaAuthBridge, type QuasarSolanaAuthBridgeProps };
|
package/dist/react/solana.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as QuasarSolanaAuthBridge}from'../chunk-VABKD4LZ.js';import'../chunk-C6JAMIC3.js';export{c as getMiniSessionAuth,d as preFlightTxCheck}from'../chunk-RSHZA2NR.js';import'../chunk-YPUBFZPR.js';
|
package/dist/react.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkVLHVLJGE_cjs=require('./chunk-VLHVLJGE.cjs'),chunkYUZXHNP6_cjs=require('./chunk-YUZXHNP6.cjs');require('./chunk-UIDJZGQ7.cjs');var chunkC3D4A4ZL_cjs=require('./chunk-C3D4A4ZL.cjs');require('./chunk-NJH5FYLU.cjs');var react=require('react'),jsxRuntime=require('react/jsx-runtime');function x({activeConnection:r,store:o,wagmiConfig:d,session:i,setSession:e,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..."),e(null),s?.());},[r?.address,i,e,s]),!r?.isConnected||!o?null:m==="SOLANA"?jsxRuntime.jsx(chunkYUZXHNP6_cjs.a,{activeConnection:r,store:o,session:i,setSession:e,maxAge:n}):jsxRuntime.jsx(chunkVLHVLJGE_cjs.a,{activeConnection:r,store:o,wagmiConfig:d,session:i,setSession:e,maxAge:n})}Object.defineProperty(exports,"getMiniSessionAuth",{enumerable:true,get:function(){return chunkC3D4A4ZL_cjs.c}});Object.defineProperty(exports,"preFlightTxCheck",{enumerable:true,get:function(){return chunkC3D4A4ZL_cjs.d}});exports.QuasarAuthBridge=x;
|
package/dist/react.d.cts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { Config } from '@wagmi/core';
|
|
3
|
-
import { StoreApi } from 'zustand';
|
|
4
|
-
import { b as MiniSessionAuth } from './types-C4cwIvHT.cjs';
|
|
5
|
-
import { QuasarActiveConnection } from './react/shared.cjs';
|
|
6
|
-
export { getMiniSessionAuth, preFlightTxCheck } from './react/shared.cjs';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Props for the unified QuasarAuthBridge component.
|
|
10
|
-
*
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
interface QuasarAuthBridgeProps {
|
|
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 Unified Quasar Authentication Bridge.
|
|
35
|
-
*
|
|
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`
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```tsx
|
|
45
|
-
* import { QuasarAuthBridge } from '@tuwaio/quasar-sdk/react';
|
|
46
|
-
*
|
|
47
|
-
* <QuasarAuthBridge
|
|
48
|
-
* activeConnection={activeConnection}
|
|
49
|
-
* store={store}
|
|
50
|
-
* wagmiConfig={config}
|
|
51
|
-
* session={auth.miniSession}
|
|
52
|
-
* setSession={auth.setMiniSession}
|
|
53
|
-
* />
|
|
54
|
-
* ```
|
|
55
|
-
*
|
|
56
|
-
* @public
|
|
57
|
-
*/
|
|
58
|
-
declare function QuasarAuthBridge({ activeConnection, store, wagmiConfig, session, setSession, maxAge, onAddressMismatch, }: QuasarAuthBridgeProps): react.JSX.Element | null;
|
|
59
|
-
|
|
60
|
-
export { QuasarActiveConnection, QuasarAuthBridge, type QuasarAuthBridgeProps };
|
package/dist/react.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { Config } from '@wagmi/core';
|
|
3
|
-
import { StoreApi } from 'zustand';
|
|
4
|
-
import { b as MiniSessionAuth } from './types-C4cwIvHT.js';
|
|
5
|
-
import { QuasarActiveConnection } from './react/shared.js';
|
|
6
|
-
export { getMiniSessionAuth, preFlightTxCheck } from './react/shared.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Props for the unified QuasarAuthBridge component.
|
|
10
|
-
*
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
interface QuasarAuthBridgeProps {
|
|
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 Unified Quasar Authentication Bridge.
|
|
35
|
-
*
|
|
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`
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```tsx
|
|
45
|
-
* import { QuasarAuthBridge } from '@tuwaio/quasar-sdk/react';
|
|
46
|
-
*
|
|
47
|
-
* <QuasarAuthBridge
|
|
48
|
-
* activeConnection={activeConnection}
|
|
49
|
-
* store={store}
|
|
50
|
-
* wagmiConfig={config}
|
|
51
|
-
* session={auth.miniSession}
|
|
52
|
-
* setSession={auth.setMiniSession}
|
|
53
|
-
* />
|
|
54
|
-
* ```
|
|
55
|
-
*
|
|
56
|
-
* @public
|
|
57
|
-
*/
|
|
58
|
-
declare function QuasarAuthBridge({ activeConnection, store, wagmiConfig, session, setSession, maxAge, onAddressMismatch, }: QuasarAuthBridgeProps): react.JSX.Element | null;
|
|
59
|
-
|
|
60
|
-
export { QuasarActiveConnection, QuasarAuthBridge, type QuasarAuthBridgeProps };
|
package/dist/react.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-GZ7OST4D.js';import {a}from'./chunk-VABKD4LZ.js';import'./chunk-C6JAMIC3.js';export{c as getMiniSessionAuth,d as preFlightTxCheck}from'./chunk-RSHZA2NR.js';import'./chunk-YPUBFZPR.js';import {useEffect}from'react';import {jsx}from'react/jsx-runtime';function x({activeConnection:r,store:o,wagmiConfig:d,session:i,setSession:e,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..."),e(null),s?.());},[r?.address,i,e,s]),!r?.isConnected||!o?null:m==="SOLANA"?jsx(a,{activeConnection:r,store:o,session:i,setSession:e,maxAge:n}):jsx(a$1,{activeConnection:r,store:o,wagmiConfig:d,session:i,setSession:e,maxAge:n})}export{x as QuasarAuthBridge};
|