/** * 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 { InitSendLibraryParams, initSendLibraryParamsBeet, } from '../types/InitSendLibraryParams' /** * @category Instructions * @category InitSendLibrary * @category generated */ export type InitSendLibraryInstructionArgs = { params: InitSendLibraryParams } /** * @category Instructions * @category InitSendLibrary * @category generated */ export const initSendLibraryStruct = new beet.BeetArgsStruct< InitSendLibraryInstructionArgs & { instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['params', initSendLibraryParamsBeet], ], 'InitSendLibraryInstructionArgs' ) /** * Accounts required by the _initSendLibrary_ instruction * * @property [_writable_, **signer**] delegate * @property [] oappRegistry * @property [_writable_] sendLibraryConfig * @category Instructions * @category InitSendLibrary * @category generated */ export type InitSendLibraryInstructionAccounts = { delegate: web3.PublicKey oappRegistry: web3.PublicKey sendLibraryConfig: web3.PublicKey systemProgram?: web3.PublicKey anchorRemainingAccounts?: web3.AccountMeta[] } export const initSendLibraryInstructionDiscriminator = [ 156, 24, 235, 120, 73, 193, 144, 19, ] /** * Creates a _InitSendLibrary_ 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 InitSendLibrary * @category generated */ export function createInitSendLibraryInstruction( accounts: InitSendLibraryInstructionAccounts, args: InitSendLibraryInstructionArgs, programId: web3.PublicKey ) { const [data] = initSendLibraryStruct.serialize({ instructionDiscriminator: initSendLibraryInstructionDiscriminator, ...args, }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.delegate, isWritable: true, isSigner: true, }, { pubkey: accounts.oappRegistry, isWritable: false, isSigner: false, }, { pubkey: accounts.sendLibraryConfig, isWritable: true, isSigner: false, }, { pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, 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 _InitSendLibrary_ instructionAccounts. * * @param accounts that will be accessed while the instruction is processed * @category Instructions * @category InitSendLibrary * @category generated */ export function createInitSendLibraryInstructionAccounts( accounts: InitSendLibraryInstructionAccounts, programId: web3.PublicKey ) { const keys: web3.AccountMeta[] = [ { pubkey: accounts.delegate, isWritable: true, isSigner: true, }, { pubkey: accounts.oappRegistry, isWritable: false, isSigner: false, }, { pubkey: accounts.sendLibraryConfig, isWritable: true, isSigner: false, }, { pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, isWritable: false, isSigner: false, }, ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { keys.push(acc) } } return keys }