Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ea52319
Support RPC `0.9.0`
ddoktorski Jul 11, 2025
183aea9
Restore `command` field in sncast json responses
franciszekjob Jul 13, 2025
3d227d0
Update other's case in `to_json`
franciszekjob Jul 14, 2025
bbfb650
Merge branch 'master' into rpc-0-9-0
ddoktorski Jul 17, 2025
d5b0302
Rename `preconfirmed` to `pre_confirmed`
ddoktorski Jul 17, 2025
a0d4f6a
Update version to `0.9` in node url
ddoktorski Jul 17, 2025
2c20aca
Restore ignored tests
ddoktorski Jul 17, 2025
2c599e1
Add backticks
ddoktorski Jul 17, 2025
3d1c5aa
Update changelog
ddoktorski Jul 17, 2025
802462b
Fix `test_happy_case_deployment_fee_message` test
ddoktorski Jul 17, 2025
764611e
Add dash to pre confirmed
ddoktorski Jul 17, 2025
7dc04ca
Bump devnet to rc.2
ddoktorski Jul 18, 2025
f0bbc6e
Resolve merge conflicts
ddoktorski Jul 21, 2025
808625a
Address PR comments
ddoktorski Jul 21, 2025
d1721df
Use always underscore for pre_confirmed input
ddoktorski Jul 21, 2025
38ce1d5
Revert refactor in `check_if_legacy_contract`
ddoktorski Jul 21, 2025
c8ad731
Resolve merge conflicts
ddoktorski Jul 31, 2025
35ab8a2
Bump starknet-rs to rc.2; bump devnet to rc.4
ddoktorski Jul 31, 2025
8b28a91
Fix changelog
ddoktorski Jul 31, 2025
34bbd0c
Fix e2e::forking::with_cache test
ddoktorski Jul 31, 2025
6c8c28b
Merge branch 'rpc-0-9-0' into restore-command-field-in-sncast-jsons
franciszekjob Aug 7, 2025
7cdce89
Merge branch 'master' of https://github.com/foundry-rs/starknet-found…
franciszekjob Sep 25, 2025
208348d
Merge branch 'restore-command-field-in-sncast-jsons' of https://githu…
franciszekjob Sep 25, 2025
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
9 changes: 1 addition & 8 deletions crates/sncast/src/response/account/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use foundry_ui::Message;
use foundry_ui::styling;
use serde::{Serialize, Serializer};
use serde_json::Value;
use serde_json::json;

fn as_str<S>(value: &u128, serializer: S) -> Result<S::Ok, S::Error>
where
Expand Down Expand Up @@ -48,13 +47,7 @@ impl Message for SncastMessage<AccountCreateResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}

Expand Down
9 changes: 1 addition & 8 deletions crates/sncast/src/response/account/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use foundry_ui::Message;
use foundry_ui::styling;
use serde::Serialize;
use serde_json::Value;
use serde_json::json;

#[derive(Serialize, Clone)]
pub struct AccountDeleteResponse {
Expand All @@ -23,12 +22,6 @@ impl Message for SncastMessage<AccountDeleteResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}
9 changes: 1 addition & 8 deletions crates/sncast/src/response/account/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use foundry_ui::Message;
use foundry_ui::styling;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use serde_json::json;
#[derive(Serialize, Deserialize, CairoSerialize, Clone, Debug, PartialEq)]
pub struct AccountDeployResponse {
pub transaction_hash: PaddedFelt,
Expand Down Expand Up @@ -37,13 +36,7 @@ impl Message for SncastMessage<AccountDeployResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}

Expand Down
9 changes: 1 addition & 8 deletions crates/sncast/src/response/account/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use foundry_ui::Message;
use foundry_ui::styling;
use serde::Serialize;
use serde_json::Value;
use serde_json::json;

#[derive(Serialize, Clone)]
pub struct AccountImportResponse {
Expand All @@ -28,12 +27,6 @@ impl Message for SncastMessage<AccountImportResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}
9 changes: 1 addition & 8 deletions crates/sncast/src/response/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use foundry_ui::Message;
use foundry_ui::styling;
use serde::Serialize;
use serde_json::Value;
use serde_json::json;
use starknet_types_core::felt::Felt;

#[derive(Serialize, CairoSerialize, Clone)]
Expand Down Expand Up @@ -34,12 +33,6 @@ impl Message for SncastMessage<CallResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}
28 changes: 28 additions & 0 deletions crates/sncast/src/response/cast_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,31 @@ pub struct SncastMessage<T: CommandResponse> {
pub command: String,
pub command_response: T,
}

