Trait fc_rpc::EthApiServer

pub trait EthApiServer: Sized + Send + Sync + 'static {
Show 35 methods // Required methods fn protocol_version(&self) -> Result<u64, Error>; fn syncing(&self) -> Result<SyncStatus, Error>; fn author(&self) -> Result<H160, Error>; fn accounts(&self) -> Result<Vec<H160, Global>, Error>; fn block_number(&self) -> Result<U256, Error>; fn chain_id(&self) -> Result<Option<U64>, Error>; fn block_by_hash<'life0, 'async_trait>( &'life0 self, hash: H256, full: bool ) -> Pin<Box<dyn Future<Output = Result<Option<Rich<Block>>, Error>> + Send + 'async_trait, Global>> where 'life0: 'async_trait, Self: 'async_trait; fn block_by_number<'life0, 'async_trait>( &'life0 self, number: BlockNumber, full: bool ) -> Pin<Box<dyn Future<Output = Result<Option<Rich<Block>>, Error>> + Send + 'async_trait, Global>> 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>, Error>> + Send + 'async_trait, Global>> where 'life0: 'async_trait, Self: 'async_trait; fn block_transaction_count_by_number<'life0, 'async_trait>( &'life0 self, number: BlockNumber ) -> Pin<Box<dyn Future<Output = Result<Option<U256>, Error>> + Send + 'async_trait, Global>> where 'life0: 'async_trait, Self: 'async_trait; fn block_uncles_count_by_hash(&self, hash: H256) -> Result<U256, Error>; fn block_uncles_count_by_number( &self, number: BlockNumber ) -> Result<U256, Error>; fn uncle_by_block_hash_and_index( &self, hash: H256, index: Index ) -> Result<Option<Rich<Block>>, Error>; fn uncle_by_block_number_and_index( &self, number: BlockNumber, index: Index ) -> Result<Option<Rich<Block>>, Error>; fn transaction_by_hash<'life0, 'async_trait>( &'life0 self, hash: H256 ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, Error>> + Send + 'async_trait, Global>> 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>, Error>> + Send + 'async_trait, Global>> where 'life0: 'async_trait, Self: 'async_trait; fn transaction_by_block_number_and_index<'life0, 'async_trait>( &'life0 self, number: BlockNumber, index: Index ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, Error>> + Send + 'async_trait, Global>> 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>, Error>> + Send + 'async_trait, Global>> where 'life0: 'async_trait, Self: 'async_trait; fn balance<'life0, 'async_trait>( &'life0 self, address: H160, number: Option<BlockNumber> ) -> Pin<Box<dyn Future<Output = Result<U256, Error>> + Send + 'async_trait, Global>> where 'life0: 'async_trait, Self: 'async_trait; fn storage_at<'life0, 'async_trait>( &'life0 self, address: H160, index: U256, number: Option<BlockNumber> ) -> Pin<Box<dyn Future<Output = Result<H256, Error>> + Send + 'async_trait, Global>> where 'life0: 'async_trait, Self: 'async_trait; fn transaction_count<'life0, 'async_trait>( &'life0 self, address: H160, number: Option<BlockNumber> ) -> Pin<Box<dyn Future<Output = Result<U256, Error>> + Send + 'async_trait, Global>> where 'life0: 'async_trait, Self: 'async_trait; fn code_at<'life0, 'async_trait>( &'life0 self, address: H160, number: Option<BlockNumber> ) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait, Global>> where 'life0: 'async_trait, Self: 'async_trait; fn call<'life0, 'async_trait>( &'life0 self, request: CallRequest, number: Option<BlockNumber>, state_overrides: Option<BTreeMap<H160, CallStateOverride, Global>> ) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait, Global>> where 'life0: 'async_trait, Self: 'async_trait; fn estimate_gas<'life0, 'async_trait>( &'life0 self, request: CallRequest, number: Option<BlockNumber> ) -> Pin<Box<dyn Future<Output = Result<U256, Error>> + Send + 'async_trait, Global>> where 'life0: 'async_trait, Self: 'async_trait; fn gas_price(&self) -> Result<U256, Error>; fn fee_history<'life0, 'async_trait>( &'life0 self, block_count: U256, newest_block: BlockNumber, reward_percentiles: Option<Vec<f64, Global>> ) -> Pin<Box<dyn Future<Output = Result<FeeHistory, Error>> + Send + 'async_trait, Global>> where 'life0: 'async_trait, Self: 'async_trait; fn max_priority_fee_per_gas(&self) -> Result<U256, Error>; fn is_mining(&self) -> Result<bool, Error>; fn hashrate(&self) -> Result<U256, Error>; fn work(&self) -> Result<Work, Error>; fn submit_hashrate(&self, hashrate: U256, id: H256) -> Result<bool, Error>; fn submit_work( &self, nonce: H64, pow_hash: H256, mix_digest: H256 ) -> Result<bool, Error>; fn send_transaction<'life0, 'async_trait>( &'life0 self, request: TransactionRequest ) -> Pin<Box<dyn Future<Output = Result<H256, Error>> + Send + 'async_trait, Global>> 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, Error>> + Send + 'async_trait, Global>> 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§

