/** * 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 ExtendPriceFeedInstructionAccounts = { admin: Signer; priceFeed: PublicKey | Pda; systemProgram?: PublicKey | Pda; }; // Data. export type ExtendPriceFeedInstructionData = { discriminator: Uint8Array }; export type ExtendPriceFeedInstructionDataArgs = {}; export function getExtendPriceFeedInstructionDataSerializer(): Serializer< ExtendPriceFeedInstructionDataArgs, ExtendPriceFeedInstructionData > { return mapSerializer< ExtendPriceFeedInstructionDataArgs, any, ExtendPriceFeedInstructionData >( struct( [['discriminator', bytes({ size: 8 })]], { description: 'ExtendPriceFeedInstructionData' } ), (value) => ({ ...value, discriminator: new Uint8Array([16, 95, 1, 5, 220, 54, 15, 80]), }) ) as Serializer< ExtendPriceFeedInstructionDataArgs, ExtendPriceFeedInstructionData >; } // Instruction. export function extendPriceFeed( context: Pick, input: ExtendPriceFeedInstructionAccounts ): TransactionBuilder { // Program ID. const programId = context.programs.getPublicKey( 'pricefeed', '8ahPGPjEbpgGaZx2NV1iG5Shj7TDwvsjkEDcGWjt94TP' ); // Accounts. const resolvedAccounts = { admin: { index: 0, isWritable: true as boolean, value: input.admin ?? null, }, priceFeed: { index: 1, isWritable: true as boolean, value: input.priceFeed ?? null, }, systemProgram: { index: 2, isWritable: false as boolean, value: input.systemProgram ?? null, }, } satisfies ResolvedAccountsWithIndices; // Default values. if (!resolvedAccounts.systemProgram.value) { resolvedAccounts.systemProgram.value = context.programs.getPublicKey( 'splSystem', '11111111111111111111111111111111' ); resolvedAccounts.systemProgram.isWritable = false; } // 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 = getExtendPriceFeedInstructionDataSerializer().serialize({}); // Bytes Created On Chain. const bytesCreatedOnChain = 0; return transactionBuilder([ { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, ]); }