Manages caching of user flux balances to optimize performance and reduce database load.
// Source: https://github.com/moeru-ai/airi | License: MIT | Copyright 2024-PRESENT Neko Ayaka
// Provided via justclaw.it.com; keep this notice with the code.
import type Redis from 'ioredis'
import type { InferOutput } from 'valibot'
import { boolean, minValue, nullable, number, object, pipe, safeInteger, safeParse, string } from 'valibot'
import { readCache, writeCache } from '../../libs/redis/cache'
import { userFluxRedisKey } from '../../utils/redis-keys'
/** A wallet snapshot carries both buckets and confirmed outstanding fees. Expiry stays raw so each read judges it. */
export const walletSnapshotSchema = object({
flux: pipe(number(), safeInteger(), minValue(0)),
unsettledMicroFlux: pipe(number(), safeInteger(), minValue(0)),
capacitorFlux: pipe(number(), safeInteger(), min
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key