Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing errors related to account and account delegation #331

Merged
merged 10 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions backend-rust/src/graphql_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3140,16 +3140,25 @@ impl Account {

/// Timestamp of the block where this account was created.
async fn created_at(&self, ctx: &Context<'_>) -> ApiResult<DateTime> {
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!(
lassemand marked this conversation as resolved.
Show resolved Hide resolved
"SELECT slot_time
FROM blocks
WHERE height = 1"
lassemand marked this conversation as resolved.
Show resolved Hide resolved
)
.fetch_one(get_pool(ctx)?)
.await?
};
Ok(slot_time)
}

Expand Down
2 changes: 1 addition & 1 deletion backend-rust/src/graphql_api/account_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub(crate) struct AccountMetricsQuery;

#[Object]
impl AccountMetricsQuery {
async fn account_metrics(
async fn accounts_metrics(
&self,
ctx: &Context<'_>,
period: MetricsPeriod,
Expand Down
9 changes: 7 additions & 2 deletions backend-rust/src/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1208,8 +1208,13 @@ impl PreparedEvent {
} => None,

AccountTransactionEffects::DelegationConfigured {
data,
} => None,
data: events,
} => Some(PreparedEvent::AccountDelegationEvents(
events
lassemand marked this conversation as resolved.
Show resolved Hide resolved
.iter()
.map(PreparedAccountDelegationEvent::prepare)
.collect::<anyhow::Result<Vec<_>>>()?,
)),
},
details => {
warn!("details = \n {:#?}", details);
Expand Down
Loading