Skip to content

Commit

Permalink
Code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
saeed-zil committed Jun 24, 2024
1 parent 034a9eb commit cd4b7d2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ multiaddr = "0.18.1"
near-jsonrpc-client = "0.8.0"
near-jsonrpc-primitives = "0.20.0"
near-primitives = "0.20.0"
near-account-id = "1.0.0"
near-sdk = "5.0.0"
near-workspaces = "0.10.0"
ouroboros = "0.18.3"
Expand Down
1 change: 1 addition & 0 deletions crates/sdk/libs/near/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ repository.workspace = true
license.workspace = true

[dependencies]
near-account-id = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
serde_with = {workspace = true, features = ["base64"]}
Expand Down
12 changes: 6 additions & 6 deletions crates/sdk/libs/near/src/jsonrpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ impl Client {
*self.id.borrow_mut() += 1;
let body = serde_json::to_vec(&Request {
jsonrpc: "2.0",
id: self.id.borrow().to_string(),
method: method.to_string(),
id: &*self.id.borrow().to_string(),
method,
params,
})
.map_err(|err| format!("Cannot serialize request: {:?}", err))?;
Expand All @@ -38,10 +38,10 @@ impl Client {
}

#[derive(Debug, Clone, Serialize)]
pub struct Request<P: Serialize> {
pub jsonrpc: &'static str,
pub id: String,
pub method: String,
struct Request<'a, P: Serialize> {
pub jsonrpc: &'a str,
pub id: &'a str,
pub method: &'a str,

pub params: P,
}
Expand Down
4 changes: 2 additions & 2 deletions crates/sdk/libs/near/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use serde_with::base64::Base64;
use serde_with::serde_as;

pub type BlockHeight = u64;
pub type BlockHash = String;
pub type AccountId = String;
pub type BlockHash = calimero_primitives::hash::Hash;
pub type AccountId = near_account_id::AccountId;
pub type StorageUsage = u64;
pub type Nonce = u64;

Expand Down
4 changes: 2 additions & 2 deletions crates/sdk/libs/near/src/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub enum QueryRequest {
},
CallFunction {
account_id: AccountId,
method_name: String,
method_name: Box<str>,
#[serde(rename = "args_base64")]
args: FunctionArgs,
},
Expand All @@ -52,7 +52,7 @@ pub struct AccountView {
pub struct ContractCodeView {
#[serde(rename = "code_base64")]
#[serde_as(as = "Base64")]
pub code: Vec<u8>,
pub code: Box<[u8]>,
pub hash: String,
}

Expand Down

0 comments on commit cd4b7d2

Please sign in to comment.