@bsv/expo-wallet-toolbox 0.4.0 → 0.7.0

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.
Files changed (182) hide show
  1. package/CHANGELOG.md +547 -0
  2. package/README.md +19 -1
  3. package/assets/sounds/vault-deposit.wav +0 -0
  4. package/assets/sounds/vault-withdraw.wav +0 -0
  5. package/core/amountFormatHelpers.ts +238 -34
  6. package/core/backup/RemoteSyncReader.ts +2 -5
  7. package/core/backup/codec.ts +2 -2
  8. package/core/backup/push.ts +1 -1
  9. package/core/config.tsx +16 -1
  10. package/core/contacts/contactActivity.ts +153 -0
  11. package/core/contacts/contactCache.ts +41 -0
  12. package/core/contacts/contactsStore.ts +183 -0
  13. package/core/context/VaultContext.tsx +8 -11
  14. package/core/context/WalletConnectionContext.tsx +137 -52
  15. package/core/context/WalletContext.tsx +464 -30
  16. package/core/demo/demoAssets.ts +60 -0
  17. package/core/demo/demoLedger.ts +240 -0
  18. package/core/demo/demoMandalaRuntime.ts +96 -0
  19. package/core/demo/demoMode.ts +38 -0
  20. package/core/demo/demoWallet.ts +25 -0
  21. package/core/demo/index.ts +26 -0
  22. package/core/demo/useDemo.ts +59 -0
  23. package/core/headers/OfflineFirstChaintracks.ts +52 -14
  24. package/core/headers/headerStore.ts +7 -10
  25. package/core/hooks/useConfirmationSound.ts +14 -8
  26. package/core/i18n/translations.tsx +4562 -986
  27. package/core/identity/contactLink.ts +36 -0
  28. package/core/identity/handleRegistry/client.ts +285 -0
  29. package/core/identity/handleRegistry/profileCert.ts +254 -0
  30. package/core/identity/handleRegistry/registration.ts +559 -0
  31. package/core/identity/handleRegistry/resolver.ts +247 -0
  32. package/core/identity/handleRegistry/rules.ts +104 -0
  33. package/core/index.ts +116 -15
  34. package/core/localpay/build.ts +674 -37
  35. package/core/localpay/codec.ts +68 -5
  36. package/core/localpay/pending.ts +240 -22
  37. package/core/localpay/pendingAborts.ts +5 -1
  38. package/core/localpay/settlementAck.ts +149 -0
  39. package/core/localpay/types.ts +14 -1
  40. package/core/localpay/verify.ts +118 -69
  41. package/core/mandala/abortGuard.ts +134 -0
  42. package/core/mandala/basketMigration.ts +166 -0
  43. package/core/mandala/bundle.ts +244 -0
  44. package/core/mandala/createRuntime.ts +2437 -0
  45. package/core/mandala/drain.ts +670 -0
  46. package/core/mandala/permissionModule.ts +642 -0
  47. package/core/mandala/resendTransfer.ts +175 -0
  48. package/core/mandala/runtime.ts +357 -0
  49. package/core/mandala/settlementStore.ts +412 -0
  50. package/core/mandala/types.ts +290 -0
  51. package/core/monitor/MonitorSupervisor.ts +121 -0
  52. package/core/monitor/TaskBackupPush.ts +1 -1
  53. package/core/monitor/TaskCreditInbox.ts +1 -1
  54. package/core/monitor/TaskDrainOutbox.ts +1 -1
  55. package/core/monitor/TaskSendOffline.ts +1 -1
  56. package/core/net/online.ts +49 -0
  57. package/core/numberFormat.ts +19 -0
  58. package/core/offline/cancelParked.ts +94 -1
  59. package/core/offline/payerHold.ts +152 -12
  60. package/core/offline/plan.ts +1 -1
  61. package/core/offline/tokenFrames.ts +197 -0
  62. package/core/parsePeerPayURI.ts +70 -17
  63. package/core/pay/rails/address.ts +51 -3
  64. package/core/pay/rails/handle.ts +88 -9
  65. package/core/pay/rails/index.ts +16 -6
  66. package/core/pay/rails/nearby.ts +114 -4
  67. package/core/pay/recordProof.ts +2 -6
  68. package/core/services/arcadeBroadcastProvider.ts +1 -4
  69. package/core/services/capWalletArgs.ts +8 -9
  70. package/core/services/exchangeRate.ts +1 -1
  71. package/core/services/externalOrigin.ts +42 -0
  72. package/core/services/vault/VaultKeyService.ts +912 -251
  73. package/core/services/vault/ceremony.ts +435 -367
  74. package/core/services/vault/ceremonyHost.ts +27 -21
  75. package/core/services/vault/devMock.ts +30 -7
  76. package/core/services/vault/driver.ts +95 -41
  77. package/core/services/vault/guard.ts +514 -56
  78. package/core/services/vault/hardwareLease.ts +22 -0
  79. package/core/services/vault/mockYubiKey.ts +258 -90
  80. package/core/services/vault/pivReset.ts +145 -0
  81. package/core/services/vault/r1comb.ts +976 -0
  82. package/core/services/vault/session.ts +93 -26
  83. package/core/services/vault/transfers.ts +2617 -747
  84. package/core/services/vault/types.ts +100 -43
  85. package/core/services/vault/vaultStore.ts +991 -74
  86. package/core/services/walletConnectionValidation.ts +293 -0
  87. package/core/services/walletServiceConfig.ts +31 -20
  88. package/core/storage/StorageExpoSQLite.ts +420 -87
  89. package/core/storage/dbImage.ts +48 -0
  90. package/core/storage/methods/findSql.ts +3 -54
  91. package/core/storage/methods/listActionsSql.ts +8 -5
  92. package/core/storage/methods/listOutputsSql.ts +9 -5
  93. package/core/storage/methods/offlineActions.ts +15 -0
  94. package/core/storage/methods/processOfflineActions.ts +265 -9
  95. package/core/storage/methods/reviewStatusSql.ts +7 -2
  96. package/core/storage/methods/walletBalanceSql.ts +16 -4
  97. package/core/storage/schema/createTables.ts +152 -0
  98. package/core/storage/sqlUpdateValue.ts +24 -0
  99. package/core/toolboxConfig.ts +182 -1
  100. package/core/toolboxTypes.ts +40 -0
  101. package/core/userAvatar.ts +79 -0
  102. package/core/walletMonitor.ts +8 -3
  103. package/core/walletRepair/runWalletCheck.ts +19 -2
  104. package/package.json +31 -30
  105. package/ui/activityFilter.ts +115 -0
  106. package/ui/components/QRScanner.tsx +1 -1
  107. package/ui/components/pay/AdmissionNotice.tsx +99 -0
  108. package/ui/components/pay/AssetPicker.tsx +184 -0
  109. package/ui/components/pay/AvailableBalance.tsx +33 -2
  110. package/ui/components/pay/HandleReceive.tsx +213 -50
  111. package/ui/components/pay/NearbyFlow.tsx +616 -69
  112. package/ui/components/pay/PayForm.tsx +73 -8
  113. package/ui/components/pay/PaymentSuccessOverlay.tsx +89 -8
  114. package/ui/components/pay/RecipientField.tsx +132 -73
  115. package/ui/components/pay/RequestHub.tsx +68 -8
  116. package/ui/components/pay/ResultBanner.tsx +41 -4
  117. package/ui/components/pay/StepBar.tsx +32 -0
  118. package/ui/components/pay/UniversalSend.tsx +1118 -86
  119. package/ui/components/pay/tokenSendCopy.ts +116 -0
  120. package/ui/components/pay/useRecipientInput.ts +36 -7
  121. package/ui/components/ui/PencilEditField.tsx +109 -0
  122. package/ui/components/ui/PermissionSheet.tsx +65 -4
  123. package/ui/components/ui/Sheet.tsx +9 -2
  124. package/ui/components/ui/SlideOverFromRight.tsx +86 -0
  125. package/ui/components/vault/EnrollWizard.tsx +1432 -488
  126. package/ui/components/vault/KeyChooser.tsx +96 -0
  127. package/ui/components/vault/VaultCeremonySheet.tsx +107 -43
  128. package/ui/components/vault/vaultErrorCopy.ts +145 -0
  129. package/ui/components/wallet/ActivityRow.tsx +283 -97
  130. package/ui/components/wallet/AmountInput.tsx +92 -28
  131. package/ui/components/wallet/AssetAmount.tsx +95 -0
  132. package/ui/components/wallet/AssetSwitcherDropdown.tsx +261 -0
  133. package/ui/components/wallet/ContactActivityList.tsx +149 -0
  134. package/ui/components/wallet/ContactSigil.tsx +49 -0
  135. package/ui/components/wallet/EditPictureSheet.tsx +99 -0
  136. package/ui/components/wallet/FitAmount.tsx +148 -0
  137. package/ui/components/wallet/IconPickerSheet.tsx +168 -0
  138. package/ui/components/wallet/IdentifierRow.tsx +69 -0
  139. package/ui/components/wallet/ImportFromBackupPrompt.tsx +35 -13
  140. package/ui/components/wallet/ProfileButton.tsx +62 -0
  141. package/ui/components/wallet/UserAvatar.tsx +85 -0
  142. package/ui/components/wallet/avatarIcons.ts +122 -0
  143. package/ui/components/wallet/tokenEviction.ts +65 -0
  144. package/ui/hooks/useContactsStore.ts +10 -0
  145. package/ui/hooks/useExportWalletData.ts +39 -0
  146. package/ui/hooks/useMandala.ts +320 -0
  147. package/ui/hooks/useOnline.ts +65 -20
  148. package/ui/hooks/useVaultBalance.ts +105 -7
  149. package/ui/hooks/useVaultCoverage.ts +52 -0
  150. package/ui/importDatabases.ts +7 -3
  151. package/ui/index.ts +75 -7
  152. package/ui/screens/ConnectionsScreen.tsx +46 -29
  153. package/ui/screens/ContactScreen.tsx +289 -0
  154. package/ui/screens/ContactsScreen.tsx +373 -0
  155. package/ui/screens/IdentifierScreen.tsx +234 -0
  156. package/ui/screens/NewContactScreen.tsx +362 -0
  157. package/ui/screens/PairScreen.tsx +12 -12
  158. package/ui/screens/PayScreen.tsx +145 -12
  159. package/ui/screens/ProfileScreen.tsx +783 -0
  160. package/ui/screens/SettingsScreen.tsx +18 -9
  161. package/ui/screens/TransactionDetailScreen.tsx +419 -0
  162. package/ui/screens/TrustScreen.tsx +1 -1
  163. package/ui/screens/VaultScreen.tsx +925 -171
  164. package/ui/screens/VaultTransferScreen.tsx +376 -123
  165. package/ui/screens/WalletCheckScreen.tsx +10 -1
  166. package/ui/screens/WalletConfigScreen.tsx +80 -16
  167. package/ui/screens/WalletHomeScreen.tsx +915 -139
  168. package/ui/screens/homeBadges.ts +9 -1
  169. package/ui/screens/tokenRowTitle.ts +68 -0
  170. package/ui/tokenFormat.ts +108 -0
  171. package/ui/tokenSeen.ts +75 -0
  172. package/ui/tokenStatus.ts +100 -0
  173. package/ui/txStatus.ts +43 -5
  174. package/assets/sounds/vault-close.wav +0 -0
  175. package/assets/sounds/vault-open.wav +0 -0
  176. package/core/services/vault/k1.ts +0 -75
  177. package/core/services/vault/sealing.ts +0 -84
  178. package/core/services/vault/vaultDerivation.ts +0 -152
  179. package/core/services/vault/vaultPassphrase.ts +0 -287
  180. package/ui/components/vault/PassphraseField.tsx +0 -306
  181. package/ui/components/vault/PhraseBackupSheet.tsx +0 -227
  182. package/ui/screens/VaultRecoverScreen.tsx +0 -226
