@liquidlink-lab/liquidlink-krilltube-sdk
v0.2.0
Published
A lightweight SDK for Liquidlink Krilltube to call the Incentive Backend and manage user points.
Readme
liquidlink-krilltube-sdk
A lightweight SDK for Liquidlink Krilltube to call the Incentive Backend and manage user points.
Installation
bun add @liquidlink-lab/liquidlink-krilltube-sdk
# or
npm install @liquidlink-lab/liquidlink-krilltube-sdk
# or
pnpm add @liquidlink-lab/liquidlink-krilltube-sdkQuick Start
import { Client } from "@liquidlink-lab/liquidlink-krilltube-sdk";
const client = new Client({
chain: "sui",
network: "mainnet",
apiKey: process.env.API_KEY!,
});
const ping = await client.ping();
console.log(ping.message);
await client.addPoints({ address: "0xabc...", points: 10 });
const points = await client.getPointsByAddress({ address: "0xabc..." });
console.log(points);API
new Client(options)
chain:"iota" | "sui"network:"testnet" | "mainnet"apiKey: API key
client.ping()
Returns the backend health message.
client.addPoints(payload)
payload.address: User addresspayload.points: Points to add
client.subPoints(payload)
payload.address: User addresspayload.points: Points to subtract
client.getPointsByAddress(query)
query.address: User address
client.getPointsLogs(query)
query.address: User addressquery.limit: Page sizequery.offset: Offsetquery.start_time: Start timestamp (seconds)query.end_time: End timestamp (seconds)
client.getScoreboard()
- Fetches the scoreboard for the current
chain. - Data is refreshed every 10 minutes.
Configuration
The SDK selects the built-in API base URL by chain and network. You can access the current config via getConfig():
const config = client.getConfig();
console.log(config.API_BASE_URL);License
MIT
