import { Keypair , PublicKey , TransactionInstruction } from '@solana/web3.js' ; import { Proposal } from '@solana/spl-governance' ; import { withCastVote } from '@solana/spl-governance' ; import { Vote , YesNoVote } from '@solana/spl-governance' ; import { sendTransactionWithNotifications } from '../tools/transactions' ; import { RpcContext } from '@solana/spl-governance' ; import { ProgramAccount } from '@solana/spl-governance' ; export const castVote = async ( { connection , wallet , programId , programVersion , walletPubkey } , realm , proposal , tokeOwnerRecord , yesNoVote ) => { let signers = [ ] ; let instructions = [ ] ; let governanceAuthority = walletPubkey ; let payer = walletPubkey ; await withCastVote ( instructions , programId , programVersion , realm , proposal . account . governance , proposal . pubkey , proposal . account . tokenOwnerRecord , tokeOwnerRecord , governanceAuthority , proposal . account . governingTokenMint , Vote . fromYesNoVote ( yesNoVote ) , payer ) ; await sendTransactionWithNotifications ( connection , wallet , instructions , signers , 'Voting on proposal' , 'Proposal voted on' ) ; } ;