requestWriteContract method
Future
requestWriteContract({
- required String topic,
- required String chainId,
- required DeployedContract deployedContract,
- required String functionName,
- required Transaction transaction,
- List parameters = const [],
- String? method,
override
Implementation
@override
Future<dynamic> requestWriteContract({
required String topic,
required String chainId,
required DeployedContract deployedContract,
required String functionName,
required Transaction transaction,
List<dynamic> parameters = const [],
String? method,
}) async {
if (transaction.from == null) {
throw Exception('Transaction must include `from` value');
}
final trx = Transaction.callContract(
contract: deployedContract,
function: deployedContract.function(functionName),
from: transaction.from!,
value: transaction.value,
maxGas: transaction.maxGas,
gasPrice: transaction.gasPrice,
nonce: transaction.nonce,
maxFeePerGas: transaction.maxFeePerGas,
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
parameters: parameters,
);
return await request(
topic: topic,
chainId: chainId,
request: SessionRequestParams(
method: method ?? MethodsConstants.ethSendTransaction,
params: [trx.toJson()],
),
);
}