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

feat(swap): get frontend fee from backend #2805

Closed
wants to merge 6 commits into from

Conversation

michaeljscript
Copy link
Collaborator

@@ -108,6 +108,10 @@ export const swapApiMaker = (
.then((response) => response.price)
}

const getFrontendFees: Swap.Api['getFrontendFees'] = async () => {
Copy link
Collaborator Author

@michaeljscript michaeljscript Oct 19, 2023

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')
Copy link
Collaborator Author

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> {
Copy link
Collaborator Author

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])

Copy link
Collaborator Author

@michaeljscript michaeljscript Oct 19, 2023

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: {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What is the endpoint?

Copy link
Collaborator Author

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',
Copy link
Collaborator Author

@michaeljscript michaeljscript Oct 19, 2023

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(() => {
Copy link
Collaborator Author

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?

@stackchain
Copy link
Member

I think we can close in favour of #2807

@michaeljscript
Copy link
Collaborator Author

@stackchain sounds good to me

@michaeljscript michaeljscript deleted the feat/swap-frontend-fee branch January 25, 2024 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants