diff --git a/Cargo.toml b/Cargo.toml index 5deaf0d..f88359f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,7 @@ members = [ "antelope.trxstats", "bitcoin.ordinals", "sx.stats", + "blocks", ] [workspace.dependencies] diff --git a/blocks/Cargo.toml b/blocks/Cargo.toml new file mode 100644 index 0000000..aad3d1a --- /dev/null +++ b/blocks/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "blocks" +version = "0.1.0" +authors = ["Yaro "] +description = "Blocks Substream" +license = "MIT OR Apache-2.0" +edition = "2021" +publish = false + +[badges] +maintenance = { status = "actively-developed" } + +[lib] +crate-type = ["cdylib"] + +[dependencies] +prost = { workspace = true } +prost-types = { workspace = true } +substreams = { workspace = true } diff --git a/blocks/Makefile b/blocks/Makefile new file mode 100644 index 0000000..1867545 --- /dev/null +++ b/blocks/Makefile @@ -0,0 +1,24 @@ +.PHONY: all +all: + make build + make pack + make graph + make info + +.PHONY: build +build: + cargo build --target wasm32-unknown-unknown --release + +.PHONY: pack +pack: + substreams pack + +.PHONY: graph +graph: + substreams graph + +.PHONY: info +info: + substreams info + +%: ; @substreams gui -e $@.substreams.pinax.network:443 map_blocks -s -5 diff --git a/blocks/README.md b/blocks/README.md new file mode 100644 index 0000000..a36afea --- /dev/null +++ b/blocks/README.md @@ -0,0 +1,36 @@ +# Clock Substream + +> Common "clock" substream that works for any substreams-instrumented firehose endpoint + +## Usage +```bash +$ make build + +$ make eth +$ make bitcoin +$ make bsc +$ make eos +``` + +## Graph +```mermaid +graph TD; + map_blocks[map: map_blocks]; + sf.substreams.v1.Clock[source: sf.substreams.v1.Clock] --> map_blocks; + +``` + +## Info +```yaml +Package name: blocks +Version: v0.1.0 +Doc: Blocks +Modules: +---- +Name: map_blocks +Initial block: 2 +Kind: map +Input: source: sf.substreams.v1.Clock +Output Type: proto:sf.substreams.v1.Clock +Hash: 44c506941d5f30db6cca01692624395d1ac40cd1 +``` \ No newline at end of file diff --git a/blocks/src/lib.rs b/blocks/src/lib.rs new file mode 100644 index 0000000..752af05 --- /dev/null +++ b/blocks/src/lib.rs @@ -0,0 +1,6 @@ +use substreams::pb::substreams::Clock; + +#[substreams::handlers::map] +pub fn map_blocks(clock: Clock) -> Result { + Ok(clock) +} diff --git a/blocks/substreams.yaml b/blocks/substreams.yaml new file mode 100644 index 0000000..6231eb1 --- /dev/null +++ b/blocks/substreams.yaml @@ -0,0 +1,20 @@ +specVersion: v0.1.0 +package: + name: blocks + version: v0.1.0 + url: https://github.com/pinax-network/substreams + doc: Blocks + +binaries: + default: + type: wasm/rust-v1 + file: ../target/wasm32-unknown-unknown/release/blocks.wasm + +modules: + - name: map_blocks + kind: map + initialBlock: 2 + inputs: + - source: sf.substreams.v1.Clock + output: + type: proto:sf.substreams.v1.Clock