@@ -13,7 +13,7 @@
13
13
  * txid to a clipboard is not that — it is debugging, and it used to crowd out
14
14
  * the two chips that actually resolve a stuck payment.
15
15
  */
16
- import React, { memo, useContext, useMemo } from 'react'
16
+ import React, { memo, useCallback, useContext, useEffect, useMemo, useState } from 'react'
17
17
  import { View, Text, StyleSheet, ActivityIndicator } from 'react-native'
18
18
  import { useTranslation } from 'react-i18next'
19
19
  import type { WalletAction } from '@bsv/sdk'
@@ -29,11 +29,31 @@ import {
29
29
  counterpartyOf,
30
30
  counterpartyHue,
31
31
  sigilPointOf,
32
- sigilPalette
32
+ sigilPalette,
33
+ type Counterparty
33
34
  } from '@bsv/expo-wallet-toolbox'
34
- import { txStatusView, toneColor } from '../../txStatus'
35
+ import { txStatusView, toneColor, type TxStatusView } from '../../txStatus'
35
36
  import PressableScale from '../ui/PressableScale'
36
37
  import Sigil from '../ui/Sigil'
38
+ import type { ContactsStore } from '../../../core/contacts/contactsStore'
39
+
40
+ /**
41
+ * expo-router is required lazily rather than imported at module scope: this
42
+ * file is barrel-exported from the package's `ui` entry point, and a static
43
+ * top-level `import` of expo-router pulls in its own untransformed JSX
44
+ * source, which Jest cannot parse for any consumer of the barrel, even one
45
+ * that never navigates. Same pattern as every other screen/component in this
46
+ * package that needs the router.
47
+ */
48
+ type ExpoRouterModule = typeof import('expo-router')
49
+ let expoRouterMod: ExpoRouterModule | undefined
50
+ function loadExpoRouter(): ExpoRouterModule {
51
+ if (!expoRouterMod) {
52
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
53
+ expoRouterMod = require('expo-router') as ExpoRouterModule
54
+ }
55
+ return expoRouterMod
56
+ }
37
57
 
