/** * 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 { ExecutableParams, executableParamsBeet, } from '../types/ExecutableParams' /** * @category Instructions * @category Executable * @category generated */ export type ExecutableInstructionArgs = { params: ExecutableParams } /** * @category Instructions * @category Executable * @category generated */ export const executableStruct = new beet.BeetArgsStruct< ExecutableInstructionArgs & { instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['params', executableParamsBeet], ], 'ExecutableInstructionArgs' ) /** * Accounts required by the _executable_ instruction * * @property [] nonce * @property [] payloadHash * @category Instructions * @category Executable * @category generated */ export type ExecutableInstructionAccounts = { nonce: web3.PublicKey payloadHash: web3.PublicKey anchorRemainingAccounts?: web3.AccountMeta[] } export const executableInstructionDiscriminator = [ 57, 165, 171, 234, 157, 191, 156, 25, ] /** * Creates a _Executable_ 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 Executable * @category generated */ export function createExecutableInstruction( accounts: ExecutableInstructionAccounts, args: ExecutableInstructionArgs, programId: web3.PublicKey ) { const [data] = executableStruct.serialize({ instructionDiscriminator: executableInstructionDiscriminator, ...args, }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.nonce, isWritable: false, isSigner: false, }, { pubkey: accounts.payloadHash, 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 _Executable_ instructionAccounts. * * @param accounts that will be accessed while the instruction is processed * @category Instructions * @category Executable * @category generated */ export function createExecutableInstructionAccounts( accounts: ExecutableInstructionAccounts, programId: web3.PublicKey ) { const keys: web3.AccountMeta[] = [ { pubkey: accounts.nonce, isWritable: false, isSigner: false, }, { pubkey: accounts.payloadHash, isWritable: false, isSigner: false, }, ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { keys.push(acc) } } return keys }