-
Notifications
You must be signed in to change notification settings - Fork 53
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
Use dedicated struct for wallet balance #385
Conversation
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.
Appraoch ACK. looks good. Few comments.
@Levi0804 can you rebase this on current master? Changs looks good. Once the conflicts are resolved it should be good to go. |
69df8ed
to
aa7770f
Compare
@mojoX911 I rebased this on master. Does this look good? |
In |
Code changes looks good.
Ack. But we can do more. It would be even better if we add the This struct then also can be used in both taker and maker bins and there we pretty print it in json. For taker the fidelity field will always be zero. So while printing we will just ommit that. Put the |
This will also change the doc sections of balances for lets do that in this PR itself. You don't need to recreate the exact situation as the tutorial. Wherever we are showing balance outputs just replace with the new json format and put the previous values in respective fields. |
@mojoX911 should we also create a similar structure for utxos? |
Alright, I'll work on this next. |
Do the current changes look good to you? |
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.
Yes changes looks good. Awaiting CI.
The Lines 220 to 230 in 8cec81b
|
do these changes look good? |
coinswap/docs/app demos/maker-cli.md Lines 215 to 225 in 64ed9f4
I should replace every balance command with get-balances, right? |
Yes. Appraoch ACK. Will do a deeper review soon. |
for some reason a check is still failing |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #385 +/- ##
==========================================
- Coverage 70.52% 70.50% -0.02%
==========================================
Files 34 34
Lines 4247 4242 -5
==========================================
- Hits 2995 2991 -4
+ Misses 1252 1251 -1 ☔ View full report in Codecov by Sentry. |
We can now completely remove this, right? coinswap/docs/app demos/maker-cli.md Lines 272 to 343 in 64ed9f4
|
Only line 273. Rest are fine. |
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.
Ack. Code looks good. Few nits and suggets.
let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap(); | ||
let live_contract_balance = wallet | ||
.balance_live_timelock_contract(Some(&all_utxos)) | ||
.unwrap(); |
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.
We now don't need to fetch individual balances. We can call get_balances
and assert values in the balance structure. This will simplify the code, as well as put get_balances
in the coverage.
Same changes will be applicable to all tests and mod.rs also. This can be done as a followup PR.
let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap(); | ||
let live_contract_balance = wallet | ||
.balance_live_timelock_contract(Some(&all_utxos)) | ||
.unwrap(); |
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.
Same thing here also, they can all be combined in one call.
Do these changes look good? |
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.
Ack
This PR is a work in progress addressing #366.