diff --git a/workspaces/Cargo.toml b/workspaces/Cargo.toml index 3dcaab95..96b21e66 100644 --- a/workspaces/Cargo.toml +++ b/workspaces/Cargo.toml @@ -12,14 +12,13 @@ Library for automating workflows and testing NEAR smart contracts. [dependencies] async-trait = "0.1" async-process = "1.3" -base64 = "0.13" +base64 = "0.21" borsh = "0.10" -bs58 = "0.4" -cargo_metadata = { version = "0.15.4", optional = true } +bs58 = "0.5" +cargo_metadata = { version = "0.17", optional = true } cargo-near = "0.3.1" chrono = "0.4.19" fs2 = "0.4" -hex = "0.4.2" rand = "0.8.4" reqwest = { version = "0.11", features = ["json"] } serde = "1.0" diff --git a/workspaces/src/result.rs b/workspaces/src/result.rs index 88890831..96e930e1 100644 --- a/workspaces/src/result.rs +++ b/workspaces/src/result.rs @@ -12,6 +12,8 @@ use near_primitives::views::{ use crate::error::ErrorKind; use crate::types::{Balance, CryptoHash, Gas}; +use base64::{engine::general_purpose, Engine as _}; + pub type Result = core::result::Result; /// Execution related info as a result of performing a successful transaction @@ -200,7 +202,7 @@ impl ExecutionFinalResult { match self.status { FinalExecutionStatus::SuccessValue(value) => Ok(ExecutionResult { total_gas_burnt: self.total_gas_burnt, - value: Value::from_string(base64::encode(value)), + value: Value::from_string(general_purpose::STANDARD.encode(value)), details: self.details, }), FinalExecutionStatus::Failure(tx_error) => Err(ExecutionResult { @@ -435,7 +437,7 @@ impl ExecutionOutcome { pub fn into_result(self) -> Result { match self.status { ExecutionStatusView::SuccessValue(value) => Ok(ValueOrReceiptId::Value( - Value::from_string(base64::encode(value)), + Value::from_string(general_purpose::STANDARD.encode(value)), )), ExecutionStatusView::SuccessReceiptId(hash) => { Ok(ValueOrReceiptId::ReceiptId(CryptoHash(hash.0))) @@ -496,7 +498,9 @@ impl Value { /// [`json`]: Value::json /// [`borsh`]: Value::borsh pub fn raw_bytes(&self) -> Result> { - base64::decode(&self.repr).map_err(|e| ErrorKind::DataConversion.custom(e)) + general_purpose::STANDARD + .decode(&self.repr) + .map_err(|e| ErrorKind::DataConversion.custom(e)) } } diff --git a/workspaces/tests/test-contracts/type-serialize/Cargo.toml b/workspaces/tests/test-contracts/type-serialize/Cargo.toml index dbe8e76f..aaf37e99 100644 --- a/workspaces/tests/test-contracts/type-serialize/Cargo.toml +++ b/workspaces/tests/test-contracts/type-serialize/Cargo.toml @@ -8,8 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -anyhow = "1.0" -bs58 = "0.4" +bs58 = "0.5" near-sdk = "4.1" [profile.release]