Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix clippy 1.82 (doc preambles) #381

Merged
merged 3 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/src/croncat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub enum AgentStatus {

/// `Agent` struct taken from [croncat repo](github.com/CronCats/contracts/) to deserialize
/// into after we get the result of a transaction and converting over to this particular type.
///
/// Helpful for understanding what our output is from a contract call. For a more in depth
/// look at what an `Agent` is all about, refer to the [croncat docs](https://docs.cron.cat/docs/)
/// to understand further, but for this example all we care about is that an Agent is something
Expand Down
5 changes: 3 additions & 2 deletions workspaces/src/network/betanet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ use std::path::PathBuf;
/// URL to the betanet RPC node provided by near.org.
pub const RPC_URL: &str = "https://rpc.betanet.near.org";

/// Betanet related configuration for interacting with betanet. Look at
/// [`workspaces::betanet`] for how to spin up a [`Worker`] that can be
/// Betanet related configuration for interacting with betanet.
///
/// Look at [`workspaces::betanet`] for how to spin up a [`Worker`] that can be
/// used to interact with betanet. Note that betanet account creation
/// is not currently supported, and these calls into creating a betanet
/// worker is meant for retrieving data and/or making queries only.
Expand Down
5 changes: 3 additions & 2 deletions workspaces/src/network/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ pub const RPC_URL: &str = "https://rpc.mainnet.near.org";
/// URL to the mainnet archival RPC node provided by near.org.
pub const ARCHIVAL_URL: &str = "https://archival-rpc.mainnet.near.org";

/// Mainnet related configuration for interacting with mainnet. Look at
/// [`workspaces::mainnet`] and [`workspaces::mainnet_archival`] for how to
/// Mainnet related configuration for interacting with mainnet.
///
/// Look at [`workspaces::mainnet`] and [`workspaces::mainnet_archival`] for how to
/// spin up a [`Worker`] that can be used to interact with mainnet. Note that
/// mainnet account creation is not currently supported, and these calls into
/// creating a mainnet worker is meant for retrieving data and/or making
Expand Down
4 changes: 3 additions & 1 deletion workspaces/src/network/sandbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ use crate::{Account, Contract, Network, Worker};

// Constant taken from nearcore crate to avoid dependency
const DEFAULT_DEPOSIT: NearToken = NearToken::from_near(100);
/// Local sandboxed environment/network, which can be used to test without interacting with
/// Local sandboxed environment/network
///
/// Can be used to test without interacting with
/// networks that are online such as mainnet and testnet. Look at [`workspaces::sandbox`]
/// for how to spin up a sandboxed network and interact with it.
///
Expand Down
5 changes: 3 additions & 2 deletions workspaces/src/network/testnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ pub const HELPER_URL: &str = "https://helper.testnet.near.org";
/// URL to the testnet archival RPC node provided by near.org.
pub const ARCHIVAL_URL: &str = "https://archival-rpc.testnet.near.org";

/// Testnet related configuration for interacting with testnet. Look at
/// [`workspaces::testnet`] and [`workspaces::testnet_archival`] for how
/// Testnet related configuration for interacting with testnet.
///
/// Look at [`workspaces::testnet`] and [`workspaces::testnet_archival`] for how
/// to spin up a [`Worker`] that can be used to run tests in testnet.
///
/// [`workspaces::testnet`]: crate::testnet
Expand Down
4 changes: 3 additions & 1 deletion workspaces/src/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ impl Function {
}

/// A builder-like object that will allow specifying various actions to be performed
/// in a single transaction. For details on each of the actions, find them in
/// in a single transaction.
///
/// For details on each of the actions, find them in
/// [NEAR transactions](https://docs.near.org/docs/concepts/transaction).
///
/// All actions are performed on the account specified by `receiver_id`. This object
Expand Down
5 changes: 4 additions & 1 deletion workspaces/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ use crate::types::{CryptoHash, Gas, NearToken};
pub type Result<T, E = crate::error::Error> = core::result::Result<T, E>;

/// Execution related info as a result of performing a successful transaction
/// execution on the network. This value can be converted into the returned
/// execution on the network.
///
/// This value can be converted into the returned
/// value of the transaction via [`ExecutionSuccess::json`] or [`ExecutionSuccess::borsh`]
pub type ExecutionSuccess = ExecutionResult<Value>;

Expand All @@ -29,6 +31,7 @@ pub type ExecutionSuccess = ExecutionResult<Value>;
pub type ExecutionFailure = ExecutionResult<TxExecutionError>;

/// Struct to hold a type we want to return along w/ the execution result view.
///
/// This view has extra info about the execution, such as gas usage and whether
/// the transaction failed to be processed on the chain.
#[non_exhaustive]
Expand Down
7 changes: 4 additions & 3 deletions workspaces/src/rpc/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ use crate::types::{BlockHeight, KeyType, PublicKey, SecretKey};
use crate::{AccessKey, AccountDetailsPatch, Result};
use crate::{AccountId, Contract, CryptoHash, InMemorySigner, Network, Worker};

/// A [`Transaction`]-like object that allows us to specify details about importing
/// a contract from a different network into our sandbox local network. This creates
/// a new [`Transaction`] to be committed to the sandbox network once `transact()`
/// A [`Transaction`]-like object with details about importing a contract from a network
/// into sandbox local network.
///
/// This creates a new [`Transaction`] to be committed to the sandbox network once `transact()`
/// has been called. This does not commit any new transactions from the network
/// this object is importing from.
///
Expand Down
24 changes: 13 additions & 11 deletions workspaces/src/rpc/query.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//! This module defines a bunch of internal types used solely for querying into RPC
//! methods to retrieve info about what's on the chain. Note that the types defined
//! are exposed as-is for users to reference in their own functions or structs as
//! needed. These types cannot be created outside of workspaces. To use them, refer
//! to surface level types like [`Account`], [`Contract`] and [`Worker`].
//! This module defines a bunch of internal types used solely for querying into
//! RPC methods to get info about what's on the chain.
//!
//! Note that the types defined are exposed as-is for users to reference in their own
//! functions or structs as needed. These types cannot be created outside of workspaces.
//! To use them, refer to surface level types like [`Account`], [`Contract`] and [`Worker`].
//!
//! For example, to query into downloading contract state:
//! ```
Expand Down Expand Up @@ -133,9 +134,10 @@ where
}

