Skip to content

Commit

Permalink
chore(iota-sdk): documentation nits (#4169)
Browse files Browse the repository at this point in the history
* chore(iota-sdk): documentation nits

* more nits

* last nits

* Update crates/iota-sdk/src/apis/coin_read.rs

Co-authored-by: Thoralf-M <[email protected]>

---------

Co-authored-by: Thoralf-M <[email protected]>
  • Loading branch information
thibault-martinez and Thoralf-M authored Nov 21, 2024
1 parent 041a462 commit d8f126e
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 73 deletions.
17 changes: 9 additions & 8 deletions crates/iota-sdk/src/apis/coin_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use crate::{
error::{Error, IotaRpcResult},
};

/// Defines methods that retrieve information from the
/// Iota network regarding the coins owned by an address.
/// Defines methods that retrieve information from the IOTA network regarding
/// the coins owned by an address.
#[derive(Debug, Clone)]
pub struct CoinReadApi {
api: Arc<RpcClient>,
Expand All @@ -30,8 +30,8 @@ impl CoinReadApi {
Self { api }
}

/// Get coins for the given address filtered by coin type. Results are
/// paginated.
/// Get coins for the given address filtered by coin type.
/// Results are paginated.
///
/// The coin type defaults to `0x2::iota::IOTA`.
///
Expand Down Expand Up @@ -68,6 +68,7 @@ impl CoinReadApi {
.get_coins(owner, coin_type.into(), cursor.into(), limit.into())
.await?)
}

/// Get all the coins for the given address regardless of coin type.
/// Results are paginated.
///
Expand Down Expand Up @@ -103,8 +104,8 @@ impl CoinReadApi {
.await?)
}

/// Get the coins for the given address filtered by coin type. Returns a
/// stream.
/// Get the coins for the given address filtered by coin type.
/// Returns a stream.
///
/// The coin type defaults to `0x2::iota::IOTA`.
///
Expand Down Expand Up @@ -268,8 +269,8 @@ impl CoinReadApi {
Ok(self.api.http.get_all_balances(owner).await?)
}

/// Get the coin metadata (name, symbol, description, decimals, etc.) for
/// a given coin type.
/// Get the coin metadata (name, symbol, description, decimals, etc.) for a
/// given coin type.
///
/// # Examples
///
Expand Down
7 changes: 3 additions & 4 deletions crates/iota-sdk/src/apis/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ use crate::{
error::{Error, IotaRpcResult},
};

