// Install Kelly Protocol SDK
// npm install @kelly-protocol/sdk
// Import and initialize
import { KellyClient } from "@kelly-protocol/sdk";
const kelly = new KellyClient({
network: "mainnet",
appId: "YOUR_APP_ID",
apiKey: "YOUR_API_KEY"
});
// Connect user wallet
const user = await kelly.identity.connectWallet({
address: "0xUSER_WALLET_ADDRESS"
});
// Fetch active prediction topics
const topics = await kelly.prediction.listTopics({
category: "ai-finance",
status: "active"
});
// Get AI insight for a prediction topic
const insight = await kelly.ai.getInsight({
topicId: topics[0].id
});
// Submit user prediction opinion
const prediction = await kelly.prediction.submitView({
topicId: topics[0].id,
address: user.address,
opinion: "positive",
confidence: 0.82,
comment: "AI adoption may accelerate ecosystem growth."
});
// Record user contribution behavior
await kelly.contribution.record({
address: user.address,
type: "PREDICTION_PARTICIPATION",
sourceId: topics[0].id,
metadata: {
action: "submit_view",
quality: "community_reviewed"
}
});
// Generate user cognitive profile
const profile = await kelly.contribution.getProfile({
address: user.address
});
// Bind user to global node network
const node = await kelly.node.bind({
address: user.address,
nodeCode: "KELLY-NODE-001"
});
// Fetch available ecosystem applications
const apps = await kelly.ecosystem.listApps({
tags: ["ai-research", "education", "data-service"]
});
console.log({
user,
insight,
prediction,
profile,
node,
apps
});
围绕 DeFi 大世界持续孵化多元生态应用