typescript-sdk

Home > @3rdweb/sdk > VoteModule > propose

VoteModule.propose() method

Create Proposal

Signature:

propose(description: string, executions?: ProposalExecutable[]): Promise<BigNumber>;

Parameters

Parameter Type Description
description string The description of the proposal.
executions ProposalExecutable[] A set of executable transactions that will be run if the proposal is passed and executed.

Returns:

Promise<BigNumber>

Remarks

Create a new proposal for token holders to vote on.

Example

// The description of the proposal you want to pass
const description = "This is a great proposal - vote for it!"
// You can (optionally) pass in contract calls that will executed when the proposal is executed.
const executions = [
  {
    // The contract you want to make a call to
    toAddress: "0x...",
    // The amount of the native currency to send in this transaction
    nativeTokenValue: 0,
    // Transaction data that will be executed when the proposal is executed
    // This is an example transfer transaction with a token module (which you would need to setup in code)
    transactionData: tokenModule.contract.interface.encodeFunctionData(
      "transfer", [
        fromAddress,
        amount,
      ]
    ),
  }
]

const proposal = await module.propose(description, executions);