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

@attestia/treasury

v0.2.1

Published

Org Treasury — deterministic payroll, DAO distributions, dual-gate funding, double-entry ledger integration

Readme

@attestia/treasury

Part of Attestia -- financial truth infrastructure for the decentralized world.

Organizational financial management with deterministic payroll, DAO distributions, dual-gate funding, and double-entry ledger integration.

npm version License: MIT


At a Glance

  • Deterministic payroll engine -- same schedule always produces the same run
  • DAO distributions with proportional, fixed, and milestone strategies
  • Dual-gate funding -- two distinct approvers required before funds are released
  • Full double-entry ledger integration via @attestia/ledger
  • All arithmetic uses bigint for precision (no floating-point)
  • Snapshot-able state for persistence and audit
  • Evolved from a Python payroll engine

Installation

npm install @attestia/treasury

Usage

Create a Treasury

import { Treasury } from "@attestia/treasury";

const treasury = new Treasury({
  orgId: "dao-1",
  name: "My DAO Treasury",
  defaultCurrency: "USDC",
  defaultDecimals: 6,
  gatekeepers: ["alice", "bob"], // dual-gate funding requires both
});

Deterministic Payroll

// Register payees
treasury.registerPayee("dev-1", "Alice", "0xAlice...", "eip155:1");
treasury.registerPayee("dev-2", "Bob", "0xBob...", "eip155:1");

// Set pay schedules
treasury.setPaySchedule("dev-1", [
  { id: "base-1", name: "Base Salary", type: "base", amount: { amount: "5000", currency: "USDC", decimals: 6 }, recurring: true, taxable: true },
  { id: "ded-1", name: "Health Insurance", type: "deduction", amount: { amount: "200", currency: "USDC", decimals: 6 }, recurring: true, taxable: false },
]);

// Create, approve, and execute a payroll run
const run = treasury.createPayrollRun("run-2024-jan", {
  start: "2024-01-01",
  end: "2024-01-31",
  label: "2024-Jan",
});

treasury.approvePayrollRun("run-2024-jan");
treasury.executePayrollRun("run-2024-jan"); // Records in double-entry ledger

DAO Distributions

// Proportional distribution (basis points, max 10000)
treasury.createDistribution(
  "dist-q1",
  "Q1 Revenue Share",
  "proportional",
  { amount: "100000", currency: "USDC", decimals: 6 },
  [
    { payeeId: "dev-1", share: 6000 }, // 60%
    { payeeId: "dev-2", share: 4000 }, // 40%
  ],
);

treasury.approveDistribution("dist-q1");
const result = treasury.executeDistribution("dist-q1");
console.log(result.totalDistributed); // { amount: "100000", ... }

Dual-Gate Funding

// Submit a funding request
treasury.submitFunding("fund-1", "Server infrastructure", {
  amount: "10000", currency: "USDC", decimals: 6,
}, "charlie");

// Both gatekeepers must approve (order doesn't matter)
treasury.approveFundingGate("fund-1", "alice", "Budget approved");
treasury.approveFundingGate("fund-1", "bob", "Verified vendor");

// Now it can be executed
treasury.executeFunding("fund-1");

Ledger and Snapshots

// Access the underlying double-entry ledger
const ledger = treasury.getLedger();
const entries = ledger.getEntries();

// Snapshot for persistence
const snapshot = treasury.snapshot();
const restored = Treasury.fromSnapshot(snapshot);

API

Classes

| Export | Description | |---|---| | Treasury | Top-level coordinator composing payroll, distributions, and funding | | PayrollEngine | Deterministic payroll computation with schedule management | | DistributionEngine | DAO/org distributions (proportional, fixed, milestone) | | FundingGateManager | Dual-gate funding approval with gatekeeper enforcement |

Error Types

| Export | Codes | |---|---| | PayrollError | PAYEE_EXISTS, PAYEE_NOT_FOUND, PAYEE_INACTIVE, RUN_EXISTS, RUN_NOT_FOUND, INVALID_TRANSITION, NO_COMPONENTS, INVALID_AMOUNT | | DistributionError | PLAN_EXISTS, PLAN_NOT_FOUND, INVALID_TRANSITION, INVALID_SHARES, POOL_EXCEEDED, NO_RECIPIENTS | | FundingError | REQUEST_EXISTS, REQUEST_NOT_FOUND, INVALID_TRANSITION, NOT_GATEKEEPER, ALREADY_APPROVED, DUPLICATE_GATEKEEPER |

Ecosystem

Attestia is a monorepo with 14 packages. Treasury sits alongside:

| Package | Purpose | |---|---| | @attestia/types | Shared domain types (Money, ChainId, IntentStatus) | | @attestia/ledger | Double-entry ledger with bigint money math | | @attestia/chain-observer | Multi-chain balance and transfer observation | | @attestia/registrum | State registration with invariant enforcement | | @attestia/vault | Personal portfolio, budgeting, and intent management | | @attestia/reconciler | 3D cross-system reconciliation engine | | @attestia/witness | XRPL on-chain attestation pipeline | | @attestia/proof | Proof generation and verification | | @attestia/verify | Verification utilities | | @attestia/event-store | Event sourcing infrastructure | | @attestia/node | Node runtime and orchestration | | @attestia/sdk | Developer SDK | | @attestia/demo | Demo and examples |

License

MIT