-
Notifications
You must be signed in to change notification settings - Fork 47
/
Fee.tsx
45 lines (35 loc) · 1.08 KB
/
Fee.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React from 'react'
import {StyleSheet} from 'react-native'
import {Text} from '../../components'
import {formatTokenWithSymbol} from '../../legacy/format'
import {useSelectedWallet} from '../../SelectedWallet'
import {YoroiUnsignedTx} from '../../yoroi-wallets/types'
import {Amounts} from '../../yoroi-wallets/utils'
import {useStrings} from './strings'
export const Fee = ({yoroiUnsignedTx}: {yoroiUnsignedTx: YoroiUnsignedTx | null}) => {
const strings = useStrings()
const wallet = useSelectedWallet()
if (yoroiUnsignedTx == null) {
return (
<Text style={styles.info} testID="feesText">
{strings.feeLabel}
{': '}
{strings.feeNotAvailable}
</Text>
)
}
const primaryAmount = Amounts.getAmount(yoroiUnsignedTx.fee, wallet.primaryToken.identifier)
return (
<Text style={styles.info} testID="feesText">
{strings.feeLabel}
{': '}
{formatTokenWithSymbol(primaryAmount.quantity, wallet.primaryToken)}
</Text>
)
}
const styles = StyleSheet.create({
info: {
fontSize: 14,
lineHeight: 22,
},
})