UserOperation.register constructor

UserOperation.register(
  1. String domainName,
  2. PublicKey owner,
  3. SubtreePolicies subtreePolicies,
  4. String data,
  5. int expiresAtHeight,
)

Implementation

factory UserOperation.register(
  String domainName,
  PublicKey owner,
  SubtreePolicies subtreePolicies,
  String data,
  int expiresAtHeight,
) {
  final nativeDomainName = domainName.toNativeUtf8();
  final nativeOwner = owner.toString().toNativeUtf8();
  final nativeData = data.toNativeUtf8();
  try {
    final op = DartApi.native.coeusUserOperation
        .opRegister(nativeDomainName, nativeOwner, subtreePolicies._ffi,
            nativeData, expiresAtHeight)
        .extract((res) => res.asPointer<Void>());
    return UserOperation(op, true);
  } finally {
    calloc.free(nativeData);
    calloc.free(nativeOwner);
    calloc.free(nativeDomainName);
  }
}