Skip to main content

Vote.propose() method

Create Proposal

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 get 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 contract (which you would need to setup in code)
transactionData: tokenContract.encoder.encode("transfer", [
fromAddress,
amount,
]),
},
];

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

Signature:

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

Parameters

ParameterTypeDescription
descriptionstringThe description of the proposal.
executionsProposalExecutable[](Optional) A set of executable transactions that will be run if the proposal is passed and executed.

Returns:

Promise<TransactionResultWithId>

  • The id of the created proposal and the transaction receipt.

Remarks

Create a new proposal for token holders to vote on.