Skip to content

Commit be3e5ab

Browse files
authored
fix(gateway): broadcasted transaction serialization (#353)
1 parent f193ec1 commit be3e5ab

File tree

11 files changed

+452
-47
lines changed

11 files changed

+452
-47
lines changed

Cargo.lock

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/gateway/gateway-client/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ version.workspace = true
77

88
[dependencies]
99
katana-primitives.workspace = true
10-
katana-rpc-types.workspace = true
1110
katana-gateway-types.workspace = true
1211

1312
clap.workspace = true

crates/gateway/gateway-client/src/lib.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ use std::str::FromStr;
33

44
use katana_gateway_types::{
55
AddDeclareTransactionResponse, AddDeployAccountTransactionResponse,
6-
AddInvokeTransactionResponse, Block, BlockId, BlockSignature, ContractClass, GatewayError,
6+
AddInvokeTransactionResponse, Block, BlockId, BlockSignature, BroadcastedDeclareTx,
7+
BroadcastedDeployAccountTx, BroadcastedInvokeTx, ContractClass, GatewayError,
78
PreConfirmedBlock, SequencerPublicKey, StateUpdate, StateUpdateWithBlock,
89
};
910
use katana_primitives::block::BlockNumber;
1011
use katana_primitives::class::CasmContractClass;
1112
use katana_primitives::Felt;
12-
use katana_rpc_types::{
13-
BroadcastedDeclareTx, BroadcastedDeployAccountTx, BroadcastedInvokeTx, BroadcastedTx,
14-
};
1513
use reqwest::header::{HeaderMap, HeaderName, HeaderValue};
1614
use reqwest::{Method, Request, StatusCode};
1715
use serde::de::DeserializeOwned;
@@ -136,24 +134,21 @@ impl Client {
136134
&self,
137135
transaction: BroadcastedInvokeTx,
138136
) -> Result<AddInvokeTransactionResponse, Error> {
139-
self.gateway("add_transaction").json(&BroadcastedTx::Invoke(transaction)).send().await
137+
self.gateway("add_transaction").json(&transaction).send().await
140138
}
141139

142140
pub async fn add_declare_transaction(
143141
&self,
144142
transaction: BroadcastedDeclareTx,
145143
) -> Result<AddDeclareTransactionResponse, Error> {
146-
self.gateway("add_transaction").json(&BroadcastedTx::Declare(transaction)).send().await
144+
self.gateway("add_transaction").json(&transaction).send().await
147145
}
148146

149147
pub async fn add_deploy_account_transaction(
150148
&self,
151149
transaction: BroadcastedDeployAccountTx,
152150
) -> Result<AddDeployAccountTransactionResponse, Error> {
153-
self.gateway("add_transaction")
154-
.json(&BroadcastedTx::DeployAccount(transaction))
155-
.send()
156-
.await
151+
self.gateway("add_transaction").json(&transaction).send().await
157152
}
158153

159154
/// Creates a [`RequestBuilder`] for a gateway endpoint.

crates/gateway/gateway-types/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ katana-rpc-types.workspace = true
1111
katana-rpc-api.workspace = true
1212
serde-utils.workspace = true
1313

14+
base64.workspace = true
15+
cairo-lang-starknet-classes.workspace = true
16+
flate2.workspace = true
17+
serde_json.workspace = true
1418
serde.workspace = true
1519
starknet.workspace = true
1620
thiserror.workspace = true

0 commit comments

Comments
 (0)