Skip to content

Commit

Permalink
feat(fgw): add transaction methods for GatewayProvider (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbcaron authored Nov 19, 2024
1 parent 0a40c2a commit 9db5cef
Show file tree
Hide file tree
Showing 46 changed files with 429 additions and 172 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Next release

- feat(fgw): added `add_transaction` for gateway client
- fix(fgw): include `l1_to_l2_consumed_message` in L1 handler receipt
- build: up starknet-rs, starknet-types, blockifier(v0.8.0), cairo
- feat(rpc): added `getCompiledCasm` method
Expand Down
42 changes: 35 additions & 7 deletions Cargo.lock

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

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ members = [
"crates/client/sync",
"crates/client/eth",
"crates/client/rpc",
"crates/client/gateway",
"crates/client/gateway/client",
"crates/client/gateway/server",
"crates/client/analytics",
"crates/client/telemetry",
"crates/client/devnet",
Expand All @@ -32,7 +33,8 @@ default-members = [
"crates/client/exec",
"crates/client/sync",
"crates/client/eth",
"crates/client/gateway",
"crates/client/gateway/client",
"crates/client/gateway/server",
"crates/client/rpc",
"crates/client/telemetry",
"crates/client/devnet",
Expand Down Expand Up @@ -114,7 +116,8 @@ mc-telemetry = { path = "crates/client/telemetry" }
mc-db = { path = "crates/client/db" }
mc-exec = { path = "crates/client/exec" }
mc-rpc = { path = "crates/client/rpc" }
mc-gateway = { path = "crates/client/gateway" }
mc-gateway-client = { path = "crates/client/gateway/client" }
mc-gateway-server = { path = "crates/client/gateway/server" }
mc-sync = { path = "crates/client/sync" }
mc-eth = { path = "crates/client/eth" }
mc-mempool = { path = "crates/client/mempool" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
description = "Madara client rpc service"
name = "mc-gateway"
description = "Madara gateway client provider"
name = "mc-gateway-client"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand All @@ -17,12 +17,9 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]

# Madara
mc-db.workspace = true
mc-rpc.workspace = true
mp-block.workspace = true
mp-class.workspace = true
mp-gateway.workspace = true
mp-utils.workspace = true

# Starknet
starknet-core.workspace = true
Expand All @@ -39,7 +36,6 @@ hyper-tls.workspace = true
hyper-util.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
thiserror.workspace = true
tokio.workspace = true
tower = { version = "0.4", features = ["timeout", "retry", "util", "limit"] }
tracing.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ type HttpsClient = Client<HttpsConnector<HttpConnector>, String>;
type TimeoutRetryClient = Retry<RetryPolicy, Timeout<HttpsClient>>;
pub type PausedClient = PauseLayerMiddleware<TimeoutRetryClient>;
#[derive(Debug, Clone)]
pub struct FeederClient {
pub struct GatewayProvider {
pub(crate) client: PausedClient,
#[allow(dead_code)]
pub(crate) gateway_url: Url,
pub(crate) feeder_gateway_url: Url,
pub(crate) headers: HeaderMap,
}

impl FeederClient {
impl GatewayProvider {
pub fn new(gateway_url: Url, feeder_gateway_url: Url) -> Self {
let pause_until = Arc::new(RwLock::new(None));
let connector = HttpsConnector::new();
Expand Down Expand Up @@ -77,6 +76,15 @@ impl FeederClient {
.expect("Failed to parse Starknet Alpha Sepolia feeder gateway url. This should not fail in prod."),
)
}
pub fn starknet_integration_sepolia() -> Self {
Self::new(
Url::parse("https://integration-sepolia.starknet.io/gateway/")
.expect("Failed to parse Starknet Integration Sepolia gateway url. This should not fail in prod."),
Url::parse("https://integration-sepolia.starknet.io/feeder_gateway/").expect(
"Failed to parse Starknet Integration Sepolia feeder gateway url. This should not fail in prod.",
),
)
}
}

#[derive(Clone, Debug)]
Expand Down
5 changes: 5 additions & 0 deletions crates/client/gateway/client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mod builder;
mod methods;
mod request_builder;

pub use builder::GatewayProvider;
Loading

0 comments on commit 9db5cef

Please sign in to comment.