38
58
  /**
39
59
  * @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
@@ -56,9 +76,8 @@ function loadIonicons(): IoniconsComponent {
56
76
  }
57
77
  function loadMaterialCommunityIcons(): MaterialCommunityIconsComponent {
58
78
  if (!materialCommunityIconsComponent) {
59
- materialCommunityIconsComponent = require('@expo/vector-icons')
60
- // eslint-disable-next-line @typescript-eslint/no-require-imports
61
- .MaterialCommunityIcons as MaterialCommunityIconsComponent
79
+ materialCommunityIconsComponent = // eslint-disable-next-line @typescript-eslint/no-require-imports
80
+ require('@expo/vector-icons').MaterialCommunityIcons as MaterialCommunityIconsComponent
62
81
  }
63
82
  return materialCommunityIconsComponent
64
83
  }
@@ -76,6 +95,20 @@ export type ActivityAction = WalletAction & {
76
95
  interface Props {
77
96
  /** Pass the screen currency to avoid subscribing every row to wallet updates. */
78
97
  currency?: string
98
+ /**
99
+ * Pass this alongside `currency` for the same reason: without it the row
100
+ * would call `useWallet()` itself just to scope the contact lookup below,
101
+ * subscribing every row to wallet updates again. `undefined`/`null` simply
102
+ * means the tappable-contact-face feature never activates for this row.
103
+ */
104
+ walletUserId?: number | null
105
+ /**
106
+ * Same reason as `walletUserId`: built once at the screen and passed down
107
+ * rather than resolved per row via `useContactsStore()`, which reaches
108
+ * `useWallet()` internally — exactly the subscription `currency` above
109
+ * already exists to avoid.
110
+ */
111
+ contactsStore?: ContactsStore | null
79
112
  action: ActivityAction
