Struct RpcClient

Source
pub struct RpcClient<P> { /* private fields */ }
Expand description

An abstract provider for interacting with the Neo JSON RPC API. Must be instantiated with a data transport which implements the JsonRpcClient trait (e.g. HTTP, Websockets etc.)

§Example

use neo3::neo_clients::{HttpProvider, RpcClient, APITrait};
use neo3::neo_config::NeoConstants;

async fn foo() -> Result<(), Box<dyn std::error::Error>> {
    let provider = HttpProvider::new(NeoConstants::SEED_1)?;
    let client = RpcClient::new(provider);

    let block = client.get_block_by_index(100u32, false).await?;
    println!("Got block: {}", serde_json::to_string(&block)?);
    Ok(())
}

Implementations§

Source§

impl<P: JsonRpcProvider> RpcClient<P>

Source

pub fn new(provider: P) -> Self

Instantiate a new provider with a backend.

Source

pub async fn node_client(&self) -> Result<NeoVersion, ProviderError>

Returns the type of node we’re connected to, while also caching the value for use in other node-specific API calls, such as the get_block_receipts call.

Source

pub fn with_sender(self, address: impl Into<Address>) -> Self

Set the default sender on the provider

Source

pub async fn request<T, R>( &self, method: &str, params: T, ) -> Result<R, ProviderError>

Make an RPC request via the internal connection, and return the result.

Source§

impl<P: JsonRpcProvider> RpcClient<P>

Source

pub fn set_interval<T: Into<Duration>>(&mut self, interval: T) -> &mut Self

Sets the default polling interval for event filters and pending transactions (default: 7 seconds)

Source

pub fn interval<T: Into<Duration>>(self, interval: T) -> Self

Sets the default polling interval for event filters and pending transactions (default: 7 seconds)

Source§

impl RpcClient<Http>

Source

pub fn url(&self) -> &Url

The Url to which requests are made

Source

pub fn url_mut(&mut self) -> &mut Url

Mutable access to the Url to which requests are made

Source§

impl<Read, Write> RpcClient<RwClient<Read, Write>>
where Read: JsonRpcProvider + 'static, <Read as JsonRpcProvider>::Error: Sync + Send + 'static + Display, Write: JsonRpcProvider + 'static, <Write as JsonRpcProvider>::Error: Sync + Send + 'static + Display,

Source

pub fn rw(r: Read, w: Write) -> Self

Creates a new RpcClient with a RwClient

Trait Implementations§

Source§

impl<P: JsonRpcProvider> APITrait for RpcClient<P>

Source§

fn get_best_block_hash<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<H256, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the hash of the latest block in the blockchain.

  • Returns: The request object
Source§

