-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat(swap): get frontend fee from backend #2805
Conversation
@@ -108,6 +108,10 @@ export const swapApiMaker = ( | |||
.then((response) => response.price) | |||
} | |||
|
|||
const getFrontendFees: Swap.Api['getFrontendFees'] = async () => { |
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.
Should this be removed as well and moved to yoroi mobile?
}>): Array<SwapOrderCalculation> => { | ||
const isLimit = orderType === 'limit' | ||
const maybeLimitPrice = isLimit ? limitPrice : undefined | ||
|
||
if (!discountTiers || discountTiers.length === 0) { | ||
throw new Error('discountTiers is 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.
What is the plan to respond from the backend? Empty discount tiers?
@@ -103,6 +105,10 @@ export class OpenSwapApi { | |||
|
|||
return tokens | |||
} | |||
|
|||
public async getFrontendFees(): Promise<Swap.FrontendFee> { |
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.
Should this be removed and moved to yoroi mobile?
React.useEffect(() => { | ||
discountTiersChanged(tiers) | ||
}, [discountTiersChanged, tiers]) | ||
|
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.
Should we block the UI somehow when fees are not fetched yet? What if the request fails?
_deps: ApiDeps, | ||
): Promise<GetFrontedFeeResponse> => { | ||
return { | ||
muesliswap: { |
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.
What is the endpoint?
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're using these mocked data in the meantime
] | ||
|
||
const milkTokenId = { | ||
mainnet: '8a1cfae21368b8bebbbed9800fec304e95cce39a2a57dc35e2e3ebaa.4d494c4b', |
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.
Where is this being compared?
const {refetch} = useSwapTokensByPairToken('', {suspense: false, enabled: false}) | ||
|
||
React.useEffect(() => { | ||
refetch() | ||
}, [refetch]) | ||
|
||
React.useEffect(() => { |
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.
Should we also block the UI if fee > 0 as this case is not properly implemented yet? Or how should the UI behave if the fee is > 0?
I think we can close in favour of #2807 |
@stackchain sounds good to me |
Resolves https://emurgo.atlassian.net/browse/YOMO-887