useVoteOnProposal MUTATION

Hook for voting on a proposal on a TokenVoting plugin.

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

Usage

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

function App() {
  const { mutate, VoteStatus, voteTxHash } = useVoteOnProposal({
    // required
    proposalId: '0x1234567890123456789012345678901234567890_0x0',
    vote: VoteValues.YES, // other options: NO, ABSTAIN
  })

  return (
    <>
      <button onClick={() => mutate?.()}>"Create New Proposal"</button>
      <p>{VoteStatus}</p>
      <p>{voteTxHash}</p>
    </>
  )
}

Required Parameters

  • Name
    proposalId
    Type
    string
    Description

    The id of the proposal to vote on.

  • Name
    vote
    Type
    VoteValues
    Description

    The vote to cast. Options: VoteValues.YES, VoteValues.NO, VoteValues.ABSTAIN

Return Values

{
  data: NewProposalReturnData | null,
  error: Error | null,
  voteTxHash: string | null,
  isLoading: boolean,
  isSuccess: boolean,
  isError: boolean,
  reset: function,
  mutate: function,
  NewVoteStatus: 'idle' | 'pinningMetadata' | 'creatingProposal' | 'confirmingTransaction' | 'success' |'error',
}

Return Data

{
  voteTxHash: string | null,
  voteStatus: VoteStatus | null,
}