Trait EthApiServer

Source
pub trait EthApiServer:
    Sized
    + Send
    + Sync
    + 'static {
Show 37 methods // Required methods fn protocol_version(&self) -> Result<u64, ErrorObject<'static>>; fn syncing<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<SyncStatus, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn author(&self) -> Result<H160, ErrorObject<'static>>; fn accounts(&self) -> Result<Vec<H160>, ErrorObject<'static>>; fn block_number(&self) -> Result<U256, ErrorObject<'static>>; fn chain_id(&self) -> Result<Option<U64>, ErrorObject<'static>>; fn block_by_hash<'life0, 'async_trait>( &'life0 self, hash: H256, full: bool, ) -> Pin<Box<dyn Future<Output = Result<Option<Rich<Block>>, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn block_by_number<'life0, 'async_trait>( &'life0 self, number_or_hash: BlockNumberOrHash, full: bool, ) -> Pin<Box<dyn Future<Output = Result<Option<Rich<Block>>, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn block_transaction_count_by_hash<'life0, 'async_trait>( &'life0 self, hash: H256, ) -> Pin<Box<dyn Future<Output = Result<Option<U256>, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn block_transaction_count_by_number<'life0, 'async_trait>( &'life0 self, number_or_hash: BlockNumberOrHash, ) -> Pin<Box<dyn Future<Output = Result<Option<U256>, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn block_transaction_receipts<'life0, 'async_trait>( &'life0 self, number_or_hash: BlockNumberOrHash, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Receipt>>, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn block_uncles_count_by_hash( &self, hash: H256, ) -> Result<U256, ErrorObject<'static>>; fn block_uncles_count_by_number( &self, number_or_hash: BlockNumberOrHash, ) -> Result<U256, ErrorObject<'static>>; fn uncle_by_block_hash_and_index( &self, hash: H256, index: Index, ) -> Result<Option<Rich<Block>>, ErrorObject<'static>>; fn uncle_by_block_number_and_index( &self, number_or_hash: BlockNumberOrHash, index: Index, ) -> Result<Option<Rich<Block>>, ErrorObject<'static>>; fn transaction_by_hash<'life0, 'async_trait>( &'life0 self, hash: H256, ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn transaction_by_block_hash_and_index<'life0, 'async_trait>( &'life0 self, hash: H256, index: Index, ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn transaction_by_block_number_and_index<'life0, 'async_trait>( &'life0 self, number_or_hash: BlockNumberOrHash, index: Index, ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn transaction_receipt<'life0, 'async_trait>( &'life0 self, hash: H256, ) -> Pin<Box<dyn Future<Output = Result<Option<Receipt>, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn balance<'life0, 'async_trait>( &'life0 self, address: H160, number_or_hash: Option<BlockNumberOrHash>, ) -> Pin<Box<dyn Future<Output = Result<U256, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn storage_at<'life0, 'async_trait>( &'life0 self, address: H160, index: U256, number_or_hash: Option<BlockNumberOrHash>, ) -> Pin<Box<dyn Future<Output = Result<H256, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn transaction_count<'life0, 'async_trait>( &'life0 self, address: H160, number_or_hash: Option<BlockNumberOrHash>, ) -> Pin<Box<dyn Future<Output = Result<U256, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn code_at<'life0, 'async_trait>( &'life0 self, address: H160, number_or_hash: Option<BlockNumberOrHash>, ) -> Pin<Box<dyn Future<Output = Result<Bytes, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn call<'life0, 'async_trait>( &'life0 self, request: TransactionRequest, number_or_hash: Option<BlockNumberOrHash>, state_overrides: Option<BTreeMap<H160, CallStateOverride>>, ) -> Pin<Box<dyn Future<Output = Result<Bytes, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn estimate_gas<'life0, 'async_trait>( &'life0 self, request: TransactionRequest, number_or_hash: Option<BlockNumberOrHash>, ) -> Pin<Box<dyn Future<Output = Result<U256, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn pending_transactions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Transaction>, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn gas_price(&self) -> Result<U256, ErrorObject<'static>>; fn fee_history<'life0, 'async_trait>( &'life0 self, block_count: BlockCount, newest_block: BlockNumberOrHash, reward_percentiles: Option<Vec<f64>>, ) -> Pin<Box<dyn Future<Output = Result<FeeHistory, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn max_priority_fee_per_gas(&self) -> Result<U256, ErrorObject<'static>>; fn is_mining(&self) -> Result<bool, ErrorObject<'static>>; fn hashrate(&self) -> Result<U256, ErrorObject<'static>>; fn work(&self) -> Result<Work, ErrorObject<'static>>; fn submit_hashrate( &self, hashrate: U256, id: H256, ) -> Result<bool, ErrorObject<'static>>; fn submit_work( &self, nonce: H64, pow_hash: H256, mix_digest: H256, ) -> Result<bool, ErrorObject<'static>>; fn send_transaction<'life0, 'async_trait>( &'life0 self, request: TransactionRequest, ) -> Pin<Box<dyn Future<Output = Result<H256, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn send_raw_transaction<'life0, 'async_trait>( &'life0 self, bytes: Bytes, ) -> Pin<Box<dyn Future<Output = Result<H256, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; // Provided method fn into_rpc(self) -> RpcModule<Self> { ... }
}
Expand description

