threshold-gov-sdk
v0.47.0
Published
SDK for Threshold Network governance
Maintainers
Readme
Threshold Governance SDK
A TypeScript SDK for interacting with Threshold Network governance contracts. This SDK provides a simple interface for creating proposals, voting, and managing delegations on the Threshold Network.
Installation
npm install threshold-gov-sdkUsage
import { ThresholdGovSDK } from 'threshold-gov-sdk';
// Initialize the SDK
const sdk = new ThresholdGovSDK({
provider: 'YOUR_ETHEREUM_PROVIDER_URL',
contractAddress: 'GOVERNANCE_CONTRACT_ADDRESS'
});
// Create a new proposal
const proposal = await sdk.createProposal({
title: 'Proposal Title',
description: 'Proposal Description',
targets: ['0x...'],
values: [0n],
calldatas: ['0x...']
});
// Get all proposals
const proposals = await sdk.getProposals();
// Vote on a proposal
await sdk.vote({
proposalId: 1,
support: true, // true for yes, false for no
});
// Delegate voting power
await sdk.delegate({
delegatee: 'DELEGATEE_ADDRESS',
});Development
- Clone the repository
- Install dependencies:
npm install - Build the project:
npm run build - Run tests:
npm test
Publishing a New Version to npm
Bump the version in
package.json- Use one of the following commands:
npm version patch # for bugfixes npm version minor # for new features npm version major # for breaking changes
- Use one of the following commands:
Run the release script
npm run releaseThis will:
- Build the SDK
- Show the files to be published (
npm pack) - Publish the new version to npm
Update your dependent projects
npm install threshold-gov-sdk@latest
License
MIT
