/** * 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 '@convergence-rfq/beet' import * as web3 from '@solana/web3.js' /** * @category Instructions * @category ValidateData * @category generated */ export type ValidateDataInstructionArgs = { instrumentData: Uint8Array baseAssetIndex: beet.COption instrumentDecimals: number } /** * @category Instructions * @category ValidateData * @category generated */ export const validateDataStruct = new beet.FixableBeetArgsStruct< ValidateDataInstructionArgs & { instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['instrumentData', beet.bytes], ['baseAssetIndex', beet.coption(beet.u16)], ['instrumentDecimals', beet.u8], ], 'ValidateDataInstructionArgs' ) /** * Accounts required by the _validateData_ instruction * * @property [**signer**] protocol * @property [] americanMeta * @property [] underlyingAssetMint * @property [] stableAssetMint * @category Instructions * @category ValidateData * @category generated */ export type ValidateDataInstructionAccounts = { protocol: web3.PublicKey americanMeta: web3.PublicKey underlyingAssetMint: web3.PublicKey stableAssetMint: web3.PublicKey anchorRemainingAccounts?: web3.AccountMeta[] } export const validateDataInstructionDiscriminator = [ 181, 2, 45, 238, 64, 129, 254, 198, ] /** * Creates a _ValidateData_ 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 ValidateData * @category generated */ export function createValidateDataInstruction( accounts: ValidateDataInstructionAccounts, args: ValidateDataInstructionArgs, programId = new web3.PublicKey('HpmyVA3t3uNGgdx86AuwZww7gnAWB57vepnk3732vEr9') ) { const [data] = validateDataStruct.serialize({ instructionDiscriminator: validateDataInstructionDiscriminator, ...args, }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.protocol, isWritable: false, isSigner: true, }, { pubkey: accounts.americanMeta, isWritable: false, isSigner: false, }, { pubkey: accounts.underlyingAssetMint, isWritable: false, isSigner: false, }, { pubkey: accounts.stableAssetMint, 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 }