asMultiMethod static method

Uint8List asMultiMethod({
  1. required ChainInfo chainInfo,
  2. required List<Uint8List> otherSignatories,
  3. required int threshold,
  4. required Uint8List callData,
  5. required Weight maxWeight,
  6. required MultisigStorage multiSigStorage,
})

Creates the asMulti approval method call for the multisig transaction.

Implementation

static Uint8List asMultiMethod(
    {required ChainInfo chainInfo,
    required List<Uint8List> otherSignatories,
    required int threshold,
    required Uint8List callData,
    required Weight maxWeight,
    required MultisigStorage multiSigStorage}) {
  final decodedCall = chainInfo.scaleCodec.registry.codecs['Call']!
      .decode(ByteInput.fromBytes(callData));
  final approvalArgument = MapEntry(
    'Multisig',
    MapEntry(
      'as_multi',
      {
        'threshold': threshold,
        'other_signatories': otherSignatories,
        'maybe_timepoint': Option<Map<String, dynamic>>.some(
            multiSigStorage.timePoint.toMap()),
        'call': decodedCall,
        'max_weight': maxWeight.toMap(),
      },
    ),
  );
  final ByteOutput output = ByteOutput();

  chainInfo.scaleCodec.registry.codecs['Call']!
      .encodeTo(approvalArgument, output);
  return output.toBytes();
}