compactToBn function

BigInt compactToBn(
  1. Map<String, dynamic> value
)

Implementation

BigInt compactToBn(Map<String, dynamic> value) {
  var toBnTrue = value.containsKey("toBn") && isFunction(value['toBn']);
  var toBigIntTrue =
      value.containsKey("toBigInt") && isFunction(value['toBigInt']);
  if (toBnTrue && !toBigIntTrue) {
    return (value["toBn"] as Function).call();
  }
  if (!toBnTrue && toBigIntTrue) {
    return (value["toBigInt"] as Function).call();
  }

  throw "toBn or toBigInt function not found";
}