/** * This code was AUTOGENERATED using the kinobi library. * Please DO NOT EDIT THIS FILE, instead use visitors * to add features, then rerun kinobi to update it. * * @see https://github.com/kinobi-so/kinobi */ import { Context, Pda, PublicKey, Signer, TransactionBuilder, transactionBuilder, } from '@metaplex-foundation/umi'; import { Serializer, bytes, mapSerializer, struct, } from '@metaplex-foundation/umi/serializers'; import { ResolvedAccount, ResolvedAccountsWithIndices, getAccountMetasAndSigners, } from '../shared'; // Accounts. export type CloseVerifyInstructionAccounts = { dvn: Signer; receiver: PublicKey | Pda; confirmations: PublicKey | Pda; }; // Data. export type CloseVerifyInstructionData = { discriminator: Uint8Array; packetHeaderHash: Uint8Array; payloadHash: Uint8Array; }; export type CloseVerifyInstructionDataArgs = { packetHeaderHash: Uint8Array; payloadHash: Uint8Array; }; export function getCloseVerifyInstructionDataSerializer(): Serializer< CloseVerifyInstructionDataArgs, CloseVerifyInstructionData > { return mapSerializer< CloseVerifyInstructionDataArgs, any, CloseVerifyInstructionData >( struct( [ ['discriminator', bytes({ size: 8 })], ['packetHeaderHash', bytes({ size: 32 })], ['payloadHash', bytes({ size: 32 })], ], { description: 'CloseVerifyInstructionData' } ), (value) => ({ ...value, discriminator: new Uint8Array([44, 133, 228, 138, 169, 242, 53, 36]), }) ) as Serializer; } // Args. export type CloseVerifyInstructionArgs = CloseVerifyInstructionDataArgs; // Instruction. export function closeVerify( context: Pick, input: CloseVerifyInstructionAccounts & CloseVerifyInstructionArgs ): TransactionBuilder { // Program ID. const programId = context.programs.getPublicKey( 'uln', '7a4WjyR8VZ7yZz5XJAKm39BUGn5iT9CKcv2pmG9tdXVH' ); // Accounts. const resolvedAccounts = { dvn: { index: 0, isWritable: false as boolean, value: input.dvn ?? null }, receiver: { index: 1, isWritable: true as boolean, value: input.receiver ?? null, }, confirmations: { index: 2, isWritable: true as boolean, value: input.confirmations ?? null, }, } satisfies ResolvedAccountsWithIndices; // Arguments. const resolvedArgs: CloseVerifyInstructionArgs = { ...input }; // Accounts in order. const orderedAccounts: ResolvedAccount[] = Object.values( resolvedAccounts ).sort((a, b) => a.index - b.index); // Keys and Signers. const [keys, signers] = getAccountMetasAndSigners( orderedAccounts, 'programId', programId ); // Data. const data = getCloseVerifyInstructionDataSerializer().serialize( resolvedArgs as CloseVerifyInstructionDataArgs ); // Bytes Created On Chain. const bytesCreatedOnChain = 0; return transactionBuilder([ { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, ]); }