Signatories.fromAddresses constructor

Signatories.fromAddresses(
  1. List<String> addresses,
  2. int threshold
)

Create a new instance of Signatories from a list of addresses and a threshold.

The addresses is a list of addresses of the signatories. Maximum of 100 signatories can be added.

The threshold is the number of signatories required to approve a transaction. Threshold should be at least 2.

Implementation

factory Signatories.fromAddresses(List<String> addresses, int threshold) {
  final List<Signatory> signatories =
      addresses.toSet().map((e) => Signatory.fromAddress(e)).toList();

  signatories
      .sort((a, b) => uint8ListCompare(a.signatoryBytes, b.signatoryBytes));
  return Signatories._(
    signatories,
    _createMultiSigBytes(signatories, threshold),
  );
}