-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add transactions #30
Add transactions #30
Conversation
# Conflicts: # Cargo.lock # Cargo.toml
src/main.rs
Outdated
depositor_address: send.depositor_address, | ||
receiver_address: send.receiver_address, | ||
amount: send.amount, | ||
// claim_type: send.claim_type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we remove this one? or keep it, just because?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
#[serde_as] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct TransactionData { | ||
pub message_id: i64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use usize
or u64
?
pub message_id: i64, | ||
pub status: StatusEnum, | ||
pub source_transaction_hash: String, | ||
pub source_block_number: i64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use u32
pub status: StatusEnum, | ||
pub source_transaction_hash: String, | ||
pub source_block_number: i64, | ||
pub source_block_hash: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use type.
pub source_block_number: i64, | ||
pub source_block_hash: String, | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub source_transaction_index: Option<i64>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use usize
or u64
pub source_transaction_index: Option<i64>, | ||
#[serde_as(as = "TimestampSeconds")] | ||
pub source_timestamp: NaiveDateTime, | ||
pub token_id: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use custom type.
#[derive(Debug, Default, Serialize, Deserialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct TransactionResult { | ||
pub avail_send: Vec<TransactionData>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable names are unclear.
pub destination_timestamp: Option<NaiveDateTime>, | ||
pub depositor_address: String, | ||
pub receiver_address: String, | ||
pub amount: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use alloy primitives U256
[( | ||
"Cache-Control", | ||
format!( | ||
"public, max-age={}, immutable", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
immutable
and maxage
should be set only when both dest and source vars are set. Otherwise, should be considered fresh for 5 minutes (or some duration less than bridging duration).
#[diesel(sql_type = ClaimType)] | ||
#[derive(Serialize, Deserialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub enum ClaimTypeEnum { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this being tracked here?
impl FromSql<Status, Pg> for StatusEnum { | ||
fn from_sql(bytes: PgValue<'_>) -> deserialize::Result<Self> { | ||
match bytes.as_bytes() { | ||
b"IN_PROGRESS" => Ok(StatusEnum::InProgress), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be PENDING
, SENT
, PROCESSED
or similar IMO.
Add transactions endpoint.