encodedDataForContractCall static method
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);
}