writeContract static method

Future<String> writeContract(
  1. String address,
  2. String contractAddress,
  3. String methodName,
  4. List<Object> parameters,
  5. String abiJsonString, {
  6. GasFeeLevel gasFeeLevel = GasFeeLevel.high,
})

Write contract, get transaction

address is public address

contractAddress is contract address

methodName is a contract method name, such as 'mint', 'balanceOf'

parameters is parameters required by the method

abiJsonString is abi json string, such as "[{"inputs":{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"}]"

gasFeeLevel is gas fee level, default is high.

Implementation

static Future<String> writeContract(String address, String contractAddress,
    String methodName, List<Object> parameters, String abiJsonString,
    {GasFeeLevel gasFeeLevel = GasFeeLevel.high}) async {
  final data = await EvmService.customMethod(
      contractAddress, methodName, parameters, abiJsonString);

  return createTransaction(address, data, BigInt.from(0), contractAddress,
      gasFeeLevel: gasFeeLevel);
}