Compare commits

..

12 Commits

Author SHA1 Message Date
Matthieu Vachon
a5400bbcb2 Fixed some links due to docs re-organization 2024-08-09 12:26:49 -04:00
Alexandre Bourget
0eec717fd7 Update substreams.yaml
Take out the doc, so it pulls the README.md in
2024-05-16 15:03:54 +01:00
Alexandre Bourget
3a2d444e94 Merge pull request #7 from pinax-network/main
Add beacon chain explorer
2024-05-16 15:03:24 +01:00
arnaudberger
2481ff71c7 Fix bitcoin-explorer 2024-03-29 16:59:00 -04:00
Matthieu Vachon
8e276ccccf Updated to latest substreams and substreams-ethereum 2024-03-29 16:50:13 -04:00
Matthieu Vachon
85804c5771 Exclude generating sf/ethereum and added prost_types dependency in case it's used 2024-03-29 16:42:26 -04:00
YaroShkvorets
f3bd26f75c add endpoints to readme 2024-03-27 21:31:17 -04:00
YaroShkvorets
a7aeb1b64d add beacon chain explorer 2024-03-27 21:24:55 -04:00
Enol
ac908c42fe Merge pull request #6 from streamingfast/feature/remove-clone
Re-wrote a bunch of Solana code to avoid all the bloated and unecessary clones
2024-02-15 02:33:16 +01:00
Matthieu Vachon
f8de655950 Merge pull request #3 from JulienR1/main
Updated README.md
2024-02-14 16:02:10 -05:00
Matthieu Vachon
8534cfb946 Re-wrote a bunch of Solana code to avoid all the bloated and unecessary clones 2024-02-14 11:02:54 -05:00
Julien Rousseau
7334a29d10 Updated README.md 2023-09-13 14:28:51 -04:00
33 changed files with 1512 additions and 172 deletions

6
beacon-explorer/.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
.vscode
.idea
.DS_Store
buf.gen.yaml
/target
*.spkg

View File

