/** * 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 '@metaplex-foundation/beet' import * as web3 from '@solana/web3.js' import { InitNonceParams, initNonceParamsBeet } from '../types/InitNonceParams' /** * @category Instructions * @category InitNonce * @category generated */ export type InitNonceInstructionArgs = { params: InitNonceParams } /** * @category Instructions * @category InitNonce * @category generated */ export const initNonceStruct = new beet.BeetArgsStruct< InitNonceInstructionArgs & { instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['params', initNonceParamsBeet], ], 'InitNonceInstructionArgs' ) /** * Accounts required by the _initNonce_ instruction * * @property [_writable_, **signer**] delegate * @property [] oappRegistry * @property [_writable_] nonce * @property [_writable_] pendingInboundNonce * @category Instructions * @category InitNonce * @category generated */ export type InitNonceInstructionAccounts = { delegate: web3.PublicKey oappRegistry: web3.PublicKey nonce: web3.PublicKey pendingInboundNonce: web3.PublicKey systemProgram?: web3.PublicKey anchorRemainingAccounts?: web3.AccountMeta[] } export const initNonceInstructionDiscriminator = [ 204, 171, 16, 214, 182, 191, 27, 196, ] /** * Creates a _InitNonce_ 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 InitNonce * @category generated */ export function createInitNonceInstruction( accounts: InitNonceInstructionAccounts, args: InitNonceInstructionArgs, programId: web3.PublicKey ) { const [data] = initNonceStruct.serialize({ instructionDiscriminator: initNonceInstructionDiscriminator, ...args, }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.delegate, isWritable: true, isSigner: true, }, { pubkey: accounts.oappRegistry, isWritable: false, isSigner: false, }, { pubkey: accounts.nonce, isWritable: true, isSigner: false, }, { pubkey: accounts.pendingInboundNonce, isWritable: true, 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 } /** * Creates a _InitNonce_ instructionAccounts. * * @param accounts that will be accessed while the instruction is processed * @category Instructions * @category InitNonce * @category generated */ export function createInitNonceInstructionAccounts( accounts: InitNonceInstructionAccounts, programId: web3.PublicKey ) { const keys: web3.AccountMeta[] = [ { pubkey: accounts.delegate, isWritable: true, isSigner: true, }, { pubkey: accounts.oappRegistry, isWritable: false, isSigner: false, }, { pubkey: accounts.nonce, isWritable: true, isSigner: false, }, { pubkey: accounts.pendingInboundNonce, isWritable: true, 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) } } return keys }