buildTransactionForFunction method
Implementation
Future<RawEvmTransaction> buildTransactionForFunction({
required ContractFunctionWithValues function,
required String sender,
EvmFeeInformation? feeInfo,
BigInt? value,
}) async {
final functionData = function.buildDataField();
if (value != null) {
assert(
function.stateMutability == StateMutability.payable,
'Function is not payable and cannot accept a value',
);
} else {
assert(
function.stateMutability == StateMutability.nonpayable,
'Function is payable and requires a value to be sent',
);
}
return await rpc.buildUnsignedTransaction(
sender: sender,
recipient: contractAddress,
feeInfo: feeInfo,
data: functionData,
value: value ?? BigInt.zero,
);
}