layout static method
Implementation
static Layout<MuSig2AggregatePublicKey> layout() =>
ObjSeqLayout<MuSig2AggregatePublicKey>(
[
LayoutConst.fixedBlobN(EcdsaKeysConst.pubKeyCompressedByteLen),
LayoutConst.optional(
LayoutConst.vec(
LayoutConst.fixedBlobN(EcdsaKeysConst.pubKeyCompressedByteLen),
),
),
],
build: (values) {
final agg = Secp256k1Point.fromBytes(
JsonParser.valueAsBytes(values.elementAtOrNull(0)),
);
final List<Secp256k1PublicKey>? pubKeys =
JsonParser.valueAsList<List<List<int>>?>(
values.elementAtOrNull(1),
)?.map((e) => Secp256k1PublicKey.fromBytes(e)).toList();
return MuSig2AggregatePublicKey._from(agg, pubKeys);
},
unbuild:
(value) => [
value.point.toBytes(),
value.publicKeys?.map((e) => e.toBytes()).toList(),
],
);