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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@zeus-network/zpl-sdk

v0.11.6

Published

A ZPL (zeus-program-library) SDK for Node.js and browser environments, built with rolldown.

Readme

ZPL SDK

A ZPL (zeus-program-library) SDK for Node.js and browser environments, built with rolldown.

Features

  • ESM/CJS dual output
  • Full TypeScript support

Usage

pnpm add @zeus-network/zpl-sdk

Client Example

import { TwoWayPegClient } from "@zeus-network/zpl-sdk";

// Initialize client
const client = new TwoWayPegClient(connection, programId);

Account

// Fetch the two-way-peg configuration account
const twoWayPegConfig = await client.accounts.getConfiguration();
console.log(twoWayPegConfig.layerFeeCollector.toString());

Instruction

// Build a withdrawal request instruction
const withdrawalIx = client.instructions.buildAddWithdrawalRequestIx(
  new BN(amountToWithdraw),
  new BN(currentSlot),
  receiverBitcoinAddress,
  wallet.publicKey,
  layerFeeCollectorPda,
  reserveSettingPda,
  liquidityManagementProgramId,
  liquidityManagementConfigurationPda,
  vaultSettingPda,
  positionPda
);

const tx = new Transaction().add(withdrawalIx);

Program Derived Address (PDA)

// Derive an interaction PDA address
// For deposits: seed1 = transaction_id, seed2 = v_out
// For withdrawals: seed1 = receiver_address, seed2 = slot
const interactionPda = client.pdas.deriveInteraction(
  receiverBitcoinAddress,
  new BN(currentSlot)
);
console.log(`Interaction PDA: ${interactionPda.toString()}`);

Flow Example

Create Hot Reserve Bucket

import { TwoWayPegClient } from "@zeus-network/zpl-sdk";
import { deriveHotReserveAddress } from "@zeus-network/zpl-sdk/bitcoin";

const client = new TwoWayPegClient(connection, programId);

const { pubkey: hotReserveBitcoinXOnlyPublicKey } = deriveHotReserveAddress(
  guardianXOnlyPublicKey,
  userBitcoinXOnlyPublicKey,
  UNLOCK_BLOCK_HEIGHT,
  bitcoinNetwork
);

const twoWayPegConfiguration = await client.accounts.getConfiguration();

const ix = client.instructions.buildCreateHotReserveBucketIx(
  UNLOCK_BLOCK_HEIGHT,
  HOT_RESERVE_BUCKET_VALIDITY_PERIOD,
  solanaPubkey,
  userBitcoinXOnlyPublicKey,
  hotReserveBitcoinXOnlyPublicKey,
  new PublicKey(selectedGuardian.address),
  new PublicKey(selectedGuardian.guardian_certificate),
  coldReserveBucket.publicKey,
  twoWayPegConfiguration.layerFeeCollector
);

const tx = new Transaction().add(ix);

Deposit

import { TwoWayPegClient } from "@zeus-network/zpl-sdk";
import { buildDepositToHotReserveTx } from "@zeus-network/zpl-sdk/bitcoin";

const client = new TwoWayPegClient(connection, programId);

const hotReserveBuckets =
  await client.getHotReserveBucketsByBitcoinXOnlyPubkey(userXOnlyPublicKey);

// NOTE: selection logic depends on your DApp logic
const targetHotReserveBucket = hotReserveBuckets[0];

const { address: targetHotReserveAddress } = bitcoin.payments.p2tr({
  pubkey: Buffer.from(targetHotReserveBucket.taprootXOnlyPublicKey),
  network: bitcoinNetwork,
});

const { psbt, usedUTXOs } = buildDepositToHotReserveTx(
  bitcoinUTXOs,
  targetHotReserveAddress,
  depositAmount,
  userXOnlyPublicKey,
  feeRate,
  bitcoinNetwork
);
Signing and Broadcasting

After constructing the deposit PSBT as shown above, complete the deposit flow with the following steps:

  1. Sign the PSBT: Use your Bitcoin wallet (such as Ledger, Sparrow, or any compatible wallet software) to sign the generated PSBT. The signing process proves ownership of the inputs and authorizes the spend.

  2. Broadcast the Transaction: Once the PSBT is fully signed, broadcast the finalized transaction to the Bitcoin network. You can use your wallet, a Bitcoin node, or a third-party API/service to submit the raw transaction hex.

Note: The SDK does not handle signing or broadcasting. You must use your own wallet infrastructure or integrate with external services for these steps.