80
113
  /** Identity of this row in the list's expanded/busy bookkeeping. Passed back
81
114
  * to `onToggle` so the handler can stay referentially stable across renders —
@@ -89,6 +122,12 @@ interface Props {
89
122
  * question ("is it sending? cancelling?") the row can answer. */
90
123
  busyLabel?: string
91
124
  onToggle: (rowKey: string) => void
125
+ /**
126
+ * Open this row's detail view. When present it REPLACES the expand-in-place
127
+ * tap: a row means one thing, and the utilities that used to unfold
128
+ * underneath it are the detail screen's overflow menu.
129
+ */
130
+ onOpen?: (action: ActivityAction) => void
92
131
  onExplorer: (txid: string) => void
93
132
  onRefreshTx: (txid: string) => void
94
133
  onAbort: (reference: string) => void
@@ -98,6 +137,42 @@ interface Props {
98
137
  onSendAgain?: (action: ActivityAction) => void
99
138
  /** Cancel a parked payment: abort the action and retire its queue row. */
100
139
  onCancelParked?: (txid: string) => void
140
+ /**
141
+ * Token denomination for a `'mandala'`-labelled action.
142
+ *
143
+ * Absent, this row is byte-identical to the row it has always been. Present,
144
+ * it overrides three things and only those three:
145
+ *
146
+ * · the DESCRIPTION, because the lib writes a developer string containing a
147
+ * raw 36-byte token id and this row renders `action.description` verbatim;
148
+ * · the AMOUNT, because `action.satoshis` for a token send is the net BSV
149
+ * spent — printing "−64 sats" for a payment of 25.00 USDX would be a
150
+ * plausible wrong number, which is worse than a blank. When the figure
151
+ * cannot be recovered the row says so rather than falling through;
152
+ * · the FACE, because the wallet action's own labels/senderIdentityKey are
153
+ * meaningless for a token transfer (they describe the BSV coin-selection
154
+ * tx, not the counterparty) — `counterpartyKey` is the row's own word for
155
+ * who was on the other side, and the row draws the same generative sigil
156
+ * a BSV row does, keyed on it directly rather than on `counterpartyOf`.
157
+ */
158
+ token?: {
159
+ title: string
160
+ /** The figure and its unit, or undefined when it could not be recovered. */
161
+ amount?: { value: string; unit: string }
162
+ incoming: boolean
163
+ /**
164
+ * The counterparty's identity key — a received row's sender (the
165
+ * blinded, per-payment A′; deliberately a different key on every payment
166
+ * from the same payer, spec D2) or a sent row's payee. Undefined draws
167
+ * the plain direction arrow instead, the same fallback a BSV row gets for
168
+ * a counterparty it cannot name.
169
+ */
170
+ counterpartyKey?: string
171
+ /** Settlement status line, in place of the chain-status words. */
172
+ statusText?: string
173
+ /** Settlement status as a tone + label; drives the dot as a BSV row's does. */
174
+ status?: TxStatusView
175
+ }
101
176
  }
102
177
 