/// Defines methods to fetch, query, or subscribe to events
/// on the Iota network.
/// Defines methods to fetch, query, or subscribe to events on the Iota network.
#[derive(Clone)]
pub struct EventApi {
api: Arc<RpcClient>,
Expand Down Expand Up @@ -78,8 +77,8 @@ impl EventApi {
Ok(self.api.http.get_events(digest).await?)
}

/// Get a list of filtered events. The response is paginated and can be
/// ordered ascending or descending.
/// Get a list of filtered events.
/// The response is paginated and can be ordered ascending or descending.
///
/// For a list of possible event filters, see [EventFilter].
pub async fn query_events(
Expand Down
6 changes: 3 additions & 3 deletions crates/iota-sdk/src/apis/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ impl GovernanceApi {

/// Get the latest IOTA system state object on-chain.
///
/// Use this method to access system information, such as the current
/// epoch, the protocol version, the reference gas price, the total
/// stake, active validators, and much more.
/// Use this method to access system information, such as the current epoch,
/// the protocol version, the reference gas price, the total stake, active
/// validators, and much more.
pub async fn get_latest_iota_system_state(&self) -> IotaRpcResult<IotaSystemStateSummary> {
Ok(self.api.http.get_latest_iota_system_state().await?)
}
Expand Down
4 changes: 2 additions & 2 deletions crates/iota-sdk/src/apis/quorum_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ impl QuorumDriverApi {
/// [`ExecuteTransactionRequestType::WaitForLocalExecution`].
///
/// When `WaitForLocalExecution` is used, but the returned
/// `confirmed_local_execution` is false, the client will wait for
/// some time before returning [Error::FailToConfirmTransactionStatus].
/// `confirmed_local_execution` is false, the client will wait for some time
/// before returning [Error::FailToConfirmTransactionStatus].
pub async fn execute_transaction_block(
&self,
tx: Transaction,
Expand Down
39 changes: 20 additions & 19 deletions crates/iota-sdk/src/apis/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ impl ReadApi {
Self { api }
}

/// Get the objects owned by the given address. Results are paginated.
/// Get the objects owned by the given address.
/// Results are paginated.
///
/// Note that if the address owns more than
/// [`QUERY_MAX_RESULT_LIMIT`](iota_json_rpc_api::QUERY_MAX_RESULT_LIMIT)
Expand Down Expand Up @@ -83,8 +84,8 @@ impl ReadApi {
.await?)
}

/// Get the dynamic fields owned by the given [ObjectID]. Results are
/// paginated.
/// Get the dynamic fields owned by the given [ObjectID].
/// Results are paginated.
///
/// If the field is a dynamic field, this method returns the ID of the Field
/// object, which contains both the name and the value.
Expand Down Expand Up @@ -155,9 +156,9 @@ impl ReadApi {
/// Get a parsed past object and version for the provided object ID.
///
/// An object's version increases when the object is mutated, though it is
/// not guaranteed that it increases always by 1. A past object can be
/// used to understand how the object changed over time, i.e. what was
/// the total balance at a specific version.
/// not guaranteed that it increases always by 1. A past object can be used
/// to understand how the object changed over time, i.e. what was the total
/// balance at a specific version.
///
/// # Examples
///
Expand Down Expand Up @@ -217,8 +218,8 @@ impl ReadApi {

/// Get a list of parsed past objects.
///
/// See [Self::try_get_parsed_past_object] for more
/// details about past objects.
/// See [Self::try_get_parsed_past_object] for more details about past
/// objects.
///
/// # Examples
///
Expand Down Expand Up @@ -468,7 +469,8 @@ impl ReadApi {
.await?)
}

/// Get filtered transaction blocks information. Results are paginated.
/// Get filtered transaction blocks information.
/// Results are paginated.
pub async fn query_transaction_blocks(
&self,
query: IotaTransactionBlockResponseQuery,
Expand All @@ -483,8 +485,8 @@ impl ReadApi {
.await?)
}

/// Get the first four bytes of the chain's genesis checkpoint digest in
/// hex format.
/// Get the first four bytes of the chain's genesis checkpoint digest in hex
/// format.
pub async fn get_chain_identifier(&self) -> IotaRpcResult<String> {
Ok(self.api.http.get_chain_identifier().await?)
}
Expand All @@ -494,7 +496,8 @@ impl ReadApi {
Ok(self.api.http.get_checkpoint(id).await?)
}

/// Return a list of checkpoints. Results are paginated.
/// Return a list of checkpoints.
/// Results are paginated.
pub async fn get_checkpoints(
&self,
cursor: impl Into<Option<BigInt<u64>>>,
Expand All @@ -508,8 +511,7 @@ impl ReadApi {
.await?)
}

/// Get the sequence number of the latest checkpoint that has been
/// executed.
/// Get the sequence number of the latest checkpoint that has been executed.
pub async fn get_latest_checkpoint_sequence_number(
&self,
) -> IotaRpcResult<CheckpointSequenceNumber> {
Expand Down Expand Up @@ -585,18 +587,17 @@ impl ReadApi {
}

// TODO(devx): we can probably cache this given an epoch
/// Get the reference gas pric.
/// Get the reference gas price.
pub async fn get_reference_gas_price(&self) -> IotaRpcResult<u64> {
Ok(*self.api.http.get_reference_gas_price().await?)
}

/// Dry run a transaction block given the provided transaction data.
///
/// This simulates running the transaction, including all standard checks,
/// without actually running it. This is useful for estimating the gas
/// fees of a transaction before executing it. You can also use it to
/// identify any side-effects of a transaction before you execute it on
/// the network.
/// without actually running it. This is useful for estimating the gas fees
/// of a transaction before executing it. You can also use it to identify
/// any side-effects of a transaction before you execute it on the network.
pub async fn dry_run_transaction_block(
&self,
tx: TransactionData,
Expand Down
Loading

0 comments on commit d8f126e

Please sign in to comment.