getIdFromCallArg function

dynamic getIdFromCallArg(
  1. dynamic arg
)

Implementation

dynamic getIdFromCallArg(dynamic arg) {
  if (arg is String) {
    return normalizeSuiAddress(arg);
  }

  if (arg["Object"] != null) {
    if (arg["Object"]["ImmOrOwnedObject"] != null) {
      return normalizeSuiAddress(arg["Object"]["ImmOrOwnedObject"]["objectId"]);
    }
    if (arg["Object"]["Receiving"] != null) {
      return normalizeSuiAddress(arg["Object"]["Receiving"]["objectId"]);
    }
    if (arg["Object"]["SharedObject"] != null) {
      return normalizeSuiAddress(arg["Object"]["SharedObject"]["objectId"]);
    }
  }

  if (arg["UnresolvedObject"] != null) {
    return arg["UnresolvedObject"]["objectId"];
  }

  return null;
}