103
178
  /** Statuses whose transaction is still local and therefore abortable: nothing
@@ -120,6 +195,8 @@ export function formatRowTime(value?: string | number | Date): string {
120
195
 
121
196
  function ActivityRowBase({
122
197
  currency,
198
+ walletUserId,
199
+ contactsStore,
123
200
  action,
124
201
  rowKey,
125
202
  offlineStatus,
@@ -127,25 +204,30 @@ function ActivityRowBase({
127
204
  busy,
128
205
  busyLabel,
129
206
  onToggle,
207
+ onOpen,
130
208
  onExplorer,
131
209
  onRefreshTx,
132
210
  onAbort,
133
211
  onSendPaymentDetails,
134
212
  onSendAgain,
135
- onCancelParked
213
+ onCancelParked,
214
+ token
136
215
  }: Props & { currency: string }) {
137
216
  const { t } = useTranslation()
138
217
  const { colors, isDark } = useTheme()
139
218
  const { satoshisPerUSD, usdToFiat = {} } = useContext(ExchangeRateContext)
140
219
  const MaterialCommunityIcons = loadMaterialCommunityIcons()
141
220
 
142
- const view = txStatusView(action.status, offlineStatus)
221
+ const incoming = token ? token.incoming : action.satoshis >= 0
222
+ // Direction decides the settled wording ("Received" vs "Sent"), so it has to
223
+ // be known before the status view is built.
224
+ const view = token?.status ?? txStatusView(action.status, offlineStatus, incoming, action.labels)
143
225
  const settled = view.tone === 'settled'
144
226
  const tone = toneColor(view.tone, colors as unknown as Record<string, string>)
145
- const incoming = action.satoshis >= 0
146
227
 
147
228
  const { value, unit } = formatAmountParts(action.satoshis, currency, satoshisPerUSD, {
148
229
  abbreviate: true,
230
+ compact: true,
149
231
  showPlus: true,
150
232
  usdToFiat
151
233
  })
@@ -154,6 +236,7 @@ function ActivityRowBase({
154
236
  // reason a sats-denominated wallet needs a fiat line at all.
155
237
  const secondary = formatAmount(action.satoshis, currency === 'BSV' ? 'USD' : 'BSV', satoshisPerUSD, {
156
238
  abbreviate: true,
239
+ compact: true,
157
240
  showPlus: true,
158
241
  usdToFiat
159
242
  })
@@ -169,15 +252,64 @@ function ActivityRowBase({
169
252
  // is unambiguous.
170
253
  const { labels, senderIdentityKey, txid } = action
171
254
  const labelsKey = labels?.join('\n') ?? ''
255
+ // Scalars, not the `token` object itself: a fresh `token` reference every
256
+ // poll must not re-derive the face when nothing about it actually changed.
257
+ const isTokenRow = token !== undefined
258
+ const tokenCounterpartyKey = token?.counterpartyKey
172
259
  const face = useMemo(() => {
260
+ // A token row is identified by its OWN counterparty key, never by
261
+ // `counterpartyOf(action)`: the action's labels/senderIdentityKey belong
262
+ // to the underlying BSV coin-selection transaction, not to who the token
263
+ // moved with. No key (an unresolvable/blinded counterparty) draws the
264
+ // plain arrow, same as any other row this hook cannot name.
265
+ if (isTokenRow) {
266
+ if (!tokenCounterpartyKey) return null
267
+ const cp: Counterparty = { kind: 'identityKey', value: tokenCounterpartyKey }
268
+ return { point: sigilPointOf(cp), hue: counterpartyHue(cp) }
269
+ }
173
270
  const cp = counterpartyOf({ labels: labelsKey === '' ? undefined : labelsKey.split('\n'), senderIdentityKey, txid })
174
271
  return cp ? { point: sigilPointOf(cp), hue: counterpartyHue(cp) } : null
175
- }, [labelsKey, senderIdentityKey, txid])
272
+ }, [labelsKey, senderIdentityKey, txid, isTokenRow, tokenCounterpartyKey])
176
273
  // Resolved outside the memo: the hue is a property of the counterparty, the
177
274
  // colours it maps to are a property of the theme, and the theme can flip
178
275
  // under a mounted row. Two HSL conversions per render are not worth a dep.
179
276
  const palette = face ? sigilPalette(face.hue, !!isDark) : null
180
277
 
278
+ // The counterparty's own identity key, when the row can name one at all —
279
+ // an address or a bare txid (the other two `counterpartyOf` kinds) can
280
+ // never be a saved contact. Recomputed independently of `face` above: that
281
+ // memo only keeps what the sigil needs (point/hue), and duplicating the
282
+ // (pure, cheap) `counterpartyOf` call here is simpler than threading a
283
+ // second value out of it.
284
+ const counterpartyIdentityKey = useMemo(() => {
285
+ if (isTokenRow) return tokenCounterpartyKey
286
+ const cp = counterpartyOf({ labels: labelsKey === '' ? undefined : labelsKey.split('\n'), senderIdentityKey, txid })
287
+ return cp?.kind === 'identityKey' ? cp.value : undefined
288
+ }, [labelsKey, senderIdentityKey, txid, isTokenRow, tokenCounterpartyKey])
289
+
290
+ // Whether the face is tappable, expanded or not (2026-09-18) — only for a
291
+ // counterparty already saved as a contact; nobody this row cannot name a
292
+ // saved contact for gets a tap that opens nothing.
293
+ const [isContact, setIsContact] = useState(false)
294
+ useEffect(() => {
295
+ if (!counterpartyIdentityKey || !contactsStore || walletUserId == null) {
296
+ setIsContact(false)
297
+ return
298
+ }
299
+ let cancelled = false
300
+ void contactsStore.getContact(walletUserId, counterpartyIdentityKey).then(c => {
301
+ if (!cancelled) setIsContact(!!c)
302
+ })
303
+ return () => {
304
+ cancelled = true
305
+ }
306
+ }, [counterpartyIdentityKey, contactsStore, walletUserId])
307
+ const faceTappable = isContact && !!counterpartyIdentityKey
308
+ const onPressFace = useCallback(() => {
309
+ if (!counterpartyIdentityKey) return
310
+ loadExpoRouter().router.push({ pathname: '/contact', params: { identityKey: counterpartyIdentityKey } } as never)
311
+ }, [counterpartyIdentityKey])
312
+
181
313
  // A parked payment was built and shown as a code, but never released: it is
182
314
  // not on chain and no task will put it there. An explorer link would 404 and
183
315
  // a Refresh would ask the network about a transaction it has never seen, so
@@ -188,14 +320,16 @@ function ActivityRowBase({
188
320
  const parked = offlineStatus === 'parked'
189
321
  const canCancelParked = parked && !!action.txid && !!onCancelParked
190
322
  const canAbort = !parked && ABORTABLE_STATUSES.has(action.status) && !!action.reference
191
- // Any outgoing payment this wallet can rebuild: both rails write the payee's
192
- // identity key as a label and the derivation data as customInstructions, so
193
- // the details can be re-delivered whether the payment went out through a
194
- // message box or a nearby code that may never have been scanned.
323
+ // Any outgoing payment this wallet can re-deliver over the message box: both
324
+ // rails write the payee's identity key as a label and the derivation data as
325
+ // customInstructions, so the details can be sent again whether the payment
326
+ // went out through a message box or a nearby code that may never have been
327
+ // scanned. A token row qualifies too — the home screen routes it to the
328
+ // Mandala runtime's own re-delivery rather than a BRC-29 rebuild.
195
329
  const resendableOutbound =
196
330
  !!action.txid &&
197
331
  (action.isOutgoing ?? !incoming) &&
198
- !!action.labels?.some(l => l === 'peerpay' || l === 'localpay')
332
+ !!action.labels?.some(l => l === 'peerpay' || l === 'localpay' || l === 'mandala')
199
333
  const canResendDetails = resendableOutbound && !!onSendPaymentDetails
200
334
  const canSendAgain = !parked && !incoming && action.status === 'failed' && !!onSendAgain
201
335
  const hasUtilities = parked
@@ -213,89 +347,140 @@ function ActivityRowBase({
213
347
  }
214
348
  ]}
215
349
  >
216
- <PressableScale
217
- scaleTo={0.99}
218
- onPress={hasUtilities ? () => onToggle(rowKey) : undefined}
219
- style={styles.row}
220
- accessibilityRole="button"
221
- accessibilityState={{ expanded }}
222
- accessibilityLabel={action.description || t('transactions')}
223
- >
350
+ <View style={styles.row}>
224
351
  {/* The sigil fills the tile, so direction moves to the border tint
225
352
  alone: the same tints as the arrow tile, so a mixed list still
226
353
  reads consistently down the left edge. The tile takes the
227
354
  counterparty's own colour, and the sigil is drawn in exactly that
228
355
  pair: sigil-js cuts its glyph lines in the background colour, so
229
- the fill must be the same solid or the cuts show as a halo. */}
230
- {face !== null && palette !== null ? (
231
- <View
232
- style={[
233
- styles.glyph,
234
- styles.avatar,
235
- {
236
- backgroundColor: palette.background,
237
- borderColor: incoming ? colors.successStrong + '2E' : colors.surfaceSunkenBorder
238
- }
239
- ]}
240
- >
241
- <Sigil
242
- point={face.point}
243
- size={38}
244
- foreground={palette.foreground}
245
- background={palette.background}
246
- detail="default"
247
- />
248
- </View>
249
- ) : (
250
- <View
251
- style={[
252
- styles.glyph,
253
- incoming
254
- ? {
255
- backgroundColor: colors.successStrong + '1A',
256
- borderColor: colors.successStrong + '2E'
257
- }
258
- : { backgroundColor: colors.surfaceSunken, borderColor: colors.surfaceSunkenBorder }
259
- ]}
260
- >
261
- <MaterialCommunityIcons
262
- name={incoming ? 'arrow-bottom-left' : 'arrow-top-right'}
263
- size={16}
264
- color={incoming ? colors.successStrong : colors.textSecondary}
265
- />
266
- </View>
267
- )}
356
+ the fill must be the same solid or the cuts show as a halo.
268
357
 