Server trait implementation for the EthApi RPC API.

Required Methods§

Source

fn protocol_version(&self) -> Result<u64, ErrorObject<'static>>

Returns protocol version encoded as a string (quotes are necessary).

Source

fn syncing<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<SyncStatus, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns an object with data about the sync status or false. (wtf?)

Source

fn author(&self) -> Result<H160, ErrorObject<'static>>

Returns block author.

Source

fn accounts(&self) -> Result<Vec<H160>, ErrorObject<'static>>

Returns accounts list.

Source

fn block_number(&self) -> Result<U256, ErrorObject<'static>>

Returns highest block number.

Source

fn chain_id(&self) -> Result<Option<U64>, ErrorObject<'static>>

Returns the chain ID used for transaction signing at the current best block. None is returned if not available.

Source

fn block_by_hash<'life0, 'async_trait>( &'life0 self, hash: H256, full: bool, ) -> Pin<Box<dyn Future<Output = Result<Option<Rich<Block>>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns block with given hash.

Source

fn block_by_number<'life0, 'async_trait>( &'life0 self, number_or_hash: BlockNumberOrHash, full: bool, ) -> Pin<Box<dyn Future<Output = Result<Option<Rich<Block>>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns block with given number.

Source

fn block_transaction_count_by_hash<'life0, 'async_trait>( &'life0 self, hash: H256, ) -> Pin<Box<dyn Future<Output = Result<Option<U256>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns the number of transactions in a block with given hash.

Source

fn block_transaction_count_by_number<'life0, 'async_trait>( &'life0 self, number_or_hash: BlockNumberOrHash, ) -> Pin<Box<dyn Future<Output = Result<Option<U256>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns the number of transactions in a block with given block number.

Source

fn block_transaction_receipts<'life0, 'async_trait>( &'life0 self, number_or_hash: BlockNumberOrHash, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Receipt>>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns the receipts of a block by number or hash.

Source

fn block_uncles_count_by_hash( &self, hash: H256, ) -> Result<U256, ErrorObject<'static>>

Returns the number of uncles in a block with given hash.

Source

fn block_uncles_count_by_number( &self, number_or_hash: BlockNumberOrHash, ) -> Result<U256, ErrorObject<'static>>

Returns the number of uncles in a block with given block number.

Source

fn uncle_by_block_hash_and_index( &self, hash: H256, index: Index, ) -> Result<Option<Rich<Block>>, ErrorObject<'static>>

Returns an uncles at given block and index.

Source

fn uncle_by_block_number_and_index( &self, number_or_hash: BlockNumberOrHash, index: Index, ) -> Result<Option<Rich<Block>>, ErrorObject<'static>>

Returns an uncles at given block and index.

Source

fn transaction_by_hash<'life0, 'async_trait>( &'life0 self, hash: H256, ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get transaction by its hash.

Source

fn transaction_by_block_hash_and_index<'life0, 'async_trait>( &'life0 self, hash: H256, index: Index, ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns transaction at given block hash and index.

Source

fn transaction_by_block_number_and_index<'life0, 'async_trait>( &'life0 self, number_or_hash: BlockNumberOrHash, index: Index, ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns transaction by given block number and index.

Source

fn transaction_receipt<'life0, 'async_trait>( &'life0 self, hash: H256, ) -> Pin<Box<dyn Future<Output = Result<Option<Receipt>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns transaction receipt by transaction hash.

Source

fn balance<'life0, 'async_trait>( &'life0 self, address: H160, number_or_hash: Option<BlockNumberOrHash>, ) -> Pin<Box<dyn Future<Output = Result<U256, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns balance of the given account.

Source

fn storage_at<'life0, 'async_trait>( &'life0 self, address: H160, index: U256, number_or_hash: Option<BlockNumberOrHash>, ) -> Pin<Box<dyn Future<Output = Result<H256, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns content of the storage at given address.

Source

fn transaction_count<'life0, 'async_trait>( &'life0 self, address: H160, number_or_hash: Option<BlockNumberOrHash>, ) -> Pin<Box<dyn Future<Output = Result<U256, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns the number of transactions sent from given address at given time (block number).

Source

fn code_at<'life0, 'async_trait>( &'life0 self, address: H160, number_or_hash: Option<BlockNumberOrHash>, ) -> Pin<Box<dyn Future<Output = Result<Bytes, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns the code at given address at given time (block number).

Source

fn call<'life0, 'async_trait>( &'life0 self, request: TransactionRequest, number_or_hash: Option<BlockNumberOrHash>, state_overrides: Option<BTreeMap<H160, CallStateOverride>>, ) -> Pin<Box<dyn Future<Output = Result<Bytes, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Call contract, returning the output data.

Source

fn estimate_gas<'life0, 'async_trait>( &'life0 self, request: TransactionRequest, number_or_hash: Option<BlockNumberOrHash>, ) -> Pin<Box<dyn Future<Output = Result<U256, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Estimate gas needed for execution of given contract.

Source

fn pending_transactions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Transaction>, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns all pending transactions.

Source

fn gas_price(&self) -> Result<U256, ErrorObject<'static>>

Returns current gas_price.

Source

fn fee_history<'life0, 'async_trait>( &'life0 self, block_count: BlockCount, newest_block: BlockNumberOrHash, reward_percentiles: Option<Vec<f64>>, ) -> Pin<Box<dyn Future<Output = Result<FeeHistory, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Introduced in EIP-1159 for getting information on the appropriate priority fee to use.

Source

fn max_priority_fee_per_gas(&self) -> Result<U256, ErrorObject<'static>>

Introduced in EIP-1159, a Geth-specific and simplified priority fee oracle. Leverages the already existing fee history cache.

Source

fn is_mining(&self) -> Result<bool, ErrorObject<'static>>

Returns true if client is actively mining new blocks.

Source

fn hashrate(&self) -> Result<U256, ErrorObject<'static>>

Returns the number of hashes per second that the node is mining with.

Source

fn work(&self) -> Result<Work, ErrorObject<'static>>

Returns the hash of the current block, the seedHash, and the boundary condition to be met.

Source

fn submit_hashrate( &self, hashrate: U256, id: H256, ) -> Result<bool, ErrorObject<'static>>

Used for submitting mining hashrate.

Source

fn submit_work( &self, nonce: H64, pow_hash: H256, mix_digest: H256, ) -> Result<bool, ErrorObject<'static>>

Used for submitting a proof-of-work solution.

Source

fn send_transaction<'life0, 'async_trait>( &'life0 self, request: TransactionRequest, ) -> Pin<Box<dyn Future<Output = Result<H256, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Sends transaction; will block waiting for signer to return the transaction hash.

Source

fn send_raw_transaction<'life0, 'async_trait>( &'life0 self, bytes: Bytes, ) -> Pin<Box<dyn Future<Output = Result<H256, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Sends signed transaction, returning its hash.

Provided Methods§

Source

fn into_rpc(self) -> RpcModule<Self>

Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<B, C, P, CT, BE, CIDP, EC> EthApiServer for Eth<B, C, P, CT, BE, CIDP, EC>
where B: BlockT, C: CallApiAt<B> + ProvideRuntimeApi<B> + HeaderBackend<B> + StorageProvider<B, BE> + 'static, C::Api: BlockBuilderApi<B> + ConvertTransactionRuntimeApi<B> + EthereumRuntimeRPCApi<B>, BE: Backend<B> + 'static, P: TransactionPool<Block = B, Hash = B::Hash> + 'static, CT: ConvertTransaction<<B as BlockT>::Extrinsic> + Send + Sync + 'static, CIDP: CreateInherentDataProviders<B, ()> + Send + 'static, EC: EthConfig<B, C>,