[][src]Struct iota_client::client::Client

pub struct Client<'a> { /* fields omitted */ }

An instance of the client using IRI URI

Methods

impl<'_> Client<'_>[src]

pub fn new(uri: &str) -> Client[src]

Create a new instance of IOTA Client

pub fn add_neighbors(&self) -> AddNeighborsBuilder[src]

Add a list of neighbors to your node. It should be noted that this is only temporary, and the added neighbors will be removed from your set of neighbors after you relaunch IRI.

Parameters

  • uris - Slices of neighbor URIs(&str) to add

pub fn attach_to_tangle(&self) -> AttachToTangleBuilder[src]

Does proof of work for the given transaction trytes. The branch_transaction and trunk_transaction parameters are returned from the get_transactions_to_approve method.

Parameters

pub async fn broadcast_bundle<'_, '_>(
    &'_ self,
    hash: &'_ Hash
) -> Result<Vec<Transaction>>
[src]

Re-broadcasts all transactions in a bundle given the tail transaction hash. It might be useful when transactions did not properly propagate, particularly in the case of large bundles.

Parameters

  • hash - Tail transaction hash (current_index == 0)

pub fn broadcast_transactions(&self) -> BroadcastTransactionsBuilder[src]

Sends transaction trytes to a node. The input trytes for this call are provided by attach_to_tangle. Response only contains errors and exceptions, it would be None if the call success.

Parameters

pub fn check_consistency(&self) -> CheckConsistencyBuilder[src]

Checks the consistency of transactions. A consistent transaction is one where the following statements are true:

  • The node isn't missing the transaction's branch or trunk transactions
  • The transaction's bundle is valid
  • The transaction's branch and trunk transactions are valid

Parameters

  • tails - Transaction hashes to check

pub fn find_transactions(&self) -> FindTransactionsBuilder[src]

Finds transactions that contain the given values in their transaction fields. The parameters define the transaction fields to search for, including bundles, addresses, tags, and approvees. Using multiple transaction fields, returns transactions hashes at the intersection of those values.

Parameters

  • bundles - (Optional) Bundle hashes to search for
  • addresses - (Optional) Addresses to search for (do not include the checksum)
  • tags - (Optional) Tags to search for
  • approvees - (Optional) Child transactions to search for

pub fn get_balances(&self) -> GetBalancesBuilder[src]

Gets the confirmed balance of an address. If the tips parameter is missing, the returned balance is correct as of the latest confirmed milestone. This endpoint returns data only if the node is synchronized.

Parameters

  • addresses - Address for which to get the balance (do not include the checksum)
  • threshold - (Optional) Confirmation threshold between 0 and 100, default is 100.
  • tips - (Optional) Tips whose history of transactions to traverse to find the balance

pub async fn get_bundle<'_, '_>(
    &'_ self,
    hash: &'_ Hash
) -> Result<Vec<Transaction>>
[src]

Fetches and validates the bundle given a tail transaction hash, by calling traverse_bundle and traversing through trunk transaction.

Parameters

  • [hash] - Tail transaction hash (current_index == 0)

pub fn get_inclusion_states(&self) -> GetInclusionStatesBuilder[src]

Gets the inclusion states of a set of transactions. This endpoint determines if a transaction is confirmed by the network (referenced by a valid milestone). You can search for multiple tips (and thus, milestones) to get past inclusion states of transactions. This endpoint returns data only if the node is synchronized.

Parameters

  • transactions - List of transaction hashes for which you want to get the inclusion state
  • tips - (Optional) List of tip transaction hashes (including milestones) you want to search for

pub fn get_inputs(&self) -> GetInputsBuilder[src]

Creates and returns an Inputs object by generating addresses and fetching their latest balance.

Parameters

  • seed - An iota seed.
  • threshold - Minimum amount of balance required
  • index - (Optional) Key index to start search at. Default is 0.
  • security - (Optional) Security level. Default is 2.

pub async fn get_latest_inclusion<'_, '_>(
    &'_ self,
    transactions: &'_ [Hash]
) -> Result<Vec<bool>>
[src]

Fetches inclusion states of the given transactions by calling GetInclusionStates using the latest solid subtangle milestone from GetNodeInfo.

Parameters

  • [transactions] - List of transaction hashes for which you want to get the inclusion state

pub async fn get_latest_solid_subtangle_milestone<'_>(&'_ self) -> Result<Hash>[src]

Gets latest solid subtangle milestone.

pub async fn get_missing_transactions<'_>(&'_ self) -> Result<GetTipsResponse>[src]

Gets all transaction hashes that a node is currently requesting from its neighbors.

pub async fn get_neighbors<'_>(&'_ self) -> Result<GetNeighborsResponse>[src]

Gets a node's neighbors and their activity.

pub fn get_new_address(&self) -> GetNewAddressBuilder[src]

Generates and returns a new address by calling find_transactions until the first unused address is detected. This stops working after a snapshot.

Parameters

  • seed - An iota seed.
  • index - (Optional) Key index to start search at. Default is 0.
  • security - (Optional) Security level. Default is 2.

pub async fn get_node_api_configuration<'_>(
    &'_ self
) -> Result<GetNodeAPIConfigurationResponse>
[src]

Gets a node's API configuration settings.

pub async fn get_node_info<'_>(&'_ self) -> Result<GetNodeInfoResponse>[src]

Gets information about a node.

pub async fn get_tips<'_>(&'_ self) -> Result<GetTipsResponse>[src]

