Skip to content

feat/PRO-2446/the-exchange-app#96

Merged
RanaBug merged 3 commits intostagingfrom
feat/PRO-2446/the-exchange-app
Jun 27, 2024
Merged

feat/PRO-2446/the-exchange-app#96
RanaBug merged 3 commits intostagingfrom
feat/PRO-2446/the-exchange-app

Conversation

@RanaBug
Copy link
Collaborator

@RanaBug RanaBug commented Jun 27, 2024

Description

  • Full FE design implementations of all components of the PillarX Swap App
  • Implementation of getting the best offer on same chain and exchange

How Has This Been Tested?

  • This has been tested only manually

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [ X ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@RanaBug RanaBug requested a review from IAmKio June 27, 2024 18:14
@RanaBug RanaBug self-assigned this Jun 27, 2024
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jun 27, 2024

Deploying x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 877f624
Status: ✅  Deploy successful!
Preview URL: https://abad6806.x-e62.pages.dev
Branch Preview URL: https://feat-pro-2446-the-exchange-a.x-e62.pages.dev

View logs

@github-actions github-actions bot temporarily deployed to Preview (feat/PRO-2446/the-exchange-app) June 27, 2024 18:19 Inactive
Copy link
Collaborator

@IAmKio IAmKio left a comment

Choose a reason for hiding this comment

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

Great work! Looking forward to the next stage of this app! Just to summarise:

  • I've left the bulk of the review till the end after the feature is complete
  • Some issues are repeating and I didn't add anymore comments for them
  • Could we rename the directory / ID from the-exchange-app to just the-exchange please?

Thanks and great work!

const renderCards = () => (
<div className='flex w-full gap-4 desktop:gap-8 justify-center'>
<SwapReceiveCard
onClick={() => handleClick(isInitialOrder ? cardPosition.left : cardPosition.right)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Handle click is a little bit generic, could we make it more specific please?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes agreed, I changed it to: handleOpenTokenList

}

useEffect(() => {
getOffer().then((offer) => setBestOffer(offer));
Copy link
Collaborator

Choose a reason for hiding this comment

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

we'll handle catching in the next task

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

100% agreed, not all calls are being handled properly

}
}, [type, amountSwap, amountReceive]);

const handleChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Handle change is too generic, could we be more descriptive here?

Copy link
Collaborator Author

@RanaBug RanaBug Jun 27, 2024

Choose a reason for hiding this comment

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

Absolutely, I changed it to: handleTokenAmountChange

if (bestOffer) {
addToBatch({
title: 'Swap assets',
chainId: swapToken?.chainId || 0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wondering what happens if chain is 0?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This needs to be better handled in the cleanup, that was a quick win

@@ -0,0 +1,147 @@
import React, { createContext, useContext, useState, useEffect, useMemo } from 'react';
import { ExchangeOffer, Token } from '@etherspot/prime-sdk/dist/sdk/data';
Copy link
Collaborator

@IAmKio IAmKio Jun 27, 2024

Choose a reason for hiding this comment

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

Just wondering why we're important from the dist directory directly here, I'm assuming these are types? If so they should be exported (if not then they should be, that's missing from the SDK)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Mmm... I noticed that all types from the SDK are coming from this folder

const assets = await getPillarSwapAssets(chainId || undefined);
setSwapTokenData(assets);
} catch (error) {
console.error('Error fetching supported assets:', error);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a note for later, we need to handle this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

100%

Copy link
Collaborator

Choose a reason for hiding this comment

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

just note we'll replace this with Boring Avatars in future

@@ -0,0 +1,9 @@
{
"title": "The Echange",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"title": "The Echange",
"title": "The Exchange",

Copy link
Collaborator Author

@RanaBug RanaBug Jun 27, 2024

Choose a reason for hiding this comment

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

Oops, done!

@github-actions github-actions bot temporarily deployed to Preview (staging) June 27, 2024 20:50 Inactive
Copy link
Collaborator

@IAmKio IAmKio left a comment

Choose a reason for hiding this comment

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

Great work 🚀

@RanaBug RanaBug force-pushed the feat/PRO-2446/the-exchange-app branch from 2e900f2 to 877f624 Compare June 27, 2024 21:06
@RanaBug RanaBug merged commit ddd3e4c into staging Jun 27, 2024
@RanaBug RanaBug deleted the feat/PRO-2446/the-exchange-app branch April 3, 2025 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants