decode method

  1. @override
DecoderResult<BigInt> decode(
  1. AbiParameter params,
  2. List<int> bytes
)
override

Decodes a numeric value (BigInt) from the given ABI-encoded bytes.

Implementation

@override
DecoderResult<BigInt> decode(AbiParameter params, List<int> bytes) {
  _ABIValidator.validateBytesLength(bytes, ABIConst.uintBytesLength);
  final sign = _ABIValidator.isSignNumber(params.type);
  final nBytes = bytes.sublist(0, ABIConst.uintBytesLength);
  final big = BigintUtils.fromBytes(nBytes, sign: sign);
  _ABIValidator.isValidNumber(params.type, big);
  return DecoderResult(result: big, consumed: ABIConst.uintBytesLength);
}