// Note: this trait is exposed publicly due to constraining with the impl offering `finality`.
/// Trait used as a converter from WorkspaceRequest to near-rpc request, and from near-rpc
/// response to a WorkspaceResult. Mostly used internally to facilitate syntax sugar for performing
/// RPC requests with async builders.
/// Trait used as a converter from WorkspaceRequest to near-rpc request,
/// and from near-rpc response to a WorkspaceResult.
///
/// Mostly used internally to facilitate syntax sugar for performing RPC requests with async builders.
pub trait ProcessQuery {
// TODO: associated default type is unstable. So for now, will require writing
// the manual impls for query_request
Expand Down Expand Up @@ -401,10 +403,10 @@ impl ProcessQuery for GasPrice {
}
}

/// Query object used to query for chunk related details at a specific `ChunkReference` which
/// consists of either a chunk [`CryptoHash`], or a `BlockShardId` (which consists of [`ShardId`]
/// and either block [`CryptoHash`] or [`BlockHeight`]).
/// Query object to query for chunk related details at a specific `ChunkReference` which
/// consists of either a chunk [`CryptoHash`], or a `BlockShardId`.
///
/// `BlockShardId` consists of [`ShardId`] and either block [`CryptoHash`] or [`BlockHeight`]
/// The default behavior where a `ChunkReference` is not supplied will use a `BlockShardId`
/// referencing the latest block `CryptoHash` with `ShardId` of 0.
pub struct QueryChunk<'a> {
Expand Down
8 changes: 6 additions & 2 deletions workspaces/src/types/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ use crate::operations::{CallTransaction, CreateAccountTransaction, Transaction};
use crate::result::{Execution, ExecutionFinalResult, Result};

/// `Account` is directly associated to an account in the network provided by the
/// [`Worker`] that creates it. This type offers methods to interact with any
/// [`Worker`] that creates it.
///
/// This type offers methods to interact with any
/// network, such as creating transactions and calling into contract functions.
#[derive(Clone)]
pub struct Account {
Expand Down Expand Up @@ -201,7 +203,9 @@ impl Account {
}

/// `Contract` is directly associated to a contract in the network provided by the
/// [`Worker`] that creates it. This type offers methods to interact with any
/// [`Worker`] that creates it.
///
/// This type offers methods to interact with any
/// network, such as creating transactions and calling into contract functions.
#[derive(Clone)]
pub struct Contract {
Expand Down
13 changes: 10 additions & 3 deletions workspaces/src/types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//! Types used in the workspaces crate. A lot of these are types are copied over from near_primitives
//! Types used in the workspaces crate.
//!
//! A lot of these are types are copied over from near_primitives
//! since those APIs are not yet stable. Once they are, we can directly reference them here, so no
//! changes on the library consumer side is needed. Just keep using these types defined here as-is.

Expand Down Expand Up @@ -222,7 +224,9 @@ impl BorshDeserialize for PublicKey {
}
}

/// Secret key of an account on chain. Usually created along with a [`PublicKey`]
/// Secret key of an account on chain.
///
/// Usually created along with a [`PublicKey`]
/// to form a keypair associated to the account. To generate a new keypair, use
/// one of the creation methods found here, such as [`SecretKey::from_seed`]
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
Expand Down Expand Up @@ -367,7 +371,9 @@ impl From<near_primitives::hash::CryptoHash> for CryptoHash {
}
}

/// Access key provides limited access to an account. Each access key belongs to some account and
/// Access key provides limited access to an account.
///
/// Each access key belongs to some account and
/// is identified by a unique (within the account) public key. One account may have large number of
/// access keys. Access keys allow to act on behalf of the account by restricting transactions
/// that can be issued.
Expand Down Expand Up @@ -434,6 +440,7 @@ pub enum AccessKeyPermission {
}

/// Grants limited permission to make transactions with FunctionCallActions
///
/// The permission can limit the allowed balance to be spent on the prepaid gas.
/// It also restrict the account ID of the receiver for this function call.
/// It also can restrict the method name for the allowed function calls.
Expand Down
6 changes: 4 additions & 2 deletions workspaces/src/worker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ use crate::network::{Betanet, Custom, Mainnet, Sandbox, Testnet};
use crate::types::gas_meter::GasHook;
use crate::{Network, Result};

/// The `Worker` type allows us to interact with any NEAR related networks, such
/// as mainnet and testnet. This controls where the environment the worker is
/// The `Worker` type allows us to interact with any NEAR related networks,
/// such as mainnet and testnet.
///
/// This controls where the environment the worker is
/// running on top of it. Refer to this for all network related actions such as
/// deploying a contract, or interacting with transactions.
pub struct Worker<T: ?Sized> {
Expand Down
Loading