๐Ÿ”ง SDK Utilities

SDK Utilities

Helper methods available on the VaeaFlash client for monitoring and debugging.

getTokenCapacity()

Get capacity for a single token without loading all 30 tokens. Throws TOKEN_NOT_SUPPORTED if not found.

const msol = await flash.getTokenCapacity('mSOL');
console.log(msol.max_amount);      // 12000
console.log(msol.route_type);      // 'synthetic'
console.log(msol.source_protocol); // 'Marginfi'
console.log(msol.swap_protocol);   // 'Sanctum'
console.log(msol.status);          // 'available' | 'degraded' | 'offline'

// Also works with mint address:
const sol = await flash.getTokenCapacity('So11111111111111111111111111111111111111112');
FieldTypeDescription
symbolstringToken symbol (e.g. "mSOL")
mintstringToken mint address
decimalsnumberToken decimals
max_amountnumberMaximum borrowable amount (in token units)
route_typedirect | syntheticHow the token is sourced
source_protocolstringLending protocol providing the liquidity
swap_protocolstring | nullSwap provider (null for direct routes)
statusavailable | degraded | offlineCurrent availability status

getHealth()

Check the health of all VAEA Flash infrastructure components. Useful for monitoring dashboards and alerting.

const health = await flash.getHealth();

console.log(health.status);                    // 'ok'
console.log(health.components.redis.status);   // 'ok'
console.log(health.components.scanner.status); // 'ok'
console.log(health.components.scanner.cache_age_ms); // 1200
console.log(health.components.program.program_id);   // 'HoYiwk...'

// Source availability:
for (const [name, src] of Object.entries(health.sources)) {
  console.log(`${name}: ${src.status} โ€” ${src.available_sol ?? 0} SOL`);
}
ComponentFieldsDescription
components.redisstatusCache layer health
components.scannerstatus, cache_age_msLiquidity scanner freshness
components.programprogram_idOn-chain program ID
sourcesstatus, available_solPer-protocol availability
๐Ÿ’ก Tip
Use getHealth() in your monitoring system to detect degraded sources. If a source goes offline, the SDK automatically falls back to the next available protocol.
๐Ÿ”