encode method

List<int> encode(
  1. List params, [
  2. bool withSelector = true
])

Encodes the function with the provided parameters.

Implementation

List<int> encode(List params, [bool withSelector = true]) {
  final abi =
      AbiParameter(name: "", type: "tuple", components: List.from(inputs))
          .abiEncode(params);
  if (!withSelector) {
    return abi.encoded;
  }
  return [...selector, ...abi.encoded];
}