Governance API
import {JsonRpcClient} from '@defichain/jellyfish-api-jsonrpc'
const client = new JsonRpcClient('http://foo:bar@localhost:8554')
// Using client.governance.
const something = await client.governance.method()
createCfp
Creates a Community Fund Request.
interface governance {
createCfp (data: CFPData, utxos: UTXO[] = []): Promise<string>
}
interface CFPData {
title: string
amount: BigNumber
payoutAddress: string
cycles?: number
}
interface UTXO {
txid: string
vout: number
}
getProposal
Returns information about the proposal.
interface governance {
getProposal (proposalId: string): Promise<ProposalInfo>
}
enum ProposalType {
COMMUNITY_FUND_REQUEST = 'CommunityFundRequest',
BLOCK_REWARD_RELLOCATION = 'BlockRewardRellocation',
VOTE_OF_CONFIDENCE = 'VoteOfConfidence'
}
enum ProposalStatus {
VOTING = 'Voting',
REJECTED = 'Rejected',
COMPLETED = 'Completed'
}
interface ProposalInfo {
proposalId: string
title: string
type: ProposalType
status: ProposalStatus
amount: BigNumber
cyclesPaid: number
totalCycles: number
finalizeAfter: number
payoutAddress: string
}
createVoc
Creates a Vote of Confidence.
interface governance {
createVoc (title: string, utxos: UTXO[] = []): Promise<string>
}
interface UTXO {
txid: string
vout: number
}
listProposals
Returns list of proposals.
interface governance {
async listProposals ({
type = ListProposalsType.ALL,
status = ListProposalsStatus.ALL
} = {}): Promise<ProposalInfo[]>
}
enum ListProposalsType {
CFP = 'cfp',
BRP = 'brp',
VOC = 'voc',
ALL = 'all'
}
enum ListProposalsStatus {
VOTING = 'voting',
REJECTED = 'rejected',
COMPLETED = 'completed',
ALL = 'all'
}
enum ProposalType {
COMMUNITY_FUND_REQUEST = 'CommunityFundRequest',
BLOCK_REWARD_RELLOCATION = 'BlockRewardRellocation',
VOTE_OF_CONFIDENCE = 'VoteOfConfidence'
}
enum ProposalStatus {
VOTING = 'Voting',
REJECTED = 'Rejected',
COMPLETED = 'Completed'
}
interface ProposalInfo {
proposalId: string
title: string
type: ProposalType
status: ProposalStatus
amount: BigNumber
cyclesPaid: number
totalCycles: number
finalizeAfter: number
payoutAddress: string
}
vote
Vote on a community proposal.
interface governance {
async vote (data: VoteData, utxos: UTXO[] = []): Promise<string>
}
enum VoteDecision {
YES = 'yes',
NO = 'no',
NEUTRAL = 'neutral'
}
interface VoteData {
proposalId: string
masternodeId: string
decision: VoteDecision
}
interface UTXO {
txid: string
vout: number
}
listVotes
Returns information about proposal votes.
interface governance {
async listVotes (proposalId: string, masternode: MasternodeType | string = MasternodeType.MINE): Promise<ListVotesResult[]>
}
enum MasternodeType {
MINE = 'mine',
ALL = 'all'
}
interface ListVotesResult {
proposalId: string
masternodeId: string
cycle: number
vote: string
}