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

@greyw0rks/clarity-vote

v1.0.1

Published

JavaScript SDK for the ClarityVote on-chain governance protocol on Stacks

Readme

@greyw0rks/clarity-vote

JavaScript SDK for the ClarityVote on-chain governance protocol on Stacks.

npm version License: MIT

Install

npm install @greyw0rks/clarity-vote

Requires @stacks/transactions and @stacks/network as peer dependencies.

Overview

ClarityVote is an on-chain governance protocol for the Stacks ecosystem — STX-balance-weighted voting, vote delegation, and timelocked proposal execution, all enforced by Clarity smart contracts.

Deployed on Stacks Mainnet:

| Contract | Address | |---|---| | clarityvote | SP1SY1E599GN04XRD2DQBKV7E62HYBJR2CT9S5QKK.clarityvote | | clarityvote-delegation | SP1SY1E599GN04XRD2DQBKV7E62HYBJR2CT9S5QKK.clarityvote-delegation | | clarityvote-timelock | SP1SY1E599GN04XRD2DQBKV7E62HYBJR2CT9S5QKK.clarityvote-timelock |

Usage

Read a proposal

import { getProposal, getNextProposalId } from '@greyw0rks/clarity-vote';

const id = await getNextProposalId(); // total proposals created
const proposal = await getProposal(1);

Cast a vote

import { buildCastVote, VOTE_CHOICES } from '@greyw0rks/clarity-vote';
import { makeContractCall, broadcastTransaction } from '@stacks/transactions';

const txOptions = {
  ...buildCastVote({ proposalId: 1, choice: VOTE_CHOICES.YES }),
  senderKey: privateKey,
  network,
};
const tx = await makeContractCall(txOptions);
await broadcastTransaction({ transaction: tx, network });

Create a proposal

import { buildCreateProposal } from '@greyw0rks/clarity-vote';
import { makeContractCall, uintCV, stringUtf8CV } from '@stacks/transactions';

const txOptions = {
  ...buildCreateProposal({
    title: 'Increase fee by 10%',
    description: 'Raise the protocol fee from 1% to 1.1%',
    durationBlocks: 144,
    quorum: 1_000_000n,
  }),
  senderKey: privateKey,
  network,
};

Delegation

import { buildDelegate, buildRevokeDelegation, getDelegation } from '@greyw0rks/clarity-vote/delegation';

// Delegate your voting weight
const tx = buildDelegate('SP2...your-delegate-address');

// Check who you're delegated to
const delegatee = await getDelegation('SP1...your-address');

// Revoke
const revoke = buildRevokeDelegation();

Timelock

import { isReady, blocksUntilEta, buildExecuteProposal } from '@greyw0rks/clarity-vote/timelock';

const ready = await isReady(1);
const blocksLeft = await blocksUntilEta(1);

if (ready) {
  const tx = buildExecuteProposal(1);
  // sign and broadcast...
}

API

Core (@greyw0rks/clarity-vote)

| Function | Description | |---|---| | getProposal(id, network?) | Fetch a proposal by ID | | getNextProposalId(network?) | Get the next proposal ID (total count) | | hasVoted(proposalId, voter, network?) | Check if an address has voted | | buildCreateProposal(params) | Build a create-proposal tx payload | | buildCastVote(params) | Build a cast-vote tx payload | | buildFinalizeProposal(id) | Build a finalize-proposal tx payload |

Delegation (@greyw0rks/clarity-vote/delegation)

| Function | Description | |---|---| | getDelegation(address, network?) | Get current delegatee | | getDelegatedWeight(address, network?) | Get total delegated weight | | getEffectiveWeight(address, network?) | Own balance + delegated weight | | buildDelegate(delegatee) | Build a delegate tx payload | | buildRevokeDelegation() | Build a revoke-delegation tx payload | | buildTransferDelegation(newDelegatee) | Build a transfer-delegation tx payload |

Timelock (@greyw0rks/clarity-vote/timelock)

| Function | Description | |---|---| | getQueuedProposal(id, network?) | Get a queued proposal | | isReady(id, network?) | Check if ready to execute | | blocksUntilEta(id, network?) | Blocks remaining until ETA | | getDelay(network?) | Current timelock delay in blocks | | buildQueueProposal(id, desc) | Build a queue-proposal tx payload | | buildExecuteProposal(id) | Build an execute-proposal tx payload | | buildCancelProposal(id) | Build a cancel-proposal tx payload |

Constants

import { VOTE_CHOICES, PROPOSAL_STATES, TIMELOCK_DEFAULTS, ERROR_CODES } from '@greyw0rks/clarity-vote';

VOTE_CHOICES.YES     // 1
VOTE_CHOICES.NO      // 2
VOTE_CHOICES.ABSTAIN // 3

PROPOSAL_STATES.ACTIVE    // 0
PROPOSAL_STATES.PASSED    // 1
PROPOSAL_STATES.REJECTED  // 2

TIMELOCK_DEFAULTS.DEFAULT_DELAY // 144 blocks (~1 Bitcoin day)

Links

License

MIT