pub struct Client { /* private fields */ }Expand description
Jsonrpc client, Only to one chain
Implementations§
Source§impl Client
impl Client
Sourcepub fn set_chain_id(&mut self, chain_id: U256) -> &mut Self
pub fn set_chain_id(&mut self, chain_id: U256) -> &mut Self
Set chain id
Sourcepub fn set_private_key(&mut self, private_key: &PrivateKey) -> &mut Self
pub fn set_private_key(&mut self, private_key: &PrivateKey) -> &mut Self
Set private key
Sourcepub fn private_key(&self) -> Option<&PrivateKey>
pub fn private_key(&self) -> Option<&PrivateKey>
Get private key
Sourcepub fn send_requests<T: Iterator<Item = JsonRpcParams>>(
&self,
params: T,
) -> Vec<Result<JsonRpcResponse, ToolError>>
pub fn send_requests<T: Iterator<Item = JsonRpcParams>>( &self, params: T, ) -> Vec<Result<JsonRpcResponse, ToolError>>
Send requests
Sourcepub fn send_request(
&self,
param: JsonRpcParams,
) -> Result<JsonRpcResponse, ToolError>
pub fn send_request( &self, param: JsonRpcParams, ) -> Result<JsonRpcResponse, ToolError>
Send request
Sourcepub fn send_request_with_multiple_url<T: Iterator<Item = Uri>>(
&self,
url: T,
params: JsonRpcParams,
) -> Vec<Result<JsonRpcResponse, ToolError>>
pub fn send_request_with_multiple_url<T: Iterator<Item = Uri>>( &self, url: T, params: JsonRpcParams, ) -> Vec<Result<JsonRpcResponse, ToolError>>
Send multiple params to one node
Sourcepub fn generate_transaction(
&mut self,
transaction_options: TransactionOptions<'_>,
) -> Result<Transaction, ToolError>
pub fn generate_transaction( &mut self, transaction_options: TransactionOptions<'_>, ) -> Result<Transaction, ToolError>
Constructing a Transaction
Sourcepub fn generate_sign_transaction(
&self,
tx: &Transaction,
) -> Result<String, ToolError>
pub fn generate_sign_transaction( &self, tx: &Transaction, ) -> Result<String, ToolError>
Constructing a UnverifiedTransaction hex string
Sourcepub fn send_signed_transaction(
&mut self,
param: &str,
) -> Result<JsonRpcResponse, ToolError>
pub fn send_signed_transaction( &mut self, param: &str, ) -> Result<JsonRpcResponse, ToolError>
Send a signed transaction
Sourcepub fn send_transaction(
&mut self,
param: &str,
) -> Result<JsonRpcResponse, ToolError>
pub fn send_transaction( &mut self, param: &str, ) -> Result<JsonRpcResponse, ToolError>
Send unsigned transactions
Sourcepub fn get_chain_id(&mut self) -> Result<u32, ToolError>
pub fn get_chain_id(&mut self) -> Result<u32, ToolError>
Get chain id
Sourcepub fn get_chain_id_v1(&mut self) -> Result<U256, ToolError>
pub fn get_chain_id_v1(&mut self) -> Result<U256, ToolError>
Get chain id v1
Sourcepub fn get_current_height(&self) -> Result<u64, ToolError>
pub fn get_current_height(&self) -> Result<u64, ToolError>
Get block height
Sourcepub fn get_version(&self) -> Result<u32, ToolError>
pub fn get_version(&self) -> Result<u32, ToolError>
Get version
Trait Implementations§
Source§impl AmendExt<JsonRpcResponse, ToolError> for Client
impl AmendExt<JsonRpcResponse, ToolError> for Client
Source§fn amend_code(
&mut self,
address: &str,
content: &str,
quota: Option<u64>,
) -> Result<T, E>
fn amend_code( &mut self, address: &str, content: &str, quota: Option<u64>, ) -> Result<T, E>
Amend contract code
Source§fn amend_abi(
&mut self,
address: &str,
content: String,
quota: Option<u64>,
) -> Result<T, E>
fn amend_abi( &mut self, address: &str, content: String, quota: Option<u64>, ) -> Result<T, E>
Amend contract ABI
Source§impl ClientExt<JsonRpcResponse, ToolError> for Client
impl ClientExt<JsonRpcResponse, ToolError> for Client
Source§fn get_peer_count(&self) -> Result<JsonRpcResponse, ToolError>
fn get_peer_count(&self) -> Result<JsonRpcResponse, ToolError>
peerCount: Get network peer count
Source§fn get_peers_info(&self, extra: bool) -> Result<JsonRpcResponse, ToolError>
fn get_peers_info(&self, extra: bool) -> Result<JsonRpcResponse, ToolError>
peersInfo: Get all peers information
Source§fn get_license_info(&self) -> Result<JsonRpcResponse, ToolError>
fn get_license_info(&self) -> Result<JsonRpcResponse, ToolError>
licenseInfo: Get CITA license information
Source§fn get_block_number(&self) -> Result<JsonRpcResponse, ToolError>
fn get_block_number(&self) -> Result<JsonRpcResponse, ToolError>
blockNumber: Get current height
Source§fn send_raw_transaction(
&mut self,
transaction_option: TransactionOptions<'_>,
) -> Result<JsonRpcResponse, ToolError>
fn send_raw_transaction( &mut self, transaction_option: TransactionOptions<'_>, ) -> Result<JsonRpcResponse, ToolError>
sendTransaction: Send a transaction and return transaction hash
Source§fn get_block_by_hash(
&self,
hash: &str,
transaction_info: bool,
) -> Result<JsonRpcResponse, ToolError>
fn get_block_by_hash( &self, hash: &str, transaction_info: bool, ) -> Result<JsonRpcResponse, ToolError>
getBlockByHash: Get block by hash
Source§fn get_block_by_number(
&self,
height: &str,
transaction_info: bool,
) -> Result<JsonRpcResponse, ToolError>
fn get_block_by_number( &self, height: &str, transaction_info: bool, ) -> Result<JsonRpcResponse, ToolError>
getBlockByNumber: Get block by number
Source§fn get_transaction_receipt(
&self,
hash: &str,
) -> Result<JsonRpcResponse, ToolError>
fn get_transaction_receipt( &self, hash: &str, ) -> Result<JsonRpcResponse, ToolError>
getTransactionReceipt: Get transaction receipt
Source§fn get_logs(
&self,
topic: Option<Vec<&str>>,
address: Option<Vec<&str>>,
from: Option<&str>,
to: Option<&str>,
) -> Result<JsonRpcResponse, ToolError>
fn get_logs( &self, topic: Option<Vec<&str>>, address: Option<Vec<&str>>, from: Option<&str>, to: Option<&str>, ) -> Result<JsonRpcResponse, ToolError>
getLogs: Get logs
Source§fn call(
&self,
from: Option<&str>,
to: &str,
data: Option<&str>,
height: &str,
extra: bool,
) -> Result<JsonRpcResponse, ToolError>
fn call( &self, from: Option<&str>, to: &str, data: Option<&str>, height: &str, extra: bool, ) -> Result<JsonRpcResponse, ToolError>
call: (readonly, will not save state change)
Source§fn get_transaction(
&self,
hash: &str,
in_pool: bool,
) -> Result<JsonRpcResponse, ToolError>
fn get_transaction( &self, hash: &str, in_pool: bool, ) -> Result<JsonRpcResponse, ToolError>
getTransaction: Get transaction by hash
Source§fn get_transaction_count(
&self,
address: &str,
height: &str,
) -> Result<JsonRpcResponse, ToolError>
fn get_transaction_count( &self, address: &str, height: &str, ) -> Result<JsonRpcResponse, ToolError>
getTransactionCount: Get transaction count of an account
Source§fn get_code(
&self,
address: &str,
height: &str,
) -> Result<JsonRpcResponse, ToolError>
fn get_code( &self, address: &str, height: &str, ) -> Result<JsonRpcResponse, ToolError>
getCode: Get the code of a contract
Source§fn get_abi(
&self,
address: &str,
height: &str,
) -> Result<JsonRpcResponse, ToolError>
fn get_abi( &self, address: &str, height: &str, ) -> Result<JsonRpcResponse, ToolError>
getAbi: Get the ABI of a contract
Source§fn get_balance(
&self,
address: &str,
height: &str,
) -> Result<JsonRpcResponse, ToolError>
fn get_balance( &self, address: &str, height: &str, ) -> Result<JsonRpcResponse, ToolError>
getBalance: Get the balance of a contract (TODO: return U256)
Source§fn new_filter(
&self,
topic: Option<Vec<&str>>,
address: Option<Vec<&str>>,
from: Option<&str>,
to: Option<&str>,
) -> Result<JsonRpcResponse, ToolError>
fn new_filter( &self, topic: Option<Vec<&str>>, address: Option<Vec<&str>>, from: Option<&str>, to: Option<&str>, ) -> Result<JsonRpcResponse, ToolError>
newFilter:
Source§fn new_block_filter(&self) -> Result<JsonRpcResponse, ToolError>
fn new_block_filter(&self) -> Result<JsonRpcResponse, ToolError>
newBlockFilter:
Source§fn uninstall_filter(
&self,
filter_id: &str,
) -> Result<JsonRpcResponse, ToolError>
fn uninstall_filter( &self, filter_id: &str, ) -> Result<JsonRpcResponse, ToolError>
uninstallFilter: Uninstall a filter by its id
Source§fn get_filter_changes(
&self,
filter_id: &str,
) -> Result<JsonRpcResponse, ToolError>
fn get_filter_changes( &self, filter_id: &str, ) -> Result<JsonRpcResponse, ToolError>
getFilterChanges: Get filter changes
Source§fn get_filter_logs(&self, filter_id: &str) -> Result<JsonRpcResponse, ToolError>
fn get_filter_logs(&self, filter_id: &str) -> Result<JsonRpcResponse, ToolError>
getFilterLogs: Get filter logs
Source§fn get_transaction_proof(
&self,
hash: &str,
) -> Result<JsonRpcResponse, ToolError>
fn get_transaction_proof( &self, hash: &str, ) -> Result<JsonRpcResponse, ToolError>
getTransactionProof: Get proof of a transaction
Source§fn get_metadata(&self, height: &str) -> Result<JsonRpcResponse, ToolError>
fn get_metadata(&self, height: &str) -> Result<JsonRpcResponse, ToolError>
getMetaData: Get metadata
Source§fn get_block_header(&self, height: &str) -> Result<JsonRpcResponse, ToolError>
fn get_block_header(&self, height: &str) -> Result<JsonRpcResponse, ToolError>
getBlockHeader: Get block headers based on block height
Source§fn get_state_proof(
&self,
address: &str,
key: &str,
height: &str,
) -> Result<JsonRpcResponse, ToolError>
fn get_state_proof( &self, address: &str, key: &str, height: &str, ) -> Result<JsonRpcResponse, ToolError>
getStateProof: Get the proof of the variable at the specified height
Source§fn get_storage_at(
&self,
address: &str,
key: &str,
height: &str,
) -> Result<JsonRpcResponse, ToolError>
fn get_storage_at( &self, address: &str, key: &str, height: &str, ) -> Result<JsonRpcResponse, ToolError>
getStorageAt: Get the value of the key at the specified height
Source§fn get_version(&self) -> Result<JsonRpcResponse, ToolError>
fn get_version(&self) -> Result<JsonRpcResponse, ToolError>
getVersion: Get release version info of all modules
Source§fn estimate_quota(
&self,
from: Option<&str>,
to: &str,
data: Option<&str>,
height: &str,
) -> Result<JsonRpcResponse, ToolError>
fn estimate_quota( &self, from: Option<&str>, to: &str, data: Option<&str>, height: &str, ) -> Result<JsonRpcResponse, ToolError>
estimateQuota: Estimate a transaction’s quota used
Source§fn get_pool_tx_num(&self) -> Result<JsonRpcResponse, ToolError>
fn get_pool_tx_num(&self) -> Result<JsonRpcResponse, ToolError>
get tx number in pool
Source§fn operate_censored_address(
&self,
action: CensorAction,
censor_addr: &str,
) -> Result<JsonRpcResponse, ToolError>
fn operate_censored_address( &self, action: CensorAction, censor_addr: &str, ) -> Result<JsonRpcResponse, ToolError>
operate censorship address list
Source§fn get_censored_addr(&self) -> Result<JsonRpcResponse, ToolError>
fn get_censored_addr(&self) -> Result<JsonRpcResponse, ToolError>
get censorship address list
Auto Trait Implementations§
impl !Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more