TypeScript Types
All types below are exported from @veridex/sdk and available via:
import type { TransferParams, VeridexConfig, PasskeyCredential /* ... */ } from '@veridex/sdk';Configuration
SimpleSDKConfig
Passed to createSDK() for quick setup.
interface SimpleSDKConfig {
network?: 'testnet' | 'mainnet';
rpcUrl?: string;
relayerUrl?: string;
relayerApiKey?: string;
sponsorPrivateKey?: string;
integratorSponsorKey?: string;
rpcUrls?: Record<ChainName, string>;
}VeridexConfig
Full config for the VeridexSDK constructor.
interface VeridexConfig {
chain: ChainClient;
persistWallet?: boolean;
testnet?: boolean;
relayerUrl?: string;
relayerApiKey?: string;
queryApiKey?: string;
sponsorPrivateKey?: string;
integratorSponsorKey?: string;
chainRpcUrls?: Record<number, string>;
}ChainConfig
Returned by sdk.getChainConfig().
interface ChainConfig {
chainId: number;
wormholeChainId: number;
rpcUrl: string;
hubContractAddress: string;
wormholeCoreBridge: string;
name: string;
explorerUrl: string;
vaultFactory: string;
vaultImplementation: string;
}ChainName
type ChainName =
| 'base' | 'optimism' | 'arbitrum' | 'ethereum' | 'polygon'
| 'monad' | 'solana' | 'aptos' | 'sui' | 'starknet' | 'stacks';NetworkType
type NetworkType = 'testnet' | 'mainnet';Passkey & Identity
PasskeyCredential
Returned by sdk.passkey.register() and sdk.passkey.authenticate().
interface PasskeyCredential {
credentialId: string;
publicKeyX: bigint;
publicKeyY: bigint;
keyHash: string;
}WebAuthnSignature
interface WebAuthnSignature {
r: string;
s: string;
authenticatorData: string;
clientDataJSON: string;
}UnifiedIdentity
Returned by sdk.getUnifiedIdentity().
interface UnifiedIdentity {
keyHash: string;
addresses: Array<{
wormholeChainId: number;
chainName: string;
address: string;
deployed: boolean;
}>;
}IdentityState
interface IdentityState {
keyHash: string;
authorizedKeys: AuthorizedKey[];
keyCount: number;
}AuthorizedKey
interface AuthorizedKey {
keyHash: string;
publicKeyX: bigint;
publicKeyY: bigint;
addedAt: bigint;
label?: string;
}Transfer & Dispatch
TransferParams
interface TransferParams {
targetChain: number; // Wormhole chain ID
token: string; // Token address or 'native'
recipient: string; // Recipient address
amount: bigint; // Amount in smallest unit (wei, lamports, etc.)
}PreparedTransfer
Returned by sdk.prepareTransfer().
interface PreparedTransfer {
params: TransferParams;
actionPayload: string;
nonce: bigint;
challenge: string;
estimatedGas: bigint;
gasPrice: bigint;
messageFee: bigint;
totalCost: bigint;
formattedCost: string;
preparedAt: number;
expiresAt: number; // 5-minute TTL
}TransferResult
Returned by sdk.executeTransfer() and sdk.transferViaRelayer().
interface TransferResult {
transactionHash: string;
sequence?: bigint;
status: 'pending' | 'confirmed' | 'failed';
}DispatchResult
Returned by low-level sdk.transfer(), sdk.execute(), sdk.bridge().
interface DispatchResult {
transactionHash: string;
sequence: bigint;
userKeyHash: string;
targetChain: number;
blockNumber: number;
}ExecuteParams
interface ExecuteParams {
targetChain: number;
target: string;
value: bigint;
callData: string;
}Cross-Chain / Bridge
BridgeParams
interface BridgeParams {
sourceChain: number;
destinationChain: number;
token: string;
recipient: string;
amount: bigint;
}PreparedBridge
interface PreparedBridge {
params: BridgeParams;
actionPayload: string;
nonce: bigint;
challenge: string;
estimatedGas: bigint;
messageFee: bigint;
totalCost: bigint;
formattedCost: string;
preparedAt: number;
expiresAt: number;
}BridgeResult
interface BridgeResult {
success: boolean;
txHash: string;
estimatedTimeSeconds: number;
path: 'query' | 'vaa';
}CrossChainFees
interface CrossChainFees {
sourceGas: bigint;
messageFee: bigint;
relayerFee: bigint;
totalCost: bigint;
formattedTotal: string;
currency: string;
}Balance
TokenBalance
interface TokenBalance {
token: TokenInfo;
balance: bigint;
formatted: string;
usdValue?: number;
}PortfolioBalance
interface PortfolioBalance {
wormholeChainId: number;
chainName: string;
address: string;
tokens: TokenBalance[];
totalUsdValue?: number;
lastUpdated: Date;
}TokenInfo
interface TokenInfo {
address: string;
symbol: string;
name: string;
decimals: number;
wormholeChainId: number;
logoUrl?: string;
}Balance Watcher
BalanceChangeEvent
Delivered to watchBalance() subscribers when token balances change.
interface BalanceChangeEvent {
wormholeChainId: number;
address: string;
portfolio: PortfolioBalance;
changes: TokenBalanceChange[];
timestamp: number;
}TokenBalanceChange
interface TokenBalanceChange {
token: TokenInfo;
previousBalance: bigint;
currentBalance: bigint;
delta: bigint; // positive = received, negative = sent
}BalanceWatcherOptions
interface BalanceWatcherOptions {
intervalMs?: number; // Poll interval (default: 15000)
minIntervalMs?: number; // Floor (default: 5000)
emitInitial?: boolean; // Emit current balances immediately
}Spending Limits
SpendingLimits
Raw on-chain spending limits.
interface SpendingLimits {
dailyLimit: bigint;
dailySpent: bigint;
dailyRemaining: bigint;
dayResetTime: Date;
timeUntilReset: number; // milliseconds
transactionLimit: bigint;
isPaused: boolean;
lastUpdated: Date;
chainId: number;
}FormattedSpendingLimits
Human-readable version for UI display, returned by sdk.getFormattedSpendingLimits().
interface FormattedSpendingLimits {
dailyLimit: string;
dailyLimitValue: number;
dailySpent: string;
dailySpentValue: number;
dailyRemaining: string;
dailyRemainingValue: number;
dailyUsedPercentage: number; // 0–100
timeUntilReset: string; // e.g. "6h 23m"
transactionLimit: string;
transactionLimitValue: number;
isPaused: boolean;
hasDailyLimit: boolean;
hasTransactionLimit: boolean;
}LimitCheckResult
Returned by sdk.checkSpendingLimit().
interface LimitCheckResult {
allowed: boolean;
message?: string;
suggestions?: string[];
}Sessions
SessionConfig
interface SessionConfig {
duration: number; // seconds
maxValue?: bigint; // max transfer per session tx
allowedTokens?: string[]; // token addresses
allowedRecipients?: string[];
}SessionSignature
interface SessionSignature {
r: string;
s: string;
v: number;
}KeyPair
interface KeyPair {
privateKey: string;
publicKey: string;
address: string;
}Transaction Summary
TransactionSummary
Returned by sdk.getTransactionSummary().
interface TransactionSummary {
title: string;
description: string;
details: ActionDetails;
risks: RiskWarning[];
gasCost: string;
expiresIn: number;
}RiskWarning
interface RiskWarning {
level: 'info' | 'warning' | 'danger';
message: string;
code: string;
}Multisig (ADR-0037)
MultisigPolicy
interface MultisigPolicy {
enabled: boolean;
threshold: number;
protectedActionMask: number;
proposalTtl: number;
disableSessions: boolean;
}TransactionProposal
interface TransactionProposal {
proposalId: string;
identityKeyHash: string;
proposerKeyHash: string;
targetChain: number;
actionType: number;
actionHash: string;
actionPayload: string;
createdAt: bigint;
expiresAt: bigint;
approvalCount: number;
requiredThreshold: number;
state: 'none' | 'pending' | 'approved' | 'executed' | 'cancelled' | 'expired';
}Enterprise Manager
EnterpriseManagerConfig
interface EnterpriseManagerConfig {
sdk: VeridexSDK;
maxConcurrency?: number; // default: 3
}BatchVaultRequest / BatchVaultResult
interface BatchVaultRequest {
keyHashes: string[];
chainIds?: number[];
maxConcurrency?: number;
}
interface BatchVaultResult {
total: number;
succeeded: number;
failed: number;
results: Array<{
keyHash: string;
result: MultiChainVaultResult | null;
error?: string;
}>;
}BatchTransferRequest / BatchTransferResult
interface BatchTransferRequest {
transfers: TransferParams[];
signer: any;
maxConcurrency?: number;
}
interface BatchTransferResult {
total: number;
succeeded: number;
failed: number;
results: Array<{
params: TransferParams;
result: TransferResult | null;
error?: string;
}>;
}BatchSpendingLimitRequest / BatchSpendingLimitResult
interface BatchSpendingLimitRequest {
updates: Array<{ newLimit: bigint }>;
signer: any;
}
interface BatchSpendingLimitResult {
total: number;
succeeded: number;
failed: number;
results: Array<{
newLimit: bigint;
result: TransferResult | null;
error?: string;
}>;
}BatchLifecycleEvent
Callback events emitted during batch operations.
type BatchLifecycleEvent =
| { type: 'started'; total: number }
| { type: 'item_started'; index: number; total: number }
| { type: 'item_completed'; index: number; total: number; success: boolean; error?: string }
| { type: 'completed'; succeeded: number; failed: number; total: number };Error Types
VeridexError
class VeridexError extends Error {
readonly code: VeridexErrorCode;
readonly chain: string | undefined;
readonly cause: unknown;
readonly retryable: boolean;
}VeridexErrorCode
enum VeridexErrorCode {
NO_CREDENTIAL = 'NO_CREDENTIAL',
UNAUTHORIZED = 'UNAUTHORIZED',
INVALID_SIGNATURE = 'INVALID_SIGNATURE',
VAULT_NOT_FOUND = 'VAULT_NOT_FOUND',
VAULT_PAUSED = 'VAULT_PAUSED',
PROTOCOL_PAUSED = 'PROTOCOL_PAUSED',
INSUFFICIENT_FUNDS = 'INSUFFICIENT_FUNDS',
DAILY_LIMIT_EXCEEDED = 'DAILY_LIMIT_EXCEEDED',
INVALID_PAYLOAD = 'INVALID_PAYLOAD',
INVALID_ACTION = 'INVALID_ACTION',
EXPIRED = 'EXPIRED',
VAA_ALREADY_PROCESSED = 'VAA_ALREADY_PROCESSED',
INVALID_VAA = 'INVALID_VAA',
INVALID_EMITTER = 'INVALID_EMITTER',
BRIDGE_ERROR = 'BRIDGE_ERROR',
RPC_ERROR = 'RPC_ERROR',
TIMEOUT = 'TIMEOUT',
RELAYER_ERROR = 'RELAYER_ERROR',
SESSION_EXPIRED = 'SESSION_EXPIRED',
SESSION_INVALID = 'SESSION_INVALID',
UNSUPPORTED_FEATURE = 'UNSUPPORTED_FEATURE',
UNKNOWN = 'UNKNOWN',
}Cross-Origin Auth
CrossOriginAuthConfig
Passed to createCrossOriginAuth().
interface CrossOriginAuthConfig {
/** The Veridex RP ID (defaults to veridex.network) */
rpId?: string;
/** Auth portal URL for popup/redirect flow */
authPortalUrl?: string;
/** Relayer API URL for server-side session tokens */
relayerUrl?: string;
/** Authentication mode: popup or redirect */
mode?: 'popup' | 'redirect';
/** Popup window features (CSS string) */
popupFeatures?: string;
/** Timeout for auth operations in ms */
timeout?: number;
/** Callback URL for redirect mode */
redirectUri?: string;
}CrossOriginSession
Returned by auth.authenticate(), auth.connectWithVeridex(), and auth.authenticateAndCreateSession().
interface CrossOriginSession {
/** User's vault address */
address: string;
/** Session key public key */
sessionPublicKey: string;
/** Session key (encrypted, stored on client) */
encryptedSessionKey?: string;
/** When the session expires */
expiresAt: number;
/** Proof of passkey ownership */
signature: WebAuthnSignature;
/** The credential used */
credential: PasskeyCredential;
/** Server-validated session token ID (from relayer) */
serverSessionId?: string;
/** Relayer-issued challenge binding for server session creation */
serverChallengeId?: string;
}ServerSessionToken
Returned by auth.createServerSession() and auth.authenticateAndCreateSession().
interface ServerSessionToken {
id: string;
keyHash: string;
appOrigin: string;
permissions: string[];
expiresAt: number;
createdAt: number;
}AuthPortalMessage
Message format exchanged between the SDK and the auth portal popup.
interface AuthPortalMessage {
type: 'VERIDEX_AUTH_REQUEST' | 'VERIDEX_AUTH_RESPONSE' | 'VERIDEX_AUTH_ERROR';
payload: CrossOriginSession | { error: string; code: string };
origin: string;
state?: string;
}AUTH_MESSAGE_TYPES
const AUTH_MESSAGE_TYPES = {
AUTH_REQUEST: 'VERIDEX_AUTH_REQUEST',
AUTH_RESPONSE: 'VERIDEX_AUTH_RESPONSE',
AUTH_ERROR: 'VERIDEX_AUTH_ERROR',
} as const;Wallet Backup & Recovery
WalletBackupConfig
Passed to the WalletBackupManager constructor.
interface WalletBackupConfig {
/** PasskeyManager instance (must be configured with rpId and relayerUrl) */
passkey: PasskeyManager;
/** Relayer API URL */
relayerUrl: string;
/** API key for relayer authentication */
apiKey?: string;
}BackupStatus
Returned by backup.getBackupStatus().
interface BackupStatus {
/** Whether an encrypted archive exists on the relayer */
hasArchive: boolean;
/** Archive schema version */
archiveVersion: number | null;
/** When the archive was last updated (epoch ms) */
archiveUpdatedAt: number | null;
/** Number of active guardians (from relayer) */
guardianCount: number;
/** Whether PRF is supported (true = strong backup, false = rawId fallback) */
prfSupported: boolean;
}WalletArchivePayload
Internal structure of an encrypted backup archive.
interface WalletArchivePayload {
/** All stored credentials */
credentials: SerializedCredential[];
/** Backup metadata */
meta: {
version: number;
createdAt: number;
deviceInfo?: string;
};
}Full Import Example
import {
// Config
type VeridexConfig, type SimpleSDKConfig, type ChainConfig,
type ChainName, type NetworkType,
// Passkey
type PasskeyCredential, type WebAuthnSignature,
// Actions
type TransferParams, type ExecuteParams, type BridgeParams,
type PreparedTransfer, type PreparedBridge,
// Results
type DispatchResult, type TransferResult, type BridgeResult, type CrossChainFees,
// Balance
type TokenBalance, type PortfolioBalance, type TokenInfo,
type BalanceChangeEvent, type TokenBalanceChange, type BalanceWatcherOptions,
// Spending Limits
type SpendingLimits, type FormattedSpendingLimits, type LimitCheckResult,
// Sessions
type SessionConfig, type SessionSignature, type KeyPair,
// Summaries
type TransactionSummary, type RiskWarning,
// Identity
type UnifiedIdentity, type VaultInfo,
// Cross-Origin Auth
type CrossOriginAuthConfig, type CrossOriginSession,
type ServerSessionToken, type AuthPortalMessage,
// Wallet Backup & Recovery
type WalletBackupConfig, type BackupStatus, type WalletArchivePayload,
// Enterprise
type EnterpriseManagerConfig, type BatchVaultRequest, type BatchVaultResult,
type BatchTransferRequest, type BatchTransferResult,
type BatchSpendingLimitRequest, type BatchSpendingLimitResult,
type BatchLifecycleEvent,
// Multisig
type MultisigPolicy, type TransactionProposal,
// Errors
VeridexError, VeridexErrorCode,
} from '@veridex/sdk';