impl<T: CommandResponse> SncastMessage<T> {
pub fn to_json(&self) -> serde_json::Value {
match serde_json::to_value(&self.command_response) {
Ok(serde_json::Value::Object(mut map)) => {
map.insert(
"command".to_string(),
serde_json::Value::String(self.command.clone()),
);
serde_json::Value::Object(map)
}
Ok(other) => {
serde_json::json!({
"error": "Expected a map for `command_response`",
"command": self.command,
"details": other.to_string()
})
}
Err(err) => {
serde_json::json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
}
}
}
}
25 changes: 3 additions & 22 deletions crates/sncast/src/response/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use foundry_ui::styling;
use indoc::formatdoc;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use serde_json::json;
#[derive(Clone, Serialize, Deserialize, CairoSerialize, Debug, PartialEq)]
pub struct DeclareTransactionResponse {
pub class_hash: PaddedFelt,
Expand All @@ -34,13 +33,7 @@ impl Message for SncastMessage<DeclareTransactionResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}

Expand All @@ -64,13 +57,7 @@ impl Message for SncastMessage<AlreadyDeclaredResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}

Expand Down Expand Up @@ -105,13 +92,7 @@ impl Message for SncastMessage<DeclareResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}

Expand Down
9 changes: 1 addition & 8 deletions crates/sncast/src/response/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use foundry_ui::styling;
use indoc::formatdoc;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use serde_json::json;

use super::{command::CommandResponse, explorer_link::OutputLink};
use crate::response::cast_message::SncastMessage;
Expand Down Expand Up @@ -36,13 +35,7 @@ impl Message for SncastMessage<DeployResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}

Expand Down
9 changes: 1 addition & 8 deletions crates/sncast/src/response/invoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use foundry_ui::Message;
use foundry_ui::styling;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use serde_json::json;

#[derive(Serialize, Deserialize, CairoSerialize, Clone, Debug, PartialEq)]
pub struct InvokeResponse {
Expand All @@ -30,13 +29,7 @@ impl Message for SncastMessage<InvokeResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}

Expand Down
9 changes: 1 addition & 8 deletions crates/sncast/src/response/multicall/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use foundry_ui::Message;
use foundry_ui::styling;
use serde::Serialize;
use serde_json::Value;
use serde_json::json;

#[derive(Serialize, Clone)]
pub struct MulticallNewResponse {
Expand All @@ -26,12 +25,6 @@ impl Message for SncastMessage<MulticallNewResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}
9 changes: 1 addition & 8 deletions crates/sncast/src/response/multicall/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use foundry_ui::Message;
use foundry_ui::styling;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use serde_json::json;

#[derive(Serialize, Deserialize, CairoSerialize, Clone, Debug, PartialEq)]
pub struct MulticallRunResponse {
Expand All @@ -33,13 +32,7 @@ impl Message for SncastMessage<MulticallRunResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}

Expand Down
9 changes: 1 addition & 8 deletions crates/sncast/src/response/script/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use foundry_ui::Message;
use foundry_ui::styling;
use serde::Serialize;
use serde_json::Value;
use serde_json::json;

#[derive(Serialize, Clone)]
pub struct ScriptInitResponse {
Expand All @@ -23,12 +22,6 @@ impl Message for SncastMessage<ScriptInitResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}
9 changes: 1 addition & 8 deletions crates/sncast/src/response/script/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use foundry_ui::Message;
use foundry_ui::styling;
use serde::Serialize;
use serde_json::Value;
use serde_json::json;

#[derive(Serialize, Debug, Clone)]
pub struct ScriptRunResponse {
Expand All @@ -29,12 +28,6 @@ impl Message for SncastMessage<ScriptRunResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}
9 changes: 1 addition & 8 deletions crates/sncast/src/response/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use foundry_ui::Message;
use foundry_ui::styling;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use serde_json::json;
use starknet_types_core::felt::Felt;

#[derive(Serialize, Deserialize, CairoSerialize, Clone, Debug, PartialEq)]
Expand All @@ -25,12 +24,6 @@ impl Message for SncastMessage<SerializeResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}
9 changes: 1 addition & 8 deletions crates/sncast/src/response/show_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use foundry_ui::Message;
use foundry_ui::styling;
use serde::Serialize;
use serde_json::Value;
use serde_json::json;

use super::command::CommandResponse;
use crate::response::cast_message::SncastMessage;
Expand Down Expand Up @@ -67,12 +66,6 @@ impl Message for SncastMessage<ShowConfigResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}
9 changes: 1 addition & 8 deletions crates/sncast/src/response/transformed_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use foundry_ui::Message;
use foundry_ui::styling;
use serde::Serialize;
use serde_json::Value;
use serde_json::json;
use starknet::core::types::{ContractClass, contract::AbiEntry};
use starknet_types_core::felt::Felt;

Expand Down Expand Up @@ -39,13 +38,7 @@ impl Message for SncastMessage<TransformedCallResponse> {
}

fn json(&self) -> Value {
serde_json::to_value(&self.command_response).unwrap_or_else(|err| {
json!({
"error": "Failed to serialize response",
"command": self.command,
"details": err.to_string()
})
})
self.to_json()
}
}

Expand Down
Loading
Loading