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

Update sdk version #17

Merged
merged 1 commit into from
Oct 2, 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
6 changes: 3 additions & 3 deletions contract-advanced-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ crate-type = ["cdylib", "rlib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
near-sdk = "5.1.0"
near-sdk = "5.4.0"
schemars = "0.8.16"

[dev-dependencies]
near-sdk = { version = "5.0.0", features = ["unit-testing"] }
near-workspaces = { version = "0.10.0", features = ["unstable"] }
near-sdk = { version = "5.4.0", features = ["unit-testing"] }
near-workspaces = { version = "0.11.0", features = ["unstable"] }
tokio = { version = "1.12.0", features = ["full"] }
serde_json = "1"

Expand Down
2 changes: 1 addition & 1 deletion contract-advanced-rs/src/batch_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Contract {
) -> String {
// The callback only has access to the last action's result
if let Ok(result) = last_result {
log!(format!("The last result is {result}"));
log!("The last result is {result}");
result
} else {
log!("The batch call failed and all calls got reverted");
Expand Down
6 changes: 3 additions & 3 deletions contract-advanced-rs/src/multiple_contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,23 @@ impl Contract {
) -> (String, i8, Vec<PostedMessage>) {
// The callback has access to the result of the 3 calls
let greeting = if let Ok(result) = hello_result {
log!(format!("HelloNear says {result}"));
log!("HelloNear says {result}");
result
} else {
log!("The call to HelloNear failed");
"".to_string()
};

let counter = if let Ok(result) = counter_result {
log!(format!("Counter is {result}"));
log!("Counter is {result}");
result
} else {
log!("The call to Counter failed");
0
};

let messages = if let Ok(result) = guestbook_result {
log!(format!("The messages are {result:?}"));
log!("The messages are {result:?}");
result
} else {
log!("The call to GuestBook failed");
Expand Down
6 changes: 3 additions & 3 deletions contract-advanced-rs/src/similar_contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ impl Contract {

match result {
PromiseResult::Failed => {
log!(format!("Promise number {index} failed."));
log!("Promise number {index} failed.");
None
}
PromiseResult::Successful(value) => {
if let Ok(message) = near_sdk::serde_json::from_slice::<String>(&value) {
log!(format!("Call {index} returned: {message}"));
log!("Call {index} returned: {message}");
Some(message)
} else {
log!(format!("Error deserializing call {index} result."));
log!("Error deserializing call {index} result.");
None
}
}
Expand Down
6 changes: 3 additions & 3 deletions contract-advanced-rs/tests/tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::string::String;
use serde_json::json;
use near_workspaces::{types::NearToken, Account, Contract};
use near_sdk::serde::{Deserialize, Serialize};
use near_sdk::near;

#[tokio::test]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
Expand Down Expand Up @@ -54,8 +54,8 @@ async fn test_multiple_contracts(
guest_book_contract: &Contract,
counter_contract: &Contract
) -> Result<(), Box<dyn std::error::Error>> {
#[derive(Deserialize, Serialize, Debug, PartialEq)]
#[serde(crate = "near_sdk::serde")]
#[derive(Debug, PartialEq)]
#[near(serializers = [json])]
pub struct PostedMessage {
pub premium: bool,
pub sender: String,
Expand Down
6 changes: 3 additions & 3 deletions contract-simple-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ crate-type = ["cdylib", "rlib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
near-sdk = "5.1.0"
near-sdk = "5.4.0"

[dev-dependencies]
near-sdk = { version = "5.0.0", features = ["unit-testing"] }
near-workspaces = { version = "0.10.0", features = ["unstable"] }
near-sdk = { version = "5.4.0", features = ["unit-testing"] }
near-workspaces = { version = "0.11.0", features = ["unstable"] }
tokio = { version = "1.12.0", features = ["full"] }
serde_json = "1"

Expand Down
Loading