encodeSmartContractCall method
Encode the smart contract call using the ABI (Application Binary Interface)
The function signature is a string that represents the function name and its parameters. For example: 'transfer(address,uint256)'
The parameters are list of values that are passed to the function.
For example: '0x1234567890', 100
Returns a string that is the encoded smart contract call
Implementation
Future<String> encodeSmartContractCall({
required String functionSignature,
List<dynamic> parameters = const [],
}) async {
final cleanedFunctionSignature = functionSignature.replaceAll(' ', '');
return await jsVMService.callJS(
"""window.EVMUtils.getAbiEncodedSmartContractArgs('$cleanedFunctionSignature', '${jsonEncode(parameters)}' )""");
}