269
- <View style={styles.middle}>
270
- <Text style={[styles.description, { color: colors.textPrimary }]} numberOfLines={1}>
271
- {action.description || t('transactions')}
272
- </Text>
273
- <View style={styles.statusLine}>
274
- <View
275
- style={[
276
- styles.dot,
277
- { backgroundColor: settled ? colors.successStrong : tone }
278
- ]}
279
- />
280
- <Text
281
- style={[styles.statusText, { color: settled ? colors.textSecondary : tone }]}
282
- numberOfLines={1}
358
+ A separate pressable from the row below it (2026-09-18), expanded
359
+ or not: tapping a face that names a saved contact opens their
360
+ contact page, while tapping the rest of the row still toggles the
361
+ chips — two touch targets, not one nested inside the other. No
362
+ visual affordance on the tile itself (a highlight ring was tried
363
+ and dropped) — the row already reads as tappable as a whole. */}
364
+ {(() => {
365
+ const tile =
366
+ face !== null && palette !== null ? (
367
+ <View
368
+ style={[
369
+ styles.glyph,
370
+ styles.avatar,
371
+ {
372
+ backgroundColor: palette.background,
373
+ borderColor: incoming ? colors.successStrong + '2E' : colors.surfaceSunkenBorder
374
+ }
375
+ ]}
376
+ >
377
+ <Sigil
378
+ point={face.point}
379
+ size={38}
380
+ foreground={palette.foreground}
381
+ background={palette.background}
382
+ detail="default"
383
+ />
384
+ </View>
385
+ ) : (
386
+ <View
387
+ style={[
388
+ styles.glyph,
389
+ incoming
390
+ ? {
391
+ backgroundColor: colors.successStrong + '1A',
392
+ borderColor: colors.successStrong + '2E'
393
+ }
394
+ : { backgroundColor: colors.surfaceSunken, borderColor: colors.surfaceSunkenBorder }
395
+ ]}
396
+ >
397
+ <MaterialCommunityIcons
398
+ name={incoming ? 'arrow-bottom-left' : 'arrow-top-right'}
399
+ size={16}
400
+ color={incoming ? colors.successStrong : colors.textSecondary}
401
+ />
402
+ </View>
403
+ )
404
+ return faceTappable ? (
405
+ <PressableScale
406
+ onPress={onPressFace}
407
+ scaleTo={0.92}
408
+ accessibilityRole="button"
409
+ accessibilityLabel={t('activity_view_contact')}
283
410
  >
284
- {time ? `${t(view.key)} · ${time}` : t(view.key)}
411
+ {tile}
412
+ </PressableScale>
413
+ ) : (
414
+ tile
415
+ )
416
+ })()}
417
+
418
+ <PressableScale
419
+ scaleTo={0.99}
420
+ onPress={onOpen ? () => onOpen(action) : hasUtilities ? () => onToggle(rowKey) : undefined}
421
+ style={styles.rowRest}
422
+ accessibilityRole="button"
423
+ accessibilityState={onOpen ? undefined : { expanded }}
424
+ accessibilityLabel={
425
+ token
426
+ ? // Never the lib's developer description, which carries a raw
427
+ // 36-byte token id, and never silence for a figure we could not
428
+ // recover: "Sent USDX, amount unavailable" is the honest read.
429
+ `${token.title}, ${
430
+ token.amount ? `${token.amount.value} ${token.amount.unit}` : t('token_row_amount_pending')
431
+ }`
432
+ : action.description || t('transactions')
433
+ }
434
+ >
435
+ <View style={styles.middle}>
436
+ <Text style={[styles.description, { color: colors.textPrimary }]} numberOfLines={1}>
437
+ {token ? token.title : action.description || t('transactions')}
285
438
  </Text>
