This module provides utilities and types for handling transaction-related functionality in PocketPay.
The transaction feature module centralizes transaction data handling, formatting, and validation to ensure consistent behavior across the app. It also includes the signing confirmation flow that provides security and UX improvements for transaction signing. The transaction feature module centralizes transaction data handling, formatting, and validation to ensure consistent behavior across the app.
Defines TypeScript interfaces and types for transaction data:
TransactionDetail- Complete transaction data structureTransactionStatus- Status types: 'successful', 'pending', 'failed'TransactionStatusConfig- Status display configurationTransactionMetadata- Computed transaction metadata
Utility functions for transaction operations:
getTransactionStatus(tx)- Determines transaction statusisSentTransaction(tx, publicKey)- Checks if transaction was sent by usergetDirectionLabel(tx, publicKey)- Returns 'Sent' or 'Received'
formatTransactionAmount(tx, publicKey)- Formats amount with +/- prefixformatTransactionDate(tx)- Formats timestamp to readable dategetTransactionHash(tx)- Extracts hash from various fieldsgetTransactionMemo(tx)- Extracts memo text and type
validateTransactionData(tx)- Checks for required fieldsgetCounterpartyAddress(tx, publicKey)- Gets sender/recipient address
import {
getTransactionStatus,
formatTransactionAmount,
isSentTransaction
} from '@/features/transactions';
// Check transaction status
const status = getTransactionStatus(transaction);
// Returns: 'successful' | 'pending' | 'failed'
// Format amount with direction
const amount = formatTransactionAmount(transaction, userPublicKey);
// Returns: "+100.50 XLM" or "-25.00 XLM"
// Check if user sent the transaction
const isSent = isSentTransaction(transaction, userPublicKey);
// Returns: true | falseNEW: app/sign-confirmation.tsx - Pre-signing confirmation screen that:
- Shows transaction summary before signing
- Educates users about signing implications
- Provides clear cancellation option
- Hides sensitive technical details (XDR, sequence numbers)
- Separates approval intent from execution
Flow: Send → Sign Confirmation → Review Transaction → Payment Success
See Signing Confirmation Documentation for details.
app/transaction/[id].tsx - Shows full transaction details including:
- Amount and direction
- Transaction status with visual indicators
- Sender and recipient addresses
- Transaction hash with copy functionality
- Memo (if present)
- Explorer link (when available)
- Timestamp
app/(tabs)/history.tsx - Uses TransactionListItem component to display transaction summaries
TransactionListItem.tsx- Reusable transaction row component- Transaction detail screen - Full transaction viewer
Transaction data comes from:
- Stellar Horizon API via
src/services/stellar.ts - Zustand store at
src/store/walletStore.ts
Transactions can have three states:
- Successful - Completed and confirmed on-chain
- Pending - Submitted but not yet confirmed
- Failed - Transaction rejected or error occurred
The status is determined from:
is_pendingfield (boolean)transaction_successfulfield (boolean)
All helper functions safely handle missing or undefined data:
- Returns fallback values ('N/A', 'Unknown date', empty strings)
- Uses optional chaining and nullish coalescing
- Provides
validateTransactionData()for comprehensive checks
Transaction hashes can be viewed on Stellar Expert:
- Uses
getExplorerTxUrl()fromsrc/services/stellar.ts - Supports testnet and mainnet
- Returns
nullfor custom networks without explorer support
Multiple fields may contain the transaction hash:
hashtransaction_hash
Use getTransactionHash() to safely extract the hash.
Multiple fields may contain timestamps:
created_at(ISO string)createdAt(ISO string)timestamp(ISO string or number)
Use formatTransactionDate() to handle all variants.
Memos are optional message attachments to transactions:
memo- The memo text/datamemo_type- Type: 'text', 'id', 'hash', or 'return'
Use getTransactionMemo() to safely extract both fields.
- All text content is screen-reader accessible
- Copy actions provide feedback via icons and text
- Status indicators use both color and icons (not color alone)
- Touch targets meet minimum size requirements
- Selectable text for addresses and hashes
Potential additions:
- Transaction filtering by status, type, or date range
- Export transaction history to CSV
- Transaction notes/tags
- Multi-currency support
- Fee display
- Operation details for complex transactions