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

@dbtchain/gov-sdk

v1.0.4

Published

Public SDK for DBTC - Simplified blockchain interactions for government departments and agencies

Readme

@dbtchain/gov-sdk

Public SDK for simplified blockchain interactions with the Digital Bayanihan Transparency Chain (DBTC).

Installation

npm install @dbtchain/gov-sdk

Quick Start

Option 1: Using Environment Variables (Recommended)

Set these environment variables:

DBTC_CHAIN_MODE=testnet    # or 'mainnet'
DBTC_API_KEY=your-api-key  # Provided by DBTC
PRIVATE_KEY=your-wallet-private-key

Then use the SDK:

import { getCurrentPhase, getPhaseName, submitProposal } from '@dbtchain/gov-sdk';

// SDK auto-configures from environment variables
const phase = await getCurrentPhase();
console.log('Current Phase:', getPhaseName(phase));

Option 2: Programmatic Configuration

import { configure, submitProposal } from '@dbtchain/gov-sdk';

configure({
  chainMode: 'testnet',  // 'testnet' (Polygon Amoy) or 'mainnet' (Polygon)
  apiKey: 'your-dbtc-api-key',
  privateKey: process.env.PRIVATE_KEY
});

Networks

| Mode | Network | Chain ID | RPC Endpoint | |------|---------|----------|--------------| | testnet | Polygon Amoy | 80002 | https://amoy.dbtc.bayanichain.io | | mainnet | Polygon | 137 | https://polygon.dbtc.bayanichain.io |

Usage Examples

Agency Actions

import { 
  submitProposal, 
  reviseProposal, 
  addDocumentManager,
  getAgencyInfo 
} from '@dbtchain/gov-sdk';

// Submit a budget proposal
const result = await submitProposal(
  '0xAgencyAddress',
  'ipfs://metadata-uri',
  {
    prexcFpapId: 'PREXC-001',
    uacsObjCode: 'PS-001',
    amount: 1000000n
  }
  // privateKey optional if set in env/config
);
console.log('Token ID:', result.tokenId);

// Revise a proposal
const revision = await reviseProposal(
  '0xAgencyAddress',
  result.tokenId,
  'ipfs://new-metadata-uri',
  { prexcFpapId: 'PREXC-001', uacsObjCode: 'PS-001', amount: 1100000n },
  'Updated amount based on new requirements'
);

// Add document manager (requires agency owner key)
await addDocumentManager(
  '0xAgencyAddress',
  '0xManagerAddress',
  process.env.AGENCY_OWNER_KEY // explicit key if different from default
);

// Get agency info (read-only, no key needed)
const info = await getAgencyInfo('0xAgencyAddress');
console.log(info);

Department Actions

import { addAgency, getDepartmentInfo } from '@dbtchain/gov-sdk';

// Add a new agency
const result = await addAgency(
  '0xDepartmentAddress',
  '002',
  'Bureau of Treasury',
  '0xAgencyOwnerAddress'
);
console.log('New Agency:', result.agencyAddress);

// Get department info
const info = await getDepartmentInfo('0xDepartmentAddress');
console.log(info);

DBTC Phase Management (DBM Only)

import { 
  addDepartment, 
  assignPhaseResponsibility,
  startBudgetCall,
  advancePhase,
  BudgetPhase 
} from '@dbtchain/gov-sdk';

// Add a department
const result = await addDepartment(
  '02',
  'Department of Finance',
  'Office of the Secretary',
  '0xOwnerAddress',
  false, // not standalone
  true   // actual department
);

// Assign phase responsibility
await assignPhaseResponsibility(BudgetPhase.BUDGET_CALL, '02');

// Start budget call
await startBudgetCall();

// Advance phase
await advancePhase();

API Reference

Configuration

  • configure(config) - Configure the SDK
  • getChainMode() - Get current chain mode
  • isTestnet() / isMainnet() - Check current network

Agency Functions

  • submitProposal() - Submit a budget proposal
  • reviseProposal() - Revise an existing proposal
  • amendProposal() - Amend a proposal during GAB phase
  • submitSeparateGAB() - Submit separate House/Senate GAB
  • submitJointGAB() - Submit joint bicameral GAB
  • addDocumentManager() - Add a document manager
  • removeDocumentManager() - Remove a document manager
  • transferAgencyOwnership() - Transfer agency ownership
  • getAgencyInfo() - Get agency information
  • isDocumentManager() - Check if address is document manager
  • getDocumentManagers() - Get all document managers

Department Functions

  • addAgency() - Add a new agency
  • setHouseAndSenate() - Set Congress House/Senate agencies
  • getDepartmentInfo() - Get department information
  • getAgency() - Get agency by code
  • isAgencyRegistered() - Check if agency is registered
  • getAgencyCodes() - Get all agency codes
  • getMainAgency() - Get main agency address
  • getHouseAgency() / getSenateAgency() - Get Congress agencies
  • getDepartmentOwner() - Get department owner

DBTC Functions

  • addDepartment() - Add a new department
  • addRegularDepartment() - Add a regular department
  • assignPhaseResponsibility() - Assign phase responsibility
  • startBudgetCall() - Start budget call phase
  • advancePhase() - Advance to next phase
  • getCurrentPhase() - Get current budget phase
  • getCurrentFiscalYear() - Get current fiscal year
  • getDepartment() - Get department by code
  • isDepartmentRegistered() - Check if department is registered
  • getDepartmentCodes() - Get all department codes
  • getDepartmentCount() - Get department count
  • getPhaseResponsibleDepartment() - Get responsible department for phase
  • getBudgetProposalContract() - Get BudgetProposal contract address
  • getDBTCOwner() - Get DBTC owner

Getting Your API Key

Contact DBTC to obtain your API key for accessing the blockchain network.

License

MIT