439
+ <View style={styles.statusLine}>
440
+ {/* A dot only where the tone carries a warning. A settled row is
441
+ the normal case, and marking every normal row green made the
442
+ list a wall of confirmation the eye had to read past. */}
443
+ {settled ? null : <View style={[styles.dot, { backgroundColor: tone }]} />}
444
+ <Text style={[styles.statusText, { color: settled ? colors.textSecondary : tone }]} numberOfLines={1}>
445
+ {(() => {
446
+ const words = token?.status ? t(view.key) : (token?.statusText ?? t(view.key))
447
+ return time ? `${words} · ${time}` : words
448
+ })()}
449
+ </Text>
450
+ </View>
286
451
  </View>
287
- </View>
288
452
 
289
- <View style={styles.amounts}>
290
- <Text style={[styles.amount, { color: amountColor }]}>
291
- {value}
292
- {unit ? <Text style={[styles.amountUnit, { color: unitColor }]}> {unit}</Text> : null}
293
- </Text>
294
- <Text style={[styles.amountSecondary, { color: colors.textTertiary }]}>{secondary}</Text>
295
- </View>
296
- </PressableScale>
453
+ <View style={styles.amounts}>
454
+ {token ? (
455
+ token.amount ? (
456
+ // No secondary denomination line: this wallet has no price for a
457
+ // token, and a converted figure would be invented.
458
+ <Text
459
+ style={[styles.amount, { color: amountColor }]}
460
+ accessibilityLabel={`${token.amount.value} ${token.amount.unit}`}
461
+ >
462
+ {token.amount.value}
463
+ <Text style={[styles.amountUnit, { color: unitColor }]}> {token.amount.unit}</Text>
464
+ </Text>
465
+ ) : (
466
+ <Text style={[styles.amountSecondary, { color: colors.textTertiary }]}>
467
+ {t('token_row_amount_pending')}
468
+ </Text>
469
+ )
470
+ ) : (
471
+ <>
472
+ <Text style={[styles.amount, { color: amountColor }]}>
473
+ {value}
474
+ {unit ? <Text style={[styles.amountUnit, { color: unitColor }]}> {unit}</Text> : null}
475
+ </Text>
476
+ <Text style={[styles.amountSecondary, { color: colors.textTertiary }]}>{secondary}</Text>
477
+ </>
478
+ )}
479
+ </View>
480
+ </PressableScale>
481
+ </View>
297
482
 
