-
Notifications
You must be signed in to change notification settings - Fork 47
/
Fees.tsx
29 lines (24 loc) · 994 Bytes
/
Fees.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import * as React from 'react'
import {useIntl} from 'react-intl'
import {Text} from '../../../../../components/Text'
import {txLabels} from '../../../../../i18n/global-messages'
import {formatTokenWithSymbol} from '../../../../../legacy/format'
import {useSelectedWallet} from '../../../../../SelectedWallet/Context/SelectedWalletContext'
import {YoroiUnsignedTx} from '../../../../../yoroi-wallets/types/types'
import {Amounts} from '../../../../../yoroi-wallets/utils/utils'
export const Fees = ({yoroiUnsignedTx}: {yoroiUnsignedTx: YoroiUnsignedTx}) => {
const strings = useStrings()
const wallet = useSelectedWallet()
const feeAmount = Amounts.getAmount(yoroiUnsignedTx.fee, wallet.primaryToken.identifier)
return (
<Text small testID="feesText">
{`${strings.fees}: ${formatTokenWithSymbol(feeAmount.quantity, wallet.primaryToken)}`}
</Text>
)
}
const useStrings = () => {
const intl = useIntl()
return {
fees: intl.formatMessage(txLabels.fees),
}
}