useCanVote QUERY

checks if an account can vote on a proposal

import { useCanVote } from '@daobox/use-aragon'

Usage

import { useCanVote } from '@daobox/use-aragon'

function App() {
  const { data, isLoading, isError } = useCanVote({
    // required
    proposalId: '0x1234567890123456789012345678901234567890_0x0',
    voterAddressOrEns: 'abuusama.eth', // your-plugin.plugin.dao.eth
    vote: VoteValues.YES, // alternatively, could be  NO or ABSTAIN.
  })

  if (isLoading) return <div>Loading...</div>
  if (isError) return <div>Error!!!</div>

  return (
    <>
      <div>Can vote: {data}</div>
    </>
  )
}

Required Parameters

  • Name
    proposalId
    Type
    string
    Description

    The ID of the proposal.

  • Name
    voterAddressOrEns
    Type
    string
    Description

    The address or ENS name of the voter.

  • Name
    vote
    Type
    VoteValues
    Description

    The vote, either YES, NO or ABSTAIN.

Return Data

data: boolean | null

Return Data example

{
  boolean: true | false
}

Return Values

{
  data: boolean | null,
  error: Error | null,
  isSuccess: boolean,
  isError: boolean,
  isLoading: boolean,
  isRefetching: boolean,
}