Skip to content

Commit 1426888

Browse files
authored
Merge branch 'main' into pcv/publish-dips-js
2 parents b2ad13c + 454c925 commit 1426888

File tree

9 files changed

+286
-89
lines changed

9 files changed

+286
-89
lines changed

Cargo.lock

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

crates/dips/Cargo.toml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,40 @@ name = "indexer-dips"
33
version = "0.1.0"
44
edition = "2021"
55

6+
[features]
7+
default = ["rpc", "db"]
8+
rpc = ["dep:prost", "dep:tonic", "dep:tonic-build", "dep:bytes"]
9+
db = ["dep:sqlx"]
10+
611
[dependencies]
7-
axum.workspace = true
812
build-info.workspace = true
913
thiserror.workspace = true
1014
anyhow.workspace = true
1115
alloy-rlp = "0.3.10"
1216
thegraph-core.workspace = true
13-
tonic.workspace = true
14-
async-trait.workspace = true
15-
prost.workspace = true
16-
prost-types.workspace = true
17+
async-trait.workspace = true
18+
prost-types.workspace = true
1719
uuid.workspace = true
1820
base64.workspace = true
1921
tokio.workspace = true
20-
sqlx.workspace = true
21-
futures = "0.3"
22+
indexer-monitor = { path = "../monitor" }
2223

23-
http = "0.2"
24+
bytes = { version = "1.10.0", optional = true }
2425
derivative = "2.2.0"
25-
ipfs-api-backend-hyper = {version = "0.6.0", features = ["with-send-sync"] }
26-
ipfs-api-prelude = {version = "0.6.0", features = ["with-send-sync"] }
27-
bytes = "1.10.0"
26+
27+
futures = "0.3"
28+
http = "0.2"
29+
prost = { workspace = true, optional = true }
30+
ipfs-api-backend-hyper = { version = "0.6.0", features = ["with-send-sync"] }
31+
ipfs-api-prelude = { version = "0.6.0", features = ["with-send-sync"] }
2832
serde_yaml.workspace = true
2933
serde.workspace = true
34+
sqlx = { workspace = true, optional = true }
35+
tonic = { workspace = true, optional = true }
3036

3137
[dev-dependencies]
3238
rand = "0.9.0"
39+
indexer-watcher = { path = "../watcher" }
3340

3441
[build-dependencies]
35-
tonic-build = { workspace = true }
42+
tonic-build = { workspace = true, optional = true }

crates/dips/build.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,22 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
fn main() {
5-
println!("cargo:rerun-if-changed=proto");
6-
tonic_build::configure()
7-
.out_dir("src/proto")
8-
.include_file("indexer.rs")
9-
.protoc_arg("--experimental_allow_proto3_optional")
10-
.compile_protos(&["proto/indexer.proto"], &["proto/"])
11-
.expect("Failed to compile DIPs indexer RPC proto(s)");
5+
#[cfg(feature = "rpc")]
6+
{
7+
println!("cargo:rerun-if-changed=proto");
128

13-
tonic_build::configure()
14-
.out_dir("src/proto")
15-
.include_file("gateway.rs")
16-
.protoc_arg("--experimental_allow_proto3_optional")
17-
.compile_protos(&["proto/gateway.proto"], &["proto"])
18-
.expect("Failed to compile DIPs gateway RPC proto(s)");
9+
tonic_build::configure()
10+
.out_dir("src/proto")
11+
.include_file("indexer.rs")
12+
.protoc_arg("--experimental_allow_proto3_optional")
13+
.compile_protos(&["proto/indexer.proto"], &["proto/"])
14+
.expect("Failed to compile DIPs indexer RPC proto(s)");
15+
16+
tonic_build::configure()
17+
.out_dir("src/proto")
18+
.include_file("gateway.rs")
19+
.protoc_arg("--experimental_allow_proto3_optional")
20+
.compile_protos(&["proto/gateway.proto"], &["proto"])
21+
.expect("Failed to compile DIPs gateway RPC proto(s)");
22+
}
1923
}

crates/dips/src/database.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use std::str::FromStr;
55

6-
use axum::async_trait;
6+
use async_trait::async_trait;
77
use build_info::chrono::{DateTime, Utc};
88
use sqlx::{types::BigDecimal, PgPool};
99
use thegraph_core::alloy::{core::primitives::U256 as uint256, hex::ToHexExt, sol_types::SolType};

crates/dips/src/ipfs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
use std::{str::FromStr, sync::Arc};
55

6+
use async_trait::async_trait;
67
use derivative::Derivative;
78
use futures::TryStreamExt;
89
use http::Uri;
910
use ipfs_api_prelude::{IpfsApi, TryFromUri};
1011
use serde::Deserialize;
11-
use tonic::async_trait;
1212

1313
use crate::DipsError;
1414

0 commit comments

Comments
 (0)