Gets tip transaction hashes from a node.

pub fn get_transactions_to_approve(&self) -> GetTransactionsToApproveBuilder[src]

Gets two consistent tip transaction hashes to use as branch/trunk transactions. This endpoint returns data only if the node is synchronized.

Parameters

  • depth - Number of milestones to go back to start the tip selection algorithm. Default is 3.
  • reference - (Optional) Transaction hash from which to start the weighted random walk. Use this parameter to make sure the returned tip transaction hashes approve a given reference transaction

pub fn get_trytes(&self) -> GetTrytesBuilder[src]

Gets a transaction's contents in trytes.

Parameters

  • hashes - Transaction hashes

pub async fn interrupt_attaching_to_tangle<'_>(&'_ self) -> Result<()>[src]

Aborts the process that's started by the attach_to_tangle method.

pub async fn is_address_used<'_, '_>(
    &'_ self,
    address: &'_ Address
) -> Result<bool>
[src]

Checks whether an address is used via FindTransactions and WereAddressesSpentFrom.

Parameters

  • address - IOTA address

pub async fn is_promotable<'_, '_>(&'_ self, tail: &'_ Hash) -> Result<bool>[src]

checks if a transaction is promotable by calling the checkConsistency IRI API command and verifying that attachmentTimestamp is above a lower bound. Lower bound is calculated based on the number of milestones issued since transaction attachment.

Parameters

  • tail - Tail Transaction Hash

pub fn prepare_transfers(&self) -> PrepareTransfersBuilder[src]

Prepares the transaction trytes by generating a bundle, filling in transfers and inputs, adding remainder and signing all input transactions.

Parameters

  • seed - An iota seed.
  • transfers - Transfer addresses to send data/value to.
  • inputs - (Optional, but recommended) Input addresses used for signing. Use get_inputs to get the valid inputs yourself.
  • remainder - (Optional) Custom remainder address.
  • security - (Optional) Security level. Default is 2.

pub fn remove_neighbors(&self) -> RemoveNeighborsBuilder[src]

Removes a list of neighbors to your node. This is only temporary, and if you have your neighbors added via the command line, they will be retained after you restart your node.

Parameters

  • uris - Slice of neighbor URIs(&str) to remove

pub async fn replay_bundle<'_, '_, '_>(
    &'_ self,
    hash: &'_ Hash
) -> Result<SendTrytesBuilder<'_>>
[src]

Reattaches a transfer to tangle by selecting tips & performing the Proof-of-Work again. Reattachments are useful in case original transactions are pending and can be done securely as many times as needed.

Parameters

  • hash - Tail transaction hash. Tail transaction is the transaction in the bundle with current_index == 0
  • depth - Number of milestones to go back to start the tip selection algorithm. Default is 3.
  • min_weight_magnitude - Difficulty of PoW

pub fn send_transfers(&self) -> SendTransfersBuilder[src]

Calls PrepareTransfers and then sends off the bundle via SendTrytes.

  • seed - An iota seed.
  • transfers - Transfer addresses to send data/value to.
  • inputs - (Optional, but recommended) Input addresses used for signing. Use get_inputs to get the valid inputs yourself.
  • remainder - (Optional) Custom remainder address.
  • security - (Optional) Security level. Default is 2.
  • depth - Number of milestones to go back to start the tip selection algorithm. Default is 3.
  • min_weight_magnitude - Difficulty of PoW
  • reference - (Optional) Transaction hash from which to start the weighted random walk.

pub fn send_trytes(&self) -> SendTrytesBuilder[src]

Perform Attaches to tanlge, stores and broadcasts a vector of transaction trytes.

Parameters

  • trytes - Vector of trytes to attach, store & broadcast
  • depth - Number of milestones to go back to start the tip selection algorithm. Default is 3.
  • min_weight_magnitude - Difficulty of PoW
  • reference - (Optional) Transaction hash from which to start the weighted random walk.

pub async fn store_and_broadcast<'_, '_>(
    &'_ self,
    trytes: &'_ [Transaction]
) -> Result<()>
[src]

Store and broadcast transactions to the node. The trytes to be used for this call are returned by attach_to_tangle. Response only contains errors and exceptions, it would be None if the call success.

Parameters

  • [trytes] - Transaction trytes

pub fn store_transactions(&self) -> StoreTransactionsBuilder[src]

Store transactions into the local storage. The trytes to be used for this call are returned by attach_to_tangle. Response only contains errors and exceptions, it would be None if the call success.

Parameters

pub async fn traverse_bundle<'_, '_>(
    &'_ self,
    hash: &'_ Hash
) -> Result<Vec<Transaction>>
[src]

Fetches the bundle of a given the tail transaction hash, by traversing through trunk transaction. It does not validate the bundle. Use get_bundle instead to get validated bundle.

Parameters

  • [hash] - Tail transaction hash (current_index == 0)

pub fn were_addresses_spent_from(&self) -> WereAddressesSpentFromBuilder[src]

Checks if an address was ever withdrawn from, either in the current epoch or in any previous epochs. If an address has a pending transaction, it's also considered 'spent'.

Parameters

  • address - addresses to check (do not include the checksum)

Trait Implementations

impl<'a> Debug for Client<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Client<'a>

impl<'a> Send for Client<'a>

impl<'a> Sync for Client<'a>

impl<'a> Unpin for Client<'a>

impl<'a> !UnwindSafe for Client<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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