Skip to content

Fix/change fiat calculation#510

Merged
siandreev merged 5 commits intofix/backlog-improvementsfrom
fix/change-fiat-calculation
Oct 16, 2025
Merged

Fix/change fiat calculation#510
siandreev merged 5 commits intofix/backlog-improvementsfrom
fix/change-fiat-calculation

Conversation

@liulekin-tonkeeper
Copy link
Copy Markdown
Contributor

No description provided.

const isRaw = price?.type === ProPriceTypes.RAW;
const tokenAmount = isRaw ? formatDecimals(price.value.stringWeiAmount) : undefined;

const { data: rate } = useRate(CryptoCurrency.TON);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Чтобы не хардкодить тон, валюту можно взять из price, она там уже есть

const loadRateFor = price.type === ProPriceTypes.RAW ? tonAssetAddressToString(price.value.asset.address) : undefined;
useRate(loadRateFor);


export const useFormattedProPrice = (price: ProPrice | undefined) => {
const isRaw = price?.type === ProPriceTypes.RAW;
const tokenAmount = isRaw ? formatDecimals(price.value.stringWeiAmount) : undefined;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

const tokenAmount = isRaw ? price.value.relativeAmount : undefined;

const { data: rate } = useRate(CryptoCurrency.TON);
const { fiatAmount: fiatEquivalent } = useFormatFiat(rate, tokenAmount);

return useQuery(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

можно просто useMemo

@siandreev siandreev force-pushed the fix/change-fiat-calculation branch from 1d055bd to fcb2999 Compare October 16, 2025 10:58
@siandreev siandreev merged commit bbdc2eb into fix/backlog-improvements Oct 16, 2025
9 checks passed
@github-actions
Copy link
Copy Markdown

Successful WEB deployment 🚀🚀🚀

Well done!
Link to test environment:
https://ab87d7b2.tonkeeper-web.pages.dev

@github-actions
Copy link
Copy Markdown

Successful iPad build 🚀🚀🚀

Well done!
The app with build version: 4.3.1(28)
Uploaded to TestFlight

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