ceed-economy-sdk
v1.1.0
Published
CEED Economy SDK — tips, payments, subscriptions, streaming, exchange, AI agents. Add a complete economy to any platform in minutes.
Downloads
17
Maintainers
Readme
@ceed/economy-sdk
Add a complete economy to any platform in minutes — tips, payments, subscriptions, streaming, exchange, and AI agents.
Install
npm install @ceed/economy-sdkQuick Start
import { CeedEconomy } from '@ceed/economy-sdk';
const ceed = new CeedEconomy({
apiKey: 'ceed_pk_your_key_here',
sandbox: true, // Use sandbox mode for testing
});
// Launch a coin
const coin = await ceed.launchCoin({
name: 'ArtistCoin',
symbol: 'ART',
totalSupply: 1_000_000,
creatorAllocationPct: 20,
vestingMonths: 12,
backingCeed: 1000,
});
// Accept tips
const tip = await ceed.tip({
toUserId: 'creator-uuid',
coinSymbol: 'ART',
amount: 5,
message: 'Great work!',
});
// Subscriptions
const sub = await ceed.subscribe({
providerId: 'creator-uuid',
coinSymbol: 'ART',
amount: 10,
interval: 'monthly',
});
// Pay-per-stream
const session = await ceed.startStream({
streamerId: 'creator-uuid',
coinSymbol: 'ART',
ratePerMinute: 0.01,
});
const result = await ceed.endStream(session.data.session_id);Authentication
| Method | Header | Use Case |
|--------|--------|----------|
| Platform Key | X-Platform-Key | Server-to-server |
| Agent Key | X-Agent-Key | AI agent operations |
| User Token | Authorization: Bearer <jwt> | Client-side (SSO) |
// Server-to-server
const ceed = new CeedEconomy({ apiKey: 'ceed_pk_...' });
// AI agent
const ceed = new CeedEconomy({ agentKey: 'ceed_ak_...' });
// Client-side (after SSO login)
const ceed = new CeedEconomy({ userToken: jwt });Sandbox Mode
Test with fake CEED — no real money, same API surface:
const ceed = new CeedEconomy({
apiKey: 'ceed_pk_...',
sandbox: true,
});
await ceed.resetSandbox(); // Re-seeds 10,000 fake CEED
const bal = await ceed.sandboxBalance();API Reference
Economy
tip(params)— Tip any user in any coinpay(params)— One-time paymentsubscribe(params)— Create recurring subscriptioncancelSubscription(id)— Cancel a subscriptionbalance()— Get user balancesearnings(userId)— Get earnings breakdownlaunchCoin(params)— Launch a new coinairdrop(params)— Airdrop coins to multiple userscoinStats(symbol)— Get coin statistics
Streaming
startStream(params)— Start pay-per-stream sessionendStream(sessionId)— End stream and settle payment
Exchange
market()— Get all tradeable pairsticker(pair)— Get ticker for a pairorderbook(pair)— Get order bookplaceOrder(params)— Place a limit or market ordercancelOrder(orderId)— Cancel an orderexchangeBalances()— Get exchange balances
Trading Bot
spybotStatus()— Get SPYBOT statussignals()— Get recent trade signals
Auth
signup(email, password, name?)— Sign uplogin(email, password)— Login and get JWTrefresh(refreshToken)— Refresh JWTme()— Get current user profile
Webhooks
registerWebhook({ url, events })— Register a webhook
API Keys
createApiKey(name, keyType?, scopes?)— Create API keylistApiKeys()— List API keys (prefix only)revokeApiKey(keyId)— Revoke an API key
Sandbox
resetSandbox()— Reset sandbox (re-seeds 10K CEED)sandboxBalance()— Get sandbox balances
Analytics
apiUsage(days?)— Get API usage statsapiHealth()— Get global API health
Health
health()— Check API status
Response Format
All methods return CeedResponse<T>:
interface CeedResponse<T> {
ok: boolean; // true if HTTP 2xx
status: number; // HTTP status code
data: T; // Response payload
}Links
License
MIT
