-
Notifications
You must be signed in to change notification settings - Fork 13
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
Moved sorting of trades to eco router #221
base: develop
Are you sure you want to change the base?
Conversation
Mi-Lan
commented
Nov 28, 2022
•
edited
Loading
edited
- Moved trades type sorting to the sdk so that we have it in one place
- Added new folder inside trades called ecoRouterTrades which handles trades fetching and trades ordering
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.
Made a few comments, looks good overall. Will aprove after removing dist
folder.
import { EcoRouterResults } from './types' | ||
|
||
export async function getTradesPromise( | ||
parsedAmount: CurrencyAmount, |
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.
Can we call this currencyAmount? We don't know if it's parsed or not so this is an assumption.
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 think it will be more confusing to call it same as type. What do you mean by well not know if its parsed or not? It always accepts the same type currency with the amount inside that is requested
recipient: receiver, | ||
tradeType: TradeType.EXACT_INPUT, | ||
}) | ||
.then((res) => resolve(res ? res : undefined)) |
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.
Not sure if this logic makes sense. If it's undefined
it will return undefined
. Are we turning false
, null
values into undefined
?
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.
So this is because of type because it should return either trade or undefined
.catch((error) => { | ||
console.error(error) | ||
errors.push(error) | ||
resolve(undefined) | ||
}) |
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.
We are repeating this logic every .catch
maybe we can have a function catch error that receives and error and returns undefined (or just return
). Calling resolve
is the same as calling return
, so we can simply that too.
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.
Hmm in not sure about this actually because its a promise not a function...
a841304
to
3472ae2
Compare