write method
Future<String>
write(
- String functionName,
- List args, {
- BigInt? value,
- BigInt? gasLimit,
- BigInt? gasPrice,
- BigInt? maxFeePerGas,
- BigInt? maxPriorityFeePerGas,
inherited
Executes a state-changing contract function.
Implementation
Future<String> write(
String functionName,
List<dynamic> args, {
BigInt? value,
BigInt? gasLimit,
BigInt? gasPrice,
BigInt? maxFeePerGas,
BigInt? maxPriorityFeePerGas,
}) async {
if (walletClient == null) {
throw StateError('WalletClient required for write operations');
}
final function = _getFunction(functionName);
final callData = AbiEncoder.encodeFunction(function.signature, args);
final request = TransactionRequest(
to: address,
data: callData,
value: value,
gasLimit: gasLimit,
gasPrice: gasPrice,
maxFeePerGas: maxFeePerGas,
maxPriorityFeePerGas: maxPriorityFeePerGas,
);
return walletClient!.sendTransactionRequest(request);
}