logo
BetaAbout us

SDK Guide

Our TypeScript SDK provides convenient classes and methods for interacting with the Rankify protocol. Get started quickly with pre-built components for common use cases.

Installation

Install the SDK using your preferred package manager:

pnpm add @peeramid-labs/sdk

Quick Start

Here's a basic example of how to get started with the SDK:

import { InstancePlayer, GameMaster } from '@peeramid-labs/sdk';

// Initialize a player instance
const player = new InstancePlayer({
  contractAddress: '0x...',
  provider: yourWeb3Provider
});

// Join a tournament
await player.joinTournament(tournamentId);

Main Use Cases

Here are the primary use cases for the SDK:

Creating a Player Instance

Initialize a player to participate in tournaments and games

Use InstancePlayer class to join games, submit moves, and track progress

Managing Game Instances

Create and administrate game tournaments as a Game Master

Use GameMaster class to create tournaments, set rules, and manage participants

Interacting with Contracts

Direct contract interaction for advanced use cases

Access contract methods directly for custom implementations

Core Classes

The SDK provides several core classes for different types of interactions:

InstancePlayer

Main class for players to participate in tournaments, submit moves, track progress, and manage their rank tokens.

GameMaster

Administrative class for creating tournaments, setting rules, managing participants, and overseeing game flow.

InstanceBase

Base class providing common functionality for interacting with Rankify instances and accessing contract methods.

MAODistributor

Manages the distribution of rewards and governance tokens within a Meritocratic Autonomous Organization.

RankTokenClient

Specialized client for interacting with rank tokens, including transfers, balance checking, and metadata queries.

Configuration

The SDK requires basic configuration to connect to the blockchain and interact with deployed contracts:

// Basic configuration
const config = {
  rpcUrl: 'https://sepolia-rollup.arbitrum.io/rpc',
  contractAddresses: {
    distributor: '0x54c7cdAEDa35c3990892e3FC1F00163fb7020287',
    maoDistribution: '0xC7A131a0f9FdD50c9e45270a48151066E22f0b9A'
  },
  privateKey: process.env.PRIVATE_KEY // For write operations
};

Documentation & Examples

For detailed API documentation, examples, and advanced usage patterns, check out the comprehensive SDK documentation.

SDK Documentation

Complete API Reference

Detailed documentation with examples and type definitions

View SDK Documentation →