signHydraTransaction method

SignedHydraTransaction signHydraTransaction(
  1. String address,
  2. String tx
)

Implementation

SignedHydraTransaction signHydraTransaction(String address, String tx) {
  // TODO should we dedicate a toJson() function for tx serialization?
  final nativeAddr = address.toNativeUtf8();
  final nativeTx = tx.toNativeUtf8();
  try {
    final signedTx = DartApi.native.hydraPrivate
        .signHydraTx(_ffi, nativeAddr, nativeTx)
        .extract((res) => res.asString);
    return SignedHydraTransaction(signedTx);
  } finally {
    calloc.free(nativeTx);
    calloc.free(nativeAddr);
  }
}