/** * 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 '@convergence-rfq/beet' import * as web3 from '@solana/web3.js' /** * @category Instructions * @category Settle * @category generated */ export type SettleInstructionArgs = { input: number[] /* size: 2 */ } /** * @category Instructions * @category Settle * @category generated */ export const settleStruct = new beet.BeetArgsStruct< SettleInstructionArgs & { instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['input', beet.uniformFixedSizeArray(beet.u8, 2)], ], 'SettleInstructionArgs' ) /** * Accounts required by the _settle_ instruction * * @property [**signer**] protocol * @property [] rfq * @property [] response * @property [_writable_] escrow * @property [_writable_] receiverTokenAccount * @category Instructions * @category Settle * @category generated */ export type SettleInstructionAccounts = { protocol: web3.PublicKey rfq: web3.PublicKey response: web3.PublicKey escrow: web3.PublicKey receiverTokenAccount: web3.PublicKey tokenProgram?: web3.PublicKey anchorRemainingAccounts?: web3.AccountMeta[] } export const settleInstructionDiscriminator = [ 175, 42, 185, 87, 144, 131, 102, 212, ] /** * Creates a _Settle_ 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 Settle * @category generated */ export function createSettleInstruction( accounts: SettleInstructionAccounts, args: SettleInstructionArgs, programId = new web3.PublicKey('HpmyVA3t3uNGgdx86AuwZww7gnAWB57vepnk3732vEr9') ) { const [data] = settleStruct.serialize({ instructionDiscriminator: settleInstructionDiscriminator, ...args, }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.protocol, isWritable: false, isSigner: true, }, { pubkey: accounts.rfq, isWritable: false, isSigner: false, }, { pubkey: accounts.response, isWritable: false, isSigner: false, }, { pubkey: accounts.escrow, isWritable: true, isSigner: false, }, { pubkey: accounts.receiverTokenAccount, isWritable: true, isSigner: false, }, { pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID, 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 }