MetaplexTokenMetaDataProgram.delegate constructor

MetaplexTokenMetaDataProgram.delegate({
  1. required SolAddress delegate,
  2. required SolAddress metadata,
  3. required SolAddress mint,
  4. required SolAddress authority,
  5. required SolAddress payer,
  6. required SolAddress sysvarInstructions,
  7. required MetaplexTokenMetaDataDelegateProgramLayout layout,
  8. SolAddress? delegateRecord,
  9. SolAddress? masterEdition,
  10. SolAddress? tokenRecord,
  11. SolAddress? token,
  12. SolAddress systemProgram = SystemProgramConst.programId,
  13. SolAddress? splTokenProgram,
  14. SolAddress? authorizationRulesProgram,
  15. SolAddress? authorizationRules,
})

Implementation

factory MetaplexTokenMetaDataProgram.delegate({
  required SolAddress delegate,
  required SolAddress metadata,
  required SolAddress mint,
  required SolAddress authority,
  required SolAddress payer,
  required SolAddress sysvarInstructions,
  required MetaplexTokenMetaDataDelegateProgramLayout layout,
  SolAddress? delegateRecord,
  SolAddress? masterEdition,
  SolAddress? tokenRecord,
  SolAddress? token,
  SolAddress systemProgram = SystemProgramConst.programId,
  SolAddress? splTokenProgram,
  SolAddress? authorizationRulesProgram,
  SolAddress? authorizationRules,
}) {
  return MetaplexTokenMetaDataProgram(keys: [
    delegateRecord?.toReadOnly() ??
        MetaplexTokenMetaDataProgramConst.programId.toReadOnly(),
    delegate.toReadOnly(),
    metadata.toWritable(),
    masterEdition?.toReadOnly() ??
        MetaplexTokenMetaDataProgramConst.programId.toReadOnly(),
    (tokenRecord?.toReadOnly() ??
            MetaplexTokenMetaDataProgramConst.programId.toReadOnly())
        .copyWith(isWritable: tokenRecord != null),
    mint.toReadOnly(),
    (token?.toReadOnly() ??
            MetaplexTokenMetaDataProgramConst.programId.toReadOnly())
        .copyWith(isWritable: token != null),
    authority.toSigner(),
    payer.toSignerAndWritable(),
    systemProgram.toReadOnly(),
    sysvarInstructions.toReadOnly(),
    splTokenProgram?.toReadOnly() ??
        MetaplexTokenMetaDataProgramConst.programId.toReadOnly(),
    authorizationRulesProgram?.toReadOnly() ??
        MetaplexTokenMetaDataProgramConst.programId.toReadOnly(),
    authorizationRules?.toReadOnly() ??
        MetaplexTokenMetaDataProgramConst.programId.toReadOnly(),
  ], programId: MetaplexTokenMetaDataProgramConst.programId, layout: layout);
}