SDK Integration (TypeScript + Rust)

PLX SDKs abstract away raw API calls, offering a plug-and-play layer for developers. Both SDKs — TypeScript and Rust — are production-ready, with local caching, signature helpers, and deterministic transaction builders.


🧩 TypeScript SDK (@plx/sdk)

Install:

npm install @plx/sdk

Quickstart Example

import { Vault, Rewards, Wallet } from "@plx/sdk";

const wallet = new Wallet("PRIVATE_KEY");
const vault = new Vault("PUMP5X");

// Fetch vault stats
const stats = await vault.stats();
console.log("TVL:", stats.tvl, "APY:", stats.apy);

// Deposit 10 SOL
await vault.deposit(wallet.address, 10);

// Claim rewards
const claim = await Rewards.claim(wallet.address);
console.log("Rewards claimed:", claim.amount, "SOL");

WebSocket Stream Example

import { RebalanceStream } from "@plx/sdk";

RebalanceStream.subscribe("SOL2X", (event) => {
  console.log(`[${event.symbol}] Ratio updated: ${event.new_ratio}`);
});

The TypeScript SDK also integrates directly with the PLX CLI:

plx vault deposit --symbol SOL5X --amount 10
plx rewards claim

⚙️ Rust SDK (plx-sdk)

Built for Solana-native engineers and on-chain analytics devs. Optimized for performance and direct Anchor IDL integration.

Cargo.toml

[dependencies]
plx-sdk = "0.4.2"

Example Usage

use plx_sdk::{Vault, Rewards};

fn main() {
    let vault = Vault::load("CHILLGUY2X");
    println!("TVL: {}", vault.tvl());
    vault.deposit("8xR7F...Kz3D", 5.0);
    let r = Rewards::claim("8xR7F...Kz3D");
    println!("Rewards claimed: {} SOL", r.amount);
}

Last updated