SDK Reference
— A typed client over the read mesh, plus one-call receipt verification.
@pluid/sdk wraps the REST API with typed methods and bundles the receipt verifier so you can prove freshness without writing crypto. It runs in Node and the browser (proxy your key server-side for the latter).
bash
npm install @pluid/sdkPluidClient
Construct once and reuse. Every option is optional — the FREE tier needs nothing.
client.tsts
import { PluidClient } from "@pluid/sdk";
const pluid = new PluidClient({
apiKey: process.env.PLUID_API_KEY, // optional — raises rate limits
baseUrl: "https://pluid.net", // optional — override the endpoint
});| Option | Type | Description |
|---|---|---|
| apiKey | string? | Sent as x-api-key. Omit for the FREE per-IP tier. |
| baseUrl | string? | API origin. Defaults to https://pluid.net. |
The Response Envelope
Read methods resolve to a typed envelope mirroring the REST shape: { result, slot, receipt }.
ts
interface ReadResult<T> {
result: T;
slot: number;
receipt: Receipt;
}Methods
Each method maps to a REST route documented in the REST reference.
| Method | Type | Description |
|---|---|---|
| getSlot() | ReadResult | Latest processed slot. |
| getEpoch() | ReadResult | Current epoch info. |
| getHealth() | { result } | Mesh read health. |
| getNetwork() | ReadResult | Composite live snapshot (slot, TPS, epoch, fee). |
| getPriorityFee() | ReadResult | Recent prioritization-fee estimate. |
| getBalance(addr) | ReadResult | Lamport balance for an account. |
| getAccount(addr) | ReadResult | Parsed account info. |
| getTokenAccounts(owner, mint?) | ReadResult | Token accounts for an owner, optionally one mint. |
| getPortfolio(addr) | ReadResult | SOL + token holdings with valuations. |
| getBlock(slot) | ReadResult | Block detail for a slot. |
| getTransaction(sig, { enhanced? }) | ReadResult | Transaction detail, optionally parsed. |
| getToken(mint) | ReadResult | Mint supply, decimals, metadata. |
| getHolders(mint, page?) | ReadResult | Paginated top holders for a mint. |
| rpc(method, params) | { result } | Allow-listed read method passthrough. |
Example
portfolio.tsts
const { result, slot, receipt } = await pluid.getPortfolio(owner);
for (const holding of result.tokens) {
console.log(holding.symbol, holding.amount);
}
console.log("as of slot", slot, "verified:", pluid.verify(receipt, result));verify()
verifyrecomputes the canonical digest of the answer, rebuilds the signed payload, and checks the ed25519 signature against Pluid’s public key, which is bundled with the SDK. It runs fully offline and returns synchronously.
verify.tsts
import { PluidClient } from "@pluid/sdk";
const pluid = new PluidClient({ apiKey });
// Pass the receipt and the result it was issued for.
const ok = pluid.verify(receipt, result); // true
// Receipt only checks the signature, not the answer:
const authentic = pluid.verify(receipt); // true| Argument | Type | Description |
|---|---|---|
| receipt | Receipt | The receipt returned alongside the result. |
| expected? | unknown | Optional. The exact result the receipt was issued for — when passed, verify also confirms the answer digest matches. |
Same scheme, any language
Verification is just canonical JSON + SHA-256 + ed25519. The Receipts page documents the exact bytes so you can verify in any stack without the SDK.
