SDK Reference
Complete API reference for @clicks-protocol/sdk.
Installation
npm install @clicks-protocol/sdkOr with yarn:
yarn add @clicks-protocol/sdkDependencies
npm install ethers@^6Quick Start
import { ClicksClient } from '@clicks-protocol/sdk';
const clicks = new ClicksClient(signer);
await clicks.quickStart('1000', agentAddress);
// 800 USDC → liquid (instant access)
// 200 USDC → earning 4-8% APY (withdraw anytime)That's it. No config. No dashboard. No human required.
Methods
quickStart
quickStart(amount: string, agentAddress: string, referrerAddress?: string): Promise<QuickStartResult>One-call setup: registers agent, approves USDC, and splits the first payment. Skips steps already completed.
Parameters
amount(string)USDC amount (human-readable, e.g. "1000")agentAddress(string)Agent wallet addressreferrerAddress(string)Optional referrer address for referral rewardsReturns
{ registered: boolean, approved: boolean, paymentSplit: boolean }
const result = await clicks.quickStart('100', agentAddress);
// result.registered → true (skips if already done)
// result.approved → true (skips if allowance sufficient)
// result.paymentSplit → true
// With referrer (L1=40%, L2=20%, L3=10% of protocol fee)
await clicks.quickStart('1000', agentAddress, referrerAddress);registerAgent
registerAgent(agentAddress: string): Promise<TransactionReceipt>Register a new agent in the Clicks Registry.
Parameters
agentAddress(string)Agent wallet address to registerReturns
Transaction receipt
await clicks.registerAgent(agentAddress);approveUSDC
approveUSDC(amount: string | 'max'): Promise<TransactionReceipt>Approve USDC spending for the Clicks contracts.
Parameters
amount(string | 'max')USDC amount to approve, or "max" for unlimitedReturns
Transaction receipt
// Approve max (recommended)
await clicks.approveUSDC('max');
// Approve specific amount
await clicks.approveUSDC('10000');receivePayment
receivePayment(amount: string, agentAddress: string): Promise<TransactionReceipt>Process an incoming USDC payment. Automatically splits based on the agent's yield percentage (default 80/20).
Parameters
amount(string)USDC amount (human-readable)agentAddress(string)Agent wallet addressReturns
Transaction receipt
// Auto-splits 80/20
await clicks.receivePayment('500', agentAddress);withdrawYield
withdrawYield(agentAddress: string): Promise<TransactionReceipt>Withdraw all principal plus accumulated yield for an agent.
Parameters
agentAddress(string)Agent wallet addressReturns
Transaction receipt
await clicks.withdrawYield(agentAddress);setOperatorYieldPct
setOperatorYieldPct(percentage: number): Promise<TransactionReceipt>Set a custom yield split percentage (5-50%).
Parameters
percentage(number)Yield percentage (5-50). E.g. 30 means 30% to yield, 70% liquid.Returns
Transaction receipt
// 30% to yield, 70% liquid
await clicks.setOperatorYieldPct(30);getAgentInfo
getAgentInfo(agentAddress: string): Promise<AgentInfo>Read-only. Get agent registration status and balance info. Works with provider (no signer needed).
Parameters
agentAddress(string)Agent wallet addressReturns
{ isRegistered: boolean, deposited: bigint, yieldPct: bigint }
const clicks = new ClicksClient(provider);
const agent = await clicks.getAgentInfo(agentAddress);
// { isRegistered: true, deposited: 1000000n, yieldPct: 20n }getYieldInfo
getYieldInfo(): Promise<YieldInfo>Read-only. Get current APY rates and active yield protocol.
Returns
{ activeProtocol: string, aaveAPY: number, morphoAPY: number, ... }
const yieldInfo = await clicks.getYieldInfo();
// { activeProtocol: 'Morpho', aaveAPY: 700, morphoAPY: 950, ... }simulateSplit
simulateSplit(amount: string, agentAddress: string): Promise<SplitResult>Read-only. Preview how a payment would be split without executing a transaction.
Parameters
amount(string)USDC amount to simulateagentAddress(string)Agent wallet addressReturns
{ liquid: bigint, toYield: bigint }
const split = await clicks.simulateSplit('100', agentAddress);
// { liquid: 80000000n, toYield: 20000000n }MCP Server
AI agents can discover and use Clicks via Model Context Protocol (MCP):
CLICKS_PRIVATE_KEY=0x... npx @clicks-protocol/mcp-serverOr install globally:
npm install -g @clicks-protocol/mcp-server
CLICKS_PRIVATE_KEY=0x... clicks-mcpAvailable Tools (9)
| Tool | Type | Description |
|---|---|---|
clicks_quick_start | ✍️ write | One-call setup + first payment |
clicks_receive_payment | ✍️ write | Split incoming USDC payment |
clicks_withdraw_yield | ✍️ write | Withdraw principal + yield |
clicks_register_agent | ✍️ write | Register new agent |
clicks_set_yield_pct | ✍️ write | Set custom yield percentage |
clicks_get_agent_info | 📖 read | Agent registration + balance info |
clicks_simulate_split | 📖 read | Preview payment split |
clicks_get_yield_info | 📖 read | Current APY + active protocol |
clicks_get_referral_stats | 📖 read | Referral network stats |
Resource: clicks://info — full protocol metadata
Compatible with: Claude, Cursor, LangChain, CrewAI, and any MCP-compatible client.