This commit is contained in:
2026-05-05 05:03:11 +02:00
parent 3e994995d7
commit f2c227e08f
132 changed files with 5767 additions and 4461 deletions

View File

@@ -17,9 +17,9 @@ pub async fn upsert_token_burn_event(
"cannot convert token burn event slot '{}' to i64: {}",
slot, error
)));
}
},
}
}
},
None => None,
};
match database.connection() {
@@ -78,13 +78,15 @@ LIMIT 1
.fetch_one(pool)
.await;
match id_result {
Ok(id) => Ok(id),
Err(error) => Err(crate::KbError::Db(format!(
"cannot fetch kb_token_burn_events id for signature '{}' and instruction_index '{}' on sqlite: {}",
dto.signature, dto.instruction_index, error
))),
Ok(id) => return Ok(id),
Err(error) => {
return Err(crate::KbError::Db(format!(
"cannot fetch kb_token_burn_events id for signature '{}' and instruction_index '{}' on sqlite: {}",
dto.signature, dto.instruction_index, error
)));
},
}
}
},
}
}
@@ -126,7 +128,7 @@ LIMIT ?
"cannot list kb_token_burn_events on sqlite: {}",
error
)));
}
},
};
let mut dtos = std::vec::Vec::new();
for entity in entities {
@@ -137,8 +139,8 @@ LIMIT ?
};
dtos.push(dto);
}
Ok(dtos)
}
return Ok(dtos);
},
}
}
@@ -165,13 +167,7 @@ mod tests {
.expect("database init must succeed");
let dex_id = crate::upsert_dex(
&database,
&crate::KbDexDto::new(
"raydium".to_string(),
"Raydium".to_string(),
None,
None,
true,
),
&crate::KbDexDto::new("raydium".to_string(), "Raydium".to_string(), None, None, true),
)
.await
.expect("dex upsert must succeed");
@@ -299,9 +295,7 @@ mod tests {
assert!(liquidity_id > 0);
assert!(mint_id > 0);
assert!(burn_id > 0);
let swaps = crate::list_recent_swaps(&database, 10)
.await
.expect("swaps list must succeed");
let swaps = crate::list_recent_swaps(&database, 10).await.expect("swaps list must succeed");
let liquidity_events = crate::list_recent_liquidity_events(&database, 10)
.await
.expect("liquidity list must succeed");