/** * 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 { ClearComposeParams, clearComposeParamsBeet, } from '../types/ClearComposeParams' /** * @category Instructions * @category ClearCompose * @category generated */ export type ClearComposeInstructionArgs = { params: ClearComposeParams } /** * @category Instructions * @category ClearCompose * @category generated */ export const clearComposeStruct = new beet.FixableBeetArgsStruct< ClearComposeInstructionArgs & { instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['params', clearComposeParamsBeet], ], 'ClearComposeInstructionArgs' ) /** * Accounts required by the _clearCompose_ instruction * * @property [**signer**] to * @property [_writable_] composeMessage * @property [] eventAuthority * @property [] program * @category Instructions * @category ClearCompose * @category generated */ export type ClearComposeInstructionAccounts = { to: web3.PublicKey composeMessage: web3.PublicKey eventAuthority: web3.PublicKey program: web3.PublicKey anchorRemainingAccounts?: web3.AccountMeta[] } export const clearComposeInstructionDiscriminator = [ 118, 1, 18, 142, 95, 175, 21, 125, ] /** * Creates a _ClearCompose_ 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 ClearCompose * @category generated */ export function createClearComposeInstruction( accounts: ClearComposeInstructionAccounts, args: ClearComposeInstructionArgs, programId: web3.PublicKey ) { const [data] = clearComposeStruct.serialize({ instructionDiscriminator: clearComposeInstructionDiscriminator, ...args, }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.to, isWritable: false, isSigner: true, }, { pubkey: accounts.composeMessage, isWritable: true, isSigner: false, }, { pubkey: accounts.eventAuthority, isWritable: false, isSigner: false, }, { pubkey: accounts.program, isWritable: false, 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 _ClearCompose_ instructionAccounts. * * @param accounts that will be accessed while the instruction is processed * @category Instructions * @category ClearCompose * @category generated */ export function createClearComposeInstructionAccounts( accounts: ClearComposeInstructionAccounts, programId: web3.PublicKey ) { const keys: web3.AccountMeta[] = [ { pubkey: accounts.to, isWritable: false, isSigner: true, }, { pubkey: accounts.composeMessage, isWritable: true, isSigner: false, }, { pubkey: accounts.eventAuthority, isWritable: false, isSigner: false, }, { pubkey: accounts.program, isWritable: false, isSigner: false, }, ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { keys.push(acc) } } return keys }