It might be interesting to support optional values on PDA seeds, e.g.:
k.pdaNode({
name: "account",
seeds: [
k.variablePdaSeedNode(
"from",
k.publicKeyTypeNode(),
"Funding account"
),
k.variablePdaSeedNode(
"seed",
k.fixedSizeTypeNode(k.bytesTypeNode(), 32),
"Optional seed for the account derivation"
),
k.variablePdaSeedNode(
"group",
k.numberTypeNode("u64"),
"Group ID for the address derivation"
),
],
})
In this example, the seed value is optional – it can either be present or not. This would result in the following AccountSeeds for the findAccountPda helper:
export type AccountSeeds = {
/** Funding account */
from: Address;
/** Optional seed for the account derivation */
seed?: ReadonlyUint8Array;
/** Group ID for the address derivation */
group: number | bigint;
};
You could also combine this with default value support (#107), so you could have optional seed values with a default value if one is not provided.
It might be interesting to support optional values on PDA seeds, e.g.:
In this example, the
seed
value is optional – it can either be present or not. This would result in the followingAccountSeeds
for thefindAccountPda
helper:You could also combine this with
default
value support (#107), so you could have optional seed values with a default value if one is not provided.