Skip to content

Commit

Permalink
feat: support meta TX in indexer-events (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
telezhnaya committed Mar 13, 2023
1 parent 674618b commit 6b57ac2
Show file tree
Hide file tree
Showing 16 changed files with 1,128 additions and 177 deletions.
1,138 changes: 988 additions & 150 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions indexer-accounts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ tracing-appender = "0.1.2"
tracing-subscriber = "0.2.4"
quote = "1.0.17"

near-crypto = "0.15.0"
near-lake-framework = "0.6.1"
near-primitives = "0.15.0"
near-crypto = "0.16.0"
near-lake-framework = "0.7.1"
near-primitives = "0.16.0"

indexer-opts = { path = "../indexer-opts" }
8 changes: 4 additions & 4 deletions indexer-balances/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ tracing = "0.1.35"
tracing-appender = "0.1.2"
tracing-subscriber = "0.2.4"

near-jsonrpc-primitives = "0.15.0"
near-jsonrpc-client = "0.4.0-beta.0"
near-lake-framework = "0.6.1"
near-primitives = "0.15.0"
near-jsonrpc-primitives = "0.16.0"
near-jsonrpc-client = "0.5.0"
near-lake-framework = "0.7.1"
near-primitives = "0.16.0"

indexer-opts = { path = "../indexer-opts" }
6 changes: 3 additions & 3 deletions indexer-base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ tracing-appender = "0.1.2"
tracing-subscriber = "0.2.4"
quote = "1.0.17"

near-crypto = "0.15.0"
near-lake-framework = "0.6.1"
near-primitives = "0.15.0"
near-crypto = "0.16.0"
near-lake-framework = "0.7.1"
near-primitives = "0.16.0"

indexer-opts = { path = "../indexer-opts" }
4 changes: 2 additions & 2 deletions indexer-base/src/db_adapters/receipts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ async fn store_receipt_actions(
.iter()
.filter_map(|(index, tx, receipt)| {
models::ActionReceipt::try_from_action_receipt_view(
*receipt,
receipt,
&block_header.hash,
*tx,
tx,
chunk_header,
*index as i32,
block_header.timestamp,
Expand Down
3 changes: 3 additions & 0 deletions indexer-base/src/models/serializers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ pub(crate) fn extract_action_type_and_value_from_action_view(
"beneficiary_id": beneficiary_id,
}),
),
near_indexer_primitives::views::ActionView::Delegate { .. } => {
todo!("near-indexer-base has to be rewritten before considering any usage")
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions indexer-events/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ tracing = "0.1.35"
tracing-appender = "0.1.2"
tracing-subscriber = "0.2.4"

near-jsonrpc-primitives = "0.15.0"
near-jsonrpc-client = "0.4.0-beta.0"
near-lake-framework = "0.6.1"
near-primitives = "0.15.0"
near-jsonrpc-primitives = "0.16.0"
near-jsonrpc-client = "0.5.0"
near-lake-framework = "0.7.1"
near-primitives = "0.16.0"

indexer-opts = { path = "../indexer-opts" }
19 changes: 18 additions & 1 deletion indexer-events/src/db_adapters/coin/legacy/aurora.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,24 @@ pub(crate) async fn collect_aurora(
}
if let ReceiptEnumView::Action { actions, .. } = &outcome.receipt.receipt {
for action in actions {
events.extend(process_aurora_functions(block_header, action, outcome).await?);
match action {
ActionView::Delegate {
delegate_action, ..
} => {
for non_delegate_action in &delegate_action.actions {
events.extend(
process_aurora_functions(
block_header,
&coin::legacy::to_action_view(non_delegate_action.clone()),
outcome,
)
.await?,
)
}
}
_ => events
.extend(process_aurora_functions(block_header, action, outcome).await?),
}
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions indexer-events/src/db_adapters/coin/legacy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,9 @@ pub(crate) async fn collect_legacy(
events.extend(wrap_near_events);
Ok(events)
}

pub(crate) fn to_action_view(
action: near_primitives::delegate_action::NonDelegateAction,
) -> near_primitives::views::ActionView {
near_primitives::views::ActionView::from(near_primitives::transaction::Action::from(action))
}
21 changes: 19 additions & 2 deletions indexer-events/src/db_adapters/coin/legacy/rainbow_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,25 @@ pub(crate) async fn collect_rainbow_bridge(
}
if let ReceiptEnumView::Action { actions, .. } = &outcome.receipt.receipt {
for action in actions {
events
.extend(process_rainbow_bridge_functions(block_header, action, outcome).await?);
match action {
ActionView::Delegate {
delegate_action, ..
} => {
for non_delegate_action in &delegate_action.actions {
events.extend(
process_rainbow_bridge_functions(
block_header,
&coin::legacy::to_action_view(non_delegate_action.clone()),
outcome,
)
.await?,
)
}
}
_ => events.extend(
process_rainbow_bridge_functions(block_header, action, outcome).await?,
),
}
}
}
}
Expand Down
19 changes: 18 additions & 1 deletion indexer-events/src/db_adapters/coin/legacy/skyward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,24 @@ pub(crate) async fn collect_skyward(
}
if let ReceiptEnumView::Action { actions, .. } = &outcome.receipt.receipt {
for action in actions {
events.extend(process_skyward_functions(block_header, action, outcome).await?);
match action {
ActionView::Delegate {
delegate_action, ..
} => {
for non_delegate_action in &delegate_action.actions {
events.extend(
process_skyward_functions(
block_header,
&coin::legacy::to_action_view(non_delegate_action.clone()),
outcome,
)
.await?,
)
}
}
_ => events
.extend(process_skyward_functions(block_header, action, outcome).await?),
}
}
}
}
Expand Down
19 changes: 18 additions & 1 deletion indexer-events/src/db_adapters/coin/legacy/tkn_near.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,24 @@ pub(crate) async fn collect_tkn_near(
}
if let ReceiptEnumView::Action { actions, .. } = &outcome.receipt.receipt {
for action in actions {
events.extend(process_tkn_near_functions(block_header, action, outcome).await?);
match action {
ActionView::Delegate {
delegate_action, ..
} => {
for non_delegate_action in &delegate_action.actions {
events.extend(
process_tkn_near_functions(
block_header,
&coin::legacy::to_action_view(non_delegate_action.clone()),
outcome,
)
.await?,
)
}
}
_ => events
.extend(process_tkn_near_functions(block_header, action, outcome).await?),
}
}
}
}
Expand Down
20 changes: 19 additions & 1 deletion indexer-events/src/db_adapters/coin/legacy/wentokensir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,25 @@ pub(crate) async fn collect_wentokensir(
}
if let ReceiptEnumView::Action { actions, .. } = &outcome.receipt.receipt {
for action in actions {
events.extend(process_wentokensir_functions(block_header, action, outcome).await?);
match action {
ActionView::Delegate {
delegate_action, ..
} => {
for non_delegate_action in &delegate_action.actions {
events.extend(
process_wentokensir_functions(
block_header,
&coin::legacy::to_action_view(non_delegate_action.clone()),
outcome,
)
.await?,
)
}
}
_ => events.extend(
process_wentokensir_functions(block_header, action, outcome).await?,
),
}
}
}
}
Expand Down
19 changes: 18 additions & 1 deletion indexer-events/src/db_adapters/coin/legacy/wrap_near.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,24 @@ pub(crate) async fn collect_wrap_near(
}
if let ReceiptEnumView::Action { actions, .. } = &outcome.receipt.receipt {
for action in actions {
events.extend(process_wrap_near_functions(block_header, action, outcome).await?);
match action {
ActionView::Delegate {
delegate_action, ..
} => {
for non_delegate_action in &delegate_action.actions {
events.extend(
process_wrap_near_functions(
block_header,
&coin::legacy::to_action_view(non_delegate_action.clone()),
outcome,
)
.await?,
)
}
}
_ => events
.extend(process_wrap_near_functions(block_header, action, outcome).await?),
}
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions indexer-opts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ rust-version = "1.64"

[dependencies]
anyhow = "1.0.51"
aws-types = "0.53.0"
aws-sdk-s3 = "0.23.0"
aws-types = "0.54.1"
aws-sdk-s3 = "0.24.0"
bigdecimal = { version = "0.2", features = ["serde"] }
clap = { version = "3.0.0-beta.5", features = ["color", "derive", "env"] }
near-lake-framework = "0.6.1"
near-jsonrpc-client = "0.4.0-beta.0"
near-lake-framework = "0.7.1"
near-jsonrpc-client = "0.5.0"
sqlx = { version = "0.5.13", features = ["runtime-tokio-native-tls", "postgres", "bigdecimal"] }
tracing = "0.1.35"
1 change: 1 addition & 0 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.67.1

0 comments on commit 6b57ac2

Please sign in to comment.