-
Notifications
You must be signed in to change notification settings - Fork 19
feat: regenerate paymentId when amount is updated #572
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
Merged
+953
−94
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
342a97c
feat: generate paymentId on server
lissavxo aae1c95
fix: solve double calling of paymentId on server
chedieck 1967279
fix: converted amount
lissavxo 9444040
fix: double request & fetching on open
chedieck f64ca38
fix: type
chedieck b74c999
fix: payment dialog
lissavxo 824c392
fix: amount convert
lissavxo f264fe9
fix: generate paymentId
lissavxo ce27eb3
refactor: clean up
lissavxo 89fc225
fix: paymentId creation
chedieck 0a683d4
fix: new request when editing amount
chedieck 61cc32a
fix: don't recreate upon closing and opening
chedieck 70952ba
fix: recreate paymentId for widget amount change
chedieck 970eac6
feat: confirming input
chedieck ad505ff
fix: extra decimals not passed to request
chedieck 6da8d92
Better amount edit confirm button
Klakurka 5716c17
fix: fiat case for paymentId generation
chedieck 8e28452
fix: creating paymentId twice in pb
chedieck 4d28251
fix: widget paymentId amount with fiat
chedieck d300bc8
test: added tests for creating paymentid
chedieck 1b8bf41
fix: paymentId for no amount
chedieck e9ead35
fix: paymentId for no amount (widget)
chedieck 283837c
test: paymentId for no amount
chedieck 6270cff
test: widget tests
chedieck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Conversion guards prevent recalculation when amount changes.
Lines 314 and 325 use
!convertedCurrencyObjguards that prevent conversion recalculation when the amount changes. OnceconvertedCurrencyObjis set, these blocks never execute again, even ifamount,price, orrandomSatoshischange.Consider removing these guards or adding amount/price to trigger recalculation:
useEffect(() => { if (currencyObj && isFiat(currency) && price) { - if(!convertedCurrencyObj) { const addressType: Currency = getCurrencyTypeFromAddress(to); const convertedObj = getCurrencyObject( currencyObj.float / price, addressType, randomSatoshis, ); setCryptoAmount(convertedObj.string); setConvertedAmount(convertedObj.float); setConvertedCurrencyObj(convertedObj); - } } else if (!isFiat(currency) && randomSatoshis && !convertedCurrencyObj){ const convertedObj = getCurrencyObject( amount as number, addressType, randomSatoshis, ); setCryptoAmount(convertedObj.string); setConvertedAmount(convertedObj.float); setConvertedCurrencyObj(convertedObj); } else if (!isFiat(currency) && !randomSatoshis) { setCryptoAmount(amount?.toString()); } }, [price, currencyObj, amount, currency, randomSatoshis, to]);🤖 Prompt for AI Agents