@@ -0,0 +1,10 @@
image: ghcr.io/graphprotocol/substreams-gitpod:latest
tasks:
- command: |
# Authenticate with the substreams server
export SUBSTREAMS_API_TOKEN=$(curl https://auth.pinax.network/v1/auth/issue -s --data-binary '{"api_key":"'$PINAX_KEY'"}' | jq -r .token)
ports:
- port: 6060
onOpen: ignore
- port: 1065
onOpen: ignore

View File

@@ -0,0 +1 @@
max_width = 120

539
beacon-explorer/Cargo.lock generated Normal file
View File

@@ -0,0 +1,539 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "anyhow"
version = "1.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247"
[[package]]
name = "autocfg"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
[[package]]
name = "bigdecimal"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa"
dependencies = [
"num-bigint",
"num-integer",
"num-traits",
]
[[package]]
name = "bitflags"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
[[package]]
name = "bytes"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "either"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
[[package]]
name = "equivalent"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "fastrand"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984"
[[package]]
name = "fixedbitset"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
[[package]]
name = "hashbrown"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
[[package]]
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "hex-literal"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0"
[[package]]
name = "home"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"
dependencies = [
"windows-sys",
]
[[package]]
name = "indexmap"
version = "2.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
dependencies = [
"equivalent",
"hashbrown",
]
[[package]]
name = "itertools"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
dependencies = [
"either",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "linux-raw-sys"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
[[package]]
name = "log"
version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
[[package]]
name = "memchr"
version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]]
name = "multimap"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a"
[[package]]
name = "num-bigint"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-integer"
version = "0.1.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
dependencies = [
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
dependencies = [
"autocfg",
]
[[package]]
name = "once_cell"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "pad"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2ad9b889f1b12e0b9ee24db044b5129150d5eada288edc800f789928dc8c0e3"
dependencies = [
"unicode-width",
]
[[package]]
name = "petgraph"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9"
dependencies = [
"fixedbitset",
"indexmap",
]
[[package]]
name = "prettyplease"
version = "0.1.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86"
dependencies = [
"proc-macro2",
"syn 1.0.109",
]
[[package]]
name = "proc-macro2"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
dependencies = [
"unicode-ident",
]
[[package]]
name = "prost"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd"
dependencies = [
"bytes",
"prost-derive",
]
[[package]]
name = "prost-build"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270"
dependencies = [
"bytes",
"heck",
"itertools",
"lazy_static",
"log",
"multimap",
"petgraph",
"prettyplease",
"prost",
"prost-types",
"regex",
"syn 1.0.109",
"tempfile",
"which",
]
[[package]]
name = "prost-derive"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4"
dependencies = [
"anyhow",
"itertools",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "prost-types"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13"
dependencies = [
"prost",
]
[[package]]
name = "quote"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
[[package]]
name = "regex"
version = "1.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
[[package]]
name = "rustix"
version = "0.38.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89"
dependencies = [
"bitflags",
"errno",
"libc",
"linux-raw-sys",
"windows-sys",
]
[[package]]
name = "substreams"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3520661f782c338f0e3c6cfc001ac790ed5e68d8f28515139e2aa674f8bb54da"
dependencies = [
"anyhow",
"bigdecimal",
"hex",
"hex-literal",
"num-bigint",
"num-integer",
"num-traits",
"pad",
"prost",
"prost-build",
"prost-types",
"substreams-macro",
"thiserror",
]
[[package]]
name = "substreams-beacon-explorer"
version = "0.1.0"
dependencies = [
"prost",
"prost-types",
"substreams",
]
[[package]]
name = "substreams-macro"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c15595ceab80fece579e462d4823048fe85d67922584c681f5e94305727ad9ee"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"thiserror",
]
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "tempfile"
version = "3.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
dependencies = [
"cfg-if",
"fastrand",
"rustix",
"windows-sys",
]
[[package]]
name = "thiserror"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.55",
]
[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-width"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
[[package]]
name = "which"
version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
dependencies = [
"either",
"home",
"once_cell",
"rustix",
]
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675"
[[package]]
name = "windows_i686_gnu"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3"
[[package]]
name = "windows_i686_msvc"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"

View File

@@ -0,0 +1,21 @@
[package]
name = "substreams-beacon-explorer"
version = "0.1.0"
description = "Substreams showcasing the building blocks of Ethereum Beacon chain"
edition = "2021"
repository = "https://github.com/streamingfast/substreams-explorers"
license = "Apache 2.0"
[lib]
name = "substreams"
crate-type = ["cdylib"]
[dependencies]
prost = "0.11"
prost-types = "0.11"
substreams = "0.5"
[profile.release]
lto = true
opt-level = 's'
strip = "debuginfo"

17
beacon-explorer/Makefile Normal file
View File

@@ -0,0 +1,17 @@
.PHONY: protogen
protogen:
substreams protogen ./substreams.yaml --exclude-paths="sf/substreams,google"
.PHONY: build
build:
cargo build --target wasm32-unknown-unknown --release
module ?= map_block_meta
.PHONY: run
run: build
substreams run -e eth-cl.substreams.pinax.network\:443 $(filter-out $@,$(MAKECMDGOALS)) -s -10
.PHONY: gui
gui: build
substreams gui -e eth-cl.substreams.pinax.network\:443 $(filter-out $@,$(MAKECMDGOALS)) -s -10

61
beacon-explorer/README.md Normal file
View File

@@ -0,0 +1,61 @@
# Beacon Explorer
The Ethereum Beacon Chain Explorer consists of several Substreams modules showcasing the most basic operations that you can perform with Substreams on the Ethereum Beacon blockchain.
## Before You Begin
Make sure you have the [Substreams CLI installed](https://substreams.streamingfast.io/getting-started/installing-the-cli), and you know the [basic structure of a Substreams module](https://substreams.streamingfast.io/documentation/intro-getting-started/intro-evm). You must also provide a Pinax [API key](https://app.pinax.network) as `$SUBSTREAMS_API_KEY` environment variable
## Modules
The substreams package in this repository provides the following substreams modules:
- `map_block_meta` - streams some block metadata, such as slot number, root hash, spec version, timestamp, etc
- `map_block_full` - streams the entire block content to help you explore available fields
- `map_blobs` - streams blobs embedded into the beacon chain block
## Building the Substreams
First, generate the Protobuf code, which is the output of the Substreams:
```bash
> make protogen
```
Then, build the Rust code using the `cargo` command-line tool:
```bash
> make build
```
## Running Substreams modules
And now you can stream the corresponding substreams modules:
```bash
> make run map_block_meta
> make run map_block_full
> make run map_blobs
```
Alternatively, you can take advantage of `substreams gui` command for a nicer user interface:
```bash
> make gui map_block_meta
> make gui map_block_full
> make gui map_blobs
```
Or, you can just use `substreams` command to run it:
```bash
> substreams run -e eth-cl.substreams.pinax.network:443 map_block_meta -s -10
```
### Endpoints
Pinax offers the following beacon chain substreams endpoints:
- eth-cl.substreams.pinax.network:443
- gnosis-cl.substreams.pinax.network:443
- sepolia-cl.substreams.pinax.network:443
- holesky-cl.substreams.pinax.network:443
- chiado-cl.substreams.pinax.network:443

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -0,0 +1,9 @@
syntax = "proto3";
package beacon.blobs.v1;
message Blobs {
uint64 slot = 1;
repeated string blobs = 2;
}

View File

@@ -0,0 +1,22 @@
syntax = "proto3";
package beacon.block_meta.v1;
import "google/protobuf/timestamp.proto";
message BlockMeta {
uint64 slot = 1;
string root = 2;
string state_root = 3;
Spec spec = 4;
google.protobuf.Timestamp timestamp = 5;
}
enum Spec {
UNSPECIFIED = 0;
PHASE0 = 1;
ALTAIR = 2;
BELLATRIX = 3;
CAPELLA = 4;
DENEB = 5;
}

View File

@@ -0,0 +1,4 @@
[toolchain]
channel = "1.69"
components = [ "rustfmt" ]
targets = [ "wasm32-unknown-unknown" ]

View File

@@ -0,0 +1,4 @@
mod map_block_meta;
mod map_block_full;
mod map_blobs;
mod pb;

View File

@@ -0,0 +1,15 @@
use substreams::Hex;
use crate::pb::beacon::blobs::v1::Blobs;
use crate::pb::sf::beacon::r#type::v1::{block::Body::*, Block};
#[substreams::handlers::map]
fn map_blobs(blk: Block) -> Result<Blobs, substreams::errors::Error> {
Ok(Blobs {
slot: blk.slot,
blobs: match blk.body {
Some(Deneb(body)) => body.embedded_blobs.into_iter().map(|b| Hex::encode(&b.blob)).collect(),
_ => vec![],
},
})
}

View File

@@ -0,0 +1,6 @@
use crate::pb::sf::beacon::r#type::v1::Block;
#[substreams::handlers::map]
fn map_block_full(blk: Block) -> Result<Block, substreams::errors::Error> {
Ok(blk)
}

View File

@@ -0,0 +1,15 @@
use substreams::Hex;
use crate::pb::beacon::block_meta::v1::BlockMeta;
use crate::pb::sf::beacon::r#type::v1::Block;
#[substreams::handlers::map]
fn map_block_meta(blk: Block) -> Result<BlockMeta, substreams::errors::Error> {
Ok(BlockMeta {
slot: blk.slot,
root: Hex::encode(&blk.root),
state_root: Hex::encode(&blk.state_root),
spec: blk.spec,
timestamp: blk.timestamp,
})
}

View File

@@ -0,0 +1,10 @@
// @generated
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Blobs {
#[prost(uint64, tag="1")]
pub slot: u64,
#[prost(string, repeated, tag="2")]
pub blobs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
// @@protoc_insertion_point(module)

View File

@@ -0,0 +1,54 @@
// @generated
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BlockMeta {
#[prost(uint64, tag="1")]
pub slot: u64,
#[prost(string, tag="2")]
pub root: ::prost::alloc::string::String,
#[prost(string, tag="3")]
pub state_root: ::prost::alloc::string::String,
#[prost(enumeration="Spec", tag="4")]
pub spec: i32,
#[prost(message, optional, tag="5")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Spec {
Unspecified = 0,
Phase0 = 1,
Altair = 2,
Bellatrix = 3,
Capella = 4,
Deneb = 5,
}
impl Spec {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Spec::Unspecified => "UNSPECIFIED",
Spec::Phase0 => "PHASE0",
Spec::Altair => "ALTAIR",
Spec::Bellatrix => "BELLATRIX",
Spec::Capella => "CAPELLA",
Spec::Deneb => "DENEB",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNSPECIFIED" => Some(Self::Unspecified),
"PHASE0" => Some(Self::Phase0),
"ALTAIR" => Some(Self::Altair),
"BELLATRIX" => Some(Self::Bellatrix),
"CAPELLA" => Some(Self::Capella),
"DENEB" => Some(Self::Deneb),
_ => None,
}
}
}
// @@protoc_insertion_point(module)

View File

@@ -0,0 +1,28 @@
// @generated
pub mod beacon {
pub mod blobs {
// @@protoc_insertion_point(attribute:beacon.blobs.v1)
pub mod v1 {
include!("beacon.blobs.v1.rs");
// @@protoc_insertion_point(beacon.blobs.v1)
}
}
pub mod block_meta {
// @@protoc_insertion_point(attribute:beacon.block_meta.v1)
pub mod v1 {
include!("beacon.block_meta.v1.rs");
// @@protoc_insertion_point(beacon.block_meta.v1)
}
}
}
pub mod sf {
pub mod beacon {
pub mod r#type {
// @@protoc_insertion_point(attribute:sf.beacon.type.v1)
pub mod v1 {
include!("sf.beacon.type.v1.rs");
// @@protoc_insertion_point(sf.beacon.type.v1)
}
}
}
}

