-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e16f95
commit 823aa18
Showing
13 changed files
with
109 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
CARGO_VERSION := $(shell cargo version 2>/dev/null) | ||
|
||
.PHONY: protogen | ||
protogen: | ||
substreams protogen ./substreams.yaml --exclude-paths="sf/substreams,google" | ||
|
||
.PHONY: build | ||
build: protogen | ||
ifdef CARGO_VERSION | ||
cargo build --target wasm32-unknown-unknown --release | ||
else | ||
@echo "Building substreams target using Docker. To speed up this step, install a Rust development environment." | ||
docker run --rm -ti --init -v ${PWD}:/usr/src --workdir /usr/src/ rust:bullseye cargo build --target wasm32-unknown-unknown --release | ||
endif | ||
|
||
.PHONY: run | ||
run: build | ||
substreams run substreams.yaml $(if $(MODULE),$(MODULE),map_events) $(if $(START_BLOCK),-s $(START_BLOCK)) $(if $(STOP_BLOCK),-t $(STOP_BLOCK)) | ||
|
||
.PHONY: gui | ||
gui: build | ||
substreams gui substreams.yaml $(if $(MODULE),$(MODULE),map_events) $(if $(START_BLOCK),-s $(START_BLOCK)) $(if $(STOP_BLOCK),-t $(STOP_BLOCK)) | ||
|
||
.PHONY: all | ||
all: protogen build package | ||
|
||
.PHONY: package | ||
package: build | ||
substreams pack substreams.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
CARGO_VERSION := $(shell cargo version 2>/dev/null) | ||
|
||
.PHONY: protogen | ||
protogen: | ||
substreams protogen ./substreams.yaml --exclude-paths="sf/substreams,google" | ||
|
||
.PHONY: build | ||
build: protogen | ||
ifdef CARGO_VERSION | ||
cargo build --target wasm32-unknown-unknown --release | ||
else | ||
@echo "Building substreams target using Docker. To speed up this step, install a Rust development environment." | ||
docker run --rm -ti --init -v ${PWD}:/usr/src --workdir /usr/src/ rust:bullseye cargo build --target wasm32-unknown-unknown --release | ||
endif | ||
|
||
.PHONY: run | ||
run: build | ||
substreams run substreams.yaml $(if $(MODULE),$(MODULE),map_events) $(if $(START_BLOCK),-s $(START_BLOCK)) $(if $(STOP_BLOCK),-t $(STOP_BLOCK)) | ||
|
||
.PHONY: gui | ||
gui: build | ||
substreams gui substreams.yaml $(if $(MODULE),$(MODULE),map_events) $(if $(START_BLOCK),-s $(START_BLOCK)) $(if $(STOP_BLOCK),-t $(STOP_BLOCK)) | ||
|
||
.PHONY: all | ||
all: protogen build package | ||
|
||
.PHONY: package | ||
package: build | ||
substreams pack substreams.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
mod abi; | ||
mod pb; | ||
use hex_literal::hex; | ||
use pb::mydata::v1 as mydata; | ||
|
||
// use substreams::prelude::*; | ||
// use substreams::store; | ||
|
||
use substreams::Hex; | ||
use substreams_ethereum::pb::eth::v2 as eth; | ||
// use substreams_ethereum::Event; | ||
use substreams_solana::pb::sf::solana::r#type::v1::Block; | ||
|
||
|
||
#[allow(unused_imports)] | ||
use num_traits::cast::ToPrimitive; | ||
use std::str::FromStr; | ||
use substreams::scalar::BigDecimal; | ||
|
||
substreams_ethereum::init!(); | ||
|
||
fn map_my_data(blk: ð::Block) -> mydata::MyData { | ||
#[substreams::handlers::map] | ||
fn map_my_data(blk: Block) -> mydata::MyData { | ||
let mut my_data = mydata::MyData::default(); | ||
if let Some(block_height) = blk.block_height { | ||
my_data.counter = block_height.block_height; | ||
} | ||
|
||
return my_data | ||
} | ||
{{- end }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters