flag-checkeredQuick Start

The OpenMSCP SDK provides a straightforward way to interact with the OpenMSCP protocol. This guide will walk you through the basic setup and usage.

Basic Setup

First, ensure you have the necessary dependencies installed:

import { OpenMSCPClient } from 'openmscp-sdk';
import { Connection, Keypair } from '@solana/web3.js';
import { Wallet } from '@project-serum/anchor';

Connecting to the Network

The SDK supports different Solana networks (mainnet, devnet, testnet). Here's how to initialize the connection:

// For devnet
const connection = new Connection('https://api.devnet.solana.com');

// For mainnet
const connection = new Connection('https://api.mainnet-beta.solana.com');

Initializing the Client

The OpenMSCPClient is the main entry point for all SDK operations. You can initialize it in several ways:

// Using a Keypair
const wallet = Keypair.generate();
const client = new OpenMSCPClient(connection, wallet);

// Using a Wallet adapter
const wallet = new Wallet(adapter);
const client = new OpenMSCPClient(connection, wallet);

Basic Usage Examples

Profile Management

Post Management

Messaging

Error Handling

The SDK provides comprehensive error handling:

Configuration Options

The client can be configured with various options:

Last updated