LazorKit LogoLazorKit
React SDK

Types

TypeScript interfaces, constants, and the SpendingLimits wrapper.

All public types from @lazorkit/wallet, grouped by what you're doing.

Wallet state

WalletInfo

interface WalletInfo {
  credentialId: string;        // WebAuthn credential ID (base64)
  passkeyPubkey: number[];     // 33-byte compressed secp256r1 pubkey

  /** Wallet PDA — internal authority account (used for signing context). */
  smartWallet: string;

  /** Vault PDA — the SOL-holding account users deposit into. base58. */
  vaultPda?: string;

  walletDevice: string;        // authority PDA for the active passkey
  platform: string;            // 'macIntel' | 'linux' | …
  expo: string;                // 'web' for React SDK
  accountName?: string;        // optional WebAuthn display name
}

smartWallet ≠ vaultPda

smartWallet is the internal Wallet PDA (used by the program for authority lookup). Funds live at vaultPda — that's what you pass as fromPubkey for transfers and what users should see / fund. Derive it with findVaultPda(walletPda) if the field is missing on an older cached WalletInfo.

LazorkitProviderProps

interface LazorkitProviderProps {
  children: ReactNode;
  rpcUrl?: string;
  portalUrl?: string;
  paymasterConfig?: PaymasterConfig;
}

interface PaymasterConfig {
  paymasterUrl: string;
  apiKey?: string;
}

Transaction payloads

interface TransactionOptions {
  feeToken?: string;                                       // SPL mint base58
  addressLookupTableAccounts?: AddressLookupTableAccount[];// v0 only
  computeUnitLimit?: number;
  clusterSimulation?: 'devnet' | 'mainnet';
  /** Wire format. Defaults to 'v0'. */
  txVersion?: 'legacy' | 'v0';
}

SendTxPayload

Shared payload shape for every send-tx method on the hook — signAndSendTransaction, signAndSendWithSession, signAndSendWithAuthority, authorizeAndExecute, and authorizeDeferred.

interface SendTxPayload {
  instructions: TransactionInstruction[];
  transactionOptions?: TransactionOptions;
}

SignAndSendTransactionPayload

Internal alias for SendTxPayload used by the action layer. Adds optional callbacks when calling actions directly (outside the React hook):

interface SignAndSendTransactionPayload extends SendTxPayload {
  onSuccess?: (signature: string) => void;
  onFail?: (error: Error) => void;
}

Deferred execution payloads

Returned/consumed by authorizeDeferred and executeDeferred.

AuthorizeDeferredPayload

interface AuthorizeDeferredPayload {
  instructions: TransactionInstruction[];
  transactionOptions?: TransactionOptions;
  onSuccess?: (result: { signature: string; deferredPayload: string }) => void;
  onFail?: (error: Error) => void;
}

ExecuteDeferredPayload

interface ExecuteDeferredPayload {
  /** Serialized DeferredPayload string returned by authorizeDeferred. */
  deferredPayload: string;
  transactionOptions?: TransactionOptions;
  onSuccess?: (signature: string) => void;
  onFail?: (error: Error) => void;
}

DeferredPayload

Internal representation of what TX1 registered on-chain. The SDK converts to/from its wire form via serializeDeferredPayload / deserializeDeferredPayload.

interface DeferredPayload {
  walletPda: PublicKey;
  deferredExecPda: PublicKey;
  compactInstructions: {
    programIdIndex: number;
    accountIndexes: number[];
    data: Uint8Array;
  }[];
  remainingAccounts: {
    pubkey: PublicKey;
    isSigner: boolean;
    isWritable: boolean;
  }[];
}

// Wire helpers — re-exported from '@lazorkit/wallet'
serializeDeferredPayload(p: DeferredPayload): string;
deserializeDeferredPayload(s: string): DeferredPayload;

Session payloads

interface CreateSessionPayload {
  expiresInSlots?: bigint;
  spendingLimits?: SpendingLimits;
  onSuccess?: (sessionPda: string, sessionPublicKey: string) => void;
  onFail?: (error: Error) => void;
}

interface RevokeSessionPayload {
  onSuccess?: () => void;
  onFail?: (error: Error) => void;
}

SpendingLimits

High-level wrapper around the on-chain action catalogue. Every field is optional — omitted limits mean "no cap" on that axis. The SDK translates SpendingLimits into concrete SessionAction[] before submission.