View File

@@ -0,0 +1,487 @@
// @generated
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Block {
#[prost(uint32, tag="1")]
pub version: u32,
#[prost(enumeration="Spec", tag="2")]
pub spec: i32,
#[prost(uint64, tag="3")]
pub slot: u64,
#[prost(uint64, tag="4")]
pub parent_slot: u64,
#[prost(bytes="vec", tag="5")]
pub root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="6")]
pub parent_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="7")]
pub state_root: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag="8")]
pub proposer_index: u64,
#[prost(bytes="vec", tag="9")]
pub body_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="30")]
pub signature: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="31")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
#[prost(oneof="block::Body", tags="20, 21, 22, 23, 24")]
pub body: ::core::option::Option<block::Body>,
}
/// Nested message and enum types in `Block`.
pub mod block {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Body {
#[prost(message, tag="20")]
Phase0(super::Phase0Body),
#[prost(message, tag="21")]
Altair(super::AltairBody),
#[prost(message, tag="22")]
Bellatrix(super::BellatrixBody),
#[prost(message, tag="23")]
Capella(super::CapellaBody),
#[prost(message, tag="24")]
Deneb(super::DenebBody),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Phase0Body {
#[prost(bytes="vec", tag="1")]
pub rando_reveal: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="2")]
pub eth1_data: ::core::option::Option<Eth1Data>,
#[prost(bytes="vec", tag="3")]
pub graffiti: ::prost::alloc::vec::Vec<u8>,
#[prost(message, repeated, tag="4")]
pub proposer_slashings: ::prost::alloc::vec::Vec<ProposerSlashing>,
#[prost(message, repeated, tag="5")]
pub attester_slashings: ::prost::alloc::vec::Vec<AttesterSlashing>,
#[prost(message, repeated, tag="6")]
pub attestations: ::prost::alloc::vec::Vec<Attestation>,
#[prost(message, repeated, tag="7")]
pub deposits: ::prost::alloc::vec::Vec<Deposit>,
#[prost(message, repeated, tag="8")]
pub voluntary_exits: ::prost::alloc::vec::Vec<SignedVoluntaryExit>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AltairBody {
#[prost(bytes="vec", tag="1")]
pub rando_reveal: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="2")]
pub eth1_data: ::core::option::Option<Eth1Data>,
#[prost(bytes="vec", tag="3")]
pub graffiti: ::prost::alloc::vec::Vec<u8>,
#[prost(message, repeated, tag="4")]
pub proposer_slashings: ::prost::alloc::vec::Vec<ProposerSlashing>,
#[prost(message, repeated, tag="5")]
pub attester_slashings: ::prost::alloc::vec::Vec<AttesterSlashing>,
#[prost(message, repeated, tag="6")]
pub attestations: ::prost::alloc::vec::Vec<Attestation>,
#[prost(message, repeated, tag="7")]
pub deposits: ::prost::alloc::vec::Vec<Deposit>,
#[prost(message, repeated, tag="8")]
pub voluntary_exits: ::prost::alloc::vec::Vec<SignedVoluntaryExit>,
#[prost(message, optional, tag="9")]
pub sync_aggregate: ::core::option::Option<SyncAggregate>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BellatrixBody {
#[prost(bytes="vec", tag="1")]
pub rando_reveal: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="2")]
pub eth1_data: ::core::option::Option<Eth1Data>,
#[prost(bytes="vec", tag="3")]
pub graffiti: ::prost::alloc::vec::Vec<u8>,
#[prost(message, repeated, tag="4")]
pub proposer_slashings: ::prost::alloc::vec::Vec<ProposerSlashing>,
#[prost(message, repeated, tag="5")]
pub attester_slashings: ::prost::alloc::vec::Vec<AttesterSlashing>,
#[prost(message, repeated, tag="6")]
pub attestations: ::prost::alloc::vec::Vec<Attestation>,
#[prost(message, repeated, tag="7")]
pub deposits: ::prost::alloc::vec::Vec<Deposit>,
#[prost(message, repeated, tag="8")]
pub voluntary_exits: ::prost::alloc::vec::Vec<SignedVoluntaryExit>,
#[prost(message, optional, tag="9")]
pub sync_aggregate: ::core::option::Option<SyncAggregate>,
#[prost(message, optional, tag="10")]
pub execution_payload: ::core::option::Option<BellatrixExecutionPayload>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CapellaBody {
#[prost(bytes="vec", tag="1")]
pub rando_reveal: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="2")]
pub eth1_data: ::core::option::Option<Eth1Data>,
#[prost(bytes="vec", tag="3")]
pub graffiti: ::prost::alloc::vec::Vec<u8>,
#[prost(message, repeated, tag="4")]
pub proposer_slashings: ::prost::alloc::vec::Vec<ProposerSlashing>,
#[prost(message, repeated, tag="5")]
pub attester_slashings: ::prost::alloc::vec::Vec<AttesterSlashing>,
#[prost(message, repeated, tag="6")]
pub attestations: ::prost::alloc::vec::Vec<Attestation>,
#[prost(message, repeated, tag="7")]
pub deposits: ::prost::alloc::vec::Vec<Deposit>,
#[prost(message, repeated, tag="8")]
pub voluntary_exits: ::prost::alloc::vec::Vec<SignedVoluntaryExit>,
#[prost(message, optional, tag="9")]
pub sync_aggregate: ::core::option::Option<SyncAggregate>,
#[prost(message, optional, tag="10")]
pub execution_payload: ::core::option::Option<CapellaExecutionPayload>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DenebBody {
#[prost(bytes="vec", tag="1")]
pub rando_reveal: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="2")]
pub eth1_data: ::core::option::Option<Eth1Data>,
#[prost(bytes="vec", tag="3")]
pub graffiti: ::prost::alloc::vec::Vec<u8>,
#[prost(message, repeated, tag="4")]
pub proposer_slashings: ::prost::alloc::vec::Vec<ProposerSlashing>,
#[prost(message, repeated, tag="5")]
pub attester_slashings: ::prost::alloc::vec::Vec<AttesterSlashing>,
#[prost(message, repeated, tag="6")]
pub attestations: ::prost::alloc::vec::Vec<Attestation>,
#[prost(message, repeated, tag="7")]
pub deposits: ::prost::alloc::vec::Vec<Deposit>,
#[prost(message, repeated, tag="8")]
pub voluntary_exits: ::prost::alloc::vec::Vec<SignedVoluntaryExit>,
#[prost(message, optional, tag="9")]
pub sync_aggregate: ::core::option::Option<SyncAggregate>,
#[prost(message, optional, tag="10")]
pub execution_payload: ::core::option::Option<DenebExecutionPayload>,
#[prost(message, repeated, tag="11")]
pub bls_to_execution_changes: ::prost::alloc::vec::Vec<SignedBlsToExecutionChange>,
#[prost(bytes="vec", repeated, tag="12")]
pub blob_kzg_commitments: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
#[prost(message, repeated, tag="20")]
pub embedded_blobs: ::prost::alloc::vec::Vec<Blob>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Eth1Data {
#[prost(bytes="vec", tag="1")]
pub deposit_root: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag="2")]
pub deposit_count: u64,
#[prost(bytes="vec", tag="3")]
pub block_hash: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProposerSlashing {
#[prost(message, optional, tag="1")]
pub signed_header_1: ::core::option::Option<SignedBeaconBlockHeader>,
#[prost(message, optional, tag="2")]
pub signed_header_2: ::core::option::Option<SignedBeaconBlockHeader>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AttesterSlashing {
#[prost(message, optional, tag="1")]
pub attestation_1: ::core::option::Option<IndexedAttestation>,
#[prost(message, optional, tag="2")]
pub attestation_2: ::core::option::Option<IndexedAttestation>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Attestation {
#[prost(bytes="vec", tag="1")]
pub aggregation_bits: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="2")]
pub data: ::core::option::Option<AttestationData>,
#[prost(bytes="vec", tag="3")]
pub signature: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Deposit {
#[prost(bytes="vec", repeated, tag="1")]
pub proof: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
#[prost(message, optional, tag="2")]
pub data: ::core::option::Option<DepositData>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SignedVoluntaryExit {
#[prost(message, optional, tag="1")]
pub message: ::core::option::Option<VoluntaryExit>,
#[prost(bytes="vec", tag="2")]
pub signature: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SyncAggregate {
#[prost(bytes="vec", tag="1")]
pub sync_commitee_bits: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="2")]
pub sync_comittee_signature: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BellatrixExecutionPayload {
#[prost(bytes="vec", tag="1")]
pub parent_hash: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="2")]
pub fee_recipient: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="3")]
pub state_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="4")]
pub receipts_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="5")]
pub logs_bloom: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="6")]
pub prev_randao: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag="7")]
pub block_number: u64,
#[prost(uint64, tag="8")]
pub gas_limit: u64,
#[prost(uint64, tag="9")]
pub gas_used: u64,
#[prost(message, optional, tag="10")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
#[prost(bytes="vec", tag="11")]
pub extra_data: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="12")]
pub base_fee_per_gas: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="13")]
pub block_hash: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", repeated, tag="14")]
pub transactions: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CapellaExecutionPayload {
#[prost(bytes="vec", tag="1")]
pub parent_hash: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="2")]
pub fee_recipient: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="3")]
pub state_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="4")]
pub receipts_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="5")]
pub logs_bloom: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="6")]
pub prev_randao: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag="7")]
pub block_number: u64,
#[prost(uint64, tag="8")]
pub gas_limit: u64,
#[prost(uint64, tag="9")]
pub gas_used: u64,
#[prost(message, optional, tag="10")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
#[prost(bytes="vec", tag="11")]
pub extra_data: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="12")]
pub base_fee_per_gas: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="13")]
pub block_hash: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", repeated, tag="14")]
pub transactions: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
#[prost(message, repeated, tag="15")]
pub withdrawals: ::prost::alloc::vec::Vec<Withdrawal>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DenebExecutionPayload {
#[prost(bytes="vec", tag="1")]
pub parent_hash: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="2")]
pub fee_recipient: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="3")]
pub state_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="4")]
pub receipts_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="5")]
pub logs_bloom: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="6")]
pub prev_randao: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag="7")]
pub block_number: u64,
#[prost(uint64, tag="8")]
pub gas_limit: u64,
#[prost(uint64, tag="9")]
pub gas_used: u64,
#[prost(message, optional, tag="10")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
#[prost(bytes="vec", tag="11")]
pub extra_data: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="12")]
pub base_fee_per_gas: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="13")]
pub block_hash: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", repeated, tag="14")]
pub transactions: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
#[prost(message, repeated, tag="15")]
pub withdrawals: ::prost::alloc::vec::Vec<Withdrawal>,
#[prost(uint64, tag="16")]
pub blob_gas_used: u64,
#[prost(uint64, tag="17")]
pub excess_blob_gas: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SignedBlsToExecutionChange {
#[prost(message, optional, tag="1")]
pub message: ::core::option::Option<BlsToExecutionChange>,
#[prost(bytes="vec", tag="2")]
pub signature: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BlsToExecutionChange {
#[prost(uint64, tag="1")]
pub validator_index: u64,
#[prost(bytes="vec", tag="2")]
pub from_bls_pub_key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="3")]
pub to_execution_address: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Withdrawal {
#[prost(uint64, tag="1")]
pub withdrawal_index: u64,
#[prost(uint64, tag="2")]
pub validator_index: u64,
#[prost(bytes="vec", tag="3")]
pub address: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag="4")]
pub gwei: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VoluntaryExit {
#[prost(uint64, tag="1")]
pub epoch: u64,
#[prost(uint64, tag="2")]
pub validator_index: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DepositData {
#[prost(bytes="vec", tag="1")]
pub public_key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="2")]
pub withdrawal_credentials: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag="3")]
pub gwei: u64,
#[prost(bytes="vec", tag="4")]
pub signature: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IndexedAttestation {
#[prost(uint64, repeated, tag="1")]
pub attesting_indices: ::prost::alloc::vec::Vec<u64>,
#[prost(message, optional, tag="2")]
pub data: ::core::option::Option<AttestationData>,
#[prost(bytes="vec", tag="3")]
pub signature: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AttestationData {
#[prost(uint64, tag="1")]
pub slot: u64,
#[prost(uint64, tag="2")]
pub committee_index: u64,
#[prost(bytes="vec", tag="3")]
pub beacon_block_root: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="4")]
pub source: ::core::option::Option<Checkpoint>,
#[prost(message, optional, tag="5")]
pub target: ::core::option::Option<Checkpoint>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Checkpoint {
#[prost(uint64, tag="1")]
pub epoch: u64,
#[prost(bytes="vec", tag="2")]
pub root: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SignedBeaconBlockHeader {
#[prost(message, optional, tag="1")]
pub message: ::core::option::Option<BeaconBlockHeader>,
#[prost(bytes="vec", tag="2")]
pub signature: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BeaconBlockHeader {
#[prost(uint64, tag="1")]
pub slot: u64,
#[prost(uint64, tag="2")]
pub proposer_index: u64,
#[prost(bytes="vec", tag="3")]
pub parent_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="4")]
pub state_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="5")]
pub body_root: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Blob {
#[prost(uint64, tag="1")]
pub index: u64,
#[prost(bytes="vec", tag="2")]
pub blob: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="3")]
pub kzg_commitment: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="4")]
pub kzg_proof: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", repeated, tag="5")]
pub kzg_commitment_inclusion_proof: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Spec {
Unspecified = 0,
Phase0 = 1,
Altair = 2,
Bellatrix = 3,
Capella = 4,
Deneb = 5,
}
impl Spec {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Spec::Unspecified => "UNSPECIFIED",
Spec::Phase0 => "PHASE0",
Spec::Altair => "ALTAIR",
Spec::Bellatrix => "BELLATRIX",
Spec::Capella => "CAPELLA",
Spec::Deneb => "DENEB",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNSPECIFIED" => Some(Self::Unspecified),
"PHASE0" => Some(Self::Phase0),
"ALTAIR" => Some(Self::Altair),
"BELLATRIX" => Some(Self::Bellatrix),
"CAPELLA" => Some(Self::Capella),
"DENEB" => Some(Self::Deneb),
_ => None,
}
}
}
// @@protoc_insertion_point(module)

