To utilize the Token Voting governance system in your DAO, it's crucial to have the TokenVoting plugin installed. Once this is in place, you can proceed to initiate proposals using the 'createProposal' method available in your TokenVotingClient.
import { CreateMajorityVotingProposalParams, ProposalCreationSteps, TokenVotingClient, VoteValues,} from"@aragon/sdk-client";import { ProposalMetadata } from"@aragon/sdk-client-common";import { context } from"../index";// Create a TokenVoting client.consttokenVotingClient:TokenVotingClient=newTokenVotingClient( context,);constmetadata:ProposalMetadata= { title:"Test Proposal", summary:"This is a short description", description:"This is a long description", resources: [ { name:"Discord", url:"https://discord.com/...", }, { name:"Website", url:"https://website...", }, ], media: { logo:"https://...", header:"https://...", },};// Pin the metadata in IPFS to get back the URI.constmetadataUri:string=awaittokenVotingClient.methods.pinMetadata( metadata,);constpluginAddress:string="0x1234567890123456789012345678901234567890"; // the address of the plugin contract containing all plugin logic.constproposalParams:CreateMajorityVotingProposalParams= { pluginAddress, metadataUri, actions: [], startDate:newDate(), endDate:newDate(), executeOnPass:false, creatorVote:VoteValues.YES,// default NO, other options: ABSTAIN, YES. This saves gas for the voting transaction.};// Create a proposal where members participate through token voting.conststeps=tokenVotingClient.methods.createProposal(proposalParams);forawait (conststepof steps) {try {switch (step.key) {caseProposalCreationSteps.CREATING:console.log({ txHash:step.txHash });break;caseProposalCreationSteps.DONE:console.log({ proposalId:step.proposalId });break; } } catch (err) {console.error(err); }}