Skip to content

Commit

Permalink
Feature/leader schedule (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorblx authored Jan 2, 2025
1 parent 6136429 commit d826b2c
Show file tree
Hide file tree
Showing 9 changed files with 1,852 additions and 1,326 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ python/src/bxsolana_trader_proto.egg-info/
/python/.pypirc
python/.venv
target/
.venv
.DS_Store

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk
.venv
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "solana-trader-proto"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
authors = ["[email protected]"]
license = "MIT"
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ all: clean proto
clean:
rm -rf js api common

proto: proto-build-api-go proto-build-common-go proto-build-swagger proto-build-gw proto-build-api-python
proto: proto-build-api-go proto-build-common-go proto-build-swagger proto-build-gw proto-build-api-python proto-build-api-rust

proto-build-gw:
docker run -v $(CURDIR)/api:/go/protobuf/out \
Expand Down Expand Up @@ -43,6 +43,9 @@ proto-build-api-python:
--python_betterproto_out=$(CURDIR)/python/src/bxsolana_trader_proto/ \
$(CURDIR)/proto/api.proto

proto-build-api-rust:
cargo build

proto-build-common-go:
docker run -v $(CURDIR)/common:/go/protobuf/out \
-v $(CURDIR)/proto:/go/protobuf/in $(PB_GO_IMAGE_NAME) \
Expand Down
2,898 changes: 1,575 additions & 1,323 deletions api/api.pb.go

Large diffs are not rendered by default.

85 changes: 85 additions & 0 deletions api/api.pb.gw.go

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

36 changes: 36 additions & 0 deletions api/api_grpc.pb.go

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

28 changes: 28 additions & 0 deletions proto/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,17 @@ service Api {
tags: "AMMs";
};
}

rpc GetLeaderSchedule(GetLeaderScheduleRequest) returns (GetLeaderScheduleResponse) {
option (google.api.http) = {
get: "/api/v2/system/leader-schedule"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
description: "Returns leaders schedule for up to 100000 next slots, starting from the current slot. Result can be limited by number of slots.";
summary: "Leaders schedule";
tags: "System";
};
}
}

message GetMarketsRequest {
Expand Down Expand Up @@ -2512,3 +2523,20 @@ message PostPumpFunSwapRequestSol {
message PostPumpFunSwapResponse{
TransactionMessageV2 transaction = 1;
}


message GetLeaderScheduleRequest {
uint64 maxSlots = 1;
}

message GetLeaderScheduleResponse {
uint64 currentSlot = 1;
repeated LeaderSchedule leaderSchedule = 2;
}

message LeaderSchedule {
uint64 slot = 1;
string leader = 2;
bool isJito = 3;
bool isLowRisk = 4;
}
55 changes: 55 additions & 0 deletions python/src/bxsolana_trader_proto/api/__init__.py

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

Loading

0 comments on commit d826b2c

Please sign in to comment.