Skip to content

Commit

Permalink
Merge pull request #23 from starknet-id/ref/update_use_new_indexer
Browse files Browse the repository at this point in the history
feat: update bot to new indexer
  • Loading branch information
Th0rgal authored Sep 22, 2023
2 parents fc57a69 + f193618 commit ad46e13
Show file tree
Hide file tree
Showing 12 changed files with 357 additions and 208 deletions.
7 changes: 6 additions & 1 deletion bot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
starknet = { git = "https://github.com/Th0rgal/starknet-rs.git", branch = "feat/starknet-id" }
mongodb = "2.1.0"
bson = "2.0.0"
chrono = "0.4"
Expand All @@ -22,6 +21,12 @@ serde_json = "1.0"
lazy_static = "1.4.0"
reqwest = "0.11.18"
num-integer = "0.1.45"
starknet = "0.6.0"
starknet-id = { git = "https://github.com/starknet-id/starknet-id.rs.git", branch = "master" }
serde_derive = "1.0.183"
env_logger = "0.10.0"
tonic = "0.10.0"
prost = "0.12.1"

[build-dependencies]
tonic-build = "0.10.0"
7 changes: 7 additions & 0 deletions bot/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure()
.build_server(false)
.protoc_arg("--experimental_allow_proto3_optional")
.compile(&["proto/status.proto"], &["proto"])?;
Ok(())
}
34 changes: 34 additions & 0 deletions bot/proto/status.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Apibara Sink status server
syntax = "proto3";

package apibara.sink.v1;

service Status {
// Get Sink status.
rpc GetStatus(GetStatusRequest) returns (GetStatusResponse);
}

// Request for the `GetStatus` method.
message GetStatusRequest {}

// Response for the `GetStatus` method.
message GetStatusResponse {
// The status of the sink.
SinkStatus status = 1;
// The starting block.
optional uint64 starting_block = 2;
// The current block.
optional uint64 current_block = 3;
// The current head of the chain.
optional uint64 head_block = 4;
// The reason why the sink is not running.
optional string reason = 5;
}

enum SinkStatus {
SINK_STATUS_UNKNOWN = 0;
// The sink is running.
SINK_STATUS_RUNNING = 1;
// The sink has errored.
SINK_STATUS_ERRORED = 2;
}
Loading

0 comments on commit ad46e13

Please sign in to comment.