NameServiceProgram.create constructor
NameServiceProgram.create({
- required NameServiceCreateLayout layout,
- required SolAddress nameKey,
- required SolAddress nameOwnerKey,
- required SolAddress payerKey,
- SolAddress nameProgramId = NameServiceProgramConst.programId,
- SolAddress systemProgramId = SystemProgramConst.programId,
- SolAddress? nameClassKey,
- SolAddress? nameParent,
- SolAddress? nameParentOwner,
Create an empty name record
Implementation
factory NameServiceProgram.create({
required NameServiceCreateLayout layout,
/// Name record to be created (program-derived address)
required SolAddress nameKey,
/// Account owner
required SolAddress nameOwnerKey,
/// Funding account (must be a system account)
required SolAddress payerKey,
SolAddress nameProgramId = NameServiceProgramConst.programId,
/// System program
SolAddress systemProgramId = SystemProgramConst.programId,
/// Account class
SolAddress? nameClassKey,
/// Parent name record
SolAddress? nameParent,
/// Owner of the parent name record.
SolAddress? nameParentOwner,
}) {
return NameServiceProgram(
keys: [
systemProgramId.toReadOnly(),
payerKey.toSignerAndWritable(),
nameKey.toWritable(),
nameOwnerKey.toReadOnly(),
nameClassKey?.toSigner() ?? SolAddress.defaultPubKey.toReadOnly(),
nameParent?.toReadOnly() ?? SolAddress.defaultPubKey.toReadOnly(),
if (nameParentOwner != null) nameParentOwner.toSigner(),
],
programId: nameProgramId,
layout: layout,
);
}