View File

@@ -0,0 +1,51 @@
specVersion: v0.1.0
package:
name: "beacon_explorer"
image: ./ethereum.png
url: "http://github.com/streamingfast/substreams-explorers/"
version: v0.1.0
imports:
beacon: https://github.com/pinax-network/firehose-beacon/releases/download/v0.1.1/beacon-v0.1.1.spkg
network: beacon
protobuf:
files:
- block_meta.proto
- blobs.proto
importPaths:
- ./proto
binaries:
default:
type: wasm/rust-v1
file: ./target/wasm32-unknown-unknown/release/substreams.wasm
modules:
- name: map_block_meta
kind: map
inputs:
- source: sf.beacon.type.v1.Block
output:
type: proto:beacon.block_meta.v1.BlockMeta
doc: |
`map_block_meta` allows you to view a basic information about a block
- name: map_block_full
kind: map
inputs:
- source: sf.beacon.type.v1.Block
output:
type: proto:sf.beacon.type.v1.Block
doc: |
`map_block_full` allows you to view a complete block, as received by a Substreams module
- name: map_blobs
kind: map
inputs:
- source: sf.beacon.type.v1.Block
output:
type: proto:beacon.blobs.v1.Blobs
doc: |
`map_blobs` allows you to view blobs inside a block

