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

[WIP]: Swaps v2 quote fetching #5601

Merged
merged 21 commits into from Apr 16, 2024
Merged

Conversation

walmat
Copy link
Contributor

@walmat walmat commented Apr 5, 2024

Known issues:

Copy link

socket-security bot commented Apr 11, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@rainbow-me/swaps@0.16.0 environment, eval, network +9 3.22 MB brunobar79

🚮 Removed packages: npm/@rainbow-me/swaps@0.15.0

View full report↗︎

@walmat walmat marked this pull request as ready for review April 11, 2024 21:30
@dereknelson dereknelson self-requested a review April 11, 2024 21:31
Copy link
Contributor

@skylarbarrera skylarbarrera left a comment

Choose a reason for hiding this comment

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

smol tings not blocking at all

// assetToSell => native currency
case 2: {
fromAssetText.value = `1 ${assetToSellSymbol.value}`;
toAssetText.value = `$${assetToSellPrice.value.toLocaleString('en-US', {
Copy link
Contributor

Choose a reason for hiding this comment

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

we shouldnt be using toLocaleString since it doenst play with with the rest of the supported currencies, we have a JS util might just need to write it as a worklet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

'worklet';

const chainName = chainNameFromChainIdWorklet(chainId) as
| ChainName.mainnet
Copy link
Contributor

Choose a reason for hiding this comment

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

prob worth pulling this out into a supportedChains type or similar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

percentageToSwap.value,
sliderXPosition.value
);
});

const formattedInputNativeValue = useDerivedValue(() => {
if (inputMethod.value === 'slider' && percentageToSwap.value === 0 && !inputValues.value.inputNativeValue) return '$0.00';
if ((inputMethod.value === 'slider' && percentageToSwap.value === 0) || !inputValues.value.inputNativeValue) {
return '$0.00';
Copy link
Contributor

Choose a reason for hiding this comment

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

native currency shiz

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -161,7 +274,9 @@ export function useSwapInputsController({
});

const formattedOutputNativeValue = useDerivedValue(() => {
if (inputMethod.value === 'slider' && percentageToSwap.value === 0 && !inputValues.value.outputNativeValue) return '$0.00';
if ((inputMethod.value === 'slider' && percentageToSwap.value === 0) || !inputValues.value.outputNativeValue) {
return '$0.00';
Copy link
Contributor

Choose a reason for hiding this comment

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

native currency shiz

Copy link
Contributor Author

Choose a reason for hiding this comment

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

const fetchPriceForAsset = async (asset: ParsedSearchAsset | null, assetType: 'assetToSell' | 'assetToBuy') => {
if (!asset) return;

const assetWithPriceData = await fetchExternalToken({
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks like the vanilla fetch which wont take advantage of caching/local data

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@skylarbarrera skylarbarrera merged commit 5d91d5e into develop Apr 16, 2024
5 of 6 checks passed
@skylarbarrera skylarbarrera deleted the @matthew/swaps-quote-fetching branch April 16, 2024 18:08
BrodyHughes added a commit that referenced this pull request Apr 17, 2024
…ecks-language

* 'develop' of github.com:rainbow-me/rainbow: (100 commits)
  [WIP]: Swaps v2 quote fetching (#5601)
  chore: app start up spring cleaning (#5622)
  fix remote config (#5627)
  would it kill you to log this only once (#5626)
  Recents (#5625)
  wc: improvements (#5616)
  Degen chain support (#5621)
  send: check contract address (#5586)
  tx requests: metadata (#5584)
  audit: phin (#5624)
  Fix: Wallets being marked as backed up by walletLoadState() (#5593)
  NFTs: filter instead of throw error when NFT has invalid network (#5537)
  Dapp Browser: Search (#5617)
  Browser: bug fixes, animation and UI improvements (#5618)
  cleanup file imports and duplicate types (#5619)
  requests: generalize analytics (#5589)
  browser: account icon clean up (#5612)
  Fix no tab and links (#5613)
  more e2e changes (#5558)
  . (#5615)
  ...
BrodyHughes added a commit that referenced this pull request Apr 18, 2024
…eplink-add

* 'develop' of github.com:rainbow-me/rainbow: (23 commits)
  Add SmoothPager (#5641)
  [APP-1370]: bump sentry sdk to latest (#5640)
  Browser refactor (#5638)
  bump version to v1.9.22 (#5634)
  Price Impact Warning (#5635)
  Disable welcome screen animations when IS_TESTING (#5637)
  init (#5495)
  [WIP]: Swaps v2 quote fetching (#5601)
  chore: app start up spring cleaning (#5622)
  fix remote config (#5627)
  would it kill you to log this only once (#5626)
  Recents (#5625)
  wc: improvements (#5616)
  Degen chain support (#5621)
  send: check contract address (#5586)
  tx requests: metadata (#5584)
  audit: phin (#5624)
  Fix: Wallets being marked as backed up by walletLoadState() (#5593)
  NFTs: filter instead of throw error when NFT has invalid network (#5537)
  Dapp Browser: Search (#5617)
  ...
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.

None yet

2 participants