Skip to Content

@cfxdevkit/wallet-connect


@cfxdevkit/wallet-connect / AuthCtx

Interface: AuthCtx

Defined in: auth-context.tsx:37

Properties

address

address: string | null

Defined in: auth-context.tsx:41

Checksummed wallet address, null when not connected.


error

error: string | null

Defined in: auth-context.tsx:47

Last login error message (e.g. “User rejected request”).


isAuthenticated

isAuthenticated: boolean

Defined in: auth-context.tsx:45

True when token is non-null and wallet is connected.


isLoading

isLoading: boolean

Defined in: auth-context.tsx:43

True while the SIWE nonce-fetch → sign → verify round-trip is in progress.


login()

login: () => Promise<boolean>

Defined in: auth-context.tsx:49

Manually trigger SIWE login (e.g. retry after rejection). Returns true on success.

Returns

Promise<boolean>


logout()

logout: () => void

Defined in: auth-context.tsx:51

Clear JWT + disconnect wallet.

Returns

void


refreshAuth()

refreshAuth: () => void

Defined in: auth-context.tsx:58

Clear the stored JWT and reset the auto-sign guard so a fresh SIWE is triggered on the next render cycle. Call this when any API request returns 401 (expired or invalid token) to transparently re-authenticate the same wallet without the user having to do anything manually.

Returns

void


token

token: string | null

Defined in: auth-context.tsx:39

Persisted JWT, null when not authenticated.