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

Add transactions #30

Closed
wants to merge 6 commits into from
Closed

Add transactions #30

wants to merge 6 commits into from

Conversation

0xSasaPrsic
Copy link
Member

Add transactions endpoint.

src/main.rs Outdated
depositor_address: send.depositor_address,
receiver_address: send.receiver_address,
amount: send.amount,
// claim_type: send.claim_type,
Copy link
Contributor

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?

Copy link
Member Author

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,
Copy link
Member

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,
Copy link
Member

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,
Copy link
Member

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>,
Copy link
Member

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,
Copy link
Member

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>,
Copy link
Member

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,
Copy link
Member

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",
Copy link
Member

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 {
Copy link
Member

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),
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants