Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 4.08 KB

InstructionAccountNode.md

File metadata and controls

64 lines (48 loc) · 4.08 KB

InstructionAccountNode

This node defines an account used by an instruction. It is characterized by its name and various requirements such as whether it needs to be writable or a signer.

Diagram

Attributes

Data

Attribute Type Description
kind "instructionAccountNode" The node discriminator.
name CamelCaseString The name of the instruction account.
isWritable boolean Whether of not the account needs to be writable.
isSigner boolean | "either" Whether or not the account needs to be a signer. If the value "either" is provided, the account can be either a signer or not depending on the context.
isOptional boolean (Optional) Whether or not the account is optional. If this is true, the account should be handled as an optional account according to the optionalAccountStrategy attribute of the InstructionNode. Defaults to false.
docs string[] Markdown documentation for the instruction account.

Children

Attribute Type Description
defaultValue InstructionInputValueNode (Optional) A default value for the account should this account not be provided when constructing the instruction.

Functions

instructionAccountNode(input)

Helper function that creates a InstructionAccountNode object from an input object.

const node = instructionAccountNode({
    name: 'authority',
    isWritable: false,
    isSigner: true,
    docs: ['This account that has the authority to perform this instruction.'],
});

Examples

An optional account

instructionAccountNode({
    name: 'freezeAuthority',
    isWritable: false,
    isSigner: false,
    isOptional: true,
    docs: ['The freeze authority to set on the asset, if any.'],
});

An optional signer account

instructionAccountNode({
    name: 'owner',
    isWritable: true,
    isSigner: 'either',
    docs: ['The owner of the asset. The owner must only sign the transaction if the asset is being updated.'],
});