Bring loyaty points onchain.
Sign up at stack.so to get your API key and create a point system.
npm install @stackso/js-core
For complete docs on usage: https://docs.stack.so/
import {StackClient} from "@stackso/js-core";
// Initialize the client
const stack = new StackClient({
// Get your API key and point system id from the Stack dashboard (stack.so)
apiKey: "YOUR_API_KEY",
pointSystemId: "YOUR_POINT_SYSTEM_ID",
});
await stack.track("signup", {
points: 10,
account: "0x627306090abaB3A6e1400e9345bC60c78a8BEf57"
});
await stack.track("signup", {
points: 15,
account: "0x2eeb301387D6BDa23E02fa0c7463507c68b597B5",
});
await stack.getPoints("0x627306090abaB3A6e1400e9345bC60c78a8BEf57");
// => 10
await stack.getLeaderboard();
// => [
// {account: "0x2eeb301387D6BDa23E02fa0c7463507c68b597B5", points: 15},
// {account: "0x627306090abaB3A6e1400e9345bC60c78a8BEf57", points: 10}
// ]
// Pagination
await stack.getLeaderboard({limit: 10, offset: 20});