MultisigProgram constructor
MultisigProgram(
- int threshold,
- Iterable<
ECPublicKey> pubkeys
Creates a multisig script program for a given threshold
(t-of-n) and a
list of public keys. The public keys are inserted into the script in the
same order that they are given.
Implementation
MultisigProgram(this.threshold, Iterable<ECPublicKey> pubkeys)
: pubkeys = List.unmodifiable(pubkeys),
script = Script([
ScriptOp.fromNumber(threshold),
...pubkeys.map((pk) => ScriptPushData(pk.data)),
ScriptOp.fromNumber(pubkeys.length),
checkmultisig,
]) {
if (pubkeys.isEmpty || pubkeys.length > maxPubkeys) {
throw ArgumentError.value(
pubkeys, "pubkeys", "must have length between 1 and $maxPubkeys",
);
}
if (threshold < 1 || threshold > pubkeys.length) {
throw ArgumentError.value(
threshold, "threshold",
"must have length between 1 and the number of public keys",
);
}
}