sendTransaction method
Sends the signed transaction to the Ethereum network via the provided RPC.
Throws an exception if there are validation errors or if the RPC request fails.
Implementation
Future<String> sendTransaction(EthereumProvider rpc) async {
// Check for validation errors before sending the transaction
_checkError();
// Convert the signed transaction to raw hex format
final rawHex =
BytesUtils.toHexString(signedSerializedTransaction(), prefix: '0x');
// Send the raw transaction hex to the Ethereum network
final result = await rpc
.request(EthereumRequestSendRawTransaction(transaction: rawHex));
// Return the transaction hash upon successful submission
return result;
}