/** * 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 { VerifiableParams, verifiableParamsBeet, } from '../types/VerifiableParams' /** * @category Instructions * @category Verifiable * @category generated */ export type VerifiableInstructionArgs = { params: VerifiableParams } /** * @category Instructions * @category Verifiable * @category generated */ export const verifiableStruct = new beet.BeetArgsStruct< VerifiableInstructionArgs & { instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['params', verifiableParamsBeet], ], 'VerifiableInstructionArgs' ) /** * Accounts required by the _verifiable_ instruction * * @property [] nonce * @property [] payloadHash * @property [] receiveConfig * @property [] defaultReceiveConfig * @category Instructions * @category Verifiable * @category generated */ export type VerifiableInstructionAccounts = { nonce: web3.PublicKey payloadHash: web3.PublicKey receiveConfig: web3.PublicKey defaultReceiveConfig: web3.PublicKey anchorRemainingAccounts?: web3.AccountMeta[] } export const verifiableInstructionDiscriminator = [ 249, 50, 227, 157, 238, 249, 211, 90, ] /** * Creates a _Verifiable_ 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 Verifiable * @category generated */ export function createVerifiableInstruction( accounts: VerifiableInstructionAccounts, args: VerifiableInstructionArgs, programId: web3.PublicKey ) { const [data] = verifiableStruct.serialize({ instructionDiscriminator: verifiableInstructionDiscriminator, ...args, }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.nonce, isWritable: false, isSigner: false, }, { pubkey: accounts.payloadHash, isWritable: false, isSigner: false, }, { pubkey: accounts.receiveConfig, isWritable: false, isSigner: false, }, { pubkey: accounts.defaultReceiveConfig, 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 _Verifiable_ instructionAccounts. * * @param accounts that will be accessed while the instruction is processed * @category Instructions * @category Verifiable * @category generated */ export function createVerifiableInstructionAccounts( accounts: VerifiableInstructionAccounts, programId: web3.PublicKey ) { const keys: web3.AccountMeta[] = [ { pubkey: accounts.nonce, isWritable: false, isSigner: false, }, { pubkey: accounts.payloadHash, isWritable: false, isSigner: false, }, { pubkey: accounts.receiveConfig, isWritable: false, isSigner: false, }, { pubkey: accounts.defaultReceiveConfig, isWritable: false, isSigner: false, }, ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { keys.push(acc) } } return keys }