/** * This code was GENERATED using the solita package. * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. * * See: https://github.com/metaplex-foundation/solita */ import * as beet from '@metaplex-foundation/beet' import * as web3 from '@solana/web3.js' import { CloseExecuteParams, closeExecuteParamsBeet, } from '../types/CloseExecuteParams' /** * @category Instructions * @category CloseExecute * @category generated */ export type CloseExecuteInstructionArgs = { params: CloseExecuteParams } /** * @category Instructions * @category CloseExecute * @category generated */ export const closeExecuteStruct = new beet.BeetArgsStruct< CloseExecuteInstructionArgs & { instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['params', closeExecuteParamsBeet], ], 'CloseExecuteInstructionArgs' ) /** * Accounts required by the _closeExecute_ instruction * * @property [**signer**] admin * @property [_writable_] config * @property [_writable_] executeHash * @category Instructions * @category CloseExecute * @category generated */ export type CloseExecuteInstructionAccounts = { admin: web3.PublicKey config: web3.PublicKey executeHash: web3.PublicKey anchorRemainingAccounts?: web3.AccountMeta[] } export const closeExecuteInstructionDiscriminator = [ 253, 220, 23, 127, 15, 171, 189, 226, ] /** * Creates a _CloseExecute_ instruction. * * @param accounts that will be accessed while the instruction is processed * @param args to provide as instruction data to the program * * @category Instructions * @category CloseExecute * @category generated */ export function createCloseExecuteInstruction( accounts: CloseExecuteInstructionAccounts, args: CloseExecuteInstructionArgs, programId: web3.PublicKey ) { const [data] = closeExecuteStruct.serialize({ instructionDiscriminator: closeExecuteInstructionDiscriminator, ...args, }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.admin, isWritable: false, isSigner: true, }, { pubkey: accounts.config, isWritable: true, isSigner: false, }, { pubkey: accounts.executeHash, isWritable: true, isSigner: false, }, ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { keys.push(acc) } } const ix = new web3.TransactionInstruction({ programId, keys, data, }) return ix } /** * Creates a _CloseExecute_ instructionAccounts. * * @param accounts that will be accessed while the instruction is processed * @category Instructions * @category CloseExecute * @category generated */ export function createCloseExecuteInstructionAccounts( accounts: CloseExecuteInstructionAccounts, programId: web3.PublicKey ) { const keys: web3.AccountMeta[] = [ { pubkey: accounts.admin, isWritable: false, isSigner: true, }, { pubkey: accounts.config, isWritable: true, isSigner: false, }, { pubkey: accounts.executeHash, isWritable: true, isSigner: false, }, ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { keys.push(acc) } } return keys }