-
Notifications
You must be signed in to change notification settings - Fork 369
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
[Wallet] Fix escrow failing randomly with local currency #5039
[Wallet] Fix escrow failing randomly with local currency #5039
Conversation
Error was: `Invalid domainURIPrefix scheme. Scheme needs to be https`
@@ -48,5 +48,5 @@ export function convertLocalAmountToDollars( | |||
// If the user enters `2.99` cUSD, this function has no impact | |||
// and `2.99` is still displayed in the confirmation screen. | |||
export function convertDollarsToMaxSupportedPrecision(amount: BigNumber) { | |||
return new BigNumber(amount.toPrecision(18, BigNumber.ROUND_UP)) | |||
return new BigNumber(amount.toFixed(18, BigNumber.ROUND_UP)) |
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 was all my bad, I misunderstood the behavior of toPrecision
when I implemented this.
It doesn't limit the number to X decimals, but to X significant digits.
See https://mikemcl.github.io/bignumber.js/#toP and https://en.wikipedia.org/wiki/Significant_figures#Significant_figures_rules_explained
toFixed
does what we want.
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.
Nice catch!
### Description This PR fixes sending an invite with an escrowed payment failing randomly when using a local currency. See details in #3000 ### Other changes - Fixed dynamic link generation never returning and leaving the UI in loading state indefinitely (underlying error was `Invalid domainURIPrefix scheme. Scheme needs to be https`) ### Tested Added new test. Invite with escrow works. ### Related issues - Fixes #3000 ### Backwards compatibility Yes
Hi @jeanregisser i have tried to repro issue on test flight build v1.1.0 (21) and able to repro issue.
Please let me know if you want to verify anything else. |
### Description This PR fixes sending an invite with an escrowed payment failing randomly when using a local currency. See details in celo-org#3000 ### Other changes - Fixed dynamic link generation never returning and leaving the UI in loading state indefinitely (underlying error was `Invalid domainURIPrefix scheme. Scheme needs to be https`) ### Tested Added new test. Invite with escrow works. ### Related issues - Fixes celo-org#3000 ### Backwards compatibility Yes
Description
This PR fixes sending an invite with an escrowed payment failing randomly when using a local currency.
See details in #3000
Other changes
Invalid domainURIPrefix scheme. Scheme needs to be https
)Tested
Added new test. Invite with escrow works.
Related issues
Backwards compatibility
Yes