hashPoseidon method

String hashPoseidon(
  1. String txCompressedData,
  2. String toEthAddr,
  3. String? toBjjAy,
  4. String? rqTxCompressedDatav2,
  5. String? rqToEthAddr,
  6. String? rqToBjjAy,
)

Implementation

String hashPoseidon(
    String txCompressedData,
    String toEthAddr,
    String? toBjjAy,
    String? rqTxCompressedDatav2,
    String? rqToEthAddr,
    String? rqToBjjAy) {
  if (lib == null) return "ERROR: The library is not initialized";
  final ptr1 = txCompressedData.toNativeUtf8();
  final ptr2 = toEthAddr.toNativeUtf8();
  final ptr3 = toBjjAy!.toNativeUtf8();
  final ptr4 = rqTxCompressedDatav2!.toNativeUtf8();
  final ptr5 = rqToEthAddr!.toNativeUtf8();
  final ptr6 = rqToBjjAy!.toNativeUtf8();
  final resultPtr = _hashPoseidon(ptr1, ptr2, ptr3, ptr4, ptr5, ptr6);
  String resultString = resultPtr.toDartString();
  resultString = resultString.replaceAll("Fr(", "");
  resultString = resultString.replaceAll(")", "");
  //print("- Response string:  $resultString");
  // Free the string pointer, as we already have
  // an owned String to return
  //print("- Freeing the native char*");
  cstringFree(resultPtr);
  return resultString;
}