Skip to content

Commit 6f97ee5

Browse files
CP-10860: Remove x/p address prefix (#2889)
1 parent 57c508c commit 6f97ee5

File tree

1 file changed

+20
-2
lines changed
  • packages/core-mobile/app/new/features/send/components

1 file changed

+20
-2
lines changed

packages/core-mobile/app/new/features/send/components/SendToken.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'
2525
import { useSelector } from 'react-redux'
2626
import { selectSelectedCurrency } from 'store/settings/currency'
2727
import { TRUNCATE_ADDRESS_LENGTH } from 'common/consts/text'
28+
import { xpAddressWithoutPrefix } from 'common/utils/xpAddressWIthoutPrefix'
2829
import { useSendContext } from '../context/sendContext'
2930
import { useSendSelectedToken } from '../store'
3031

@@ -98,6 +99,20 @@ export const SendToken = ({ onSend }: { onSend: () => void }): JSX.Element => {
9899
)
99100
}, [network.networkToken.decimals, selectedToken])
100101

102+
const addressToSendWithoutPrefix = useMemo(() => {
103+
if (selectedToken === undefined) {
104+
return undefined
105+
}
106+
if (
107+
addressToSend &&
108+
(isTokenWithBalancePVM(selectedToken) ||
109+
isTokenWithBalanceAVM(selectedToken))
110+
) {
111+
return xpAddressWithoutPrefix(addressToSend)
112+
}
113+
return addressToSend
114+
}, [addressToSend, selectedToken])
115+
101116
const canSubmit =
102117
!isSending &&
103118
amount &&
@@ -201,15 +216,18 @@ export const SendToken = ({ onSend }: { onSend: () => void }): JSX.Element => {
201216
{recipient.name}
202217
</Text>
203218
)}
204-
{addressToSend && (
219+
{addressToSendWithoutPrefix && (
205220
<Text
206221
variant="mono"
207222
numberOfLines={1}
208223
sx={{
209224
fontSize: 13,
210225
color: colors.$textSecondary
211226
}}>
212-
{truncateAddress(addressToSend, TRUNCATE_ADDRESS_LENGTH)}
227+
{truncateAddress(
228+
addressToSendWithoutPrefix,
229+
TRUNCATE_ADDRESS_LENGTH
230+
)}
213231
</Text>
214232
)}
215233
</View>

0 commit comments

Comments
 (0)