write method
Implementation
Future<String> write({
required String functionName,
required List<dynamic> args,
required web3.Credentials credentials,
BigInt? value, // Add this line for the value parameter
// required BigInt gasPrice,
// required BigInt gasLimit,
}) async {
final function = this.contract.function(functionName);
final chainId = await this.client.getNetworkId();
final transaction = web3.Transaction.callContract(
contract: this.contract,
function: function,
parameters: args,
value: value != null
? web3.EtherAmount.fromBigInt(web3.EtherUnit.wei, value)
: null,
// gasPrice: gasPrice,
// maxGas: gasLimit,
);
final response = await this.client.sendTransaction(
credentials,
transaction,
chainId: chainId,
);
print(response);
return response;
}