npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pacifica-js-sdk

v1.1.0

Published

Community-maintained JavaScript/TypeScript SDK for Pacifica

Readme

Pacifica JS SDK (Community)

npm version License: ISC Production Grade

Community-maintained production-ready JavaScript/TypeScript SDK for Pacifica. Engineered for high-frequency trading bots, institutional integrations, and DeFi agents.

Note: This is an unofficial, community-maintained SDK. It is not affiliated with or endorsed by the Pacifica team.

Features

  • 🔐 Secure Authentication: Ed25519 signing with runtime validation for keys.
  • 🤖 Agent Wallets: Native support for binding and using agent wallets for automated trading.
  • 📡 Real-time Data: Robust WebSocket client with auto-reconnection and exponential backoff.
  • Full Trading Suite: Market, Limit, Stop-Loss, and Take-Profit orders.
  • 🛡️ Error Handling: Typed error classes (PacificaError, NetworkError) for predictable failure management.
  • 📘 TypeScript First: Strict type definitions for all API interactions.
  • Tested: Unit tested utilities and critical paths.

Installation

npm install pacifica-js-sdk

Quick Start

Basic Configuration

Create a .env file (optional):

PRIVATE_KEY=your_base58_private_key

Initialize the client with error handling:

import { PacificaClient, PacificaError } from 'pacifica-js-sdk';
import dotenv from 'dotenv';

dotenv.config();

try {
    const client = new PacificaClient({
        privateKey: process.env.PRIVATE_KEY,
        network: "mainnet" // or "testnet"
    });

    await client.connect();
    console.log("Connected securely.");
} catch (error) {
    if (error instanceof PacificaError) {
        console.error("Pacifica SDK Error:", error.message);
    } else {
        console.error("Unknown Error:", error);
    }
}

Trading with Stop-Loss & Take-Profit

await client.connect();

const response = await client.createOrder({
    symbol: "BTC",
    side: "bid",
    type: "limit",
    price: "65000",
    amount: "0.1",
    take_profit: {
        stop_price: "70000",
        limit_price: "70100"
    },
    stop_loss: {
        stop_price: "60000"
    }
});

console.log("Order placed:", response);

Using Agent Wallets

Agent wallets allow you to sign transactions with a secondary keypair, keeping your main private key safe.

  1. Bind an Agent Wallet (One-time setup using main key):
import { Keypair } from "@solana/web3.js";

// Generate a new agent keypair
const agentKeypair = Keypair.generate();
const agentPublicKey = agentKeypair.publicKey.toBase58();

// Bind it to your account
await client.bindAgentWallet(agentPublicKey);
console.log("Agent bound:", agentPublicKey);
console.log("Agent Private Key:", bs58.encode(agentKeypair.secretKey)); // Save this!
  1. Trade with Agent Wallet:
const agentClient = new PacificaClient({
    privateKey: process.env.MAIN_PRIVATE_KEY, // Still needed for account identification
    agentWallet: "AGENT_PRIVATE_KEY_BASE58", // Signs requests
    network: "mainnet"
});

await agentClient.connect();
await agentClient.createOrder({ ... });

WebSocket Subscriptions

await client.connect();

// Typed event listeners
client.on('ticker', (ticker) => {
    console.log(`Update for ${ticker.symbol}: $${ticker.price}`);
});

client.on('orderbook', (book) => {
    console.log(`Orderbook ${book.symbol}: ${book.bids[0]} / ${book.asks[0]}`);
});

// Subscribe
client.subscribeToTicker("BTC");
client.subscribeToOrderbook("ETH");

REST API Methods

// Get Account Info (Balances, Margin)
const account = await client.getAccountInfo();

// Get Open Positions
const positions = await client.getPositions();

// Get Open Orders
const orders = await client.getOrders();

// Get All Markets
const markets = await client.getMarkets();

License

ISC