/** * 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 splToken from '@solana/spl-token' import * as beet from '@metaplex-foundation/beet' import * as web3 from '@solana/web3.js' import { SendWithLzTokenParams, sendWithLzTokenParamsBeet, } from '../types/SendWithLzTokenParams' /** * @category Instructions * @category SendWithLzToken * @category generated */ export type SendWithLzTokenInstructionArgs = { params: SendWithLzTokenParams } /** * @category Instructions * @category SendWithLzToken * @category generated */ export const sendWithLzTokenStruct = new beet.FixableBeetArgsStruct< SendWithLzTokenInstructionArgs & { instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['params', sendWithLzTokenParamsBeet], ], 'SendWithLzTokenInstructionArgs' ) /** * Accounts required by the _sendWithLzToken_ instruction * * @property [**signer**] endpoint * @property [_writable_] messageLib * @property [_writable_] messageLibLzToken * @property [_writable_, **signer**] payer * @property [_writable_] lzTokenSource * @property [] lzTokenMint * @category Instructions * @category SendWithLzToken * @category generated */ export type SendWithLzTokenInstructionAccounts = { endpoint: web3.PublicKey messageLib: web3.PublicKey messageLibLzToken: web3.PublicKey payer: web3.PublicKey lzTokenSource: web3.PublicKey lzTokenMint: web3.PublicKey tokenProgram?: web3.PublicKey systemProgram?: web3.PublicKey anchorRemainingAccounts?: web3.AccountMeta[] } export const sendWithLzTokenInstructionDiscriminator = [ 165, 161, 84, 48, 129, 26, 193, 19, ] /** * Creates a _SendWithLzToken_ 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 SendWithLzToken * @category generated */ export function createSendWithLzTokenInstruction( accounts: SendWithLzTokenInstructionAccounts, args: SendWithLzTokenInstructionArgs, programId: web3.PublicKey ) { const [data] = sendWithLzTokenStruct.serialize({ instructionDiscriminator: sendWithLzTokenInstructionDiscriminator, ...args, }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.endpoint, isWritable: false, isSigner: true, }, { pubkey: accounts.messageLib, isWritable: true, isSigner: false, }, { pubkey: accounts.messageLibLzToken, isWritable: true, isSigner: false, }, { pubkey: accounts.payer, isWritable: true, isSigner: true, }, { pubkey: accounts.lzTokenSource, isWritable: true, isSigner: false, }, { pubkey: accounts.lzTokenMint, isWritable: false, isSigner: false, }, { pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID, isWritable: false, 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 _SendWithLzToken_ instructionAccounts. * * @param accounts that will be accessed while the instruction is processed * @category Instructions * @category SendWithLzToken * @category generated */ export function createSendWithLzTokenInstructionAccounts( accounts: SendWithLzTokenInstructionAccounts, programId: web3.PublicKey ) { const keys: web3.AccountMeta[] = [ { pubkey: accounts.endpoint, isWritable: false, isSigner: true, }, { pubkey: accounts.messageLib, isWritable: true, isSigner: false, }, { pubkey: accounts.messageLibLzToken, isWritable: true, isSigner: false, }, { pubkey: accounts.payer, isWritable: true, isSigner: true, }, { pubkey: accounts.lzTokenSource, isWritable: true, isSigner: false, }, { pubkey: accounts.lzTokenMint, isWritable: false, isSigner: false, }, { pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID, isWritable: false, 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 }