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

@@ -39,7 +39,7 @@ impl KbTokenBurnEventDto {
amount: std::string::String,
supply_after: std::option::Option<std::string::String>,
) -> Self {
Self {
return Self {
id: None,
token_id,
signature,
@@ -50,24 +50,21 @@ impl KbTokenBurnEventDto {
amount,
supply_after,
executed_at: chrono::Utc::now(),
}
};
}
}
impl TryFrom<crate::KbTokenBurnEventEntity> for KbTokenBurnEventDto {
type Error = crate::KbError;
fn try_from(
entity: crate::KbTokenBurnEventEntity,
) -> Result<Self, Self::Error> {
fn try_from(entity: crate::KbTokenBurnEventEntity) -> Result<Self, Self::Error> {
let executed_at_result = chrono::DateTime::parse_from_rfc3339(&entity.executed_at);
let executed_at = match executed_at_result {
Ok(executed_at) => executed_at.with_timezone(&chrono::Utc),
Err(error) => {
return Err(crate::KbError::Db(format!(
"cannot parse token burn event executed_at '{}': {}",
entity.executed_at,
error
entity.executed_at, error
)));
},
};
@@ -79,15 +76,14 @@ impl TryFrom<crate::KbTokenBurnEventEntity> for KbTokenBurnEventDto {
Err(error) => {
return Err(crate::KbError::Db(format!(
"cannot convert token burn event slot '{}' to u64: {}",
slot,
error
slot, error
)));
},
}
},
None => None,
};
Ok(Self {
return Ok(Self {
id: Some(entity.id),
token_id: entity.token_id,
signature: entity.signature,
@@ -98,6 +94,6 @@ impl TryFrom<crate::KbTokenBurnEventEntity> for KbTokenBurnEventDto {
amount: entity.amount,
supply_after: entity.supply_after,
executed_at,
})
});
}
}