-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: init command support for starknet
- Loading branch information
1 parent
43a8245
commit f02addd
Showing
22 changed files
with
739 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ package codegen | |
// ENUM( | ||
// | ||
// Ethereum | ||
// Starknet | ||
// Other | ||
// | ||
// ) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,12 @@ | ||
package codegen | ||
|
||
//go:generate go-enum -f=$GOFILE --marshal --names --nocase | ||
|
||
// ENUM( | ||
// | ||
// Mainnet | ||
// Sepolia | ||
// Other | ||
// | ||
// ) | ||
type StarknetChain uint |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,4 @@ | ||
/build/ | ||
/target/ | ||
buf.gen.yaml | ||
*.spkg |
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,21 @@ | ||
[package] | ||
name = "{{ .name }}" | ||
version = "0.0.1" | ||
edition = "2021" | ||
|
||
[lib] | ||
name = "substreams" | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
prost = "0.11" | ||
prost-types = "0.11" | ||
substreams = "0.5" | ||
substreams-database-change = "1" | ||
substreams-entity-change = "1" | ||
substreams-starknet = "0.1" | ||
|
||
[profile.release] | ||
lto = true | ||
opt-level = 's' | ||
strip = "debuginfo" |
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,26 @@ | ||
CARGO_VERSION := $(shell cargo version 2>/dev/null) | ||
|
||
.PHONY: build | ||
build: | ||
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_blocks) $(if $(START_BLOCK),-s $(START_BLOCK)) $(if $(STOP_BLOCK),-t $(STOP_BLOCK)) | ||
|
||
.PHONY: gui | ||
gui: build | ||
substreams gui substreams.yaml $(if $(MODULE),$(MODULE),map_blocks) $(if $(START_BLOCK),-s $(START_BLOCK)) $(if $(STOP_BLOCK),-t $(STOP_BLOCK)) | ||
|
||
.PHONY: protogen | ||
protogen: | ||
substreams protogen ./substreams.yaml --exclude-paths="sf/substreams,google" | ||
|
||
.PHONY: pack | ||
pack: 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
syntax = "proto3"; | ||
|
||
import "google/protobuf/timestamp.proto"; | ||
|
||
package block.v1; | ||
|
||
message Block { | ||
uint64 height = 1; | ||
bytes hash = 2; | ||
bytes prev_hash = 3; | ||
uint64 timestamp = 4; | ||
uint64 tx_count = 5; | ||
uint64 event_count = 6; | ||
} |
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,4 @@ | ||
[toolchain] | ||
channel = "1.77" | ||
components = ["rustfmt"] | ||
targets = ["wasm32-unknown-unknown"] |
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,8 @@ | ||
CREATE TABLE IF NOT EXISTS block ( | ||
"height" INT, | ||
"hash" VARCHAR(64), | ||
"prev_hash" VARCHAR(64), | ||
"timestamp" INT, | ||
"tx_count" INT, | ||
"event_count" INT | ||
) ENGINE = MergeTree PRIMARY KEY ("hash"); |
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,8 @@ | ||
type Block @entity { | ||
id: ID! | ||
height: BigInt! | ||
prev_hash: Bytes! | ||
timestamp: BigInt! | ||
tx_count: BigInt! | ||
event_count: BigInt! | ||
} |
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,9 @@ | ||
CREATE TABLE IF NOT EXISTS block ( | ||
"height" INT, | ||
"hash" VARCHAR(64), | ||
"prev_hash" VARCHAR(64), | ||
"timestamp" INT, | ||
"tx_count" INT, | ||
"event_count" INT, | ||
PRIMARY KEY(hash) | ||
); |
Oops, something went wrong.