import { Keypair , PublicKey , TransactionInstruction } from '@solana/web3.js' ; import { InstructionData , Proposal } from '@solana/spl-governance' ; import { withInsertInstruction } from '@solana/spl-governance' ; import { sendTransactionWithNotifications } from '../tools/transactions' ; import { RpcContext } from '@solana/spl-governance' ; import { ProgramAccount } from '@solana/spl-governance' ; export const insertInstruction = async ( { connection , wallet , programId , programVersion , walletPubkey } , proposal , tokenOwnerRecord , index , holdUpTime , instructionData ) => { let signers = [ ] ; let instructions = [ ] ; const governanceAuthority = walletPubkey ; const payer = walletPubkey ; const proposalInstructionAddress = await withInsertInstruction ( instructions , programId , programVersion , proposal . account . governance , proposal . pubkey , tokenOwnerRecord , governanceAuthority , index , holdUpTime , instructionData , payer ) ; await sendTransactionWithNotifications ( connection , wallet , instructions , signers , 'Adding instruction' , 'Instruction added' ) ; return proposalInstructionAddress ; } ;