Skip to content

Commit 77a9f77

Browse files
authored
feat(katana): default to deserialize response as JSON (#157)
Deserialize the JSON-RPC response object as a raw JSON to make the client compatible with other Starknet RPC spec. Currently, we deserialize the response as concrete types from `starknet-rs` crate. The crate only supports a single RPC spec at a time so the types are bounded to a single RPC spec. Meaning the client is only compatible when interacting the a server of a similar spec. Deserializing as raw JSON makes the client more flexible and can be used to interact with Starknet servers regardless of the RPC spec version.
1 parent e6aaa10 commit 77a9f77

File tree

3 files changed

+200
-129
lines changed

3 files changed

+200
-129
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/katana/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ inquire = "0.7.5"
2727
# Rev on branch starknet 0.15.1.
2828
piltover = { git = "https://github.com/cartridge-gg/piltover.git", rev = "3bed7ac554259668dbdce6a5f56de5b2bf7faf43" }
2929
rand.workspace = true
30+
serde.workspace = true
3031
shellexpand = "3.1.0"
3132
spinoff.workspace = true
3233
starknet.workspace = true
@@ -37,6 +38,7 @@ tracing.workspace = true
3738
url.workspace = true
3839

3940
colored_json = { version = "5.0", optional = true }
41+
serde_json = { workspace = true, optional = true }
4042

4143
[build-dependencies]
4244
vergen = { version = "9.0.0", features = [ "build", "cargo", "emit_and_set" ] }
@@ -55,7 +57,7 @@ tempfile.workspace = true
5557
default = [ "cartridge", "init-slot", "jemalloc", "katana-cli/explorer" ]
5658

5759
cartridge = [ "katana-cli/cartridge" ]
58-
client = [ "dep:colored_json" ]
60+
client = [ "dep:colored_json", "dep:serde_json" ]
5961
init-custom-settlement-chain = [ ]
6062
init-slot = [ ]
6163
jemalloc = [ ]

0 commit comments

Comments
 (0)