-
Notifications
You must be signed in to change notification settings - Fork 94
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
Fix tx value for atomic name swap finalize #296
Conversation
I think it'd be awesome if you could actually expand this list to include something like bob-wallet/app/components/Transactions/Transaction/index.js Lines 131 to 133 in abdcdc8
|
// Renewals and Updates have a value, but it doesn't | ||
// affect the spendable balance of the wallet. | ||
if (covenant.action === 'RENEW' || | ||
covenant.action === 'UPDATE' || | ||
covenant.action === 'TRANSFER' || | ||
covenant.action === 'FINALIZE') { | ||
covenant.action === 'TRANSFER') { |
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.
I could be wrong but I think if the wallet is receiving payment for a FINALIZE, then the payment value might just be equal to totalValue
calculated above. I'm not sure if that'll work for the buyer though (who is sending money) but might save you some of the logic in the blob L371-390
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.
Yup, this works for the seller and I initially tried this (but outside the for loop because totalValue won't be complete inside the loop).
if (covAction) {
return {
...covData,
fee: tx.fee,
value: covenant.action === 'FINALIZE' ? totalValue : covValue, // <- instead of just covValue
};
}
Like you said, this only works for the seller, not buyer. There's also a problem of identifying if the value is +ve or -ve.
abdcdc8
to
9f00284
Compare
Fixes #292.
The value for atomic name swaps show up as 0. This PR shows the +ve/-ve amount for seller/buyer.
Note: I could only test with 2 name swaps, probably needs more testing. Also not sure if this is the best way to get the values, it's the shortest I could think of.
For the example below, 2 names transferred,
c/
for 50 HNS,d/
without payment.Sender:
Receiver: