buildKeys static method

List<AccountMeta> buildKeys({
  1. required List<AccountMeta> keys,
  2. required SolAddress owner,
  3. List<SolAddress> multiSigners = const [],
})

Implementation

static List<AccountMeta> buildKeys({
  required List<AccountMeta> keys, // Required list of initial keys
  required SolAddress owner, // Required owner SolAddress
  List<SolAddress> multiSigners = const [], // Optional list of multi-signers
}) {
  // Construct the list of keys by spreading the initial keys
  // and adding the owner as a signer or read-only key based on the presence of multiSigners.
  // Then, add each multi-signer as a signer key to the list.
  return [
    ...keys,
    multiSigners.isEmpty ? owner.toSigner() : owner.toReadOnly(),
    ...multiSigners.map((e) => e.toSigner()),
  ];
}