@apps.fun/sdk
Build with apps.fun
Token gating, trading, burns, and revenue sharing. Launch on Robinhood Chain.
$npm install viem
What you can build
Token Gating
Gate features behind token holdings. Check balances, set minimums, create tiers.
Direct Trading
Buy, sell, and burn tokens directly on-chain. Works with any connected EVM wallet.
Wallet Support
Connect any EVM wallet via wagmi. Build transactions, sign in the wallet, submit.
Revenue Routing
Route app revenue to token holders. Integrate dividends with a few lines of code.
Quick start
Examples using viem
token-gate.ts
import { createPublicClient, http } from 'viem';
import { base } from 'viem/chains';
const client = createPublicClient({
chain: base,
transport: http(),
});
// Check ERC20 token balance
const balance = await client.readContract({
address: 'TOKEN_CONTRACT_ADDRESS',
abi: erc20Abi,
functionName: 'balanceOf',
args: [walletAddress],
});
const minRequired = 1_000_000_000_000_000_000n; // 1 token (18 decimals)
if (balance >= minRequired) {
// Grant access to premium features
} else {
console.log(`Need ${minRequired - balance} more tokens`);
}Starter templates
Clone and deploy in minutes
Next.js + wagmi
Full-stack app with wallet connect and token gating
Wallet connectToken-gated pagesTrading UI
Discord Bot
Role-based token gating for Discord servers
Verify commandRole assignmentBalance checks
Express API
REST API with token-gated endpoints
Middleware authTrading endpointsWebhook support