# React Native crypto wallet app template (Pro)

> A complete React Native crypto wallet for iOS, Android and the web: a portfolio you can scrub through, markets with a sortable table, coin detail, swaps that show every fee and the price impact, receiving by QR code, activity and account security.

# Crypto wallet: Orbit Pro

Orbit is a self-custody wallet. The balance card follows your finger along the chart; a swap goes amount → review → done and names the rate, network fee, Orbit fee, price impact and the least you will get before you confirm. It refuses more than you hold.

See it live, on any device

## Use the whole app

```tsx
import { CryptoApp } from '@patine-ui/pro';

<CryptoApp />;
```

| Prop | Type | Default |
| --- | --- | --- |
| `initialRoute` | 'portfolio' \| 'welcome' \| 'markets' \| 'asset' \| 'swap' \| 'receive' \| 'activity' \| 'settings' | 'portfolio' |
| `demo` | `'ready'` \| `'loading'` \| `'empty'` \| `'error'` | `'ready'` |
| `insets` | `{ top, bottom }` | None |
| `platform` | `'ios'` \| `'android'` \| `'web'` | `Platform.OS` |

Screens move the platform's way: on iOS a pushed screen slides in from the trailing edge, on Android they fade through, on the web and between tabs they fade in. Reduce motion turns it off.

## Screens

| Screen | What it does |
| --- | --- |
| `PortfolioScreen` | The balance on a gradient card, an area chart over 1D to 1Y that the balance follows while you scrub, quick actions, holdings with their day, allocation as a donut |
| `WelcomeScreen` | Three swipeable pages on the library's Pager with page dots, Create a wallet and I already have one |
| `MarketsScreen` | Search, chips for watchlist, gainers, losers and sectors; rows with sparklines on phones and a sortable Table with a 7-day line on desktop |
| `AssetScreen` | Price and change for the range, a line chart to scrub, your position, market stats with Stat, an About collapsible, Receive and Swap pinned |
| `SwapScreen` | Steps (Amount, Review, Done), coin pickers on Select, Max, flip, slippage, and a DescriptionList of every fee |
| `ReceiveScreen` | A QRCode with the coin's logo in the middle, the address in groups of four with CopyButton, and which network to use |
| `ActivityScreen` | Pro's ActivityFeed by day with filters; pending and failed swaps flagged |
| `WalletSettingsScreen` | Face ID and backup progress, price alerts you switch or swipe away (SwipeableRow), preferences |

Every screen is exported on its own, takes its data as props, and has sample data as defaults. `swapQuote(from, to, amount, slippage)` returns the rate, fees, price impact and minimum received; `priceSeries` draws a seeded demo history; `applySwap` moves coins between holdings.

## Built with

The free components, from `patine-ui`:

[Alert](/docs/components/alert) · [Avatar](/docs/components/avatar) · [Badge](/docs/components/badge) · [Button](/docs/components/button) · [Card](/docs/components/card) · [ChipGroup](/docs/components/chip-group) · [Collapsible](/docs/components/collapsible) · [CopyButton](/docs/components/copy-button) · [DescriptionList](/docs/components/description-list) · [Heading, Text](/docs/components/text) · [List, ListItem](/docs/components/list) · [PageIndicator, Pager](/docs/components/carousel) · [Progress](/docs/components/progress) · [QRCode](/docs/components/qr-code) · [SearchField](/docs/components/search-field) · [SegmentedControl](/docs/components/segmented-control) · [Select](/docs/components/select) · [Separator](/docs/components/separator) · [Stat](/docs/components/stat) · [Steps](/docs/components/steps) · [SwipeableRow](/docs/components/swipeable-row) · [Switch](/docs/components/switch) · [Table](/docs/components/table) · [TextField](/docs/components/text-field)

And from Patine Pro:

- [Activity feed](/docs/blocks/activity-feed) PRO
- [App shell and layout](/docs/pro/layout) PRO
- [Brand logos](/docs/components/brand-icons) PRO
- [Line chart](/docs/components/line-chart) PRO
- [Pie chart](/docs/components/pie-chart) PRO
- [Sparkline](/docs/components/sparkline) PRO

## Files

```text
crypto/
├── components/
│   ├── AssetRow.tsx
│   └── CoinMark.tsx
├── hooks/
│   ├── useCryptoApp.ts
│   └── useCryptoScreens.ts
├── ActivityScreen.tsx
├── AssetScreen.tsx
├── crypto.constants.ts
├── crypto.types.ts
├── crypto.utils.ts
├── CryptoApp.tsx
├── index.ts
├── MarketsScreen.tsx
├── PortfolioScreen.tsx
├── ReceiveScreen.tsx
├── SwapScreen.tsx
├── WalletSettingsScreen.tsx
└── WelcomeScreen.tsx
```

It also uses `shared/`, the theme, money formatting and screen transitions every Pro app shares.

## A look at the code

A swap quote with every fee and the minimum received, from `crypto.utils.ts`:

```tsx
/** What swapping `amount` of one coin for another returns: the rate, fees, price impact and the least you'll get. */
export const swapQuote = (from: Coin, to: Coin, amount: number, slippage: number): SwapQuote => {
  const value = amount * from.price;
  const priceImpact = amount > 0 ? Math.min(0.05, value / 4_000_000) : 0;
  const serviceFee = value * SERVICE_FEE;
  const networkFee = amount > 0 ? NETWORK_FEE_USD : 0;
  const net = Math.max(0, value - serviceFee - networkFee) * (1 - priceImpact);
  const receive = net / to.price;
  return {
    receive,
    minimum: receive * (1 - slippage),
    rate: from.price / to.price,
    networkFee,
    serviceFee,
    priceImpact,
    value,
  };
};
```

Get the source with Pro
