diff --git a/backend-rust/.sqlx/query-97a2898e60a267e365312cdedf1d15245a355a3460e88ec2bce6ba571277e0be.json b/backend-rust/.sqlx/query-6af2928df158730d8a4cc3f4e7284ac67825a548794ce2b9c3246d642cc013d5.json similarity index 51% rename from backend-rust/.sqlx/query-97a2898e60a267e365312cdedf1d15245a355a3460e88ec2bce6ba571277e0be.json rename to backend-rust/.sqlx/query-6af2928df158730d8a4cc3f4e7284ac67825a548794ce2b9c3246d642cc013d5.json index 56c9c9222..5cd43f5bd 100644 --- a/backend-rust/.sqlx/query-97a2898e60a267e365312cdedf1d15245a355a3460e88ec2bce6ba571277e0be.json +++ b/backend-rust/.sqlx/query-6af2928df158730d8a4cc3f4e7284ac67825a548794ce2b9c3246d642cc013d5.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT slot_time\n FROM transactions\n JOIN blocks ON transactions.block_height = blocks.height\n WHERE transactions.index = $1", + "query": "SELECT slot_time\n FROM transactions\n JOIN blocks ON transactions.block_height = blocks.height\n WHERE transactions.index = $1", "describe": { "columns": [ { @@ -18,5 +18,5 @@ false ] }, - "hash": "97a2898e60a267e365312cdedf1d15245a355a3460e88ec2bce6ba571277e0be" + "hash": "6af2928df158730d8a4cc3f4e7284ac67825a548794ce2b9c3246d642cc013d5" } diff --git a/backend-rust/.sqlx/query-71525908726653a43c0cf1b0515fb5d8aa6e0405d54781b6220a573e797e6e34.json b/backend-rust/.sqlx/query-71525908726653a43c0cf1b0515fb5d8aa6e0405d54781b6220a573e797e6e34.json new file mode 100644 index 000000000..eb265551f --- /dev/null +++ b/backend-rust/.sqlx/query-71525908726653a43c0cf1b0515fb5d8aa6e0405d54781b6220a573e797e6e34.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT slot_time\n FROM blocks\n WHERE height = 0", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "slot_time", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false + ] + }, + "hash": "71525908726653a43c0cf1b0515fb5d8aa6e0405d54781b6220a573e797e6e34" +} diff --git a/backend-rust/src/graphql_api.rs b/backend-rust/src/graphql_api.rs index e65b62f89..c3834f481 100644 --- a/backend-rust/src/graphql_api.rs +++ b/backend-rust/src/graphql_api.rs @@ -3140,16 +3140,25 @@ impl Account { /// Timestamp of the block where this account was created. async fn created_at(&self, ctx: &Context<'_>) -> ApiResult { - let slot_time = sqlx::query_scalar!( - "SELECT slot_time - FROM transactions - JOIN blocks ON transactions.block_height = blocks.height - WHERE transactions.index = $1", - self.transaction_index - ) - .fetch_one(get_pool(ctx)?) - .await?; - + let slot_time = if let Some(transaction_index) = self.transaction_index { + sqlx::query_scalar!( + "SELECT slot_time + FROM transactions + JOIN blocks ON transactions.block_height = blocks.height + WHERE transactions.index = $1", + transaction_index + ) + .fetch_one(get_pool(ctx)?) + .await? + } else { + sqlx::query_scalar!( + "SELECT slot_time + FROM blocks + WHERE height = 0" + ) + .fetch_one(get_pool(ctx)?) + .await? + }; Ok(slot_time) } diff --git a/backend-rust/src/graphql_api/account_metrics.rs b/backend-rust/src/graphql_api/account_metrics.rs index d957ed9ae..dd96b52da 100644 --- a/backend-rust/src/graphql_api/account_metrics.rs +++ b/backend-rust/src/graphql_api/account_metrics.rs @@ -41,7 +41,7 @@ pub(crate) struct AccountMetricsQuery; #[Object] impl AccountMetricsQuery { - async fn account_metrics( + async fn accounts_metrics( &self, ctx: &Context<'_>, period: MetricsPeriod, diff --git a/backend-rust/src/indexer.rs b/backend-rust/src/indexer.rs index 62a7b988e..6c936ef84 100644 --- a/backend-rust/src/indexer.rs +++ b/backend-rust/src/indexer.rs @@ -1208,8 +1208,13 @@ impl PreparedEvent { } => None, AccountTransactionEffects::DelegationConfigured { - data, - } => None, + data: events, + } => Some(PreparedEvent::AccountDelegationEvents( + events + .iter() + .map(PreparedAccountDelegationEvent::prepare) + .collect::>>()?, + )), }, details => { warn!("details = \n {:#?}", details);