Skip to content

Commit

Permalink
proto: add account_include to Blocks filter (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid committed Jul 7, 2023
1 parent 6db9c9d commit 1b6c833
Show file tree
Hide file tree
Showing 17 changed files with 218 additions and 73 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ The minor version will be incremented upon a breaking change and the patch versi

### Breaking

## 2023-07-07

- @triton-one/yellowstone-grpc:0.1.4
- yellowstone-grpc-client-1.6.0+solana.1.14.18
- yellowstone-grpc-client-1.6.0+solana.1.16.1
- yellowstone-grpc-geyser-1.2.0+solana.1.14.18
- yellowstone-grpc-geyser-1.2.0+solana.1.16.1
- yellowstone-grpc-proto-1.6.0+solana.1.14.18
- yellowstone-grpc-proto-1.6.0+solana.1.16.1

### Features

- geyser: add `account_include` to Blocks filter ([#155](https://github.com/rpcpool/yellowstone-grpc/pull/155)).

## 2023-06-29

- @triton-one/yellowstone-grpc:0.1.3
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[workspace]
members = [
"examples/rust", # 1.5.0+solana.1.14.18
"yellowstone-grpc-client", # 1.5.0+solana.1.14.18
"yellowstone-grpc-geyser", # 1.1.0+solana.1.14.18
"yellowstone-grpc-proto", # 1.5.0+solana.1.14.18
"examples/rust", # 1.6.0+solana.1.14.18
"yellowstone-grpc-client", # 1.6.0+solana.1.14.18
"yellowstone-grpc-geyser", # 1.2.0+solana.1.14.18
"yellowstone-grpc-proto", # 1.6.0+solana.1.14.18
]

[patch.crates-io]
Expand Down
2 changes: 1 addition & 1 deletion examples/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yellowstone-grpc-client-simple"
version = "1.5.0+solana.1.14.18"
version = "1.6.0+solana.1.14.18"
authors = ["Triton One"]
edition = "2021"
publish = false
Expand Down
11 changes: 10 additions & 1 deletion examples/rust/src/bin/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ struct ActionSubscribe {
#[clap(long)]
blocks: bool,

/// Filter included account in transactions
#[clap(long)]
blocks_account_include: Vec<String>,

/// Subscribe on block meta updates (without transactions)
#[clap(long)]
blocks_meta: bool,
Expand Down Expand Up @@ -240,7 +244,12 @@ impl Action {

let mut blocks: BlocksFilterMap = HashMap::new();
if args.blocks {
blocks.insert("client".to_owned(), SubscribeRequestFilterBlocks {});
blocks.insert(
"client".to_owned(),
SubscribeRequestFilterBlocks {
account_include: args.blocks_account_include.clone(),
},
);
}

let mut blocks_meta: BlocksMetaFilterMap = HashMap::new();
Expand Down
3 changes: 2 additions & 1 deletion examples/typescript/package-lock.json

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

9 changes: 8 additions & 1 deletion examples/typescript/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ async function subscribeCommand(client, args) {
}

if (args.blocksMeta) {
request.blocksMeta.client = {};
request.blocksMeta.client = {
account_include: args.blocksAccountInclude,
};
}

if (args.accounts.dataslice) {
Expand Down Expand Up @@ -297,6 +299,11 @@ function parseCommandLineArgs() {
description: "subscribe on block updates",
type: "boolean",
},
"blocks-account-include": {
default: [],
description: "filter included account in transactions",
type: "array",
},
"blocks-meta": {
default: false,
description: "subscribe on block meta updates (without transactions)",
Expand Down
4 changes: 2 additions & 2 deletions yellowstone-grpc-client-nodejs/package-lock.json

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

2 changes: 1 addition & 1 deletion yellowstone-grpc-client-nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@triton-one/yellowstone-grpc",
"version": "0.1.3",
"version": "0.1.4",
"license": "Apache-2.0",
"author": "Triton One",
"description": "Yellowstone gRPC Geyser Node.js Client",
Expand Down
4 changes: 2 additions & 2 deletions yellowstone-grpc-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yellowstone-grpc-client"
version = "1.5.0+solana.1.14.18"
version = "1.6.0+solana.1.14.18"
authors = ["Triton One"]
edition = "2021"
description = "Yellowstone gRPC Geyser Simple Client"
Expand All @@ -16,7 +16,7 @@ http = "0.2.8"
thiserror = "1.0"
tonic = { version = "0.9.2", features = ["gzip", "tls", "tls-roots"] }
tonic-health = "0.9.2"
yellowstone-grpc-proto = { path = "../yellowstone-grpc-proto", version = "1.5.0+solana.1.14.18" }
yellowstone-grpc-proto = { path = "../yellowstone-grpc-proto", version = "1.6.0+solana.1.14.18" }

[dev-dependencies]
tokio = { version = "1.21.2", features = ["macros"] }
2 changes: 1 addition & 1 deletion yellowstone-grpc-geyser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yellowstone-grpc-geyser"
version = "1.1.0+solana.1.14.18"
version = "1.2.0+solana.1.14.18"
authors = ["Triton One"]
edition = "2021"
description = "Yellowstone gRPC Geyser Plugin"
Expand Down
8 changes: 6 additions & 2 deletions yellowstone-grpc-geyser/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
"any": false,
"account_include_max": 10,
"account_include_reject": ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"],
"account_exclude_max": 10
"account_exclude_max": 10,
"account_required_max": 10
},
"blocks": {
"max": 1
"max": 1,
"any": false,
"account_include_max": 10,
"account_include_reject": ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"]
},
"blocks_meta": {
"max": 1
Expand Down
12 changes: 11 additions & 1 deletion yellowstone-grpc-geyser/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,21 @@ impl Default for ConfigGrpcFiltersTransactions {
pub struct ConfigGrpcFiltersBlocks {
#[serde(deserialize_with = "deserialize_usize_str")]
pub max: usize,
pub any: bool,
#[serde(deserialize_with = "deserialize_usize_str")]
pub account_include_max: usize,
#[serde(deserialize_with = "deserialize_pubkey_set")]
pub account_include_reject: HashSet<Pubkey>,
}

impl Default for ConfigGrpcFiltersBlocks {
fn default() -> Self {
Self { max: usize::MAX }
Self {
max: usize::MAX,
any: true,
account_include_max: usize::MAX,
account_include_reject: HashSet::new(),
}
}
}

Expand Down

0 comments on commit 1b6c833

Please sign in to comment.