From f37aa2aa45d8f85c5bd4813b71acef62be83af03 Mon Sep 17 00:00:00 2001 From: Giovanni Vignone <72773059+giovannivignone@users.noreply.github.com> Date: Sun, 11 Dec 2022 11:45:34 -0500 Subject: [PATCH] documentation: add rpc docs (#136) * adding documentation for rpc.md * adding rpc methods in table for rpc.md * adjusting readme to link to rpc.md * fixing grammar * grammar * adding RPC Methods according to documentation and listing column as Client Function * adding more description space * undoing description spacing --- README.md | 3 ++- rpc.md | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 rpc.md diff --git a/README.md b/README.md index b6129c8..3d51dd1 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,9 @@ helios --execution-rpc $ETH_RPC_URL Helios will now run a local RPC server at `http://127.0.0.1:8545`. -Helios also provides examples in the [`examples/`](./examples/) directory. To run an example, you can execute `cargo run --example ` from inside the helios repository. +Helios provides examples in the [`examples/`](./examples/) directory. To run an example, you can execute `cargo run --example ` from inside the helios repository. +Helios also provides documentation of its supported RPC methods in the [rpc.md](./rpc.md) file. ### Warning diff --git a/rpc.md b/rpc.md new file mode 100644 index 0000000..987a21e --- /dev/null +++ b/rpc.md @@ -0,0 +1,23 @@ +# Helios Remote Procedure Calls + +Helios provides a variety of RPC methods for interacting with the Ethereum network. These methods are exposed via the `Client` struct. The RPC methods follow the [Ethereum JSON RPC Spec](https://ethereum.github.io/execution-apis/api-documentation). See [examples](./examples/readme.rs) of running remote procedure calls with Helios. + +## RPC Methods + +| RPC Method | Client Function | Description | Example | +| ---------- | --------------- | ----------- | ------- | +| `eth_getBalance` | `get_balance` | Returns the balance of the account given an address. | `client.get_balance(&self, address: &str, block: BlockTag)` | +| `eth_getTransactionCount` | `get_transaction_count` | Returns the number of transactions sent from the given address. | `client.get_transaction_count(&self, address: &str, block: BlockTag)` | +| `eth_getCode` | `get_code` | Returns the code at a given address. | `client.get_code(&self, address: &str, block: BlockTag)` | +| `eth_call` | `call` | Executes a new message call immediately without creating a transaction on the blockchain. | `client.call(&self, opts: CallOpts, block: BlockTag)` | +| `eth_estimateGas` | `estimate_gas` | Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. | `client.estimate_gas(&self, opts: CallOpts)` | +| `eth_getChainId` | `chain_id` | Returns the chain ID of the current network. | `client.chain_id(&self)` | +| `eth_gasPrice` | `gas_price` | Returns the current price per gas in wei. | `client.gas_price(&self)` | +| `eth_maxPriorityFeePerGas` | `max_priority_fee_per_gas` | Returns the current max priority fee per gas in wei. | `client.max_priority_fee_per_gas(&self)` | +| `eth_blockNumber` | `block_number` | Returns the number of the most recent block. | `client.block_number(&self)` | +| `eth_getBlockByNumber` | `get_block_by_number` | Returns the information of a block by number. | `get_block_by_number(&self, block: BlockTag, full_tx: bool)` | +| `eth_getBlockByHash` | `get_block_by_hash` | Returns the information of a block by hash. | `get_block_by_hash(&self, hash: &str, full_tx: bool)` | +| `eth_sendRawTransaction` | `send_raw_transaction` | Submits a raw transaction to the network. | `client.send_raw_transaction(&self, bytes: &str)` | +| `eth_getTransactionReceipt` | `get_transaction_receipt` | Returns the receipt of a transaction by transaction hash. | `client.get_transaction_receipt(&self, hash: &str)` | +| `eth_getLogs` | `get_logs` | Returns an array of logs matching the filter. | `client.get_logs(&self, filter: Filter)` | +| `eth_getStorageAt` | `get_storage_at` | Returns the value from a storage position at a given address. | `client.get_storage_at(&self, address: &str, slot: H256, block: BlockTag)` | \ No newline at end of file