UNPKG

@metaplex-foundation/mpl-toolbox

Version:

Auto-generated essential Solana and Metaplex programs

48 lines 2.42 kB
"use strict"; /** * 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/metaplex-foundation/kinobi */ Object.defineProperty(exports, "__esModule", { value: true }); exports.approveTokenDelegateChecked = exports.getApproveTokenDelegateCheckedInstructionDataSerializer = void 0; const umi_1 = require("@metaplex-foundation/umi"); const serializers_1 = require("@metaplex-foundation/umi/serializers"); const shared_1 = require("../shared"); function getApproveTokenDelegateCheckedInstructionDataSerializer() { return (0, serializers_1.mapSerializer)((0, serializers_1.struct)([ ['discriminator', (0, serializers_1.u8)()], ['amount', (0, serializers_1.u64)()], ['decimals', (0, serializers_1.u8)()], ], { description: 'ApproveTokenDelegateCheckedInstructionData' }), (value) => ({ ...value, discriminator: 13 })); } exports.getApproveTokenDelegateCheckedInstructionDataSerializer = getApproveTokenDelegateCheckedInstructionDataSerializer; // Instruction. function approveTokenDelegateChecked(context, input) { // Program ID. const programId = context.programs.getPublicKey('splToken', 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'); // Accounts. const resolvedAccounts = { source: { index: 0, isWritable: true, value: input.source ?? null }, mint: { index: 1, isWritable: false, value: input.mint ?? null }, delegate: { index: 2, isWritable: false, value: input.delegate ?? null }, owner: { index: 3, isWritable: false, value: input.owner ?? null }, }; // Arguments. const resolvedArgs = { ...input }; // Accounts in order. const orderedAccounts = Object.values(resolvedAccounts).sort((a, b) => a.index - b.index); // Keys and Signers. const [keys, signers] = (0, shared_1.getAccountMetasAndSigners)(orderedAccounts, 'programId', programId); // Data. const data = getApproveTokenDelegateCheckedInstructionDataSerializer().serialize(resolvedArgs); // Bytes Created On Chain. const bytesCreatedOnChain = 0; return (0, umi_1.transactionBuilder)([ { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, ]); } exports.approveTokenDelegateChecked = approveTokenDelegateChecked; //# sourceMappingURL=approveTokenDelegateChecked.js.map