This node provides a definition for a specific Program-Derived Address (PDA). It is characterized by a name and a list of seeds that can either be constant or variable.
Attribute | Type | Description |
---|---|---|
kind |
"pdaNode" |
The node discriminator. |
name |
CamelCaseString |
The name of the PDA. |
docs |
string[] |
Markdown documentation for the PDA. |
programId |
string |
(Optional) The address of the program the PDA should derive from. Defaults to the address of the nearest ProgramNode ancestor. |
Attribute | Type | Description |
---|---|---|
seeds |
PdaSeedNode [] |
The seeds of the PDA. |
Helper function that creates a pdaNode
object from an input object.
const node = pdaNode({
name: 'counter',
seeds: [variablePdaSeedNode('authority', publicKeyTypeNode())],
docs: ['The counter PDA derived from its authority.'],
});
pdaNode({
name: 'ticket',
seeds: [
constantPdaSeedNodeFromString('utf8', 'raffles'),
variablePdaSeedNode('raffle', publicKeyTypeNode()),
constantPdaSeedNodeFromString('utf8', 'tickets'),
variablePdaSeedNode('ticketNumber', numberTypeNode('u32')),
],
});
pdaNode({
name: 'seedlessPda',
seeds: [],
});