diff --git a/.env.example b/.env.example index 26d5bca..4496a21 100644 --- a/.env.example +++ b/.env.example @@ -4,8 +4,4 @@ AA_ERC4337_ADDRESSES= AA_SAFE_ADDRESSES= ENDPOINT= -SUBSTREAMS_API_TOKEN= - -SINK_DB_NAME= -SINK_DB_URL= -SINK_DB_PASS= \ No newline at end of file +SUBSTREAMS_API_TOKEN= \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 2f260ce..4084861 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -69,7 +69,7 @@ dependencies = [ [[package]] name = "blocktorch_substreams" -version = "0.1.0" +version = "0.1.3" dependencies = [ "anyhow", "chrono", @@ -82,7 +82,6 @@ dependencies = [ "serde", "serde_qs", "substreams", - "substreams-database-change", "substreams-ethereum", ] @@ -754,17 +753,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "substreams-database-change" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ea09c700498fea3e50eb9aab5b0637d8bfce888be899aa68f987132923e46cc" -dependencies = [ - "prost", - "prost-types", - "substreams", -] - [[package]] name = "substreams-ethereum" version = "0.9.6" diff --git a/Cargo.toml b/Cargo.toml index 7851e6c..b24409e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blocktorch_substreams" -version = "0.1.0" +version = "0.1.3" description = "Blocktorch substreams for oracles, account abstraction and more" edition = "2021" repository = "https://github.com/blocktorch-xyz/blocktorch-substreams" @@ -24,8 +24,6 @@ prost-types = "0.11" substreams = "0.5" # Use latest from https://crates.io/crates/substreams-ethereum substreams-ethereum = "0.9" -# Use latest from https://crates.io/crates/substreams-database-change -substreams-database-change = "1.3" # Required so that ethabi > ethereum-types build correctly under wasm32-unknown-unknown [target.wasm32-unknown-unknown.dependencies] diff --git a/Makefile b/Makefile index 094448d..e56c125 100644 --- a/Makefile +++ b/Makefile @@ -10,16 +10,11 @@ build: .PHONY: run run: build - substreams run -e $(ENDPOINT) substreams.yaml map_combine_rollups -s $(START_BLOCK) -t $(STOP_BLOCK) - -.PHONY: sink -sink: build - substreams-sink-sql setup "psql://$(SINK_DB_NAME):$(SINK_DB_PASS)@$(SINK_DB_URL)?sslmode=disable" substreams.yaml || true - substreams-sink-sql run "psql://$(SINK_DB_NAME):$(SINK_DB_PASS)@$(SINK_DB_URL)?sslmode=disable" substreams.yaml --on-module-hash-mistmatch=warn + substreams run -e $(ENDPOINT) substreams.yaml map_combine_data -s $(START_BLOCK) -t $(STOP_BLOCK) .PHONY: gui gui: build - substreams gui -e $(ENDPOINT) substreams.yaml map_combine_rollups -s $(START_BLOCK) -t $(STOP_BLOCK) + substreams gui -e $(ENDPOINT) substreams.yaml map_combine_data -s $(START_BLOCK) -t $(STOP_BLOCK) .PHONY: protogen protogen: @@ -28,7 +23,3 @@ protogen: .PHONY: pack pack: build substreams pack substreams.yaml - -.PHONY: cursor-read -cursor-read: - substreams-sink-sql tools --dsn="psql://$(SINK_DB_NAME):$(SINK_DB_PASS)@$(SINK_DB_URL)?sslmode=disable" cursor read diff --git a/proto/aa_transaction.proto b/proto/aa_transaction.proto index 5105f06..cf40e05 100644 --- a/proto/aa_transaction.proto +++ b/proto/aa_transaction.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package eth.transaction.v1; +package eth.blocktorch.v1; import "google/protobuf/timestamp.proto"; diff --git a/proto/chronicle_transaction.proto b/proto/chronicle_transaction.proto index 33a981d..5a805e2 100644 --- a/proto/chronicle_transaction.proto +++ b/proto/chronicle_transaction.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package eth.transaction.v1; +package eth.blocktorch.v1; import "google/protobuf/timestamp.proto"; diff --git a/proto/combined_data.proto b/proto/combined_data.proto new file mode 100644 index 0000000..108267d --- /dev/null +++ b/proto/combined_data.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package eth.blocktorch.v1; + +import "aa_transaction.proto"; +import "chronicle_transaction.proto"; + +import "nitro_rollup.proto"; +import "op_rollup.proto"; +import "zk_evm_rollup.proto"; + +message CombinedData { + repeated AccountAbstractionTransaction accountAbstractionTransactions = 1; + repeated ChronicleTransaction chronicleTransactions = 2; + + repeated NitroRollup nitroRollups = 3; + repeated OPRollup opRollups = 4; + repeated ZkEvmRollup zkEvmRollups = 5; +} \ No newline at end of file diff --git a/proto/combined_rollups.proto b/proto/combined_rollups.proto index 71ff5b2..4499714 100644 --- a/proto/combined_rollups.proto +++ b/proto/combined_rollups.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package eth.rollup.v1; +package eth.blocktorch.v1; import "nitro_rollup.proto"; import "op_rollup.proto"; diff --git a/proto/combined_transactions.proto b/proto/combined_transactions.proto index 4fc3284..b74db23 100644 --- a/proto/combined_transactions.proto +++ b/proto/combined_transactions.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package eth.transaction.v1; +package eth.blocktorch.v1; import "aa_transaction.proto"; import "chronicle_transaction.proto"; diff --git a/proto/nitro_rollup.proto b/proto/nitro_rollup.proto index 260ffca..9aceeec 100644 --- a/proto/nitro_rollup.proto +++ b/proto/nitro_rollup.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package eth.rollup.v1; +package eth.blocktorch.v1; import "google/protobuf/timestamp.proto"; diff --git a/proto/op_rollup.proto b/proto/op_rollup.proto index 8d25007..8991508 100644 --- a/proto/op_rollup.proto +++ b/proto/op_rollup.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package eth.rollup.v1; +package eth.blocktorch.v1; import "google/protobuf/timestamp.proto"; diff --git a/proto/zk_evm_rollup.proto b/proto/zk_evm_rollup.proto index 4f586c9..f63164c 100644 --- a/proto/zk_evm_rollup.proto +++ b/proto/zk_evm_rollup.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package eth.rollup.v1; +package eth.blocktorch.v1; import "google/protobuf/timestamp.proto"; diff --git a/schema.sql b/schema.sql deleted file mode 100644 index 533a9e6..0000000 --- a/schema.sql +++ /dev/null @@ -1,18 +0,0 @@ -create table chronicle_transactions -( - "hash" text not null constraint chronicle_transactions_pk primary key, - "from" text, - "to" text, - "chain" text, - "status" text, - "timestamp" timestamp -); - -create table aa_transactions -( - "hash" text not null constraint aa_transactions_pk primary key, - "chain" text, - "aaType" text, - "status" text, - "timestamp" timestamp -); \ No newline at end of file diff --git a/src/db_out.rs b/src/db_out.rs deleted file mode 100644 index 6eb9672..0000000 --- a/src/db_out.rs +++ /dev/null @@ -1,49 +0,0 @@ -use crate::pb::eth::transaction::v1::{AccountAbstractionTransaction, AccountAbstractionTransactions, ChronicleTransaction, ChronicleTransactions}; - -use substreams_database_change::pb::database::{table_change::Operation, DatabaseChanges}; - -#[substreams::handlers::map] -fn db_out( - aa_trxs: AccountAbstractionTransactions, - chronicle_trxs: ChronicleTransactions -) -> Result { - let mut database_changes: DatabaseChanges = Default::default(); - - for trx in chronicle_trxs.transactions { - push_create_chronicle(&mut database_changes, 0, &trx); - } - - for trx in aa_trxs.transactions { - push_create_aa(&mut database_changes, 0, &trx); - } - - Ok(database_changes) -} - - -fn push_create_chronicle( - changes: &mut DatabaseChanges, - ordinal: u64, - trx: &ChronicleTransaction -) { - changes - .push_change("chronicle_transactions", &trx.hash, ordinal, Operation::Create) - .change("from", (None, &trx.from)) - .change("to", (None, &trx.to)) - .change("chain", (None, &trx.chain)) - .change("status", (None, &trx.status)) - .change("timestamp", (None, &trx.timestamp.as_ref().unwrap().clone())); -} - -fn push_create_aa( - changes: &mut DatabaseChanges, - ordinal: u64, - trx: &AccountAbstractionTransaction -) { - changes - .push_change("aa_transactions", &trx.hash, ordinal, Operation::Create) - .change("chain", (None, &trx.chain)) - .change("aaType", (None, &trx.account_abstraction_type)) - .change("status", (None, &trx.status)) - .change("timestamp", (None, &trx.timestamp.as_ref().unwrap().clone())); -} \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 003a3a2..411b4ea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,7 @@ mod map_combine_rollups; mod map_filter_chronicle_transactions; mod map_filter_aa_transactions; mod map_combine_transactions; -mod db_out; +mod map_combine_data; mod pb; mod abi; diff --git a/src/map_combine_data.rs b/src/map_combine_data.rs new file mode 100644 index 0000000..5a0540d --- /dev/null +++ b/src/map_combine_data.rs @@ -0,0 +1,20 @@ +use crate::pb::eth::blocktorch::v1::{CombinedData, AccountAbstractionTransactions, ChronicleTransactions, NitroRollups, OpRollups, ZkEvmRollups}; + +#[substreams::handlers::map] +fn map_combine_data( + aa_trxs: AccountAbstractionTransactions, + chronicle_trxs: ChronicleTransactions, + nitro_rollups: NitroRollups, + op_rollups: OpRollups, + zk_evm_rollups: ZkEvmRollups +) -> Result> { + Ok( + CombinedData { + account_abstraction_transactions: aa_trxs.transactions, + chronicle_transactions: chronicle_trxs.transactions, + nitro_rollups: nitro_rollups.rollups, + op_rollups: op_rollups.rollups, + zk_evm_rollups: zk_evm_rollups.rollups + } + ) +} \ No newline at end of file diff --git a/src/map_combine_rollups.rs b/src/map_combine_rollups.rs index ddfe0e0..2145ab9 100644 --- a/src/map_combine_rollups.rs +++ b/src/map_combine_rollups.rs @@ -1,4 +1,4 @@ -use crate::pb::eth::rollup::v1::{CombinedRollups, NitroRollups, OpRollups, ZkEvmRollups}; +use crate::pb::eth::blocktorch::v1::{CombinedRollups, NitroRollups, OpRollups, ZkEvmRollups}; #[substreams::handlers::map] fn map_combine_rollups( diff --git a/src/map_combine_transactions.rs b/src/map_combine_transactions.rs index 2567187..9b3ea31 100644 --- a/src/map_combine_transactions.rs +++ b/src/map_combine_transactions.rs @@ -1,4 +1,4 @@ -use crate::pb::eth::transaction::v1::{CombinedTransactions, AccountAbstractionTransactions, ChronicleTransactions}; +use crate::pb::eth::blocktorch::v1::{CombinedTransactions, AccountAbstractionTransactions, ChronicleTransactions}; #[substreams::handlers::map] fn map_combine_transactions( diff --git a/src/map_filter_aa_transactions.rs b/src/map_filter_aa_transactions.rs index 1d9a5ff..3a12e6b 100644 --- a/src/map_filter_aa_transactions.rs +++ b/src/map_filter_aa_transactions.rs @@ -1,4 +1,4 @@ -use crate::pb::eth::transaction::v1::{AccountAbstractionTransaction as Transaction, AccountAbstractionTransactions as Transactions}; +use crate::pb::eth::blocktorch::v1::{AccountAbstractionTransaction as Transaction, AccountAbstractionTransactions as Transactions}; use crate::abi; use substreams::{log, Hex}; use substreams_ethereum::{Function, Event}; diff --git a/src/map_filter_chronicle_transactions.rs b/src/map_filter_chronicle_transactions.rs index 35e8a67..31d3423 100644 --- a/src/map_filter_chronicle_transactions.rs +++ b/src/map_filter_chronicle_transactions.rs @@ -1,4 +1,4 @@ -use crate::pb::eth::transaction::v1::{ChronicleTransaction as Transaction, ChronicleTransactions as Transactions}; +use crate::pb::eth::blocktorch::v1::{ChronicleTransaction as Transaction, ChronicleTransactions as Transactions}; use crate::abi; use substreams::{log, Hex}; use substreams_ethereum::block_view::CallView; diff --git a/src/map_index_nitro_rollup_creations.rs b/src/map_index_nitro_rollup_creations.rs index 8cad63e..05ca19f 100644 --- a/src/map_index_nitro_rollup_creations.rs +++ b/src/map_index_nitro_rollup_creations.rs @@ -1,6 +1,6 @@ use crate::abi::rollups::arbitrum::rollup_creator::events::RollupCreated; use crate::abi::rollups::arbitrum::rollup_creator::functions::CreateRollup; -use crate::pb::eth::rollup::v1::{NitroRollup, NitroRollups}; +use crate::pb::eth::blocktorch::v1::{NitroRollup, NitroRollups}; use substreams::{log, Hex}; use substreams_ethereum::Event; use substreams_ethereum::block_view::CallView; diff --git a/src/map_index_op_rollup_creations.rs b/src/map_index_op_rollup_creations.rs index 4f79531..6a4c6c3 100644 --- a/src/map_index_op_rollup_creations.rs +++ b/src/map_index_op_rollup_creations.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use crate::abi::rollups::op::proxy_admin::functions::{UpgradeAndCall, Upgrade}; -use crate::pb::eth::rollup::v1::{OpRollup, OpRollups}; +use crate::pb::eth::blocktorch::v1::{OpRollup, OpRollups}; use substreams::{log, Hex}; use substreams_ethereum::Function; use substreams_ethereum::pb::eth::v2::{Block, TransactionTrace}; diff --git a/src/map_index_zk_evm_rollup_creations.rs b/src/map_index_zk_evm_rollup_creations.rs index 5e2726b..ca7a542 100644 --- a/src/map_index_zk_evm_rollup_creations.rs +++ b/src/map_index_zk_evm_rollup_creations.rs @@ -4,7 +4,7 @@ use crate::abi::rollups::zk_evm::polygon_zk_evm_deployer::events::{OwnershipTran use crate::abi::rollups::zk_evm::polygon_zk_evm::events::{Initialized, UpdateZkEvmVersion, OwnershipTransferred as ZkEvmOwnershipTransferred}; use crate::abi::rollups::zk_evm::polygon_zk_evm_global_exit_root::functions::RollupAddress; use crate::abi::rollups::zk_evm::transparent_upgradeable_proxy::events::Upgraded; -use crate::pb::eth::rollup::v1::{ZkEvmRollup, ZkEvmRollups}; +use crate::pb::eth::blocktorch::v1::{ZkEvmRollup, ZkEvmRollups}; use substreams::{log, Hex}; use substreams_ethereum::Event; use substreams_ethereum::pb::eth::v2::{Block, TransactionTrace}; diff --git a/src/pb/eth.rollup.v1.rs b/src/pb/eth.blocktorch.v1.rs similarity index 68% rename from src/pb/eth.rollup.v1.rs rename to src/pb/eth.blocktorch.v1.rs index 7f9b63a..0b90ab0 100644 --- a/src/pb/eth.rollup.v1.rs +++ b/src/pb/eth.blocktorch.v1.rs @@ -1,35 +1,85 @@ // @generated #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct ZkEvmRollups { +pub struct AccountAbstractionTransactions { #[prost(message, repeated, tag="1")] - pub rollups: ::prost::alloc::vec::Vec, + pub transactions: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct ZkEvmRollup { - #[prost(string, optional, tag="1")] - pub zk_evm_deployer_contract: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag="2")] - pub proxy_admin_contract: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag="3")] - pub polygon_zk_evm_timelock_contract: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag="4")] - pub native_token_contract: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag="5")] - pub polygon_zk_evm_implementation: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag="6")] - pub polygon_zk_evm_bridge_implementation: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag="7")] - pub polygon_zk_evm_global_exit_root_implementation: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag="8")] - pub polygon_zk_evm_proxy: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag="9")] - pub polygon_zk_evm_bridge_proxy: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag="10")] - pub polygon_zk_evm_global_exit_root_proxy: ::core::option::Option<::prost::alloc::string::String>, +pub struct AccountAbstractionTransaction { + #[prost(string, tag="1")] + pub from: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub to: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub hash: ::prost::alloc::string::String, + #[prost(string, tag="4")] + pub chain: ::prost::alloc::string::String, + #[prost(string, tag="5")] + pub account_abstraction_type: ::prost::alloc::string::String, + #[prost(string, tag="6")] + pub status: ::prost::alloc::string::String, + #[prost(message, optional, tag="7")] + pub timestamp: ::core::option::Option<::prost_types::Timestamp>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChronicleTransactions { + #[prost(message, repeated, tag="1")] + pub transactions: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChronicleTransaction { + #[prost(string, tag="1")] + pub from: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub to: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub hash: ::prost::alloc::string::String, + #[prost(string, tag="4")] + pub chain: ::prost::alloc::string::String, + #[prost(string, tag="5")] + pub status: ::prost::alloc::string::String, + #[prost(message, optional, tag="6")] + pub timestamp: ::core::option::Option<::prost_types::Timestamp>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NitroRollups { + #[prost(message, repeated, tag="1")] + pub rollups: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NitroRollup { + #[prost(string, tag="1")] + pub rollup_address: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub native_token_address: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub inbox_address: ::prost::alloc::string::String, + #[prost(string, tag="4")] + pub outbox_address: ::prost::alloc::string::String, + #[prost(string, tag="5")] + pub rollup_event_inbox_address: ::prost::alloc::string::String, + #[prost(string, tag="6")] + pub challenge_manager_address: ::prost::alloc::string::String, + #[prost(string, tag="7")] + pub admin_proxy_address: ::prost::alloc::string::String, + #[prost(string, tag="8")] + pub sequencer_inbox_address: ::prost::alloc::string::String, + #[prost(string, tag="9")] + pub bridge_address: ::prost::alloc::string::String, + #[prost(string, tag="10")] + pub upgrade_executor_address: ::prost::alloc::string::String, #[prost(string, tag="11")] - pub admin_address: ::prost::alloc::string::String, + pub validator_utils_address: ::prost::alloc::string::String, + #[prost(string, tag="12")] + pub validator_wallet_creator_address: ::prost::alloc::string::String, + #[prost(message, optional, tag="13")] + pub created_at: ::core::option::Option<::prost_types::Timestamp>, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -77,39 +127,49 @@ pub struct OpRollup { } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct NitroRollups { +pub struct ZkEvmRollups { #[prost(message, repeated, tag="1")] - pub rollups: ::prost::alloc::vec::Vec, + pub rollups: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct NitroRollup { - #[prost(string, tag="1")] - pub rollup_address: ::prost::alloc::string::String, - #[prost(string, tag="2")] - pub native_token_address: ::prost::alloc::string::String, - #[prost(string, tag="3")] - pub inbox_address: ::prost::alloc::string::String, - #[prost(string, tag="4")] - pub outbox_address: ::prost::alloc::string::String, - #[prost(string, tag="5")] - pub rollup_event_inbox_address: ::prost::alloc::string::String, - #[prost(string, tag="6")] - pub challenge_manager_address: ::prost::alloc::string::String, - #[prost(string, tag="7")] - pub admin_proxy_address: ::prost::alloc::string::String, - #[prost(string, tag="8")] - pub sequencer_inbox_address: ::prost::alloc::string::String, - #[prost(string, tag="9")] - pub bridge_address: ::prost::alloc::string::String, - #[prost(string, tag="10")] - pub upgrade_executor_address: ::prost::alloc::string::String, +pub struct ZkEvmRollup { + #[prost(string, optional, tag="1")] + pub zk_evm_deployer_contract: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="2")] + pub proxy_admin_contract: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="3")] + pub polygon_zk_evm_timelock_contract: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="4")] + pub native_token_contract: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="5")] + pub polygon_zk_evm_implementation: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="6")] + pub polygon_zk_evm_bridge_implementation: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="7")] + pub polygon_zk_evm_global_exit_root_implementation: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="8")] + pub polygon_zk_evm_proxy: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="9")] + pub polygon_zk_evm_bridge_proxy: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="10")] + pub polygon_zk_evm_global_exit_root_proxy: ::core::option::Option<::prost::alloc::string::String>, #[prost(string, tag="11")] - pub validator_utils_address: ::prost::alloc::string::String, - #[prost(string, tag="12")] - pub validator_wallet_creator_address: ::prost::alloc::string::String, - #[prost(message, optional, tag="13")] - pub created_at: ::core::option::Option<::prost_types::Timestamp>, + pub admin_address: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CombinedData { + #[prost(message, repeated, tag="1")] + pub account_abstraction_transactions: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="2")] + pub chronicle_transactions: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="3")] + pub nitro_rollups: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="4")] + pub op_rollups: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="5")] + pub zk_evm_rollups: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -121,4 +181,12 @@ pub struct CombinedRollups { #[prost(message, repeated, tag="3")] pub zk_evm_rollups: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CombinedTransactions { + #[prost(message, repeated, tag="1")] + pub account_abstraction_transactions: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="2")] + pub chronicle_transactions: ::prost::alloc::vec::Vec, +} // @@protoc_insertion_point(module) diff --git a/src/pb/eth.transaction.v1.rs b/src/pb/eth.transaction.v1.rs deleted file mode 100644 index 8b840f5..0000000 --- a/src/pb/eth.transaction.v1.rs +++ /dev/null @@ -1,56 +0,0 @@ -// @generated -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ChronicleTransactions { - #[prost(message, repeated, tag="1")] - pub transactions: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ChronicleTransaction { - #[prost(string, tag="1")] - pub from: ::prost::alloc::string::String, - #[prost(string, tag="2")] - pub to: ::prost::alloc::string::String, - #[prost(string, tag="3")] - pub hash: ::prost::alloc::string::String, - #[prost(string, tag="4")] - pub chain: ::prost::alloc::string::String, - #[prost(string, tag="5")] - pub status: ::prost::alloc::string::String, - #[prost(message, optional, tag="6")] - pub timestamp: ::core::option::Option<::prost_types::Timestamp>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct AccountAbstractionTransactions { - #[prost(message, repeated, tag="1")] - pub transactions: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct AccountAbstractionTransaction { - #[prost(string, tag="1")] - pub from: ::prost::alloc::string::String, - #[prost(string, tag="2")] - pub to: ::prost::alloc::string::String, - #[prost(string, tag="3")] - pub hash: ::prost::alloc::string::String, - #[prost(string, tag="4")] - pub chain: ::prost::alloc::string::String, - #[prost(string, tag="5")] - pub account_abstraction_type: ::prost::alloc::string::String, - #[prost(string, tag="6")] - pub status: ::prost::alloc::string::String, - #[prost(message, optional, tag="7")] - pub timestamp: ::core::option::Option<::prost_types::Timestamp>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct CombinedTransactions { - #[prost(message, repeated, tag="1")] - pub account_abstraction_transactions: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="2")] - pub chronicle_transactions: ::prost::alloc::vec::Vec, -} -// @@protoc_insertion_point(module) diff --git a/src/pb/mod.rs b/src/pb/mod.rs index e2257e8..de0a407 100644 --- a/src/pb/mod.rs +++ b/src/pb/mod.rs @@ -1,17 +1,10 @@ // @generated pub mod eth { - pub mod rollup { - // @@protoc_insertion_point(attribute:eth.rollup.v1) + pub mod blocktorch { + // @@protoc_insertion_point(attribute:eth.blocktorch.v1) pub mod v1 { - include!("eth.rollup.v1.rs"); - // @@protoc_insertion_point(eth.rollup.v1) - } - } - pub mod transaction { - // @@protoc_insertion_point(attribute:eth.transaction.v1) - pub mod v1 { - include!("eth.transaction.v1.rs"); - // @@protoc_insertion_point(eth.transaction.v1) + include!("eth.blocktorch.v1.rs"); + // @@protoc_insertion_point(eth.blocktorch.v1) } } } diff --git a/src/store_filtered_transactions.rs b/src/store_filtered_transactions.rs deleted file mode 100644 index 988e6fc..0000000 --- a/src/store_filtered_transactions.rs +++ /dev/null @@ -1,11 +0,0 @@ -use crate::pb::eth::transaction::v1::{Transaction, Transactions}; -use substreams::store::{ - StoreSetIfNotExists, StoreSetIfNotExistsProto, StoreNew -}; - -#[substreams::handlers::store] -fn store_filtered_transactions(trxs: Transactions, s: StoreSetIfNotExistsProto) { - for trx in trxs.transactions { - s.set_if_not_exists(0, &trx.hash, &trx); - } -} \ No newline at end of file diff --git a/substreams.yaml b/substreams.yaml index c062798..99df5d8 100644 --- a/substreams.yaml +++ b/substreams.yaml @@ -1,12 +1,7 @@ specVersion: v0.1.0 package: name: "blocktorch_substreams" - version: v0.1.2 - -imports: - sql: https://github.com/streamingfast/substreams-sink-sql/releases/download/protodefs-v1.0.3/substreams-sink-sql-protodefs-v1.0.3.spkg - -network: mainnet + version: v0.1.3 protobuf: files: @@ -17,6 +12,7 @@ protobuf: - chronicle_transaction.proto - aa_transaction.proto - combined_transactions.proto + - combined_data.proto importPaths: - ./proto @@ -26,26 +22,37 @@ binaries: file: ./target/wasm32-unknown-unknown/release/substreams.wasm modules: + - name: map_combine_data + kind: map + inputs: + - map: map_filter_aa_transactions + - map: map_filter_chronicle_transactions + - map: map_index_nitro_rollup_creations + - map: map_index_op_rollup_creations + - map: map_index_zk_evm_rollup_creations + output: + type: proto:eth.blocktorch.v1.CombinedData + - name: map_index_nitro_rollup_creations kind: map inputs: - source: sf.ethereum.type.v2.Block output: - type: proto:eth.rollup.v1.NitroRollups + type: proto:eth.blocktorch.v1.NitroRollups - name: map_index_op_rollup_creations kind: map inputs: - source: sf.ethereum.type.v2.Block output: - type: proto:eth.rollup.v1.OpRollups + type: proto:eth.blocktorch.v1.OpRollups - name: map_index_zk_evm_rollup_creations kind: map inputs: - source: sf.ethereum.type.v2.Block output: - type: proto:eth.rollup.v1.ZkEvmRollups + type: proto:eth.blocktorch.v1.ZkEvmRollups - name: map_combine_rollups kind: map @@ -54,21 +61,21 @@ modules: - map: map_index_op_rollup_creations - map: map_index_zk_evm_rollup_creations output: - type: proto:eth.rollup.v1.CombinedRollups + type: proto:eth.blocktorch.v1.CombinedRollups - name: map_filter_aa_transactions kind: map inputs: - source: sf.ethereum.type.v2.Block output: - type: proto:eth.transaction.v1.AccountAbstractionTransactions + type: proto:eth.blocktorch.v1.AccountAbstractionTransactions - name: map_filter_chronicle_transactions kind: map inputs: - source: sf.ethereum.type.v2.Block output: - type: proto:eth.transaction.v1.ChronicleTransactions + type: proto:eth.blocktorch.v1.ChronicleTransactions - name: map_combine_transactions kind: map @@ -76,24 +83,4 @@ modules: - map: map_filter_aa_transactions - map: map_filter_chronicle_transactions output: - type: proto:eth.transaction.v1.CombinedTransactions - - - name: db_out - kind: map - inputs: - - map: map_filter_aa_transactions - - map: map_filter_chronicle_transactions - output: - type: proto:sf.substreams.sink.database.v1.DatabaseChanges - -sink: - module: db_out - type: sf.substreams.sink.sql.v1.Service - config: - schema: "./schema.sql" - wire_protocol_access: true - engine: postgres - postgraphile_frontend: - enabled: true - pgweb_frontend: - enabled: true \ No newline at end of file + type: proto:eth.blocktorch.v1.CombinedTransactions \ No newline at end of file