interface SpendingLimits {
  /** Lifetime SOL cap (lamports) — session dies once spent. */
  solLifetimeCap?: bigint;

  /** Maximum lamports per single execute. */
  solPerTxMax?: bigint;

  /** SOL cap that resets every `windowSlots` slots. */
  solRecurring?: {
    limit: bigint;
    windowSlots: bigint;
  };
}

Need token or program limits?

The high-level SpendingLimits covers SOL. For token caps, program whitelisting, or per-action expiries, drop to the raw SessionAction catalogue via LazorKitClient.createSession directly.

Common windows

windowSlotsMinutesHoursDays
9_000n601
54_000n6
216_000n1
1_512_000n7

Slot time ≈ 400 ms — these are approximations. Use on-chain clock math for precise enforcement windows.


Authority payloads

interface AddAuthorityPayload {
  role?: number;                        // ROLE_ADMIN (1) | ROLE_SPENDER (2, default)
  onSuccess?: (authorityPda: string, authorityPublicKey: string) => void;
  onFail?: (error: Error) => void;
}

removeAuthority takes a single positional targetAuthorityPda: string.


Roles & auth types

export const ROLE_OWNER   = 0;   // can transfer ownership
export const ROLE_ADMIN   = 1;   // manage authorities + sessions
export const ROLE_SPENDER = 2;   // execute only

export const AUTH_TYPE_ED25519   = 0;
export const AUTH_TYPE_SECP256R1 = 1;

Low-level SessionAction

Drop-down to the raw action catalogue when SpendingLimits isn't expressive enough (token caps, program filters, per-action expiries). Pass SessionAction[] when calling LazorKitClient.createSession directly.

enum SessionActionType {
  SolLimit            = 1,
  SolRecurringLimit   = 2,
  SolMaxPerTx         = 3,
  TokenLimit          = 4,
  TokenRecurringLimit = 5,
  TokenMaxPerTx       = 6,
  ProgramWhitelist    = 10,
  ProgramBlacklist    = 11,
}

import { Actions } from '@lazorkit/wallet';

Actions.solLimit(lamports, expiresAt?)
Actions.solRecurringLimit({ limit, window, expiresAt? })
Actions.solMaxPerTx(lamports, expiresAt?)

Actions.tokenLimit({ mint, remaining, expiresAt? })
Actions.tokenRecurringLimit({ mint, limit, window, expiresAt? })
Actions.tokenMaxPerTx({ mint, max, expiresAt? })

Actions.programWhitelist(programId, expiresAt?)
Actions.programBlacklist(programId, expiresAt?)

Hook interface

Full return type of useWallet:

interface WalletHookInterface {
  // State
  smartWalletPubkey: PublicKey | null;
  wallet: WalletInfo | null;
  isConnected: boolean;
  isLoading: boolean;
  isConnecting: boolean;
  isSigning: boolean;
  error: Error | null;

  // Core
  connect: (options?: { feeMode?: 'paymaster' | 'user' }) => Promise<WalletInfo>;
  disconnect: () => Promise<void>;
  signAndSendTransaction: (payload: SendTxPayload) => Promise<string>;
  signMessage: (message: string) => Promise<{ signature: string; signedPayload: string }>;
  verifyMessage: (args: {
    signedPayload: Uint8Array;
    signature: Uint8Array;
    publicKey: Uint8Array;
  }) => Promise<boolean>;

  // Session
  createSession: (payload?: {
    expiresInSlots?: bigint;
    spendingLimits?: SpendingLimits;
  }) => Promise<{ sessionPda: string; sessionPublicKey: string }>;
  revokeSession: () => Promise<void>;
  signAndSendWithSession: (payload: SendTxPayload) => Promise<string>;

  // Authority
  addAuthority: (payload?: { role?: number }) => Promise<{
    authorityPda: string;
    authorityPublicKey: string;
  }>;
  removeAuthority: (targetAuthorityPda: string) => Promise<void>;
  signAndSendWithAuthority: (payload: SendTxPayload) => Promise<string>;

  // Deferred execution
  authorizeAndExecute: (payload: SendTxPayload) => Promise<string>;
  authorizeDeferred: (payload: SendTxPayload) => Promise<{
    signature: string;
    deferredPayload: string;
  }>;
  executeDeferred: (payload: {
    deferredPayload: string;
    transactionOptions?: TransactionOptions;
  }) => Promise<string>;
}