gleeth/rpc/types
Core types for gleeth’s JSON-RPC layer - request/response structures, Ethereum method definitions, and the unified application error type.
Types
Supported Ethereum JSON-RPC method names.
pub type EthMethod {
EthBlockNumber
EthGetBalance
EthCall
EthGetTransactionByHash
EthGetTransactionReceipt
EthGetCode
EthEstimateGas
EthGetStorageAt
EthGetLogs
EthGetBlockByNumber
EthChainId
EthSendRawTransaction
EthGetTransactionCount
EthGasPrice
EthMaxPriorityFeePerGas
EthFeeHistory
}
Constructors
-
EthBlockNumber -
EthGetBalance -
EthCall -
EthGetTransactionByHash -
EthGetTransactionReceipt -
EthGetCode -
EthEstimateGas -
EthGetStorageAt -
EthGetLogs -
EthGetBlockByNumber -
EthChainId -
EthSendRawTransaction -
EthGetTransactionCount -
EthGasPrice -
EthMaxPriorityFeePerGas -
EthFeeHistory
Unified error type for all gleeth operations. Commands return
Result(Nil, GleethError), making this the single error channel
across the entire application.
pub type GleethError {
InvalidRpcUrl(String)
InvalidAddress(String)
InvalidHash(String)
RpcError(String)
NetworkError(String)
ParseError(String)
ConfigError(String)
AbiErr(types.AbiError)
WalletErr(wallet.WalletError)
TransactionErr(transaction.TransactionError)
}
Constructors
-
InvalidRpcUrl(String)The provided RPC URL is malformed or empty.
-
InvalidAddress(String)The provided Ethereum address fails validation (bad length, missing 0x prefix, etc.).
-
InvalidHash(String)The provided transaction or block hash fails validation.
-
RpcError(String)The Ethereum node returned a JSON-RPC error response.
-
NetworkError(String)A network-level failure occurred (connection refused, timeout, DNS failure).
-
ParseError(String)Failed to parse a JSON-RPC response or decode a hex value.
-
ConfigError(String)Invalid or missing CLI configuration (missing RPC URL, bad flags).
-
AbiErr(types.AbiError)Wraps an ABI encoding/decoding error, preserving the original AbiError.
-
WalletErr(wallet.WalletError)Wraps a wallet operation error, preserving the original WalletError.
-
TransactionErr(transaction.TransactionError)Wraps a transaction signing/building error, preserving the original TransactionError.
A JSON-RPC 2.0 response received from an Ethereum node.
pub type JsonRpcResponse {
JsonRpcResponse(
jsonrpc: String,
id: Int,
result: Result(json.Json, JsonRpcError),
)
}
Constructors
-
JsonRpcResponse( jsonrpc: String, id: Int, result: Result(json.Json, JsonRpcError), )
Values
pub fn error_to_string(error: GleethError) -> String
Convert a GleethError to a human-readable message string.
pub fn method_to_string(method: EthMethod) -> String
Convert an EthMethod variant to its JSON-RPC method name string.