Skip to content
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

Review button states #5854

Merged
merged 52 commits into from
Jun 21, 2024
Merged

Review button states #5854

merged 52 commits into from
Jun 21, 2024

Conversation

walmat
Copy link
Contributor

@walmat walmat commented Jun 17, 2024

Fixes APP-1486
Fixes APP-1600
Fixes APP-1601
Fixes APP-1602
Fixes APP-1617
Fixes APP-1580

What changed (plus any additional context for devs)

Screen recordings / screenshots

What to test

greg-schrammel and others added 30 commits May 29, 2024 15:29
* add more fns

* accept string or number

* update errors
* .

* oop

* oop

* okay ty ben

* change background opacity to 1

* .

* oop

* .
* perf

* ✨

* useWhyDidYouUpdate

* EstimatedSwapGasFee

* keepPreviousData

* AnimatedText

* isSameAddress
Copy link

linear bot commented Jun 17, 2024

Copy link

linear bot commented Jun 17, 2024

Copy link

linear bot commented Jun 17, 2024

Copy link

linear bot commented Jun 17, 2024

const network = getNetworkFromChainId(chainId);
const { nativeCurrency } = getNetworkObj(network);
const { mainnetAddress, address } = nativeCurrency;
const uniqueId = mainnetAddress ? `${mainnetAddress}_${Network.mainnet}` : `${address}_${network}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless something changed, this is not how it's supposed to be. UniqueIds should be created as ${mainnetAddress || address}_${chainId}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we're using chainId format for new swaps stuff. Will be incrementally adopting this new pattern elsewhere in the app later @greg-schrammel.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or wait i'm not sure why this file was touched actually.. this is for old user assets logic

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@greg-schrammel for swaps work, we've been duplicating the general resources files for assets and placing them here: __swaps__/screens/Swap/resources/assets; we hadn't copied over the useUserAsset function but we should be doing that for now (clean up of this duplication of resources will be tackled later)

Copy link
Contributor

@greg-schrammel greg-schrammel Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a useUserAsset that selects a single asset from useUserAssets, I created in the same file a useUserNativeNetworkAsset to make it easier to grab the network native asset
is there another hook/way of doing that already?
don't see a reason to clone this file

for context Im using this hook to know the user network native balance, and check if he has enough for the transaction


const gasAmount = formatUnits(safeBigInt(totalWei), nativeNetworkAsset.decimals).toString();
const feeInUserCurrency = multiply(networkAssetPrice, gasAmount);
const feeFormatted = formatUnits(safeBigInt(fee), nativeNetworkAsset.decimals).toString();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a theory that the reason we see 0 sometimes as the gas price is because there are decimals in the fee and the safeBigInt returns 0. IMO it's preferably to round up

Copy link
Contributor

@greg-schrammel greg-schrammel Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should be using wei for everything here
but makes sense gonna test it

@jinchung jinchung self-requested a review June 18, 2024 17:39
Copy link

linear bot commented Jun 19, 2024

jinchung added 3 commits June 20, 2024 18:36
* 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
Copy link

linear bot commented Jun 21, 2024

@brunobar79 brunobar79 merged commit 56abcd6 into develop Jun 21, 2024
6 checks passed
@brunobar79 brunobar79 deleted the review-button-states branch June 21, 2024 14:21
BrodyHughes added a commit that referenced this pull request Jun 26, 2024
…able-unit-tests

* 'develop' of github.com:rainbow-me/rainbow:
  rerun only failed tests (#5878)
  bump versions to v1.9.28 (#5893)
  input asset regression fix on v1 (#5891)
  bump to version 1.9.27 (#5890)
  take into account l1 op  gas fee for claimBridge (#5889)
  Points UI (#5866)
  Remove input value typeof checks (#5886)
  Fix swap button presses, adjust button state logic (#5884)
  Swaps: Gas fee range to use for native asset maxSwappableAmount buffer (#5881)
  clear custom gas settings (#5875)
  Review button states (#5854)
  fix handler (#5880)
  Use graphql ens key everywhere (#5882)
  Fix chain badges on android (#5867)
  fix android padding calc (#5877)
  add unknown type as failed (#5871)
  Swaps: gas icons, review sheet cleanup (#5872)
  Swap flashbots min priority fee (#5869)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants