Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

leaderboard-ts-sdk

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaderboard-ts-sdk

SDK to interact with leaderboards smart contract

latest
npmnpm
Version
0.0.6
Version published
Maintainers
0
Created
Source

NPC Labs is a core contributor to B3 - the gaming ecosystem L3 Onchain Leaderboards with B3

Overview

The On-Chain Leaderboard Smart Contract allows game developers to integrate on-chain leaderboards for tracking and displaying player scores securely on the blockchain. The leaderboard is managed by game admins, who can create, set, update, increment, and decrement player scores using player wallet addresses. Additionally, a TypeScript SDK will be provided to facilitate interaction with the contract.

  • Purpose: Provide an on-chain solution for managing game leaderboards where scores are stored and updated transparently and securely.
  • Primary User: Game admins (authorized by the contract).
  • Secondary User: Players whose scores are tracked.

Typescript SDK

  • Fetch Leaderboard Data: Allow easy retrieval of leaderboard standings and individual player scores from the contract.
  • Update Scores: Provide functionality for admins to interact with the contract methods for setting, updating, incrementing, or decrementing scores.

Example Methods in the SDK:

  • createLeaderboard(label: string): Promise
  • setScore(label: string, player: string, score: number): Promise
  • updateScore(label: string, player: string, score: number): Promise
  • incrementScore(label: string, player: string, increment: number): Promise
  • decrementScore(label: string, player: string, decrement: number): Promise
  • getLeaderboard(label: string): Promise
  • getScore(label: string, player: string): Promise
  • getPlayerCount(label: string): Promise<number | undefined> // New method
  • getLeaderboardSize(label: string): Promise<number | undefined> // New method
  • getTopPercentage(label: string, percentage: number): Promise<[string[], number[]]> // New method
  • getLeaderboardStartTime(label: string): Promise<number | undefined> // New method
  • getLeaderboardEndTime(label: string): Promise<number | undefined> // New method
  • isLeaderboardActive(label: string): Promise // New method

Keywords

leaderboard

FAQs

Package last updated on 16 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts