/** * 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 { BaseAssetIndex, baseAssetIndexBeet } from '../types/BaseAssetIndex' /** * @category Instructions * @category AddUserAsset * @category generated */ export type AddUserAssetInstructionArgs = { index: BaseAssetIndex ticker: string } /** * @category Instructions * @category AddUserAsset * @category generated */ export const addUserAssetStruct = new beet.FixableBeetArgsStruct< AddUserAssetInstructionArgs & { instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['index', baseAssetIndexBeet], ['ticker', beet.utf8String], ], 'AddUserAssetInstructionArgs' ) /** * Accounts required by the _addUserAsset_ instruction * * @property [_writable_, **signer**] creator * @property [_writable_] authority * @property [] protocol * @property [_writable_] baseAsset * @property [_writable_] mintInfo * @property [] mint * @category Instructions * @category AddUserAsset * @category generated */ export type AddUserAssetInstructionAccounts = { creator: web3.PublicKey authority: web3.PublicKey protocol: web3.PublicKey baseAsset: web3.PublicKey mintInfo: web3.PublicKey mint: web3.PublicKey systemProgram?: web3.PublicKey anchorRemainingAccounts?: web3.AccountMeta[] } export const addUserAssetInstructionDiscriminator = [ 243, 6, 215, 182, 146, 138, 90, 85, ] /** * Creates a _AddUserAsset_ 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 AddUserAsset * @category generated */ export function createAddUserAssetInstruction( accounts: AddUserAssetInstructionAccounts, args: AddUserAssetInstructionArgs, programId = new web3.PublicKey('FqAhTZg86EKEzeWMLtutVDRXJuLWrey7oDHr3Au6RFdo') ) { const [data] = addUserAssetStruct.serialize({ instructionDiscriminator: addUserAssetInstructionDiscriminator, ...args, }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.creator, isWritable: true, isSigner: true, }, { pubkey: accounts.authority, isWritable: true, isSigner: false, }, { pubkey: accounts.protocol, isWritable: false, isSigner: false, }, { pubkey: accounts.baseAsset, isWritable: true, isSigner: false, }, { pubkey: accounts.mintInfo, isWritable: true, isSigner: false, }, { pubkey: accounts.mint, 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 }