This node represents a difference in bytes stored on-chain from executing an instruction. For instance, if an instruction creates a new account of 42 bytes, this node can provide this information. This enables clients to allocate the right amount of lamports to cover the cost of executing the instruction.
Attribute | Type | Description |
---|---|---|
kind |
"instructionByteDeltaNode" |
The node discriminator. |
withHeader |
boolean |
(Optional) Whether or not we should add the account header size — i.e. 128 bytes — to the value. Default to false when the value is a ResolverValueNode and true otherwise. |
subtract |
boolean |
(Optional) Whether or not the provided value should be subtracted from the total byte delta. Defaults to false . |
Attribute | Type | Description |
---|---|---|
value |
AccountLinkNode | ArgumentValueNode | NumberValueNode | ResolverValueNode |
The value representing the byte delta. If an AccountLinkNode is used, the size of the linked account will be used. If an ArgumentValueNode is used, the value of the instruction argument will be used. If a NumberValueNode is used, that explicit number will be used. Otherwise, a ResolverValueNode can be used as a fallback for more complex values. |
Helper function that creates a InstructionByteDeltaNode
object from a value node and some options.
const node = instructionByteDeltaNode(numberValueNode(42), { withHeader: false });
instructionByteDeltaNode(accountLinkNode('token'));
instructionByteDeltaNode(accountLinkNode('token'), { subtract: true });
instructionByteDeltaNode(argumentValueNode('additionalSpace'), { withHeader: false });