@napcatlabs/protocol
v0.1.27
Published
<div align="center"> <h1>Napcat Protocol SDK</h1> </div>
Downloads
689
Readme
Napcat Protocol SDK! This is the official SDK that allows you to interact with the Napcat protocol on the Solana blockchain.
Install
Install these dependencies over:
npm:
npm install @napcat/protocol
yarn:
yarn add @napcat/protocol
How to Use
Here’s a basic example of how you can start using the SDK:
import { Connection, PublicKey } from '@solana/web3.js'
import { Wallet } from '@coral-xyz/anchor'
import NapcatProtocolClient from '@napcat/protocol'
const connection = new Connection('https://api.mainnet-beta.solana.com')
const wallet = new Wallet(/* Your private key here */)
const napcatClient = new NapcatProtocolClient(connection, wallet)
// Example: Claiming Rewards
async function claimRewards() {
const vaultPubkey = new PublicKey('vaultPublicKeyHere')
const userPubkey = new PublicKey('userPublicKeyHere')
const userPositionPubkey = new PublicKey('userPositionPublicKeyHere')
const args = {
vaultPubkey,
userPubkey,
userPositionPubkey
}
try {
const txSignature = await napcatClient.claimRewards(args)
console.log('Rewards claimed successfully! Transaction:', txSignature)
} catch (error) {
console.error('Error claiming rewards:', error)
}
}
claimRewards()