/** * 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 '@convergence-rfq/beet' import * as web3 from '@solana/web3.js' import { Quote, quoteBeet } from '../types/Quote' /** * @category Instructions * @category RespondToRfq * @category generated */ export type RespondToRfqInstructionArgs = { bid: beet.COption ask: beet.COption pdaDistinguisher: number expirationTimestamp: beet.bignum additionalData: Uint8Array } /** * @category Instructions * @category RespondToRfq * @category generated */ export const respondToRfqStruct = new beet.FixableBeetArgsStruct< RespondToRfqInstructionArgs & { instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['bid', beet.coption(quoteBeet)], ['ask', beet.coption(quoteBeet)], ['pdaDistinguisher', beet.u16], ['expirationTimestamp', beet.i64], ['additionalData', beet.bytes], ], 'RespondToRfqInstructionArgs' ) /** * Accounts required by the _respondToRfq_ instruction * * @property [_writable_, **signer**] maker * @property [] protocol * @property [_writable_] rfq * @property [_writable_] response * @property [_writable_] collateralInfo * @property [] collateralToken * @property [] riskEngine * @property [] whitelist * @category Instructions * @category RespondToRfq * @category generated */ export type RespondToRfqInstructionAccounts = { maker: web3.PublicKey protocol: web3.PublicKey rfq: web3.PublicKey response: web3.PublicKey collateralInfo: web3.PublicKey collateralToken: web3.PublicKey riskEngine: web3.PublicKey whitelist: web3.PublicKey systemProgram?: web3.PublicKey anchorRemainingAccounts?: web3.AccountMeta[] } export const respondToRfqInstructionDiscriminator = [ 6, 226, 238, 129, 112, 7, 193, 164, ] /** * Creates a _RespondToRfq_ 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 RespondToRfq * @category generated */ export function createRespondToRfqInstruction( accounts: RespondToRfqInstructionAccounts, args: RespondToRfqInstructionArgs, programId = new web3.PublicKey('FqAhTZg86EKEzeWMLtutVDRXJuLWrey7oDHr3Au6RFdo') ) { const [data] = respondToRfqStruct.serialize({ instructionDiscriminator: respondToRfqInstructionDiscriminator, ...args, }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.maker, isWritable: true, isSigner: true, }, { pubkey: accounts.protocol, isWritable: false, isSigner: false, }, { pubkey: accounts.rfq, isWritable: true, isSigner: false, }, { pubkey: accounts.response, isWritable: true, isSigner: false, }, { pubkey: accounts.collateralInfo, isWritable: true, isSigner: false, }, { pubkey: accounts.collateralToken, isWritable: false, isSigner: false, }, { pubkey: accounts.riskEngine, isWritable: false, isSigner: false, }, { pubkey: accounts.whitelist, 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 }