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.

Beravote.js repository

Get started

Installation

Node.js

To install beravote.js on Node.js, open your terminal and run:

npm i beravote.js

Browser

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

yarn

Build package (frontend)

Usage

Get Api Key

Init client

Available Methods

Chains & Networks

getChains()

Fetches all supported chains.

getNetworks()

Fetches all supported networks.

getPopularProposals()

Fetches the hottest proposals on the platform.

Proposals

getProposalsByCid(proposalCid)

Fetch a specific proposal by CID.

getProposalLists(spaceName, { page, pageSize })

List proposals in a space.

getPendingProposals(spaceName, { page, pageSize })

Fetch proposals pending execution.

getActiveProposals(spaceName, { page, pageSize })

List currently active proposals.

getClosedProposals(spaceName, { page, pageSize })

List closed (finished) proposals.

Comments & Votes

getProposalComments(proposalCid, { page, pageSize })

Fetch comments for a proposal.

getProposalVotes(proposalCid, { page, pageSize })

Fetch all votes on a proposal.

getVotes(proposalCid, address)

Get vote by a specific address on a proposal.

getFilterVotes(proposalCid, network, address)

Get filtered vote details by network and address.

Stats & Balances

findProposalStats(proposalCid, network, address)

Get vote stats for a proposal by user and network.

getProposalVoterBalance(proposalCid, network, address)

Get voter balance on a proposal.

getSpaceStats(spaceName)

Stats for a given space.

Spaces

getJoinedSpaces(address)

Get spaces joined by a user.

getOwnerSpaces(address)

Get spaces owned by an address.

getSpaceMembers(spaceName)

List all members of a space.

getSpaceDetails(spaceName)

Fetch metadata and settings for a space.

getNetworkSpaces(network)

Get all spaces by network.

getAllSpaces()

Fetch all visible spaces.

getAllSpacesWithoutFilter()

Fetch all raw spaces without filters.

Last updated