Prerequisities & Installation

Prerequisites

Before using the OpenMSCP SDK, ensure you have:

  • Node.js (v16 or higher)

  • TypeScript (v4.0 or higher)

  • A Solana wallet (e.g., Phantom, Solflare)

  • Basic understanding of Solana blockchain concepts

  • Familiarity with TypeScript/JavaScript

Installation

For development purposes, you can install from source:

git clone https://github.com/OpenMSCP/mscp-sdk
cd mscp-sdk/sdk
yarn install
yarn build

Basic Usage

Here's a quick example of how to use the SDK:

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

// Initialize the client
const connection = new Connection('https://api.devnet.solana.com');
const wallet = Keypair.generate(); // Or use a wallet adapter
const client = new OpenMSCPClient(connection, wallet);

// Create a profile
const profile = await client.profile.create({
  username: 'alice',
  bio: 'Blockchain enthusiast',
  profilePicture: 'ipfs://QmHash...'
});

// Create a post
const post = await client.post.create('Hello, OpenMSCP!');

// Send a message
const message = await client.message.send(
  recipientPublicKey,
  'This is an encrypted message'
);

Last updated