298
- {expanded && hasUtilities ? (
483
+ {!onOpen && expanded && hasUtilities ? (
299
484
  <View style={styles.chips}>
300
485
  {busy ? (
301
486
  <View style={styles.busyRow}>
@@ -366,9 +551,7 @@ function ActivityRowBase({
366
551
  {/* Inset to the description, not the screen edge: the rule separates the
367
552
  text columns, and the glyph tiles already read as separate objects. An
368
553
  expanded row is bounded by its own surface, so it needs no rule. */}
369
- {expanded ? null : (
370
- <View style={[styles.separator, { backgroundColor: colors.hairline }]} />
371
- )}
554
+ {expanded ? null : <View style={[styles.separator, { backgroundColor: colors.hairline }]} />}
372
555
  </View>
373
556
  )
374
557
  }
@@ -393,10 +576,7 @@ function Chip({
393
576
  <PressableScale
394
577
  onPress={onPress}
395
578
  haptic="tap"
396
- style={[
397
- styles.chip,
398
- { backgroundColor: colors.surfaceRaised, borderColor: colors.surfaceRaisedBorder }
399
- ]}
579
+ style={[styles.chip, { backgroundColor: colors.surfaceRaised, borderColor: colors.surfaceRaisedBorder }]}
400
580
  accessibilityRole="button"
401
581
  accessibilityLabel={accessibilityLabel}
402
582
  >
@@ -415,6 +595,10 @@ const styles = StyleSheet.create({
415
595
  paddingTop: 13,
416
596
  paddingBottom: 11
417
597
  },
598
+ // The face's touch target and the rest of the row's are two separate
599
+ // pressables side by side; `rowRest` reproduces `row`'s own inner spacing
600
+ // for the middle/amounts pair so splitting them changes no spacing.
601
+ rowRest: { flex: 1, flexDirection: 'row', alignItems: 'center', gap: spacing.md },
418
602
  glyph: {
419
603
  width: 38,
420
604
  height: 38,
@@ -472,7 +656,9 @@ function ConnectedActivityRow(props: Props) {
472
656
  /** Preserve the existing package API for hosts that omit currency; the home
473
657
  * screen supplies it so background wallet updates cannot invalidate each row. */
474
658
  export default function ActivityRow(props: Props) {
475
- return props.currency === undefined
476
- ? <ConnectedActivityRow {...props} />
477
- : <MemoActivityRow {...props} currency={props.currency} />
659
+ return props.currency === undefined ? (
660
+ <ConnectedActivityRow {...props} />
661
+ ) : (
662
+ <MemoActivityRow {...props} currency={props.currency} />
663
+ )
478
664
  }