wallet-stack 1.0.0-alpha.133 → 1.0.0-alpha.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/analytics/Properties.tsx +1 -1
- package/src/components/ReviewTransaction.test.tsx +49 -8
- package/src/components/ReviewTransaction.tsx +58 -12
- package/src/icons/VerifiedBadge.tsx +27 -0
- package/src/identity/actions.ts +0 -17
- package/src/identity/contactMapping.test.ts +78 -19
- package/src/identity/contactMapping.ts +50 -20
- package/src/identity/reducer.ts +7 -21
- package/src/identity/selectors.ts +0 -2
- package/src/recipients/RecipientItemV2.test.tsx +11 -72
- package/src/recipients/RecipientItemV2.tsx +1 -34
- package/src/recipients/recipient.test.ts +6 -5
- package/src/recipients/recipient.ts +7 -12
- package/src/recipients/verifier.ts +20 -0
- package/src/redux/migrations.test.ts +25 -0
- package/src/redux/migrations.ts +21 -0
- package/src/redux/store.test.ts +1 -2
- package/src/redux/store.ts +1 -1
- package/src/send/EnterAmount.tsx +106 -83
- package/src/send/SelectRecipientAddress.tsx +11 -13
- package/src/send/SendConfirmation.test.tsx +3 -3
- package/src/send/SendConfirmation.tsx +3 -3
- package/src/send/SendEnterAmount.test.tsx +27 -0
- package/src/send/SendSelectRecipient.test.tsx +37 -51
- package/src/send/useFetchRecipientVerificationStatus.ts +6 -11
- package/src/transactions/UserSection.tsx +37 -11
- package/src/transactions/feed/TransactionDetailsScreen.test.tsx +6 -6
- package/src/utils/phoneNumbers.ts +0 -11
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
import { useTranslation } from 'react-i18next'
|
|
3
3
|
import { LayoutAnimation, StyleSheet, Text, View } from 'react-native'
|
|
4
|
+
import { formatShortenedAddress } from 'src/account/utils'
|
|
4
5
|
import AccountNumber from 'src/components/AccountNumber'
|
|
5
6
|
import Expandable from 'src/components/Expandable'
|
|
6
7
|
import Touchable from 'src/components/Touchable'
|
|
8
|
+
import VerifiedBadge from 'src/icons/VerifiedBadge'
|
|
7
9
|
import { Screens } from 'src/navigator/Screens'
|
|
8
10
|
import { getDisplayName, Recipient, recipientHasNumber } from 'src/recipients/recipient'
|
|
11
|
+
import { useVerifierName } from 'src/recipients/verifier'
|
|
9
12
|
import colors from 'src/styles/colors'
|
|
10
13
|
import { typeScale } from 'src/styles/fonts'
|
|
11
|
-
import {
|
|
14
|
+
import { Spacing } from 'src/styles/styles'
|
|
12
15
|
|
|
13
16
|
interface Props {
|
|
14
17
|
type: 'sent' | 'received' | 'withdrawn'
|
|
@@ -36,11 +39,30 @@ export default function UserSection({
|
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
const displayName = getDisplayName(recipient, t)
|
|
39
|
-
const displayNumber = recipientHasNumber(recipient)
|
|
40
|
-
? getDisplayNumberInternational(recipient.e164PhoneNumber)
|
|
41
|
-
: undefined
|
|
42
42
|
const address = recipient.address || ''
|
|
43
43
|
|
|
44
|
+
const verifierName = useVerifierName(recipient.address)
|
|
45
|
+
|
|
46
|
+
// Show short address in the secondary row when the primary (displayName) isn't already
|
|
47
|
+
// a formatted address — i.e., when the recipient has a name or phone number so the
|
|
48
|
+
// address would add information rather than duplicating the primary.
|
|
49
|
+
const hasIdentity = !!recipient.name || recipientHasNumber(recipient)
|
|
50
|
+
const shortAddress =
|
|
51
|
+
hasIdentity && recipient.address ? formatShortenedAddress(recipient.address) : undefined
|
|
52
|
+
|
|
53
|
+
const secondaryContent = verifierName ? (
|
|
54
|
+
<View style={styles.secondaryContent}>
|
|
55
|
+
{!!shortAddress && <Text style={styles.secondaryText}>{shortAddress}</Text>}
|
|
56
|
+
<VerifiedBadge
|
|
57
|
+
color={colors.contentSecondary}
|
|
58
|
+
testID={testID ? `${testID}/VerifierBadge` : undefined}
|
|
59
|
+
/>
|
|
60
|
+
<Text style={styles.secondaryText}>{verifierName}</Text>
|
|
61
|
+
</View>
|
|
62
|
+
) : shortAddress ? (
|
|
63
|
+
<Text style={styles.secondaryText}>{shortAddress}</Text>
|
|
64
|
+
) : null
|
|
65
|
+
|
|
44
66
|
const sectionLabel = {
|
|
45
67
|
received: t('receivedFrom'),
|
|
46
68
|
sent: t('sentTo'),
|
|
@@ -54,16 +76,14 @@ export default function UserSection({
|
|
|
54
76
|
<Text style={styles.sectionLabel}>{sectionLabel}</Text>
|
|
55
77
|
<Touchable onPress={toggleExpanded} disabled={!expandable}>
|
|
56
78
|
<>
|
|
57
|
-
<Expandable isExpandable={expandable && !
|
|
79
|
+
<Expandable isExpandable={expandable && !secondaryContent} isExpanded={expanded}>
|
|
58
80
|
<Text style={styles.username} testID={`${testID}/name`}>
|
|
59
81
|
{displayName}
|
|
60
82
|
</Text>
|
|
61
83
|
</Expandable>
|
|
62
|
-
{!!
|
|
63
|
-
<Expandable isExpandable={expandable
|
|
64
|
-
<
|
|
65
|
-
{displayNumber}
|
|
66
|
-
</Text>
|
|
84
|
+
{!!secondaryContent && (
|
|
85
|
+
<Expandable isExpandable={expandable} isExpanded={expanded}>
|
|
86
|
+
<View testID={`${testID}/address`}>{secondaryContent}</View>
|
|
67
87
|
</Expandable>
|
|
68
88
|
)}
|
|
69
89
|
</>
|
|
@@ -104,10 +124,16 @@ const styles = StyleSheet.create({
|
|
|
104
124
|
username: {
|
|
105
125
|
...typeScale.bodyMedium,
|
|
106
126
|
},
|
|
107
|
-
|
|
127
|
+
secondaryText: {
|
|
108
128
|
...typeScale.bodySmall,
|
|
109
129
|
color: colors.contentSecondary,
|
|
110
130
|
},
|
|
131
|
+
secondaryContent: {
|
|
132
|
+
flexDirection: 'row',
|
|
133
|
+
alignItems: 'center',
|
|
134
|
+
gap: Spacing.Tiny4,
|
|
135
|
+
flexShrink: 1,
|
|
136
|
+
},
|
|
111
137
|
avatarContainer: {
|
|
112
138
|
flex: 1,
|
|
113
139
|
justifyContent: 'center',
|
|
@@ -47,7 +47,6 @@ import {
|
|
|
47
47
|
mockClaimRewardTransaction,
|
|
48
48
|
mockCusdAddress,
|
|
49
49
|
mockCusdTokenId,
|
|
50
|
-
mockDisplayNumber2,
|
|
51
50
|
mockE164Number2,
|
|
52
51
|
mockEarnClaimRewardTransaction,
|
|
53
52
|
mockEarnDepositTransaction,
|
|
@@ -326,8 +325,8 @@ describe('TransactionDetailsScreen', () => {
|
|
|
326
325
|
const nameComponent = getByTestId('TransferSent/name')
|
|
327
326
|
expect(getElementText(nameComponent)).toEqual(mockName)
|
|
328
327
|
|
|
329
|
-
const
|
|
330
|
-
expect(getElementText(
|
|
328
|
+
const addressComponent = getByTestId('TransferSent/address')
|
|
329
|
+
expect(getElementText(addressComponent)).toEqual('0x8C3b...ca4E')
|
|
331
330
|
|
|
332
331
|
expect(getByTestId('TransactionDetails/FeeRowItem')).toHaveTextContent('0.01 CELO', {
|
|
333
332
|
exact: false,
|
|
@@ -359,8 +358,8 @@ describe('TransactionDetailsScreen', () => {
|
|
|
359
358
|
const nameComponent = getByTestId('TransferReceived/name')
|
|
360
359
|
expect(getElementText(nameComponent)).toEqual(mockName)
|
|
361
360
|
|
|
362
|
-
const
|
|
363
|
-
expect(getElementText(
|
|
361
|
+
const addressComponent = getByTestId('TransferReceived/address')
|
|
362
|
+
expect(getElementText(addressComponent)).toEqual('0x8C3b...ca4E')
|
|
364
363
|
|
|
365
364
|
const totalComponent = getByTestId('TotalLineItem/Total')
|
|
366
365
|
expect(getElementText(totalComponent)).toEqual('€4.00')
|
|
@@ -381,7 +380,8 @@ describe('TransactionDetailsScreen', () => {
|
|
|
381
380
|
const nameComponent = getByTestId('RewardReceived/name')
|
|
382
381
|
expect(getElementText(nameComponent)).toEqual('feedItemRewardReceivedTitle')
|
|
383
382
|
|
|
384
|
-
|
|
383
|
+
// Rewards senders don't have a known verifier, so the verifier composite isn't shown.
|
|
384
|
+
expect(queryByTestId('RewardReceived/VerifierBadge')).toBeNull()
|
|
385
385
|
|
|
386
386
|
const totalComponent = getByTestId('TotalLineItem/Total')
|
|
387
387
|
expect(getElementText(totalComponent)).toEqual('€4.00')
|
|
@@ -69,17 +69,6 @@ export function getDisplayPhoneNumber(phoneNumber: string, defaultCountryCode: s
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export function getDisplayNumberInternational(e164PhoneNumber: string) {
|
|
73
|
-
const countryCode = getCountryCode(e164PhoneNumber)
|
|
74
|
-
const phoneDetails = parsePhoneNumber(e164PhoneNumber, (countryCode || '').toString())
|
|
75
|
-
if (phoneDetails) {
|
|
76
|
-
return phoneDetails.displayNumberInternational
|
|
77
|
-
} else {
|
|
78
|
-
// Fallback to input instead of showing nothing for invalid numbers
|
|
79
|
-
return e164PhoneNumber
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
72
|
export function isE164NumberStrict(phoneNumber: string) {
|
|
84
73
|
try {
|
|
85
74
|
const parsedPhoneNumber = phoneUtil.parse(phoneNumber)
|