/** * 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 InitializeCollateral * @category generated */ export const initializeCollateralStruct = new beet.BeetArgsStruct<{ instructionDiscriminator: number[] /* size: 8 */ }>( [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], 'InitializeCollateralInstructionArgs' ) /** * Accounts required by the _initializeCollateral_ instruction * * @property [_writable_, **signer**] user * @property [] protocol * @property [_writable_] collateralInfo * @property [_writable_] collateralToken * @property [] collateralMint * @category Instructions * @category InitializeCollateral * @category generated */ export type InitializeCollateralInstructionAccounts = { user: web3.PublicKey protocol: web3.PublicKey collateralInfo: web3.PublicKey collateralToken: web3.PublicKey collateralMint: web3.PublicKey systemProgram?: web3.PublicKey tokenProgram?: web3.PublicKey rent?: web3.PublicKey anchorRemainingAccounts?: web3.AccountMeta[] } export const initializeCollateralInstructionDiscriminator = [ 5, 185, 112, 16, 169, 75, 193, 165, ] /** * Creates a _InitializeCollateral_ instruction. * * @param accounts that will be accessed while the instruction is processed * @category Instructions * @category InitializeCollateral * @category generated */ export function createInitializeCollateralInstruction( accounts: InitializeCollateralInstructionAccounts, programId = new web3.PublicKey('FqAhTZg86EKEzeWMLtutVDRXJuLWrey7oDHr3Au6RFdo') ) { const [data] = initializeCollateralStruct.serialize({ instructionDiscriminator: initializeCollateralInstructionDiscriminator, }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.user, isWritable: true, isSigner: true, }, { pubkey: accounts.protocol, isWritable: false, isSigner: false, }, { pubkey: accounts.collateralInfo, isWritable: true, isSigner: false, }, { pubkey: accounts.collateralToken, isWritable: true, isSigner: false, }, { pubkey: accounts.collateralMint, isWritable: false, isSigner: false, }, { pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, isWritable: false, isSigner: false, }, { pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID, isWritable: false, isSigner: false, }, { pubkey: accounts.rent ?? web3.SYSVAR_RENT_PUBKEY, 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 }