writeContract static method

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

Write contract, get transaction

address is public address

value is the value sent with this transaction.

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,
    BigInt value,
    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, value, contractAddress,
      gasFeeLevel: gasFeeLevel);
}