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:
| Prop | Type | Description |
|---|---|---|
sdk | VeridexSDK | SDK instance from createSDK() |
children | ReactNode | Child 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:
| Field | Type | Description |
|---|---|---|
chain | string | Chain name (e.g. 'base') |
network | 'testnet' | 'mainnet' | Network environment |
chainId | number | Wormhole chain ID |
usePasskey
const {
register,
authenticate,
credential,
isRegistering,
isAuthenticating,
error,
} = usePasskey();Returns:
| Field | Type | Description |
|---|---|---|
register | (username: string, displayName: string) => Promise<Credential> | Register a new passkey |
authenticate | () => Promise<Credential> | Authenticate with an existing passkey |
credential | Credential | null | Current credential |
isRegistering | boolean | Registration in progress |
isAuthenticating | boolean | Authentication in progress |
error | Error | null | Last error |
useBalance
const { balance, isLoading, error, refresh } = useBalance(tokenAddress?);Parameters:
| Parameter | Type | Description |
|---|---|---|
tokenAddress | string? | Token contract address (optional, defaults to native) |
Returns:
| Field | Type | Description |
|---|---|---|
balance | TokenBalance | null | Token balance with formatted, symbol, decimals |
isLoading | boolean | Loading state |
error | Error | null | Last error |
refresh | () => void | Force refresh |
useTransfer
const { prepare, execute, status, receipt, error } = useTransfer();Returns:
| Field | Type | Description |
|---|---|---|
prepare | (params: TransferParams) => Promise<TransferPreview> | Prepare a transfer for review |
execute | () => Promise<TransferReceipt> | Execute the prepared transfer |
status | string | null | Current status ('preparing', 'signing', 'confirming', 'complete') |
receipt | TransferReceipt | null | Transaction receipt after completion |
error | Error | null | Last error |
useMultiChainPortfolio
const { portfolio, totalValueUSD, isLoading, error } = useMultiChainPortfolio(chainIds?);Parameters:
| Parameter | Type | Description |
|---|---|---|
chainIds | number[]? | Chains to query (default: all configured) |
Returns:
| Field | Type | Description |
|---|---|---|
portfolio | PortfolioEntry[] | Balance per chain |
totalValueUSD | number | Aggregate USD value |
isLoading | boolean | Loading state |
error | Error | null | Last error |
useSpendingLimits
const { limits, spent, remaining, percentUsed } = useSpendingLimits();Returns:
| Field | Type | Description |
|---|---|---|
limits | SpendingLimits | null | Configured limits |
spent | number | Amount spent in current period |
remaining | number | Remaining allowance |
percentUsed | number | Utilization percentage (0-100) |
Utility Functions
resolveChainId
resolveChainId(name: string): numberResolve a chain name to its Wormhole chain ID.
resolveChainIds
resolveChainIds(names: string[]): number[]Resolve multiple chain names.