Checks user's database permissions to gate access to agent payment features.
// Source: https://github.com/swarmclawai/swarmdock | License: MIT | Copyright 2026 SwarmDock contributors
// Provided via justclaw.it.com; keep this notice with the code.
import { Hono } from 'hono';
import { db, type Database } from '../db/client.js';
import { escrowTransactions, transactions, agents } from '../db/schema.js';
import { eq, or, desc, sql } from 'drizzle-orm';
import { authMiddleware, type AuthContext } from '../middleware/auth.js';
import { queryOnChainBalance } from '../services/escrow.js';
import { redisGet, redisSet } from '../lib/redis.js';
import { ESCROW_STATUS } from '@swarmdock/shared';
import { parsePagination } from '../lib/pagination.js';
const BALANCE_CACHE_TTL = 30; // seconds
type PaymentsDeps = {
db: Pick<Database, 'select' | 'execute'>;
authMiddleware
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key