Type alias InstructionNamespace<IDL, I>

InstructionNamespace<IDL, I>: MakeInstructionsNamespace<IDL, I, TransactionInstruction, {
    [M in keyof AllInstructionsMap<IDL>]: {
        accounts: ((ctx) => unknown);
    }
}>

The namespace provides functions to build [[TransactionInstruction]] objects for each method of a program.

Usage

instruction.<method>(...args, ctx);

Parameters

  1. args - The positional arguments for the program. The type and number of these arguments depend on the program being used.
  2. ctx - [[Context]] non-argument parameters to pass to the method. Always the last parameter in the method call.

Example

To create an instruction for the increment method above,

const tx = await program.instruction.increment({
accounts: {
counter,
},
});

Type Parameters