typescript-sdk

Home > @3rdweb/sdk > VoteModule > vote

VoteModule.vote() method

Vote

Signature:

vote(proposalId: string, voteType: VoteType, reason?: string): Promise<void>;

Parameters

Parameter Type Description
proposalId string The proposal to cast a vote on.
voteType VoteType The position the voter is taking on their vote.
reason string (optional) The reason for the vote.

Returns:

Promise<void>

Remarks

Vote on an active proposal

Example

// The proposal ID of the proposal you want to vote on
const proposalId = "0";
// The vote type you want to cast, can be VoteType.Against, VoteType.For, or VoteType.Abstain
const voteType = VoteType.For;
// The (optional) reason for the vote
const reason = "I like this proposal!";

await module.vote(proposalId, voteType, reason);