TokenInstruction.initializeMultisig constructor

TokenInstruction.initializeMultisig({
  1. required Ed25519HDPublicKey account,
  2. required List<Ed25519HDPublicKey> signers,
})

Initializes a multisignature account with N provided signers.

Multisignature accounts can be used in place of any single owner/delegate accounts in any token instruction that require an owner/delegate to be present.

Implementation

factory TokenInstruction.initializeMultisig({
  required Ed25519HDPublicKey account,
  required List<Ed25519HDPublicKey> signers,
}) =>
    TokenInstruction._(
      accounts: [
        AccountMeta.writeable(pubKey: account, isSigner: true),
        AccountMeta.readonly(
          pubKey: Ed25519HDPublicKey.fromBase58(Sysvar.rent),
          isSigner: false,
        ),
        ...signers.map(
          (pubKey) => AccountMeta.readonly(pubKey: pubKey, isSigner: true),
        ),
      ],
      data: ByteArray.merge([
        TokenProgram.initializeMintInstructionIndex,
        ByteArray.u8(signers.length),
      ]),
    );