fn get_block_hash<'life0, 'async_trait>( &'life0 self, block_index: u32, ) -> Pin<Box<dyn Future<Output = Result<H256, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the block hash of the corresponding block based on the specified block index.

  • Parameter blockIndex: The block index
  • Returns: The request object
Source§

fn get_block<'life0, 'async_trait>( &'life0 self, block_hash: H256, full_tx: bool, ) -> Pin<Box<dyn Future<Output = Result<NeoBlock, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the corresponding block information according to the specified block hash.

  • Parameters:
    • blockHash: The block hash
    • returnFullTransactionObjects: Whether to get block information with all transaction objects or just the block header
  • Returns: The request object
Source§

fn get_block_by_hash<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 str, full_tx: bool, ) -> Pin<Box<dyn Future<Output = Result<NeoBlock, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets the block by hash string.

  • Parameters:
    • hash: The block hash as a string
    • full_tx: Whether to get block information with all transaction objects or just the block header
  • Returns: The request object
Source§

fn get_raw_block<'life0, 'async_trait>( &'life0 self, block_hash: H256, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the corresponding block information for the specified block hash.

  • Parameter blockHash: The block hash
  • Returns: The request object
Source§

fn get_block_header_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u32, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the block header count of the blockchain.

  • Returns: The request object
Source§

fn get_block_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u32, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the block count of the blockchain.

  • Returns: The request object
Source§

fn get_block_header<'life0, 'async_trait>( &'life0 self, block_hash: H256, ) -> Pin<Box<dyn Future<Output = Result<NeoBlock, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the corresponding block header information according to the specified block hash.

  • Parameter blockHash: The block hash
  • Returns: The request object
Source§

fn get_block_header_by_index<'life0, 'async_trait>( &'life0 self, index: u32, ) -> Pin<Box<dyn Future<Output = Result<NeoBlock, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the corresponding block header information according to the specified index.

  • Parameter blockIndex: The block index
  • Returns: The request object
Source§

fn get_raw_block_header<'life0, 'async_trait>( &'life0 self, block_hash: H256, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the corresponding block header information according to the specified block hash.

  • Parameter blockHash: The block hash
  • Returns: The request object
Source§

fn get_raw_block_header_by_index<'life0, 'async_trait>( &'life0 self, index: u32, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the corresponding block header information according to the specified index.

  • Parameter blockIndex: The block index
  • Returns: The request object
Source§

fn get_native_contracts<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<NativeContractState>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the native contracts list, which includes the basic information of native contracts and the contract descriptive file manifest.json.

  • Returns: The request object
Source§

fn get_contract_state<'life0, 'async_trait>( &'life0 self, hash: H160, ) -> Pin<Box<dyn Future<Output = Result<ContractState, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the contract information.

  • Parameter contractHash: The contract script hash
  • Returns: The request object
Source§

fn get_contract_state_by_id<'life0, 'async_trait>( &'life0 self, id: i64, ) -> Pin<Box<dyn Future<Output = Result<ContractState, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the contract information.

  • Parameter contractHash: The contract script hash
  • Returns: The request object
Source§

fn get_native_contract_state<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ContractState, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets the native contract information by its name.

This RPC only works for native contracts.

  • Parameter contractName: The name of the native contract
  • Returns: The request object
Source§

fn get_mem_pool<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<MemPoolDetails, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets a list of unconfirmed or confirmed transactions in memory.

  • Returns: The request object
Source§

fn get_raw_mem_pool<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<H256>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets a list of confirmed transactions in memory.

  • Returns: The request object
Source§

fn get_transaction<'life0, 'async_trait>( &'life0 self, hash: H256, ) -> Pin<Box<dyn Future<Output = Result<RTransaction, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the corresponding transaction information based on the specified transaction hash.

  • Parameter txHash: The transaction hash
  • Returns: The request object
Source§

fn get_raw_transaction<'life0, 'async_trait>( &'life0 self, tx_hash: H256, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the corresponding transaction information based on the specified transaction hash.

  • Parameter txHash: The transaction hash
  • Returns: The request object
Source§

fn get_storage<'life0, 'life1, 'async_trait>( &'life0 self, contract_hash: H160, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets the stored value according to the contract hash and the key.

  • Parameters:
    • contractHash: The contract hash
    • keyHexString: The key to look up in storage as a hexadecimal string
  • Returns: The request object
Source§

fn find_storage<'life0, 'life1, 'async_trait>( &'life0 self, contract_hash: H160, prefix_hex_string: &'life1 str, start_index: u64, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Finds the storage entries of a contract based on the prefix and start index.

  • Parameters:
    • contractHash: The contract hash
    • prefix_hex_string: The prefix to filter the storage entries
    • start_index: the start index
  • Returns: The request object
Source§

fn find_storage_with_id<'life0, 'life1, 'async_trait>( &'life0 self, contract_id: i64, prefix_hex_string: &'life1 str, start_index: u64, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Finds the storage entries of a contract based on the prefix and start index.

  • Parameters:
    • contract_id: The contract id
    • prefix_hex_string: The prefix to filter the storage entries
    • start_index: the start index
  • Returns: The request object
Source§

fn get_transaction_height<'life0, 'async_trait>( &'life0 self, tx_hash: H256, ) -> Pin<Box<dyn Future<Output = Result<u32, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the transaction height with the specified transaction hash.

  • Parameter txHash: The transaction hash
  • Returns: The request object
Source§

fn get_next_block_validators<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Validator>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the validators of the next block.

  • Returns: The request object
Source§

fn get_committee<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the public key list of current Neo committee members.

  • Returns: The request object
Source§

fn get_connection_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u32, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the current number of connections for the node.

  • Returns: The request object
Source§

fn get_peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Peers, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets a list of nodes that the node is currently connected or disconnected from.

  • Returns: The request object
Source§

fn get_version<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<NeoVersion, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the version information of the node.

  • Returns: The request object
Source§

fn send_raw_transaction<'life0, 'async_trait>( &'life0 self, hex: String, ) -> Pin<Box<dyn Future<Output = Result<RawTransaction, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Broadcasts a transaction over the NEO network.

  • Parameter rawTransactionHex: The raw transaction in hexadecimal
  • Returns: The request object
Source§

fn send_transaction<'a, 'life0, 'async_trait>( &'life0 self, tx: Transaction<'a, P>, ) -> Pin<Box<dyn Future<Output = Result<H256, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Sends a transaction to the network

§Arguments
  • tx - The transaction to send
§Returns

A Result containing the transaction hash or a ProviderError

Source§

fn submit_block<'life0, 'async_trait>( &'life0 self, hex: String, ) -> Pin<Box<dyn Future<Output = Result<SubmitBlock, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Broadcasts a new block over the NEO network.

  • Parameter serializedBlockAsHex: The block in hexadecimal
  • Returns: The request object
Source§

fn broadcast_address<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Broadcasts the node’s address to the network

Source§

fn broadcast_block<'life0, 'async_trait>( &'life0 self, block: NeoBlock, ) -> Pin<Box<dyn Future<Output = Result<bool, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Broadcasts a block to the network

Source§

fn broadcast_get_blocks<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 str, count: u32, ) -> Pin<Box<dyn Future<Output = Result<bool, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Broadcasts a request for blocks to the network

§Arguments
  • hash - The hash of the block to start from
  • count - The number of blocks to request
§Returns

A Result containing a boolean indicating success or a ProviderError

Source§

fn broadcast_transaction<'life0, 'async_trait>( &'life0 self, tx: RTransaction, ) -> Pin<Box<dyn Future<Output = Result<bool, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Broadcasts a transaction to the network

§Arguments
  • tx - The transaction to broadcast
§Returns

A Result containing a boolean indicating success or a ProviderError

Source§

fn create_contract_deployment_transaction<'life0, 'async_trait>( &'life0 self, nef: NefFile, manifest: ContractManifest, signers: Vec<Signer>, ) -> Pin<Box<dyn Future<Output = Result<TransactionBuilder<'_, P>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Creates a contract deployment transaction

Source§

fn create_contract_update_transaction<'life0, 'async_trait>( &'life0 self, contract_hash: H160, nef: NefFile, manifest: ContractManifest, signers: Vec<Signer>, ) -> Pin<Box<dyn Future<Output = Result<TransactionBuilder<'_, P>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Creates a contract update transaction

Source§

fn create_invocation_transaction<'life0, 'life1, 'async_trait>( &'life0 self, contract_hash: H160, method: &'life1 str, parameters: Vec<ContractParameter>, signers: Vec<Signer>, ) -> Pin<Box<dyn Future<Output = Result<TransactionBuilder<'_, P>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Creates an invocation transaction

Source§

fn invoke_function<'life0, 'life1, 'async_trait>( &'life0 self, contract_hash: &'life1 H160, method: String, params: Vec<ContractParameter>, signers: Option<Vec<Signer>>, ) -> Pin<Box<dyn Future<Output = Result<InvocationResult, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Invokes the function with functionName of the smart contract with the specified contract hash.

  • Parameters:
    • contractHash: The contract hash to invoke
    • functionName: The function to invoke
    • contractParams: The parameters of the function
    • signers: The signers
  • Returns: The request object
Source§

fn invoke_script<'life0, 'async_trait>( &'life0 self, hex: String, signers: Vec<Signer>, ) -> Pin<Box<dyn Future<Output = Result<InvocationResult, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Invokes a script.

  • Parameters:
    • scriptHex: The script to invoke
    • signers: The signers
  • Returns: The request object
Source§

fn get_unclaimed_gas<'life0, 'async_trait>( &'life0 self, hash: H160, ) -> Pin<Box<dyn Future<Output = Result<UnclaimedGas, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the unclaimed GAS of the account with the specified script hash.

  • Parameter scriptHash: The account’s script hash
  • Returns: The request object
Source§

fn list_plugins<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Plugin>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets a list of plugins loaded by the node.

  • Returns: The request object
Source§

fn validate_address<'life0, 'life1, 'async_trait>( &'life0 self, address: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ValidateAddress, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Verifies whether the address is a valid NEO address.

  • Parameter address: The address to verify
  • Returns: The request object
Source§

fn close_wallet<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Closes the current wallet.

  • Returns: The request object
Source§

fn dump_priv_key<'life0, 'async_trait>( &'life0 self, script_hash: H160, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Exports the private key of the specified script hash.

  • Parameter scriptHash: The account’s script hash
  • Returns: The request object
Source§

fn get_wallet_balance<'life0, 'async_trait>( &'life0 self, token_hash: H160, ) -> Pin<Box<dyn Future<Output = Result<Balance, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the wallet balance of the corresponding token.

  • Parameter tokenHash: The token hash
  • Returns: The request object
Source§

fn get_new_address<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Creates a new address.

  • Returns: The request object
Source§

fn get_wallet_unclaimed_gas<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the amount of unclaimed GAS in the wallet.

  • Returns: The request object
Source§

fn import_priv_key<'life0, 'async_trait>( &'life0 self, priv_key: String, ) -> Pin<Box<dyn Future<Output = Result<NeoAddress, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Imports a private key to the wallet.

  • Parameter privateKeyInWIF: The private key in WIF-format
  • Returns: The request object
Source§

fn calculate_network_fee<'life0, 'async_trait>( &'life0 self, txBase64: String, ) -> Pin<Box<dyn Future<Output = Result<NeoNetworkFee, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Calculates the network fee for the specified transaction.

  • Parameter txBase64: The transaction in hexadecimal
  • Returns: The request object
Source§

fn list_address<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<NeoAddress>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists all the addresses in the current wallet.

  • Returns: The request object
Source§

fn open_wallet<'life0, 'async_trait>( &'life0 self, path: String, password: String, ) -> Pin<Box<dyn Future<Output = Result<bool, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Opens the specified wallet.

  • Parameters:
    • walletPath: The wallet file path
    • password: The password for the wallet
  • Returns: The request object
Source§

fn send_from<'life0, 'async_trait>( &'life0 self, token_hash: H160, from: H160, to: H160, amount: u32, ) -> Pin<Box<dyn Future<Output = Result<RTransaction, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Transfers an amount of a token from an account to another account.

  • Parameters:
    • tokenHash: The token hash of the NEP-17 contract
    • from: The transferring account’s script hash
    • to: The recipient
    • amount: The transfer amount in token fractions
  • Returns: The request object
Source§

fn send_many<'life0, 'async_trait>( &'life0 self, from: Option<H160>, send_tokens: Vec<TransactionSendToken>, ) -> Pin<Box<dyn Future<Output = Result<RTransaction, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Initiates multiple transfers to multiple accounts from one specific account in a transaction.

  • Parameters:
    • from: The transferring account’s script hash
    • txSendTokens: a list of TransactionSendToken objects, that each contains the token hash, the recipient and the transfer amount.
  • Returns: The request object
Source§

fn send_to_address<'life0, 'async_trait>( &'life0 self, token_hash: H160, to: H160, amount: u32, ) -> Pin<Box<dyn Future<Output = Result<RTransaction, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Transfers an amount of a token to another account.

  • Parameters:
    • tokenHash: The token hash of the NEP-17 contract
    • to: The recipient
    • amount: The transfer amount in token fractions
  • Returns: The request object
Source§

fn get_application_log<'life0, 'async_trait>( &'life0 self, tx_hash: H256, ) -> Pin<Box<dyn Future<Output = Result<ApplicationLog, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the application logs of the specified transaction hash.

  • Parameter txHash: The transaction hash
  • Returns: The request object
Source§

fn get_nep17_balances<'life0, 'async_trait>( &'life0 self, script_hash: H160, ) -> Pin<Box<dyn Future<Output = Result<Nep17Balances, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the balance of all NEP-17 token assets in the specified script hash.

  • Parameter scriptHash: The account’s script hash
  • Returns: The request object
Source§

fn get_nep17_transfers<'life0, 'async_trait>( &'life0 self, script_hash: H160, ) -> Pin<Box<dyn Future<Output = Result<Nep17Transfers, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets all the NEP-17 transaction information occurred in the specified script hash.

  • Parameter scriptHash: The account’s script hash
  • Returns: The request object
Source§

fn get_nep17_transfers_from<'life0, 'async_trait>( &'life0 self, script_hash: H160, from: u64, ) -> Pin<Box<dyn Future<Output = Result<Nep17Transfers, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets all the NEP17 transaction information occurred in the specified script hash since the specified time.

  • Parameters:
    • scriptHash: The account’s script hash
    • from: The timestamp transactions occurred since
  • Returns: The request object
Source§

fn get_nep17_transfers_range<'life0, 'async_trait>( &'life0 self, script_hash: H160, from: u64, to: u64, ) -> Pin<Box<dyn Future<Output = Result<Nep17Transfers, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets all the NEP17 transaction information occurred in the specified script hash in the specified time range.

  • Parameters:
    • scriptHash: The account’s script hash
    • from: The start timestamp
    • to: The end timestamp
  • Returns: The request object
Source§

fn get_nep11_balances<'life0, 'async_trait>( &'life0 self, script_hash: H160, ) -> Pin<Box<dyn Future<Output = Result<Nep11Balances, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets all NEP-11 balances of the specified account.

  • Parameter scriptHash: The account’s script hash
  • Returns: The request object
Source§

fn get_nep11_transfers<'life0, 'async_trait>( &'life0 self, script_hash: H160, ) -> Pin<Box<dyn Future<Output = Result<Nep11Transfers, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets all NEP-11 transaction of the given account.

  • Parameter scriptHash: The account’s script hash
  • Returns: The request object
Source§

fn get_nep11_transfers_from<'life0, 'async_trait>( &'life0 self, script_hash: H160, from: u64, ) -> Pin<Box<dyn Future<Output = Result<Nep11Transfers, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets all NEP-11 transaction of the given account since the given time.

  • Parameters:
    • scriptHash: The account’s script hash
    • from: The date from when to report transactions
  • Returns: The request object
Source§

fn get_nep11_transfers_range<'life0, 'async_trait>( &'life0 self, script_hash: H160, from: u64, to: u64, ) -> Pin<Box<dyn Future<Output = Result<Nep11Transfers, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets all NEP-11 transactions of the given account in the time span between from and to.

  • Parameters:
    • scriptHash: The account’s script hash
    • from: The start timestamp
    • to: The end timestamp
  • Returns: The request object
Source§

fn get_nep11_properties<'life0, 'life1, 'async_trait>( &'life0 self, script_hash: H160, token_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, String>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets the properties of the token with tokenId from the NEP-11 contract with scriptHash.

The properties are a mapping from the property name string to the value string. The value is plain text if the key is one of the properties defined in the NEP-11 standard. Otherwise, the value is a Base64-encoded byte array.

To receive custom property values that consist of nested types (e.g., Maps or Arrays) use invokeFunction(_:_:_:) to directly invoke the method properties of the NEP-11 smart contract.

  • Parameters:
    • scriptHash: The account’s script hash
    • tokenId: The ID of the token as a hexadecimal string
  • Returns: The request object
Source§

fn get_state_root<'life0, 'async_trait>( &'life0 self, block_index: u32, ) -> Pin<Box<dyn Future<Output = Result<StateRoot, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the state root by the block height.

  • Parameter blockIndex: The block index
  • Returns: The request object
Source§

fn get_proof<'life0, 'life1, 'async_trait>( &'life0 self, root_hash: H256, contract_hash: H160, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets the proof based on the root hash, the contract hash and the storage key.

  • Parameters:
    • rootHash: The root hash
    • contractHash: The contract hash
    • storageKeyHex: The storage key
  • Returns: The request object
Source§

fn verify_proof<'life0, 'life1, 'async_trait>( &'life0 self, root_hash: H256, proof: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Verifies the proof data and gets the value of the storage corresponding to the key.

  • Parameters:
    • rootHash: The root hash
    • proof: The proof data of the state root
  • Returns: The request object
Source§

fn get_state_height<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<StateHeight, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the state root height.

  • Returns: The request object
Source§

fn get_state<'life0, 'life1, 'async_trait>( &'life0 self, root_hash: H256, contract_hash: H160, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets the state.

  • Parameters:
    • rootHash: The root hash
    • contractHash: The contract hash
    • keyHex: The storage key
  • Returns: The request object
Source§

fn find_states<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, root_hash: H256, contract_hash: H160, key_prefix: &'life1 str, start_key: Option<&'life2 str>, count: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<States, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Gets a list of states that match the provided key prefix.

Includes proofs of the first and last entry.

  • Parameters:
    • rootHash: The root hash
    • contractHash: The contact hash
    • keyPrefixHex: The key prefix
    • startKeyHex: The start key
    • countFindResultItems: The number of results. An upper limit is defined in the Neo core
  • Returns: The request object
Source§

fn invoke_function_diagnostics<'life0, 'async_trait>( &'life0 self, contract_hash: H160, function_name: String, params: Vec<ContractParameter>, signers: Vec<Signer>, ) -> Pin<Box<dyn Future<Output = Result<InvocationResult, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Invokes the function with functionName of the smart contract with the specified contract hash.

Includes diagnostics from the invocation.

  • Parameters:
    • contractHash: The contract hash to invoke
    • functionName: The function to invoke
    • contractParams: The parameters of the function
    • signers: The signers
  • Returns: The request object
Source§

fn invoke_script_diagnostics<'life0, 'async_trait>( &'life0 self, hex: String, signers: Vec<Signer>, ) -> Pin<Box<dyn Future<Output = Result<InvocationResult, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Invokes a script.

Includes diagnostics from the invocation.

  • Parameters:
    • scriptHex: The script to invoke
    • signers: The signers
  • Returns: The request object
Source§

fn traverse_iterator<'life0, 'async_trait>( &'life0 self, session_id: String, iterator_id: String, count: u32, ) -> Pin<Box<dyn Future<Output = Result<Vec<StackItem>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the results from an iterator.

The results are limited to count items. If count is greater than MaxIteratorResultItems in the Neo Node’s configuration file, this request fails.

  • Parameters:
    • sessionId: The session id
    • iteratorId: The iterator id
    • count: The maximal number of stack items returned
  • Returns: The request object
Source§

type Error = ProviderError

Error type returned by most operations
Source§

type Provider = P

The JSON-RPC client type at the bottom of the stack
Source§

fn rpc_client(&self) -> &RpcClient<Self::Provider>

The HTTP or Websocket provider.
Source§

fn network<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u32, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn cancel_transaction<'life0, 'async_trait>( &'life0 self, txHash: H256, signers: Vec<H160>, extra_fee: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<RTransaction, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_block_by_index<'life0, 'async_trait>( &'life0 self, index: u32, full_tx: bool, ) -> Pin<Box<dyn Future<Output = Result<NeoBlock, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_raw_block_by_index<'life0, 'async_trait>( &'life0 self, index: u32, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn terminate_session<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn invoke_contract_verify<'life0, 'async_trait>( &'life0 self, hash: H160, params: Vec<ContractParameter>, signers: Vec<Signer>, ) -> Pin<Box<dyn Future<Output = Result<InvocationResult, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_raw_mempool<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<MemPoolDetails, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn import_private_key<'life0, 'async_trait>( &'life0 self, wif: String, ) -> Pin<Box<dyn Future<Output = Result<NeoAddress, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

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

Source§

fn send_to_address_send_token<'life0, 'life1, 'async_trait>( &'life0 self, send_token: &'life1 TransactionSendToken, ) -> Pin<Box<dyn Future<Output = Result<RTransaction, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn send_from_send_token<'life0, 'life1, 'async_trait>( &'life0 self, send_token: &'life1 TransactionSendToken, from: H160, ) -> Pin<Box<dyn Future<Output = Result<RTransaction, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn nns_resolver(&self) -> H160

Source§

fn block_interval(&self) -> u32

Source§

fn polling_interval(&self) -> u32

Source§

fn max_valid_until_block_increment(&self) -> u32

Source§

impl<P> AsRef<P> for RpcClient<P>

Source§

fn as_ref(&self) -> &P

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<P: Clone> Clone for RpcClient<P>

Source§

fn clone(&self) -> RpcClient<P>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P: Debug> Debug for RpcClient<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<P> Freeze for RpcClient<P>
where P: Freeze,

§

impl<P> !RefUnwindSafe for RpcClient<P>

§

impl<P> Send for RpcClient<P>
where P: Send,

§

impl<P> Sync for RpcClient<P>
where P: Sync,

§

impl<P> Unpin for RpcClient<P>
where P: Unpin,

§

impl<P> !UnwindSafe for RpcClient<P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,