View File

@@ -4,7 +4,7 @@ The Bitcoin Explorer consists of several Substreams modules showcasing the most
## Before You Begin
Make sure you have the [Substreams CLI installed](https://substreams.streamingfast.io/getting-started/installing-the-cli), and you know the [basic structure of a Substreams module](https://substreams.streamingfast.io/getting-started/quickstart). You must also provide an [authentication token](https://substreams.streamingfast.io/reference-and-specs/authentication).
Make sure you have the [Substreams CLI installed](https://substreams.streamingfast.io/getting-started/installing-the-cli), and you know the [basic structure of a Substreams module](https://substreams.streamingfast.io/documentation/intro-getting-started). You must also provide an [authentication token](https://substreams.streamingfast.io/documentation/consume/authentication).
## Modules

View File

@@ -8,7 +8,7 @@ package:
This packages holds simple modules to allow you to explore the Bitcoin data model.
imports:
bitcoin: ../../firehose-bitcoin/substreams/bitcoin-v1.0.0.spkg
bitcoin: https://github.com/streamingfast/firehose-bitcoin/releases/download/v1.0.0/substreams-bitcoin-v1.0.0.spkg
network: btc-mainnet

View File

@@ -781,15 +781,16 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "substreams"
version = "0.5.10"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af972e374502cdfc9998132f5343848d1c58f27a295dc061a89804371f408a46"
checksum = "3520661f782c338f0e3c6cfc001ac790ed5e68d8f28515139e2aa674f8bb54da"
dependencies = [
"anyhow",
"bigdecimal",
"hex",
"hex-literal",
"num-bigint",
"num-integer",
"num-traits",
"pad",
"prost",
@@ -801,9 +802,9 @@ dependencies = [
[[package]]
name = "substreams-ethereum"
version = "0.9.3"
version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0bd6c3ecb69e76111515d8087080ce7a750f41df79de221d24ab76bc3efe81e"
checksum = "8bd2614efbfe4fc3f9e5bc342d68b6d5a20640b2e3c2258094c7bce59ea29667"
dependencies = [
"getrandom",
"num-bigint",
@@ -815,9 +816,9 @@ dependencies = [
[[package]]
name = "substreams-ethereum-abigen"
version = "0.9.3"
version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "894803ed2422e63afac798ae1370faf6897d9200b53c03aa53b4945ea28cdc3d"
checksum = "c7e52092b876ccda2087dd08cf769398c3dce591de3a3f46570d5596b8fd6144"
dependencies = [
"anyhow",
"ethabi",
@@ -832,9 +833,9 @@ dependencies = [
[[package]]
name = "substreams-ethereum-core"
version = "0.9.3"
version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49a7a83144082aafd061f36bc68a20f1a2b3b8774ec58cd0dabd222a3f606a0c"
checksum = "06601ff5192dc844f4c48961f196b12104e4cbf47dcfdef78ba77d10358b1109"
dependencies = [
"bigdecimal",
"ethabi",
@@ -848,9 +849,9 @@ dependencies = [
[[package]]
name = "substreams-ethereum-derive"
version = "0.9.3"
version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac19d40bbdf62261b6acca3a7e43f8ad68b5bc76ca41a8822988c757b2b0d9e9"
checksum = "01728bb412313d36b376be0aed38a8ca7dfbc28adaa658e3df47530b528b4c64"
dependencies = [
"ethabi",
"heck",
@@ -872,6 +873,7 @@ dependencies = [
"hex-literal",
"num-bigint",
"prost",
"prost-types",
"serde",
"serde_qs",
"substreams",
@@ -880,9 +882,9 @@ dependencies = [
[[package]]
name = "substreams-macro"
version = "0.5.10"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6521ccd011a4c3f52cd3c31fc7400733e4feba2094e0e0e6354adca25b2b3f37"
checksum = "c15595ceab80fece579e462d4823048fe85d67922584c681f5e94305727ad9ee"
dependencies = [
"proc-macro2",
"quote",

View File

@@ -15,6 +15,7 @@ ethabi = "17"
hex-literal = "0.3"
num-bigint = "0.4"
prost = "0.11"
prost-types = "0.11"
# Use latest from https://crates.io/crates/substreams
substreams = "0.5"
# Use latest from https://crates.io/crates/substreams-ethereum

View File

@@ -1,6 +1,6 @@
.PHONY: protogen
protogen:
substreams protogen ./substreams.yaml --exclude-paths="sf/substreams,google"
substreams protogen ./substreams.yaml --exclude-paths="sf/ethereum,sf/substreams,google"
.PHONY: build
build:

View File

@@ -4,7 +4,7 @@ The Ethereum Explorer consists of several Substreams modules showcasing the most
## Before You Begin
Make sure you have the [Substreams CLI installed](https://substreams.streamingfast.io/getting-started/installing-the-cli), and you know the [basic structure of a Substreams module](https://substreams.streamingfast.io/getting-started/quickstart). You must also provide an [authentication token](https://substreams.streamingfast.io/reference-and-specs/authentication).
Make sure you have the [Substreams CLI installed](https://substreams.streamingfast.io/getting-started/installing-the-cli), and you know the [basic structure of a Substreams module](https://substreams.streamingfast.io/documentation/intro-getting-started/intro-evm). You must also provide an [authentication token](https://substreams.streamingfast.io/documentation/consume/authentication).
## Modules
@@ -20,7 +20,7 @@ Given any combination of two parameters (`from` and `to`), the `map_filter_trans
1. Providing the filters (only the `from` fields, only the `to` field, both `from` and `to` fields, or none)
1. Iterating over all the transactions.
2. Filter the transactions, according to the parameters provided. For example, `from == tx_from`, `from == tx_from and to == tx_to`.
1. Filter the transactions, according to the parameters provided. For example, `from == tx_from`, `from == tx_from and to == tx_to`.
### How Can You Retrieve All the Events for a Specific Smart Contract?
@@ -255,7 +255,7 @@ all done
### Running the "map_contract_events" Module
To run this module, you must provide the address of a smart contract. By default, the `params` section of the Substreams manifest contains the `0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d` address, corresponding to the Bore Yacht Club smart contract. You can change this address to track any smart contract.
To run this module, you must provide the address of a smart contract. By default, the `params` section of the Substreams manifest contains the `0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d` address, corresponding to the Bored Ape Yacht Club smart contract. You can change this address to track any smart contract.
The logs of a smart contract might be split across thousands of Ethereum blocks, so for testing purposes, and to avoid iterating over the full blockchain, the following command limits starts searching at block number `17717995`.

View File

@@ -13,9 +13,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.75"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]]
name = "autocfg"
@@ -36,15 +36,9 @@ dependencies = [
[[package]]
name = "bitflags"
version = "1.3.2"
version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
[[package]]
name = "bs58"
@@ -66,9 +60,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "either"
version = "1.9.0"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
[[package]]
name = "equivalent"
@@ -78,9 +72,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.5"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860"
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
dependencies = [
"libc",
"windows-sys",
@@ -100,9 +94,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
[[package]]
name = "getrandom"
version = "0.2.10"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
dependencies = [
"cfg-if",
"libc",
@@ -111,9 +105,9 @@ dependencies = [
[[package]]
name = "hashbrown"
version = "0.14.2"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
[[package]]
name = "heck"
@@ -135,18 +129,18 @@ checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0"
[[package]]
name = "home"
version = "0.5.5"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb"
checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"
dependencies = [
"windows-sys",
]
[[package]]
name = "indexmap"
version = "2.0.2"
version = "2.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897"
checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177"
dependencies = [
"equivalent",
"hashbrown",
@@ -169,15 +163,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.149"
version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "linux-raw-sys"
version = "0.4.10"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f"
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
[[package]]
name = "log"
@@ -187,9 +181,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "memchr"
version = "2.6.4"
version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
[[package]]
name = "multimap"
@@ -210,19 +204,18 @@ dependencies = [
[[package]]
name = "num-integer"
version = "0.1.45"
version = "0.1.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
dependencies = [
"autocfg",
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.17"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
dependencies = [
"autocfg",
]
@@ -245,14 +238,14 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]
[[package]]
name = "once_cell"
version = "1.18.0"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "pad"
@@ -265,9 +258,9 @@ dependencies = [
[[package]]
name = "percent-encoding"
version = "2.3.0"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "petgraph"
@@ -300,9 +293,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.69"
version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
dependencies = [
"unicode-ident",
]
@@ -363,27 +356,18 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.33"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
[[package]]
name = "redox_syscall"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "regex"
version = "1.10.2"
version = "1.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
dependencies = [
"aho-corasick",
"memchr",
@@ -393,9 +377,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.3"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd"
dependencies = [
"aho-corasick",
"memchr",
@@ -410,11 +394,11 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "rustix"
version = "0.38.21"
version = "0.38.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3"
checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949"
dependencies = [
"bitflags 2.4.1",
"bitflags",
"errno",
"libc",
"linux-raw-sys",
@@ -423,22 +407,22 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.190"
version = "1.0.196"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7"
checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.190"
version = "1.0.196"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3"
checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]
[[package]]
@@ -454,15 +438,16 @@ dependencies = [
[[package]]
name = "substreams"
version = "0.5.10"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af972e374502cdfc9998132f5343848d1c58f27a295dc061a89804371f408a46"
checksum = "3520661f782c338f0e3c6cfc001ac790ed5e68d8f28515139e2aa674f8bb54da"
dependencies = [
"anyhow",
"bigdecimal",
"hex",
"hex-literal",
"num-bigint",
"num-integer",
"num-traits",
"pad",
"prost",
@@ -474,9 +459,9 @@ dependencies = [
[[package]]
name = "substreams-macro"
version = "0.5.10"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6521ccd011a4c3f52cd3c31fc7400733e4feba2094e0e0e6354adca25b2b3f37"
checksum = "c15595ceab80fece579e462d4823048fe85d67922584c681f5e94305727ad9ee"
dependencies = [
"proc-macro2",
"quote",
@@ -556,9 +541,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.38"
version = "2.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
dependencies = [
"proc-macro2",
"quote",
@@ -567,35 +552,34 @@ dependencies = [
[[package]]
name = "tempfile"
version = "3.8.1"
version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67"
dependencies = [
"cfg-if",
"fastrand",
"redox_syscall",
"rustix",
"windows-sys",
]
[[package]]
name = "thiserror"
version = "1.0.50"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.50"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]
[[package]]
@@ -606,9 +590,9 @@ checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
[[package]]
name = "toml_edit"
version = "0.21.0"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03"
checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1"
dependencies = [
"indexmap",
"toml_datetime",
@@ -647,18 +631,18 @@ dependencies = [
[[package]]
name = "windows-sys"
version = "0.48.0"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.48.5"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
@@ -671,51 +655,51 @@ dependencies = [
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
[[package]]
name = "winnow"
version = "0.5.34"
version = "0.5.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16"
checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
dependencies = [
"memchr",
]

View File

@@ -6,6 +6,10 @@ protogen:
build:
cargo build --target wasm32-unknown-unknown --release
.PHONY: run
run: build
substreams run substreams.yaml $(if $(MODULE),$(MODULE),map_block_meta) $(if $(START_BLOCK),-s $(START_BLOCK)) $(if $(STOP_BLOCK),-t $(STOP_BLOCK)) $(if $(PARAMS),-p '$(PARAMS)')
.PHONY: package
package: build
substreams pack substreams.yaml

View File

@@ -4,7 +4,7 @@ The Solana Explorer consists of several Substreams modules showcasing the most b
## Before You Begin
Make sure you have the [Substreams CLI installed](https://substreams.streamingfast.io/getting-started/installing-the-cli), and you know the [basic structure of a Substreams module](https://substreams.streamingfast.io/getting-started/quickstart). You must also provide an [authentication token](https://substreams.streamingfast.io/reference-and-specs/authentication).
Make sure you have the [Substreams CLI installed](https://substreams.streamingfast.io/getting-started/installing-the-cli), and you know the [basic structure of a Substreams module](https://substreams.streamingfast.io/documentation/intro-getting-started/intro-solana). You must also provide an [authentication token](https://substreams.streamingfast.io/documentation/consume/authentication).
## Modules

View File

@@ -1,14 +1,11 @@
use substreams_solana::pb::sf::solana::r#type::v1::{Block, ConfirmedTransaction};
use substreams_solana::pb::sf::solana::r#type::v1::Block;
// Vote111111111111111111111111111111111111111
static VOTE_INSTRUCTION: &'static [u8] = &[7, 97, 72, 29, 53, 116, 116, 187, 124, 77, 118, 36, 235, 211, 189, 179, 216, 53, 94, 115, 209, 16, 67, 252, 13, 163, 83, 128, 0, 0, 0, 0];
#[substreams::handlers::map]
fn map_block_without_votes(block: Block) -> Result<Block, substreams::errors::Error> {
let mut block_cloned: Block = block.clone();
let filtered_transactions: Vec<ConfirmedTransaction> = block.transactions_owned()
.filter(|trx| {
fn map_block_without_votes(mut block: Block) -> Result<Block, substreams::errors::Error> {
block.transactions.retain(|trx| {
let meta = match trx.meta.as_ref() {
Some(meta) => meta,
None => return false,
@@ -16,6 +13,7 @@ fn map_block_without_votes(block: Block) -> Result<Block, substreams::errors::Er
if meta.err.is_some() {
return false;
}
let transaction = match trx.transaction.as_ref() {
Some(transaction) => transaction,
None => return false,
@@ -27,9 +25,7 @@ fn map_block_without_votes(block: Block) -> Result<Block, substreams::errors::Er
}
true
}).collect();
});
block_cloned.transactions = filtered_transactions;
Ok(block_cloned)
Ok(block)
}

View File

@@ -9,46 +9,39 @@ struct InstructionFilterParams {
}
#[substreams::handlers::map]
fn map_filter_instructions(params: String, blk: Block) -> Result<Instructions, Vec<substreams::errors::Error>> {
fn map_filter_instructions(params: String, blk: Block) -> Result<Instructions, substreams::errors::Error> {
let filters = parse_filters_from_params(params)?;
let mut instructions : Vec<Instruction> = Vec::new();
blk.transactions_owned().into_iter().for_each(|tx| {
let msg = tx.transaction.clone().unwrap().message.unwrap();
let instructions : Vec<Instruction> = blk.transactions().flat_map(|tx| {
let msg = tx.transaction.as_ref().unwrap().message.as_ref().unwrap();
let acct_keys = tx.resolved_accounts();
let insts : Vec<Instruction> = msg.instructions.iter()
msg.instructions.iter()
.filter(|inst| apply_filter(inst, &filters, &acct_keys))
.map(|inst| {
Instruction {
program_id: bs58::encode(acct_keys[inst.program_id_index as usize].to_vec()).into_string(),
accounts: inst.accounts.iter().map(|acct| bs58::encode(acct_keys[*acct as usize].to_vec()).into_string()).collect(),
data: bs58::encode(inst.data.clone()).into_string(),
data: bs58::encode(&inst.data).into_string(),
}
}).collect::<Vec<_>>()
}).collect();
instructions.extend(insts);
});
Ok(Instructions { instructions })
}
fn parse_filters_from_params(params: String) -> Result<InstructionFilterParams, Vec<substreams::errors::Error>> {
let parsed_result = serde_qs::from_str(&params);
if parsed_result.is_err() {
return Err(Vec::from([anyhow!("Unexpected error while parsing parameters")]));
fn parse_filters_from_params(params: String) -> Result<InstructionFilterParams, substreams::errors::Error> {
match serde_qs::from_str(&params) {
Ok(filters) => Ok(filters),
Err(e) => Err(anyhow!("Failed to parse filters from params: {}", e))
}
let filters = parsed_result.unwrap();
//todo: verify_filters(&filters)?;
Ok(filters)
}
fn apply_filter(instruction: &CompiledInstruction, filters: &InstructionFilterParams, account_keys: &Vec<&Vec<u8>>) -> bool {
if filters.program_id.is_none() {
return true;
}
let program_id_filter = filters.program_id.clone().unwrap();
let program_id_filter = filters.program_id.as_ref().unwrap();
let program_account_key = account_keys.get(instruction.program_id_index as usize);
if program_account_key.is_none() {
@@ -56,7 +49,7 @@ fn apply_filter(instruction: &CompiledInstruction, filters: &InstructionFilterPa
}
let program_account_key_val = bs58::encode(program_account_key.unwrap()).into_string();
if program_account_key_val != program_id_filter {
if &program_account_key_val != program_id_filter {
return false;
}

View File

@@ -18,7 +18,7 @@ fn map_filter_transactions(params: String, blk: Block) -> Result<Transactions, V
.iter()
.filter(|tx| apply_filter(tx, &filters))
.for_each(|tx| {
let msg = tx.transaction.clone().unwrap().message.unwrap();
let msg = tx.transaction.as_ref().unwrap().message.as_ref().unwrap();
let acct_keys = tx.resolved_accounts();
let insts: Vec<Instruction> = msg
@@ -31,14 +31,14 @@ fn map_filter_transactions(params: String, blk: Block) -> Result<Transactions, V
.iter()
.map(|acct| bs58::encode(acct_keys[*acct as usize].to_vec()).into_string())
.collect(),
data: bs58::encode(inst.data.clone()).into_string(),
data: bs58::encode(&inst.data).into_string(),
})
.collect();
let t = Transaction {
signatures: tx
.transaction
.clone()
.as_ref()
.unwrap()
.signatures
.iter()