diff --git a/workspaces/src/rpc/client.rs b/workspaces/src/rpc/client.rs index 16ba48bf..50d978de 100644 --- a/workspaces/src/rpc/client.rs +++ b/workspaces/src/rpc/client.rs @@ -9,7 +9,6 @@ use tokio::sync::RwLock; use tokio_retry::strategy::{jitter, ExponentialBackoff}; use tokio_retry::Retry; -use near_crypto::Signer; use near_jsonrpc_client::errors::{JsonRpcError, JsonRpcServerError}; use near_jsonrpc_client::methods::health::RpcStatusError; use near_jsonrpc_client::methods::tx::RpcTransactionError; @@ -562,8 +561,7 @@ pub(crate) async fn send_batch_tx_and_retry( actions: Vec, ) -> Result { let signer = signer.inner(); - let cache_key = (signer.account_id.clone(), signer.public_key()); - + let cache_key = (signer.account_id.clone(), signer.secret_key.public_key()); retry(|| async { let (block_hash, nonce) = fetch_tx_nonce(client, &cache_key).await?; send_tx( @@ -573,7 +571,7 @@ pub(crate) async fn send_batch_tx_and_retry( nonce, signer.account_id.clone(), receiver_id.clone(), - &signer as &dyn Signer, + &signer as &dyn near_crypto::Signer, actions.clone(), block_hash, ), @@ -589,9 +587,8 @@ pub(crate) async fn send_batch_tx_async_and_retry( receiver_id: &AccountId, actions: Vec, ) -> Result { - let signer = signer.inner(); - let cache_key = (signer.account_id.clone(), signer.public_key()); - + let signer = &signer.inner(); + let cache_key = (signer.account_id.clone(), signer.secret_key.public_key()); retry(|| async { let (block_hash, nonce) = fetch_tx_nonce(worker.client(), &cache_key).await?; let hash = worker @@ -601,7 +598,7 @@ pub(crate) async fn send_batch_tx_async_and_retry( nonce, signer.account_id.clone(), receiver_id.clone(), - &signer as &dyn Signer, + signer as &dyn near_crypto::Signer, actions.clone(), block_hash, ), diff --git a/workspaces/src/types/gas_meter.rs b/workspaces/src/types/gas_meter.rs index 061c09f4..96a2b229 100644 --- a/workspaces/src/types/gas_meter.rs +++ b/workspaces/src/types/gas_meter.rs @@ -12,7 +12,7 @@ use crate::Worker; /// The auto-traits [`Send`], [`Sync`], [`UnwindSafe`] and [`RefUnwindSafe`] are added explicitly because they /// do not fall under the rules the compiler uses to automatically add them. /// See here: -pub type GasHook = Arc Result<()> + Send + Sync + UnwindSafe + RefUnwindSafe>; +pub(crate) type GasHook = Arc Result<()> + Send + Sync + UnwindSafe + RefUnwindSafe>; /// Allows you to meter the amount of gas consumed by transaction(s). /// Note: This only works with transactions that resolve to [`crate::result::ExecutionFinalResult`] diff --git a/workspaces/src/types/mod.rs b/workspaces/src/types/mod.rs index c93d1621..0fc2f44c 100644 --- a/workspaces/src/types/mod.rs +++ b/workspaces/src/types/mod.rs @@ -27,8 +27,7 @@ use crate::result::Result; pub use self::account::{AccountDetails, AccountDetailsPatch}; pub use self::chunk::{Chunk, ChunkHeader}; - -pub use self::gas_meter::{GasHook, GasMeter}; +pub use self::gas_meter::GasMeter; /// Nonce is a unit used to determine the order of transactions in the pool. pub type Nonce = u64; diff --git a/workspaces/src/worker/impls.rs b/workspaces/src/worker/impls.rs index 1d660dae..84485ca3 100644 --- a/workspaces/src/worker/impls.rs +++ b/workspaces/src/worker/impls.rs @@ -199,6 +199,7 @@ impl Worker where T: NetworkClient + Send + Sync + ?Sized, { + /// Provides a list of changes in block associated with the given block reference. pub async fn changes_in_block( &self, block_reference: BlockReference, @@ -206,6 +207,7 @@ where self.client().changes_in_block(block_reference).await } + /// Provides a list of changes in block associated with the given block reference and state changes request. pub async fn changes( &self, block_reference: BlockReference, @@ -216,10 +218,12 @@ where .await } + /// Provides a genesis config associated with the network being used. pub async fn genesis_config(&self) -> Result { self.client().genesis_config().await } + /// Provides a protocol config associated with the given block reference. pub async fn protocol_config( &self, block_reference: BlockReference, @@ -227,10 +231,12 @@ where self.client().protocol_config(block_reference).await } + /// Provides a receipt associated with the given receipt reference. pub async fn receipt(&self, receipt_reference: ReceiptReference) -> Result { self.client().receipt(receipt_reference).await } + /// Returns the transaction status for a given transaction hash or signed transaction. pub async fn tx_status( &self, transaction_info: TransactionInfo, @@ -238,6 +244,7 @@ where self.client().tx_status(transaction_info).await } + /// Provides a list of validators ordered with respect to their stake. pub async fn validators_ordered( &self, block_id: MaybeBlockId, diff --git a/workspaces/src/worker/mod.rs b/workspaces/src/worker/mod.rs index 036570f4..02c3f4ee 100644 --- a/workspaces/src/worker/mod.rs +++ b/workspaces/src/worker/mod.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use crate::network::builder::NetworkBuilder; use crate::network::{Betanet, Custom, Mainnet, Sandbox, Testnet}; -use crate::types::GasHook; +use crate::types::gas_meter::GasHook; use crate::{Network, Result}; /// The `Worker` type allows us to interact with any NEAR related networks, such