decodeMoveAbort function

PredictMoveError? decodeMoveAbort(
  1. ExecutionError? error
)

Decode a gRPC ExecutionError into a PredictMoveError.

Returns null when error carries no Move abort (insufficient gas, a size error, any non-abort failure), so callers can fall back to a plain error with the failure description. The field provenance mirrors the official decoder: abort.abortCode (u64, read unsigned), abort.location.module, and abort.cleverError.constantName — the chain-decoded clever-error constant that replaces the old hand-maintained abort tables.

Implementation

PredictMoveError? decodeMoveAbort(ExecutionError? error) {
  if (error == null || !error.hasAbort()) return null;
  final abort = error.abort;
  final module = abort.hasLocation() ? abort.location.module : '';
  final code = BigInt.parse(abort.abortCode.toStringUnsigned());
  final abortName =
      abort.hasCleverError() && abort.cleverError.constantName.isNotEmpty
          ? abort.cleverError.constantName
          : null;
  return PredictMoveError(module, code, abortName);
}