-
Notifications
You must be signed in to change notification settings - Fork 635
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
Safemath pt 2 #5778
Safemath pt 2 #5778
Conversation
const scaledBigInt1 = scaleUpWorklet(bigInt1, decimalPlaces1); | ||
const scaledBigInt2 = scaleUpWorklet(bigInt2, decimalPlaces2); | ||
const result = (scaledBigInt1 * scaledBigInt2) / BigInt(10) ** BigInt(20); | ||
return formatResultWorklet(result); | ||
} | ||
|
||
// Divide function | ||
export function divWorklet(num1: string, num2: string): string { | ||
export function divWorklet(num1: string | number, num2: string | number): string { |
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.
do we want to make it "easy" to keep number
s in the codebase?
like we can make the user use string by not accepting number in the api or at least indicate something is up by making his code ugly having to parse before lol
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'm just getting started to replace the unsafe Number usages inside the worklets and I'm not sure what I'm gonna find out so I'll keep it flexible like this to move faster but in the end I'd like to find all the occurrences and make it more stricter if possible
* add more fns * accept string or number * update errors
* wip * fix gesture button states * Safemath pt 2 (#5778) * add more fns * accept string or number * update errors * fix dynamic island overlap on recieve modal (#5672) * . * oop * oop * okay ty ben * change background opacity to 1 * . * oop * . * Gas optimizations (#5779) * perf * ✨ * useWhyDidYouUpdate * EstimatedSwapGasFee * keepPreviousData * AnimatedText * isSameAddress * fix other networks section (#5784) * Swaps: fix favorite button press (#5782) * fix * android fix * todo * remove console logs * Insufficient Funds * remove todo * move cache getter closer to fetcher implentation * fix * :) * 🍕 * or equal 🤌 * remove unused isSameAddress util * just reordering declarations * error i18n * useGasSharedValues * remove estimating * fix label flickering * fix review panel not prompting * Revert "Lint on pre-commit (#5836)" This reverts commit d56ed46. * fix a bunch of shit --------- Co-authored-by: Matthew Wall <[email protected]> Co-authored-by: Bruno Barbieri <[email protected]> Co-authored-by: brdy <[email protected]> Co-authored-by: Ben Goldberg <[email protected]>
* wip * fix gesture button states * Safemath pt 2 (#5778) * add more fns * accept string or number * update errors * fix dynamic island overlap on recieve modal (#5672) * . * oop * oop * okay ty ben * change background opacity to 1 * . * oop * . * Gas optimizations (#5779) * perf * ✨ * useWhyDidYouUpdate * EstimatedSwapGasFee * keepPreviousData * AnimatedText * isSameAddress * fix other networks section (#5784) * Swaps: fix favorite button press (#5782) * fix * android fix * todo * remove console logs * Insufficient Funds * remove todo * move cache getter closer to fetcher implentation * fix * :) * 🍕 * or equal 🤌 * remove unused isSameAddress util * just reordering declarations * error i18n * useGasSharedValues * remove estimating * fix label flickering * fix review panel not prompting * Revert "Lint on pre-commit (#5836)" This reverts commit d56ed46. * fix a bunch of shit * fix? * opacity * on review panel we should show fetching status and quote errors too * remove error * useUserNativeNetworkAsset * less or equal * Fixes for review button states (#5873) * Fixes APP-1601: adds missing useThreshold for gas fee showing $0.00 * Tweak confirm button prop labels logic and ordering * Prep work: remove reliance of asset balance display in valueBasedDecimalFormatter * niceIncrementerFormatter returns asset balance if max swap * Update formattedInputValue Instead of using the niceIncrementFormatter for formatting slider-based values: for max: use the valueBasedDecimalFormatter on the input value which has already been set to maxSwappableAmount for everything else: add commas to the input value as it has already been formatted using the niceIncrementFormatter * Fixup: missed spot for previous hasEnoughFundsForGas revert * fix formatting --------- Co-authored-by: gregs <[email protected]> Co-authored-by: Bruno Barbieri <[email protected]> Co-authored-by: brdy <[email protected]> Co-authored-by: Ben Goldberg <[email protected]> Co-authored-by: Jin <[email protected]> Co-authored-by: Bruno Barbieri <[email protected]>
#5881) * wip * fix gesture button states * Safemath pt 2 (#5778) * add more fns * accept string or number * update errors * fix dynamic island overlap on recieve modal (#5672) * . * oop * oop * okay ty ben * change background opacity to 1 * . * oop * . * Gas optimizations (#5779) * perf * ✨ * useWhyDidYouUpdate * EstimatedSwapGasFee * keepPreviousData * AnimatedText * isSameAddress * fix other networks section (#5784) * Swaps: fix favorite button press (#5782) * fix * android fix * todo * remove console logs * Insufficient Funds * remove todo * move cache getter closer to fetcher implentation * fix * :) * 🍕 * or equal 🤌 * remove unused isSameAddress util * just reordering declarations * error i18n * useGasSharedValues * remove estimating * fix label flickering * fix review panel not prompting * Revert "Lint on pre-commit (#5836)" This reverts commit d56ed46. * fix a bunch of shit * fix? * opacity * on review panel we should show fetching status and quote errors too * remove error * useUserNativeNetworkAsset * less or equal * gas fee range * fixes * Fixes for review button states (#5873) * Fixes APP-1601: adds missing useThreshold for gas fee showing $0.00 * Tweak confirm button prop labels logic and ordering * Prep work: remove reliance of asset balance display in valueBasedDecimalFormatter * niceIncrementerFormatter returns asset balance if max swap * Update formattedInputValue Instead of using the niceIncrementFormatter for formatting slider-based values: for max: use the valueBasedDecimalFormatter on the input value which has already been set to maxSwappableAmount for everything else: add commas to the input value as it has already been formatted using the niceIncrementFormatter * merge * weird issues * fixes * fix out of sync issue * update input amount + quote when maxSwappableAmount changes * fix input formatting logic * fix wei conversion --------- Co-authored-by: gregs <[email protected]> Co-authored-by: Matthew Wall <[email protected]> Co-authored-by: Bruno Barbieri <[email protected]> Co-authored-by: brdy <[email protected]> Co-authored-by: Jin <[email protected]>
Fixes APP-####
What changed (plus any additional context for devs)
Adds more methods:
Accepts parameters of type
number
orstring
Screen recordings / screenshots
What to test