Voting app
This is an app connector for the Voting app (voting.aragonpm.eth
). It only supports The Graph for now.
Usage
To connect a Voting app, you need to pass it to connectVoting()
:
It extends the App
object, which means that every method and property of App
is also available on this object.
connect(app, connector)
Connects and returns a Voting
instance.
Name | Type | Description |
---|---|---|
|
| The app to extend with connected capabilities. |
|
| Accepts either a string describing the desired connector (only |
returns |
| An |
It can throw the following errors:
Error type | Description |
---|---|
Either the passed value is not a valid app object, or its name is not | |
Either the connector configuration format is not valid, or the connector name is not supported. | |
A subgraph couldn’t be found with the current network. Pass a |
Voting
An object representing the Voting app, returned by connectVoting()
. Use the following API to retrieve its data:
Voting#votes(filters)
Get the list of votes in the Voting app.
Name | Type | Description |
---|---|---|
|
| Optional object allowing to filter the votes. |
|
| Maximum number of votes. Defaults to |
|
| Skip a number of votes. Defaults to |
returns |
| The list of votes. |
This method can throw one of the following errors:
Error type | Description |
---|---|
The response seems incorrect. | |
The connection to the remote source failed. |
Voting#onVotes(filters, callback)
Subscribe to the list of votes in the Voting app. The callback is optional, not passing it will return a partially applied function.
Name | Type | Description |
---|---|---|
|
| Optional object allowing to filter the votes. See |
|
| A callback that will get called every time the result gets updated. |
returns |
| Unsubscribe function. |
The error passed to callback
can be null
(no error) or one of the following:
Error type | Description |
---|---|
The data couldn’t be fetched. | |
The connection to the remote source failed. |
Vote
A single Vote
object contains the following properties:
Name | Type | Description |
---|---|---|
|
| Unique identifier for the vote. |
|
| Address of the vote creator. |
|
| An arbitrary string that can be used to describe the vote. |
|
| Whether the vote has been executed. |
|
| Block timestamp for the vote execution. . |
|
| The start date. Expressed in Unix time (seconds). |
|
| Number of the block before the one in which the vote was created. |
|
| Percentage of positive votes required, compared to the negatives votes, for the vote to pass. |
|
| Percentage of positive votes required, compared to the total, for the vote to pass. |
|
| Total amount of tokens casted to a positive vote. |
|
| Total amount of tokens casted to a negative vote. |
|
| Amount of tokens available at the block |
|
| EVM call script to be executed on vote approval. |
And the following methods:
Vote#casts(filters)
Get the list of casted votes.
Name | Type | Description |
---|---|---|
|
| Optional object allowing to filter the votes. |
|
| Maximum number of votes. Defaults to |
|
| Skip a number of votes. Defaults to |
returns |
| The list of casted votes. |
This method can throw one of the following errors:
Error type | Description |
---|---|
The response seems incorrect. | |
The connection to the remote source failed. |
Vote#onCasts(filters, callback)
Subscribe to the list of casted votes. The callback is optional, not passing it will return a partially applied function.
Name | Type | Description |
---|---|---|
|
| Optional object allowing to filter the votes. See |
|
| A callback that will get called every time the result gets updated. |
returns |
| Unsubscribe function. |
The error passed to callback
can be null
(no error) or one of the following:
Error type | Description |
---|---|
The data couldn’t be fetched. | |
The connection to the remote source failed. |
Cast
Represents a casted vote. This object contains the following properties:
Name | Type | Description |
---|---|---|
|
| Unique identifier for the casted vote. |
|
| The casted |
|
| The address that casted the vote. |
|
| Whether or not the vote is positive. |
|
| Voter stake for the casted vote. |
|
| Block timestamp for the casted vote. |
Last updated