encodedDataForContractCall static method

Uint8List encodedDataForContractCall(
  1. String contractName,
  2. String contractAddress,
  3. String functionName,
  4. List params, {
  5. String? jsonInterface,
  6. bool include0x = false,
  7. int? forcePadLength,
  8. bool padToEvenLength = false,
})

Encodes data for a contract call using the specified function and parameters.

contractName is the name of the contract. contractAddress is the address of the deployed contract. functionName is the name of the function to be called. params is a list of parameters to be passed to the function. jsonInterface is an optional JSON string representing the contract ABI. include0x is a flag to include the '0x' prefix in the encoded data. forcePadLength is an optional integer to force padding of the output data. padToEvenLength is a flag to pad the output data to an even length.

Returns a encoded data as a Uint8List.

Implementation

static Uint8List encodedDataForContractCall(
  String contractName,
  String contractAddress,
  String functionName,
  List<dynamic> params, {
  String? jsonInterface,
  bool include0x = false,
  int? forcePadLength,
  bool padToEvenLength = false,
}) {
  final DeployedContract contract = _getDeployedContract(
    contractName,
    contractAddress,
    jsonInterface: jsonInterface,
  );
  return contract.function(functionName).encodeCall(params);
}