/** * 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 { FeeParameters, feeParametersBeet } from '../types/FeeParameters' /** * @category Instructions * @category InitializeProtocol * @category generated */ export type InitializeProtocolInstructionArgs = { settleFees: FeeParameters defaultFees: FeeParameters assetAddFee: beet.bignum } /** * @category Instructions * @category InitializeProtocol * @category generated */ export const initializeProtocolStruct = new beet.BeetArgsStruct< InitializeProtocolInstructionArgs & { instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['settleFees', feeParametersBeet], ['defaultFees', feeParametersBeet], ['assetAddFee', beet.u64], ], 'InitializeProtocolInstructionArgs' ) /** * Accounts required by the _initializeProtocol_ instruction * * @property [_writable_, **signer**] signer * @property [_writable_] protocol * @property [] riskEngine * @property [] collateralMint * @category Instructions * @category InitializeProtocol * @category generated */ export type InitializeProtocolInstructionAccounts = { signer: web3.PublicKey protocol: web3.PublicKey riskEngine: web3.PublicKey collateralMint: web3.PublicKey systemProgram?: web3.PublicKey anchorRemainingAccounts?: web3.AccountMeta[] } export const initializeProtocolInstructionDiscriminator = [ 188, 233, 252, 106, 134, 146, 202, 91, ] /** * Creates a _InitializeProtocol_ 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 InitializeProtocol * @category generated */ export function createInitializeProtocolInstruction( accounts: InitializeProtocolInstructionAccounts, args: InitializeProtocolInstructionArgs, programId = new web3.PublicKey('FqAhTZg86EKEzeWMLtutVDRXJuLWrey7oDHr3Au6RFdo') ) { const [data] = initializeProtocolStruct.serialize({ instructionDiscriminator: initializeProtocolInstructionDiscriminator, ...args, }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.signer, isWritable: true, isSigner: true, }, { pubkey: accounts.protocol, isWritable: true, isSigner: false, }, { pubkey: accounts.riskEngine, isWritable: false, isSigner: false, }, { pubkey: accounts.collateralMint, 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 }