fn protocol_version(&self) -> Result<u64, Error>

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

fn syncing(&self) -> Result<SyncStatus, Error>

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

fn author(&self) -> Result<H160, Error>

Returns block author.

fn accounts(&self) -> Result<Vec<H160, Global>, Error>

Returns accounts list.

fn block_number(&self) -> Result<U256, Error>

Returns highest block number.

fn chain_id(&self) -> Result<Option<U64>, Error>

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

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

Returns block with given hash.

fn block_by_number<'life0, 'async_trait>( &'life0 self, number: BlockNumber, full: bool ) -> Pin<Box<dyn Future<Output = Result<Option<Rich<Block>>, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,

Returns block with given number.

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

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

fn block_transaction_count_by_number<'life0, 'async_trait>( &'life0 self, number: BlockNumber ) -> Pin<Box<dyn Future<Output = Result<Option<U256>, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,

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

fn block_uncles_count_by_hash(&self, hash: H256) -> Result<U256, Error>

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

fn block_uncles_count_by_number( &self, number: BlockNumber ) -> Result<U256, Error>

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

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

Returns an uncles at given block and index.

fn uncle_by_block_number_and_index( &self, number: BlockNumber, index: Index ) -> Result<Option<Rich<Block>>, Error>

Returns an uncles at given block and index.

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

Get transaction by its hash.

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

Returns transaction at given block hash and index.

fn transaction_by_block_number_and_index<'life0, 'async_trait>( &'life0 self, number: BlockNumber, index: Index ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,

Returns transaction by given block number and index.

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

Returns transaction receipt by transaction hash.

fn balance<'life0, 'async_trait>( &'life0 self, address: H160, number: Option<BlockNumber> ) -> Pin<Box<dyn Future<Output = Result<U256, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,

Returns balance of the given account.

fn storage_at<'life0, 'async_trait>( &'life0 self, address: H160, index: U256, number: Option<BlockNumber> ) -> Pin<Box<dyn Future<Output = Result<H256, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,

Returns content of the storage at given address.

fn transaction_count<'life0, 'async_trait>( &'life0 self, address: H160, number: Option<BlockNumber> ) -> Pin<Box<dyn Future<Output = Result<U256, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,

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

fn code_at<'life0, 'async_trait>( &'life0 self, address: H160, number: Option<BlockNumber> ) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,

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

fn call<'life0, 'async_trait>( &'life0 self, request: CallRequest, number: Option<BlockNumber>, state_overrides: Option<BTreeMap<H160, CallStateOverride, Global>> ) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,

Call contract, returning the output data.

fn estimate_gas<'life0, 'async_trait>( &'life0 self, request: CallRequest, number: Option<BlockNumber> ) -> Pin<Box<dyn Future<Output = Result<U256, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,

Estimate gas needed for execution of given contract.

fn gas_price(&self) -> Result<U256, Error>

Returns current gas_price.

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

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

fn max_priority_fee_per_gas(&self) -> Result<U256, Error>

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

fn is_mining(&self) -> Result<bool, Error>

Returns true if client is actively mining new blocks.

fn hashrate(&self) -> Result<U256, Error>

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

fn work(&self) -> Result<Work, Error>

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

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

Used for submitting mining hashrate.

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

Used for submitting a proof-of-work solution.

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

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

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

Sends signed transaction, returning its hash.

Provided Methods§

fn into_rpc(self) -> RpcModule<Self>

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

Implementors§

source§

impl<B, C, P, CT, BE, A, CIDP, EC> EthApiServer for Eth<B, C, P, CT, BE, A, 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> + 'static, CT: ConvertTransaction<<B as BlockT>::Extrinsic> + Send + Sync + 'static, A: ChainApi<Block = B> + 'static, CIDP: CreateInherentDataProviders<B, ()> + Send + 'static, EC: EthConfig<B, C>,