toCborValue method

  1. @override
CborValue toCborValue()
override

Implementation

@override
CborValue toCborValue() {
  final Map map = {};
  map[AlphSignRequestKeys.uuid.index] = CborBytes(getRequestId(), tags: [RegistryType.UUID.tag]);
  map[AlphSignRequestKeys.data.index] =  data;
  if (derivationPath != null) {
    CborValue derivationPathDataItem = derivationPath!.toCborValue();
    derivationPathDataItem = cborValueSetTags(derivationPathDataItem, [derivationPath!.getRegistryType().tag]);
    map[AlphSignRequestKeys.derivationPath.index] = derivationPathDataItem;
  }
  if (outputs != null && outputs!.isNotEmpty) {
      List<CborValue> outputsData = [];
      for(CryptoTxEntity output in outputs!){
        CborValue inputDataItem = output.toCborValue();
        inputDataItem = cborValueSetTags(inputDataItem, [output.getRegistryType().tag]);
        outputsData.add(inputDataItem);
      }
      map[AlphSignRequestKeys.outputs.index] = outputsData;
    }
  if (origin != null) {
    map[AlphSignRequestKeys.origin.index] = origin;
  }
  return CborValue(map);
}