BeraVote.js
Overview
beravote.js is lightweight and structured JavaScript/Node.js client for interacting with the Beravote API, making it easier to fetch proposals, supported chains, networks, comments, and more.
Get started
Installation
Node.js
To install beravote.js on Node.js, open your terminal and run:
npm i beravote.jsBrowser
You can create an index.html file and include beravote.js with:
<script src="https://cdn.jsdelivr.net/gh/BeraVote/beravote.js/dist/beravote.min.js" integrity="sha384-5dVdSwcJ+Rj6EnGCGJRMWfP6d9qUe6Ly4t7SIjuxBZwQ/ytWbZA0ssqa5Pz01kIg" crossorigin="anonymous"></script>Development
Install dependencies
yarnBuild package (frontend)
Usage
Init client
Available Methods
Chains & Networks
getChains()
getChains()Fetches all supported chains.
getNetworks()
getNetworks()Fetches all supported networks.
Popular Content
getPopularProposals()
getPopularProposals()Fetches the hottest proposals on the platform.
Proposals
getProposalsByCid(proposalCid)
getProposalsByCid(proposalCid)Fetch a specific proposal by CID.
getProposalLists(spaceName, { page, pageSize })
getProposalLists(spaceName, { page, pageSize })List proposals in a space.
getPendingProposals(spaceName, { page, pageSize })
getPendingProposals(spaceName, { page, pageSize })Fetch proposals pending execution.
getActiveProposals(spaceName, { page, pageSize })
getActiveProposals(spaceName, { page, pageSize })List currently active proposals.
getClosedProposals(spaceName, { page, pageSize })
getClosedProposals(spaceName, { page, pageSize })List closed (finished) proposals.
Comments & Votes
getProposalComments(proposalCid, { page, pageSize })
getProposalComments(proposalCid, { page, pageSize })Fetch comments for a proposal.
getProposalVotes(proposalCid, { page, pageSize })
getProposalVotes(proposalCid, { page, pageSize })Fetch all votes on a proposal.
getVotes(proposalCid, address)
getVotes(proposalCid, address)Get vote by a specific address on a proposal.
getFilterVotes(proposalCid, network, address)
getFilterVotes(proposalCid, network, address)Get filtered vote details by network and address.
Stats & Balances
findProposalStats(proposalCid, network, address)
findProposalStats(proposalCid, network, address)Get vote stats for a proposal by user and network.
getProposalVoterBalance(proposalCid, network, address)
getProposalVoterBalance(proposalCid, network, address)Get voter balance on a proposal.
getSpaceStats(spaceName)
getSpaceStats(spaceName)Stats for a given space.
Spaces
getJoinedSpaces(address)
getJoinedSpaces(address)Get spaces joined by a user.
getOwnerSpaces(address)
getOwnerSpaces(address)Get spaces owned by an address.
getSpaceMembers(spaceName)
getSpaceMembers(spaceName)List all members of a space.
getSpaceDetails(spaceName)
getSpaceDetails(spaceName)Fetch metadata and settings for a space.
getNetworkSpaces(network)
getNetworkSpaces(network)Get all spaces by network.
getAllSpaces()
getAllSpaces()Fetch all visible spaces.
getAllSpacesWithoutFilter()
getAllSpacesWithoutFilter()Fetch all raw spaces without filters.
Last updated