Skip to content

Latest commit

 

History

History
61 lines (40 loc) · 1.99 KB

ConstantPdaSeedNode.md

File metadata and controls

61 lines (40 loc) · 1.99 KB

ConstantPdaSeedNode

This node represents a constant seed for a program-derived address (PDA).

Attributes

Data

Attribute Type Description
kind "constantPdaSeedNode" The node discriminator.

Children

Attribute Type Description
type TypeNode The type of the constant seed.
value ValueNode | ProgramIdValueNode The value of the constant seed.

Functions

constantPdaSeedNode(type, value)

Helper function that creates a ConstantPdaSeedNode object from a type node and a value node.

const node = constantPdaSeedNode(numberTypeNode('u32'), numberValueNode(42));

constantPdaSeedNodeFromString(encoding, data)

Helper function that creates a ConstantPdaSeedNode object of type StringTypeNode from an encoding and a string of data.

constantPdaSeedNodeFromString('utf8', 'Hello');

// Equivalent to:
constantPdaSeedNode(stringTypeNode('utf8'), stringValueNode('Hello'));

constantValueNodeFromBytes(encoding, data)

Helper function that creates a ConstantValueNode object of type BytesTypeNode from an encoding and a string of data.

constantValueNodeFromBytes('base16', 'FF99CC');

// Equivalent to:
constantValueNode(bytesTypeNode(), bytesValueNode('base16', 'FF99CC'));

Examples

A PDA node with a UTF-8 constant seed

pdaNode({
    name: 'tickets',
    seeds: [constantPdaSeedNodeFromString('utf8', 'tickets')],
});