Voting app
Last updated
Last updated
This is an app connector for the Voting app (voting.aragonpm.eth
). It only supports The Graph for now.
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.
Connects and returns a Voting
instance.
Name | Type | Description |
---|---|---|
It can throw the following errors:
Error type | Description |
---|---|
An object representing the Voting app, returned by connectVoting()
. Use the following API to retrieve its data:
Get the list of votes in the Voting app.
This method can throw one of the following errors:
Subscribe to the list of votes in the Voting app. The callback is optional, not passing it will return a partially applied function.
The error passed to callback
can be null
(no error) or one of the following:
A single Vote
object contains the following properties:
And the following methods:
Get the list of casted votes.
This method can throw one of the following errors:
Subscribe to the list of casted votes. The callback is optional, not passing it will return a partially applied function.
The error passed to callback
can be null
(no error) or one of the following:
Represents a casted vote. This object contains the following properties:
Name | Type | Description |
---|---|---|
Error type | Description |
---|---|
Name | Type | Description |
---|---|---|
Error type | Description |
---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Error type | Description |
---|---|
Name | Type | Description |
---|---|---|
Error type | Description |
---|---|
Name | Type | Description |
---|---|---|
app
App
or Promise<App>
The app to extend with connected capabilities.
connector
["thegraph", Object]
or "thegraph"
Accepts either a string describing the desired connector (only "thegraph"
for now), or a tuple to also pass a configuration object to the connector.
returns
Promise<Voting>
An Voting
instance (see below).
Either the passed value is not a valid app object, or its name is not voting
.
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 subgraphUrl
directly, or use one of the supported networks.
filters
Object
Optional object allowing to filter the votes.
filters.first
Number
Maximum number of votes. Defaults to 1000
.
filters.skip
Number
Skip a number of votes. Defaults to 0
.
returns
Promise<Vote[]>
The list of votes.
The response seems incorrect.
The connection to the remote source failed.
filters
Object
Optional object allowing to filter the votes. See Voting#votes()
for details.
callback
(error: Error, votes: Vote[]) => void
A callback that will get called every time the result gets updated.
returns
{ unsubscribe: () => void }
Unsubscribe function.
The data couldn’t be fetched.
The connection to the remote source failed.
id
String
Unique identifier for the vote.
creator
Address
Address of the vote creator.
metadata
String
An arbitrary string that can be used to describe the vote.
executed
Boolean
Whether the vote has been executed.
executedAt
String
Block timestamp for the vote execution. .
startDate
String
The start date. Expressed in Unix time (seconds).
snapshotBlock
String
Number of the block before the one in which the vote was created.
supportRequiredPct
String
Percentage of positive votes required, compared to the negatives votes, for the vote to pass.
minAcceptQuorum
String
Percentage of positive votes required, compared to the total, for the vote to pass.
yea
String
Total amount of tokens casted to a positive vote.
nay
String
Total amount of tokens casted to a negative vote.
votingPower
String
Amount of tokens available at the block snapshotBlock
.
script
String
EVM call script to be executed on vote approval.
filters
Object
Optional object allowing to filter the votes.
filters.first
Number
Maximum number of votes. Defaults to 1000
.
filters.skip
Number
Skip a number of votes. Defaults to 0
.
returns
Promise<Cast[]>
The list of casted votes.
The response seems incorrect.
The connection to the remote source failed.
filters
Object
Optional object allowing to filter the votes. See Vote#casts()
for details.
callback
(error: Error, votes: Vote[]) => void
A callback that will get called every time the result gets updated.
returns
{ unsubscribe: () => void }
Unsubscribe function.
The data couldn’t be fetched.
The connection to the remote source failed.
id
String
Unique identifier for the casted vote.
vote
String
The casted Vote
object.
voter
String
The address that casted the vote.
supports
String
Whether or not the vote is positive.
stake
String
Voter stake for the casted vote.
createdAt
String
Block timestamp for the casted vote.