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

@latch-labs/sdk

v0.1.5

Published

TypeScript SDK for Latch — split-control escrow on Solana

Readme

@latch-labs/sdk

TypeScript SDK for Latch — the split-control escrow primitive on Solana.

⚠️ Unaudited, experimental, devnet only. Do not use with real funds.

npm install @latch-labs/sdk

Quickstart

import { AnchorProvider, Wallet } from "@anchor-lang/core";
import { Connection, Keypair } from "@solana/web3.js";
import {
  LatchClient, DeadlockRule, TimerMode, RiskFlags, BN,
} from "@latch-labs/sdk";

const provider = new AnchorProvider(
  new Connection("https://api.devnet.solana.com", "confirmed"),
  new Wallet(payerKeypair),
  { commitment: "confirmed" }
);
const client = LatchClient.fromProvider(provider);

// Create a two-party deal: 1,000 tokens, two milestones, both must approve.
const dealId = Math.floor(Date.now() / 1000);
await client.createDeal({
  dealId,
  parties: [buyer.publicKey, seller.publicKey],
  payerIdx: 0,
  payeeIdx: 1,
  approvalThreshold: 2,
  termsHash: sha256OfYourAgreementDocument,       // 32 bytes
  milestoneAmounts: [new BN(600_000_000), new BN(400_000_000)],
  deadlockRule: DeadlockRule.TimeoutRefund,
  timerMode: TimerMode.FromDeadlock,
  timeoutSecs: 7 * 24 * 3600,
  recoverySigners: [recoveryAgent.publicKey],     // party-chosen, never an operator
  recoveryThreshold: 1,
  recoveryDelaySecs: 3 * 24 * 3600,               // on-chain notice window
  acceptedRiskFlags: RiskFlags.FREEZE_AUTHORITY,  // explicit mint-risk consent
  mint: usdcMint,
}).rpc();

const deal = client.dealPda(provider.wallet.publicKey, dealId);
await client.signTerms(deal).rpc();               // each party, own wallet
// ... deposit, confirmReady, approveMilestone, releaseMilestone — see the
// API reference: https://latchlabs.org/api/

const info = await client.fetchDeal(deal);        // typed account + state name

Every lifecycle method returns Anchor's MethodsBuilder — chain .rpc() to send, .instruction() to compose into your own transaction, or .transaction() to sign elsewhere (wallet adapters).

Event history

Latch emits a CPI event for every state change (inner-instruction data — not logs, which RPC providers truncate). Rebuild a deal's complete, independently verifiable history:

import { fetchEventHistory } from "@latch-labs/sdk";
const events = await fetchEventHistory(client.program, connection, deal);
// [{ name: "dealCreated", data: {...}, signature, blockTime }, ...]

This is the primitive behind signature certificates and adoption metrics.

What the program guarantees

  • No operator key can move escrowed funds — there is no admin instruction.
  • Funds move only on party sign-offs, the resolution rule fixed at formation, or the parties' own recovery signers (only to the parties, only after the on-chain notice delay).
  • Releases and resolutions are permissionless cranks once conditions are met.
  • Mints are vetted at creation; custody-affecting Token-2022 extensions must be explicitly accepted via acceptedRiskFlags.

Apache-2.0. Program ID (devnet): BT8tr7YXYLQPsLMq3qCipY1fBKyjT3gmGQB5amV2v5yv.