API Reference
React SDK

React SDK API Reference

Full API for @veridex/react — the React bindings for the Veridex Protocol core SDK.


VeridexProvider

Context provider that makes the SDK available to all child components.

import { VeridexProvider } from '@veridex/react';
 
<VeridexProvider sdk={sdkInstance}>
  <App />
</VeridexProvider>

Props:

PropTypeDescription
sdkVeridexSDKSDK instance from createSDK()
childrenReactNodeChild components

useVeridexSDK

const sdk: VeridexSDK = useVeridexSDK();

Returns the SDK instance from the nearest VeridexProvider. Throws if used outside of a provider.


useNetwork

const { chain, network, chainId } = useNetwork();

Returns:

FieldTypeDescription
chainstringChain name (e.g. 'base')
network'testnet' | 'mainnet'Network environment
chainIdnumberWormhole chain ID

usePasskey

const {
  register,
  authenticate,
  credential,
  isRegistering,
  isAuthenticating,
  error,
} = usePasskey();

Returns:

FieldTypeDescription
register(username: string, displayName: string) => Promise<Credential>Register a new passkey
authenticate() => Promise<Credential>Authenticate with an existing passkey
credentialCredential | nullCurrent credential
isRegisteringbooleanRegistration in progress
isAuthenticatingbooleanAuthentication in progress
errorError | nullLast error

useBalance

const { balance, isLoading, error, refresh } = useBalance(tokenAddress?);

Parameters:

ParameterTypeDescription
tokenAddressstring?Token contract address (optional, defaults to native)

Returns:

FieldTypeDescription
balanceTokenBalance | nullToken balance with formatted, symbol, decimals
isLoadingbooleanLoading state
errorError | nullLast error
refresh() => voidForce refresh

useTransfer

const { prepare, execute, status, receipt, error } = useTransfer();

Returns:

FieldTypeDescription
prepare(params: TransferParams) => Promise<TransferPreview>Prepare a transfer for review
execute() => Promise<TransferReceipt>Execute the prepared transfer
statusstring | nullCurrent status ('preparing', 'signing', 'confirming', 'complete')
receiptTransferReceipt | nullTransaction receipt after completion
errorError | nullLast error

useMultiChainPortfolio

const { portfolio, totalValueUSD, isLoading, error } = useMultiChainPortfolio(chainIds?);

Parameters:

ParameterTypeDescription
chainIdsnumber[]?Chains to query (default: all configured)

Returns:

FieldTypeDescription
portfolioPortfolioEntry[]Balance per chain
totalValueUSDnumberAggregate USD value
isLoadingbooleanLoading state
errorError | nullLast error

useSpendingLimits

const { limits, spent, remaining, percentUsed } = useSpendingLimits();

Returns:

FieldTypeDescription
limitsSpendingLimits | nullConfigured limits
spentnumberAmount spent in current period
remainingnumberRemaining allowance
percentUsednumberUtilization percentage (0-100)

Utility Functions

resolveChainId

resolveChainId(name: string): number

Resolve a chain name to its Wormhole chain ID.

resolveChainIds

resolveChainIds(names: string[]): number[]

Resolve multiple chain names.