diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 71157152..92f3bb1c 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -8,9 +8,9 @@ edition = "2018" anyhow = "1.0" maplit = "1.0" near-units = "0.2.0" -near-gas = { version = "0.2.5", features = ["serde", "borsh", "schemars"] } -near-jsonrpc-primitives = "0.23.0" -near-primitives = "0.23.0" +near-gas = { version = "0.3", features = ["serde", "borsh", "schemars"] } +near-jsonrpc-primitives = "0.24" +near-primitives = "0.24" serde = "1.0" serde_with = "3.4" serde_json = { version = "1.0" } diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 00000000..1deb8306 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,7 @@ +[toolchain] +# This specifies the version of Rust we use to build. +# Individual crates in the workspace may support a lower version, as indicated by `rust-version` field in each crate's `Cargo.toml`. +# The version specified below, should be at least as high as the maximum `rust-version` within the workspace. +channel = "stable" +components = ["rustfmt", "clippy", "rust-analyzer"] +targets = ["wasm32-unknown-unknown"] diff --git a/workspaces/Cargo.toml b/workspaces/Cargo.toml index 219ad32b..b54ab107 100644 --- a/workspaces/Cargo.toml +++ b/workspaces/Cargo.toml @@ -14,7 +14,7 @@ async-trait = "0.1" base64 = "0.22" bs58 = "0.5" cargo_metadata = { version = "0.18", optional = true } -cargo-near = { version = "0.6.3", default-features = false } +cargo-near = { version = "0.8", default-features = false } chrono = "0.4.19" fs2 = "0.4" rand = "0.8.4" @@ -31,19 +31,19 @@ tracing = "0.1" url = { version = "2.2.2", features = ["serde"] } near-abi-client = "0.1.1" -near-gas = { version = "0.2.5", features = ["serde", "borsh", "schemars"] } -near-token = { version = "0.2.0", features = ["serde"] } -near-sdk = { version = "5.2.0", optional = true } +near-gas = { version = "0.3", features = ["serde", "borsh", "schemars"] } +near-token = { version = "0.3", features = ["serde"] } +near-sdk = { version = "5.3", optional = true } near-account-id = "1.0.0" -near-crypto = "0.23.0" -near-primitives = "0.23.0" -near-jsonrpc-primitives = "0.23.0" -near-jsonrpc-client = { version = "0.10.1", features = ["sandbox"] } -near-sandbox-utils = "0.9.0" -near-chain-configs = { version = "0.23.0", optional = true } +near-crypto = "0.24" +near-primitives = "0.24" +near-jsonrpc-primitives = "0.24" +near-jsonrpc-client = { version = "0.11", features = ["sandbox"] } +near-sandbox-utils = "0.10" +near-chain-configs = { version = "0.24", optional = true } [build-dependencies] -near-sandbox-utils = "0.8.0" +near-sandbox-utils = "0.10" [target.'cfg(unix)'.dependencies] libc = "0.2" @@ -51,7 +51,7 @@ libc = "0.2" [dev-dependencies] anyhow = "1.0" futures = "0.3" -near-sdk = "5.2.0" +near-sdk = "5.3" test-log = { version = "0.2.8", default-features = false, features = ["trace"] } tracing-subscriber = { version = "0.3.5", features = ["env-filter"] } diff --git a/workspaces/src/cargo/mod.rs b/workspaces/src/cargo/mod.rs index 58558263..325e1ebd 100644 --- a/workspaces/src/cargo/mod.rs +++ b/workspaces/src/cargo/mod.rs @@ -1,7 +1,5 @@ use crate::error::ErrorKind; -use cargo_near::commands::build_command::{build, BuildCommand}; - /// Builds the cargo project located at `project_path` and returns the generated wasm file contents. /// /// NOTE: This function does not check whether the resulting wasm file is a valid smart @@ -16,9 +14,10 @@ pub async fn compile_project(project_path: &str) -> crate::Result> { _ => ErrorKind::Io.custom(e), })?; - let cargo_near_build_command = BuildCommand { + let cargo_opts = cargo_near::BuildOpts { no_release: false, no_embed_abi: false, + no_locked: true, no_doc: true, color: None, no_abi: true, @@ -38,8 +37,7 @@ pub async fn compile_project(project_path: &str) -> crate::Result> { no_default_features: false, }; - let compile_artifact = - build::run(cargo_near_build_command).map_err(|e| ErrorKind::Io.custom(e))?; + let compile_artifact = cargo_near::build(cargo_opts).map_err(|e| ErrorKind::Io.custom(e))?; let file = compile_artifact .path diff --git a/workspaces/src/rpc/client.rs b/workspaces/src/rpc/client.rs index f61356fc..f4a655e0 100644 --- a/workspaces/src/rpc/client.rs +++ b/workspaces/src/rpc/client.rs @@ -47,6 +47,7 @@ use crate::{Network, Worker}; pub(crate) const DEFAULT_CALL_FN_GAS: NearGas = NearGas::from_tgas(10); pub(crate) const DEFAULT_CALL_DEPOSIT: NearToken = NearToken::from_near(0); +pub(crate) const DEFAULT_PRIORITY_FEE: u64 = 0; /// A client that wraps around [`JsonRpcClient`], and provides more capabilities such /// as retry w/ exponential backoff and utility functions for sending transactions. @@ -96,7 +97,7 @@ impl Client { tracing::info!( target: "workspaces", "Submitting transaction with actions {:?} succeeded with status {:?}", - method.signed_transaction.transaction.actions, + method.signed_transaction.transaction.actions(), response.status ); } @@ -560,8 +561,11 @@ pub(crate) async fn send_batch_tx_and_retry( receiver_id: &AccountId, actions: Vec, ) -> Result { - let signer = signer.inner(); - let cache_key = (signer.account_id.clone(), signer.secret_key.public_key()); + let inner = signer.inner(); + let cache_key = ( + signer.account_id.clone(), + signer.secret_key.public_key().into(), + ); retry(|| async { let (block_hash, nonce) = fetch_tx_nonce(client, &cache_key).await?; send_tx( @@ -571,9 +575,10 @@ pub(crate) async fn send_batch_tx_and_retry( nonce, signer.account_id.clone(), receiver_id.clone(), - &signer as &dyn near_crypto::Signer, + &inner, actions.clone(), block_hash, + DEFAULT_PRIORITY_FEE, ), ) .await @@ -587,8 +592,11 @@ 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.secret_key.public_key()); + let inner = signer.inner(); + let cache_key = ( + signer.account_id.clone(), + signer.secret_key.public_key().into(), + ); retry(|| async { let (block_hash, nonce) = fetch_tx_nonce(worker.client(), &cache_key).await?; let hash = worker @@ -598,9 +606,10 @@ pub(crate) async fn send_batch_tx_async_and_retry( nonce, signer.account_id.clone(), receiver_id.clone(), - signer as &dyn near_crypto::Signer, + &inner, actions.clone(), block_hash, + DEFAULT_PRIORITY_FEE, ), }) .await diff --git a/workspaces/src/types/mod.rs b/workspaces/src/types/mod.rs index 192ff5bc..66e02442 100644 --- a/workspaces/src/types/mod.rs +++ b/workspaces/src/types/mod.rs @@ -17,6 +17,7 @@ use std::path::Path; use std::str::FromStr; pub use near_account_id::AccountId; +use near_crypto::Signer; use near_primitives::borsh::{BorshDeserialize, BorshSerialize}; use serde::{Deserialize, Serialize}; @@ -292,11 +293,11 @@ impl InMemorySigner { )) } - pub(crate) fn inner(&self) -> near_crypto::InMemorySigner { - near_crypto::InMemorySigner::from_secret_key( + pub(crate) fn inner(&self) -> Signer { + Signer::InMemory(near_crypto::InMemorySigner::from_secret_key( self.account_id.clone(), self.secret_key.0.clone(), - ) + )) } } diff --git a/workspaces/tests/test-contracts/status-message/Cargo.toml b/workspaces/tests/test-contracts/status-message/Cargo.toml index 28c24cec..a723eb69 100644 --- a/workspaces/tests/test-contracts/status-message/Cargo.toml +++ b/workspaces/tests/test-contracts/status-message/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -near-sdk = "5.0.0-alpha.2" +near-sdk = "5.3.0" [profile.release] codegen-units = 1 diff --git a/workspaces/tests/test-contracts/type-serialize/Cargo.toml b/workspaces/tests/test-contracts/type-serialize/Cargo.toml index 5389347f..17b287e5 100644 --- a/workspaces/tests/test-contracts/type-serialize/Cargo.toml +++ b/workspaces/tests/test-contracts/type-serialize/Cargo.toml @@ -9,7 +9,7 @@ crate-type = ["cdylib"] [dependencies] bs58 = "0.5" -near-sdk = "5.0.0-alpha.2" +near-sdk = "5.3.0" [profile.release] codegen-units = 1