diff --git a/Makefile b/Makefile index bcf51ae..8057f37 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ build: .PHONY: run run: build - substreams run -e $(ENDPOINT) substreams.yaml db_out -s $(START_BLOCK) -t $(STOP_BLOCK) + substreams run -e $(ENDPOINT) substreams.yaml map_combine_transactions -s $(START_BLOCK) -t $(STOP_BLOCK) .PHONY: sink sink: build diff --git a/proto/combined_transactions.proto b/proto/combined_transactions.proto new file mode 100644 index 0000000..4fc3284 --- /dev/null +++ b/proto/combined_transactions.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +package eth.transaction.v1; + +import "aa_transaction.proto"; +import "chronicle_transaction.proto"; + +message CombinedTransactions { + repeated AccountAbstractionTransaction accountAbstractionTransactions = 1; + repeated ChronicleTransaction chronicleTransactions = 2; +} \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index c860a32..f0d8d63 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,6 @@ mod map_filter_chronicle_transactions; mod map_filter_aa_transactions; +mod map_combine_transactions; mod db_out; mod pb; mod abi; diff --git a/src/map_combine_transactions.rs b/src/map_combine_transactions.rs new file mode 100644 index 0000000..2567187 --- /dev/null +++ b/src/map_combine_transactions.rs @@ -0,0 +1,9 @@ +use crate::pb::eth::transaction::v1::{CombinedTransactions, AccountAbstractionTransactions, ChronicleTransactions}; + +#[substreams::handlers::map] +fn map_combine_transactions( + aa_trxs: AccountAbstractionTransactions, + chronicle_trxs: ChronicleTransactions +) -> Result> { + Ok(CombinedTransactions { account_abstraction_transactions: aa_trxs.transactions, chronicle_transactions: chronicle_trxs.transactions }) +} \ No newline at end of file diff --git a/src/pb/eth.transaction.v1.rs b/src/pb/eth.transaction.v1.rs index 5afcb2f..8b840f5 100644 --- a/src/pb/eth.transaction.v1.rs +++ b/src/pb/eth.transaction.v1.rs @@ -45,4 +45,12 @@ pub struct AccountAbstractionTransaction { #[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/substreams.yaml b/substreams.yaml index 562cf7f..96487d2 100644 --- a/substreams.yaml +++ b/substreams.yaml @@ -12,6 +12,7 @@ protobuf: files: - chronicle_transaction.proto - aa_transaction.proto + - combined_transactions.proto importPaths: - ./proto @@ -23,7 +24,6 @@ binaries: modules: - name: map_filter_aa_transactions kind: map - initialBlock: 18664500 inputs: - source: sf.ethereum.type.v2.Block output: @@ -31,15 +31,21 @@ modules: - name: map_filter_chronicle_transactions kind: map - initialBlock: 18664500 inputs: - source: sf.ethereum.type.v2.Block output: type: proto:eth.transaction.v1.ChronicleTransactions + + - name: map_combine_transactions + kind: map + inputs: + - map: map_filter_aa_transactions + - map: map_filter_chronicle_transactions + output: + type: proto:eth.transaction.v1.CombinedTransactions - name: db_out kind: map - initialBlock: 18664500 inputs: - map: map_filter_aa_transactions - map: map_filter_chronicle_transactions