The namespace provides functions to build [[TransactionInstruction]] objects for each method of a program.
instruction.<method>(...args, ctx); Copy
instruction.<method>(...args, ctx);
args
ctx
To create an instruction for the increment method above,
increment
const tx = await program.instruction.increment({ accounts: { counter, },}); Copy
const tx = await program.instruction.increment({ accounts: { counter, },});
The namespace provides functions to build [[TransactionInstruction]] objects for each method of a program.
Usage
Parameters
args- The positional arguments for the program. The type and number of these arguments depend on the program being used.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
incrementmethod above,