A node that represents a PDA value. It alone can be used to derive the PDA address.
Attribute | Type | Description |
---|---|---|
kind |
"pdaValueNode" |
The node discriminator. |
Attribute | Type | Description |
---|---|---|
pda |
PdaLinkNode | PdaNode |
The PDA definition to use. It can either be a PdaLinkNode — therefore pointing to an existing PDA definition on the ProgramNode — or a direct PdaNode if we want to inline the PDA definition. |
seeds |
PdaSeedValueNode [] |
The values of all variable seeds in the PDA. |
Helper function that creates a PdaValueNode
object from a PDA definition and an array of seed values. When a string
is provided as the pda
definition, it is used as a PdaLinkNode
.
const node = pdaValueNode('associatedToken', [
pdaSeedValueNode('mint', publicKeyValueNode('G345gmp34svbGxyXuCvKVVHDbqJQ66y65vVrx7m7FmBE')),
pdaSeedValueNode('owner', publicKeyValueNode('Nzgr9bYfMRq5768bHfXsXoPTnLWAXgQNosRBxK63jRH')),
]);
pdaValueNode('associatedToken', [
pdaSeedValueNode('mint', accountValueNode('mint')),
pdaSeedValueNode('owner', accountValueNode('authority')),
]);
const inlinedPdaNode = pdaNode({
name: 'associatedToken',
seeds: [
variablePdaSeedNode('mint', publicKeyTypeNode()),
constantPdaSeedNode(publicKeyTypeNode(), publicKeyValueNode('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA')),
variablePdaSeedNode('owner', publicKeyTypeNode()),
],
});
pdaValueNode(inlinedPdaNode, [
pdaSeedValueNode('mint', accountValueNode('mint')),
pdaSeedValueNode('owner', accountValueNode('authority')),
]);