Pick your stack, set a policy, paste the snippet. The whole DApp integration is one function call before you delegate capital. Everything else here is your own business logic.
import { gate, TelaroGateError } from "@telaro/gate";
export async function delegateCapital(
agentPubkey: string,
amountUsdc: bigint,
) {
try {
await gate(agentPubkey, {
minBond: 1000000000n, // 1,000 USDC
minScore: 700,
});
} catch (err) {
if (err instanceof TelaroGateError) {
// err.code: NOT_BONDED | BOND_BELOW_MIN | SCORE_BELOW_MIN | FROZEN | LOOKUP_FAILED
throw new Error(`refused delegation: ${err.code}`);
}
throw err;
}
// Agent passed the gate - safe to delegate.
await yourVault.deposit(agentPubkey, amountUsdc);
}