-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #56 +/- ##
==========================================
+ Coverage 89.85% 91.16% +1.31%
==========================================
Files 12 12
Lines 355 419 +64
==========================================
+ Hits 319 382 +63
- Misses 36 37 +1 ☔ View full report in Codecov by Sentry. |
I think the more idiomatic way would be doing something like this: pub struct WalletBalance {
/// The balance for the wallet; just the number itself.
#[serde(rename = "balance")]
pub balance: U256,
/// The unit used for the balance; formatted as "ETH"
#[serde(rename = "unit")]
pub unit: String,
} with a custom display implementation: impl Display for WalletBalance {
// ...
} I would also be in favor of turning pub struct Unit {
Eth,
Other(String),
} Since we are mostly going to be using Eth, and down the line we can add other chains we use |
just a small nit, if we unwrap in a method used by the RPC our server will go down Otherwise looking good! Ready to approve after that is turned into an error |
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.
This looks like a good start. Make sure to address those codecov warnings about lack of tests.
What ?
This PR adds the balance endpoint for the xps-gateway.
Implementation
Quite straight-forward; just query the provider for the wallet balance.
Closes
Closes #23.
Open question
While this implementation would work just fine, it might be adventitious to change the
into something like this:
This would allow us to make the RPC more friendly for code-oriented users while retaining the user-facing formatter.