Skip to content

Commit

Permalink
Integrate with db code
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzejkop committed Jan 9, 2024
1 parent 385b5db commit 0b96030
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ impl Database {
nonce,
current_nonce,
max_inflight_txs,
gas_price_limits
gas_price_limits,
enabled
FROM relayers
"#,
)
Expand All @@ -152,7 +153,8 @@ impl Database {
nonce,
current_nonce,
max_inflight_txs,
gas_price_limits
gas_price_limits,
enabled
FROM relayers
WHERE id = $1
"#,
Expand Down Expand Up @@ -1241,6 +1243,7 @@ mod tests {
chain_id: 1,
value: U256Wrapper(U256::from(10_123u64)),
}]),
enabled: None,
},
)
.await?;
Expand Down
9 changes: 6 additions & 3 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,20 @@ pub struct RelayerInfo {
#[sqlx(try_from = "i64")]
pub max_inflight_txs: u64,
pub gas_price_limits: Json<Vec<RelayerGasPriceLimit>>,
pub enabled: bool,
}

#[derive(Deserialize, Serialize, Debug, Clone, Default)]
#[serde(rename_all = "camelCase")]
pub struct RelayerUpdate {
#[serde(default)]
pub relayer_name: Option<String>,

#[serde(default)]
pub max_inflight_txs: Option<u64>,

#[serde(default)]
pub gas_price_limits: Option<Vec<RelayerGasPriceLimit>>,
#[serde(default)]
pub enabled: Option<bool>,
}

#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
Expand Down Expand Up @@ -86,6 +87,7 @@ mod tests {
value: U256Wrapper(U256::zero()),

Check warning on line 87 in src/types.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/tx-sitter-monolith/tx-sitter-monolith/src/types.rs
chain_id: 1,
}]),
enabled: true
};

let json = serde_json::to_string_pretty(&info).unwrap();
Expand All @@ -105,7 +107,8 @@ mod tests {
"value": "0x0",
"chainId": 1
}
]
],
"enabled": true
}
"#};

Expand Down

0 comments on commit 0b96030

Please sign in to comment.