@funkit/connect-rn 3.7.0 → 3.9.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 (79) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/chunk-FTD4HETU.js +94 -0
  3. package/dist/chunk-FTD4HETU.js.map +7 -0
  4. package/dist/{chunk-VDKAH5Y5.js → chunk-PHUM52HD.js} +173 -64
  5. package/dist/chunk-PHUM52HD.js.map +7 -0
  6. package/dist/clients/lighter/lighterFastWithdrawal.d.ts.map +1 -1
  7. package/dist/clients/lighter/useLighterUnstakedFee.d.ts +12 -6
  8. package/dist/clients/lighter/useLighterUnstakedFee.d.ts.map +1 -1
  9. package/dist/clients/lighter/useLighterWithdrawal.d.ts.map +1 -1
  10. package/dist/clients/lighter/useLighterWithdrawalMethods.d.ts.map +1 -1
  11. package/dist/clients/lighter.js +47 -86
  12. package/dist/clients/lighter.js.map +3 -3
  13. package/dist/clients/nado/index.d.ts +4 -0
  14. package/dist/clients/nado/index.d.ts.map +1 -0
  15. package/dist/clients/nado/nadoWithdrawalConfig.d.ts +38 -0
  16. package/dist/clients/nado/nadoWithdrawalConfig.d.ts.map +1 -0
  17. package/dist/clients/nado/useNadoWithdrawal.d.ts +14 -0
  18. package/dist/clients/nado/useNadoWithdrawal.d.ts.map +1 -0
  19. package/dist/clients/nado/withdrawalErrors.d.ts +9 -0
  20. package/dist/clients/nado/withdrawalErrors.d.ts.map +1 -0
  21. package/dist/clients/nado/withdrawalSubmit.d.ts +37 -0
  22. package/dist/clients/nado/withdrawalSubmit.d.ts.map +1 -0
  23. package/dist/clients/nado.d.ts +1 -0
  24. package/dist/clients/nado.js +417 -0
  25. package/dist/clients/nado.js.map +7 -0
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +1147 -882
  29. package/dist/index.js.map +4 -4
  30. package/dist/src/components/ReceiveAmountSummary.d.ts.map +1 -1
  31. package/dist/src/components/WithdrawSourceCard.d.ts.map +1 -1
  32. package/dist/src/flow/DepositFlowContent.d.ts.map +1 -1
  33. package/dist/src/flow/FlowSheet.d.ts.map +1 -1
  34. package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -1
  35. package/dist/src/flow/WithdrawalFlowContent.d.ts.map +1 -1
  36. package/dist/src/flow/depositFlowConfig.d.ts.map +1 -1
  37. package/dist/src/flow/sheetSizing.d.ts +22 -0
  38. package/dist/src/flow/sheetSizing.d.ts.map +1 -0
  39. package/dist/src/flow/useCopiedToast.d.ts.map +1 -1
  40. package/dist/src/flow/withdrawalFlowConfig.d.ts +32 -3
  41. package/dist/src/flow/withdrawalFlowConfig.d.ts.map +1 -1
  42. package/dist/src/haptics/HapticsContext.d.ts.map +1 -1
  43. package/dist/src/identity/IdentityContext.d.ts +9 -0
  44. package/dist/src/identity/IdentityContext.d.ts.map +1 -1
  45. package/dist/src/providers/FunkitStatsigProvider.d.ts.map +1 -1
  46. package/dist/src/screens/QrCodeScreen.d.ts.map +1 -1
  47. package/dist/src/screens/SelectReceiveTokenAndChainScreen.d.ts.map +1 -1
  48. package/dist/src/screens/WithdrawAddressScreen.d.ts +1 -1
  49. package/dist/src/screens/WithdrawAddressScreen.d.ts.map +1 -1
  50. package/dist/src/screens/WithdrawCompleteScreen.d.ts +16 -7
  51. package/dist/src/screens/WithdrawCompleteScreen.d.ts.map +1 -1
  52. package/dist/src/screens/WithdrawCryptoComplete.d.ts +9 -4
  53. package/dist/src/screens/WithdrawCryptoComplete.d.ts.map +1 -1
  54. package/dist/src/screens/WithdrawCryptoSteps.d.ts +4 -2
  55. package/dist/src/screens/WithdrawCryptoSteps.d.ts.map +1 -1
  56. package/dist/src/swapped/SwappedWebView.d.ts.map +1 -1
  57. package/dist/src/transfer/hooks/useFops.d.ts +6 -0
  58. package/dist/src/transfer/hooks/useFops.d.ts.map +1 -1
  59. package/dist/src/transfer/hooks/useTokenTransfer.d.ts.map +1 -1
  60. package/dist/src/transfer/hooks/useWithdrawalFops.d.ts.map +1 -1
  61. package/dist/src/utils/amountGlyphs.d.ts.map +1 -1
  62. package/dist/src/utils/executionErrorMessage.d.ts.map +1 -1
  63. package/dist/src/utils/numpadInput.d.ts.map +1 -1
  64. package/dist/src/withdrawal/receiveDestination.d.ts.map +1 -1
  65. package/dist/src/withdrawal/useCryptoWithdrawalExecution.d.ts +16 -2
  66. package/dist/src/withdrawal/useCryptoWithdrawalExecution.d.ts.map +1 -1
  67. package/dist/src/withdrawal/useCryptoWithdrawalForm.d.ts +3 -1
  68. package/dist/src/withdrawal/useCryptoWithdrawalForm.d.ts.map +1 -1
  69. package/dist/src/withdrawal/useCryptoWithdrawalSubmit.d.ts +2 -1
  70. package/dist/src/withdrawal/useCryptoWithdrawalSubmit.d.ts.map +1 -1
  71. package/dist/src/withdrawal/useDepositAddressWithdrawalStatus.d.ts +21 -0
  72. package/dist/src/withdrawal/useDepositAddressWithdrawalStatus.d.ts.map +1 -0
  73. package/dist/src/withdrawal/useWithdrawalDestinationTokens.d.ts.map +1 -1
  74. package/dist/src/withdrawal/useWithdrawalStatus.d.ts.map +1 -1
  75. package/dist/src/withdrawal/validation.d.ts.map +1 -1
  76. package/package.json +3 -3
  77. package/dist/chunk-VDKAH5Y5.js.map +0 -7
  78. package/dist/src/components/SheetContent.d.ts +0 -25
  79. package/dist/src/components/SheetContent.d.ts.map +0 -1
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/theme/tokens.ts", "../src/theme/toRestyleTheme.ts", "../src/theme/buildFunkitTheme.ts", "../src/theme/themes.ts", "../src/theme/useColorScheme.ts", "../src/theme/useFunkitTheme.ts", "../src/theme/restyle.ts", "../src/theme/FunkitThemeProvider.tsx", "../src/providers/FunkitProvider.tsx", "../src/flow/FunkitFlowProvider.tsx", "../src/transfer/clipboard.ts", "../src/flow/DepositFlowContent.tsx", "../src/components/SheetContent.tsx", "../src/geo/useCheckoutBlocked.ts", "../src/statsig/useDynamicConfig.ts", "../src/geo/useUserIpInfo.ts", "../src/geo/isCountryBlocked.ts", "../src/hooks/useNestedSheet.tsx", "../src/icons/CryptoBitcoinIcon.tsx", "../src/icons/PaymentMethodIcon.tsx", "../src/icons/assetLogos.ts", "../src/icons/FunIcon.tsx", "../src/icons/PaymentBrandIcons.tsx", "../src/icons/funIconUri.ts", "../src/icons/QrChainCluster.tsx", "../src/icons/FigmaSystemIcons.tsx", "../src/icons/SourceTokenCluster.tsx", "../src/icons/TokenChainIcon.tsx", "../src/screens/CheckoutBlockedScreen.tsx", "../src/icons/StatusIcon.tsx", "../src/screens/QrCodeScreen.tsx", "../src/components/Grabber.tsx", "../src/hooks/useScreenSize.ts", "../src/icons/CopyAddressIcon.tsx", "../src/screens/SelectChainScreen.tsx", "../src/components/ScrollFade.tsx", "../src/hooks/useNestedSheetHeight.ts", "../src/icons/ChainAvatar.tsx", "../src/screens/SelectMethodScreen.tsx", "../src/hooks/usePulse.ts", "../src/screens/TransferCryptoScreen.tsx", "../src/components/SelectedChainRow.tsx", "../src/swapped/SwappedScreen.tsx", "../src/swapped/SwappedScreenShell.tsx", "../src/swapped/SwappedWebView.tsx", "../src/swapped/buildSwappedTheme.ts", "../src/swapped/webViewSwappedTransport.ts", "../src/transfer/availableChains.ts", "../src/utils/chainDisplay.ts", "../src/transfer/fops.ts", "../src/transfer/formatDepositAddress.ts", "../src/transfer/hooks/useCopyDepositAddress.ts", "../src/transfer/hooks/useFiatExchangeRates.ts", "../src/transfer/hooks/useFops.ts", "../src/transfer/hooks/useTransferInit.ts", "../src/transfer/hooks/useLighterDepositRecipientOverride.ts", "../src/transfer/hooks/useUDAParams.ts", "../src/transfer/hooks/useSupportedTokens.ts", "../src/transfer/supportedTokens.ts", "../src/transfer/hooks/useTokenTransfer.ts", "../src/transfer/QrCode.tsx", "../src/flow/depositFlowConfig.ts", "../src/flow/FlowSheet.tsx", "../src/flow/useKeyboardHeight.ts", "../src/flow/selectedChainStorage.ts", "../src/flow/guardHostCallbacks.ts", "../src/flow/useCopiedToast.tsx", "../src/flow/AddressCopiedToast.tsx", "../src/flow/WithdrawalFlowContent.tsx", "../src/screens/WithdrawCryptoComplete.tsx", "../src/withdrawal/useWithdrawalStatus.ts", "../src/screens/WithdrawCompleteScreen.tsx", "../src/components/PillButton.tsx", "../src/components/ReceiveAmountSummary.tsx", "../src/components/SkeletonBar.tsx", "../src/utils/safeArea.ts", "../src/screens/WithdrawCryptoSteps.tsx", "../src/hooks/useIsStablecoin.ts", "../src/utils/formatAmount.ts", "../src/withdrawal/useCryptoWithdrawalForm.ts", "../src/withdrawal/sourceToken.ts", "../src/withdrawal/useCryptoWithdrawalQuote.ts", "../src/withdrawal/useSourceTokenDecimals.ts", "../src/withdrawal/useCryptoWithdrawalValidation.ts", "../src/withdrawal/useSourceTokenUsdPrice.ts", "../src/withdrawal/validation.ts", "../src/withdrawal/useWithdrawalAmountInput.ts", "../src/withdrawal/useWithdrawalDestinationTokens.ts", "../src/withdrawal/useWithdrawalRisk.ts", "../src/withdrawal/useCryptoWithdrawalSubmit.ts", "../src/utils/executionErrorMessage.ts", "../src/withdrawal/useCryptoWithdrawalExecution.ts", "../src/screens/SelectReceiveTokenAndChainScreen.tsx", "../src/components/AssetGrid.tsx", "../src/utils/assetGrid.ts", "../src/components/TopBar.tsx", "../src/withdrawal/receiveDestination.ts", "../src/screens/SelectReceiveTokenScreen.tsx", "../src/components/SearchInput.tsx", "../src/components/SelectableAssetRow.tsx", "../src/screens/SelectSourceTokenScreen.tsx", "../src/screens/TransactionBreakdownScreen.tsx", "../src/screens/WithdrawAddressScreen.tsx", "../src/components/ReceiveAsRow.tsx", "../src/components/WalletAddressInput.tsx", "../src/screens/WithdrawAmountScreen.tsx", "../src/components/AmountDisplay.tsx", "../src/utils/amountGlyphs.ts", "../src/utils/motion.ts", "../src/components/NumPad.tsx", "../src/haptics/HapticsContext.tsx", "../src/haptics/hapticTap.ts", "../src/components/WithdrawSourceCard.tsx", "../src/utils/numpadInput.ts", "../src/screens/WithdrawMethodScreen.tsx", "../src/swapped/SwappedWithdrawScreen.tsx", "../src/transfer/hooks/useWithdrawalFops.ts", "../src/withdrawal/useWithdrawalExecution.ts", "../src/version.ts", "../src/providers/FunkitStatsigProvider.tsx", "../src/statsig/useClientAsyncInitRN.ts", "../src/statsig/StatsigClientRN.ts", "../src/statsig/rnSetup.ts", "../src/statsig/appVisibilityShim.ts", "../src/statsig/preloadedAsyncStorage.ts", "../src/statsig/statsigMetadata.ts", "../src/providers/useFunkitCheckout.ts", "../src/history/useRecentDeposits.ts", "../src/history/useCheckoutsListenerByUserId.ts"],
4
- "sourcesContent": ["// Local design tokens for @funkit/connect-rn, generated from the \"Fun Variables\"\n// Figma export (`Fun Variables/{Light,Dark}.tokens.json`). This file is a STRICT\n// mirror of that export: the token tree reproduces Figma's variable HIERARCHY\n// one-to-one (`background` / `content` / `border` / `font` / `spacing` / `brand`\n// / `button` / `opacity`), values are the resolved concrete values, and nothing\n// is invented \u2014 if a state (hover, focused, \u2026) or token isn't in Fun Variables,\n// it isn't here either.\n//\n// Multi-word Figma leaves are camelCased so they're valid TS identifiers\n// (`element-inner` \u2192 `elementInner`, `loading alpha` \u2192 `loadingAlpha`,\n// `amount input` \u2192 `amountInput`, `top bar` \u2192 `topBar`); the nesting is\n// otherwise identical to the JSON.\n//\n// `buildFunkitTheme` (buildFunkitTheme.ts) FLATTENS this tree into the flat\n// `@shopify/restyle` theme components consume (`bgButtonPrimary`, \u2026). The\n// Figma-path \u2192 flat-key convention is documented in\n// `packages/connect-rn/CLAUDE.md` (\u00A7 \"Figma Fun Variables \u2192 tokens.ts\").\n//\n// connect-rn's theme is intentionally NOT shared with @funkit/connect-core (web\n// keeps its separate `ThemeVars`).\n\nimport type { TextStyle } from 'react-native'\n\n/**\n * A Figma font-style name (`font/\u2026/weight`). The Fun Variables export defines\n * exactly these two cuts \u2014 there is no semibold/bold, so any `fontWeight: '600'`\n * in a component is a smell that should route through the token instead.\n */\nexport type FunkitFontStyleName = 'Regular' | 'Medium'\n\n/** Logical weight a component's `Text` can request; maps onto `font/body/weight/*`. */\nexport type FunkitFontWeight = 'base' | 'medium'\n\n/** `font/*` \u2014 body and header typography. Family is shared by both in Light/Dark. */\nexport interface FunkitFontTokens {\n body: {\n /**\n * `font/body/family`. The Fun Variables value is `Inter`, so the host must\n * register `Inter-Regular` / `Inter-Medium` (see {@link fontFamilyForWeight});\n * if it doesn't, RN falls back to the platform system font.\n */\n family: string\n weight: Record<FunkitFontWeight, FunkitFontStyleName>\n size: { base: number; detail: number }\n // Absolute px (RN's TextStyle.lineHeight).\n leading: { base: number; detail: number }\n }\n header: {\n family: string\n weight: FunkitFontStyleName\n alignment: 'Left' | 'Center' | 'Right'\n // `amount input` / `amount summary` are single-line; Figma defines no leading.\n size: {\n title: number\n subtitle: number\n amountInput: number\n amountSummary: number\n }\n }\n}\n\n/** One button state's fill (`background/button/*` \u2014 only `default` + `pressed`). */\nexport interface ButtonSurface {\n default: string\n pressed: string\n}\n\n/**\n * The full token set for one mode \u2014 a one-to-one mirror of the Fun Variables\n * Figma variable groups.\n */\nexport interface FunkitTokens {\n background: {\n modal: string\n secondary: string\n button: {\n primary: ButtonSurface\n secondary: ButtonSurface\n tertiary: ButtonSurface\n icon: ButtonSurface\n destructive: ButtonSurface & { disabled: string }\n }\n pill: { default: string; pressed: string; disabled: string }\n /**\n * Scrim dimming the host app behind the flow sheet. NOT yet a Fun Variable\n * \u2014 the design (13315:9391) hardcodes it \u2014 so it lives here to stay\n * per-client overridable. Fold it in when the export gains the variable.\n */\n overlay: string\n }\n /** `opacity/disabled` \u2014 a percentage (0\u2013100); divide by 100 for RN `opacity`. */\n opacity: {\n disabled: number\n }\n content: {\n elements: {\n primary: string\n secondary: string\n success: string\n error: string\n hyperlink: string\n warning: string\n }\n // Label/icon color on a button surface. `loadingAlpha` (`loading alpha`) is\n // the same color at reduced alpha, shown while the button is loading.\n button: {\n primary: { default: string; loadingAlpha: string }\n secondary: { default: string; loadingAlpha: string }\n tertiary: { default: string }\n icon: { default: string }\n destructive: { default: string; loadingAlpha: string }\n }\n }\n border: {\n radius: {\n modal: number\n element: number\n elementInner: number\n button: number\n }\n modal: { default: string; weight: number }\n elements: {\n default: { color: string; weight: number }\n selected: { color: string; weight: number }\n }\n button: { primary: string; secondary: string; weight: number }\n }\n font: FunkitFontTokens\n spacing: {\n padding: {\n elements: { horizontal: number }\n modal: { horizontal: number }\n }\n heights: { topBar: number; button: number }\n }\n brand: {\n primary: string\n }\n button: {\n // Icon tiers collapse per the export: xs === sm (16) and md === lg (20).\n // The four tiers are kept so call sites stay semantic.\n icon: {\n size: { xs: number; sm: number; md: number; lg: number }\n }\n size: { xs: number; sm: number; md: number; lg: number }\n }\n}\n\n/**\n * Resolves a font family + Figma style name to the concrete native font-family\n * name the host must register \u2014 e.g. `('Inter', 'Medium')` \u2192 `'Inter-Medium'`.\n *\n * This is connect-rn's whole answer to a React Native / Expo quirk: you cannot\n * reliably select a custom font's weight via `fontWeight`. Android matches custom\n * fonts by exact family-name string, and a font loaded at runtime (`expo-font`)\n * registers one native Typeface per name \u2014 so `fontWeight: '500'` on\n * `fontFamily: 'Inter'` is silently ignored and every weight renders identically.\n * Weight therefore has to be baked into the family name, and every text style\n * goes through here.\n */\nexport function fontFamilyForWeight(\n family: string,\n styleName: FunkitFontStyleName,\n): string {\n return `${family}-${styleName}`\n}\n\n/** Figma font-style name \u2192 CSS numeric weight (for the Swapped WebView / RN `fontWeight`). */\nexport const FONT_STYLE_CSS_WEIGHT: Record<\n FunkitFontStyleName,\n TextStyle['fontWeight']\n> = {\n Regular: '400',\n Medium: '500',\n}\n\nexport const lightTokens: FunkitTokens = {\n background: {\n modal: '#FFFFFF',\n secondary: '#F9F9F9',\n button: {\n primary: { default: '#0F0F0F', pressed: '#1B1B1B' },\n secondary: { default: '#F9F9F9', pressed: '#DDDDDD' },\n tertiary: { default: '#FFFFFF', pressed: '#EFEFEF' },\n icon: { default: '#FFFFFF', pressed: '#EFEFEF' },\n destructive: {\n default: '#F34126',\n pressed: '#C2341E',\n disabled: '#F34126',\n },\n },\n pill: { default: '#FFFFFF', pressed: '#EFEFEF', disabled: '#FFFFFF' },\n overlay: '#131313CC',\n },\n opacity: {\n disabled: 40,\n },\n content: {\n elements: {\n primary: '#0F0F0F',\n secondary: '#6C6C6C',\n success: '#52A300',\n error: '#F34126',\n hyperlink: '#0F0F0F',\n warning: '#F97316',\n },\n button: {\n primary: { default: '#FFFFFF', loadingAlpha: '#FFFFFF4D' },\n secondary: { default: '#0F0F0F', loadingAlpha: '#0000004D' },\n tertiary: { default: '#0F0F0F' },\n icon: { default: '#6C6C6C' },\n destructive: { default: '#FFFFFF', loadingAlpha: '#FFFFFF80' },\n },\n },\n border: {\n radius: { modal: 24, element: 12, elementInner: 8, button: 999 },\n modal: { default: '#FFFFFF', weight: 1 },\n elements: {\n default: { color: '#EFEFEF', weight: 1 },\n selected: { color: '#0F0F0F', weight: 1 },\n },\n button: { primary: '#0F0F0F', secondary: '#F9F9F9', weight: 0 },\n },\n font: {\n body: {\n family: 'Inter',\n weight: { base: 'Regular', medium: 'Medium' },\n size: { base: 16, detail: 14 },\n leading: { base: 22, detail: 20 },\n },\n header: {\n family: 'Inter',\n weight: 'Medium',\n alignment: 'Center',\n size: { title: 18, subtitle: 16, amountInput: 48, amountSummary: 48 },\n },\n },\n spacing: {\n padding: {\n elements: { horizontal: 12 },\n modal: { horizontal: 16 },\n },\n heights: { topBar: 56, button: 42 },\n },\n brand: {\n primary: '#0F0F0F',\n },\n button: {\n icon: { size: { xs: 16, sm: 16, md: 20, lg: 20 } },\n size: { xs: 36, sm: 40, md: 48, lg: 56 },\n },\n}\n\nexport const darkTokens: FunkitTokens = {\n background: {\n modal: '#0F0F0F',\n secondary: '#1B1B1B',\n button: {\n primary: { default: '#FFFFFF', pressed: '#F9F9F9' },\n secondary: { default: '#1B1B1B', pressed: '#2D2D2D' },\n tertiary: { default: '#1B1B1B', pressed: '#2D2D2D' },\n icon: { default: '#0F0F0F', pressed: '#1B1B1B' },\n destructive: {\n default: '#DB3B22',\n pressed: '#F34126',\n disabled: '#DB3B22',\n },\n },\n pill: { default: '#0F0F0F', pressed: '#1B1B1B', disabled: '#0F0F0F' },\n overlay: '#131313CC',\n },\n opacity: {\n disabled: 40,\n },\n content: {\n elements: {\n primary: '#FFFFFF',\n secondary: '#929292',\n success: '#52A300',\n error: '#F34126',\n hyperlink: '#FFFFFF',\n warning: '#F97316',\n },\n button: {\n primary: { default: '#000000', loadingAlpha: '#0000004D' },\n secondary: { default: '#F9F9F9', loadingAlpha: '#FFFFFF4D' },\n tertiary: { default: '#F9F9F9' },\n icon: { default: '#929292' },\n destructive: { default: '#FFFFFF', loadingAlpha: '#FFFFFF80' },\n },\n },\n border: {\n radius: { modal: 24, element: 12, elementInner: 8, button: 999 },\n modal: { default: '#1B1B1B', weight: 1 },\n elements: {\n default: { color: '#2D2D2D', weight: 1 },\n selected: { color: '#FFFFFF', weight: 1 },\n },\n button: { primary: '#FFFFFF', secondary: '#1B1B1B', weight: 0 },\n },\n font: {\n body: {\n family: 'Inter',\n weight: { base: 'Regular', medium: 'Medium' },\n size: { base: 16, detail: 14 },\n leading: { base: 22, detail: 20 },\n },\n header: {\n family: 'Inter',\n weight: 'Medium',\n alignment: 'Center',\n size: { title: 18, subtitle: 16, amountInput: 48, amountSummary: 48 },\n },\n },\n spacing: {\n padding: {\n elements: { horizontal: 12 },\n modal: { horizontal: 16 },\n },\n heights: { topBar: 56, button: 42 },\n },\n brand: {\n primary: '#0F0F0F',\n },\n button: {\n icon: { size: { xs: 16, sm: 16, md: 20, lg: 20 } },\n size: { xs: 36, sm: 40, md: 48, lg: 56 },\n },\n}\n", "import { createTheme } from '@shopify/restyle'\n\nimport { buildFunkitTheme } from './buildFunkitTheme'\nimport { type FunkitTokens, darkTokens, lightTokens } from './tokens'\n\n/**\n * Wraps the pure {@link buildFunkitTheme} projection in Restyle's `createTheme`.\n * All the real work \u2014 mirroring the Fun Variables Figma groups onto the theme \u2014\n * lives in `buildFunkitTheme`; this is just the thin Restyle boundary so the\n * projection stays testable without Restyle's react-native imports.\n */\nexport function toRestyleTheme(tokens: FunkitTokens) {\n return createTheme(buildFunkitTheme(tokens))\n}\n\n/** The Restyle theme type all connect-rn components are written against. */\nexport type FunkitTheme = ReturnType<typeof toRestyleTheme>\n\n/** Built-in default Restyle themes derived from the Fun Variables Light/Dark tokens. */\nexport const defaultLightTheme = toRestyleTheme(lightTokens)\nexport const defaultDarkTheme = toRestyleTheme(darkTokens)\n", "import type { TextStyle } from 'react-native'\n\nimport {\n FONT_STYLE_CSS_WEIGHT,\n type FunkitFontStyleName,\n type FunkitTokens,\n fontFamilyForWeight,\n} from './tokens'\n\n// A resolved text cut: the native family (weight baked into the name, see\n// `fontFamilyForWeight`) plus the numeric weight kept for the Swapped WebView\n// (CSS) theme and the system-font fallback.\nfunction cut(family: string, styleName: FunkitFontStyleName) {\n return {\n fontFamily: fontFamilyForWeight(family, styleName),\n fontWeight: FONT_STYLE_CSS_WEIGHT[styleName],\n }\n}\n\n/**\n * Projects the nested Fun Variables {@link FunkitTokens} onto the object\n * `@shopify/restyle`'s `createTheme` consumes \u2014 kept as a pure function (no\n * Restyle import) so tests can build the theme without pulling Restyle's\n * react-native Flow source into the node env.\n *\n * The design deliberately DOESN'T use Restyle's `colors` prop system: `colors`\n * is empty and components read colors straight from the Figma-shaped groups\n * (`theme.background.button.primary.default`, `theme.content.elements.primary`,\n * \u2026) via `useTheme()`, so the theme stays a faithful mirror of Figma. Only the\n * non-color numeric buckets Restyle genuinely needs (`spacing`, `borderRadii`,\n * `borderWidths`, `sizes`, `breakpoints`) are projected onto its reserved keys.\n */\nexport function buildFunkitTheme(tokens: FunkitTokens) {\n const { font } = tokens\n const base = cut(font.body.family, font.body.weight.base)\n const medium = cut(font.body.family, font.body.weight.medium)\n const header = cut(font.header.family, font.header.weight)\n const headerAlign =\n font.header.alignment.toLowerCase() as TextStyle['textAlign']\n\n return {\n // Restyle's BaseTheme requires `colors`; intentionally empty \u2014 see above.\n colors: {},\n\n // \u2500\u2500 Figma variable groups, verbatim \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n background: tokens.background,\n content: tokens.content,\n border: tokens.border,\n brand: tokens.brand,\n opacity: tokens.opacity,\n font: tokens.font,\n\n // \u2500\u2500 Non-color numeric buckets projected onto Restyle's reserved keys \u2500\n spacing: {\n none: 0,\n elementsHorizontal: tokens.spacing.padding.elements.horizontal,\n modalHorizontal: tokens.spacing.padding.modal.horizontal,\n },\n borderRadii: {\n modal: tokens.border.radius.modal,\n element: tokens.border.radius.element,\n elementInner: tokens.border.radius.elementInner,\n button: tokens.border.radius.button,\n // Structural (no Figma token): fully-circular avatars / icon wells.\n rounded: 999,\n },\n borderWidths: {\n modal: tokens.border.modal.weight,\n elementsDefault: tokens.border.elements.default.weight,\n elementsSelected: tokens.border.elements.selected.weight,\n button: tokens.border.button.weight,\n },\n sizes: {\n topBar: tokens.spacing.heights.topBar,\n buttonHeight: tokens.spacing.heights.button,\n buttonXs: tokens.button.size.xs,\n buttonSm: tokens.button.size.sm,\n buttonMd: tokens.button.size.md,\n buttonLg: tokens.button.size.lg,\n iconXs: tokens.button.icon.size.xs,\n iconSm: tokens.button.icon.size.sm,\n iconMd: tokens.button.icon.size.md,\n iconLg: tokens.button.icon.size.lg,\n },\n breakpoints: {\n phone: 0,\n tablet: 768,\n },\n\n // Text variants carry no `color` (Restyle colors is unused); the `Text`\n // component defaults the color from `content/elements/*` and callers\n // override per-node via `style`.\n textVariants: {\n defaults: {\n ...base,\n fontSize: font.body.size.base,\n lineHeight: font.body.leading.base,\n },\n body: {\n ...base,\n fontSize: font.body.size.base,\n lineHeight: font.body.leading.base,\n },\n bodyMedium: {\n ...medium,\n fontSize: font.body.size.base,\n lineHeight: font.body.leading.base,\n },\n detail: {\n ...base,\n fontSize: font.body.size.detail,\n lineHeight: font.body.leading.detail,\n },\n headerTitle: {\n ...header,\n fontSize: font.header.size.title,\n textAlign: headerAlign,\n },\n headerSubtitle: {\n ...header,\n fontSize: font.header.size.subtitle,\n textAlign: headerAlign,\n },\n amountInput: {\n ...medium,\n fontSize: font.header.size.amountInput,\n },\n amountSummary: {\n ...medium,\n fontSize: font.header.size.amountSummary,\n },\n },\n // Per-weight `{ fontFamily, fontWeight }` the `Text` `weight` prop applies on\n // top of any variant (both are required for custom fonts \u2014 see\n // `fontFamilyForWeight`).\n textWeights: {\n base,\n medium,\n },\n }\n}\n", "import { type FunkitTheme, toRestyleTheme } from './toRestyleTheme'\nimport { type FunkitTokens, darkTokens, lightTokens } from './tokens'\n\n/** Recursive partial \u2014 every group/leaf of the nested token tree is optional. */\ntype DeepPartial<T> = T extends object\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : T\n\n/**\n * A deep-partial override of the nested Fun Variables {@link FunkitTokens}\n * groups. Pass to {@link lightTheme} / {@link darkTheme} to restyle only the\n * leaves a brand changes (`background` / `content` / `border` / `brand` / \u2026);\n * anything omitted keeps the base token's value.\n */\nexport type FunkitTokensOverride = DeepPartial<FunkitTokens>\n\n/** A mergeable plain object \u2014 not null, not an array. */\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * Deep-merge `override` onto a deep *clone* of `base`. The result shares no\n * object references with `base`, so the built-in tokens are never aliased into a\n * theme \u2014 and thus can't be mutated through one. Non-object values (and arrays)\n * replace the base value whole.\n */\nfunction deepMerge<T>(base: T, override?: DeepPartial<T>): T {\n if (!isPlainObject(base)) {\n return override === undefined ? base : (override as T)\n }\n const source: Record<string, unknown> = isPlainObject(override)\n ? override\n : {}\n const cloned: Record<string, unknown> = {}\n for (const key of Object.keys(base)) {\n cloned[key] = deepMerge(base[key], source[key])\n }\n return cloned as T\n}\n\n/**\n * Build a light {@link FunkitTheme}, deep-merging an optional brand override\n * onto the SDK's `lightTokens`. A brand specifies only the leaves it changes \u2014\n * the design defines `default` / `pressed` states \u2014 and everything else keeps\n * the default value. Called with no argument it returns the default light theme.\n *\n * @example\n * const theme = lightTheme({\n * background: { button: { primary: { default: '#1e3b25', pressed: '#264e30' } } },\n * brand: { primary: '#1e3b25' },\n * })\n */\nexport function lightTheme(override?: FunkitTokensOverride): FunkitTheme {\n return toRestyleTheme(deepMerge(lightTokens, override))\n}\n\n/**\n * Build a dark {@link FunkitTheme}, deep-merging an optional brand override onto\n * the SDK's `darkTokens`. See {@link lightTheme}. For a dark-only brand, call\n * this once and reuse the theme for both `light` and `dark`.\n */\nexport function darkTheme(override?: FunkitTokensOverride): FunkitTheme {\n return toRestyleTheme(deepMerge(darkTokens, override))\n}\n", "import { useEffect, useState } from 'react'\nimport { Appearance, type ColorSchemeName } from 'react-native'\n\nexport type SystemColorScheme = 'light' | 'dark' | undefined\n\n/** A concrete, resolved color scheme (never undefined). */\nexport type ColorScheme = 'light' | 'dark'\n\n/**\n * Resolve the active color scheme with this precedence (pure, exported for\n * testing):\n * 1. `controlled` \u2014 the `FunkitProvider` `colorScheme` prop. When set, it\n * wins over everything, so a manual toggle / system change can't move it.\n * 2. `override` \u2014 a manual `toggleColorScheme()` choice (uncontrolled only).\n * 3. `system` \u2014 the live OS Appearance.\n * 4. `'light'` \u2014 fallback when the system scheme is unknown.\n */\nexport function resolveColorScheme(\n controlled: ColorScheme | undefined,\n override: ColorScheme | undefined,\n system: SystemColorScheme,\n): ColorScheme {\n if (controlled) {\n return controlled\n }\n return override ?? system ?? 'light'\n}\n\n/**\n * Normalize React Native's `ColorSchemeName` (`'light' | 'dark' | null |\n * undefined`) to `'light' | 'dark' | undefined`. Pure \u2014 exported for testing.\n */\nexport function normalizeColorScheme(\n scheme: ColorSchemeName | null | undefined,\n): SystemColorScheme {\n return scheme === 'light' || scheme === 'dark' ? scheme : undefined\n}\n\n/**\n * Reads the system color scheme from RN's `Appearance` API and re-renders on\n * change. The RN counterpart to web's `prefers-color-scheme` media query.\n */\nexport function useColorScheme(): SystemColorScheme {\n const [scheme, setScheme] = useState<SystemColorScheme>(() =>\n normalizeColorScheme(Appearance.getColorScheme()),\n )\n\n useEffect(() => {\n const subscription = Appearance.addChangeListener(({ colorScheme }) => {\n setScheme(normalizeColorScheme(colorScheme))\n })\n return () => subscription.remove()\n }, [])\n\n return scheme\n}\n", "import { useMemo } from 'react'\n\nimport {\n defaultDarkTheme,\n defaultLightTheme,\n type FunkitTheme,\n} from './toRestyleTheme'\nimport { type SystemColorScheme, useColorScheme } from './useColorScheme'\n\n/**\n * A light/dark Restyle theme set. **At least one mode must be provided**; a\n * missing mode falls back to the one that is set. Only Restyle themes (produced\n * by `toRestyleTheme`) are accepted \u2014 raw token objects are not, so callers\n * can't accidentally pass a half-built theme.\n */\nexport type FunkitThemeSet =\n | { light: FunkitTheme; dark?: FunkitTheme }\n | { light?: FunkitTheme; dark: FunkitTheme }\n\nconst DEFAULT_THEME_SET: FunkitThemeSet = {\n light: defaultLightTheme,\n dark: defaultDarkTheme,\n}\n\n/**\n * Pick the Restyle theme for a color scheme, falling back to the other mode\n * when the requested one isn't in the set. The `FunkitThemeSet` union\n * guarantees at least one mode is present.\n */\nexport function selectTheme(\n themeSet: FunkitThemeSet,\n scheme: SystemColorScheme,\n): FunkitTheme {\n const primary = scheme === 'dark' ? themeSet.dark : themeSet.light\n const fallback = scheme === 'dark' ? themeSet.light : themeSet.dark\n if (primary) {\n return primary\n }\n if (fallback) {\n return fallback\n }\n // Unreachable for typed callers; guards untyped (JS) misuse.\n throw new Error(\n 'FunkitProvider: `themes` must include at least one of { light, dark }',\n )\n}\n\n/**\n * Resolves the active Restyle theme from the live system color scheme, to hand\n * to Restyle's `ThemeProvider`. Pass a custom theme set to override the\n * built-in Fun Mobile themes. Falls back to light when the system scheme is\n * unknown.\n */\nexport function useFunkitTheme(\n themeSet: FunkitThemeSet = DEFAULT_THEME_SET,\n): FunkitTheme {\n const scheme = useColorScheme()\n // Depend on the individual theme refs, not the `themeSet` object \u2014 an inline\n // set is a new object each render and would defeat the memo.\n return useMemo(\n () => selectTheme(themeSet, scheme),\n [scheme, themeSet.light, themeSet.dark],\n )\n}\n", "import {\n createBox,\n createText,\n useTheme as useRestyleTheme,\n} from '@shopify/restyle'\nimport {\n type ComponentProps,\n type ComponentRef,\n createElement,\n forwardRef,\n} from 'react'\n\nimport type { FunkitTheme } from './toRestyleTheme'\nimport type { FunkitFontWeight } from './tokens'\n\n/**\n * `@shopify/restyle` primitives bound to the connect-rn {@link FunkitTheme}.\n * Components use these instead of raw `View` / `Text` so style props\n * (`backgroundColor`, `padding`, `borderRadius`, `variant`, \u2026) resolve to theme\n * tokens with full type safety.\n */\nexport const Box = createBox<FunkitTheme>()\n\nconst RestyleText = createText<FunkitTheme>()\n\nexport interface TextProps extends ComponentProps<typeof RestyleText> {\n /**\n * Override the font weight for this node regardless of `variant`. Applies the\n * resolved per-cut family AND numeric weight \u2014 both are required, since RN/Expo\n * can't select a custom font's weight via `fontWeight` alone (see\n * {@link fontFamilyForWeight}). So `variant=\"detail\" weight=\"medium\"` renders\n * the detail style in `Inter-Medium`. An explicit `style` still wins over it.\n */\n weight?: FunkitFontWeight\n}\n\n/**\n * {@link FunkitTheme}-bound Restyle `Text` with a `weight` escape hatch: set\n * `weight` to render a single node at a different cut than its `variant` without\n * minting a `*Medium` twin variant. Without `weight` it's the plain Restyle Text.\n */\nexport const Text = forwardRef<ComponentRef<typeof RestyleText>, TextProps>(\n function Text({ weight, variant, style, ...rest }, ref) {\n const theme = useRestyleTheme<FunkitTheme>()\n // Apply the weight override *before* `style` so a caller's explicit style\n // still wins; `?.` guards mocked themes that omit `textWeights`.\n const weightStyle = weight ? theme.textWeights?.[weight] : undefined\n // Text color isn't a Restyle color prop \u2014 the theme has no `colors` bucket;\n // colors live under the Figma groups. Default it here from `content/elements`\n // by variant (detail/subtitle are secondary, the rest primary); an explicit\n // `style` color still wins. `?.` guards mocked themes.\n const elements = theme.content?.elements\n const secondary = variant === 'detail' || variant === 'headerSubtitle'\n const colorStyle = elements\n ? { color: secondary ? elements.secondary : elements.primary }\n : undefined\n return createElement(RestyleText, {\n ref,\n variant,\n style: [colorStyle, weightStyle, style],\n ...rest,\n })\n },\n)\n\n/** {@link FunkitTheme}-typed `useTheme`, for reading raw token values. */\nexport const useTheme = () => useRestyleTheme<FunkitTheme>()\n", "import { ThemeProvider } from '@shopify/restyle'\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from 'react'\n\nimport { defaultDarkTheme, defaultLightTheme } from './toRestyleTheme'\nimport {\n type ColorScheme,\n resolveColorScheme,\n useColorScheme,\n} from './useColorScheme'\nimport { type FunkitThemeSet, selectTheme } from './useFunkitTheme'\n\nconst DEFAULT_THEMES: FunkitThemeSet = {\n light: defaultLightTheme,\n dark: defaultDarkTheme,\n}\n\ninterface FunkitColorSchemeValue {\n /** The active, resolved color scheme. */\n colorScheme: ColorScheme\n /**\n * Flip light\u2194dark, or set a specific scheme when an argument is given.\n * **No-op when the provider's `colorScheme` prop is set** (controlled mode) \u2014\n * the host owns the scheme in that case.\n */\n toggleColorScheme: (next?: ColorScheme) => void\n /** True when the scheme is forced by the `colorScheme` prop (uncontrolled toggle disabled). */\n isControlled: boolean\n}\n\nconst FunkitColorSchemeContext = createContext<FunkitColorSchemeValue | null>(\n null,\n)\n\nexport interface FunkitThemeProviderProps {\n children: ReactNode\n /**\n * The light/dark Restyle theme set. Defaults to the built-in Fun Mobile\n * themes. Pass `{ light, dark }` from `toRestyleTheme(...)` to customize.\n */\n themes?: FunkitThemeSet\n /**\n * Force a color scheme. When provided the provider is **controlled**: it\n * always renders this scheme, ignores the system Appearance, and\n * `toggleColorScheme()` becomes a no-op. When omitted the provider is\n * **uncontrolled**: the scheme follows the system Appearance and can be\n * flipped with `toggleColorScheme()`.\n */\n colorScheme?: ColorScheme\n}\n\n/**\n * The styling layer for `@funkit/connect-rn`. Resolves the active Restyle theme\n * (selected from `themes` by color scheme), wires it into Restyle's\n * `ThemeProvider`, and exposes the scheme + a manual toggle via\n * {@link useFunkitColorScheme}.\n *\n * This is an internal-ish provider \u2014 host apps mount the user-facing\n * {@link FunkitProvider}, which passes `themes` / `colorScheme` down to this.\n */\nexport function FunkitThemeProvider({\n children,\n themes = DEFAULT_THEMES,\n colorScheme,\n}: FunkitThemeProviderProps) {\n const isControlled = colorScheme != null\n const systemScheme = useColorScheme()\n // Manual override, used only in uncontrolled mode. Sticky once set \u2014 later\n // system changes are ignored until the next toggle (matches web behavior).\n const [override, setOverride] = useState<ColorScheme | undefined>(undefined)\n\n const activeScheme = resolveColorScheme(colorScheme, override, systemScheme)\n\n const toggleColorScheme = useCallback(\n (next?: ColorScheme) => {\n if (colorScheme != null) {\n return // controlled: the host owns the scheme\n }\n setOverride((prev) => {\n if (next != null) {\n return next\n }\n const current = resolveColorScheme(undefined, prev, systemScheme)\n return current === 'dark' ? 'light' : 'dark'\n })\n },\n [colorScheme, systemScheme],\n )\n\n const theme = selectTheme(themes, activeScheme)\n\n const value = useMemo<FunkitColorSchemeValue>(\n () => ({ colorScheme: activeScheme, toggleColorScheme, isControlled }),\n [activeScheme, toggleColorScheme, isControlled],\n )\n\n return (\n <FunkitColorSchemeContext.Provider value={value}>\n <ThemeProvider theme={theme}>{children}</ThemeProvider>\n </FunkitColorSchemeContext.Provider>\n )\n}\n\n/**\n * Read the active color scheme and toggle it. Must be used within a\n * {@link FunkitProvider} (which mounts {@link FunkitThemeProvider}).\n * `toggleColorScheme` is a no-op when the provider is in controlled mode (a\n * `colorScheme` prop was passed).\n */\nexport function useFunkitColorScheme(): FunkitColorSchemeValue {\n const value = useContext(FunkitColorSchemeContext)\n if (value == null) {\n throw new Error('useFunkitColorScheme must be used within <FunkitProvider>')\n }\n return value\n}\n", "import { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { type ReactNode, useEffect, useMemo, useRef } from 'react'\nimport { SafeAreaProvider } from 'react-native-safe-area-context'\n\nimport type { BackdropBlurRenderer } from '../flow/FlowSheet'\nimport { FunkitFlowProvider } from '../flow/FunkitFlowProvider'\nimport {\n FunkitHapticsProvider,\n type HapticFeedback,\n} from '../haptics/HapticsContext'\nimport {\n type FunkitConfig,\n FunkitIdentityProvider,\n resolveFunkitIdentity,\n} from '../identity/IdentityContext'\nimport type { Locale } from '../locales/i18n'\nimport { logger } from '../logging/logger'\nimport {\n FunkitThemeProvider,\n type FunkitThemeProviderProps,\n} from '../theme/FunkitThemeProvider'\nimport type { ClipboardReader, ClipboardWriter } from '../transfer/clipboard'\nimport { CONNECT_RN_VERSION } from '../version'\nimport { FunkitI18nProvider } from './FunkitI18nProvider'\nimport { FunkitStatsigProvider } from './FunkitStatsigProvider'\n\nexport interface FunkitProviderProps {\n children: ReactNode\n /**\n * Identity config \u2014 `apiKey` (+ optional `externalUserId`). Mirrors the\n * identity-relevant subset of the web SDK's `funkitConfig`. Required for the\n * SDK to generate deposit addresses; when omitted, the deposit flow falls\n * back to any host-supplied `depositAddress` on the flow config.\n */\n config?: FunkitConfig\n /**\n * The connected wallet address (default transfer recipient). On web this\n * comes from wagmi; RN has no wallet provider, so the host passes it here.\n */\n walletAddress?: string\n /**\n * React Query client. Web requires the host to supply one; for single-provider\n * RN ergonomics we default to an internally-created client when omitted (pass\n * your own to share a cache with the rest of the app).\n */\n queryClient?: QueryClient\n /**\n * Light/dark Restyle theme set. Defaults to the built-in Fun Mobile themes.\n * Forwarded to {@link FunkitThemeProvider}.\n */\n themes?: FunkitThemeProviderProps['themes']\n /**\n * Optional forced color scheme. When set, the scheme is controlled (system\n * Appearance ignored, `toggleColorScheme()` disabled); when omitted it\n * follows the system Appearance and is toggleable. Forwarded to\n * {@link FunkitThemeProvider}.\n */\n colorScheme?: FunkitThemeProviderProps['colorScheme']\n /**\n * Run Statsig in development mode (dev environment tier + verbose logging).\n * Mirrors `@funkit/connect`'s `debug`.\n */\n debug?: boolean\n /**\n * UI language for the SDK's own copy (defaults to English). Mirrors\n * `@funkit/connect`'s `locale`.\n */\n locale?: Locale\n /**\n * Clipboard write used by the deposit flow's \"Copy address\" buttons. Defaults\n * to the bare-RN `@react-native-clipboard/clipboard` peer (lazily loaded).\n * Inject your own to use a different module \u2014 e.g. pass `setStringAsync` from\n * `expo-clipboard` when running in **Expo Go**, where the native module isn't\n * linked. Return the write's success to drive the \"Copied!\" confirmation; a\n * `void` return is treated as success.\n */\n copyToClipboard?: ClipboardWriter\n /**\n * Clipboard read behind the withdrawal's \"Paste\" button. Defaults to the same\n * bare-RN peer as {@link FunkitProviderProps.copyToClipboard} \u2014 inject your own\n * (e.g. `getStringAsync` from `expo-clipboard`) where that module isn't linked.\n */\n pasteFromClipboard?: ClipboardReader\n /**\n * Blur behind the flow sheet's scrim. The SDK ships the scrim only (no native\n * blur dependency), so pass your own blur view \u2014 e.g.\n * `() => <BlurView style={StyleSheet.absoluteFill} />` \u2014 to complete the\n * design's blurred backdrop.\n */\n renderBackdropBlur?: BackdropBlurRenderer\n /**\n * Tactile tap for the withdrawal keypad. Omitted, the SDK taps through the\n * optional `react-native-haptic-feedback` peer when it is installed, and\n * stays silent when it isn't. Pass your own to use another module \u2014\n * `expo-haptics` in Expo Go, which links only Expo's own \u2014 or a no-op for\n * silence.\n */\n hapticFeedback?: HapticFeedback\n}\n\n// Sentinel identity used when the host mounts the provider without a `config`.\n// `'0x'` userId/address disables the transfer query (getCheckoutTokenTransferParams\n// returns undefined), so the flow shows its fallback rather than firing a bad\n// request.\nconst ANONYMOUS_CONFIG: FunkitConfig = { apiKey: '' }\n\n// Metro's debug-build global; `typeof`-probed so non-RN runtimes (tests, SSR)\n// resolve to false. Declared locally \u2014 this tsconfig loads only node types.\ndeclare const __DEV__: boolean | undefined\nconst IS_DEV_BUILD = typeof __DEV__ !== 'undefined' && !!__DEV__\n\n// Conservative default for the internally-created fallback client. Stock\n// react-query staleTime of 0 marks data stale immediately, so every remount\n// refetches and needlessly hits the API on mobile; a 60s floor stops that.\n// Retry is intentionally left at the react-query default \u2014 lowering it would\n// weaken flaky-network resilience (the case this SDK most needs to survive) and\n// can make the geo-compliance lookup fail closed. Hooks that need fresher or\n// staler data set their own staleTime.\nfunction createFallbackQueryClient(): QueryClient {\n return new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60_000,\n },\n },\n })\n}\n\n/**\n * Top-level, user-facing provider for `@funkit/connect-rn` \u2014 the single\n * provider host apps mount around their tree.\n *\n * Composes the platform halves, mirroring the web `FunkitProvider` nesting\n * (Statsig flags \u2192 React Query \u2192 identity \u2192 theme \u2192 i18n \u2192 the managed flow). Statsig\n * stays outermost so flags are available everywhere; the deposit-flow query\n * hooks below it read identity from {@link FunkitIdentityProvider} and run on\n * the {@link QueryClientProvider}. Host integration stays a single\n * `<FunkitProvider>`.\n */\nexport function FunkitProvider({\n children,\n config,\n walletAddress,\n queryClient,\n themes,\n colorScheme,\n debug = IS_DEV_BUILD,\n locale,\n copyToClipboard,\n pasteFromClipboard,\n renderBackdropBlur,\n hapticFeedback,\n}: FunkitProviderProps) {\n // Stable default client when the host doesn't supply one.\n const fallbackClient = useRef<QueryClient>(undefined)\n fallbackClient.current ??= createFallbackQueryClient()\n const client = queryClient ?? fallbackClient.current\n\n const identity = useMemo(\n () => resolveFunkitIdentity(config ?? ANONYMOUS_CONFIG, walletAddress),\n [config, walletAddress],\n )\n\n // Configure the Datadog logger once the apiKey is known. Without this the\n // FunLogger stays unconfigured, queues every record, and never emits to the\n // transport. Mirrors the web FunkitProvider. Only configure when an apiKey is\n // present \u2014 configuring with none makes every log a console \"apiKey not set\"\n // error, and there's nothing to ship to Datadog anyway.\n useEffect(() => {\n if (!config?.apiKey) {\n return\n }\n logger.configure(config.apiKey, debug, CONNECT_RN_VERSION)\n }, [config?.apiKey, debug])\n\n // Attach user context to every log (no apiKey required).\n useEffect(() => {\n logger.setUserInfo(\n identity.userId,\n identity.walletAddress,\n '',\n identity.loginType ?? '',\n '',\n )\n }, [identity])\n\n return (\n <SafeAreaProvider>\n <FunkitStatsigProvider\n apiKey={identity.apiKey}\n userId={identity.userId}\n isDevelopment={debug}\n >\n <QueryClientProvider client={client}>\n <FunkitIdentityProvider identity={identity}>\n <FunkitThemeProvider themes={themes} colorScheme={colorScheme}>\n <FunkitI18nProvider locale={locale}>\n <FunkitHapticsProvider hapticFeedback={hapticFeedback}>\n <FunkitFlowProvider\n copyToClipboard={copyToClipboard}\n pasteFromClipboard={pasteFromClipboard}\n renderBackdropBlur={renderBackdropBlur}\n >\n {children}\n </FunkitFlowProvider>\n </FunkitHapticsProvider>\n </FunkitI18nProvider>\n </FunkitThemeProvider>\n </FunkitIdentityProvider>\n </QueryClientProvider>\n </FunkitStatsigProvider>\n </SafeAreaProvider>\n )\n}\n", "import {\n type ReactNode,\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from 'react'\nimport { View, type ViewStyle } from 'react-native'\nimport { logger } from '../logging/logger'\nimport {\n type ClipboardReader,\n type ClipboardWriter,\n copyToClipboard as defaultCopyToClipboard,\n pasteFromClipboard as defaultPasteFromClipboard,\n guardClipboardReader,\n} from '../transfer/clipboard'\nimport { FlowContent } from './DepositFlowContent'\nimport type {\n DepositFlowCallbacks,\n DepositFlowConfig,\n} from './depositFlowConfig'\nimport { type BackdropBlurRenderer, FlowSheet } from './FlowSheet'\nimport { guardHostCallbacks } from './guardHostCallbacks'\nimport { useCopiedToast } from './useCopiedToast'\nimport { WithdrawalFlowContent } from './WithdrawalFlowContent'\nimport type {\n WithdrawalFlowCallbacks,\n WithdrawalFlowConfig,\n} from './withdrawalFlowConfig'\n\nexport type FlowScreen =\n | 'addMoney'\n | 'transfer'\n | 'swapped'\n | 'withdrawMethod'\n | 'withdrawAmount'\n | 'withdrawAddress'\n | 'withdrawReceiveToken'\n | 'withdrawComplete'\n\n/**\n * The open flow's mode + its config/callbacks, as a discriminated union so\n * deposit and withdrawal state can't cross-contaminate (a `beginDeposit` after\n * a withdrawal fully replaces the slot, and vice versa).\n */\ntype ActiveFlow =\n | {\n mode: 'deposit'\n config: DepositFlowConfig\n callbacks: DepositFlowCallbacks\n }\n | {\n mode: 'withdrawal'\n config: WithdrawalFlowConfig\n callbacks: WithdrawalFlowCallbacks\n }\n\ninterface FlowState {\n isOpen: boolean\n stack: FlowScreen[]\n flow: ActiveFlow | null\n /**\n * Bumped on every `begin*`. The sheet keys its present on this, so a new\n * session opened while a previous one is mid-dismiss re-presents (cancelling\n * the stale dismiss) instead of letting the late `onDismiss` close it.\n */\n session: number\n}\n\nconst CRYPTO_WITHDRAWAL_STEPS = new Set<FlowScreen>([\n 'withdrawAmount',\n 'withdrawAddress',\n 'withdrawReceiveToken',\n 'withdrawComplete',\n])\n\nconst CLOSED: FlowState = {\n isOpen: false,\n stack: [],\n flow: null,\n session: 0,\n}\n\ninterface FunkitFlowContextValue {\n /** Open the managed deposit flow at the Add money screen. */\n beginDeposit: (\n config: DepositFlowConfig,\n callbacks?: DepositFlowCallbacks,\n ) => void\n /** Open the managed withdrawal flow at the payout-method screen. */\n beginWithdrawal: (\n config: WithdrawalFlowConfig,\n callbacks?: WithdrawalFlowCallbacks,\n ) => void\n /** Close the flow. */\n closeFlow: () => void\n}\n\nconst FunkitFlowContext = createContext<FunkitFlowContextValue | null>(null)\n\nexport interface FlowNav {\n navigate: (s: FlowScreen) => void\n back: () => void\n /** Replace the whole stack with a single screen (never closes the sheet). */\n reset: (s: FlowScreen) => void\n /**\n * Pop back to `s`, however many screens deep it is \u2014 what `back` can't do once\n * a step lands between two that navigate to each other. A no-op when `s` isn't\n * on the stack.\n */\n popTo: (s: FlowScreen) => void\n closeFlow: () => void\n}\n\n/**\n * Mounts the managed deposit-flow modal and exposes `beginDeposit` to\n * {@link useFunkitCheckout}. The five screens are rendered + navigated here\n * (host apps never render them directly), mirroring how `@funkit/connect`'s\n * `FunkitProvider` owns the checkout modal.\n */\nexport function FunkitFlowProvider({\n children,\n copyToClipboard = defaultCopyToClipboard,\n pasteFromClipboard = defaultPasteFromClipboard,\n renderBackdropBlur,\n}: {\n children: ReactNode\n /** Host clipboard override; defaults to the bare-RN clipboard peer. */\n copyToClipboard?: ClipboardWriter\n /** Host clipboard-read override; defaults to the bare-RN clipboard peer. */\n pasteFromClipboard?: ClipboardReader\n /** Host blur under the sheet's scrim. See {@link BackdropBlurRenderer}. */\n renderBackdropBlur?: BackdropBlurRenderer\n}) {\n const [state, setState] = useState<FlowState>(CLOSED)\n\n // Guarded here for the same reason as the callbacks below. The write isn't:\n // its `void` return means success, so a swallowed failure would read as one\n // (see useCopyDepositAddress, which guards it where the result is compared).\n const readClipboard = useMemo(\n () => guardClipboardReader(pasteFromClipboard),\n [pasteFromClipboard],\n )\n\n // The two doors host callbacks come in through: guarded here, so everything\n // downstream reads them off flow state already wrapped.\n const beginDeposit = useCallback(\n (config: DepositFlowConfig, hostCallbacks: DepositFlowCallbacks = {}) => {\n logger.info('beginDeposit', config)\n const callbacks = guardHostCallbacks(hostCallbacks)\n callbacks.onOpen?.()\n setState((prev) => ({\n isOpen: true,\n stack: ['addMoney'],\n flow: { mode: 'deposit', config, callbacks },\n session: prev.session + 1,\n }))\n },\n [],\n )\n\n const beginWithdrawal = useCallback(\n (\n config: WithdrawalFlowConfig,\n hostCallbacks: WithdrawalFlowCallbacks = {},\n ) => {\n logger.info('beginWithdrawal', config)\n const callbacks = guardHostCallbacks(hostCallbacks)\n callbacks.onOpen?.()\n setState((prev) => ({\n isOpen: true,\n stack: ['withdrawMethod'],\n flow: { mode: 'withdrawal', config, callbacks },\n session: prev.session + 1,\n }))\n },\n [],\n )\n\n const { toast, showCopiedToast, clearToast } = useCopiedToast()\n\n const closeFlow = useCallback(() => {\n setState((prev) => {\n // Idempotent: fire onClose only on the open\u2192closed transition. The gorhom\n // sheet's dismiss animation re-invokes this (via onDismiss) after the host\n // has already closed, so a guard keeps onClose firing exactly once.\n if (!prev.isOpen) return prev\n prev.flow?.callbacks.onClose?.()\n return CLOSED\n })\n clearToast()\n }, [clearToast])\n\n const navigate = useCallback((screen: FlowScreen) => {\n setState((prev) => ({ ...prev, stack: [...prev.stack, screen] }))\n }, [])\n\n const reset = useCallback((screen: FlowScreen) => {\n setState((prev) => (prev.isOpen ? { ...prev, stack: [screen] } : prev))\n }, [])\n\n const popTo = useCallback((screen: FlowScreen) => {\n setState((prev) => {\n const index = prev.stack.lastIndexOf(screen)\n if (!prev.isOpen || index < 0) return prev\n return { ...prev, stack: prev.stack.slice(0, index + 1) }\n })\n }, [])\n\n const back = useCallback(() => {\n setState((prev) => {\n if (!prev.isOpen) return prev\n if (prev.stack.length <= 1) {\n prev.flow?.callbacks.onClose?.()\n return CLOSED\n }\n return { ...prev, stack: prev.stack.slice(0, -1) }\n })\n }, [])\n\n const value = useMemo<FunkitFlowContextValue>(\n () => ({ beginDeposit, beginWithdrawal, closeFlow }),\n [beginDeposit, beginWithdrawal, closeFlow],\n )\n\n const current = state.stack[state.stack.length - 1]\n // Each flow's home screen is its stack root (Add money / payout methods) \u2014\n // they only ever appear at depth 0.\n const isHomeScreen = state.stack.length <= 1\n const isCryptoWithdrawalStep =\n !!current && CRYPTO_WITHDRAWAL_STEPS.has(current)\n const nav = useMemo<FlowNav>(\n () => ({ navigate, back, reset, popTo, closeFlow }),\n [navigate, back, reset, popTo, closeFlow],\n )\n\n return (\n <FunkitFlowContext.Provider value={value}>\n <View style={rootContainer}>\n {/* FlowSheet wraps the host app (children) so the gorhom path's portal\n host spans the full screen; the flow screens render as `content`. */}\n <FlowSheet\n isOpen={state.isOpen}\n session={state.session}\n onClose={closeFlow}\n // The Swapped embed focuses an input inside its WebView, which gorhom\n // can't see; the rail's own screens are a full window and pad their own\n // footer. See useKeyboardHeight.\n keyboardAvoidEnabled={current === 'swapped'}\n // Transfer opts in (swiping it exits the flow); other pushed screens \u2014\n // especially the Swapped embed mid-payment \u2014 must not be dismissable.\n // The outcome opts in too: the funds have already moved, and while it\n // settles the design's button is a spinner, so a swipe is the only way\n // out of a poll that never comes back.\n enableSwipeToDismiss={\n isHomeScreen ||\n current === 'transfer' ||\n current === 'withdrawComplete'\n }\n // See {@link CRYPTO_WITHDRAWAL_STEPS}.\n fullHeight={isCryptoWithdrawalStep}\n renderBackdropBlur={renderBackdropBlur}\n content={\n // Mounted only while open so the flow queries run only then.\n state.isOpen && state.flow ? (\n state.flow.mode === 'deposit' ? (\n <FlowContent\n config={state.flow.config}\n current={current}\n nav={nav}\n copyToClipboard={copyToClipboard}\n onCopySuccess={showCopiedToast}\n callbacks={state.flow.callbacks}\n />\n ) : (\n <WithdrawalFlowContent\n config={state.flow.config}\n callbacks={state.flow.callbacks}\n current={current}\n nav={nav}\n pasteFromClipboard={readClipboard}\n />\n )\n ) : null\n }\n >\n {children}\n </FlowSheet>\n {/* A later sibling of FlowSheet: later siblings sit on top in RN, so\n the toast floats above the gorhom sheet without a <Modal> (which\n would block all touches for its entire lifetime). */}\n {toast}\n </View>\n </FunkitFlowContext.Provider>\n )\n}\n\nconst rootContainer: ViewStyle = { flex: 1 }\n\nexport function useFunkitFlow(): FunkitFlowContextValue {\n const value = useContext(FunkitFlowContext)\n if (value == null) {\n throw new Error('useFunkitFlow must be used within <FunkitProvider>')\n }\n return value\n}\n", "import { logger } from '../logging/logger'\n\n/**\n * A clipboard write the host can inject via `FunkitProvider`'s `copyToClipboard`\n * to use their own clipboard module \u2014 e.g. `expo-clipboard` in Expo Go, where\n * the bare-RN native module isn't linked. Given the address text; returns\n * whether the write succeeded (a `void` return is treated as success).\n */\nexport type ClipboardWriter = (value: string) => void | Promise<boolean>\n\n/**\n * Default clipboard: lazily (dynamic import) loads the bare-RN\n * `@react-native-clipboard/clipboard` peer and writes via `setString`.\n *\n * The import is dynamic + guarded so the native module is only **evaluated when\n * a copy actually happens** \u2014 not at startup. A host that hasn't linked it\n * (e.g. Expo Go, where `getEnforcing('RNCClipboard')` would throw) should inject\n * its own writer through `FunkitProvider`'s `copyToClipboard`; that override\n * runs instead, so this path \u2014 and the throw \u2014 never execute. If the module is\n * absent and no override is provided, the copy degrades to a no-op + warning\n * instead of crashing.\n *\n * Returns whether the copy succeeded.\n */\nexport async function copyToClipboard(value: string): Promise<boolean> {\n try {\n const { default: Clipboard } =\n await import('@react-native-clipboard/clipboard')\n Clipboard.setString(value)\n return true\n } catch (error) {\n logger.warn(\n 'connect-rn: clipboard write failed; address not copied. Inject ' +\n 'FunkitProvider `copyToClipboard` to use your own clipboard module ' +\n '(e.g. expo-clipboard in Expo Go).',\n { error: error instanceof Error ? error.message : String(error) },\n )\n return false\n }\n}\n\n/**\n * A clipboard read the host can inject via `FunkitProvider`'s\n * `pasteFromClipboard`, for the same reason as {@link ClipboardWriter}: the\n * bare-RN native module isn't linked everywhere. Returns the clipboard's text,\n * or `undefined` when it can't be read.\n */\nexport type ClipboardReader = () =>\n | string\n | undefined\n | Promise<string | undefined>\n\n/** A {@link ClipboardReader} that resolves to `undefined` instead of rejecting. */\nexport type SafeClipboardReader = () => Promise<string | undefined>\n\n/**\n * Wraps a host-injected reader where it enters the SDK, so no paste call site\n * has to defend itself. Only injected readers can fail; the default below is\n * already guarded, and the type lets a host throw as easily as reject.\n */\nexport function guardClipboardReader(\n read: ClipboardReader,\n): SafeClipboardReader {\n return async () => {\n try {\n const value = await read()\n // A host that ignores the type can resolve a non-string (e.g. the\n // `ClipboardItem[]` of `navigator.clipboard.read`), and call sites go\n // straight to `.trim()` \u2014 same unhandled rejection this guard exists for.\n if (value !== undefined && typeof value !== 'string') {\n logger.warn('connect-rn:host_callback_threw', {\n callback: 'pasteFromClipboard',\n error: `resolved ${typeof value}, expected string`,\n })\n return undefined\n }\n return value\n } catch (error) {\n logger.warn('connect-rn:host_callback_threw', {\n callback: 'pasteFromClipboard',\n error: error instanceof Error ? error.message : String(error),\n })\n return undefined\n }\n }\n}\n\n/**\n * Default clipboard read \u2014 the mirror of {@link copyToClipboard}, and dynamic for\n * the same reason: the native module is only evaluated when a paste actually\n * happens, so a host that hasn't linked it degrades to a warning instead of\n * crashing at startup.\n */\nexport async function pasteFromClipboard(): Promise<string | undefined> {\n try {\n const { default: Clipboard } =\n await import('@react-native-clipboard/clipboard')\n return await Clipboard.getString()\n } catch (error) {\n logger.warn(\n 'connect-rn: clipboard read failed; nothing pasted. Inject ' +\n 'FunkitProvider `pasteFromClipboard` to use your own clipboard module ' +\n '(e.g. expo-clipboard in Expo Go).',\n { error: error instanceof Error ? error.message : String(error) },\n )\n return undefined\n }\n}\n", "import { BottomSheetModal } from '@gorhom/bottom-sheet'\nimport { useStatsigClient } from '@statsig/react-bindings'\nimport { type ReactNode, useCallback, useEffect, useState } from 'react'\nimport { Share } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { SelectedChainRow } from '../components/SelectedChainRow'\nimport { SheetContent, sheetSizing } from '../components/SheetContent'\nimport { useCheckoutBlocked } from '../geo/useCheckoutBlocked'\nimport { useNestedSheet } from '../hooks/useNestedSheet'\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { CryptoBitcoinIcon } from '../icons/CryptoBitcoinIcon'\nimport { PaymentMethodIcon } from '../icons/PaymentMethodIcon'\nimport { QrChainCluster } from '../icons/QrChainCluster'\nimport { SourceTokenCluster } from '../icons/SourceTokenCluster'\nimport { TokenChainIcon } from '../icons/TokenChainIcon'\nimport { logger } from '../logging/logger'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { CheckoutBlockedScreen } from '../screens/CheckoutBlockedScreen'\nimport { QrCodeScreen } from '../screens/QrCodeScreen'\nimport {\n ChangeChainScreen,\n SelectChainScreen,\n} from '../screens/SelectChainScreen'\nimport {\n type PaymentMethodOption,\n type ReceiveTokenOption,\n SelectMethodScreen,\n} from '../screens/SelectMethodScreen'\nimport { TransferCryptoScreen } from '../screens/TransferCryptoScreen'\nimport { useDynamicConfig } from '../statsig/useDynamicConfig'\nimport { SwappedScreen } from '../swapped/SwappedScreen'\nimport {\n type AvailableChain,\n buildAvailableChains,\n} from '../transfer/availableChains'\nimport type { ClipboardWriter } from '../transfer/clipboard'\nimport { toFopRows } from '../transfer/fops'\nimport { formatDepositAddress } from '../transfer/formatDepositAddress'\nimport { useCopyDepositAddress } from '../transfer/hooks/useCopyDepositAddress'\nimport { useFiatExchangeRates } from '../transfer/hooks/useFiatExchangeRates'\nimport { type UseFopsResult, useFops } from '../transfer/hooks/useFops'\nimport { useSupportedTokens } from '../transfer/hooks/useSupportedTokens'\nimport { useTokenTransfer } from '../transfer/hooks/useTokenTransfer'\nimport { QrCode } from '../transfer/QrCode'\nimport type {\n DepositCheckoutConfig,\n DepositFlowCallbacks,\n DepositFlowConfig,\n DynamicTargetAssetCandidate,\n} from './depositFlowConfig'\nimport { getDefaultDynamicTargetAsset } from './depositFlowConfig'\nimport { FlowSheetBackground } from './FlowSheet'\nimport type { FlowNav, FlowScreen } from './FunkitFlowProvider'\nimport {\n readSelectedChainId,\n writeSelectedChainId,\n} from './selectedChainStorage'\n\n/**\n * Screens presented as a nested sheet on top of the current FlowScreen. Adding\n * one is a member here plus a branch in {@link DepositNestedSheet}.\n */\ntype NestedScreen = 'selectChain' | 'changeChain' | 'qrCode'\n\n/** Fill the sheet instead of hugging content; a record so new screens must choose. */\nconst FULL_HEIGHT_SCREENS: Record<NestedScreen, boolean> = {\n selectChain: true,\n changeChain: true,\n qrCode: false,\n}\n\n// The synthetic id of the built-in \"Crypto\" funding row. Payment methods are\n// derived internally (not host-configured), mirroring web \u2014 the crypto row\n// routes into the Transfer screen; the rest are Swapped FOPs.\nconst CRYPTO_METHOD_ID = 'crypto'\n\n/**\n * The live flow body. Drives the deposit-address + QR generation\n * ({@link useTokenTransfer}) for the open flow and renders the active screen\n * with the resolved data. Kept separate from the provider so its\n * hooks run only while the modal is open (it isn't mounted when closed).\n */\nexport function FlowContent({\n config,\n current,\n nav,\n copyToClipboard,\n onCopySuccess,\n callbacks,\n}: {\n config: DepositFlowConfig\n current: FlowScreen | undefined\n nav: FlowNav\n copyToClipboard: ClipboardWriter\n onCopySuccess: () => void\n callbacks: DepositFlowCallbacks\n}): ReactNode {\n const { t } = useFunkitTranslation()\n const insets = useSafeAreaInsets()\n const { userId } = useFunkitIdentity()\n const { isGeoblocked, isLoadingGeoCheck } = useCheckoutBlocked({\n onCheckoutBlocked: callbacks.onCheckoutBlocked,\n })\n\n const { selectedChainId, rememberChainId } = useRememberedChain(userId)\n const targetAsset = useDepositTargetAsset(config)\n const {\n depositAddress: generatedAddress,\n qrCodeUri,\n transferInit,\n isLoading: isAddressLoading,\n } = useTokenTransfer({\n checkoutConfig: targetAsset.activeCheckoutConfig,\n selectedChainId: selectedChainId ? Number(selectedChainId) : undefined,\n dynamicRoutingId: targetAsset.activeDynamicRoutingId,\n enabled: true,\n })\n\n // Curated deposit chains, fetched + resolved from the Statsig\n // `tokentransferconfig` (host config can override). `transferInit` gates\n // Solana/Bitcoin/Tron until their deposit address exists. The chain list\n // drives the \"Available chains\" screen.\n const fetched = useSupportedTokens({ transferInit })\n const tokenChainFilters = config.tokenChainFilters ?? fetched.chainFilters\n // Until the fetch settles there are no chains, so the Crypto row's trailing\n // logo cluster would render empty and pop in after. Only wait when the list\n // is actually being fetched (a host-supplied one is ready immediately).\n const isChainListLoading = !config.tokenChainFilters && fetched.isLoading\n\n // Per-chain minimum transfer values (Statsig), mirroring web's TransferToken.\n const minTransferLimits = useDynamicConfig('mintokentransfervalue')\n\n // Swapped forms of payment (Card / Apple Pay / Revolut Pay / Bank Transfer),\n // fetched the same way web does (minus geo). Mobile has no Crypto/Cash tabs \u2014\n // these are merged into the single Add money list (saved FOPs on top, then\n // Crypto, then the rest), so `isSwappedEnabled` just decides whether the cash\n // methods are present.\n const fops = useFops({\n checkoutConfig: targetAsset.activeCheckoutConfig,\n dynamicRoutingId: targetAsset.activeDynamicRoutingId,\n })\n\n // Statsig readiness gates the Add money skeleton: until it resolves,\n // `isSwappedEnabled` reads its `false` fallback (see `isAddMoneyLoading`).\n const { isLoading: isStatsigLoading } = useStatsigClient()\n\n // The embedded-flow URL of the cash method the user picked (drives the\n // Swapped WebView screen).\n const [selectedSwappedUrl, setSelectedSwappedUrl] = useState<string>()\n\n const minDepositTarget = {\n targetChain: targetAsset.activeCheckoutConfig?.targetChain,\n targetAsset: targetAsset.activeCheckoutConfig?.targetAsset,\n dynamicRoutingId: targetAsset.activeDynamicRoutingId,\n getMinDepositUSD: config.checkoutConfig?.getMinDepositUSD,\n }\n\n // The pickers list EVM and non-EVM chains together, so no network filter.\n const allChains = buildAvailableChains({\n t,\n chainFilters: tokenChainFilters,\n minTransferLimits,\n target: minDepositTarget,\n })\n\n const selectedChain = allChains.find((chain) => chain.id === selectedChainId)\n\n // Transfer can't render without a chain, so head back to Add money \u2014 the\n // Crypto row reads the same value and reopens the picker.\n useEffect(() => {\n if (current === 'transfer' && allChains.length && !selectedChain) {\n nav.back()\n }\n }, [current, allChains.length, selectedChain, nav])\n\n const selectChain = (chain: AvailableChain) => {\n // Source-chain decision point: drives the deposit address + QR generation.\n logger.info('connect-rn:deposit:chain_selected', {\n chainId: chain.id,\n chainName: chain.name,\n })\n rememberChainId(chain.id)\n }\n\n // Prefer the generated address; fall back to a host-supplied one while it\n // loads or when no identity is configured.\n const rawAddress = generatedAddress ?? config.depositAddress\n const displayAddress = rawAddress\n ? formatDepositAddress(rawAddress)\n : t('transferCrypto.generating')\n\n const copyAddressAndToast = useCopyDepositAddress({\n copyToClipboard,\n onCopySuccess,\n isTransferOpen: current === 'transfer',\n address: rawAddress,\n })\n\n const {\n nestedSheetRef,\n nestedScreen,\n setNestedScreen,\n openNestedScreen,\n closeNestedScreen,\n renderNestedBackdrop,\n } = useNestedSheet<NestedScreen>()\n const isFullHeightScreen = !!nestedScreen && FULL_HEIGHT_SCREENS[nestedScreen]\n\n const openSwappedFlow = (embeddedFlowUrl: string) => {\n setSelectedSwappedUrl(embeddedFlowUrl)\n nav.navigate('swapped')\n }\n\n const addMoneyMethods = useAddMoneyMethods({\n allChains,\n selectedChain,\n fops,\n targetAsset,\n nav,\n openNestedScreen,\n openSwappedFlow,\n })\n\n const screen = ((): ReactNode => {\n switch (current) {\n case 'addMoney': {\n // Every gate that changes what the list shows, so no row pops in late.\n // `isStatsigLoading` is one of them because `isSwappedEnabled` reads\n // `false` until it resolves \u2014 indistinguishable from an off gate.\n const isLoading =\n isLoadingGeoCheck ||\n isAddressLoading ||\n isStatsigLoading ||\n isChainListLoading ||\n (fops.isSwappedEnabled && fops.isLoading)\n return (\n <SelectMethodScreen\n {...addMoneyMethods}\n title={t('selectMethod.title')}\n errorTitle={t('selectMethod.errorTitle')}\n errorMessage={t('selectMethod.errorMessage')}\n loading={isLoading}\n error={fops.isSwappedEnabled && fops.isError}\n onRetry={fops.refetch}\n />\n )\n }\n case 'transfer':\n return selectedChain ? (\n <TransferCryptoScreen\n depositAddress={displayAddress}\n selectedChain={selectedChain}\n onBack={nav.back}\n onChangeChain={() => openNestedScreen('changeChain')}\n onShowQrCode={() => openNestedScreen('qrCode')}\n // Copy/share the FULL address (the screen only shows it truncated).\n // Clipboard is loaded lazily + guarded (see copyToClipboard) so a\n // missing native module degrades gracefully instead of crashing. The\n // toast is shown only after the write lands (see copyAddressAndToast).\n onCopyAddress={\n rawAddress\n ? () => void copyAddressAndToast(rawAddress)\n : undefined\n }\n onShareAddress={\n rawAddress\n ? () => void Share.share({ message: rawAddress })\n : undefined\n }\n />\n ) : null\n case 'swapped':\n return selectedSwappedUrl ? (\n <SwappedScreen\n url={selectedSwappedUrl}\n onBack={nav.back}\n onClose={nav.closeFlow}\n />\n ) : null\n default:\n return null\n }\n })()\n\n if (isGeoblocked) {\n return <CheckoutBlockedScreen />\n }\n\n return (\n <>\n {screen}\n <BottomSheetModal\n ref={nestedSheetRef}\n {...sheetSizing({ fullHeight: isFullHeightScreen })}\n // Same status-bar cap as FlowSheet \u2014 the chain list can grow tall.\n topInset={insets.top}\n // Every nested screen draws its own <Grabber />; `null` suppresses gorhom's.\n handleComponent={null}\n backgroundComponent={FlowSheetBackground}\n backdropComponent={renderNestedBackdrop}\n onDismiss={() => setNestedScreen(null)}\n >\n <SheetContent fullHeight={isFullHeightScreen}>\n <DepositNestedSheet\n nestedScreen={nestedScreen}\n allChains={allChains}\n selectedChain={selectedChain}\n isChainListLoading={isChainListLoading}\n selectChain={selectChain}\n closeNestedScreen={closeNestedScreen}\n nav={nav}\n qrCode={config.qrCode}\n qrCodeUri={qrCodeUri}\n rawAddress={rawAddress}\n copyAddressAndToast={copyAddressAndToast}\n />\n </SheetContent>\n </BottomSheetModal>\n </>\n )\n}\n\n/** What {@link SelectMethodScreen} renders, minus its i18n strings + load state. */\ninterface AddMoneyMethods {\n methods: PaymentMethodOption[]\n receiveTokens: ReceiveTokenOption[] | undefined\n selectedReceiveTokenId: string | undefined\n onSelectReceiveToken: (id: string) => void\n onSelectMethod: (id: string) => void\n}\n\n/**\n * The Add money list \u2014 saved FOPs, the built-in Crypto row, cash FOPs \u2014 and\n * where picking a row routes to. Derivation only: the caller owns the loading\n * and error gates, since those depend on flow-wide state this hook never sees.\n */\nfunction useAddMoneyMethods({\n allChains,\n selectedChain,\n fops,\n targetAsset,\n nav,\n openNestedScreen,\n openSwappedFlow,\n}: {\n allChains: AvailableChain[]\n /** Gates the Crypto row: with no chain yet, pick one before Transfer. */\n selectedChain: AvailableChain | undefined\n fops: UseFopsResult\n targetAsset: DepositTargetAsset\n nav: FlowNav\n openNestedScreen: (screen: NestedScreen) => void\n openSwappedFlow: (embeddedFlowUrl: string) => void\n}): AddMoneyMethods {\n const { t } = useFunkitTranslation()\n const { savedFops, genericFops, isSwappedEnabled } = fops\n const { candidates, selectedCandidate, setSelectedCandidate } = targetAsset\n\n // Only cash rows show a converted limit; skip the fetch when Swapped is off.\n const { data: exchangeRates } = useFiatExchangeRates(isSwappedEnabled)\n\n // The built-in crypto/transfer row (Figma: Add money crypto row): a\n // Bitcoin glyph leading + a trailing stack of supported source-chain\n // logos with a \"+N\" overflow. The row is derived internally (not\n // host-supplied, like web); its source icons come from the curated\n // deposit networks (deduped), not a host-passed list.\n const cryptoSourceIcons = allChains.map((c) => c.iconUri)\n const cryptoMethod: PaymentMethodOption[] = [\n {\n id: CRYPTO_METHOD_ID,\n title: t('selectMethod.crypto'),\n subtitle: t('selectMethod.noLimit'),\n icon: <CryptoBitcoinIcon />,\n trailing: cryptoSourceIcons.length ? (\n <SourceTokenCluster icons={cryptoSourceIcons} overflowMode=\"plus\" />\n ) : undefined,\n },\n ]\n const toCashRows = (fops: typeof savedFops): PaymentMethodOption[] =>\n toFopRows(t, fops, exchangeRates).map((row, i) => ({\n id: row.id,\n title: row.name,\n subtitle: row.subtitle,\n icon: <PaymentMethodIcon fop={fops[i]} />,\n }))\n // Single flat list (no tabs on mobile): saved FOPs on top, then the\n // Crypto row, then the generic cash FOPs \u2014 matching the Figma order. When\n // Swapped is off there are no FOPs, so it's just the host's methods.\n const methods: PaymentMethodOption[] = isSwappedEnabled\n ? [...toCashRows(savedFops), ...cryptoMethod, ...toCashRows(genericFops)]\n : cryptoMethod\n // Receive-token dropdown options. Keyed by array index \u2014 the only handle\n // guaranteed unique + stable across candidates, since `tokenSymbol` can\n // repeat (USDG with Perps/Spot `badgeText`) and `dynamicRoutingId` can be\n // absent. Selecting one rebinds the target asset (see\n // {@link useDepositTargetAsset}).\n const receiveTokens: ReceiveTokenOption[] | undefined = candidates?.map(\n (c, i) => ({\n id: String(i),\n label: c.badgeText ? `${c.tokenSymbol} (${c.badgeText})` : c.tokenSymbol,\n icon: <TokenChainIcon symbol={c.tokenSymbol} iconSrc={c.iconSrc} />,\n }),\n )\n const selectedReceiveTokenId =\n selectedCandidate && candidates\n ? String(candidates.indexOf(selectedCandidate))\n : undefined\n\n return {\n methods,\n receiveTokens,\n selectedReceiveTokenId,\n onSelectReceiveToken: (id) => {\n const picked = candidates?.[Number(id)]\n if (picked) {\n setSelectedCandidate(picked)\n }\n },\n onSelectMethod: (id) => {\n if (id === CRYPTO_METHOD_ID) {\n // First deposit picks a chain first, so the address + QR are\n // generated for one the user chose; after that, straight through.\n if (selectedChain == null) {\n openNestedScreen('selectChain')\n return\n }\n nav.navigate('transfer')\n return\n }\n // FOP rows use a `<fopType>:<name>` id (see `toFopRows`). Open the\n // selected method's Swapped embedded flow in the WebView screen.\n if (id.includes(':')) {\n const fop = [...savedFops, ...genericFops].find(\n (f) => `${f.fopType}:${f.name}` === id,\n )\n if (fop?.embeddedFlowUrl) {\n openSwappedFlow(fop.embeddedFlowUrl)\n }\n return\n }\n // TODO(connect-rn): other host methods route to their own flows\n // once those land.\n },\n }\n}\n\n/**\n * Content of the overlay sheet on top of the current deposit screen. Every\n * branch overlays rather than pushes, so Add money stays the stack root and\n * Transfer's back button returns there instead of to a picker.\n */\nfunction DepositNestedSheet({\n nestedScreen,\n allChains,\n selectedChain,\n isChainListLoading,\n selectChain,\n closeNestedScreen,\n nav,\n qrCode,\n qrCodeUri,\n rawAddress,\n copyAddressAndToast,\n}: {\n nestedScreen: NestedScreen | null\n allChains: AvailableChain[]\n selectedChain: AvailableChain | undefined\n isChainListLoading: boolean\n selectChain: (chain: AvailableChain) => void\n closeNestedScreen: () => void\n nav: FlowNav\n /** Host-supplied QR override; falls back to one rendered from `qrCodeUri`. */\n qrCode: ReactNode\n qrCodeUri: string | undefined\n rawAddress: string | undefined\n copyAddressAndToast: (value: string) => Promise<boolean>\n}): ReactNode {\n switch (nestedScreen) {\n case 'selectChain':\n return (\n <SelectChainScreen\n chains={allChains}\n selectedChain={selectedChain}\n loading={isChainListLoading}\n onBack={closeNestedScreen}\n onSelectChain={(chain) => {\n selectChain(chain)\n closeNestedScreen()\n nav.navigate('transfer')\n }}\n />\n )\n case 'changeChain':\n return (\n <ChangeChainScreen\n chains={allChains}\n selectedChain={selectedChain}\n onCancel={closeNestedScreen}\n onSelectChain={(chain) => {\n selectChain(chain)\n closeNestedScreen()\n }}\n />\n )\n case 'qrCode':\n return (\n <QrCodeScreen\n qrCode={\n qrCode ??\n (qrCodeUri ? <QrCode value={qrCodeUri} size={235} /> : null)\n }\n // Selected network's logos overlaid on the QR center (single network \u2192\n // one logo; multi-chain \u2192 a 2\u00D72 grid).\n centerIcon={\n <QrChainCluster\n iconKeys={selectedChain ? [selectedChain.iconUri] : []}\n />\n }\n // The full (untruncated) address; omitted while it's still\n // generating (the QR screen hides the address block until then).\n address={rawAddress}\n // Returns the copy's success so the screen only confirms \"Copied!\"\n // when the write actually landed (copyToClipboard is warn-only on\n // failure). Clipboard is loaded lazily + guarded (see copyToClipboard)\n // so a missing native module degrades gracefully instead of crashing.\n // The \"Address copied\" toast is also shown only on a successful write\n // (see copyAddressAndToast).\n onCopyAddress={\n rawAddress ? () => copyAddressAndToast(rawAddress) : undefined\n }\n onClose={closeNestedScreen}\n />\n )\n default:\n return null\n }\n}\n\ninterface DepositTargetAsset {\n /** The receive-token dropdown's options, in config order. */\n candidates: DynamicTargetAssetCandidate[] | undefined\n selectedCandidate: DynamicTargetAssetCandidate | undefined\n setSelectedCandidate: (candidate: DynamicTargetAssetCandidate) => void\n activeCheckoutConfig: DepositCheckoutConfig | undefined\n activeDynamicRoutingId: string | undefined\n}\n\n/**\n * The target token a deposit routes to, and the receive-token candidate the\n * user picked. Selecting a candidate re-targets the deposit address + QR and\n * the `dynamicRoutingId` in lockstep.\n */\nfunction useDepositTargetAsset(config: DepositFlowConfig): DepositTargetAsset {\n // Initialised to the resolved default for the config's `dynamicRoutingId`.\n const [selectedCandidate, setSelectedCandidate] = useState(() =>\n getDefaultDynamicTargetAsset(\n config.dynamicTargetAssetCandidates,\n config.dynamicRoutingId,\n ),\n )\n\n // The candidate's chain/asset win; the routing id falls back to the config's\n // existing value (NOT cleared) when the candidate omits one.\n const activeCheckoutConfig = selectedCandidate\n ? {\n ...config.checkoutConfig,\n targetChain: selectedCandidate.tokenChainId,\n targetAsset: selectedCandidate.tokenAddress,\n }\n : config.checkoutConfig\n const activeDynamicRoutingId =\n selectedCandidate?.dynamicRoutingId ?? config.dynamicRoutingId\n\n return {\n candidates: config.dynamicTargetAssetCandidates,\n selectedCandidate,\n setSelectedCandidate,\n activeCheckoutConfig,\n activeDynamicRoutingId,\n }\n}\n\ninterface RememberedChain {\n selectedChainId: string | undefined\n /** Persist the pick for this identity and apply it immediately. */\n rememberChainId: (chainId: string) => void\n}\n\n/**\n * The deposit chain the user picked, remembered across launches.\n *\n * The id, not the row \u2014 the row is derived from the curated chain list, so a\n * chain disabled after it was picked stops resolving instead of going stale.\n */\nfunction useRememberedChain(userId: string): RememberedChain {\n const [selectedChainId, setSelectedChainId] = useState<string>()\n\n useEffect(() => {\n let active = true\n // The selection belongs to an identity, so drop the previous one's before\n // reading; `current ??` alone can't tell a stale pick from a fresh one.\n setSelectedChainId(undefined)\n void readSelectedChainId(userId).then((storedId) => {\n // `active` drops a read whose identity has changed; `current ??` keeps a\n // slow one from clobbering a fresh pick.\n if (active && storedId) {\n setSelectedChainId((current) => current ?? storedId)\n }\n })\n return () => {\n active = false\n }\n }, [userId])\n\n const rememberChainId = useCallback(\n (chainId: string) => {\n setSelectedChainId(chainId)\n void writeSelectedChainId(userId, chainId)\n },\n [userId],\n )\n\n return { selectedChainId, rememberChainId }\n}\n", "import { BottomSheetView } from '@gorhom/bottom-sheet'\nimport type { ReactNode } from 'react'\n\nconst FULL_HEIGHT_DETENT = ['100%']\n\n/**\n * Sizing props for a `BottomSheetModal`; `topInset` stays with the caller.\n * A gorhom scrollable reports its content height as the sheet's, chrome\n * excluded, so screens with one take a detent and set their own height \u2014\n * matching whatever `topInset` the caller pairs this with.\n */\nexport function sheetSizing({ fullHeight }: { fullHeight: boolean }) {\n return fullHeight\n ? { enableDynamicSizing: false, snapPoints: FULL_HEIGHT_DETENT }\n : { enableDynamicSizing: true }\n}\n\n/**\n * Only a hug-content screen is wrapped: `BottomSheetView` measures it, but also\n * registers it as a static view, which over-drags the sheet on first touch.\n */\nexport function SheetContent({\n fullHeight,\n children,\n}: {\n fullHeight: boolean\n children: ReactNode\n}) {\n if (fullHeight) {\n return <>{children}</>\n }\n return <BottomSheetView>{children}</BottomSheetView>\n}\n", "import { useEffect, useMemo } from 'react'\nimport { useEffectEvent } from '@funkit/connect-core'\n\nimport { useDynamicConfig } from '../statsig/useDynamicConfig'\n\nimport { isCountryBlocked } from './isCountryBlocked'\nimport { useUserIpInfo } from './useUserIpInfo'\n\ninterface UseCheckoutBlockedParams {\n onCheckoutBlocked?: () => void\n}\n\ninterface UseCheckoutBlockedResult {\n isGeoblocked: boolean\n isLoadingGeoCheck: boolean\n}\n\nexport function useCheckoutBlocked(\n params: UseCheckoutBlockedParams,\n): UseCheckoutBlockedResult {\n const { userIpInfo, isLoadingGeoCheck } = useUserIpInfo()\n const blockedCountries = useDynamicConfig('blockedcountries')\n\n const isGeoblocked = useMemo(() => {\n if (isLoadingGeoCheck) {\n return false\n }\n if (!userIpInfo) {\n return true\n }\n return isCountryBlocked(blockedCountries, userIpInfo)\n }, [blockedCountries, isLoadingGeoCheck, userIpInfo])\n\n const onCheckoutBlockedEvent = useEffectEvent(() => {\n params.onCheckoutBlocked?.()\n })\n\n useEffect(() => {\n if (isGeoblocked) {\n onCheckoutBlockedEvent()\n }\n }, [isGeoblocked])\n\n return { isGeoblocked, isLoadingGeoCheck }\n}\n", "import {\n type DynamicConfigName,\n type DynamicConfigValue,\n useDynamicConfig as useCoreDynamicConfig,\n} from '@funkit/connect-core'\n\nimport { useUserIpInfo } from '../geo/useUserIpInfo'\n\n// RN counterpart of `@funkit/connect`'s `hooks/statsig/useDynamicConfig`. The\n// core hook takes `countryCode` as a parameter so it stays platform-agnostic;\n// this wrapper threads the user's IP-derived `alpha2` (Moonpay/ipapi) so\n// country-conditional variant configs (e.g. `enableswappeddeposit`) resolve\n// against the real region instead of falling to their default branch.\nexport type { DynamicConfigName, DynamicConfigValue }\n\nexport const useDynamicConfig = <Name extends DynamicConfigName>(\n name: Name,\n options?: {\n bypassCountryCode?: boolean\n },\n): DynamicConfigValue<Name> => {\n const { userIpInfo } = useUserIpInfo()\n return useCoreDynamicConfig(name, {\n bypassCountryCode: options?.bypassCountryCode,\n countryCode: userIpInfo?.alpha2,\n })\n}\n", "import { useUserIpInfo as useCoreUserIpInfo } from '@funkit/connect-core'\n\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\n\n// Re-exported so existing RN importers (isCountryBlocked, the flow hooks, tests)\n// keep their type source unchanged after the fetch logic moved to core.\nexport type {\n FunkitUserIpInfo,\n UseUserIpInfoResult,\n} from '@funkit/connect-core'\n\n// Thin RN wrapper over the shared core `useUserIpInfo` (V1 PR13 moved the\n// Moonpay\u2192ipapi fetch logic there so web and RN don't duplicate it). RN is\n// login-agnostic, so the lookup always runs (`enabled: true`); web's wrapper\n// gates on `isUserLoggedIn` instead. `apiKey` lets the core hook reach the\n// first-party geo endpoint; the chain it picks is Statsig-driven.\nexport function useUserIpInfo() {\n const { apiKey } = useFunkitIdentity()\n\n // Login-agnostic + session-stable: always run, never go stale.\n return useCoreUserIpInfo({\n logger,\n apiKey,\n enabled: true,\n staleTime: Number.POSITIVE_INFINITY,\n })\n}\n", "import { logger } from '../logging/logger'\nimport type { FunkitUserIpInfo } from './useUserIpInfo'\n\nconst ALL_MATCH = '*'\n\nexport function isCountryBlocked(\n blockedList: readonly string[],\n userIpInfo: FunkitUserIpInfo,\n): boolean {\n if (!userIpInfo.alpha2) {\n logger.log('isUserBlockedForCheckout_NoIpDetected')\n return true\n }\n\n const isBlocked =\n blockedList.includes(ALL_MATCH) || blockedList.includes(userIpInfo.alpha2)\n\n logger.info('isUserBlockedForCheckoutResult', {\n isBlocked,\n blockedList,\n alpha2: userIpInfo.alpha2,\n })\n return isBlocked\n}\n", "import {\n BottomSheetBackdrop,\n type BottomSheetModal,\n} from '@gorhom/bottom-sheet'\nimport {\n type ComponentProps,\n type ReactNode,\n type RefObject,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react'\n\nexport interface NestedSheet<TScreen extends string> {\n nestedSheetRef: RefObject<BottomSheetModal | null>\n nestedScreen: TScreen | null\n setNestedScreen: (screen: TScreen | null) => void\n openNestedScreen: (screen: TScreen) => void\n closeNestedScreen: () => void\n renderNestedBackdrop: (\n props: ComponentProps<typeof BottomSheetBackdrop>,\n ) => ReactNode\n}\n\n/**\n * Which overlay screen is showing, plus the sheet handle and backdrop the\n * caller feeds to its BottomSheetModal. `TScreen` is the flow's own union of\n * overlay screen names, so each flow keeps its screens typed to its own set.\n */\nexport function useNestedSheet<TScreen extends string>(): NestedSheet<TScreen> {\n const nestedSheetRef = useRef<BottomSheetModal>(null)\n const [nestedScreen, setNestedScreen] = useState<TScreen | null>(null)\n const openNestedScreen = useCallback((screen: TScreen) => {\n setNestedScreen(screen)\n }, [])\n useEffect(() => {\n if (nestedScreen) {\n nestedSheetRef.current?.present()\n }\n }, [nestedScreen])\n const closeNestedScreen = useCallback(() => {\n nestedSheetRef.current?.dismiss()\n }, [])\n const renderNestedBackdrop = useCallback(\n (props: ComponentProps<typeof BottomSheetBackdrop>) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n pressBehavior=\"close\"\n />\n ),\n [],\n )\n return {\n nestedSheetRef,\n nestedScreen,\n setNestedScreen,\n openNestedScreen,\n closeNestedScreen,\n renderNestedBackdrop,\n }\n}\n", "import { SvgXml } from 'react-native-svg'\n\nimport { useTheme } from '../theme/restyle'\n\n// Verbatim port of web's `CircleBitcoinIcon`\n// (`packages/connect/src/components/Icons/New/CircleBitcoinIcon.tsx`) \u2014 the\n// glyph the web \"Use Crypto\" tab uses. Kept as inline SVG (rendered via\n// `SvgXml`, like FunIcon) so the package stays asset-free. `fill=\"currentColor\"`\n// is resolved by the `color` prop below, so the disc tracks the active theme's\n// text color (dark disc in light mode, light disc in dark mode) \u2014 matching web.\nconst CIRCLE_BITCOIN_SVG = `<svg viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12.9168 11.8737C12.9168 12.449 12.4505 12.9154 11.8752 12.9154H8.75016V10.832H11.8752C12.4505 10.832 12.9168 11.2984 12.9168 11.8737Z\" fill=\"currentColor\"/><path d=\"M11.4585 7.08203H8.75016V9.16536H11.4585C12.0338 9.16536 12.5002 8.69899 12.5002 8.1237C12.5002 7.5484 12.0338 7.08203 11.4585 7.08203Z\" fill=\"currentColor\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.0002 0.832031C4.93755 0.832031 0.833496 4.93609 0.833496 9.9987C0.833496 15.0613 4.93755 19.1654 10.0002 19.1654C15.0628 19.1654 19.1668 15.0613 19.1668 9.9987C19.1668 4.93609 15.0628 0.832031 10.0002 0.832031ZM8.3335 4.16536C8.79373 4.16536 9.16683 4.53846 9.16683 4.9987V5.41536H10.0002V4.9987C10.0002 4.53846 10.3733 4.16536 10.8335 4.16536C11.2937 4.16536 11.6668 4.53846 11.6668 4.9987V5.42326C13.0653 5.52964 14.1668 6.69803 14.1668 8.1237C14.1668 8.74941 13.9546 9.32557 13.5983 9.78413C14.2 10.2809 14.5835 11.0325 14.5835 11.8737C14.5835 13.3695 13.3709 14.582 11.8752 14.582H11.6668V14.9987C11.6668 15.4589 11.2937 15.832 10.8335 15.832C10.3733 15.832 10.0002 15.4589 10.0002 14.9987V14.582H9.16683V14.9987C9.16683 15.4589 8.79373 15.832 8.3335 15.832C7.87326 15.832 7.50016 15.4589 7.50016 14.9987V14.582H6.66683C6.20659 14.582 5.8335 14.2089 5.8335 13.7487C5.8335 13.2885 6.20659 12.9154 6.66683 12.9154H7.0835V7.08203H6.66683C6.20659 7.08203 5.8335 6.70894 5.8335 6.2487C5.8335 5.78846 6.20659 5.41536 6.66683 5.41536H7.50016V4.9987C7.50016 4.53846 7.87326 4.16536 8.3335 4.16536Z\" fill=\"currentColor\"/></svg>`\n\n/**\n * The \"Crypto\" funding-source glyph (Figma: Add money crypto row leading) \u2014 the\n * RN port of web's `CircleBitcoinIcon`. Renders the bitcoin disc in the theme's\n * primary text color.\n */\nexport function CryptoBitcoinIcon({ size = 28 }: { size?: number }) {\n const theme = useTheme()\n return (\n <SvgXml\n xml={CIRCLE_BITCOIN_SVG}\n width={size}\n height={size}\n color={theme.content.elements.primary}\n />\n )\n}\n", "import type { SwappedFormOfPayment } from '@funkit/api-base'\nimport { getSwappedIcon, isSavedFormOfPaymentType } from '@funkit/connect-core'\n\nimport { useFunkitColorScheme } from '../theme/FunkitThemeProvider'\nimport { FALLBACK_ASSET_LOGO } from './assetLogos'\nimport { FunIcon } from './FunIcon'\nimport {\n JcbIcon,\n MastercardIcon,\n UnionPayIcon,\n VisaIcon,\n} from './PaymentBrandIcons'\n\n// RN can't render the CDN card-brand logos (embedded-raster SVGs), so use local\n// vectors where we have them and fall back to this generic glyph otherwise.\nconst CARD_ICON = 'https://sdk-cdn.fun.xyz/images/swapped/card-payment.svg'\n\n// Local brand vectors, keyed by the normalized cardBrand (spaces\u2192_, lowercased)\n// to match SWAPPED_CARD_BRANDS. Cartes Bancaires is intentionally absent \u2014 its\n// only logo is a raster inside an SVG <pattern> RN can't draw, so it falls back\n// to the generic card glyph.\nconst BRAND_ICONS: Record<string, typeof MastercardIcon> = {\n mastercard: MastercardIcon,\n visa: VisaIcon,\n jcb: JcbIcon,\n unionpay: UnionPayIcon,\n}\n\nconst genericCardIcon = (isDarkMode: boolean) =>\n isDarkMode ? CARD_ICON.replace('.svg', '-light.svg') : CARD_ICON\n\nexport function PaymentMethodIcon({ fop }: { fop: SwappedFormOfPayment }) {\n const isDarkMode = useFunkitColorScheme().colorScheme === 'dark'\n if (isSavedFormOfPaymentType(fop)) {\n const BrandIcon =\n BRAND_ICONS[fop.cardBrand.replace(/ /g, '_').toLowerCase()]\n if (BrandIcon) {\n return <BrandIcon size={32} />\n }\n return (\n <FunIcon\n uri={genericCardIcon(isDarkMode)}\n fallbackUri={FALLBACK_ASSET_LOGO}\n />\n )\n }\n return (\n <FunIcon\n uri={getSwappedIcon(fop, isDarkMode)}\n fallbackUri={FALLBACK_ASSET_LOGO}\n />\n )\n}\n", "// Symbol \u2192 Fun CDN logo map, duplicated verbatim from `@funkit/fun-relay`\n// (`src/assets.ts`). We copy rather than import because `@funkit/fun-relay` has\n// no subpath export \u2014 importing it would pull its relay-sdk / bitcoin adapter\n// graph into the React Native bundle. This is a pure data map with no deps, so\n// the cost of duplication is low; keep it in sync with fun-relay when symbols\n// are added there.\n//\n// This is the primary symbol\u2192logo source for the deposit token list. See\n// `funIconUri.ts#tokenLogoUri` for how the transfer screen resolves icons\n// (mirrors web's `getTokenIconUrl`, NOT the wallet-assets `getAssetLogoSrc`).\nexport const ASSET_LOGO_SRCS: Record<string, string> = {\n $MFER: 'https://sdk-cdn.fun.xyz/images/mfer.png',\n AARBUSDCN: 'https://sdk-cdn.fun.xyz/images/aarbusdcn.png',\n AAVE: 'https://sdk-cdn.fun.xyz/images/aave.svg',\n AERO: 'https://sdk-cdn.fun.xyz/images/aero.svg',\n APE: 'https://sdk-cdn.fun.xyz/images/ape.svg',\n APOLWMATIC: 'https://sdk-cdn.fun.xyz/images/apolwmatic.png',\n ARB: 'https://sdk-cdn.fun.xyz/images/arb.svg',\n BEHYPE: 'https://sdk-cdn.fun.xyz/images/behype.svg',\n BENTO: 'https://sdk-cdn.fun.xyz/images/bento.png',\n BLERF: 'https://sdk-cdn.fun.xyz/images/blerf.png',\n BRETT: 'https://sdk-cdn.fun.xyz/images/brett.svg',\n BSHIB: 'https://sdk-cdn.fun.xyz/images/bshib.png',\n BTC: 'https://sdk-cdn.fun.xyz/images/btc.svg',\n CBBTC: 'https://sdk-cdn.fun.xyz/images/cbbtc.svg',\n CBETH: 'https://sdk-cdn.fun.xyz/images/cbeth.png',\n CRO: 'https://sdk-cdn.fun.xyz/images/cro.svg',\n CRV: 'https://sdk-cdn.fun.xyz/images/crv.svg',\n DAI: 'https://sdk-cdn.fun.xyz/images/dai.svg',\n DEGEN: 'https://sdk-cdn.fun.xyz/images/degen.svg',\n ETH: 'https://sdk-cdn.fun.xyz/images/eth.svg',\n GMX: 'https://sdk-cdn.fun.xyz/images/gmx.svg',\n GRT: 'https://sdk-cdn.fun.xyz/images/grt.svg',\n HYPE: 'https://sdk-cdn.fun.xyz/images/hype.svg',\n IMX: 'https://sdk-cdn.fun.xyz/images/imx.svg',\n INJ: 'https://sdk-cdn.fun.xyz/images/inj.svg',\n LDO: 'https://sdk-cdn.fun.xyz/images/ldo.svg',\n LINK: 'https://sdk-cdn.fun.xyz/images/link.png',\n LUCK: 'https://sdk-cdn.fun.xyz/images/luck.png',\n MATIC: 'https://sdk-cdn.fun.xyz/images/matic.svg',\n MFER: 'https://sdk-cdn.fun.xyz/images/mfer.png',\n MKR: 'https://sdk-cdn.fun.xyz/images/mkr.svg',\n MNT: 'https://sdk-cdn.fun.xyz/images/mnt.svg',\n OP: 'https://sdk-cdn.fun.xyz/images/optimism.svg',\n PENDLE: 'https://sdk-cdn.fun.xyz/images/pendle.svg',\n POL: 'https://sdk-cdn.fun.xyz/images/matic.svg',\n PYUSD: 'https://sdk-cdn.fun.xyz/images/pyusd.svg',\n QNT: 'https://sdk-cdn.fun.xyz/images/qnt.svg',\n RNDR: 'https://sdk-cdn.fun.xyz/images/rndr.svg',\n ROOST: 'https://sdk-cdn.fun.xyz/images/roost.png',\n SAND: 'https://sdk-cdn.fun.xyz/images/sand.svg',\n SHIB: 'https://sdk-cdn.fun.xyz/images/shib.svg',\n SNX: 'https://sdk-cdn.fun.xyz/images/snx.svg',\n SOL: 'https://sdk-cdn.fun.xyz/images/sol.svg',\n SUSDS: 'https://sdk-cdn.fun.xyz/images/susds.svg',\n TYBG: 'https://sdk-cdn.fun.xyz/images/tybg.png',\n UNI: 'https://sdk-cdn.fun.xyz/images/uni.png',\n USDC: 'https://sdk-cdn.fun.xyz/images/usdc.svg',\n 'USDC.E': 'https://sdk-cdn.fun.xyz/images/usdc.svg',\n USDBC: 'https://sdk-cdn.fun.xyz/images/usdc.svg',\n USDE: 'https://sdk-cdn.fun.xyz/images/usde.svg',\n WUSDE: 'https://sdk-cdn.fun.xyz/images/usde.svg',\n EUSDE: 'https://sdk-cdn.fun.xyz/images/eusde.svg',\n USDT: 'https://sdk-cdn.fun.xyz/images/usdt.svg',\n 'USD\u20AE0': 'https://sdk-cdn.fun.xyz/images/usdt0.svg',\n USDT0: 'https://sdk-cdn.fun.xyz/images/usdt0.svg',\n USDS: 'https://sdk-cdn.fun.xyz/images/usds.svg',\n USDH: 'https://sdk-cdn.fun.xyz/images/usdh.svg',\n VRTX: 'https://sdk-cdn.fun.xyz/images/vrtx.svg',\n WBTC: 'https://sdk-cdn.fun.xyz/images/wbtc.svg',\n WEETH: 'https://sdk-cdn.fun.xyz/images/weeth.png',\n WETH: 'https://sdk-cdn.fun.xyz/images/weth.svg',\n WHYPE: 'https://sdk-cdn.fun.xyz/images/whype.png',\n WSTETH: 'https://sdk-cdn.fun.xyz/images/wsteth.png',\n TRUMP: 'https://sdk-cdn.fun.xyz/images/trump.png',\n BNB: 'https://sdk-cdn.fun.xyz/images/bsc.svg',\n WBNB: 'https://sdk-cdn.fun.xyz/images/bsc.svg',\n BTCB: 'https://sdk-cdn.fun.xyz/images/btc.svg',\n UBTC: 'https://sdk-cdn.fun.xyz/images/btc.svg',\n BUSD: 'https://sdk-cdn.fun.xyz/images/busd.svg',\n XAUT: 'https://sdk-cdn.fun.xyz/images/xaut.png',\n ADA: 'https://sdk-cdn.fun.xyz/images/ada.svg',\n XRP: 'https://sdk-cdn.fun.xyz/images/xrp.svg',\n UDOGE: 'https://sdk-cdn.fun.xyz/images/doge.svg',\n DOGE: 'https://sdk-cdn.fun.xyz/images/doge.svg',\n LTC: 'https://sdk-cdn.fun.xyz/images/ltc.svg',\n HNT: 'https://sdk-cdn.fun.xyz/images/hnt.svg',\n COMP: 'https://sdk-cdn.fun.xyz/images/comp.svg',\n PEPE: 'https://sdk-cdn.fun.xyz/images/pepe.svg',\n LSTHYPE: 'https://sdk-cdn.fun.xyz/images/lsthype.svg',\n HBUSDT: 'https://sdk-cdn.fun.xyz/images/hbusdt.svg',\n WVLP: 'https://sdk-cdn.fun.xyz/images/wvlp.svg',\n LIQUIDHYPE: 'https://sdk-cdn.fun.xyz/images/liquidhype.svg',\n VHYPE: 'https://sdk-cdn.fun.xyz/images/vhype.png',\n HBHYPE: 'https://sdk-cdn.fun.xyz/images/hbhype.svg',\n MON: 'https://sdk-cdn.fun.xyz/images/monad.svg',\n WMON: 'https://sdk-cdn.fun.xyz/images/wmon.svg',\n AUSD: 'https://sdk-cdn.fun.xyz/images/ausd.svg',\n SUSHI: 'https://sdk-cdn.fun.xyz/images/sushi.svg',\n SKY: 'https://sdk-cdn.fun.xyz/images/sky.svg',\n LIT: 'https://sdk-cdn.fun.xyz/images/lit.svg',\n AZTEC: 'https://sdk-cdn.fun.xyz/images/aztec.svg',\n U: 'https://sdk-cdn.fun.xyz/images/u.png',\n PUSD: 'https://sdk-cdn.fun.xyz/images/pusd.svg',\n}\n\n/** Generic fallback logo when a symbol isn't in the map. */\nexport const FALLBACK_ASSET_LOGO =\n 'https://sdk-cdn.fun.xyz/images/dollar_circle.png'\n\n/**\n * Verbatim mirror of `@funkit/fun-relay`'s `getAssetLogoSrc`: resolve a token's\n * logo URL by symbol (case-insensitive), falling back to a generic dollar-circle.\n * This is web's *wallet-assets* resolver. NOTE: the deposit/transfer token list\n * does NOT use this \u2014 it uses {@link tokenLogoUri} (web's `getTokenIconUrl`),\n * which falls back to `<symbol>.svg` rather than the dollar-circle.\n */\nexport function getAssetLogoSrc(symbol: string): string {\n return ASSET_LOGO_SRCS[symbol.toUpperCase()] ?? FALLBACK_ASSET_LOGO\n}\n", "import { useEffect, useState } from 'react'\nimport { Image, type ViewStyle } from 'react-native'\nimport { SvgCss } from 'react-native-svg/css'\n\nimport { Box, useTheme } from '../theme/restyle'\n\n/**\n * Fun's CDN chain logos are inconsistent: some ship `width`/`height` with **no\n * `viewBox`** (e.g. the 28\u00D728 EVM coins \u2014 these don't scale unless we add one),\n * while others ship their own `viewBox` at a different scale/origin (e.g. Solana\n * 16\u00D716, Tron `138.8 49.5 522 500.2`). A blanket `viewBox` override therefore\n * breaks the latter \u2014 squashing Solana into a corner and pushing Tron entirely\n * off-screen. So we fetch the SVG and **synthesize a `viewBox` only when one is\n * missing** (derived from width/height), never clobbering an existing one, then\n * render with {@link SvgCss}. Results are cached per URL.\n */\nconst svgCache = new Map<string, string>()\n\nfunction ensureViewBox(svg: string): string {\n if (/\\bviewBox\\s*=/.test(svg)) {\n return svg\n }\n const width = svg.match(/\\bwidth=\"([\\d.]+)\"/)?.[1]\n const height = svg.match(/\\bheight=\"([\\d.]+)\"/)?.[1]\n if (!width || !height) {\n return svg\n }\n return svg.replace(/<svg\\b/, `<svg viewBox=\"0 0 ${width} ${height}\"`)\n}\n\n/**\n * Renders a Fun CDN icon. SVG URLs (chain logos) are fetched, viewBox-normalized\n * and drawn via `SvgCss` (RN's built-in `Image` can't render SVG); raster URLs\n * (token PNGs) go through `Image`. Clipped to a circle.\n *\n * `SvgCss` over `SvgXml` because many CDN logos style their paths only through a\n * `<style>` block, which `SvgXml` drops \u2014 leaving them to paint black.\n */\nexport interface FunIconProps {\n uri: string\n size?: number\n /**\n * Raster URL to swap in if `uri` fails to load (SVG fetch error or `<Image>`\n * `onError`). Mirrors web's `AsyncImage` `fallbackSrc` \u2014 the token list passes\n * `FALLBACK_ASSET_LOGO` (dollar-circle) so a dead CDN URL degrades to the same\n * icon web shows, rather than a blank placeholder.\n */\n fallbackUri?: string\n}\n\nexport function FunIcon({ uri, size = 32, fallbackUri }: FunIconProps) {\n // The URL we're actually rendering; on load failure we swap to `fallbackUri`\n // (once), matching web's `AsyncImage` fallback-on-error behavior.\n const [currentUri, setCurrentUri] = useState(uri)\n const isSvg = currentUri.endsWith('.svg')\n const [xml, setXml] = useState<string | null>(\n () => svgCache.get(currentUri) ?? null,\n )\n // Raster (Image) load state \u2014 drives the placeholder until the logo paints.\n const [rasterLoaded, setRasterLoaded] = useState(false)\n const theme = useTheme()\n\n // Reset when the requested icon changes (e.g. a different token row).\n useEffect(() => {\n setCurrentUri(uri)\n setRasterLoaded(false)\n setXml(svgCache.get(uri) ?? null)\n }, [uri])\n\n // Swap to the fallback once if the current URL can't be rendered.\n const onFailure = () => {\n if (fallbackUri && currentUri !== fallbackUri) {\n setCurrentUri(fallbackUri)\n setRasterLoaded(false)\n setXml(svgCache.get(fallbackUri) ?? null)\n }\n }\n\n useEffect(() => {\n if (!isSvg) {\n return\n }\n const cached = svgCache.get(currentUri)\n if (cached != null) {\n setXml(cached)\n return\n }\n let active = true\n fetch(currentUri)\n .then((res) => {\n // A 404 still resolves; its body is an error page, not SVG. Treat a\n // non-OK response as a failure so it falls back instead of rendering a\n // blank circle (e.g. a mistyped CDN chain key like `bnb` vs `bsc`).\n if (!res.ok) {\n throw new Error(`icon fetch ${res.status}`)\n }\n return res.text()\n })\n .then((text) => {\n if (!text.includes('<svg')) {\n throw new Error('icon response is not an SVG')\n }\n const normalized = ensureViewBox(text)\n svgCache.set(currentUri, normalized)\n if (active) {\n setXml(normalized)\n }\n })\n .catch(() => {\n // Fetch failed: fall back to the dollar-circle (like web) if one was\n // supplied; otherwise the placeholder fill stays visible.\n if (active) {\n onFailure()\n }\n })\n return () => {\n active = false\n }\n }, [currentUri, isSvg])\n\n // Show a neutral placeholder circle until the icon is ready \u2014 i.e. while the\n // SVG is being fetched (or its fetch failed \u2192 `xml` stays null) or while the\n // raster logo hasn't painted (or 404'd \u2192 `onLoad` never fires). Avoids the\n // bare/broken icon gap seen on slow networks or missing CDN assets.\n const ready = isSvg ? xml != null : rasterLoaded\n const clip: ViewStyle = { overflow: 'hidden' }\n return (\n <Box\n width={size}\n height={size}\n borderRadius=\"rounded\"\n style={[\n clip,\n { backgroundColor: ready ? undefined : theme.background.secondary },\n ]}\n >\n {isSvg ? (\n xml != null ? (\n <SvgCss xml={xml} width={size} height={size} />\n ) : null\n ) : (\n <Image\n source={{ uri: currentUri }}\n style={{ width: size, height: size }}\n onLoad={() => setRasterLoaded(true)}\n onError={onFailure}\n />\n )}\n </Box>\n )\n}\n", "import { SvgXml } from 'react-native-svg'\n\nimport { useTheme } from '../theme/restyle'\n\n/**\n * Payment-method brand glyphs for the \"Add money\" funding-source picker (Figma:\n * Fun Mobile / Add money, node 11202:8263). Each is a byte-for-byte SVG export\n * from that Figma frame \u2014 Mastercard keeps its brand colors; the monochrome\n * marks (Apple, Revolut, Bank, Crypto) swap their fill/stroke to the theme's\n * primary content color so they track light/dark. Host apps may pass their own\n * brand icons instead; these are the package's design-matched defaults used by\n * the stories.\n */\n\ntype BrandIconProps = {\n /** Glyph box size in px (the leading slot centers it). */\n size?: number\n /** Override the monochrome color; defaults to the theme primary. */\n color?: string\n}\n\nfunction useGlyphColor(color?: string) {\n const theme = useTheme()\n return color ?? theme.content.elements.primary\n}\n\n// Mastercard: the two interlocking circles (red / amber + overlap), drawn at the\n// Figma 24\u00D718 aspect. Brand colors are fixed (not themed).\nconst MASTERCARD_SVG =\n '<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"8.5\" cy=\"9\" r=\"7.5\" fill=\"#EB001B\"/><circle cx=\"15.5\" cy=\"9\" r=\"7.5\" fill=\"#F79E1B\"/><path d=\"M12 3.3A7.49 7.49 0 0 1 12 14.7 7.49 7.49 0 0 1 12 3.3Z\" fill=\"#FF5F00\"/></svg>'\n\n// Apple logo (Figma node 788:9641), rendered in the theme primary color.\nconst APPLE_SVG =\n '<svg width=\"11.7334\" height=\"14.4\" viewBox=\"0 0 11.7334 14.4\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M8.63605 6.48119e-06C8.66955 6.48119e-06 8.70304 6.48119e-06 8.73843 6.48119e-06C8.82059 1.01552 8.43319 1.77432 7.96236 2.32381C7.50039 2.86951 6.86777 3.39877 5.8446 3.31846C5.77635 2.31749 6.16438 1.61497 6.63457 1.06674C7.07064 0.555823 7.87009 0.101179 8.63605 6.48119e-06Z\" fill=\"currentColor\"/><path d=\"M11.7334 10.57C11.7334 10.5801 11.7334 10.589 11.7334 10.5984C11.4459 11.4698 11.0357 12.2166 10.5352 12.9096C10.0783 13.5388 9.51835 14.3854 8.51856 14.3854C7.65465 14.3854 7.08081 13.8296 6.1954 13.8145C5.25881 13.7993 4.74375 14.2792 3.88741 14.4C3.78946 14.4 3.6915 14.4 3.59544 14.4C2.96662 14.3089 2.45914 13.8107 2.08943 13.3617C0.999267 12.0351 0.156839 10.3215 0.000107765 8.12857C0.000107765 7.91357 0.000107765 7.69922 0.000107765 7.48422C0.0664656 5.91479 0.828633 4.63875 1.8417 4.02033C2.37635 3.69152 3.11134 3.4114 3.92976 3.5366C4.28051 3.59098 4.63884 3.71112 4.95293 3.83C5.25059 3.94445 5.62283 4.14743 5.97548 4.13668C6.21436 4.12972 6.45199 4.00516 6.69277 3.91726C7.39806 3.66243 8.08945 3.3703 9.00076 3.50751C10.096 3.67318 10.8733 4.16008 11.3536 4.91128C10.4271 5.50124 9.69468 6.3903 9.81981 7.90852C9.93104 9.28762 10.7324 10.0945 11.7334 10.57Z\" fill=\"currentColor\"/></svg>'\n\n// Revolut \"R\" wordmark (Figma node 823426821), theme-colored.\nconst REVOLUT_SVG =\n '<svg width=\"15.9174\" height=\"20\" viewBox=\"0 0 15.9174 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3.7156 4.90723H0V19.9531H3.7156V4.90723Z\" fill=\"currentColor\"/><path d=\"M15.4128 5.77982C15.4128 2.56881 12.7982 0 9.63303 0H0V3.21101H9.12844C10.5963 3.21101 11.789 4.3578 11.789 5.73395C11.789 6.42202 11.5596 7.11009 11.055 7.61468C10.5505 8.11927 9.90826 8.3945 9.22018 8.3945H5.6422C5.50459 8.3945 5.41284 8.48624 5.41284 8.62385V11.4679C5.41284 11.5138 5.41284 11.5596 5.45872 11.6055L11.5138 20H15.9174L9.90826 11.5596C12.9358 11.422 15.4128 8.85321 15.4128 5.77982Z\" fill=\"currentColor\"/></svg>'\n\n// Bitcoin \"B\" coin (Figma icon/system, node b8d97bb3), theme-colored.\nconst CRYPTO_SVG =\n '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M15.5 14.25C15.5 14.9404 14.9404 15.5 14.25 15.5H10.5V13H14.25C14.9404 13 15.5 13.5596 15.5 14.25Z\" fill=\"currentColor\"/><path d=\"M13.75 8.5H10.5V11H13.75C14.4404 11 15 10.4404 15 9.75C15 9.05964 14.4404 8.5 13.75 8.5Z\" fill=\"currentColor\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1ZM10 5C10.5523 5 11 5.44772 11 6V6.5H12V6C12 5.44772 12.4477 5 13 5C13.5523 5 14 5.44772 14 6V6.50947C15.6781 6.63713 17 8.03919 17 9.75C17 10.5009 16.7454 11.1922 16.3178 11.7425C17.0398 12.3386 17.5 13.2406 17.5 14.25C17.5 16.0449 16.0449 17.5 14.25 17.5H14V18C14 18.5523 13.5523 19 13 19C12.4477 19 12 18.5523 12 18V17.5H11V18C11 18.5523 10.5523 19 10 19C9.44772 19 9 18.5523 9 18V17.5H8C7.44772 17.5 7 17.0523 7 16.5C7 15.9477 7.44772 15.5 8 15.5H8.5V8.5H8C7.44772 8.5 7 8.05228 7 7.5C7 6.94772 7.44772 6.5 8 6.5H9V6C9 5.44772 9.44772 5 10 5Z\" fill=\"currentColor\"/></svg>'\n\n// Bank \"source-and-destination\" line glyph (Figma node a82cc93d), theme-colored.\nconst BANK_SVG =\n '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3 21H21M6 18V9.99998M10 18V9.99998M14 18V9.99998M18 18V9.99998M20 6.99998L12.424 2.26498C12.2702 2.16884 12.1933 2.12077 12.1108 2.10203C12.0379 2.08546 11.9621 2.08546 11.8892 2.10203C11.8067 2.12077 11.7298 2.16884 11.576 2.26498L4 6.99998H20Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\n\n// Card-brand marks below keep their fixed brand colors (like Mastercard) and\n// are byte-for-byte SVG path exports. RN can render these vectors where it\n// cannot draw the CDN logos, which embed a raster inside an SVG <pattern>.\nconst VISA_SVG =\n '<svg width=\"24\" height=\"19\" viewBox=\"0 0 24 19\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M24 0.00405757L15.7253 19H10.3255L6.25345 3.83691C6.17546 3.09873 5.70545 2.48223 5.05208 2.17398L5.03943 2.16789C3.58936 1.48244 1.90322 0.924752 0.139106 0.573914L0 0.551607L0.122245 0.00202878H8.81426C9.99877 0.00202878 10.9831 0.835522 11.1664 1.92454L11.1685 1.93671L13.3205 12.9303L18.636 0L24 0.00405757Z\" fill=\"#1B33C3\"/></svg>'\n\nconst JCB_SVG =\n '<svg width=\"24\" height=\"19\" viewBox=\"0 0 24 19\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><g clip-path=\"url(#clip0_5933_159)\"><path d=\"M23.9201 15.1208C23.9201 17.2137 22.2589 18.9179 20.2188 18.9179H0.0800781V3.8791C0.0800781 1.78623 1.7413 0.0820312 3.7814 0.0820312H23.9201V15.1208Z\" fill=\"white\"/><path d=\"M17.3625 11.264H18.8926C18.9363 11.264 19.0383 11.249 19.0821 11.249C19.3735 11.1892 19.6212 10.9201 19.6212 10.5464C19.6212 10.1876 19.3735 9.91855 19.0821 9.84381C19.0383 9.82886 18.9509 9.82886 18.8926 9.82886H17.3625V11.264Z\" fill=\"url(#paint0_linear_5933_159)\"/><path d=\"M18.7177 1.35266C17.2605 1.35266 16.0656 2.56354 16.0656 4.0734V6.89878H19.8106C19.8981 6.89878 20.0001 6.89878 20.0729 6.91373C20.9181 6.95857 21.5447 7.40705 21.5447 8.1844C21.5447 8.79731 21.1221 9.32053 20.3352 9.42517V9.45507C21.195 9.51487 21.8507 10.0082 21.8507 10.7706C21.8507 11.5928 21.1221 12.131 20.1604 12.131H16.051V17.6621H19.9418C21.399 17.6621 22.5939 16.4512 22.5939 14.9414V1.35266H18.7177Z\" fill=\"url(#paint1_linear_5933_159)\"/><path d=\"M19.4318 8.36381C19.4318 8.00504 19.1841 7.76585 18.8926 7.721C18.8635 7.721 18.7906 7.70605 18.7469 7.70605H17.3625V9.02158H18.7469C18.7906 9.02158 18.8781 9.02158 18.8926 9.00663C19.1841 8.96178 19.4318 8.72259 19.4318 8.36381Z\" fill=\"url(#paint2_linear_5933_159)\"/><path d=\"M4.0583 1.35266C2.60109 1.35266 1.40617 2.56354 1.40617 4.0734V10.7855C2.14935 11.1593 2.92168 11.3985 3.694 11.3985C4.61204 11.3985 5.10749 10.8304 5.10749 10.053V6.88383H7.38075V10.0381C7.38075 11.2639 6.63757 12.2655 4.11659 12.2655C2.58652 12.2655 1.3916 11.9217 1.3916 11.9217V17.6472H5.28236C6.73957 17.6472 7.93449 16.4363 7.93449 14.9264V1.35266H4.0583Z\" fill=\"url(#paint3_linear_5933_159)\"/><path d=\"M11.388 1.35266C9.93075 1.35266 8.73584 2.56354 8.73584 4.0734V7.63128C9.40616 7.04827 10.5719 6.67454 12.4517 6.76423C13.4572 6.80908 14.5355 7.09311 14.5355 7.09311V8.24419C13.9964 7.96016 13.3552 7.70603 12.5246 7.64623C11.0965 7.54159 10.2368 8.25914 10.2368 9.51487C10.2368 10.7855 11.0965 11.5031 12.5246 11.3835C13.3552 11.3237 13.9964 11.0546 14.5355 10.7855V11.9366C14.5355 11.9366 13.4718 12.2207 12.4517 12.2655C10.5719 12.3552 9.40616 11.9815 8.73584 11.3985V17.6771H12.6266C14.0838 17.6771 15.2787 16.4662 15.2787 14.9563V1.35266H11.388Z\" fill=\"url(#paint4_linear_5933_159)\"/></g><defs><linearGradient id=\"paint0_linear_5933_159\" x1=\"16.0632\" y1=\"10.5482\" x2=\"22.6115\" y2=\"10.5482\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#007940\"/><stop offset=\"0.2285\" stop-color=\"#00873F\"/><stop offset=\"0.7433\" stop-color=\"#40A737\"/><stop offset=\"1\" stop-color=\"#5CB531\"/></linearGradient><linearGradient id=\"paint1_linear_5933_159\" x1=\"16.063\" y1=\"9.50087\" x2=\"22.6118\" y2=\"9.50087\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#007940\"/><stop offset=\"0.2285\" stop-color=\"#00873F\"/><stop offset=\"0.7433\" stop-color=\"#40A737\"/><stop offset=\"1\" stop-color=\"#5CB531\"/></linearGradient><linearGradient id=\"paint2_linear_5933_159\" x1=\"16.063\" y1=\"8.36194\" x2=\"22.6116\" y2=\"8.36194\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#007940\"/><stop offset=\"0.2285\" stop-color=\"#00873F\"/><stop offset=\"0.7433\" stop-color=\"#40A737\"/><stop offset=\"1\" stop-color=\"#5CB531\"/></linearGradient><linearGradient id=\"paint3_linear_5933_159\" x1=\"1.40309\" y1=\"9.50086\" x2=\"8.05279\" y2=\"9.50086\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#1F286F\"/><stop offset=\"0.4751\" stop-color=\"#004E94\"/><stop offset=\"0.8261\" stop-color=\"#0066B1\"/><stop offset=\"1\" stop-color=\"#006FBC\"/></linearGradient><linearGradient id=\"paint4_linear_5933_159\" x1=\"8.69816\" y1=\"9.50086\" x2=\"15.1566\" y2=\"9.50086\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#6C2C2F\"/><stop offset=\"0.1735\" stop-color=\"#882730\"/><stop offset=\"0.5731\" stop-color=\"#BE1833\"/><stop offset=\"0.8585\" stop-color=\"#DC0436\"/><stop offset=\"1\" stop-color=\"#E60039\"/></linearGradient><clipPath id=\"clip0_5933_159\"><rect width=\"24\" height=\"19\" fill=\"white\"/></clipPath></defs></svg>'\n\nconst UNIONPAY_SVG =\n '<svg width=\"256px\" height=\"160px\" viewBox=\"0 0 256 160\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" preserveAspectRatio=\"xMidYMid\"><g><path d=\"M50.041631,0.000667563305 L113.820211,0.000667563305 C122.723127,0.000667563305 128.260438,7.25731345 126.183558,16.1897657 L96.4900715,143.675416 C94.3945365,152.576777 85.480739,159.839641 76.571605,159.839641 L12.7992433,159.839641 C3.908764,159.839641 -1.64098444,152.576777 0.435896208,143.675416 L30.1418186,16.1897657 C32.2186993,7.25731345 41.1278333,0.000667563305 50.041631,0.000667563305\" fill=\"#E21836\"></path><path d=\"M108.513283,0.000667563305 L181.857018,0.000667563305 C190.758378,0.000667563305 186.744527,7.25731345 184.650546,16.1897657 L154.961724,143.675416 C152.878625,152.576777 153.528427,159.839641 144.608411,159.839641 L71.2646775,159.839641 C62.3446615,159.839641 56.8244495,152.576777 58.919985,143.675416 L88.6072525,16.1897657 C90.715224,7.25731345 99.6057035,0.000667563305 108.513283,0.000667563305\" fill=\"#00447C\"></path><path d=\"M178.94783,0.000667563305 L242.726409,0.000667563305 C251.641762,0.000667563305 257.179074,7.25731345 255.085093,16.1897657 L225.396271,143.675416 C223.300736,152.576777 214.380719,159.839641 205.466922,159.839641 L141.717879,159.839641 C132.797863,159.839641 127.265215,152.576777 129.354532,143.675416 L159.048017,16.1897657 C161.124899,7.25731345 170.027814,0.000667563305 178.94783,0.000667563305\" fill=\"#007B84\"></path><path d=\"M66.698338,40.8561434 C60.139686,40.9229891 58.202715,40.8561434 57.5840035,40.7100156 C57.346157,41.8401744 52.920349,62.256098 52.9079125,62.273198 C51.9549725,66.403641 51.261643,69.347961 48.9064975,71.2491775 C47.5695833,72.3544635 46.0088137,72.8876745 44.1993159,72.8876745 C41.2907503,72.8876745 39.5962892,71.4434965 39.3118063,68.704377 L39.2573971,67.7638735 C39.2573971,67.7638735 40.1434913,62.231225 40.1434913,62.200134 C40.1434913,62.200134 44.7884909,43.5952629 45.6201759,41.1359627 C45.6637033,40.9960531 45.6761397,40.9229891 45.6870215,40.8561434 C36.6457507,40.9354255 35.0430082,40.8561434 34.9326351,40.7100156 C34.8720075,40.9105527 34.6481522,42.0640298 34.6481522,42.0640298 L29.9052159,63.0333735 L29.4979234,64.8117805 L28.7097659,70.6289115 C28.7097659,72.3544635 29.0486581,73.762887 29.7233334,74.9536735 C31.8841598,78.729679 38.0479561,79.2955355 41.5348148,79.2955355 C46.0274683,79.2955355 50.241857,78.341041 53.089795,76.598389 C58.0332685,73.677387 59.3266555,69.1116695 60.4801325,65.0542905 L61.014898,62.972746 C61.014898,62.972746 65.7998075,43.6496723 66.6128375,41.1359627 C66.643929,40.9960531 66.656365,40.9229891 66.698338,40.8561434 Z M82.9786885,56.444252 C81.825211,56.444252 79.7172395,56.724071 77.823796,57.6521385 C77.1366845,58.0050215 76.486882,58.412314 75.8013245,58.818052 L76.420036,56.5841615 L76.081144,56.20796 C72.0657375,57.0209905 71.167207,57.129809 67.4580475,57.6521385 L67.147137,57.8588935 C66.7165265,61.4296985 66.3341065,64.1144085 64.7375825,71.133208 C64.129753,73.7199815 63.498605,76.331628 62.8659025,78.912183 L63.036903,79.2401935 C66.8377815,79.0396565 67.9912585,79.0396565 71.29468,79.0940655 L71.562063,78.8033645 C71.981792,76.65342 72.036201,76.1497455 72.965823,71.795447 C73.402652,69.7310025 74.313619,65.1948215 74.7628845,63.579643 C75.588351,63.197223 76.402936,62.8210215 77.1802115,62.8210215 C79.0316825,62.8210215 78.8062725,64.4362005 78.734763,65.079785 C78.655481,66.160198 77.9808055,69.68903 77.2890305,72.7188505 L76.8273285,74.674476 C76.5055365,76.1186545 76.152653,77.522414 75.830861,78.954156 L75.9707705,79.2401935 C79.7172395,79.0396565 80.859835,79.0396565 84.0591015,79.0940655 L84.435303,78.8033645 C85.013596,75.4455335 85.183042,74.547003 86.209046,69.6579385 L86.725157,67.411612 C87.727843,63.0153405 88.2315175,60.786114 87.4728965,58.970398 C86.670748,56.93549 84.7462135,56.444252 82.9786885,56.444252 Z M101.165696,61.047123 C99.1743155,61.429543 97.904247,61.684489 96.6419515,61.8492715 C95.3905375,62.049809 94.1702145,62.2316915 92.24568,62.499074 L92.093334,62.637429 L91.9534245,62.7478025 C91.7528875,64.181099 91.6129775,65.420076 91.3471495,66.876691 C91.1217395,68.383051 90.7750745,70.094612 90.2107725,72.5539125 C89.7739435,74.436474 89.5485335,75.092495 89.299805,75.754734 C89.057295,76.4169725 88.7899125,77.060557 88.298674,78.9120275 L88.413711,79.0830285 L88.510093,79.240038 C90.308709,79.1545375 91.4855045,79.09391 92.6949455,79.0830285 C93.902832,79.039501 95.1542455,79.0830285 97.0912165,79.09391 L97.260663,78.955555 L97.4425455,78.803209 C97.7223645,77.133621 97.7643375,76.6843555 97.935338,75.8697705 C98.104784,74.9961125 98.39704,73.786672 99.113688,70.556314 C99.4525805,69.039072 99.8303365,67.5264935 100.181665,65.97816 C100.546985,64.436045 100.929404,62.9172485 101.293169,61.4000065 L101.23876,61.2165695 L101.165696,61.047123 Z M101.208135,54.841043 C99.3986375,53.7730665 96.222689,54.1119585 94.0851805,55.587228 C91.953891,57.0329605 91.711381,59.0849685 93.5146605,60.166936 C95.293067,61.2053765 98.481452,60.896021 100.600305,59.408315 C102.726932,57.9314915 102.99276,55.898138 101.208135,54.841043 Z M112.151399,79.574733 C115.812368,79.574733 119.565055,78.565829 122.389675,75.571763 C124.562938,73.143554 125.559405,69.5307765 125.904516,68.043071 C127.028457,63.112034 126.153244,60.809743 125.054176,59.407538 C123.384588,57.2700295 120.43405,56.5844725 117.373138,56.5844725 C115.532549,56.5844725 111.148714,56.766355 107.724038,59.923649 C105.264737,62.2010665 104.12836,65.291515 103.442803,68.2544895 C102.751028,71.2734285 101.955097,76.70814 106.95298,78.7306115 C108.495095,79.3928505 110.718104,79.574733 112.151399,79.574733 Z M111.865362,68.4798995 C112.709484,64.7458675 113.705951,61.6118915 116.249197,61.6118915 C118.242132,61.6118915 118.386705,63.943719 117.500611,67.6901875 C117.342047,68.5218725 116.614517,71.6138755 115.630486,72.9305805 C114.943374,73.902175 114.130344,74.49135 113.231813,74.49135 C112.96443,74.49135 111.374124,74.49135 111.349251,72.1299865 C111.336815,70.964073 111.574661,69.7732865 111.865362,68.4798995 Z M135.05616,79.094532 L135.342197,78.803831 C135.747935,76.6538865 135.814781,76.148657 136.713312,71.7959135 C137.162577,69.731469 138.092198,65.195288 138.529028,63.580109 C139.356049,63.196135 140.156643,62.8199335 140.958791,62.8199335 C142.797825,62.8199335 142.57397,64.4351125 142.500907,65.0786965 C142.43406,66.1606645 141.759386,69.6879415 141.055173,72.717762 L140.618345,74.673388 C140.284116,76.1191205 139.920351,77.521326 139.598559,78.9546225 L139.738469,79.24066 C143.497374,79.0401225 144.596441,79.0401225 147.814363,79.094532 L148.203001,78.803831 C148.767303,75.4444455 148.919649,74.5459145 149.976744,69.658405 L150.480419,67.410524 C151.487768,63.0142525 151.99766,60.7865805 151.251476,58.9708645 C150.426009,56.9359565 148.489038,56.4447185 146.746386,56.4447185 C145.591354,56.4447185 143.472501,56.722983 141.589939,57.652605 C140.916819,58.005488 140.242143,58.411226 139.579904,58.8185185 L140.156643,56.584628 L139.847287,56.206872 C135.833436,57.021457 134.91625,57.1302755 131.211754,57.652605 L130.927271,57.85936 C130.478006,61.4301645 130.112686,64.1133205 128.516162,71.1336745 C127.908333,73.720448 127.277185,76.332094 126.646037,78.9126495 L126.815483,79.24066 C130.622579,79.0401225 131.758957,79.0401225 135.05616,79.094532 Z M162.673542,79.2398825 C162.909834,78.0864055 164.313594,71.2494885 164.32603,71.2494885 C164.32603,71.2494885 165.52148,66.232951 165.594545,66.0510685 C165.594545,66.0510685 165.970746,65.5287395 166.346947,65.321984 L166.900367,65.321984 C172.122106,65.321984 178.018519,65.321984 182.6402,61.92218 C185.785058,59.590353 187.935002,56.1470215 188.89416,51.9621695 C189.142889,50.9361655 189.326326,49.7158426 189.326326,48.4955199 C189.326326,46.8927774 189.004534,45.3071349 188.074912,44.0681575 C185.718212,40.770954 181.025022,40.7103265 175.60741,40.6854536 C175.59031,40.6854536 172.93669,40.7103265 172.93669,40.7103265 C166.001837,40.7958268 163.220744,40.770954 162.078149,40.6310444 C161.981767,41.1362735 161.799884,42.0348043 161.799884,42.0348043 C161.799884,42.0348043 159.315711,53.547812 159.315711,53.5664665 C159.315711,53.5664665 153.371107,78.0444325 153.091287,79.1979095 C159.146265,79.124846 161.628884,79.124846 162.673542,79.2398825 Z M167.276569,58.7882045 C167.276569,58.7882045 169.917752,47.2985153 169.905316,47.3420427 L169.990815,46.7528678 L170.028125,46.3036024 L171.083665,46.4124209 C171.083665,46.4124209 176.530813,46.8803409 176.658287,46.8927774 C178.808231,47.7244624 179.694325,49.8681887 179.075614,52.666381 C178.511312,55.223618 176.852606,57.373563 174.721316,58.412003 C172.966227,59.291879 170.816282,59.364943 168.601047,59.364943 L167.167751,59.364943 L167.276569,58.7882045 Z M183.721236,68.692718 C183.023242,71.668129 182.221093,77.102841 187.194103,79.039812 C188.779745,79.714487 190.200605,79.915024 191.644784,79.8419605 C193.169799,79.759569 194.582886,78.99473 195.891818,77.8941075 C195.773673,78.346482 195.655527,78.7988565 195.537381,79.2527855 L195.76279,79.5434865 C199.339813,79.392695 200.449763,79.392695 204.325259,79.4222315 L204.676588,79.1548485 C205.242445,75.8281085 205.775656,72.597751 207.246262,66.2334175 C207.962909,63.184942 208.678003,60.1660035 209.413306,57.1299645 L209.29827,56.795736 C205.296854,57.537257 204.227323,57.6958215 200.378253,58.241469 L200.085998,58.479315 C200.047134,58.788671 200.006716,59.08559 199.969406,59.3825095 C199.370904,58.4155785 198.503465,57.590112 197.164996,57.0755555 C195.453434,56.4024345 191.433365,57.269874 187.977597,60.416286 C185.549388,62.662613 184.383475,65.7406245 183.721236,68.692718 Z M192.12514,68.8746005 C192.981698,65.2074135 193.965729,62.104529 196.515194,62.104529 C198.127263,62.104529 198.976048,63.5922345 198.803493,66.1292625 C198.666693,66.761965 198.51901,67.4288675 198.343345,68.182825 C198.0884,69.2725655 197.811689,70.3529785 197.542752,71.4349465 C197.26915,72.174913 196.950468,72.8729065 196.600694,73.3377175 C195.944673,74.267339 194.383904,74.8440775 193.485373,74.8440775 C193.230426,74.8440775 191.65722,74.8440775 191.602811,72.524687 C191.590374,71.3696555 191.828221,70.1804235 192.12514,68.8746005 Z M236.010903,56.766044 L235.701548,56.413161 C231.742105,57.2153095 231.025456,57.3427825 227.387807,57.834021 L227.120423,58.1014035 C227.107988,58.144931 227.097105,58.211777 227.078451,58.2724045 L227.066014,58.211777 C224.357986,64.459519 224.437268,63.111723 222.232914,68.0303235 C222.220477,67.806468 222.220477,67.6665585 222.208042,67.428712 L221.656175,56.766044 L221.30951,56.413161 C217.161968,57.2153095 217.064031,57.3427825 213.233616,57.834021 L212.935143,58.1014035 C212.893169,58.228877 212.893169,58.3687865 212.868297,58.5211325 L212.893169,58.575542 C213.371971,61.022406 213.256934,60.4767585 213.737291,64.338264 C213.961146,66.233262 214.25962,68.139142 214.483475,70.010822 C214.861232,73.143243 215.072651,74.685358 215.534352,79.4656035 C212.947578,83.7344015 212.335085,85.3495805 209.844694,89.0960495 L209.861794,89.1333585 L208.10826,91.906678 C207.907723,92.198934 207.725841,92.399471 207.470894,92.4849715 C207.191075,92.6233265 206.82731,92.648199 206.32208,92.648199 L205.350486,92.648199 L203.906308,97.451763 L208.860663,97.5372635 C211.769228,97.524827 213.597381,96.1645945 214.581412,94.336442 L217.696733,88.9981125 L217.646987,88.9981125 L217.974998,88.621911 C220.070533,84.110603 236.010903,56.766044 236.010903,56.766044 Z M183.72108,119.853625 L181.619326,119.853625 L189.398302,94.1242455 L191.978857,94.1242455 L192.798105,91.4737355 L192.877387,94.421165 C192.781005,96.243099 194.214302,97.858278 197.979425,97.5908955 L202.333723,97.5908955 L203.832311,92.63654 L202.193814,92.63654 C201.251756,92.63654 200.814927,92.3986935 200.869337,91.888801 L200.790054,88.890071 L192.726596,88.890071 L192.726596,88.9056165 C190.119614,88.960026 182.33442,89.1558995 180.758105,89.5756285 C178.850671,90.0668665 176.840635,91.5125995 176.840635,91.5125995 L177.630347,88.85898 L170.087664,88.85898 L168.516013,94.1242455 L160.632883,120.246927 L159.103204,120.246927 L157.603062,125.165528 L172.626247,125.165528 L172.122572,126.805579 L179.525345,126.805579 L180.016584,125.165528 L182.093465,125.165528 L183.72108,119.853625 Z M177.557284,99.352202 C176.349398,99.6864305 174.101516,100.699998 174.101516,100.699998 L176.100669,94.1242455 L182.093465,94.1242455 L180.647732,98.915373 C180.647732,98.915373 178.796261,99.0241915 177.557284,99.352202 Z M177.672321,108.746356 C177.672321,108.746356 175.789759,108.982648 174.550781,109.262467 C173.330458,109.632451 171.042159,110.798364 171.042159,110.798364 L173.106603,103.955229 L179.13049,103.955229 L177.672321,108.746356 Z M174.31449,119.914253 L168.30304,119.914253 L170.045692,114.139095 L176.038487,114.139095 L174.31449,119.914253 Z M188.791404,103.955229 L197.456474,103.955229 L196.211278,107.987735 L187.431173,107.987735 L186.112912,112.396443 L193.795505,112.396443 L187.978375,120.587374 C187.571082,121.188986 187.205762,121.401959 186.800025,121.571405 C186.392732,121.77816 185.857967,122.02067 185.239255,122.02067 L183.107965,122.02067 L181.643577,126.849107 L187.218198,126.849107 C190.115882,126.849107 191.827443,125.530847 193.091294,123.800631 L197.080273,118.341047 L197.936831,123.884578 C198.118713,124.923017 198.864898,125.530847 199.370127,125.767139 C199.928211,126.046958 200.50495,126.527315 201.319535,126.598824 C202.193192,126.636133 202.82434,126.66567 203.244069,126.66567 L205.983189,126.66567 L207.627904,121.262049 L206.547491,121.262049 C205.927224,121.262049 204.859248,121.157894 204.677366,120.963575 C204.495483,120.727283 204.495483,120.363518 204.397546,119.810098 L203.528552,114.254131 L199.970183,114.254131 L201.530954,112.396443 L210.293959,112.396443 L211.641755,107.987735 L203.528552,107.987735 L204.792402,103.955229 L212.880733,103.955229 L214.380875,98.982219 L190.266674,98.982219 L188.791404,103.955229 Z M115.605924,121.037106 L117.628395,114.309008 L125.940582,114.309008 L127.459378,109.304907 L119.139419,109.304907 L120.409488,105.163582 L128.539791,105.163582 L130.046152,100.318045 L109.703292,100.318045 L108.228023,105.163582 L112.849704,105.163582 L111.616945,109.304907 L106.982827,109.304907 L105.446931,114.394508 L110.067057,114.394508 L107.371465,123.295869 C107.0077,124.474219 107.542466,124.923484 107.881358,125.470686 C108.228023,126.003897 108.579352,126.35678 109.369064,126.557317 C110.183649,126.7392 110.741733,126.848018 111.500354,126.848018 L120.87119,126.848018 L122.540778,121.304488 L118.387016,121.875009 C117.584868,121.875009 115.363414,121.778627 115.605924,121.037106 Z M116.55933,88.8286665 L114.452913,92.635763 C114.002093,93.4674475 113.596355,93.983559 113.231036,94.221405 C112.909244,94.4219425 112.271878,94.505888 111.348474,94.505888 L110.249406,94.505888 L108.780355,99.3762975 L112.430442,99.3762975 C114.18553,99.3762975 115.533326,98.7327135 116.176911,98.410921 C116.868686,98.040938 117.050568,98.252357 117.585334,97.736246 L118.818094,96.668269 L130.216064,96.668269 L131.728643,91.5973225 L123.385365,91.5973225 L124.84198,88.8286665 L116.55933,88.8286665 Z M133.386416,121.134887 C133.192097,120.855067 133.332007,120.362275 133.628926,119.336271 L136.744247,109.024932 L147.826644,109.024932 C149.441823,109.001614 150.607736,108.982959 151.366357,108.92855 C152.180942,108.843049 153.067037,108.552348 154.032413,108.030019 C155.028881,107.482817 155.538773,106.906078 155.969384,106.243839 C156.44974,105.583155 157.220798,104.137422 157.883037,101.908196 L161.798952,88.859291 L150.298381,88.926137 C150.298381,88.926137 146.757113,89.448466 145.197898,90.0252045 C143.624692,90.668789 141.37681,92.4658505 141.37681,92.4658505 L142.415251,88.8888275 L135.31095,88.8888275 L125.364931,121.874854 C125.012048,123.155803 124.775756,124.085425 124.721347,124.643509 C124.702692,125.245121 125.479968,125.840514 125.983643,126.289779 C126.579036,126.739045 127.458911,126.665981 128.303033,126.739045 C129.190682,126.805891 130.452978,126.847863 132.195629,126.847863 L137.655214,126.847863 L139.33102,121.189296 L134.443511,121.650998 C133.921182,121.650998 133.543426,121.371178 133.386416,121.134887 Z M138.754282,102.060541 L150.394763,102.060541 L149.654797,104.379932 C149.550642,104.434341 149.301913,104.264895 148.117345,104.404805 L138.037634,104.404805 L138.754282,102.060541 Z M141.086109,94.2815665 L152.824526,94.2815665 L151.980405,97.075095 C151.980405,97.075095 146.447757,97.020686 145.561663,97.1839135 C141.662847,97.858589 139.38543,99.941688 139.38543,99.941688 L141.086109,94.2815665 Z M149.915339,112.146937 C149.818957,112.493602 149.666611,112.705021 149.453638,112.863585 C149.217345,113.015931 148.834926,113.07034 148.264406,113.07034 L146.605699,113.07034 L146.703636,110.245721 L139.804537,110.245721 L139.524718,124.054801 C139.513836,125.051268 139.610218,125.628007 140.339303,126.089709 C141.068387,126.666447 143.314714,126.739511 146.338316,126.739511 L150.661524,126.739511 L152.222294,121.570628 L148.458724,121.777383 L147.207311,121.850447 C147.03631,121.777383 146.873082,121.710537 146.6912,121.528655 C146.532635,121.371645 146.265253,121.468028 146.30878,120.47156 L146.338316,116.931847 L150.285323,116.768619 C152.416613,116.768619 153.32758,116.075288 154.104855,115.414604 C154.846376,114.781902 155.088886,114.054372 155.368706,113.07034 L156.030945,109.936365 L150.607114,109.936365 L149.915339,112.146937 Z\" fill=\"#FEFEFE\"></path></g></svg>'\n\nexport function MastercardIcon({ size = 24 }: { size?: number }) {\n return <SvgXml xml={MASTERCARD_SVG} width={size} height={size * (18 / 24)} />\n}\n\nexport function VisaIcon({ size = 24 }: { size?: number }) {\n return <SvgXml xml={VISA_SVG} width={size} height={size * (19 / 24)} />\n}\n\nexport function JcbIcon({ size = 24 }: { size?: number }) {\n return <SvgXml xml={JCB_SVG} width={size} height={size * (19 / 24)} />\n}\n\nexport function UnionPayIcon({ size = 24 }: { size?: number }) {\n return <SvgXml xml={UNIONPAY_SVG} width={size} height={size * (160 / 256)} />\n}\n\nexport function ApplePayIcon({ size = 20, color }: BrandIconProps) {\n const c = useGlyphColor(color)\n const w = size * (11.7334 / 14.4)\n return (\n <SvgXml\n xml={APPLE_SVG.replace('currentColor', c).replace('currentColor', c)}\n width={w}\n height={size}\n />\n )\n}\n\nexport function RevolutIcon({ size = 20, color }: BrandIconProps) {\n const c = useGlyphColor(color)\n const w = size * (15.9174 / 20)\n return (\n <SvgXml\n xml={REVOLUT_SVG.replace('currentColor', c).replace('currentColor', c)}\n width={w}\n height={size}\n />\n )\n}\n\nexport function CryptoCoinIcon({ size = 24, color }: BrandIconProps) {\n const c = useGlyphColor(color)\n return (\n <SvgXml\n xml={CRYPTO_SVG.replace(/currentColor/g, c)}\n width={size}\n height={size}\n />\n )\n}\n\nexport function BankIcon({ size = 24, color }: BrandIconProps) {\n const c = useGlyphColor(color)\n return (\n <SvgXml\n xml={BANK_SVG.replace(/currentColor/g, c)}\n width={size}\n height={size}\n />\n )\n}\n", "import { ASSET_LOGO_SRCS } from './assetLogos'\n\n// Fun's icon CDN. Chain logos are SVG; token logos vary (svg/png). {@link FunIcon}\n// picks the renderer by extension (SvgXml for `.svg`, Image otherwise).\nconst CDN_BASE = 'https://sdk-cdn.fun.xyz/images'\n\n/** CDN URL for a chain logo, e.g. `chainIconUri('ethereum')`. SVG. */\nexport const chainIconUri = (chainKey: string): string =>\n `${CDN_BASE}/${chainKey}.svg`\n\n/**\n * Resolve a deposit token's logo URL by symbol \u2014 a verbatim mirror of the web\n * SDK's `getLocalTokenIconUrl` (`packages/connect/src/utils/tokenIconUrl.ts`),\n * the resolver the web *token-transfer* screen uses via `getTokenIconUrl`.\n *\n * IMPORTANT: web's transfer screen resolves the icon PURELY by symbol \u2014 it does\n * NOT consult the `/assets/supported` API `logo` field (that field is only used\n * by the wallet-holdings screen, via `getAssetLogoSrc`). The fallback for an\n * unknown symbol is `<symbol>.svg` on the CDN, NOT the dollar-circle. Matching\n * this exactly is why most tokens (USDT/DAI/WETH \u2026) now render: the CDN files\n * are `.svg`, and special cases like POL live in {@link ASSET_LOGO_SRCS}.\n */\nexport const tokenLogoUri = (symbol: string): string =>\n ASSET_LOGO_SRCS[symbol.toUpperCase()] ??\n `${CDN_BASE}/${symbol.toLowerCase()}.svg`\n", "import type { ViewStyle } from 'react-native'\n\nimport { Box } from '../theme/restyle'\nimport { FALLBACK_ASSET_LOGO } from './assetLogos'\nimport { FunIcon } from './FunIcon'\nimport { chainIconUri } from './funIconUri'\n\n/**\n * The chain-logo cluster shown in the center of the deposit QR (Figma: qr-code\n * \u2192 `icon/chain`). It reflects the selected network: a single network renders\n * one large logo (e.g. Solana), a multi-chain network renders a 2\u00D72 grid of\n * small logos (e.g. EVM: Ethereum / Aptos / Base / BNB). Logos resolve from CDN\n * chain keys OR full image URLs so the package stays asset-free.\n *\n * The QR behind it is drawn at high error-correction ({@link QrCode} `ecl=\"H\"`),\n * so this central occlusion stays scannable.\n */\nexport interface QrChainClusterProps {\n /**\n * Logos for the selected network \u2014 either CDN chain **keys** (e.g.\n * `['ethereum', 'bsc']`) or full image **URLs** (`@funkit/chains` `iconUrl`s).\n * One entry \u2192 a single logo; 2\u20134 \u2192 a 2\u00D72 grid.\n */\n iconKeys: string[]\n /** Max logos in the grid before the rest are dropped (Figma shows 4). */\n max?: number\n}\n\n/** A full URL is used as-is; anything else is treated as a CDN chain key. */\nfunction toIconUri(icon: string): string {\n return icon.startsWith('http') ? icon : chainIconUri(icon)\n}\n\n// Smaller logos with clear padding inside the quiet-zone card, so the center\n// occludes fewer QR modules (denser read) and the icons don't touch the edge.\n// Figma `icon/chain` card (node 12782:5552): 46px quiet-zone card, 12px radius\n// (border/radius/element). The 2\u00D72 grid is centered inside it, so the icons\n// keep a clean margin from the card edge.\nconst CARD_SIZE = 46\nconst CARD_RADIUS = 12\n// Single logo fills the card with the same ~6px margin the 2\u00D72 grid keeps.\nconst SINGLE_SIZE = 34\nconst GRID_SIZE = 16\nconst GRID_GAP = 3\n\nexport function QrChainCluster({ iconKeys, max = 4 }: QrChainClusterProps) {\n const keys = iconKeys.slice(0, max)\n const first = keys[0]\n if (first == null) {\n return null\n }\n\n if (keys.length === 1) {\n return (\n <Box alignItems=\"center\" justifyContent=\"center\" style={card}>\n <Box style={ring(SINGLE_SIZE)}>\n <FunIcon\n uri={toIconUri(first)}\n size={SINGLE_SIZE}\n fallbackUri={FALLBACK_ASSET_LOGO}\n />\n </Box>\n </Box>\n )\n }\n\n return (\n <Box alignItems=\"center\" justifyContent=\"center\" style={card}>\n <Box flexDirection=\"row\" flexWrap=\"wrap\" style={grid}>\n {keys.map((key) => (\n <Box key={key} style={ring(GRID_SIZE)}>\n <FunIcon\n uri={toIconUri(key)}\n size={GRID_SIZE}\n fallbackUri={FALLBACK_ASSET_LOGO}\n />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n\n// Cap the row at two columns so 3\u20134 logos wrap into a 2\u00D72.\nconst grid: ViewStyle = {\n width: GRID_SIZE * 2 + GRID_GAP,\n gap: GRID_GAP,\n}\n// The white rounded-square \"quiet zone\" behind the cluster (Figma `icon/chain`).\n// The QR is drawn at high error-correction so this central occlusion stays\n// scannable \u2014 without it the QR pattern bleeds through the gaps between the\n// circular logos. Padded so a little white shows around the 2\u00D72 grid.\nconst card: ViewStyle = {\n width: CARD_SIZE,\n height: CARD_SIZE,\n borderRadius: CARD_RADIUS,\n backgroundColor: '#FFFFFF',\n}\n// A logo clipped to a circle (no border \u2014 the chain SVGs carry their own\n// shape). The fill is an opaque white \u2014 the QR is always drawn on white cells\n// ({@link QrCode}), so transparent chain-logo SVGs need a white backing or the\n// QR pattern bleeds through behind the icon.\nconst ring = (iconSize: number): ViewStyle => ({\n width: iconSize,\n height: iconSize,\n borderRadius: 999,\n backgroundColor: '#FFFFFF',\n overflow: 'hidden',\n})\n", "import { SvgXml } from 'react-native-svg'\n\nimport { useTheme } from '../theme/restyle'\n\ntype IconProps = {\n size?: number\n color?: string\n}\n\nfunction useIconColor(color?: string) {\n const theme = useTheme()\n return color ?? theme.content.elements.primary\n}\n\nfunction renderIcon(svg: string, size: number, color: string) {\n return (\n <SvgXml\n xml={svg.replace(/currentColor/g, color)}\n width={size}\n height={size}\n />\n )\n}\n\n// Exact SVG icons exported from the Fun Mobile Figma file (node 10121:4436,\n// \"Fun Mobile (Copy)\" icon export set). Monochrome fills/strokes are swapped to\n// `currentColor` so the icons inherit theme colors; the success check keeps its\n// semantic green. Geometry is byte-for-byte from the export \u2014 nothing composed.\nconst CLOSE_SVG =\n '<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M4.41291 3.08709C4.0468 2.72097 3.4532 2.72097 3.08709 3.08709C2.72097 3.4532 2.72097 4.0468 3.08709 4.41291L8.67417 10L3.08709 15.5871C2.72097 15.9532 2.72097 16.5468 3.08709 16.9129C3.4532 17.279 4.0468 17.279 4.41291 16.9129L10 11.3258L15.5871 16.9129C15.9532 17.279 16.5468 17.279 16.9129 16.9129C17.279 16.5468 17.279 15.9532 16.9129 15.5871L11.3258 10L16.9129 4.41291C17.279 4.0468 17.279 3.4532 16.9129 3.08709C16.5468 2.72097 15.9532 2.72097 15.5871 3.08709L10 8.67417L4.41291 3.08709Z\" fill=\"currentColor\"/></svg>'\n\nconst QR_SCAN_SVG =\n '<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5.83333 9.99935H10V14.166M2.50833 9.99935H2.5M6.675 14.166H6.66667M10.0083 17.4993H10M17.5083 9.99935H17.5M2.5 14.166H3.75M12.9167 9.99935H14.5833M2.5 17.4993H6.66667M10 1.66602V6.66602M14.6667 17.4993H16.1667C16.6334 17.4993 16.8667 17.4993 17.045 17.4085C17.2018 17.3286 17.3293 17.2011 17.4092 17.0443C17.5 16.8661 17.5 16.6327 17.5 16.166V14.666C17.5 14.1993 17.5 13.966 17.4092 13.7877C17.3293 13.6309 17.2018 13.5034 17.045 13.4235C16.8667 13.3327 16.6334 13.3327 16.1667 13.3327H14.6667C14.2 13.3327 13.9666 13.3327 13.7883 13.4235C13.6315 13.5034 13.5041 13.6309 13.4242 13.7877C13.3333 13.966 13.3333 14.1993 13.3333 14.666V16.166C13.3333 16.6327 13.3333 16.8661 13.4242 17.0443C13.5041 17.2011 13.6315 17.3286 13.7883 17.4085C13.9666 17.4993 14.2 17.4993 14.6667 17.4993ZM14.6667 6.66602H16.1667C16.6334 6.66602 16.8667 6.66602 17.045 6.57519C17.2018 6.49529 17.3293 6.36781 17.4092 6.21101C17.5 6.03275 17.5 5.79939 17.5 5.33268V3.83268C17.5 3.36597 17.5 3.13262 17.4092 2.95436C17.3293 2.79756 17.2018 2.67007 17.045 2.59018C16.8667 2.49935 16.6334 2.49935 16.1667 2.49935H14.6667C14.2 2.49935 13.9666 2.49935 13.7883 2.59018C13.6315 2.67007 13.5041 2.79756 13.4242 2.95436C13.3333 3.13262 13.3333 3.36597 13.3333 3.83268V5.33268C13.3333 5.79939 13.3333 6.03275 13.4242 6.21101C13.5041 6.36781 13.6315 6.49529 13.7883 6.57519C13.9666 6.66602 14.2 6.66602 14.6667 6.66602ZM3.83333 6.66602H5.33333C5.80004 6.66602 6.0334 6.66602 6.21166 6.57519C6.36846 6.49529 6.49594 6.36781 6.57584 6.21101C6.66667 6.03275 6.66667 5.79939 6.66667 5.33268V3.83268C6.66667 3.36597 6.66667 3.13262 6.57584 2.95436C6.49594 2.79756 6.36846 2.67007 6.21166 2.59018C6.0334 2.49935 5.80004 2.49935 5.33333 2.49935H3.83333C3.36662 2.49935 3.13327 2.49935 2.95501 2.59018C2.79821 2.67007 2.67072 2.79756 2.59083 2.95436C2.5 3.13262 2.5 3.36597 2.5 3.83268V5.33268C2.5 5.79939 2.5 6.03275 2.59083 6.21101C2.67072 6.36781 2.79821 6.49529 2.95501 6.57519C3.13327 6.66602 3.36662 6.66602 3.83333 6.66602Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\n\nconst COPY_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5.6 10.4V12.08C5.6 12.7521 5.6 13.0881 5.73079 13.3448C5.84584 13.5706 6.02942 13.7542 6.25521 13.8692C6.51191 14 6.84794 14 7.52 14H12.08C12.7521 14 13.0881 14 13.3448 13.8692C13.5706 13.7542 13.7542 13.5706 13.8692 13.3448C14 13.0881 14 12.7521 14 12.08V7.52C14 6.84794 14 6.51191 13.8692 6.25521C13.7542 6.02942 13.5706 5.84584 13.3448 5.73079C13.0881 5.6 12.7521 5.6 12.08 5.6H10.4M3.92 10.4H8.48C9.15206 10.4 9.48809 10.4 9.74479 10.2692C9.97058 10.1542 10.1542 9.97058 10.2692 9.74479C10.4 9.48809 10.4 9.15206 10.4 8.48V3.92C10.4 3.24794 10.4 2.91191 10.2692 2.65521C10.1542 2.42942 9.97058 2.24584 9.74479 2.13079C9.48809 2 9.15206 2 8.48 2H3.92C3.24794 2 2.91191 2 2.65521 2.13079C2.42942 2.24584 2.24584 2.42942 2.13079 2.65521C2 2.91191 2 3.24794 2 3.92V8.48C2 9.15206 2 9.48809 2.13079 9.74479C2.24584 9.97058 2.42942 10.1542 2.65521 10.2692C2.91191 10.4 3.24794 10.4 3.92 10.4Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\n\nconst SHARE_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M14 8V10.8C14 11.9201 14 12.4802 13.782 12.908C13.5903 13.2843 13.2843 13.5903 12.908 13.782C12.4802 14 11.9201 14 10.8 14H5.2C4.07989 14 3.51984 14 3.09202 13.782C2.71569 13.5903 2.40973 13.2843 2.21799 12.908C2 12.4802 2 11.9201 2 10.8V8M5.33333 4.66667L8 2L10.6667 4.66667M8 2V10\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\n\nconst CHEVRON_RIGHT_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.71967 12.5303C5.42678 12.2374 5.42678 11.7626 5.71967 11.4697L9.18934 8L5.71967 4.53033C5.42678 4.23744 5.42678 3.76256 5.71967 3.46967C6.01256 3.17678 6.48744 3.17678 6.78033 3.46967L10.7803 7.46967C11.0732 7.76256 11.0732 8.23744 10.7803 8.53033L6.78033 12.5303C6.48744 12.8232 6.01256 12.8232 5.71967 12.5303Z\" fill=\"currentColor\"/></svg>'\n\nconst CHEVRON_LEFT_SVG =\n '<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12.8504 15.6629C13.2165 15.2968 13.2165 14.7032 12.8504 14.3371L8.51333 10L12.8504 5.66291C13.2165 5.2968 13.2165 4.7032 12.8504 4.33709C12.4843 3.97097 11.8907 3.97097 11.5246 4.33709L6.52459 9.33709C6.15847 9.7032 6.15847 10.2968 6.52459 10.6629L11.5246 15.6629C11.8907 16.029 12.4843 16.029 12.8504 15.6629Z\" fill=\"currentColor\"/></svg>'\n\n// Semantic success check-in-circle \u2014 keeps its Figma green (#52A300) regardless\n// of theme color, since it signals a confirmed action (\"Address copied\").\nconst SUCCESS_CHECK_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5.5 8.5L7 10L10.5 6.5M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z\" stroke=\"#52A300\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\n\n// The Fun Mobile export set does not include a down-chevron or a plain selection\n// check (the token dropdown's expanded state is not part of the exported frames),\n// so these stay as the matching Fun Brand Guidelines system glyphs.\nconst CHEVRON_DOWN_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M3.46967 5.71967C3.76256 5.42678 4.23744 5.42678 4.53033 5.71967L8 9.18934L11.4697 5.71967C11.7626 5.42678 12.2374 5.42678 12.5303 5.71967C12.8232 6.01256 12.8232 6.48744 12.5303 6.78033L8.53033 10.7803C8.23744 11.0732 7.76256 11.0732 7.46967 10.7803L3.46967 6.78033C3.17678 6.48744 3.17678 6.01256 3.46967 5.71967Z\" fill=\"currentColor\"/></svg>'\n\n// The denomination swap (node 13928:63184). Path is the export verbatim; the\n// wrapper applies the quarter turn, since the export draws it lying down.\nconst SWAP_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><g transform=\"translate(1 14) rotate(-90)\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M8.21967 0.21967C8.51256 -0.0732233 8.98744 -0.0732233 9.28033 0.21967L11.947 2.88634C12.2399 3.17923 12.2399 3.6541 11.947 3.947L9.28033 6.61366C8.98744 6.90656 8.51256 6.90656 8.21967 6.61366C7.92678 6.32077 7.92678 5.8459 8.21967 5.553L9.60601 4.16667H0.75C0.335786 4.16667 0 3.83088 0 3.41667C0 3.00245 0.335786 2.66667 0.75 2.66667H9.60601L8.21967 1.28033C7.92678 0.987437 7.92678 0.512563 8.21967 0.21967ZM3.947 6.88634C4.23989 7.17923 4.23989 7.6541 3.947 7.947L2.56066 9.33333H11.4167C11.8309 9.33333 12.1667 9.66912 12.1667 10.0833C12.1667 10.4975 11.8309 10.8333 11.4167 10.8333H2.56066L3.947 12.2197C4.23989 12.5126 4.23989 12.9874 3.947 13.2803C3.6541 13.5732 3.17923 13.5732 2.88634 13.2803L0.21967 10.6137C-0.0732233 10.3208 -0.0732233 9.8459 0.21967 9.553L2.88634 6.88634C3.17923 6.59344 3.6541 6.59344 3.947 6.88634Z\" fill=\"currentColor\"/></g></svg>'\n\nconst CHECK_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M13.8047 4.19526C14.0651 4.45561 14.0651 4.87772 13.8047 5.13807L6.80474 12.1381C6.54439 12.3984 6.12228 12.3984 5.86193 12.1381L2.5286 8.80474C2.26825 8.54439 2.26825 8.12228 2.5286 7.86193C2.78895 7.60158 3.21106 7.60158 3.4714 7.86193L6.33333 10.7239L12.8619 4.19526C13.1223 3.93491 13.5444 3.93491 13.8047 4.19526Z\" fill=\"currentColor\"/></svg>'\n\nexport function FigmaCloseIcon({ size = 20, color }: IconProps) {\n return renderIcon(CLOSE_SVG, size, useIconColor(color))\n}\n\nexport function FigmaQrScanIcon({ size = 20, color }: IconProps) {\n return renderIcon(QR_SCAN_SVG, size, useIconColor(color))\n}\n\nexport function FigmaCopyIcon({ size = 16, color }: IconProps) {\n return renderIcon(COPY_SVG, size, useIconColor(color))\n}\n\nexport function FigmaShareIcon({ size = 16, color }: IconProps) {\n return renderIcon(SHARE_SVG, size, useIconColor(color))\n}\n\nexport function FigmaChevronRightIcon({ size = 16, color }: IconProps) {\n return renderIcon(CHEVRON_RIGHT_SVG, size, useIconColor(color))\n}\n\nexport function FigmaChevronLeftIcon({ size = 20, color }: IconProps) {\n return renderIcon(CHEVRON_LEFT_SVG, size, useIconColor(color))\n}\n\nexport function FigmaSuccessCheckIcon({ size = 16 }: { size?: number }) {\n return <SvgXml xml={SUCCESS_CHECK_SVG} width={size} height={size} />\n}\n\nexport function FigmaChevronDownIcon({ size = 16, color }: IconProps) {\n return renderIcon(CHEVRON_DOWN_SVG, size, useIconColor(color))\n}\n\nexport function FigmaSwapIcon({ size = 16, color }: IconProps) {\n return renderIcon(SWAP_SVG, size, useIconColor(color))\n}\n\nexport function FigmaCheckIcon({ size = 16, color }: IconProps) {\n return renderIcon(CHECK_SVG, size, useIconColor(color))\n}\n\nconst INFO_CIRCLE_SVG =\n '<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10 9.16667V13.3333M10 6.66667H10.0083M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\n\nexport function FigmaInfoCircleIcon({ size = 20, color }: IconProps) {\n return renderIcon(INFO_CIRCLE_SVG, size, useIconColor(color))\n}\n\n// Just the \"+\" stroke from the Add money Crypto-row overflow chip (Figma\n// list-item `plus.svg`). The source asset bakes in a #F9F9F9 circle, but the\n// SourceTokenCluster pill already draws the themed `bgSecondary` circle, so we\n// keep only the glyph and let it inherit the theme via `currentColor` \u2014 drawn\n// as geometry it centers cleanly where the text \"+\" did not.\nconst PLUS_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M8.20833 5V11.4167M5 8.20833H11.4167\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\n\nexport function FigmaPlusIcon({ size = 16, color }: IconProps) {\n return renderIcon(PLUS_SVG, size, useIconColor(color))\n}\n\n// The export is a 13.5 glyph centered in a 16 box, so the translate reproduces\n// the padding the design gives it rather than filling the icon slot.\nconst SEARCH_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><g transform=\"translate(1.25 1.25)\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.75 0C2.57436 0 0 2.57436 0 5.75C0 8.92564 2.57436 11.5 5.75 11.5C7.06745 11.5 8.28141 11.0569 9.25101 10.3117L12.2197 13.2803C12.5126 13.5732 12.9874 13.5732 13.2803 13.2803C13.5732 12.9874 13.5732 12.5126 13.2803 12.2197L10.3117 9.25101C11.0569 8.28141 11.5 7.06745 11.5 5.75C11.5 2.57436 8.92564 0 5.75 0ZM1.5 5.75C1.5 3.40279 3.40279 1.5 5.75 1.5C8.09721 1.5 10 3.40279 10 5.75C10 8.09721 8.09721 10 5.75 10C3.40279 10 1.5 8.09721 1.5 5.75Z\" fill=\"currentColor\"/></g></svg>'\n\nexport function FigmaSearchIcon({ size = 16, color }: IconProps) {\n return renderIcon(SEARCH_SVG, size, useIconColor(color))\n}\n\nconst ALERT_CIRCLE_SVG =\n '<svg width=\"20\" height=\"20\" viewBox=\"0 0 22.21 22.19\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11.0993 22.1908C9.5667 22.1908 8.1308 21.9008 6.7916 21.3207C5.4524 20.7478 4.2744 19.9529 3.2575 18.9359C2.2405 17.919 1.442 16.741 0.862 15.4018C0.289 14.0626 0.0026 12.6267 0.0026 11.0941C0.0026 9.5616 0.289 8.1257 0.862 6.7865C1.442 5.4402 2.2405 4.2621 3.2575 3.2523C4.2744 2.2354 5.4524 1.4405 6.7916 0.8676C8.1308 0.2875 9.5667 -0.0025 11.0993 -0.0025C12.6318 -0.0025 14.0677 0.2875 15.4069 0.8676C16.7532 1.4405 17.9349 2.2354 18.9518 3.2523C19.9687 4.2621 20.7636 5.4402 21.3366 6.7865C21.9166 8.1257 22.2067 9.5616 22.2067 11.0941C22.2067 12.6267 21.9166 14.0626 21.3366 15.4018C20.7636 16.741 19.9687 17.919 18.9518 18.9359C17.9349 19.9529 16.7532 20.7478 15.4069 21.3207C14.0677 21.9008 12.6318 22.1908 11.0993 22.1908ZM11.11 12.9525C11.7474 12.9525 12.0732 12.6195 12.0875 11.9535L12.2594 6.5609C12.2737 6.2315 12.1699 5.963 11.9479 5.7553C11.7259 5.5404 11.443 5.433 11.0993 5.433C10.7483 5.433 10.4655 5.5404 10.2506 5.7553C10.0358 5.963 9.9355 6.2279 9.9498 6.5502L10.1002 11.9643C10.1217 12.6231 10.4583 12.9525 11.11 12.9525ZM11.11 16.6479C11.4681 16.6479 11.776 16.5333 12.0338 16.3041C12.2916 16.0749 12.4205 15.7813 12.4205 15.4232C12.4205 15.0723 12.2916 14.7787 12.0338 14.5424C11.776 14.3061 11.4681 14.1879 11.11 14.1879C10.7448 14.1879 10.4332 14.3061 10.1754 14.5424C9.9176 14.7787 9.7887 15.0723 9.7887 15.4232C9.7887 15.7813 9.9176 16.0749 10.1754 16.3041C10.4404 16.5333 10.7519 16.6479 11.11 16.6479Z\" fill=\"currentColor\"/></svg>'\n\nexport function FigmaAlertCircleIcon({ size = 22, color }: IconProps) {\n return renderIcon(ALERT_CIRCLE_SVG, size, useIconColor(color))\n}\n", "import type { ViewStyle } from 'react-native'\n\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { FALLBACK_ASSET_LOGO } from './assetLogos'\nimport { FigmaPlusIcon } from './FigmaSystemIcons'\nimport { FunIcon } from './FunIcon'\nimport { chainIconUri } from './funIconUri'\n\n/**\n * The crypto-row trailing avatar stack (Figma: Add money `list-item/base` \u2192\n * `trailing` \u2192 `crypto2`). A short row of supported source-asset logos \u2014\n * 16px thin-bordered circles \u2014 followed by a \"+N\" pill counting the rest, e.g.\n * `\u25C7 \u25CE \u2B21 \u2296 +7`. Logos resolve from CDN chain keys so the package stays\n * asset-free.\n */\nexport interface SourceTokenClusterProps {\n /**\n * Logos to show \u2014 either CDN chain **keys** (e.g. `['ethereum', 'base', \u2026]`)\n * or full image **URLs** (e.g. `@funkit/chains` `iconUrl`s); each entry is\n * resolved independently. The first `maxVisible` render as logos; the rest\n * collapse into the \"+N\" pill.\n */\n icons: string[]\n /** Logos shown before collapsing the rest into \"+N\". Defaults to 4 (Figma). */\n maxVisible?: number\n /** Logo diameter in px. Defaults to 16 (Add money row); 20 on Transfer. */\n size?: number\n /** Gap between chips. Figma: 2 on the Add money row, 4 on Transfer. */\n gap?: number\n /**\n * Overflow chip style. `'count'` (default) shows \"+N\" with the remaining count\n * in a `pillPressed` circle (Transfer deposit row, Figma `tap-target`).\n * `'plus'` shows a bare \"+\" glyph in a `bgSecondary` circle regardless of count\n * (Add money Crypto row, Figma `crypto2`).\n */\n overflowMode?: 'count' | 'plus'\n}\n\n/** A full URL is used as-is; anything else is treated as a CDN chain key. */\nfunction toIconUri(icon: string): string {\n return icon.startsWith('http') ? icon : chainIconUri(icon)\n}\n\nexport function SourceTokenCluster({\n icons,\n maxVisible = 4,\n size = 16,\n gap = 2,\n overflowMode = 'count',\n}: SourceTokenClusterProps) {\n const theme = useTheme()\n const visible = icons.slice(0, maxVisible)\n const overflow = icons.length - visible.length\n return (\n <Box flexDirection=\"row\" alignItems=\"center\" style={{ gap }}>\n {visible.map((icon) => (\n <Box\n key={icon}\n style={[\n iconRing(size),\n { backgroundColor: theme.background.secondary },\n ]}\n >\n <FunIcon\n uri={toIconUri(icon)}\n size={size}\n fallbackUri={FALLBACK_ASSET_LOGO}\n />\n </Box>\n ))}\n {overflow > 0 ? (\n // Both chips are a fixed `size`\u00D7`size` circle (Figma). The \"+\" glyph sits\n // on `bgSecondary` (Add money `crypto2`); the \"+N\" count on `pillPressed`\n // (Transfer `tap-target`).\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[\n overflowCircle(size),\n {\n backgroundColor:\n overflowMode === 'plus'\n ? theme.background.secondary\n : theme.background.pill.pressed,\n },\n ]}\n >\n {overflowMode === 'plus' ? (\n // The geometric \"+\" glyph centers cleanly; the text \"+\" did not.\n <FigmaPlusIcon\n size={size}\n color={theme.content.elements.secondary}\n />\n ) : (\n <Text\n variant=\"bodyMedium\"\n style={[\n overflowText(size),\n { color: theme.content.elements.secondary },\n ]}\n >\n {`+${overflow}`}\n </Text>\n )}\n </Box>\n ) : null}\n </Box>\n )\n}\n\n// A logo in a circle with the Figma `border/icon` hairline. `overflow: hidden`\n// clips the CDN logo to the circle so the border reads cleanly.\nconst iconRing = (size: number): ViewStyle => ({\n width: size,\n height: size,\n borderRadius: 999,\n borderWidth: 1,\n borderColor: 'rgba(0,0,0,0.1)',\n overflow: 'hidden',\n // Center the same-size FunIcon so the border-box hairline doesn't push it 1px\n // off and clip the bottom-right; it fills the circle with the border on edge.\n alignItems: 'center',\n justifyContent: 'center',\n})\n// Both overflow chips are a fixed `size`\u00D7`size` circle (Figma) \u2014 no horizontal\n// padding (which made the single-glyph \"+\" read as an oval).\nconst overflowCircle = (size: number): ViewStyle => ({\n width: size,\n height: size,\n borderRadius: 999,\n})\n// \"+N\" count text: Inter-Medium (via `bodyMedium`) at ~0.6\u00D7 the chip, tracking\n// -0.48 per the Figma `tap-target` (`+4`).\nconst overflowText = (size: number) =>\n ({\n fontSize: Math.round(size * 0.6),\n letterSpacing: -0.48,\n }) as const\n", "import type { ViewStyle } from 'react-native'\n\nimport { Box, useTheme } from '../theme/restyle'\nimport { FALLBACK_ASSET_LOGO } from './assetLogos'\nimport { FunIcon } from './FunIcon'\nimport { chainIconUri, tokenLogoUri } from './funIconUri'\n\n/**\n * A token logo with a small chain badge overlaid bottom-right (Figma: the\n * `icon/crypto` avatar) \u2014 the RN analogue of web's `FunAssetAvatar`. The token\n * icon resolves from `iconSrc` (direct URL, matching web's\n * `DynamicTargetAssetCandidate.iconSrc`) or falls back to CDN via `symbol`\n * ({@link tokenLogoUri}). The badge resolves by CDN chain key. Omit `chainKey`\n * to render the token logo alone.\n */\nexport interface TokenChainIconProps {\n /** Token symbol \u2192 CDN token logo fallback, e.g. `\"USDG\"`. */\n symbol: string\n /** Direct URL for the token icon \u2014 preferred over CDN `symbol` lookup. */\n iconSrc?: string\n /** CDN chain key for the badge overlay, e.g. `\"ethereum\"`. Omit to hide it. */\n chainKey?: string\n /**\n * Direct URL for the badge \u2014 preferred over `chainKey`, and the way to badge\n * by chain id, whose logo comes from `@funkit/chains` rather than the CDN key.\n */\n chainIconSrc?: string\n size?: number\n}\n\nexport function TokenChainIcon({\n symbol,\n iconSrc,\n chainKey,\n chainIconSrc,\n size = 24,\n}: TokenChainIconProps) {\n const theme = useTheme()\n const badge = Math.round(size * 0.5)\n const badgeUri =\n chainIconSrc ?? (chainKey ? chainIconUri(chainKey) : undefined)\n return (\n <Box width={size} height={size}>\n <FunIcon\n uri={iconSrc ?? tokenLogoUri(symbol)}\n size={size}\n fallbackUri={FALLBACK_ASSET_LOGO}\n />\n {badgeUri ? (\n <Box\n borderRadius=\"rounded\"\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[\n badgeRing(badge),\n { backgroundColor: theme.background.modal },\n ]}\n >\n <FunIcon\n uri={badgeUri}\n size={badge}\n fallbackUri={FALLBACK_ASSET_LOGO}\n />\n </Box>\n ) : null}\n </Box>\n )\n}\n\nconst badgeRing = (badge: number): ViewStyle => ({\n position: 'absolute',\n right: -1,\n bottom: -1,\n width: badge + 2,\n height: badge + 2,\n})\n", "import { Linking, Pressable, StyleSheet } from 'react-native'\n\nimport { StatusIcon } from '../icons/StatusIcon'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\nconst FUN_REGIONAL_RESTRICTIONS_URL =\n 'https://intercom.help/funxyz/en/articles/9827689-regional-restrictions'\n\nexport function CheckoutBlockedScreen() {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={{ backgroundColor: theme.background.modal }}\n >\n <Box alignItems=\"center\" style={styles.topBar}>\n <Box\n style={[\n styles.grabber,\n { backgroundColor: theme.border.elements.default.color },\n ]}\n />\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {t('selectMethod.title')}\n </Text>\n </Box>\n\n <Box alignItems=\"center\" justifyContent=\"center\" style={styles.content}>\n <StatusIcon />\n <Box alignItems=\"center\" style={styles.textGroup}>\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {t('checkoutBlocked.notAvailable')}\n </Text>\n <Box alignItems=\"center\">\n <Text\n variant=\"detail\"\n style={[\n styles.descriptionText,\n { color: theme.content.elements.secondary },\n ]}\n >\n {t('checkoutBlocked.regionMessage')}\n </Text>\n <Pressable\n onPress={() => Linking.openURL(FUN_REGIONAL_RESTRICTIONS_URL)}\n >\n <Text\n variant=\"detail\"\n style={[\n styles.linkText,\n { color: theme.content.elements.secondary },\n ]}\n >\n {t('checkoutBlocked.viewRegions')}\n </Text>\n </Pressable>\n </Box>\n </Box>\n </Box>\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n topBar: { height: 64, paddingTop: 25, paddingBottom: 12 },\n grabber: {\n position: 'absolute',\n top: 8,\n width: 36,\n height: 5,\n borderRadius: 999,\n },\n content: {\n height: 390,\n gap: 24,\n paddingHorizontal: 16,\n paddingBottom: 34,\n },\n textGroup: { gap: 8 },\n descriptionText: { textAlign: 'center' },\n linkText: { textAlign: 'center', textDecorationLine: 'underline' },\n})\n", "import { StyleSheet } from 'react-native'\n\nimport { Box, useTheme } from '../theme/restyle'\nimport { FigmaAlertCircleIcon } from './FigmaSystemIcons'\n\n// Shared status circle (Figma: Fun Mobile `status-icon`) for the geo-blocked\n// and unavailable/error screens.\nexport function StatusIcon() {\n const theme = useTheme()\n return (\n <Box\n borderRadius=\"rounded\"\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[styles.circle, { backgroundColor: theme.background.secondary }]}\n >\n <FigmaAlertCircleIcon\n size={20}\n color={theme.content.button.icon.default}\n />\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n circle: { width: 48, height: 48 },\n})\n", "import { type ReactNode, useEffect, useRef, useState } from 'react'\nimport { Pressable, type TextStyle, type ViewStyle } from 'react-native'\n\nimport { Grabber } from '../components/Grabber'\nimport { useScreenSize } from '../hooks/useScreenSize'\nimport { CopyAddressIcon } from '../icons/CopyAddressIcon'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\n/**\n * The deposit QR-code screen (Figma: Fun Mobile / qr-code-modal, node\n * 11636:2663). Presented as a nested bottom sheet: a centered \"QR Code\"\n * title (no close button), the framed QR with the selected network's chain\n * logos overlaid in its center, the full deposit address with a\n * \"Copy address\" button, and a \"Done\" primary button that dismisses the sheet.\n *\n * Vertical padding adapts to screen height via {@link useScreenSize} so the\n * sheet doesn't overflow on compact devices (iPhone SE).\n *\n * The scannable QR itself is host-supplied (`qrCode`, e.g.\n * `react-native-qrcode-svg`) so the package stays `react-native-svg`-free;\n * this screen renders the themed frame and the centered chain-logo overlay.\n */\nexport interface QrCodeScreenProps {\n /** The rendered QR code node (host-supplied). */\n qrCode: ReactNode\n /**\n * Chain logos centered on the QR \u2014 the selected network's icons (see\n * {@link QrChainCluster}). Omit to render the QR with no center overlay.\n */\n centerIcon?: ReactNode\n /** The full deposit address shown (wrapping) below the QR. */\n address?: string\n /** How long the \"Copied\" confirmation stays on the Copy button (ms). */\n copiedFeedbackMs?: number\n onClose?: () => void\n /**\n * Copy the full address to the clipboard. Omit to hide the Copy button.\n * May return whether the copy succeeded; when it resolves `false` the\n * \"Copied!\" confirmation is suppressed (a `void` return is treated as\n * success).\n */\n onCopyAddress?: () => void | Promise<boolean>\n}\n\nexport function QrCodeScreen(props: QrCodeScreenProps) {\n const { t } = useFunkitTranslation()\n const {\n qrCode,\n centerIcon,\n address,\n copiedFeedbackMs = 1800,\n onClose,\n onCopyAddress,\n } = props\n const doneLabel = t('common.done')\n const { isShort } = useScreenSize()\n const theme = useTheme()\n\n const [copied, setCopied] = useState(false)\n const copyTimer = useRef<ReturnType<typeof setTimeout>>(undefined)\n\n useEffect(() => () => clearTimeout(copyTimer.current), [])\n\n const handleCopy = async () => {\n // Only confirm \"Copied!\" when the write actually landed: copyToClipboard\n // returns false on its warn-only no-op path (e.g. no clipboard module), so\n // we don't claim success falsely. A void-returning handler is success.\n const ok = await onCopyAddress?.()\n if (ok === false) return\n setCopied(true)\n clearTimeout(copyTimer.current)\n copyTimer.current = setTimeout(() => setCopied(false), copiedFeedbackMs)\n }\n\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={[sheet, { backgroundColor: theme.background.modal }]}\n >\n {/* Top bar: grabber \u00B7 centered title (no back/close in this variant) */}\n <Box alignItems=\"center\" style={topBar}>\n <Grabber />\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {t('qrCode.title')}\n </Text>\n </Box>\n <Box style={{ paddingVertical: isShort ? 0 : 16 }}>\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[content, { paddingVertical: isShort ? 24 : 82 }]}\n >\n <Box\n borderWidth={1.5}\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[\n qrFrame,\n {\n backgroundColor: theme.background.modal,\n borderColor: theme.border.elements.default.color,\n },\n ]}\n >\n {qrCode}\n {centerIcon ? (\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n style={centerOverlay}\n >\n {centerIcon}\n </Box>\n ) : null}\n </Box>\n\n {address ? (\n <Box alignItems=\"center\" style={addressGroup}>\n <Text\n variant=\"body\"\n style={[\n addressText,\n { color: theme.content.elements.secondary },\n ]}\n >\n {address}\n </Text>\n {onCopyAddress ? (\n <Pressable\n onPress={handleCopy}\n accessibilityRole=\"button\"\n accessibilityLabel={\n copied ? t('common.addressCopied') : t('common.copyAddress')\n }\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n borderWidth={1}\n borderRadius=\"element\"\n style={[\n copyButton,\n {\n backgroundColor:\n theme.background.button.secondary.default,\n borderColor: theme.background.button.secondary.default,\n },\n ]}\n >\n <CopyAddressIcon />\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.button.secondary.default }}\n >\n {copied ? t('common.copied') : t('common.copyAddress')}\n </Text>\n </Box>\n </Pressable>\n ) : null}\n </Box>\n ) : null}\n </Box>\n\n <Box style={buttonContainer}>\n <Pressable\n onPress={onClose}\n accessibilityRole=\"button\"\n accessibilityLabel={doneLabel}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius=\"button\"\n style={[\n doneButton,\n { backgroundColor: theme.background.button.primary.default },\n ]}\n >\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.button.primary.default }}\n >\n {doneLabel}\n </Text>\n </Box>\n </Pressable>\n </Box>\n </Box>\n </Box>\n )\n}\n\nconst sheet: ViewStyle = { paddingBottom: 34 }\nconst topBar: ViewStyle = {\n height: 64,\n paddingTop: 25,\n paddingBottom: 12,\n paddingHorizontal: 24,\n}\n// QR card and address group share a 40px gap (Figma `content`).\nconst content: ViewStyle = {\n paddingHorizontal: 20,\n gap: 40,\n}\nconst qrFrame: ViewStyle = {\n width: 275,\n height: 275,\n borderRadius: 20,\n padding: 18,\n // Figma shadow/md: a soft lift under the card.\n shadowColor: '#000',\n shadowOpacity: 0.1,\n shadowOffset: { width: 0, height: 4 },\n shadowRadius: 16,\n elevation: 3,\n}\nconst centerOverlay: ViewStyle = {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n pointerEvents: 'none',\n}\nconst addressGroup: ViewStyle = { gap: 16 }\n// Constrained so the 42-char address wraps to two centered lines (Figma).\nconst addressText: TextStyle = { textAlign: 'center', maxWidth: 220 }\nconst copyButton: ViewStyle = {\n height: 48,\n paddingHorizontal: 20,\n gap: 8,\n}\nconst buttonContainer: ViewStyle = { paddingHorizontal: 20 }\nconst doneButton: ViewStyle = { height: 56, paddingHorizontal: 24 }\n", "import { StyleSheet } from 'react-native'\n\nimport { Box, useTheme } from '../theme/restyle'\n\n/**\n * The bottom-sheet drag affordance. Absolutely positioned so each top bar lays\n * out its own content independently. Sheets rendering this must pass\n * `handleComponent={null}` to gorhom, or its default handle draws a second\n * grabber above it.\n */\nexport function Grabber() {\n const theme = useTheme()\n return (\n <Box\n testID=\"grabber\"\n alignItems=\"center\"\n pointerEvents=\"none\"\n style={styles.overlay}\n >\n <Box\n style={[\n styles.bar,\n { backgroundColor: theme.border.elements.default.color },\n ]}\n />\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n overlay: { position: 'absolute', top: 8, left: 0, right: 0 },\n bar: { width: 36, height: 5, borderRadius: 999 },\n})\n", "import { useWindowDimensions } from 'react-native'\n\nexport function useScreenSize() {\n const { height } = useWindowDimensions()\n\n // Add additional breakpoints as needed (e.g. isTall).\n const isShort = height < 700\n\n return { isShort }\n}\n", "import { SvgXml } from 'react-native-svg'\n\nimport { useTheme } from '../theme/restyle'\n\n// Verbatim port of web's `CopyDoubleRoundedSquareIcon`\n// (`packages/connect/src/components/Icons/CopyDoubleRoundedSquareIcon.tsx`) \u2014\n// two overlapping rounded squares. Kept as inline SVG (rendered via `SvgXml`,\n// like the other connect-rn glyphs) so the package stays asset-free.\n// `stroke=\"currentColor\"` is resolved by the `color` prop below, so the glyph\n// tracks the secondary-button label color.\nconst COPY_ADDRESS_SVG = `<svg viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10.2 5.8V4.26C10.2 3.64394 10.2 3.33591 10.0801 3.10061C9.97465 2.89363 9.80637 2.72535 9.59939 2.61989C9.36409 2.5 9.05606 2.5 8.44 2.5H4.26C3.64394 2.5 3.33591 2.5 3.10061 2.61989C2.89363 2.72535 2.72535 2.89363 2.61989 3.10061C2.5 3.33591 2.5 3.64394 2.5 4.26V8.44C2.5 9.05606 2.5 9.36409 2.61989 9.59939C2.72535 9.80637 2.89363 9.97465 3.10061 10.0801C3.33591 10.2 3.64394 10.2 4.26 10.2H5.8M7.56 13.5H11.74C12.3561 13.5 12.6641 13.5 12.8994 13.3801C13.1064 13.2746 13.2746 13.1064 13.3801 12.8994C13.5 12.6641 13.5 12.3561 13.5 11.74V7.56C13.5 6.94394 13.5 6.63591 13.3801 6.40061C13.2746 6.19363 13.1064 6.02535 12.8994 5.91989C12.6641 5.8 12.3561 5.8 11.74 5.8H7.56C6.94394 5.8 6.63591 5.8 6.40061 5.91989C6.19363 6.02535 6.02535 6.19363 5.91989 6.40061C5.8 6.63591 5.8 6.94394 5.8 7.56V11.74C5.8 12.3561 5.8 12.6641 5.91989 12.8994C6.02535 13.1064 6.19363 13.2746 6.40061 13.3801C6.63591 13.5 6.94394 13.5 7.56 13.5Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>`\n\n/**\n * The \"Copy address\" button glyph \u2014 the RN port of web's\n * `CopyDoubleRoundedSquareIcon`. Renders in the theme's secondary-button label\n * color so it matches the button text.\n */\nexport function CopyAddressIcon({ size = 16 }: { size?: number }) {\n const theme = useTheme()\n return (\n <SvgXml\n xml={COPY_ADDRESS_SVG}\n width={size}\n height={size}\n color={theme.content.button.secondary.default}\n />\n )\n}\n", "import { BottomSheetScrollView } from '@gorhom/bottom-sheet'\nimport type { ReactNode } from 'react'\nimport { Pressable, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { Grabber } from '../components/Grabber'\nimport { ScrollFade, useScrollEdgeFades } from '../components/ScrollFade'\nimport { useNestedSheetHeight } from '../hooks/useNestedSheetHeight'\nimport { ChainAvatar } from '../icons/ChainAvatar'\nimport { FigmaCheckIcon, FigmaChevronLeftIcon } from '../icons/FigmaSystemIcons'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport type { AvailableChain } from '../transfer/availableChains'\n\ninterface ChainListProps {\n chains: AvailableChain[]\n /** Marks a row selected: `background/secondary` fill + a trailing check. */\n selectedChain?: AvailableChain\n onSelectChain?: (chain: AvailableChain) => void\n loading?: boolean\n skeletonCount?: number\n}\n\n/**\n * The \"Deposit crypto\" chain picker \u2014 the first-run variant, shown before the\n * user has chosen a deposit network.\n */\nexport interface SelectChainScreenProps extends ChainListProps {\n onBack?: () => void\n}\n\nexport function SelectChainScreen(props: SelectChainScreenProps) {\n const { t } = useFunkitTranslation()\n const { onBack, ...chainList } = props\n const theme = useTheme()\n const insets = useSafeAreaInsets()\n const sheetHeight = useNestedSheetHeight()\n\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={{\n height: sheetHeight,\n backgroundColor: theme.background.modal,\n paddingBottom: bottomInset(insets.bottom),\n }}\n >\n <Box style={styles.backTopBar}>\n <Grabber />\n <Pressable\n onPress={onBack}\n hitSlop={8}\n accessibilityRole=\"button\"\n accessibilityLabel={t('common.back')}\n style={styles.backPress}\n >\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[\n styles.backButton,\n {\n backgroundColor: theme.background.secondary,\n borderColor: theme.border.elements.default.color,\n },\n ]}\n >\n <FigmaChevronLeftIcon\n size={24}\n color={theme.content.button.icon.default}\n />\n </Box>\n </Pressable>\n </Box>\n\n <ChainList\n {...chainList}\n header={\n <Box style={styles.titleBlock}>\n <Text\n variant=\"bodyMedium\"\n style={[\n styles.titleText,\n { color: theme.content.elements.primary },\n ]}\n >\n {t('selectChain.title')}\n </Text>\n <Text\n variant=\"body\"\n style={{ color: theme.content.elements.secondary }}\n >\n {t('selectChain.subtitle')}\n </Text>\n </Box>\n }\n />\n </Box>\n )\n}\n\n/**\n * The \"Select a chain\" picker \u2014 the same list reopened from Transfer to change\n * networks. Cancel dismisses; the current chain is checked.\n */\nexport interface ChangeChainScreenProps extends ChainListProps {\n onCancel?: () => void\n}\n\nexport function ChangeChainScreen(props: ChangeChainScreenProps) {\n const { t } = useFunkitTranslation()\n const { onCancel, ...chainList } = props\n const theme = useTheme()\n const insets = useSafeAreaInsets()\n const sheetHeight = useNestedSheetHeight()\n const cancelLabel = t('common.cancel')\n\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={{\n height: sheetHeight,\n backgroundColor: theme.background.modal,\n paddingBottom: bottomInset(insets.bottom),\n }}\n >\n <Box alignItems=\"center\" style={styles.titleTopBar}>\n <Grabber />\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {t('changeChain.title')}\n </Text>\n </Box>\n\n <ChainList {...chainList} />\n\n <Box style={styles.buttonContainer}>\n <Pressable\n onPress={onCancel}\n accessibilityRole=\"button\"\n accessibilityLabel={cancelLabel}\n >\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius=\"button\"\n style={[\n styles.cancelButton,\n { backgroundColor: theme.background.button.primary.default },\n ]}\n >\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.button.primary.default }}\n >\n {cancelLabel}\n </Text>\n </Box>\n </Pressable>\n </Box>\n </Box>\n )\n}\n\n/** The scrollable chain rows shared by both pickers. */\nfunction ChainList({\n chains,\n selectedChain,\n onSelectChain,\n loading = false,\n skeletonCount = 8,\n header,\n}: ChainListProps & { header?: ReactNode }) {\n const theme = useTheme()\n const { showTopFade, showBottomFade, scrollProps } = useScrollEdgeFades()\n\n return (\n <View style={styles.scrollArea}>\n <BottomSheetScrollView\n style={styles.list}\n showsVerticalScrollIndicator={false}\n contentContainerStyle={styles.listContent}\n {...scrollProps}\n >\n {header}\n {loading\n ? Array.from({ length: skeletonCount }, (_, index) => (\n <ChainRowSkeleton key={index} />\n ))\n : chains.map((chain) => (\n <ChainRow\n key={chain.id}\n chain={chain}\n selected={chain.id === selectedChain?.id}\n onPress={onSelectChain}\n />\n ))}\n </BottomSheetScrollView>\n {showTopFade ? (\n <ScrollFade edge=\"top\" color={theme.background.modal} id=\"chain-list\" />\n ) : null}\n {showBottomFade ? (\n <ScrollFade\n edge=\"bottom\"\n color={theme.background.modal}\n id=\"chain-list\"\n />\n ) : null}\n </View>\n )\n}\n\nfunction ChainRow({\n chain,\n selected,\n onPress,\n}: {\n chain: AvailableChain\n selected: boolean\n onPress?: (chain: AvailableChain) => void\n}) {\n const theme = useTheme()\n return (\n <Pressable\n onPress={() => onPress?.(chain)}\n accessibilityRole=\"button\"\n accessibilityLabel={chain.name}\n accessibilityState={{ selected }}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n borderRadius=\"element\"\n style={[\n styles.row,\n selected ? { backgroundColor: theme.background.secondary } : null,\n ]}\n >\n <ChainAvatar uri={chain.iconUri} />\n <Box flex={1}>\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n style={{ color: theme.content.elements.primary }}\n >\n {chain.name}\n </Text>\n </Box>\n {selected ? (\n <FigmaCheckIcon size={20} color={theme.content.elements.secondary} />\n ) : null}\n </Box>\n </Pressable>\n )\n}\n\nfunction ChainRowSkeleton() {\n const theme = useTheme()\n return (\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.row}>\n <Box\n style={[\n styles.skeletonIcon,\n { backgroundColor: theme.background.pill.pressed },\n ]}\n />\n <Box flex={1}>\n <Box\n style={[\n styles.skeletonName,\n { backgroundColor: theme.background.pill.pressed },\n ]}\n />\n </Box>\n </Box>\n )\n}\n\n// Devices without a home indicator report a 0 bottom inset, which would leave\n// the cancel button flush against the screen edge.\nconst MIN_BOTTOM_INSET = 16\nconst bottomInset = (inset: number) => Math.max(inset, MIN_BOTTOM_INSET)\n\nconst styles = StyleSheet.create({\n backTopBar: { paddingHorizontal: 20, paddingTop: 20, paddingBottom: 12 },\n backPress: { alignSelf: 'flex-start' },\n // A white fill on the white sheet reads as nothing on device, so the circle\n // takes the secondary surface + hairline.\n backButton: {\n width: 48,\n height: 48,\n borderRadius: 999,\n borderWidth: 1,\n shadowColor: '#000',\n shadowOpacity: 0.05,\n shadowOffset: { width: 0, height: 4 },\n shadowRadius: 8,\n elevation: 2,\n },\n // Same geometry as the Add money sheet.\n titleTopBar: { height: 64, paddingTop: 25, paddingBottom: 12 },\n // Inside the list's 16 inset, so 12 more lines it up with the row text.\n titleBlock: {\n paddingHorizontal: 12,\n paddingTop: 12,\n paddingBottom: 24,\n gap: 2,\n },\n // No theme variant for 21/25; the medium cut rides on `bodyMedium` because an\n // inline fontWeight can't select a custom font's cut in RN/Expo.\n titleText: { fontSize: 21, lineHeight: 25 },\n scrollArea: { flex: 1, position: 'relative' },\n list: { flex: 1, width: '100%' },\n // The trailing buffer keeps the last row clear of the sheet edge.\n listContent: { paddingHorizontal: 16, paddingBottom: 16 },\n row: { gap: 12, paddingHorizontal: 12, paddingVertical: 10 },\n buttonContainer: { paddingHorizontal: 20, paddingTop: 8 },\n cancelButton: { height: 56, paddingHorizontal: 24 },\n skeletonIcon: { width: 36, height: 36, borderRadius: 999 },\n skeletonName: { width: 157, height: 16, borderRadius: 4 },\n})\n", "import { useRef, useState } from 'react'\nimport type {\n LayoutChangeEvent,\n NativeScrollEvent,\n NativeSyntheticEvent,\n} from 'react-native'\nimport { StyleSheet, View } from 'react-native'\nimport Svg, { Defs, LinearGradient, Rect, Stop } from 'react-native-svg'\n\n// Height of the full-width edge gradient.\nconst SCROLL_FADE_HEIGHT = 42\n\n// Keeps sub-pixel offsets from flipping a fade on/off at the very top/bottom.\nconst SCROLL_EPSILON = 1\n\n/**\n * Fades a scrolling list into the modal surface at one edge. Uses\n * react-native-svg since RN has no CSS gradient. Pair with\n * `useScrollEdgeFades` to decide when each edge shows.\n */\nexport function ScrollFade({\n edge,\n color,\n id,\n}: {\n edge: 'top' | 'bottom'\n color: string\n /** Gradient id prefix \u2014 must be unique per screen on one mounted tree. */\n id: string\n}) {\n const gradientId = `${id}-fade-${edge}`\n const topOpaque = edge === 'top'\n return (\n <View\n pointerEvents=\"none\"\n style={[styles.fade, edge === 'top' ? { top: 0 } : { bottom: 0 }]}\n >\n <Svg width=\"100%\" height=\"100%\">\n <Defs>\n <LinearGradient id={gradientId} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <Stop\n offset=\"0\"\n stopColor={color}\n stopOpacity={topOpaque ? 1 : 0}\n />\n <Stop\n offset=\"1\"\n stopColor={color}\n stopOpacity={topOpaque ? 0 : 1}\n />\n </LinearGradient>\n </Defs>\n <Rect\n x=\"0\"\n y=\"0\"\n width=\"100%\"\n height=\"100%\"\n fill={`url(#${gradientId})`}\n />\n </Svg>\n </View>\n )\n}\n\n/**\n * Tracks which edges of a `ScrollView` still have content beyond them, for\n * `ScrollFade`. Spread `scrollProps` onto the `ScrollView`.\n */\nexport function useScrollEdgeFades() {\n const [showTopFade, setShowTopFade] = useState(false)\n const [showBottomFade, setShowBottomFade] = useState(false)\n const metrics = useRef({ scrollY: 0, viewportH: 0, contentH: 0 })\n\n const recomputeFades = () => {\n const { scrollY, viewportH, contentH } = metrics.current\n const overflows = contentH > viewportH + SCROLL_EPSILON\n setShowTopFade(overflows && scrollY > SCROLL_EPSILON)\n setShowBottomFade(\n overflows && scrollY + viewportH < contentH - SCROLL_EPSILON,\n )\n }\n\n const onScroll = (e: NativeSyntheticEvent<NativeScrollEvent>) => {\n metrics.current.scrollY = e.nativeEvent.contentOffset.y\n recomputeFades()\n }\n const onLayout = (e: LayoutChangeEvent) => {\n metrics.current.viewportH = e.nativeEvent.layout.height\n recomputeFades()\n }\n const onContentSizeChange = (_w: number, h: number) => {\n metrics.current.contentH = h\n // A shorter replacement list can clamp the native offset without firing\n // onScroll, so re-clamp scrollY to the new max or the bottom fade may hide\n // while the list still overflows.\n metrics.current.scrollY = Math.min(\n metrics.current.scrollY,\n Math.max(0, h - metrics.current.viewportH),\n )\n recomputeFades()\n }\n\n return {\n showTopFade,\n showBottomFade,\n scrollProps: { onScroll, onLayout, onContentSizeChange },\n }\n}\n\nconst styles = StyleSheet.create({\n fade: {\n position: 'absolute',\n left: 0,\n right: 0,\n height: SCROLL_FADE_HEIGHT,\n },\n})\n", "import { useWindowDimensions } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\n/**\n * Fills a nested sheet \u2014 the same `insets.top` its `BottomSheetModal` is capped\n * by, so the screen and the sheet can't drift apart. A `FlowSheet` step waives\n * that cap (`topInset={0}`) and takes the whole window instead.\n */\nexport function useNestedSheetHeight() {\n const { height } = useWindowDimensions()\n const insets = useSafeAreaInsets()\n return height - insets.top\n}\n", "import { StyleSheet } from 'react-native'\n\nimport { Box } from '../theme/restyle'\nimport { FALLBACK_ASSET_LOGO } from './assetLogos'\nimport { FunIcon } from './FunIcon'\n\nexport interface ChainAvatarProps {\n /** Full CDN logo URL, e.g. `chainIconUri('base')`. */\n uri: string\n size?: number\n}\n\n/**\n * A chain logo clipped to a circle with a hairline border. Centering a same-size\n * {@link FunIcon} keeps it from sitting 1px off, since the border-box hairline\n * shrinks the content box.\n */\nexport function ChainAvatar({ uri, size = 36 }: ChainAvatarProps) {\n return (\n <Box style={[styles.ring, { width: size, height: size }]}>\n <FunIcon uri={uri} size={size} fallbackUri={FALLBACK_ASSET_LOGO} />\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n // `border/icon` has no dark-mode counterpart in the token export, so it isn't\n // in tokens.ts and the hairline stays a literal.\n ring: {\n borderRadius: 999,\n borderWidth: 1,\n borderColor: 'rgba(0,0,0,0.1)',\n overflow: 'hidden',\n alignItems: 'center',\n justifyContent: 'center',\n },\n})\n", "import { type ReactNode, useEffect, useRef, useState } from 'react'\nimport { Animated, Pressable, ScrollView, type ViewStyle } from 'react-native'\n// `Animated` (above) is React Native's legacy API, still used by the loading\n// pulse. The \"Deposit to\" dropdown motion uses `react-native-reanimated`,\n// imported here as `Reanimated` so the two namespaces don't collide.\nimport Reanimated, {\n Easing,\n Keyframe,\n useAnimatedStyle,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated'\n\nimport { FigmaCheckIcon, FigmaChevronDownIcon } from '../icons/FigmaSystemIcons'\nimport { StatusIcon } from '../icons/StatusIcon'\nimport { usePulse } from '../hooks/usePulse'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\n// Motion tokens for the \"Deposit to\" dropdown open/close \u2014 transitions.dev\n// `menu-dropdown` recipe translated to reanimated. The web recipe grows the\n// menu from its trigger (transform-origin top, scale 0.97\u21921, opacity 0\u21921); RN\n// has no transform-origin, so a small translateY (-4\u21920) gives the same\n// \"emerging from the trigger top\" read. Open = Fast (250ms), close = Quick\n// (150ms), Smooth ease-out easing (cubic-bezier(0.22, 1, 0.36, 1)).\nconst DROPDOWN_OPEN_DURATION = 250\nconst DROPDOWN_CLOSE_DURATION = 150\nconst DROPDOWN_EASING = Easing.bezier(0.22, 1, 0.36, 1)\nconst DROPDOWN_PRE_SCALE = 0.97\nconst DROPDOWN_TRANSLATE_Y = -4\n\nconst AnimatedPressable = Reanimated.createAnimatedComponent(Pressable)\n\n// The menu is conditionally rendered (closed = unmounted), so the open/close\n// motion rides reanimated layout animations \u2014 `entering` on mount, `exiting`\n// on unmount \u2014 the same pattern as AddressCopiedToast. Enter grows from the\n// trigger top (opacity + scale 0.97\u21921 + translateY -4\u21920); exit reverses it.\n// Easing lives on the destination keyframe (per reanimated's Keyframe API).\nconst menuEnter = new Keyframe({\n 0: {\n opacity: 0,\n transform: [\n { translateY: DROPDOWN_TRANSLATE_Y },\n { scale: DROPDOWN_PRE_SCALE },\n ],\n },\n 100: {\n opacity: 1,\n transform: [{ translateY: 0 }, { scale: 1 }],\n easing: DROPDOWN_EASING,\n },\n}).duration(DROPDOWN_OPEN_DURATION)\nconst menuExit = new Keyframe({\n 0: {\n opacity: 1,\n transform: [{ translateY: 0 }, { scale: 1 }],\n },\n 100: {\n opacity: 0,\n transform: [\n { translateY: DROPDOWN_TRANSLATE_Y },\n { scale: DROPDOWN_PRE_SCALE },\n ],\n easing: DROPDOWN_EASING,\n },\n}).duration(DROPDOWN_CLOSE_DURATION)\n// The dimming scrim fades in/out (opacity only) in sync with the menu.\nconst scrimEnter = new Keyframe({\n 0: { opacity: 0 },\n 100: { opacity: 1, easing: DROPDOWN_EASING },\n}).duration(DROPDOWN_OPEN_DURATION)\nconst scrimExit = new Keyframe({\n 0: { opacity: 1 },\n 100: { opacity: 0, easing: DROPDOWN_EASING },\n}).duration(DROPDOWN_CLOSE_DURATION)\n\n/**\n * One selectable funding source in {@link SelectMethodScreen}. Brand icons are\n * host-supplied (`icon` / `trailing`) so the package stays asset- and\n * `react-native-svg`-free; the screen renders a themed circular slot for each.\n */\nexport interface PaymentMethodOption {\n /** Stable id passed back to `onSelectMethod`. */\n id: string\n title: string\n /** Secondary line: balance, limit, timing, etc. */\n subtitle?: string\n /** Leading icon, centered in the themed circle. */\n icon?: ReactNode\n /** Trailing accessory, e.g. a token cluster for the Crypto row. */\n trailing?: ReactNode\n /**\n * Shown but not selectable \u2014 e.g. a cash payout whose minimum the balance\n * can't meet. Dimmed rather than hidden so the option stays discoverable.\n */\n disabled?: boolean\n}\n\n/**\n * One option in the \"Deposit to\" receive-token dropdown (Figma: Fun Mobile /\n * Add money). Mirrors web's `ReceiveTokenDropdown` items. The icon is supplied\n * by the flow (keeping this screen asset-free) and `label` is the composed\n * destination text, e.g. `\"USDG (Perps)\"`.\n */\nexport interface ReceiveTokenOption {\n id: string\n label: string\n icon?: ReactNode\n}\n\nexport interface SelectMethodScreenProps {\n methods: PaymentMethodOption[]\n onSelectMethod: (id: string) => void\n /** Sheet title \u2014 the caller owns the copy (\"Add money\" vs \"Withdraw\"). */\n title: string\n /**\n * Receive-token candidates shown in the \"Deposit to\" dropdown above the\n * payment methods (web: `ReceiveTokenDropdown`). When set, the screen shows\n * the dropdown + a \"Pay with\" section label. Omit to render just the\n * methods list (back-compat with hosts that don't pass candidates).\n */\n receiveTokens?: ReceiveTokenOption[]\n selectedReceiveTokenId?: string\n onSelectReceiveToken?: (id: string) => void\n /**\n * Show the loading skeleton instead of the method list (Figma: Fun Mobile /\n * Add money, loading). Set while the funding sources are still being fetched\n * (e.g. the Swapped cash methods) so the list doesn't pop in row-by-row.\n */\n loading?: boolean\n /**\n * Number of skeleton rows rendered while `loading`. Defaults to 5 when the\n * deposit selector shows, 6 otherwise (it reclaims the selector's room).\n */\n skeletonCount?: number\n /**\n * Show the error state instead of the list (Figma: Fun Mobile / Add money,\n * error) \u2014 a \"Something went wrong\" message + a \"Try again\" button. Takes\n * precedence over `loading`. Set when fetching the funding sources failed.\n */\n error?: boolean\n /** \"Try again\" handler shown with the error state. */\n onRetry?: () => void\n /** Error-state copy \u2014 the caller owns it (generic fetch failure vs\n withdraw's terminal states). */\n errorTitle: string\n errorMessage: string\n /**\n * Open the \"Deposit to\" dropdown on mount. For previews/tests of the expanded\n * state (Figma node 11200:8055); hosts leave this `false` and let the user\n * tap the trigger.\n */\n initialDropdownOpen?: boolean\n /**\n * Secondary line under the list, for why part of it is missing (web's\n * `NoCashMethodsNote`). A note, not a takeover: the rows that DID load stay\n * usable.\n */\n note?: string\n}\n\n/**\n * The \"Add money\" funding-source picker (Figma: Fun Mobile / Add money). A\n * bottom-sheet-style surface \u2014 grabber + centered title + a scrollable list of\n * payment methods \u2014 built from the connect-rn Restyle theme so it tracks the\n * active light/dark scheme. Selecting a method (e.g. Crypto) routes the host to\n * the next screen (Transfer/UDA).\n *\n * When `receiveTokens` are given, a fixed \"Deposit to\" selector sits above the\n * scrollable list. Opening it floats the option list as an overlay (it does\n * NOT reflow the list) over a dimming scrim \u2014 matching web's\n * `ReceiveTokenDropdown`.\n */\nexport function SelectMethodScreen(props: SelectMethodScreenProps) {\n const { t } = useFunkitTranslation()\n const {\n methods,\n onSelectMethod,\n title,\n loading = false,\n skeletonCount,\n error = false,\n onRetry,\n note,\n errorTitle,\n errorMessage,\n receiveTokens,\n selectedReceiveTokenId,\n onSelectReceiveToken,\n initialDropdownOpen = false,\n } = props\n const theme = useTheme()\n const selected = receiveTokens?.find((t) => t.id === selectedReceiveTokenId)\n const showDropdown = receiveTokens && receiveTokens.length > 0 && selected\n\n // Dropdown open-state lives here (not in the dropdown) so the screen can lay\n // a dimming scrim over the whole sheet while the option list floats above it.\n const [dropdownOpen, setDropdownOpen] = useState(initialDropdownOpen)\n const scrimVisible = !error && showDropdown && dropdownOpen\n\n // The rows are the same in both layouts; only the chrome around them differs\n // (bordered \"Pay with\" card vs. a bare scrolling list).\n const methodRows = methods.map((method, i) => (\n <Box key={method.id}>\n {i > 0 ? <MethodDivider /> : null}\n <Pressable\n onPress={method.disabled ? undefined : () => onSelectMethod(method.id)}\n disabled={method.disabled}\n accessibilityRole=\"button\"\n accessibilityLabel={method.title}\n accessibilityState={{ disabled: !!method.disabled }}\n style={\n method.disabled\n ? { opacity: theme.opacity.disabled / 100 }\n : undefined\n }\n >\n <PaymentMethodRow method={method} />\n </Pressable>\n </Box>\n ))\n\n // Sits with the rows, inside the same scroll content \u2014 after the list it would\n // be laid out past the sheet's measured height and render outside it.\n const noteText = note ? (\n <Box style={noteBox}>\n <Text\n variant=\"detail\"\n style={{ color: theme.content.elements.secondary }}\n >\n {note}\n </Text>\n </Box>\n ) : null\n\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={{ backgroundColor: theme.background.modal }}\n >\n <Box alignItems=\"center\" style={topBar}>\n <Box\n style={[\n grabber,\n { backgroundColor: theme.border.elements.default.color },\n ]}\n />\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {title}\n </Text>\n </Box>\n\n {error ? (\n <SelectMethodError\n title={errorTitle}\n message={errorMessage}\n onRetry={onRetry}\n />\n ) : loading ? (\n <SelectMethodLoading\n count={skeletonCount}\n showDropdown={Boolean(showDropdown)}\n />\n ) : (\n <>\n {/* Fixed \"Deposit to\" selector. Sits above the scrollable list and\n stays above the scrim (so it reads bright while the rest dims). */}\n {showDropdown ? (\n <Box style={depositSection}>\n <Box style={sectionLabel}>\n <Text\n variant=\"detail\"\n weight=\"medium\"\n style={{ color: theme.content.elements.secondary }}\n >\n {t('selectMethod.depositTo')}\n </Text>\n </Box>\n <ReceiveTokenDropdown\n tokens={receiveTokens}\n selected={selected}\n open={dropdownOpen}\n onToggle={() => setDropdownOpen((o) => !o)}\n onSelect={(id) => {\n onSelectReceiveToken?.(id)\n setDropdownOpen(false)\n }}\n />\n </Box>\n ) : null}\n\n {showDropdown ? (\n // \"Pay with\" section: a labeled, bordered card wrapping the method\n // rows with hairline dividers between them (Figma node 11202:8282).\n <Box style={payWithSection}>\n <Box style={sectionLabel}>\n <Text\n variant=\"detail\"\n weight=\"medium\"\n style={{ color: theme.content.elements.secondary }}\n >\n {t('selectMethod.payWith')}\n </Text>\n </Box>\n <Box\n borderWidth={1}\n borderRadius=\"element\"\n style={[\n methodsCard,\n {\n backgroundColor: theme.background.modal,\n borderColor: theme.border.elements.default.color,\n },\n ]}\n >\n {methodRows}\n </Box>\n {noteText}\n </Box>\n ) : (\n // Methods-only: bare rows with full-width hairline dividers, no\n // outer border (Figma node 11202:8632).\n <ScrollView\n contentContainerStyle={listContent}\n showsVerticalScrollIndicator={false}\n >\n {methodRows}\n {noteText}\n </ScrollView>\n )}\n </>\n )}\n\n {/* Dimming scrim (Figma: background-overlay, rgba(0,0,0,0.2)). Sits below\n the deposit selector + option list but above the rest of the sheet;\n tapping it closes the dropdown. */}\n {scrimVisible ? (\n <AnimatedPressable\n entering={scrimEnter}\n exiting={scrimExit}\n style={scrim}\n onPress={() => setDropdownOpen(false)}\n accessibilityRole=\"button\"\n accessibilityLabel={t('common.close')}\n />\n ) : null}\n </Box>\n )\n}\n\nfunction SelectMethodError({\n title,\n message,\n onRetry,\n}: {\n title: string\n message: string\n onRetry?: () => void\n}) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const retryLabel = t('common.tryAgain')\n return (\n <Box alignItems=\"center\" justifyContent=\"center\" style={errorContainer}>\n <StatusIcon />\n <Box alignItems=\"center\" style={errorText}>\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {title}\n </Text>\n <Text\n variant=\"detail\"\n style={[\n errorMessageText,\n { color: theme.content.elements.secondary },\n ]}\n >\n {message}\n </Text>\n </Box>\n {/* No handler \u2192 non-retryable state (e.g. withdrawals unavailable in\n region): show the message alone instead of a dead button. */}\n {onRetry ? (\n <Pressable\n onPress={onRetry}\n accessibilityRole=\"button\"\n accessibilityLabel={retryLabel}\n >\n <Box\n borderRadius=\"button\"\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[\n retryButton,\n { backgroundColor: theme.background.button.primary.default },\n ]}\n >\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.button.primary.default }}\n >\n {retryLabel}\n </Text>\n </Box>\n </Pressable>\n ) : null}\n </Box>\n )\n}\n\nfunction PaymentMethodRow({ method }: { method: PaymentMethodOption }) {\n const theme = useTheme()\n return (\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n gap=\"elementsHorizontal\"\n style={row}\n >\n <Box width={48} height={48} alignItems=\"center\" justifyContent=\"center\">\n {method.icon}\n </Box>\n <Box flex={1} style={details}>\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {method.title}\n </Text>\n {method.subtitle ? (\n <Text\n variant=\"detail\"\n style={{ color: theme.content.elements.secondary }}\n >\n {method.subtitle}\n </Text>\n ) : null}\n </Box>\n {method.trailing}\n </Box>\n )\n}\n\n/**\n * Hairline divider between method rows (Figma `line-container`, 1px\n * `border/elements/default`), spanning the full row width.\n */\nfunction MethodDivider() {\n const theme = useTheme()\n return (\n <Box\n style={[\n divider,\n { backgroundColor: theme.border.elements.default.color },\n ]}\n />\n )\n}\n\n/**\n * The \"Deposit to\" receive-token dropdown (Figma: Fun Mobile / Add money) \u2014\n * RN analogue of web's `ReceiveTokenDropdown`. A bordered trigger pill\n * (icon + label + chevron); when `open`, the option list floats below it as an\n * absolute overlay (`top: '100%'`) so it never reflows the list underneath.\n * Open-state is controlled by the screen (which also lays the scrim).\n */\nfunction ReceiveTokenDropdown({\n tokens,\n selected,\n open,\n onToggle,\n onSelect,\n}: {\n tokens: ReceiveTokenOption[]\n selected: ReceiveTokenOption\n open: boolean\n onToggle: () => void\n onSelect: (id: string) => void\n}) {\n const theme = useTheme()\n const selectable = tokens.length > 1\n\n return (\n <Box style={dropdownAnchor}>\n <Pressable\n onPress={selectable ? onToggle : undefined}\n accessibilityRole=\"button\"\n accessibilityLabel={selected.label}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n borderWidth={1}\n borderRadius=\"element\"\n style={[\n dropdownTrigger,\n {\n backgroundColor: theme.background.modal,\n borderColor: theme.border.elements.default.color,\n },\n ]}\n >\n <Box flexDirection=\"row\" alignItems=\"center\" style={triggerLeft}>\n {selected.icon ?? <ReceiveTokenIconFallback />}\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n style={[triggerLabel, { color: theme.content.elements.primary }]}\n >\n {selected.label}\n </Text>\n </Box>\n {selectable ? <AnimatedChevron open={open} /> : null}\n </Box>\n </Pressable>\n {open && selectable ? (\n <Reanimated.View\n entering={menuEnter}\n exiting={menuExit}\n style={dropdownMenuOverlay}\n >\n <Box\n borderRadius=\"element\"\n style={[dropdownMenu, { backgroundColor: theme.background.modal }]}\n >\n {tokens.map((token) => (\n <Pressable\n key={token.id}\n onPress={() => onSelect(token.id)}\n accessibilityRole=\"menuitem\"\n accessibilityLabel={token.label}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n style={dropdownItem}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n style={triggerLeft}\n >\n {token.icon ?? <ReceiveTokenIconFallback />}\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {token.label}\n </Text>\n </Box>\n {token.id === selected.id ? <CheckIcon /> : null}\n </Box>\n </Pressable>\n ))}\n </Box>\n </Reanimated.View>\n ) : null}\n </Box>\n )\n}\n\nfunction ReceiveTokenIconFallback() {\n const theme = useTheme()\n return (\n <Box\n width={24}\n height={24}\n borderRadius=\"rounded\"\n style={{ backgroundColor: theme.background.pill.pressed }}\n />\n )\n}\n\nfunction ChevronDownIcon() {\n return <FigmaChevronDownIcon size={16} />\n}\n\n/**\n * The trigger chevron, rotated ~180\u00B0 while the dropdown is open (same\n * timing/easing as the menu) so it reads as flipping up as the menu opens.\n */\nfunction AnimatedChevron({ open }: { open: boolean }) {\n const rotation = useSharedValue(open ? 1 : 0)\n useEffect(() => {\n rotation.value = withTiming(open ? 1 : 0, {\n duration: open ? DROPDOWN_OPEN_DURATION : DROPDOWN_CLOSE_DURATION,\n easing: DROPDOWN_EASING,\n })\n }, [open, rotation])\n // Spelled out because the plugin workletizes by the hook's name, which esbuild\n // renames once a second module imports it \u2014 this worked on import order alone.\n const style = useAnimatedStyle(() => {\n 'worklet'\n return { transform: [{ rotate: `${rotation.value * 180}deg` }] }\n })\n return (\n <Reanimated.View style={style}>\n <FigmaChevronDownIcon size={16} />\n </Reanimated.View>\n )\n}\n\nfunction CheckIcon() {\n return <FigmaCheckIcon size={16} />\n}\n\n/**\n * Loading skeleton for the Add money screen. Mirrors the populated layout so\n * content swaps in without a shift: when `showDropdown`, a \"Deposit to\"\n * selector skeleton + \"Pay with\" label sit above the method skeletons (matching\n * the loaded view's sections); otherwise just the method skeletons. Shapes\n * pulse opacity in sync; labels + chevron stay static.\n */\nfunction SelectMethodLoading({\n count,\n showDropdown,\n}: {\n count?: number\n showDropdown: boolean\n}) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const opacity = usePulse()\n // The deposit selector takes vertical room, so fewer method rows fit.\n const rowCount = count ?? (showDropdown ? 5 : 6)\n return (\n <>\n {showDropdown ? (\n <Box style={depositSection}>\n <Box style={sectionLabel}>\n <Text\n variant=\"detail\"\n style={{ color: theme.content.elements.secondary }}\n >\n {t('selectMethod.depositTo')}\n </Text>\n </Box>\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n borderWidth={1}\n borderRadius=\"element\"\n style={[\n dropdownTrigger,\n {\n backgroundColor: theme.background.modal,\n borderColor: theme.border.elements.default.color,\n },\n ]}\n >\n <Animated.View style={[loadingSelectorLeft, { opacity }]}>\n <Box\n width={20}\n height={20}\n borderRadius=\"rounded\"\n style={{ backgroundColor: theme.background.pill.pressed }}\n />\n <Box\n style={[\n skeletonTitleBar,\n { backgroundColor: theme.background.pill.pressed },\n ]}\n />\n </Animated.View>\n <ChevronDownIcon />\n </Box>\n </Box>\n ) : null}\n\n {showDropdown ? (\n <Box style={payWithSection}>\n <Box style={sectionLabel}>\n <Text\n variant=\"detail\"\n style={{ color: theme.content.elements.secondary }}\n >\n {t('selectMethod.payWith')}\n </Text>\n </Box>\n <Box\n borderWidth={1}\n borderRadius=\"element\"\n style={[\n methodsCard,\n {\n backgroundColor: theme.background.modal,\n borderColor: theme.border.elements.default.color,\n },\n ]}\n >\n <Animated.View\n style={{ opacity }}\n accessibilityLabel={t('selectMethod.loadingMethods')}\n >\n {Array.from({ length: rowCount }, (_, i) => (\n <PaymentMethodRowSkeleton key={i} />\n ))}\n </Animated.View>\n </Box>\n </Box>\n ) : (\n <Box style={skeletonListContent}>\n <Animated.View\n style={{ opacity }}\n accessibilityLabel={t('selectMethod.loadingMethods')}\n >\n {Array.from({ length: rowCount }, (_, i) => (\n <PaymentMethodRowSkeleton key={i} />\n ))}\n </Animated.View>\n </Box>\n )}\n </>\n )\n}\n\n/**\n * One skeleton row in the loading list (Figma node 11333:2346): a fixed 68px\n * row (48px circular leading slot + 10px vertical padding) plus two stacked\n * bars (157\u00D716, 83\u00D714, 4px gap) \u2014 the exact Figma loading geometry.\n */\nfunction PaymentMethodRowSkeleton() {\n const theme = useTheme()\n return (\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n gap=\"elementsHorizontal\"\n style={skeletonRow}\n >\n <Box\n width={48}\n height={48}\n borderRadius=\"rounded\"\n style={{ backgroundColor: theme.background.pill.pressed }}\n />\n <Box flex={1} style={skeletonDetails}>\n <Box\n style={[\n skeletonTitleBar,\n { backgroundColor: theme.background.pill.pressed },\n ]}\n />\n <Box\n style={[\n skeletonSubtitleBar,\n { backgroundColor: theme.background.pill.pressed },\n ]}\n />\n </Box>\n </Box>\n )\n}\n\nconst topBar: ViewStyle = { height: 64, paddingTop: 25, paddingBottom: 12 }\nconst grabber: ViewStyle = {\n position: 'absolute',\n top: 8,\n width: 36,\n height: 5,\n borderRadius: 999,\n}\n// Methods-only list (Figma node 11202:8632): rows padded 16 horizontal, no\n// outer border, hairline dividers between them.\n// Gap between the last row and the screen bottom (Figma / design review).\nconst BOTTOM_GAP = 50\nconst listContent: ViewStyle = {\n paddingHorizontal: 16,\n paddingBottom: BOTTOM_GAP,\n}\n// list-item/base: 12px padding all sides (Figma), gap 12 between leading slot\n// and details supplied by the Box `gap` prop.\nconst row: ViewStyle = { padding: 12 }\nconst details: ViewStyle = { gap: 2 }\n// The fixed deposit selector. zIndex keeps it (and its overlaid option list)\n// above the scrim; the rest of the sheet sits below it and dims.\nconst depositSection: ViewStyle = {\n paddingHorizontal: 16,\n zIndex: 2,\n}\n// \"Pay with\" section: label + bordered method card, 12px gap between (Figma\n// node 11202:8279, pt-12 on the section).\nconst payWithSection: ViewStyle = {\n paddingHorizontal: 16,\n paddingTop: 12,\n paddingBottom: BOTTOM_GAP,\n}\n// Label rows sit with 12px horizontal padding so they align with the row text\n// inside the cards/triggers below them (Figma px-12 on the label).\nconst sectionLabel: ViewStyle = { paddingHorizontal: 12, paddingBottom: 6 }\n// Bordered card wrapping the method rows (Figma node 11202:8282): py-2 inset so\n// the first/last rows clear the rounded corners.\nconst methodsCard: ViewStyle = { paddingVertical: 2, overflow: 'hidden' }\n\n// The enclosing section already pads 16 horizontally; the extra 12 aligns the\n// note with the row text above it, as the section labels do.\nconst noteBox: ViewStyle = { paddingHorizontal: 12, paddingTop: 12 }\n// Hairline divider between rows.\nconst divider: ViewStyle = { height: 1 }\nconst dropdownAnchor: ViewStyle = { position: 'relative' }\nconst dropdownTrigger: ViewStyle = { height: 48, paddingHorizontal: 12 }\nconst triggerLeft: ViewStyle = { gap: 6, flex: 1 }\nconst triggerLabel: ViewStyle = { flex: 1 }\n// Floating option list: anchored just below the trigger as an overlay, so it\n// never reflows the method list. The animated wrapper owns the positioning\n// (and the open/close transform + opacity); the inner Box owns the surface.\nconst dropdownMenuOverlay: ViewStyle = {\n position: 'absolute',\n top: '100%',\n left: 0,\n right: 0,\n marginTop: 4,\n zIndex: 30,\n}\n// shadow/lg from Figma (0,8 / blur 32\u219216 radius / rgba(0,0,0,0.12)); no border.\n// Kept on the surface Box (which has a background) so the iOS shadow renders.\nconst dropdownMenu: ViewStyle = {\n shadowColor: '#000',\n shadowOpacity: 0.12,\n shadowOffset: { width: 0, height: 8 },\n shadowRadius: 16,\n elevation: 8,\n}\nconst dropdownItem: ViewStyle = { height: 48, paddingHorizontal: 12 }\nconst scrim: ViewStyle = {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: 'rgba(0,0,0,0.2)',\n zIndex: 1,\n}\nconst errorContainer: ViewStyle = {\n height: 468,\n gap: 24,\n paddingHorizontal: 16,\n}\nconst errorText: ViewStyle = { gap: 8 }\nconst errorMessageText = { textAlign: 'center' } as const\nconst retryButton: ViewStyle = { height: 48, paddingHorizontal: 20 }\n// The loading list (Figma node 11333:2342): same horizontal/bottom padding as\n// the loaded list (so the sheet doesn't jump height when loading finishes) but\n// no inter-row gap \u2014 the 68px skeleton rows stack flush (their py-10 supplies\n// the breathing room), matching the Figma frame exactly.\nconst skeletonListContent: ViewStyle = {\n paddingHorizontal: 16,\n paddingBottom: BOTTOM_GAP,\n}\n// Figma list-item/base: 12px padding all sides (48px leading circle + 12 each\n// side = 72px row). No inter-row gap; rows abut directly inside the card.\nconst skeletonRow: ViewStyle = { padding: 12 }\n// Row layout for the skeleton selector's left (Animated.View takes no Restyle\n// props, so flexDirection lives here, not as a prop).\nconst loadingSelectorLeft: ViewStyle = {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 6,\n flex: 1,\n}\nconst skeletonDetails: ViewStyle = { gap: 4 }\nconst skeletonTitleBar: ViewStyle = { width: 157, height: 16, borderRadius: 4 }\nconst skeletonSubtitleBar: ViewStyle = {\n width: 83,\n height: 14,\n borderRadius: 4,\n}\n", "import { useEffect, useRef } from 'react'\nimport { Animated } from 'react-native'\n\nconst PULSE_DURATION_MS = 700\nconst PULSE_MIN_OPACITY = 0.5\n\n/**\n * The breathing opacity every loading placeholder shares, so two skeletons on\n * screen at once pulse as one thing rather than two.\n */\nexport function usePulse() {\n const opacity = useRef(new Animated.Value(1)).current\n useEffect(() => {\n const loop = Animated.loop(\n Animated.sequence([\n Animated.timing(opacity, {\n toValue: PULSE_MIN_OPACITY,\n duration: PULSE_DURATION_MS,\n useNativeDriver: true,\n }),\n Animated.timing(opacity, {\n toValue: 1,\n duration: PULSE_DURATION_MS,\n useNativeDriver: true,\n }),\n ]),\n )\n loop.start()\n return () => loop.stop()\n }, [opacity])\n return opacity\n}\n", "import { type ReactNode, useEffect, useRef, useState } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { Grabber } from '../components/Grabber'\nimport { SelectedChainRow } from '../components/SelectedChainRow'\nimport {\n FigmaChevronLeftIcon,\n FigmaCopyIcon,\n FigmaQrScanIcon,\n FigmaShareIcon,\n} from '../icons/FigmaSystemIcons'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\n/**\n * The Transfer Crypto / Universal-Deposit-Address screen. A themed bottom-sheet\n * surface: a back + QR top bar, the tappable selected-chain card, a centered\n * deposit-address card with the chain's minimum, and full-width Copy / Share\n * buttons. UI only \u2014 the host wires the data + callbacks (the deposit-address\n * resolution lives in the transfer hooks).\n */\nexport interface TransferCryptoScreenProps {\n /** Pre-formatted deposit address, e.g. `0x7854...5139F0`. */\n depositAddress: string\n /** The chain the address was generated for, with its minimum-deposit label. */\n selectedChain: { name: string; iconUri: string; minLabel?: string }\n /** How long the \"Copied\" confirmation stays on the Copy button (ms). */\n copiedFeedbackMs?: number\n /** Leading top-bar action \u2014 returns to the Add money screen. */\n onBack?: () => void\n onShowQrCode?: () => void\n /** Tapping the selected-chain card (opens the chain picker). */\n onChangeChain?: () => void\n onCopyAddress?: () => void\n onShareAddress?: () => void\n}\n\nexport function TransferCryptoScreen(props: TransferCryptoScreenProps) {\n const { t } = useFunkitTranslation()\n const {\n depositAddress,\n selectedChain,\n copiedFeedbackMs = 1800,\n onBack,\n onShowQrCode,\n onChangeChain,\n onCopyAddress,\n onShareAddress,\n } = props\n const theme = useTheme()\n const insets = useSafeAreaInsets()\n const [copied, setCopied] = useState(false)\n const copyTimer = useRef<ReturnType<typeof setTimeout>>(undefined)\n\n useEffect(() => () => clearTimeout(copyTimer.current), [])\n\n const handleCopy = () => {\n onCopyAddress?.()\n setCopied(true)\n clearTimeout(copyTimer.current)\n copyTimer.current = setTimeout(() => setCopied(false), copiedFeedbackMs)\n }\n\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={{ backgroundColor: theme.background.modal }}\n >\n {/* Top bar: back \u00B7 title \u00B7 QR */}\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.topBar}>\n <Grabber />\n <Pressable\n onPress={onBack}\n hitSlop={12}\n accessibilityRole=\"button\"\n accessibilityLabel={t('common.back')}\n >\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n style={styles.iconButton}\n >\n <FigmaChevronLeftIcon />\n </Box>\n </Pressable>\n <Box flex={1} alignItems=\"center\">\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {t('transferCrypto.title')}\n </Text>\n </Box>\n <Pressable\n onPress={onShowQrCode}\n hitSlop={12}\n accessibilityRole=\"button\"\n accessibilityLabel={t('transferCrypto.showQrCode')}\n >\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n style={styles.iconButton}\n >\n <FigmaQrScanIcon />\n </Box>\n </Pressable>\n </Box>\n\n <Box style={[styles.content, { paddingBottom: insets.bottom + 16 }]}>\n <SelectedChainRow\n label={t('transferCrypto.selectedChain')}\n name={selectedChain.name}\n iconUri={selectedChain.iconUri}\n accessibilityLabel={t('transferCrypto.changeChain')}\n onPress={onChangeChain}\n />\n\n <Box alignItems=\"center\" style={styles.addressRegion}>\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n borderWidth={1}\n borderRadius=\"element\"\n style={[\n styles.addressCard,\n {\n backgroundColor: theme.background.modal,\n borderColor: theme.border.elements.default.color,\n },\n ]}\n >\n <Box alignItems=\"center\" style={styles.addressColumn}>\n <Box alignItems=\"center\" style={styles.addressGroup}>\n <Text\n variant=\"detail\"\n style={{ color: theme.content.elements.secondary }}\n >\n {t('transferCrypto.depositAddressLabel')}\n </Text>\n <Text\n variant=\"bodyMedium\"\n style={[\n styles.addressText,\n { color: theme.content.elements.primary },\n ]}\n >\n {depositAddress}\n </Text>\n </Box>\n {selectedChain.minLabel ? (\n <Text\n variant=\"body\"\n style={{ color: theme.content.elements.secondary }}\n >\n {selectedChain.minLabel}\n </Text>\n ) : null}\n </Box>\n </Box>\n\n {/* Copy / Share */}\n <Box flexDirection=\"row\" style={styles.buttonsRow}>\n <PillButton\n label={copied ? t('common.copied') : t('common.copy')}\n accessibilityLabel={\n copied ? t('common.addressCopied') : t('common.copyAddress')\n }\n icon={\n <FigmaCopyIcon color={theme.content.button.primary.default} />\n }\n onPress={handleCopy}\n />\n <PillButton\n label={t('transferCrypto.share')}\n accessibilityLabel={t('transferCrypto.shareAddress')}\n icon={\n <FigmaShareIcon color={theme.content.button.primary.default} />\n }\n onPress={onShareAddress}\n />\n </Box>\n </Box>\n </Box>\n </Box>\n )\n}\n\n/** A full-width black pill action button (Copy / Share). */\nfunction PillButton({\n label,\n accessibilityLabel,\n icon,\n onPress,\n}: {\n label: string\n accessibilityLabel: string\n icon: ReactNode\n onPress?: () => void\n}) {\n const theme = useTheme()\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n style={styles.pillButtonPress}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius=\"button\"\n style={[\n styles.pillButton,\n { backgroundColor: theme.background.button.primary.default },\n ]}\n >\n {icon}\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.button.primary.default }}\n >\n {label}\n </Text>\n </Box>\n </Pressable>\n )\n}\n\nconst styles = StyleSheet.create({\n topBar: {\n paddingTop: 16,\n paddingBottom: 16,\n paddingHorizontal: 24,\n gap: 4,\n },\n // 32px touch target centers the 20px glyph so it visually aligns with the\n // px-20 content below.\n iconButton: { width: 32, height: 32 },\n content: {\n paddingHorizontal: 20,\n // paddingBottom is set inline: safe-area inset + 16 so the buttons keep a\n // 16px gap above the home indicator on every device.\n paddingTop: 8,\n gap: 16,\n },\n addressRegion: { gap: 12, width: '100%' },\n addressCard: {\n width: '100%',\n // Centres the address block in the card at the designed height.\n paddingVertical: 148,\n paddingHorizontal: 20,\n // The card MUST keep an opaque `backgroundColor`: on Android `elevation`\n // draws its shadow from the view outline, and without a solid background it\n // can't clip to the rounded corners \u2014 it bleeds as a gray rectangular\n // border around the card.\n shadowColor: '#000',\n shadowOpacity: 0.02,\n shadowOffset: { width: 0, height: 8 },\n shadowRadius: 32,\n elevation: 1,\n },\n // 6 inside the label+address pair, 8 out to the minimum.\n addressColumn: { gap: 8 },\n addressGroup: { gap: 6 },\n // Weight (medium) comes from the `bodyMedium` variant's Inter-Medium family \u2014\n // an inline `fontWeight` wouldn't select the cut on a custom font in RN/Expo.\n addressText: { fontSize: 28, lineHeight: 39 },\n buttonsRow: { gap: 10, width: '100%' },\n pillButtonPress: { flex: 1 },\n pillButton: { height: 56, paddingHorizontal: 24, gap: 8 },\n})\n", "import { Pressable, StyleSheet } from 'react-native'\n\nimport { FigmaChevronRightIcon } from '../icons/FigmaSystemIcons'\nimport { ChainAvatar } from '../icons/ChainAvatar'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\nexport interface SelectedChainRowProps {\n /** Section label above the chain name, e.g. `Selected chain`. */\n label: string\n /** The chain's display name, e.g. `Base`. */\n name: string\n /** Full CDN logo URL for the 32px chain icon. */\n iconUri: string\n accessibilityLabel: string\n onPress?: () => void\n}\n\n/**\n * The tappable \"Selected chain\" card on the Transfer screen. Shows the chain the\n * deposit address was generated for and opens the chain picker to change it.\n */\nexport function SelectedChainRow({\n label,\n name,\n iconUri,\n accessibilityLabel,\n onPress,\n}: SelectedChainRowProps) {\n const theme = useTheme()\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n borderRadius=\"element\"\n style={[styles.card, { backgroundColor: theme.background.secondary }]}\n >\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.chain}>\n <ChainAvatar uri={iconUri} size={32} />\n <Box>\n <Text\n variant=\"detail\"\n style={{ color: theme.content.elements.secondary }}\n >\n {label}\n </Text>\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n style={{ color: theme.content.elements.primary }}\n >\n {name}\n </Text>\n </Box>\n </Box>\n <FigmaChevronRightIcon\n size={20}\n color={theme.content.button.icon.default}\n />\n </Box>\n </Pressable>\n )\n}\n\nconst styles = StyleSheet.create({\n card: { padding: 16 },\n chain: { gap: 12, flex: 1 },\n})\n", "import type { SwappedInboundMessage } from '@funkit/connect-core'\nimport { useCallback } from 'react'\n\nimport { logger } from '../logging/logger'\nimport {\n type SwappedScreenBaseProps,\n SwappedScreenShell,\n} from './SwappedScreenShell'\n\nexport interface SwappedScreenProps extends SwappedScreenBaseProps {\n /** Fired when the embed reports a successful transaction. */\n onSuccess?: () => void\n}\n\n/**\n * Deposit-mode host for the Swapped embed (mirroring web's\n * `SwappedIframeController`): back / new-deposit \u2192 {@link onBack},\n * close \u2192 {@link onClose}, transaction-successful \u2192 {@link onSuccess}.\n * Withdrawal lifecycle messages are ignored \u2014 see `SwappedWithdrawScreen`.\n */\nexport function SwappedScreen({\n url,\n onClose,\n onBack,\n onSuccess,\n}: SwappedScreenProps) {\n const handleMessage = useCallback(\n (msg: SwappedInboundMessage) => {\n switch (msg.type) {\n // Same destination, logged apart: \"went back\" and \"started another\n // deposit\" are different intents (web parity).\n case 'SWAPPED_GO_BACK':\n logger.info('connect-rn:swapped:back')\n onBack()\n break\n case 'SWAPPED_NEW_DEPOSIT':\n logger.info('connect-rn:swapped:back_and_new_deposit')\n onBack()\n break\n case 'SWAPPED_CLOSE':\n logger.info('connect-rn:swapped:exit')\n onClose()\n break\n case 'SWAPPED_TRANSACTION_SUCCESSFUL':\n logger.info('connect-rn:swapped:transaction_successful')\n onSuccess?.()\n break\n default:\n // READY / NAVIGATION / LOGOUT / ERROR handled in the shell or\n // tracked elsewhere; withdrawal lifecycle messages belong to\n // SwappedWithdrawScreen.\n break\n }\n },\n [onBack, onClose, onSuccess],\n )\n\n return <SwappedScreenShell url={url} onMessage={handleMessage} />\n}\n", "import type { SwappedInboundMessage } from '@funkit/connect-core'\nimport { useCallback } from 'react'\nimport type { ViewStyle } from 'react-native'\n\nimport { logger } from '../logging/logger'\nimport { Box, useTheme } from '../theme/restyle'\nimport { SwappedWebView } from './SwappedWebView'\n\n/** Props shared by both Swapped embed hosts (deposit and withdrawal). */\nexport interface SwappedScreenBaseProps {\n /** The selected FOP's `embeddedFlowUrl` to load in the embed. */\n url: string\n /** Close the whole flow (embed asked to exit, e.g. its own \u2715). */\n onClose: () => void\n /** Go back to the method list (embed's own back). */\n onBack: () => void\n}\n\ninterface SwappedScreenShellProps {\n url: string\n onMessage: (msg: SwappedInboundMessage) => void\n}\n\n/**\n * Full-screen host frame for the Swapped embedded payment flow\n * ({@link SwappedWebView}). The embed ships its own top bar, so we render no\n * RN header. Mode-agnostic message handling (error and navigation logging)\n * lives here;\n * mode-specific dispatch lives in `SwappedScreen` (deposit) and\n * `SwappedWithdrawScreen` (withdrawal).\n */\nexport function SwappedScreenShell({\n url,\n onMessage,\n}: SwappedScreenShellProps) {\n const theme = useTheme()\n const handleMessage = useCallback(\n (msg: SwappedInboundMessage) => {\n switch (msg.type) {\n case 'SWAPPED_ERROR':\n // Recoverable \u2014 the embed surfaces its own error UI (WARN, not ERROR).\n logger.warn('connect-rn:swapped:error', {\n data: msg.data ?? {},\n })\n break\n case 'SWAPPED_READY':\n // Unconditional boot signal. `swapped:theme_sent` also fires on READY\n // but only once the theme send succeeds, so it can't be relied on to\n // count how many times the embed (re)initialised.\n logger.info('connect-rn:swapped:ready')\n break\n case 'SWAPPED_LOGOUT':\n logger.info('connect-rn:swapped:logout')\n break\n case 'SWAPPED_NAVIGATION':\n // Which step the embed moved to. The only signal we get about what\n // it's showing \u2014 without it a blank embed is indistinguishable from\n // a user sitting still, which is why this exists (mirrors the web\n // SDK's `swapped-iframe:navigation`).\n logger.info('connect-rn:swapped:navigation', {\n step: msg.data?.step || 'unknown',\n })\n break\n default:\n break\n }\n onMessage(msg)\n },\n [onMessage],\n )\n\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={[sheet, { backgroundColor: theme.background.modal }]}\n >\n <SwappedWebView url={url} onMessage={handleMessage} style={fill} />\n </Box>\n )\n}\n\n// Fixed sheet height (the embed needs a concrete area; a flex WebView in the\n// content-sized bottom sheet would collapse to grey). Clipped to the rounded\n// top corners.\nconst SHEET_HEIGHT = 550\nconst sheet: ViewStyle = { height: SHEET_HEIGHT, overflow: 'hidden' }\nconst fill: ViewStyle = { flex: 1 }\n", "import type { SwappedInboundMessage } from '@funkit/connect-core'\nimport { useTheme } from '@shopify/restyle'\nimport { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { ActivityIndicator, View, type ViewStyle } from 'react-native'\nimport {\n WebView,\n type WebViewMessageEvent,\n type WebViewNavigation,\n} from 'react-native-webview'\n\nimport { logger } from '../logging/logger'\nimport { useFunkitColorScheme } from '../theme/FunkitThemeProvider'\nimport type { FunkitTheme } from '../theme/toRestyleTheme'\nimport { buildSwappedThemeRN } from './buildSwappedTheme'\nimport {\n SWAPPED_WEBVIEW_INJECTED_JS,\n createWebViewSwappedTransport,\n} from './webViewSwappedTransport'\n\nexport interface SwappedWebViewProps {\n /** The selected FOP's `embeddedFlowUrl` (a swapped.com/.dev widget URL). */\n url: string\n /** Typed, origin-validated inbound messages from the embed. */\n onMessage: (msg: SwappedInboundMessage) => void\n style?: ViewStyle\n}\n\n/**\n * Renders the Swapped embedded payment flow in a `WebView` and bridges its\n * messages to the typed {@link SwappedTransport} contract \u2014 the React Native\n * counterpart of web's iframe. The {@link SWAPPED_WEBVIEW_INJECTED_JS} bridge\n * redirects the embed's `postMessage` to the native channel; `onMessage` is\n * parsed + origin-validated before reaching the handler.\n */\nexport function SwappedWebView({ url, onMessage, style }: SwappedWebViewProps) {\n const webViewRef = useRef<WebView>(null)\n // Last main-frame URL reported by the WebView's NATIVE layer \u2014 the fallback\n // when `nativeEvent.url` is empty on a message event (some webview builds omit\n // it). Seeded with the widget url so a message before the first navigation\n // callback still validates against a real Swapped origin. Never sourced from\n // page JS, so it stays trustworthy for the fail-closed origin gate.\n const lastCommittedUrlRef = useRef(url)\n const { transport, dispatch } = useMemo(\n () =>\n createWebViewSwappedTransport({\n getWebView: () => webViewRef.current,\n }),\n [],\n )\n\n const theme = useTheme<FunkitTheme>()\n const { colorScheme } = useFunkitColorScheme()\n const swappedTheme = useMemo(\n () => buildSwappedThemeRN(theme, colorScheme === 'dark'),\n [theme, colorScheme],\n )\n // Latest theme/scheme without resubscribing the message handler below.\n const swappedThemeRef = useRef(swappedTheme)\n swappedThemeRef.current = swappedTheme\n const colorSchemeRef = useRef(colorScheme)\n colorSchemeRef.current = colorScheme\n\n // Keep the latest handler without re-subscribing on every render. When the\n // embed announces SWAPPED_READY (its message listener is attached \u2014 reaches\n // us via the bridge's `window.opener` shim), send it the active theme:\n // the same READY-gated send web's iframe does via core `useSwappedSession`.\n const handlerRef = useRef(onMessage)\n handlerRef.current = onMessage\n useEffect(\n () =>\n transport.onMessage((msg) => {\n if (msg.type === 'SWAPPED_READY') {\n transport.send({\n type: 'SWAPPED_THEME',\n data: swappedThemeRef.current,\n })\n logger.info('connect-rn:swapped:theme_sent', {\n colorScheme: colorSchemeRef.current,\n })\n }\n handlerRef.current(msg)\n }),\n [transport],\n )\n\n const handleNavigationStateChange = (navState: WebViewNavigation) => {\n if (navState.url) {\n lastCommittedUrlRef.current = navState.url\n }\n }\n\n const handleMessage = (event: WebViewMessageEvent) => {\n // onNavigationStateChange doesn't fire for SPA route changes inside the\n // widget, but those never change the origin \u2014 all the gate reads.\n dispatch(\n event.nativeEvent.data,\n event.nativeEvent.url || lastCommittedUrlRef.current,\n )\n }\n\n // Native loading state, shown before the widget's HTML exists (so neither\n // the URL loading params nor SWAPPED_THEME can style it): without this,\n // `startInLoadingState` renders react-native-webview's default spinner \u2014\n // platform-colored on a white fill \u2014 which flashes unthemed.\n const renderLoading = useCallback(\n () => (\n <View\n style={[loadingOverlay, { backgroundColor: theme.background.modal }]}\n >\n <ActivityIndicator color={theme.content.elements.secondary} />\n </View>\n ),\n [theme.background.modal, theme.content.elements.secondary],\n )\n\n // Load failures are recoverable (the embed shows its own retry UI) \u2192 WARN.\n // Event types inlined: the exact exported names vary across webview versions.\n const handleError = (event: {\n nativeEvent: { code: number; description: string; url: string }\n }) => {\n logger.warn('connect-rn:swapped:webview:error', {\n code: String(event.nativeEvent.code),\n description: event.nativeEvent.description,\n url: event.nativeEvent.url,\n })\n }\n const handleHttpError = (event: {\n nativeEvent: { statusCode: number; url: string }\n }) => {\n logger.warn('connect-rn:swapped:webview:httpError', {\n status: String(event.nativeEvent.statusCode),\n url: event.nativeEvent.url,\n })\n }\n\n return (\n <WebView\n ref={webViewRef}\n source={{ uri: url }}\n onMessage={handleMessage}\n onNavigationStateChange={handleNavigationStateChange}\n onError={handleError}\n onHttpError={handleHttpError}\n scrollEnabled={false}\n injectedJavaScriptBeforeContentLoaded={SWAPPED_WEBVIEW_INJECTED_JS}\n // Themed spinner while the embed loads (instead of a blank grey panel).\n startInLoadingState\n renderLoading={renderLoading}\n // The Swapped flow needs these to run its KYC / payment widgets.\n javaScriptEnabled\n domStorageEnabled\n // The embed relies on its own session cookies (login / KYC state).\n sharedCookiesEnabled\n thirdPartyCookiesEnabled\n // Cards / Apple Pay / Google Pay surfaces inside the embed.\n allowsInlineMediaPlayback\n // The embed auto-focuses its amount input on open. iOS suppresses the\n // keyboard for programmatic (non-tap) focus by default, so the input\n // would sit focused with no keyboard \u2014 raise it without a user gesture.\n // (iOS-only prop; Android already shows the keyboard on focus.)\n keyboardDisplayRequiresUserAction={false}\n // Drop iOS's form accessory bar (the \u2039 \u203A / Done toolbar above the\n // keyboard) \u2014 the embed has no multi-field navigation to drive it, so it\n // just adds a strip between the sheet and the keyboard. (iOS-only.)\n hideKeyboardAccessoryView\n // The embed renders its own bottom sheet anchored to the viewport bottom.\n // By default WKWebView ALSO insets its scroll view by the keyboard height,\n // so its content shifts up while the sheet itself (gorhom's `interactive`\n // keyboard behavior) is already moving up \u2014 double-compensating. Pin the\n // insets so the WebView stays a fixed canvas and the sheet is the single\n // thing that moves. (iOS-only.)\n automaticallyAdjustContentInsets={false}\n contentInsetAdjustmentBehavior=\"never\"\n // Some embed steps open provider pages in a new window.\n setSupportMultipleWindows={false}\n originWhitelist={['https://*']}\n // Match the theme while the page itself paints (the platform WebView\n // is opaque white by default \u2014 visible as a flash in dark/custom themes).\n style={[{ backgroundColor: theme.background.modal }, style]}\n />\n )\n}\n\nconst loadingOverlay: ViewStyle = {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n alignItems: 'center',\n justifyContent: 'center',\n}\n", "import type { SwappedTheme } from '@funkit/connect-core'\n\nimport type { FunkitTheme } from '../theme/toRestyleTheme'\n\nconst px = (value: number) => `${value}px`\nconst toRawHex = (color: string) => color.replace(/^#/, '')\n\n/**\n * Loading-state theme for the Swapped embed: the query params sent to `/fops`\n * (`thirdPartyPaymentConfigs.swapped.themeConfig`) that the API bakes into the\n * returned `embeddedFlowUrl` (e.g. `\u2026&iframeBackground=fbf9f4&textColor=282828`)\n * \u2014 the widget themes its boot spinner / skeleton straight from the URL, before\n * its message listener is up and any `SWAPPED_THEME` postMessage can land.\n * Mirrors web's `buildSwappedThemeQueryParams(resolvedTheme)`; colors are raw\n * hex (no `#`, they travel in a URL).\n *\n * Web also pins `height`/`width` to its dialog constants; omitted here \u2014 the\n * widget sizes to the WebView's real viewport.\n */\nexport function buildSwappedThemeQueryParamsRN(\n theme: FunkitTheme,\n): Record<string, string> {\n const { background, content, border, borderRadii } = theme\n return {\n iframeBackground: toRawHex(background.modal),\n widgetBackground: toRawHex(background.modal),\n textColor: toRawHex(content.elements.primary),\n spinnerColor: toRawHex(content.elements.primary),\n modalRadii: px(borderRadii.modal),\n skeletonColor: toRawHex(border.elements.default.color),\n skeletonSecondaryColor: toRawHex(background.secondary),\n }\n}\n\n/**\n * Builds the {@link SwappedTheme} payload for the embedded Swapped flow from\n * the active Restyle theme \u2014 the React Native counterpart of web's\n * `buildSwappedTheme(ThemeVars)`. RN tokens are concrete hex / numbers (no\n * CSS-var indirection), so unlike web no `resolveObjectCssVars` pass is needed.\n *\n * The Swapped widget's vocabulary is richer than the Fun Variables export: it\n * has hover / focused / disabled slots the mobile design doesn't define. Since\n * connect-rn's tokens are a strict mirror of Figma (only default / pressed /\n * some disabled states exist), those extra slots are adapted here at the\n * boundary: hover \u2190 pressed, primary/tertiary disabled \u2190 the default fill (the\n * widget dims via opacity), and the widget's neutral \"focused\" strokes map onto\n * the `border/elements/{default,selected}` variables.\n *\n * Fonts are intentionally omitted: Swapped expects a slug from its hosted\n * webfont set, and RN font families (system/native names) don't map onto it.\n */\nexport function buildSwappedThemeRN(\n theme: FunkitTheme,\n isDarkMode: boolean,\n): SwappedTheme {\n const {\n background,\n content,\n border,\n brand,\n borderRadii,\n sizes,\n spacing,\n textVariants,\n } = theme\n return {\n colors: {\n // \u2500\u2500 Core text \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n primaryText: content.elements.primary,\n secondaryText: content.elements.secondary,\n tertiaryText: content.elements.secondary,\n\n // \u2500\u2500 Surfaces \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n modalBackground: background.modal,\n offBackground: background.secondary,\n hoverState: background.secondary,\n lightStroke: border.elements.default.color,\n mediumStroke: border.elements.default.color,\n heavyStroke: border.elements.default.color,\n modalBorder: border.modal.default,\n modalHeaderDivider: border.elements.default.color,\n modalFooterDivider: border.elements.default.color,\n\n // \u2500\u2500 Accent / brand \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n actionColor: brand.primary,\n accentColor: brand.primary,\n accentColorForeground: content.button.primary.default,\n\n // \u2500\u2500 Status \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n error: content.elements.error,\n success: content.elements.success,\n\n // \u2500\u2500 Spinner \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n spinnerIndicator: content.elements.primary,\n spinnerBackground: border.elements.default.color,\n\n // \u2500\u2500 Primary button (hover \u2190 pressed, disabled \u2190 default fill) \u2500\u2500\u2500\u2500\u2500\n // web spreads both `buttonBackground*` (ThemeVars) and `buttonPrimary*`\n // (widget aliases); the widget reads whichever is present.\n buttonBackground: background.button.primary.default,\n buttonBackgroundHover: background.button.primary.pressed,\n buttonBackgroundPressed: background.button.primary.pressed,\n buttonBackgroundDisabled: background.button.primary.default,\n buttonPrimary: background.button.primary.default,\n buttonPrimaryHover: background.button.primary.pressed,\n buttonDisabled: background.button.primary.default,\n buttonTextPrimary: content.button.primary.default,\n buttonTextHover: content.button.primary.default,\n buttonTextDisabled: content.button.primary.default,\n buttonTextSecondary: content.button.secondary.default,\n buttonTextSecondaryDisabled: content.button.secondary.default,\n buttonFocusedOutline: 'none',\n buttonBorderGradient: 'none',\n buttonHoverBorderGradient: 'none',\n buttonDisabledBorderGradient: 'none',\n\n // \u2500\u2500 Tertiary button (hover \u2190 pressed, disabled \u2190 default fill) \u2500\u2500\u2500\u2500\n buttonBackgroundTertiary: background.button.tertiary.default,\n buttonBackgroundHoverTertiary: background.button.tertiary.pressed,\n buttonBackgroundDisabledTertiary: background.button.tertiary.default,\n buttonTextTertiary: content.button.tertiary.default,\n buttonTextDisabledTertiary: content.button.tertiary.default,\n buttonBorderTertiary: 'transparent',\n buttonBorderFocusedTertiary: border.elements.selected.color,\n\n // \u2500\u2500 Icon button / top bar (hover \u2190 pressed) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n headerButtonBackground: background.button.icon.default,\n buttonIconBackgroundHover: background.button.icon.pressed,\n buttonIconBackgroundPressed: background.button.icon.pressed,\n buttonIconStroke: content.button.icon.default,\n modalTopbarIcon: content.button.icon.default,\n modalTopbarIconBackground: background.button.icon.default,\n modalTopbarIconBackgroundHover: background.button.icon.pressed,\n modalTopbarIconBackgroundPressed: background.button.icon.pressed,\n\n // \u2500\u2500 Input (hover/focused \u2190 border/elements variables) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n inputBackground: background.modal,\n inputBackgroundHover: background.secondary,\n inputBorderBase: border.elements.default.color,\n inputBorderHover: border.elements.selected.color,\n inputLabel: content.elements.primary,\n inputBorder: border.elements.default.color,\n inputBorderFocused: content.elements.secondary,\n inputBorderActive: content.elements.secondary,\n inputPlaceholder: content.elements.secondary,\n\n // \u2500\u2500 Selection \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n selectedOptionBorder: border.elements.selected.color,\n focusedOptionBorder: border.elements.selected.color,\n\n // \u2500\u2500 Widget aliases (mirrors web buildSwappedTheme) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n boxBackground: background.secondary,\n secondaryButtonBg: background.button.tertiary.default,\n secondaryButtonText: content.button.tertiary.default,\n secondaryButtonHover: background.button.tertiary.pressed,\n secondaryButtonTextHover: content.button.tertiary.default,\n },\n radii: {\n modal: px(borderRadii.modal),\n actionButton: px(borderRadii.button),\n summaryBox: px(borderRadii.element),\n box: px(borderRadii.element),\n otpInput: px(borderRadii.button),\n calculatorInput: px(borderRadii.button),\n amountPill: px(borderRadii.button),\n },\n paymentMethodLightLogos: !isDarkMode,\n headerHeight: px(sizes.topBar),\n headerFontWeight: String(textVariants.headerTitle.fontWeight ?? '500'),\n // web: topbarIconColor \u2190 modalTopbarIcon (the icon on the top-bar buttons)\n topbarIconColor: content.button.icon.default,\n topbarTextFontSize: px(textVariants.headerTitle.fontSize ?? 13),\n headerIconWrapperSize: px(sizes.buttonXs),\n headerIconSize: px(sizes.iconMd),\n buttonFontWeight: String(textVariants.bodyMedium.fontWeight ?? '500'),\n modalBottomBarButtonHeight: px(sizes.buttonHeight),\n iframeBackground: background.modal,\n // Same fixed paddings web sends (web: modalBaseHorizontalPadding + 6px).\n topbarPaddingX: px(spacing.modalHorizontal + 6),\n topbarPaddingY: '12px',\n boxPaddingY: '16px',\n boxPaddingX: '16px',\n paddingPrimary: '20px',\n paddingSecondary: '12px',\n paddingTertiary: '20px',\n }\n}\n", "import {\n type SwappedInboundMessage,\n type SwappedOutboundMessage,\n type SwappedTransport,\n getSwappedOrigin,\n} from '@funkit/connect-core'\n\n/**\n * Marker key on host \u2192 embed envelopes (see {@link buildSwappedSendScript}).\n * The injected bridge recognizes the mark, unwraps the payload, and delivers it\n * to the page; everything unmarked is embed traffic and goes to native.\n */\nexport const FUNKIT_ENVELOPE_KEY = '__funkitSwapped'\n\n/**\n * Injected into the Swapped WebView before its content loads. Installs one\n * bridged `postMessage` that routes BOTH directions:\n *\n * - **embed \u2192 native**: the embed talks to its host by calling\n * `window.parent.postMessage(obj, origin)` (the web iframe contract); at the\n * top level `window.parent === window`, so overriding `window.postMessage`\n * intercepts those calls and forwards them \u2014 JSON-stringified \u2014 to React\n * Native via `window.ReactNativeWebView.postMessage`. The RN side parses +\n * origin-validates via {@link handleWebViewMessage}.\n * - **native \u2192 embed**: messages injected by {@link buildSwappedSendScript}\n * arrive at the same bridged function wrapped in a funkit-marked envelope\n * ({@link FUNKIT_ENVELOPE_KEY}); the bridge unwraps them and re-dispatches\n * the payload through the REAL `postMessage` (captured before the override),\n * so the embed's `message` listeners receive a genuine, trusted MessageEvent\n * with an object `event.data` \u2014 exactly what they get from an iframe parent.\n *\n * It also installs a fake `window.opener` wired to the native channel: with no\n * parent frame the widget posts its lifecycle messages (`SWAPPED_READY`, \u2026) to\n * `opener` instead of `parent`, and a top-level WebView has neither \u2014 without\n * the shim those messages are silently dropped.\n */\nexport const SWAPPED_WEBVIEW_INJECTED_JS = `(function () {\n if (window.${FUNKIT_ENVELOPE_KEY}Bridge) { return; }\n window.${FUNKIT_ENVELOPE_KEY}Bridge = true;\n // The REAL postMessage, captured before the override below.\n var postToPage = window.postMessage.bind(window);\n function forwardToNative(message) {\n try {\n var data = typeof message === 'string' ? message : JSON.stringify(message);\n window.ReactNativeWebView && window.ReactNativeWebView.postMessage(data);\n } catch (e) {}\n }\n function bridged(message) {\n // funkit envelope (host \u2192 embed): unwrap + deliver to the page's listeners.\n if (message && message.${FUNKIT_ENVELOPE_KEY}) {\n try { postToPage(message.payload, '*'); } catch (e) {}\n return;\n }\n // Anything else is the embed talking to its host \u2192 forward to native.\n forwardToNative(message);\n }\n try { window.postMessage = bridged; } catch (e) {}\n // The widget only emits some messages (notably SWAPPED_ORDER_DATA, the sell\n // deposit address) when it believes it is embedded in a parent frame \u2014 on web\n // that's a real <iframe> so window.parent !== window. A top-level WebView has\n // window.parent === window, so present a DISTINCT parent/top (a proxy over\n // window) whose postMessage forwards to native; the get-trap delegates every\n // other property to the real window so the widget's other parent.* access works.\n var frameProxy = window;\n try {\n frameProxy = new Proxy(window, {\n get: function (target, prop) {\n if (prop === 'postMessage') { return bridged; }\n var value = target[prop];\n return typeof value === 'function' ? value.bind(target) : value;\n },\n });\n } catch (e) {\n // Proxy unavailable \u2192 fall back to bridging the real parent.\n try { if (window.parent) { window.parent.postMessage = bridged; } } catch (e2) {}\n }\n // Guard parent/top independently: parent is [Replaceable] so it sticks, but\n // top is [LegacyUnforgeable] (HTML spec) and throws on conforming engines\n // while succeeding on the WebView builds that gate embed detection on it \u2014\n // isolating them means a throw on one never skips the other.\n try { Object.defineProperty(window, 'parent', { configurable: true, get: function () { return frameProxy; } }); } catch (e) {}\n try { Object.defineProperty(window, 'top', { configurable: true, get: function () { return frameProxy; } }); } catch (e) {}\n // No parent frame \u2192 the widget posts lifecycle messages to window.opener.\n try { if (!window.opener) { window.opener = { postMessage: forwardToNative }; } } catch (e) {}\n true;\n})();\ntrue;`\n\n/**\n * Build the JS snippet that delivers an outbound message INTO the embed, run\n * via `webView.injectJavaScript`. One shape for every message type: the payload\n * is wrapped in a funkit-marked envelope and handed to the (bridged)\n * `window.postMessage` \u2014 the bridge unwraps it and re-dispatches via the real\n * `postMessage` (see {@link SWAPPED_WEBVIEW_INJECTED_JS}). If the bridge isn't\n * installed, the envelope dispatches as-is and the embed ignores it (no `type`).\n */\nexport function buildSwappedSendScript(msg: SwappedOutboundMessage): string {\n const envelope = JSON.stringify({ [FUNKIT_ENVELOPE_KEY]: true, payload: msg })\n return `(function () {\n try { window.postMessage(${envelope}, '*'); } catch (e) {}\n})();\ntrue;`\n}\n\n/**\n * Parse + validate a raw WebView `onMessage` payload into a typed inbound\n * Swapped message. Returns `null` (drop the message) when the payload isn't\n * valid JSON with a string `type`, or `url`'s origin isn't a Swapped origin\n * (mirrors web's `isSwappedOrigin(event.origin)` iframe guard).\n *\n * `url` is the page URL to validate against. The caller passes `nativeEvent.url`,\n * falling back to the last committed navigation URL when a webview build omits it\n * (see {@link SwappedWebView}) \u2014 so a missing url here means no trustworthy\n * source, and we fail closed.\n */\nexport function handleWebViewMessage(\n rawData: unknown,\n url?: string,\n): SwappedInboundMessage | null {\n // Fail closed: no verifiable Swapped page URL \u2192 drop.\n if (!url || getSwappedOrigin(url) == null) {\n return null\n }\n let parsed: unknown\n if (typeof rawData === 'string') {\n try {\n parsed = JSON.parse(rawData)\n } catch {\n return null\n }\n } else {\n parsed = rawData\n }\n const data = parsed as { type?: unknown } | null | undefined\n if (!data || typeof data.type !== 'string') {\n return null\n }\n return data as SwappedInboundMessage\n}\n\n/** Minimal surface of `react-native-webview`'s ref the transport needs. */\nexport interface WebViewLike {\n injectJavaScript(script: string): void\n}\n\nexport interface WebViewSwappedTransport {\n /** Implements the shared {@link SwappedTransport} contract. */\n transport: SwappedTransport\n /**\n * Feed a raw WebView `onMessage` payload (+ optional page url) through origin\n * validation and fan it out to `transport.onMessage` subscribers.\n */\n dispatch(rawData: unknown, url?: string): void\n}\n\n/**\n * React Native {@link SwappedTransport}: bridges the typed Swapped message\n * contract over a `WebView` instead of web's `<iframe>` + `window.postMessage`.\n * `send` delivers into the embed by injecting an in-page `postMessage` call\n * ({@link buildSwappedSendScript}); inbound messages arrive through\n * {@link dispatch} (wired to the WebView's `onMessage`).\n */\nexport function createWebViewSwappedTransport({\n getWebView,\n}: {\n getWebView: () => WebViewLike | null\n}): WebViewSwappedTransport {\n const handlers = new Set<(msg: SwappedInboundMessage) => void>()\n\n const transport: SwappedTransport = {\n send(msg: SwappedOutboundMessage): boolean {\n const webView = getWebView()\n if (!webView) {\n return false\n }\n webView.injectJavaScript(buildSwappedSendScript(msg))\n return true\n },\n onMessage(handler: (msg: SwappedInboundMessage) => void): () => void {\n handlers.add(handler)\n return () => {\n handlers.delete(handler)\n }\n },\n }\n\n function dispatch(rawData: unknown, url?: string): void {\n const msg = handleWebViewMessage(rawData, url)\n if (msg) {\n for (const handler of handlers) {\n handler(msg)\n }\n }\n }\n\n return { transport, dispatch }\n}\n", "import {\n type MinDepositTarget,\n type MinTransferConfig,\n getConfiguredMinDepositUsd,\n getMinTransferValueUsd,\n} from '@funkit/connect-core'\nimport type { TFunction } from 'i18next'\n\nimport { chainIconUri, chainName } from '../utils/chainDisplay'\nimport type { TokenChainFilter } from './supportedTokens'\n\n/** A curated deposit chain the user can pick to send funds on. */\nexport interface AvailableChain {\n /** Numeric chain id as a string. */\n id: string\n /** Display name, e.g. `Ethereum`, `Binance Smart Chain`. */\n name: string\n /** Full CDN logo URL. */\n iconUri: string\n /** Minimum-deposit label, e.g. `$10 minimum`. */\n minLabel?: string\n}\n\n/**\n * Build the chain-picker rows from the curated chain list (the\n * `tokentransferconfig` chains resolved by `useSupportedTokens`, as chain-filter\n * chips), enriched with `@funkit/chains` logos and the per-chain minimum.\n *\n * The minimum mirrors web's `TransferToken`:\n * `ceil(getMinTransferValueForChain(chainId, mintokentransfervalue) +\n * getMinDepositUSD(target))`.\n */\nexport function buildAvailableChains({\n t,\n chainFilters,\n minTransferLimits,\n target,\n}: {\n t: TFunction\n /** `useSupportedTokens().chainFilters` \u2014 `All` + one chip per curated chain. */\n chainFilters: TokenChainFilter[]\n minTransferLimits: MinTransferConfig\n target?: MinDepositTarget\n}): AvailableChain[] {\n const minDepositAddOn = getConfiguredMinDepositUsd(target)\n\n return chainFilters\n .filter((f) => f.id !== 'all')\n .map((f) => ({ chainId: Number(f.id), name: f.label }))\n .map(({ chainId, name }) => {\n const min = getMinTransferValueUsd(\n chainId,\n minTransferLimits,\n minDepositAddOn,\n )\n return {\n id: String(chainId),\n name:\n name ||\n chainName(chainId) ||\n t('networks.chainFallback', { chainId }),\n iconUri: chainIconUri(chainId),\n minLabel: t('networks.minimum', { min }),\n }\n })\n}\n", "import { chainMetadataById } from '@funkit/chains'\n\nimport { FALLBACK_ASSET_LOGO } from '../icons/assetLogos'\n\n// How a chain is shown, read from `@funkit/chains` \u2014 the metadata both SDKs\n// already share. The fallbacks are the platform-specific half: the CDN\n// placeholder and the locale string are RN's own.\n\n/** Chain logo, or the placeholder for a chain the metadata doesn't cover. */\nexport function chainIconUri(chainId: number): string {\n return chainMetadataById[chainId]?.iconUrl ?? FALLBACK_ASSET_LOGO\n}\n\n/**\n * The chain's name, or `undefined` when the metadata doesn't know it \u2014 callers\n * supply their own fallback, since not all of them have a `t` to hand.\n */\nexport function chainName(chainId: number): string | undefined {\n return chainMetadataById[chainId]?.name\n}\n", "import {\n type ExchangeRates,\n FormOfPaymentType,\n type SwappedFormOfPayment,\n} from '@funkit/api-base'\nimport { getFopsLimit, getFormOfPaymentDisplayName } from '@funkit/connect-core'\nimport type { TFunction } from 'i18next'\n\n/** A cash-tab payment row, derived from a Swapped form of payment. */\nexport interface FopRow {\n /** Stable id passed back to `onSelectFop`. */\n id: string\n /** Display name, e.g. \"Card\", \"Apple Pay\". */\n name: string\n /** Subtitle, e.g. \"$10,000.00 limit \u2022 Instant\". */\n subtitle: string\n /**\n * Disabled when the FOP has no embedded-flow URL \u2014 these are the\n * \"coming soon\" placeholders Swapped returns when geoblocked/unavailable.\n */\n disabled: boolean\n}\n\n/**\n * Map Swapped forms of payment to Add money rows. Subtitle mirrors the Figma:\n * `\"<limit> limit\"`, with `\" \u00B7 1-2 days\"` appended for bank transfers (the\n * only FOP the Figma gives a timing suffix). The limit is the FOP's max\n * converted to USD via {@link getFopsLimit} (falls back to a default when no\n * exchange rate is available \u2014 RN doesn't fetch rates in V1).\n */\nexport function toFopRows(\n t: TFunction,\n fops: SwappedFormOfPayment[],\n exchangeRates?: ExchangeRates,\n): FopRow[] {\n return fops.map((fop) => {\n const limit = getFopsLimit(fop, exchangeRates)\n // Two full keys instead of concatenating around \"\u00B7\" \u2014 locales own the\n // separator and word order.\n const subtitle =\n fop.fopType === FormOfPaymentType.BANK_TRANSFER\n ? t('fops.bankTransferSubtitle', { limit })\n : t('fops.limit', { limit })\n return {\n id: `${fop.fopType}:${fop.name}`,\n name: getFormOfPaymentDisplayName(fop),\n subtitle,\n disabled: !fop.embeddedFlowUrl,\n }\n })\n}\n\n/**\n * Map Swapped payout methods to Withdraw rows. Deliberately NOT {@link toFopRows}:\n * its `getFopsLimit` default invents a \"$10k limit\" when no exchange rate is\n * available, which would misstate a limit on the user's own money (web's\n * `getWithdrawalFopsDisclaimerLimit` returns no limit without rates). Subtitle\n * is timing-only: bank transfers settle in days, everything else is instant.\n */\nexport function toWithdrawFopRows(\n t: TFunction,\n fops: SwappedFormOfPayment[],\n): FopRow[] {\n return fops.map((fop) => ({\n id: `${fop.fopType}:${fop.name}`,\n name: getFormOfPaymentDisplayName(fop),\n subtitle:\n fop.fopType === FormOfPaymentType.BANK_TRANSFER\n ? t('fops.bankTransferTime')\n : t('fops.instant'),\n disabled: !fop.embeddedFlowUrl,\n }))\n}\n", "/**\n * Truncate a deposit address for display, e.g.\n * `0x7854f3\u20265139F0` (Figma: Transfer Crypto). Keeps the leading + trailing\n * characters with an ellipsis between; short strings are returned unchanged.\n * Kept local (not `@funkit/utils`) so connect-rn doesn't take that dep just for\n * one formatter, and so the lead/trail counts can match the RN design.\n */\nexport function formatDepositAddress(\n address: string | undefined,\n leading = 6,\n trailing = 6,\n): string {\n if (!address) {\n return ''\n }\n if (address.length <= leading + trailing) {\n return address\n }\n return `${address.slice(0, leading)}\u2026${address.slice(-trailing)}`\n}\n", "import { useCallback, useEffect, useRef } from 'react'\n\nimport { logger } from '../../logging/logger'\nimport type { ClipboardWriter } from '../clipboard'\n\nexport interface UseCopyDepositAddressParams {\n copyToClipboard: ClipboardWriter\n /** Shows the \"Address copied\" toast. */\n onCopySuccess: () => void\n isTransferOpen: boolean\n /** Undefined while it's still generating. */\n address: string | undefined\n}\n\n/**\n * The Copy buttons' clipboard write + toast, plus the auto-copy when Transfer\n * opens and whenever the address changes.\n *\n * The returned write never rejects; `false` means the address wasn't copied.\n */\nexport function useCopyDepositAddress({\n copyToClipboard,\n onCopySuccess,\n isTransferOpen,\n address,\n}: UseCopyDepositAddressParams): (value: string) => Promise<boolean> {\n const copyAddress = useCallback(\n async (value: string): Promise<boolean> => {\n try {\n // A void return is success (see ClipboardWriter).\n const ok = (await copyToClipboard(value)) !== false\n if (ok) {\n onCopySuccess()\n }\n return ok\n } catch (error) {\n // Only host-injected writers reject; the default is already guarded.\n logger.warn('connect-rn: clipboard write threw; address not copied', {\n error: error instanceof Error ? error.message : String(error),\n })\n return false\n }\n },\n [copyToClipboard, onCopySuccess],\n )\n\n // Keyed on the address, so a switch between chains sharing one doesn't\n // re-copy; cleared on leaving Transfer so re-opening copies again.\n const copiedAddressRef = useRef<string | undefined>(undefined)\n useEffect(() => {\n if (!isTransferOpen) {\n copiedAddressRef.current = undefined\n return\n }\n if (!address || copiedAddressRef.current === address) {\n return\n }\n copiedAddressRef.current = address\n void copyAddress(address)\n }, [isTransferOpen, address, copyAddress])\n\n return copyAddress\n}\n", "import { getFiatExchangeRates } from '@funkit/api-base'\nimport { useQuery } from '@tanstack/react-query'\n\nimport { logger } from '../../logging/logger'\n\n/**\n * RN port of web's `useFiatExchangeRates`: the fiat exchange-rate table used to\n * convert the host's USD source balance into Swapped's EUR sell cap. Keyless\n * endpoint, cached for an hour (rates barely move within a session).\n */\nexport function useFiatExchangeRates(enabled = true) {\n const { data, isLoading, error } = useQuery({\n queryKey: ['fiatExchangeRates'],\n queryFn: () => getFiatExchangeRates({ logger }),\n refetchOnMount: false,\n refetchOnReconnect: false,\n refetchOnWindowFocus: false,\n gcTime: 1000 * 60 * 60, // 1 hour\n enabled,\n })\n\n return { data, isLoading, error }\n}\n", "import {\n type RecipientTarget,\n type SwappedFormOfPayment,\n getFops,\n} from '@funkit/api-base'\nimport {\n FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS,\n solanaChain,\n} from '@funkit/chains'\nimport {\n DEFAULT_FIAT_CURRENCY,\n FOPS_STALE_TIME,\n buildSwappedThirdPartyPaymentConfigs,\n getConfiguredMinDepositUsd,\n getDepositAddressForChain,\n getMinTransferValueEur,\n sortFops,\n useSwappedDefaultCurrencyQuery,\n} from '@funkit/connect-core'\nimport { useDynamicConfig } from '../../statsig/useDynamicConfig'\nimport { useTheme } from '@shopify/restyle'\nimport { useQuery } from '@tanstack/react-query'\nimport { useMemo } from 'react'\n\nimport type { DepositCheckoutConfig } from '../../flow/depositFlowConfig'\nimport { useUserIpInfo } from '../../geo/useUserIpInfo'\nimport { useFunkitIdentity } from '../../identity/IdentityContext'\nimport { logger } from '../../logging/logger'\nimport { buildSwappedThemeQueryParamsRN } from '../../swapped/buildSwappedTheme'\nimport type { FunkitTheme } from '../../theme/toRestyleTheme'\nimport { useFiatExchangeRates } from './useFiatExchangeRates'\nimport { useTransferInit } from './useTransferInit'\n\n// Swapped enumerates region-specific payment methods by country, so the /fops\n// call needs *a* country. We send the user's real country (resolved from their\n// IP via {@link useUserIpInfo}), falling back to this default while the geo\n// lookup is in flight or if it fails \u2014 so the cash list still populates.\n//\n// TODO(connect-rn): per-region geoblocking. Web also compares `blockedcountries`\n// (Statsig) against the resolved country and disables/hides methods for blocked\n// regions (`useFunkitUserIp().isUserGeoblocked` \u2192\n// `PaymentMethodDisabledBadge reason=\"geoblocked\"`). This wires the country in;\n// the per-method gating is the remaining step.\nconst DEFAULT_COUNTRY_CODE = 'US'\n\nexport interface UseFopsParams {\n /**\n * Destination chain/asset \u2014 drives the deposit recipient + FOP query. Its\n * optional `getMinDepositUSD` feeds the fiat (Swapped) buy minimum.\n */\n checkoutConfig: DepositCheckoutConfig | undefined\n dynamicRoutingId?: string\n enabled?: boolean\n}\n\nexport interface UseFopsResult {\n /**\n * The user's saved forms of payment (e.g. \"Mastercard (\u20263869)\"). Rendered at\n * the top of the Add money list, above the Crypto row \u2014 mirroring web, where\n * saved FOPs sort first.\n */\n savedFops: SwappedFormOfPayment[]\n /** Generic forms of payment (Card / Apple Pay / Revolut Pay / Bank Transfer). */\n genericFops: SwappedFormOfPayment[]\n isLoading: boolean\n isFetching: boolean\n /** The FOPs fetch failed (network / API). Drives the Add money error state. */\n isError: boolean\n /** Re-run the FOPs fetch (the Add money \"Try again\" action). */\n refetch: () => void\n /** Whether Swapped (cash) methods are offered at all. */\n isSwappedEnabled: boolean\n}\n\n/**\n * Thin RN port of `@funkit/connect`'s `useFops`: fetches the Swapped forms of\n * payment (`getFops`) that populate the \"Use Cash\" tab. Identity comes from\n * {@link useFunkitIdentity}; the deposit recipient is derived from\n * {@link useTransferInit} + the core `getDepositAddressForChain`.\n *\n * Theme, buy minimum, and region currency reach web parity (see the inline\n * notes below). V1 still omits web's per-region geoblocking and `validateFops`.\n */\nexport function useFops({\n checkoutConfig,\n dynamicRoutingId,\n enabled = true,\n}: UseFopsParams): UseFopsResult {\n const isSwappedEnabled = !!useDynamicConfig('enableswappeddeposit')\n const input = useFopsQueryInput({\n checkoutConfig,\n dynamicRoutingId,\n enabled: enabled && isSwappedEnabled,\n })\n const query = useDoFetchFops(input)\n\n // The region-currency / rate lookups keep the fetch disabled, and a disabled\n // query's `isLoading` reads false \u2014 indistinguishable from \"settled, no cash\n // methods\". Cover those windows too, or callers paint a cash-less list before\n // /fops has even been requested.\n const isLoading =\n isSwappedEnabled &&\n (input.isDependencyLoading || (input.enabled && query.isLoading))\n\n return {\n savedFops: query.data?.savedFormsOfPayments ?? [],\n genericFops: query.data?.genericFormsOfPayments ?? [],\n isLoading,\n isFetching: input.isTransferInitFetching,\n isError: query.isError,\n refetch: () => void query.refetch(),\n isSwappedEnabled,\n }\n}\n\n/**\n * Resolves the /fops request into a query key \u2014 identity, region (country +\n * fiat currency), Swapped theme, deposit recipient, EUR buy minimum \u2014 plus\n * whether the fetch may run and which upstream lookups are still pending.\n *\n * The key and the loading flags live together on purpose: a dependency added to\n * the key has to declare its loading state right here, so it can't be forgotten\n * when `useFops` composes `isLoading`.\n */\nfunction useFopsQueryInput({\n checkoutConfig,\n dynamicRoutingId,\n enabled,\n}: {\n checkoutConfig: DepositCheckoutConfig | undefined\n dynamicRoutingId: string | undefined\n enabled: boolean\n}) {\n const { apiKey, userId, prefillFiatEmail } = useFunkitIdentity()\n const fopPriority = useDynamicConfig('foppriority')\n\n // Real country from the user's IP; default while it loads / if it fails.\n const { userIpInfo } = useUserIpInfo()\n\n // Region-default fiat currency (web parity); falls back to USD. Resolved from\n // the *real* IP country (not the DEFAULT_COUNTRY_CODE fallback above) so a\n // non-US user isn't briefly quoted in USD. Gating /fops on its loading state\n // avoids an initial USD fetch that refetches once the region currency resolves.\n const {\n data: fiatCurrencyCode = DEFAULT_FIAT_CURRENCY,\n isLoading: isFiatCurrencyCodeLoading,\n } = useSwappedDefaultCurrencyQuery({\n apiKey,\n countryCode: userIpInfo?.alpha2,\n logger,\n })\n\n // Loading-state theme baked into the returned embeddedFlowUrls (web parity).\n const theme = useTheme<FunkitTheme>()\n const themeConfig = useMemo(\n () => buildSwappedThemeQueryParamsRN(theme),\n [theme],\n )\n\n const {\n transferInit,\n isLoading: isTransferInitLoading,\n isFetching: isTransferInitFetching,\n } = useTransferInit({ checkoutConfig, dynamicRoutingId, enabled })\n\n const targetAsset = checkoutConfig?.targetAsset\n const targetChain = checkoutConfig?.targetChain\n const recipientAddress = targetChain\n ? getDepositAddressForChain(Number(targetChain), transferInit)\n : undefined\n\n const { defaultMinAmount, isLoading: isExchangeRatesLoading } =\n useDefaultMinAmountEur({ checkoutConfig, dynamicRoutingId, enabled })\n\n return {\n // `prefillFiatEmail` is intentionally kept out of the key (web parity):\n // it's read at fetch time, so post-mount changes don't refetch.\n queryKey: [\n 'fops',\n {\n apiKey,\n userId,\n recipientAddress,\n solanaAddress: transferInit?.solanaAddr,\n targetAsset,\n targetChain,\n // fallback to DEFAULT_COUNTRY_CODE, do not use it in useSwappedDefaultCurrencyQuery\n countryCode: userIpInfo?.alpha2 || DEFAULT_COUNTRY_CODE,\n fiatCurrencyCode,\n fopPriority,\n themeConfig,\n defaultMinAmount,\n },\n ] as const,\n prefillFiatEmail,\n enabled:\n enabled &&\n !!apiKey &&\n !!targetAsset &&\n !!targetChain &&\n !!recipientAddress &&\n !!transferInit &&\n !isFiatCurrencyCodeLoading &&\n !isExchangeRatesLoading,\n isDependencyLoading:\n isTransferInitLoading ||\n isFiatCurrencyCodeLoading ||\n isExchangeRatesLoading,\n isTransferInitFetching,\n }\n}\n\n/**\n * Swapped enforces its own minimum inside the widget; we hand it the same floor\n * web sends (shared `getMinTransferValueEur`) \u2014 the chain transfer minimum plus\n * the config's `getMinDepositUSD`, converted to EUR. Callers gate /fops on\n * `isLoading` so the first request already carries the real EUR floor rather\n * than a 1:1 estimate that later churns the query key.\n */\nfunction useDefaultMinAmountEur({\n checkoutConfig,\n dynamicRoutingId,\n enabled,\n}: {\n checkoutConfig: DepositCheckoutConfig | undefined\n dynamicRoutingId: string | undefined\n enabled: boolean\n}) {\n const minTransferLimits = useDynamicConfig('mintokentransfervalue')\n const { data: exchangeRates, isLoading } = useFiatExchangeRates(enabled)\n\n const targetChain = checkoutConfig?.targetChain\n const defaultMinAmount = getMinTransferValueEur(\n targetChain ? Number(targetChain) : undefined,\n minTransferLimits,\n getConfiguredMinDepositUsd({\n targetChain,\n targetAsset: checkoutConfig?.targetAsset,\n dynamicRoutingId,\n getMinDepositUSD: checkoutConfig?.getMinDepositUSD,\n }),\n exchangeRates,\n )\n\n return { defaultMinAmount, isLoading }\n}\n\n/** Runs the /fops fetch off the key built by {@link useFopsQueryInput}. */\nfunction useDoFetchFops({\n queryKey,\n prefillFiatEmail,\n enabled,\n}: ReturnType<typeof useFopsQueryInput>) {\n return useQuery({\n queryKey,\n queryFn: async ({ queryKey: [_, params] }) => {\n const { recipientAddress, targetAsset, targetChain, fopPriority } = params\n if (!recipientAddress || !targetChain || !targetAsset) {\n return { genericFormsOfPayments: [], savedFormsOfPayments: [] }\n }\n const destinationToken = { chainId: targetChain, address: targetAsset }\n // Swapped recommends a Solana fallback recipient when one was minted.\n const recipientTargets: RecipientTarget[] = [\n { recipientAddress, destinationToken },\n ...(params.solanaAddress\n ? [\n {\n recipientAddress: params.solanaAddress,\n destinationToken: {\n chainId: solanaChain.id.toString(),\n address: FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS,\n },\n },\n ]\n : []),\n ]\n\n const response = await getFops({\n apiKey: params.apiKey,\n logger,\n params: {\n recipientAddress,\n userId: params.userId,\n destinationToken,\n fiatCurrencyCode: params.fiatCurrencyCode,\n countryCode: params.countryCode,\n recipientTargets,\n thirdPartyPaymentConfigs: buildSwappedThirdPartyPaymentConfigs({\n prefillFiatEmail,\n themeConfig: params.themeConfig,\n logTag: 'connect-rn:useFops',\n logger,\n }),\n checkoutLimitsCriteria: { defaultMinAmount: params.defaultMinAmount },\n },\n })\n\n return {\n genericFormsOfPayments: sortFops(\n response.genericFormsOfPayments,\n fopPriority,\n ),\n savedFormsOfPayments: sortFops(\n response.savedFormsOfPayments,\n fopPriority,\n ),\n }\n },\n enabled,\n staleTime: FOPS_STALE_TIME,\n refetchOnWindowFocus: false,\n })\n}\n", "import {\n type CheckoutInitTokenTransferResponse,\n type FunAddress,\n initializeCheckoutTokenTransferAddress,\n} from '@funkit/api-base'\nimport {\n type CheckoutTokenTransferConfig,\n getCheckoutTokenTransferParams,\n} from '@funkit/connect-core'\nimport { useQuery } from '@tanstack/react-query'\nimport { useEffect } from 'react'\n\nimport { useFunkitIdentity } from '../../identity/IdentityContext'\nimport { logger } from '../../logging/logger'\nimport { useLighterDepositRecipientOverride } from './useLighterDepositRecipientOverride'\nimport { useUDAParams } from './useUDAParams'\n\n// clientMetadata is stored alongside the transfer record; web ships a full\n// HistoricalCheckoutItem stub, but the thin RN flow has no checkout history, so\n// an empty object is sent. It MUST be a stable reference \u2014 re-creating it each\n// render would change the query and cause refetch/flicker.\nconst TRANSFER_CLIENT_METADATA: NonNullable<object> = {}\n\nexport interface UseTransferInitParams {\n /** Destination chain/asset to derive the deposit address for. */\n checkoutConfig: CheckoutTokenTransferConfig | undefined\n /** Final recipient. Defaults to the identity's wallet address. */\n recipientAddr?: FunAddress\n /** Dynamic-routing id used to resolve UDA params. */\n dynamicRoutingId?: string\n /** Gate the network call (e.g. only when the screen is visible). */\n enabled?: boolean\n}\n\nexport interface UseTransferInitResult {\n transferInit: CheckoutInitTokenTransferResponse | undefined\n recipientAddr: FunAddress\n isLoading: boolean\n isFetching: boolean\n}\n\n/**\n * Thin RN reimplementation of `@funkit/connect`'s `useCheckoutTransferInit`:\n * builds the (customer-agnostic) transfer params via the core helper and\n * creates the deposit-address EOA through `@funkit/api-base`. Identity comes\n * from {@link useFunkitIdentity}; web's Polymarket target override and geo /\n * post-action gating are dropped. Lighter's main-account override is kept \u2014\n * see {@link useLighterDepositRecipientOverride}.\n */\nexport function useTransferInit({\n checkoutConfig,\n recipientAddr,\n dynamicRoutingId,\n enabled = true,\n}: UseTransferInitParams): UseTransferInitResult {\n const { apiKey, userId, walletAddress } = useFunkitIdentity()\n const udaParams = useUDAParams(dynamicRoutingId)\n const {\n isLighterDeposit,\n recipientOverride: lighterRecipientOverride,\n isLookupFetching,\n lookupStatus,\n } = useLighterDepositRecipientOverride({\n apiKey,\n targetChain: udaParams?.targetChain,\n walletAddress,\n })\n\n // Mirrors web's useCheckoutTransferInit priority: a resolved Lighter L2\n // main-account index outranks an explicit recipientAddr override, which\n // outranks the wallet.\n const resolvedRecipient = ((): FunAddress => {\n if (isLighterDeposit && lighterRecipientOverride) {\n return lighterRecipientOverride as FunAddress\n }\n return (recipientAddr || walletAddress || '0x') as FunAddress\n })()\n\n // Lighter EOA generation targets the L2 main-account index \u2014 the backend\n // rejects a raw L1 wallet address. When the lookup is pending, failed, or\n // found no main account (and no explicit recipientAddr pins the\n // destination), hold the request instead of sending one that 400s.\n const isLighterWalletFallback =\n isLighterDeposit && !lighterRecipientOverride && !recipientAddr\n\n // Money-path decision log \u2014 same key/payload as web's useCheckoutTransferInit.\n useEffect(() => {\n if (isLighterDeposit && lighterRecipientOverride) {\n logger.info('checkout:recipient:lighterMainAccount', {\n mainAccountIndex: lighterRecipientOverride,\n targetChain: udaParams?.targetChain,\n })\n }\n }, [isLighterDeposit, lighterRecipientOverride, udaParams?.targetChain])\n\n // The hold is user-visible (no deposit address) \u2014 surface it once the lookup\n // settles without an index instead of staying silent.\n useEffect(() => {\n if (isLighterWalletFallback && !isLookupFetching) {\n logger.warn('checkout:recipient:lighterMainAccountUnresolved', {\n targetChain: udaParams?.targetChain,\n lookupStatus,\n })\n }\n }, [\n isLighterWalletFallback,\n isLookupFetching,\n lookupStatus,\n udaParams?.targetChain,\n ])\n\n // `undefined` when required params are missing \u2014 also disables the query.\n const params = getCheckoutTokenTransferParams({\n checkoutConfig,\n userId,\n apiKey,\n recipientAddr: resolvedRecipient,\n udaParams,\n })\n\n const { data, isLoading, isFetching } = useQuery({\n queryKey: ['initializeCheckoutTokenTransferAddress', params] as const,\n queryFn: ({ queryKey: [, queryParams] }) =>\n queryParams\n ? initializeCheckoutTokenTransferAddress({\n ...queryParams,\n logger,\n clientMetadata: TRANSFER_CLIENT_METADATA,\n })\n : undefined,\n enabled: enabled && !!params && !isLighterWalletFallback,\n refetchOnWindowFocus: false,\n refetchOnMount: false,\n })\n\n return {\n transferInit: isFetching ? undefined : data,\n recipientAddr: resolvedRecipient,\n isLoading,\n isFetching,\n }\n}\n", "import { LIGHTER_CHAIN_ID } from '@funkit/chains'\nimport { useLighterAccountsQuery } from '@funkit/connect-core'\nimport type { Address } from 'viem'\nimport { isLighterxyzApiKey } from '../../utils/customers'\n\nexport interface LighterDepositRecipientOverride {\n /** True when this deposit targets Lighter \u2014 callers must not fall back to the L1 wallet address. */\n isLighterDeposit: boolean\n /** The L2 main-account index. Undefined while the lookup is pending, failed, or found no main account. */\n recipientOverride: string | undefined\n /** True while the account lookup is in flight \u2014 an unresolved recipient is expected then. */\n isLookupFetching: boolean\n /** Lookup query status, for the unresolved-recipient WARN log. */\n lookupStatus: 'pending' | 'error' | 'success'\n}\n\n/**\n * Lighter EOA generation targets the L2 main-account index, not the L1\n * address \u2014 resolves it as a deposit recipientAddr override (mirrors web's\n * `useLighterAccounts`). `isLighterDeposit` lets callers withhold the L1\n * wallet fallback until `recipientOverride` resolves, since the backend\n * rejects an L1 address for Lighter.\n */\nexport function useLighterDepositRecipientOverride({\n apiKey,\n targetChain,\n walletAddress,\n}: {\n apiKey: string\n targetChain: string | undefined\n walletAddress: string | undefined\n}): LighterDepositRecipientOverride {\n const isLighterDeposit =\n isLighterxyzApiKey(apiKey) && targetChain === LIGHTER_CHAIN_ID.toString()\n\n const { mainAccountIndex, isFetching, status } = useLighterAccountsQuery({\n address: isLighterDeposit ? (walletAddress as Address) : undefined,\n })\n\n return {\n isLighterDeposit,\n recipientOverride: mainAccountIndex,\n isLookupFetching: isFetching,\n lookupStatus: status,\n }\n}\n", "import type { UDAConfig } from '@funkit/connect-core'\n\nimport { useDynamicConfig } from '../../statsig/useDynamicConfig'\nimport { useMemo } from 'react'\n\n/**\n * Thin RN reimplementation of `@funkit/connect`'s `useUDAParams`. Resolves the\n * Universal Deposit Address config for a dynamic-routing id from the\n * `uda_params` Statsig dynamic config. Unlike web, the routing id is passed in\n * (web reads it from the checkout context, which RN doesn't have).\n */\nexport function useUDAParams(dynamicRoutingId?: string): UDAConfig | undefined {\n const udaParams = useDynamicConfig('uda_params')\n return useMemo(\n () =>\n udaParams.find((param) => param.dynamicRoutingId === dynamicRoutingId)\n ?.params,\n [udaParams, dynamicRoutingId],\n )\n}\n", "import type { CheckoutInitTokenTransferResponse } from '@funkit/api-base'\nimport { getSupportedAssets } from '@funkit/api-base'\nimport {\n isTransferChainEnabled,\n resolveTokenTransferConfig,\n} from '@funkit/connect-core'\nimport { useDynamicConfig } from '../../statsig/useDynamicConfig'\nimport { useQuery } from '@tanstack/react-query'\nimport { useMemo } from 'react'\n\nimport { useFunkitIdentity } from '../../identity/IdentityContext'\nimport { logger } from '../../logging/logger'\nimport {\n buildSupportedTokenList,\n type SupportedToken,\n type TokenChainFilter,\n} from '../supportedTokens'\n\nexport interface UseSupportedTokensResult {\n /** Curated deposit tokens (no icons attached), priority symbols first. */\n tokens: SupportedToken[]\n /** `All` + one chip per configured chain. */\n chainFilters: TokenChainFilter[]\n isLoading: boolean\n}\n\n/**\n * Fetch + resolve the deposit token list the same way the web SDK does: the\n * curated Statsig `tokentransferconfig` (chains + asset addresses), filtered by\n * the disabled list and merged with `@funkit/api-base`'s `getSupportedAssets`\n * metadata (`resolveTokenTransferConfig`, shared via connect-core) \u2014 NOT the raw\n * allow-list. Identity (apiKey) comes from {@link useFunkitIdentity}; the query\n * is disabled until an apiKey is present.\n *\n * `transferInit` gates which chains are offered: Solana / Bitcoin / Tron only\n * appear once the deposit-init response carries their address (mirrors web's\n * `useEnabledTokenTransferChainTokens` via the shared `isTransferChainEnabled`).\n */\nexport function useSupportedTokens({\n enabled = true,\n transferInit,\n}: {\n enabled?: boolean\n transferInit?: CheckoutInitTokenTransferResponse\n} = {}): UseSupportedTokensResult {\n const { apiKey } = useFunkitIdentity()\n const tokenTransferConfig = useDynamicConfig('tokentransferconfig')\n const disabledChainAssets = useDynamicConfig(\n 'disabletokentransferchainsandassets',\n )\n\n const { data, isLoading } = useQuery({\n queryKey: ['getSupportedAssets', apiKey] as const,\n queryFn: ({ queryKey: [, key] }) =>\n getSupportedAssets({ apiKey: key, logger }),\n enabled: enabled && !!apiKey,\n staleTime: 5 * 60_000,\n refetchOnWindowFocus: false,\n })\n\n const { tokens, chainFilters } = useMemo(() => {\n if (!data) {\n return { tokens: [], chainFilters: [{ id: 'all', label: 'All' }] }\n }\n const resolved = resolveTokenTransferConfig({\n chainConfigs: tokenTransferConfig.chains ?? [],\n priorityTokens: tokenTransferConfig.priorityTokens ?? [],\n disabledChainAssets,\n supportedAssets: data,\n logger,\n })\n const built = buildSupportedTokenList(resolved)\n\n // Hide chains whose deposit address hasn't been minted (Solana/Bitcoin/Tron)\n // \u2014 leaving EVM chains always enabled. The `all` chip is always kept.\n const isEnabled = (chainId: number | undefined) =>\n chainId == null || isTransferChainEnabled(chainId, transferInit)\n return {\n tokens: built.tokens.filter((t) => isEnabled(t.chainId)),\n chainFilters: built.chainFilters.filter(\n (c) => c.id === 'all' || isEnabled(Number(c.id)),\n ),\n }\n }, [data, tokenTransferConfig, disabledChainAssets, transferInit])\n\n return { tokens, chainFilters, isLoading }\n}\n", "import type { TokenTransferConfigResult } from '@funkit/connect-core'\n\n/**\n * One curated deposit token (chain + asset), produced from the resolved\n * `tokentransferconfig`. Consumed by the deposit flow (its chains drive the\n * \"Available chains\" list).\n */\nexport interface SupportedToken {\n id: string\n symbol: string\n /** Chain shown on the trailing side, e.g. \"Ethereum\". */\n chainLabel: string\n /** Numeric chain id \u2014 used to derive the available-chains list + re-target. */\n chainId?: number\n /** Token contract address. */\n address?: string\n}\n\n/** A curated chain entry. The first is usually `{ id: 'all', label: 'All' }`. */\nexport interface TokenChainFilter {\n id: string\n label: string\n}\n\n/**\n * Flatten a resolved token-transfer config (the curated Statsig\n * `tokentransferconfig` merged with `/assets/supported` metadata \u2014 see\n * `resolveTokenTransferConfig`) into the supported-tokens screen's token rows +\n * chain-filter chips. One row per curated (chain, asset); chains keep their\n * config order; priority symbols float to the top. NOT the raw allow-list, so\n * no meme coins \u2014 only the customer's configured deposit tokens.\n */\nexport function buildSupportedTokenList(resolved: TokenTransferConfigResult): {\n tokens: SupportedToken[]\n chainFilters: TokenChainFilter[]\n} {\n const priorityIndex = new Map(\n resolved.priorityTokenSymbols.map((symbol, i) => [symbol, i]),\n )\n\n const tokens: SupportedToken[] = []\n const chainFilters: TokenChainFilter[] = [{ id: 'all', label: 'All' }]\n\n for (const chainId of resolved.chainIdSortOrder) {\n const assets = Object.values(resolved.supportedAssets[chainId] ?? {})\n if (assets.length === 0) {\n continue\n }\n chainFilters.push({ id: String(chainId), label: assets[0].chainName })\n for (const asset of assets) {\n tokens.push({\n id: `${asset.chainId}:${asset.address}`,\n symbol: asset.symbol,\n chainLabel: asset.chainName,\n chainId: Number(asset.chainId),\n address: asset.address,\n })\n }\n }\n\n // Stable sort: priority symbols first (in priority order); everything else\n // keeps its chain/insertion order.\n const rank = (symbol: string) =>\n priorityIndex.get(symbol) ?? Number.POSITIVE_INFINITY\n tokens.sort((a, b) => rank(a.symbol) - rank(b.symbol))\n\n return { tokens, chainFilters }\n}\n", "import type {\n CheckoutInitTokenTransferResponse,\n FunAddress,\n} from '@funkit/api-base'\nimport { bitcoinChain, solanaChain, tronChain } from '@funkit/chains'\nimport {\n type CheckoutTokenTransferConfig,\n type QRCodeUri,\n type TransferTokenQrCodeType,\n getDepositAddressForChain,\n getTransferTokenQrCodeUri,\n} from '@funkit/connect-core'\n\nimport { useTransferInit } from './useTransferInit'\n\n// Web applies a per-customer slippage matrix; the thin RN flow uses a single\n// default (web's fallback value) until a customer needs otherwise.\nconst DEFAULT_MAX_SLIPPAGE_PERCENT = 0.25\n\nfunction resolveBlockchain(\n chainId: number | undefined,\n): TransferTokenQrCodeType {\n if (chainId === solanaChain.id) {\n return 'solana'\n }\n if (chainId === bitcoinChain.id) {\n return 'bitcoin'\n }\n if (chainId === tronChain.id) {\n return 'tron'\n }\n return 'ethereum'\n}\n\nexport interface UseTokenTransferParams {\n checkoutConfig: CheckoutTokenTransferConfig | undefined\n /** Chain the user picked to send funds on. */\n selectedChainId: number | undefined\n dynamicRoutingId?: string\n enabled?: boolean\n}\n\nexport interface UseTokenTransferResult {\n /** Where the user sends funds first. */\n depositAddress: FunAddress | undefined\n /** Raw deposit-init response (per-chain addresses); gates which chains show. */\n transferInit: CheckoutInitTokenTransferResponse | undefined\n /** Final destination of the funds. */\n recipientAddr: string\n /** Default max slippage, as a percent. */\n maxSlippagePercent: number\n qrCodeUri: QRCodeUri | undefined\n blockchain: TransferTokenQrCodeType\n isLoading: boolean\n}\n\n/**\n * Thin RN reimplementation of `@funkit/connect`'s `useTokenTransfer`: resolves\n * the deposit address + QR URI for the selected chain. The web hook's i18n\n * tooltips, fiat conversion, price-impact estimate, per-customer slippage, and\n * Polygon \"original recipient\" special-case are intentionally omitted. (The\n * per-chain minimums are computed in `buildAvailableChains`, not here.)\n */\nexport function useTokenTransfer({\n checkoutConfig,\n selectedChainId,\n dynamicRoutingId,\n enabled,\n}: UseTokenTransferParams): UseTokenTransferResult {\n const { transferInit, recipientAddr, isLoading } = useTransferInit({\n checkoutConfig,\n dynamicRoutingId,\n enabled,\n })\n\n const depositAddress =\n selectedChainId !== undefined\n ? getDepositAddressForChain(selectedChainId, transferInit)\n : undefined\n\n const blockchain = resolveBlockchain(selectedChainId)\n\n const qrCodeUri = depositAddress\n ? getTransferTokenQrCodeUri({ depositAddress, type: blockchain })\n : undefined\n\n return {\n depositAddress,\n transferInit,\n recipientAddr,\n maxSlippagePercent: DEFAULT_MAX_SLIPPAGE_PERCENT,\n qrCodeUri,\n blockchain,\n isLoading,\n }\n}\n", "import QRCode from 'react-native-qrcode-svg'\n\n/**\n * Renders the scannable deposit QR from the EIP-681 URI produced by the\n * transfer hooks (e.g. `ethereum:0x\u2026`). Built on `react-native-qrcode-svg`\n * (which renders via `react-native-svg`, already a peer for the CDN icons).\n *\n * The QR is always drawn as near-black (`#101010`, matching the Figma deposit\n * frame) modules on a white cell \u2014 fixed colors, NOT the Restyle theme: in dark\n * mode `textPrimary` is light, which over the light cell background renders\n * white-on-white (invisible/unscannable). QR contrast must hold regardless of\n * the app's color scheme.\n */\nexport interface QrCodeProps {\n /** The value to encode \u2014 the EIP-681 URI / address from `useTokenTransfer`. */\n value: string\n size?: number\n /**\n * Error-correction level. Defaults to `'H'` (highest) so the centered\n * chain-logo overlay ({@link QrChainCluster}) stays within scannable\n * tolerance.\n */\n ecl?: 'L' | 'M' | 'Q' | 'H'\n}\n\nexport function QrCode({ value, size = 220, ecl = 'H' }: QrCodeProps) {\n return (\n <QRCode\n value={value}\n size={size}\n ecl={ecl}\n color=\"#101010\"\n backgroundColor=\"#FFFFFF\"\n />\n )\n}\n", "import type {\n CheckoutTokenTransferConfig,\n DynamicTargetAssetCandidate,\n MinDepositTarget,\n} from '@funkit/connect-core'\nimport type { ReactNode } from 'react'\n\nimport type {\n SupportedToken,\n TokenChainFilter,\n} from '../transfer/supportedTokens'\n\nexport type { DynamicTargetAssetCandidate } from '@funkit/connect-core'\n\n/**\n * Destination chain/asset for a deposit, plus the customer `getMinDepositUSD`\n * closure that feeds the transfer minimums and the fiat (Swapped) buy floor.\n * The web `FunkitCheckoutConfig` satisfies this structurally. Named once here so\n * the flow provider and `useFops` share exactly one shape.\n */\nexport type DepositCheckoutConfig = CheckoutTokenTransferConfig &\n Pick<MinDepositTarget, 'getMinDepositUSD'>\n\n/**\n * Resolve the active target-asset candidate from a list + routing id (RN-only).\n *\n * This is intentionally NOT a drop-in equivalent of web's\n * `getDefaultDynamicTargetAsset` (`packages/connect/src/utils/assets.ts`), which\n * takes the whole checkout config (synthesizing a guaranteed fallback) and adds\n * a `tokenSymbol === targetAssetTicker` match step. The RN flow only needs to\n * pick a candidate from the configured list:\n *\n * 1. Match `dynamicRoutingId`\n * 2. Match `isDefault`\n * 3. First candidate\n */\nexport function getDefaultDynamicTargetAsset(\n candidates: DynamicTargetAssetCandidate[] | undefined,\n dynamicRoutingId: string | undefined,\n): DynamicTargetAssetCandidate | undefined {\n if (!candidates?.length) return undefined\n if (candidates.length === 1) return candidates[0]\n\n const routingId = dynamicRoutingId ?? ''\n return (\n candidates.find((c) => c.dynamicRoutingId === routingId) ??\n candidates.find((c) => c.isDefault) ??\n candidates[0]\n )\n}\n\n/**\n * @deprecated Unused \u2014 the deposit chain is chosen on the Select chain screen,\n * which lists every curated chain individually instead of network segments.\n */\nexport interface ChainOption {\n /** Stable id used for selection (e.g. the network id). */\n id: string\n label: string\n /**\n * CDN chain keys for the segment glyph: one \u2192 a single logo, several \u2192 a 2\u00D72\n * cluster (e.g. the EVM group).\n */\n iconKeys?: string[]\n /**\n * Numeric chain id this network selects \u2014 drives which generated deposit\n * address + QR (EVM / Solana / Bitcoin / Tron) the flow shows.\n */\n chainId?: number\n}\n\n/**\n * Data the managed deposit flow renders.\n *\n * The deposit address + QR are now SDK-generated: given `checkoutConfig` (the\n * destination chain/asset) and the identity on `<FunkitProvider>`, the flow\n * resolves the Universal Deposit Address and EIP-681 QR URI via the transfer\n * hooks. `depositAddress`/`qrCode` remain as optional host overrides / fallbacks\n * (shown while generation is loading or when no identity is configured).\n *\n * TODO(connect-rn): source the remaining lists internally too \u2014 payment methods\n * from config/Statsig, supported tokens from `@funkit/api-base` \u2014 so\n * `beginDeposit` ultimately takes just a target, like the web `beginCheckout`.\n */\nexport interface DepositFlowConfig {\n /**\n * Candidate target assets for the \"Deposit to\" row, following web's\n * `FunkitCheckoutConfig.dynamicTargetAssetCandidates`. The active candidate is\n * resolved via {@link getDefaultDynamicTargetAsset} using `dynamicRoutingId`.\n * Omit to hide the deposit-target row.\n */\n dynamicTargetAssetCandidates?: DynamicTargetAssetCandidate[]\n /**\n * Destination of the deposit (target chain + asset). Drives deposit-address\n * generation via the transfer hooks, and its optional `getMinDepositUSD`\n * feeds the per-chain transfer minimums and the fiat (Swapped) sell floor.\n * The web `FunkitCheckoutConfig` satisfies this structurally.\n */\n checkoutConfig?: DepositCheckoutConfig\n /**\n * @deprecated Ignored \u2014 the user picks the source chain on the Select chain\n * screen, which drives the generated address and QR type.\n */\n sourceChain?: string\n /** Dynamic-routing id used to resolve UDA params for `checkoutConfig`. */\n dynamicRoutingId?: string\n /**\n * Deposit address fallback/override. The flow prefers the SDK-generated\n * address; this is shown while it loads or when generation is unavailable\n * (no identity). Display formatting (truncation) is applied by the flow.\n */\n depositAddress?: string\n /** Tokens shown on the supported-tokens screen (host-filtered). */\n supportedTokens?: SupportedToken[]\n tokenChainFilters?: TokenChainFilter[]\n /**\n * QR code override. By default the flow renders the generated EIP-681 URI\n * with `react-native-qrcode-svg`; supply a node only to override.\n */\n qrCode?: ReactNode\n}\n\n/** Lifecycle callbacks passed to `useFunkitCheckout`. */\nexport interface DepositFlowCallbacks {\n onOpen?: () => void\n onClose?: () => void\n onCheckoutBlocked?: () => void\n}\n", "import {\n type ComponentProps,\n type ReactNode,\n useCallback,\n useEffect,\n useRef,\n} from 'react'\nimport { StyleSheet, View, type ViewStyle } from 'react-native'\nimport {\n BottomSheetBackdrop,\n type BottomSheetBackgroundProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n useBottomSheetTimingConfigs,\n} from '@gorhom/bottom-sheet'\nimport { Easing } from 'react-native-reanimated'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { SheetContent, sheetSizing } from '../components/SheetContent'\nimport { useTheme } from '../theme/restyle'\nimport { useKeyboardHeight } from './useKeyboardHeight'\n\n/**\n * Host-supplied blur laid under the sheet's scrim. The package ships no blur\n * module of its own \u2014 every option is native, so it would cost consumers a\n * rebuild and a peer-dep bump. Rendered into a full-bleed container, so\n * `flex: 1` or `StyleSheet.absoluteFill` fills the screen.\n */\nexport type BackdropBlurRenderer = () => ReactNode\n\nexport interface FlowSheetProps {\n isOpen: boolean\n /**\n * Per-`beginDeposit` id. A change while open re-presents the sheet, which\n * cancels an in-flight dismiss \u2014 so opening a new session mid-swipe-dismiss\n * isn't closed by the previous session's late `onDismiss`.\n */\n session: number\n onClose: () => void\n /** The flow screens rendered inside the sheet. */\n content: ReactNode\n /** The host app subtree the sheet is presented above. */\n children: ReactNode\n /**\n * Lift the sheet above the keyboard. Scoped to the screen that needs it (the\n * Swapped embed's WebView): a generic flow screen with no inputs shouldn't\n * subscribe to keyboard events, and a future `BottomSheetTextInput` screen\n * would be handled by gorhom natively instead. See {@link useKeyboardHeight}.\n */\n keyboardAvoidEnabled?: boolean\n enableSwipeToDismiss?: boolean\n /** Let the sheet reach the top of the screen for a screen that is a full window tall. */\n fullHeight?: boolean\n /** Optional blur behind the scrim. See {@link BackdropBlurRenderer}. */\n renderBackdropBlur?: BackdropBlurRenderer\n}\n\n/** The subset of `BottomSheetModal`'s imperative handle the flow drives. */\ninterface SheetHandle {\n present: () => void\n dismiss: () => void\n}\n\n/**\n * Host for the managed deposit-flow surface: a `@gorhom/bottom-sheet` modal\n * (native gestures + spring physics), sized to its content. The flow screens\n * draw their own grabber, so the sheet runs handle-less; its surface is painted\n * by {@link FlowSheetBackground} (which also fills the over-drag gap).\n *\n * Requires the gorhom peer stack (`@gorhom/bottom-sheet`,\n * `react-native-gesture-handler`, `react-native-reanimated`) and a\n * `<GestureHandlerRootView>` at the app root.\n */\nexport function FlowSheet({\n isOpen,\n session,\n onClose,\n content,\n children,\n keyboardAvoidEnabled = false,\n enableSwipeToDismiss = true,\n fullHeight = false,\n renderBackdropBlur,\n}: FlowSheetProps) {\n const ref = useRef<SheetHandle | null>(null)\n const setRef = useCallback((instance: SheetHandle | null) => {\n ref.current = instance\n }, [])\n\n const keyboardHeight = useKeyboardHeight(keyboardAvoidEnabled)\n const insets = useSafeAreaInsets()\n const theme = useTheme()\n\n // Bridge the flow's `isOpen` state onto the modal's imperative present/dismiss.\n // Two guards avoid gorhom's \"dismiss on an already-closed modal \u2192 unmount +\n // mark DISMISSED (can't re-present)\" footgun:\n // - `hasPresented`: never dismiss a modal we never presented (initial mount).\n // - `sheetSelfDismissed`: when a swipe/backdrop closes the sheet, gorhom\n // already dismissed it and fired onDismiss \u2192 onClose \u2192 isOpen=false; skip\n // the redundant dismiss so it can reopen.\n const hasPresented = useRef(false)\n const sheetSelfDismissed = useRef(false)\n useEffect(() => {\n if (isOpen) {\n sheetSelfDismissed.current = false\n ref.current?.present()\n hasPresented.current = true\n return\n }\n if (!hasPresented.current) return\n hasPresented.current = false\n if (sheetSelfDismissed.current) {\n sheetSelfDismissed.current = false\n return\n }\n ref.current?.dismiss()\n // `session` is a dep so a new beginDeposit while open re-presents (and\n // cancels any in-flight dismiss) rather than leaving a stale close pending.\n }, [isOpen, session])\n\n const handleDismiss = useCallback(() => {\n sheetSelfDismissed.current = true\n onClose()\n }, [onClose])\n\n // Smooth the dynamic-size morph: when the active flow screen changes height,\n // gorhom recomputes the dynamic snap point and animates to it with these\n // configs (this also governs present/dismiss). Ease-out cubic-bezier\n // (0.22, 1, 0.36, 1) over 300ms matches the team's container-resize motion\n // token, so the sheet tweens between screen heights instead of snapping.\n const animationConfigs = useBottomSheetTimingConfigs({\n duration: 300,\n easing: Easing.bezier(0.22, 1, 0.36, 1),\n })\n\n // Both layers hang off gorhom's backdrop so its fade and tap-to-close own\n // them, with the scrim over the blur (the design's `backdrop-filter` order).\n const renderBackdrop = useCallback(\n (props: ComponentProps<typeof BottomSheetBackdrop>) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n pressBehavior=\"close\"\n // gorhom's backdrop paints opaque black scaled by `opacity`; the alpha\n // rides our scrim color instead, so the container clears to transparent\n // and `opacity` only drives the fade.\n opacity={1}\n style={backdropContainer}\n >\n {renderBackdropBlur ? (\n <View style={StyleSheet.absoluteFill} pointerEvents=\"none\">\n {renderBackdropBlur()}\n </View>\n ) : null}\n <View\n style={[scrim, { backgroundColor: theme.background.overlay }]}\n pointerEvents=\"none\"\n />\n </BottomSheetBackdrop>\n ),\n [renderBackdropBlur, theme.background.overlay],\n )\n\n return (\n <BottomSheetModalProvider>\n {children}\n <BottomSheetModal\n ref={setRef}\n // We lift the sheet ourselves by growing the content (the spacer below,\n // driven by `keyboardAvoidEnabled`). gorhom doesn't react to the\n // WebView's keyboard, so `extend` just keeps it at its (grown) content\n // height \u2014 our spacer is the single source of truth.\n keyboardBehavior=\"extend\"\n // While the keyboard is up, disable over-drag: rubber-banding the sheet\n // up would otherwise lift the keyboard-compensation spacer into view as\n // blank space. Over-drag (and its surface fill, see FlowSheetBackground)\n // stays on the rest of the time.\n enableOverDrag={keyboardHeight === 0}\n // Full-height steps scroll with gorhom's scrollable, which can't be\n // measured (see sheetSizing); the rest are sized to their content.\n {...sheetSizing({ fullHeight })}\n // Cap the sheet at the bottom of the status bar: gorhom subtracts this\n // from the container height, so a tall screen tops out flush below it\n // instead of sliding behind it. A full-height screen waives the cap and\n // pays the inset itself, or the scrim shows as a strip above it.\n topInset={fullHeight ? 0 : insets.top}\n // Off on non-home screens: the drag rubber-bands back instead of\n // closing (gorhom keeps the pan gesture, just not the dismissal).\n enablePanDownToClose={enableSwipeToDismiss}\n animationConfigs={animationConfigs}\n onDismiss={handleDismiss}\n backdropComponent={renderBackdrop}\n // The flow screens render their own grabber; the sheet paints the\n // surface (see FlowSheetBackground) so over-drag doesn't expose a gap.\n handleComponent={null}\n backgroundComponent={FlowSheetBackground}\n >\n <SheetContent fullHeight={fullHeight}>\n {content}\n {/* Lift the sheet above the keyboard. The Swapped embed focuses an\n input inside its WebView (see useKeyboardHeight) which gorhom's\n keyboard handling can't see, so the sheet won't move on its own.\n Growing the dynamically-sized content by the keyboard height\n slides the whole sheet up instead of letting the keyboard overlap\n it (which reflows the WebView's viewport smaller \u2014 the \"shrink\").\n gorhom tweens the resize with `animationConfigs`. */}\n {keyboardHeight > 0 ? (\n <View style={{ height: keyboardHeight }} />\n ) : null}\n </SheetContent>\n </BottomSheetModal>\n </BottomSheetModalProvider>\n )\n}\n\n/**\n * Sheet surface for the flow modal. gorhom sizes the sheet body to its content,\n * so a flat background fills only the content area; over-dragging the sheet\n * above its content height lifts the body off the bottom and would otherwise\n * expose the backdrop below it (ENG-4340: \"you can see how the drawer ends\").\n *\n * We paint the `bgModal` surface (matching each screen's own surface + rounded\n * top) and hang a tall extension off the content's bottom edge. Anchored at\n * `top: '100%'`, the extension tracks the body as it lifts, so the rubber-band\n * over-drag reveals more surface instead of empty space \u2014 the bounce is kept.\n */\nexport function FlowSheetBackground({\n pointerEvents,\n style,\n}: BottomSheetBackgroundProps) {\n const theme = useTheme()\n const surface: ViewStyle = {\n backgroundColor: theme.background.modal,\n borderTopLeftRadius: theme.borderRadii.modal,\n borderTopRightRadius: theme.borderRadii.modal,\n }\n const extension: ViewStyle = {\n ...bottomExtension,\n backgroundColor: theme.background.modal,\n }\n return (\n <View pointerEvents={pointerEvents} style={[style, surface]}>\n <View style={extension} />\n </View>\n )\n}\n\nconst backdropContainer: ViewStyle = { backgroundColor: 'transparent' }\n\nconst scrim: ViewStyle = StyleSheet.absoluteFill\n\n// Comfortably taller than any phone screen so even a hard rubber-band pull never\n// drags past the surface; it extends below the device edge and stays off-screen\n// at rest.\nconst bottomExtension: ViewStyle = {\n position: 'absolute',\n top: '100%',\n left: 0,\n right: 0,\n height: 1000,\n}\n", "import { useEffect, useState } from 'react'\nimport { Keyboard, Platform } from 'react-native'\n\n/**\n * The on-screen keyboard height (0 when hidden), tracked from the global\n * keyboard events. Pass `enabled` to scope it to the screen that needs it: when\n * `false`, no listeners are registered and it always reports 0.\n *\n * This is the ONLY thing that lifts the flow sheet, for native inputs and the\n * Swapped WebView alike: gorhom's own avoidance runs `keyboardBehavior=\"extend\"`\n * under `enableDynamicSizing`, where the max snap point is already the content\n * height \u2014 a no-op, verified on device even with a `BottomSheetTextInput`.\n *\n * iOS emits the `Will` events (ahead of the keyboard animation, so the sheet\n * lifts in sync); Android only reliably emits the `Did` events.\n */\nexport function useKeyboardHeight(enabled: boolean): number {\n const [height, setHeight] = useState(0)\n useEffect(() => {\n if (!enabled) {\n setHeight(0)\n return\n }\n const showEvent =\n Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow'\n const hideEvent =\n Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide'\n const show = Keyboard.addListener(showEvent, (e) =>\n setHeight(e.endCoordinates.height),\n )\n const hide = Keyboard.addListener(hideEvent, () => setHeight(0))\n return () => {\n show.remove()\n hide.remove()\n }\n }, [enabled])\n return height\n}\n", "import AsyncStorage from '@react-native-async-storage/async-storage'\n\nimport { logger } from '../logging/logger'\n\n// Per Fun user, so two accounts don't inherit each other's chain. Hosts that\n// omit `externalUserId` get the wallet address as the userId, so for them a\n// wallet change already scopes to a new key.\nconst storageKey = (userId: string) => `funkit.selectedChain.${userId}`\n\n/** Null when nothing is stored, or the read failed \u2014 the caller just asks. */\nexport async function readSelectedChainId(\n userId: string,\n): Promise<string | null> {\n try {\n return await AsyncStorage.getItem(storageKey(userId))\n } catch (error) {\n logger.warn('connect-rn:deposit:chain_read_failed', {\n error: error instanceof Error ? error.message : String(error),\n })\n return null\n }\n}\n\nexport async function writeSelectedChainId(\n userId: string,\n chainId: string,\n): Promise<void> {\n try {\n await AsyncStorage.setItem(storageKey(userId), chainId)\n } catch (error) {\n logger.warn('connect-rn:deposit:chain_write_failed', {\n chainId,\n error: error instanceof Error ? error.message : String(error),\n })\n }\n}\n", "import { logger } from '../logging/logger'\n\ntype HostCallback = (...args: never[]) => unknown\n\n/**\n * Wraps every function on a host callback object so an integrator's throw stays\n * the integrator's problem.\n *\n * Applied where callbacks enter the SDK rather than at each call site: some of\n * those sites can't defend themselves usefully \u2014 `onClose` runs inside a\n * `setState` updater, `onOpen` runs before the sheet is open \u2014 and a call site\n * added later would otherwise be unguarded by default.\n */\nexport function guardHostCallbacks<T extends object>(callbacks: T): T {\n const guarded: Record<string, unknown> = {}\n for (const [name, value] of Object.entries(callbacks)) {\n guarded[name] =\n typeof value === 'function'\n ? guardOne(name, value as HostCallback)\n : value\n }\n return guarded as T\n}\n\nfunction guardOne(name: string, callback: HostCallback): HostCallback {\n return (...args) => {\n try {\n const result = callback(...args)\n // The callback types are all void, but nothing stops a host passing an\n // `async` function, whose rejection no try/catch here would see.\n if (result instanceof Promise) {\n return result.catch((error: unknown) => warn(name, error))\n }\n return result\n } catch (error) {\n warn(name, error)\n return undefined\n }\n }\n}\n\nfunction warn(name: string, error: unknown): void {\n logger.warn('connect-rn:host_callback_threw', {\n callback: name,\n error: error instanceof Error ? error.message : String(error),\n })\n}\n", "import { type ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport { StyleSheet, View, type ViewStyle } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { AddressCopiedToast } from './AddressCopiedToast'\n\n// How long the pill stays fully shown, and the duration of its exit animation\n// (kept in sync with AddressCopiedToast's FadeOutUp) used to defer the overlay\n// teardown until the fade-out finishes.\nconst TOAST_VISIBLE_MS = 1800\nconst TOAST_EXIT_MS = 350\nconst TOAST_INSET_OFFSET = 20\n\n// Full-screen, top-anchored, non-interactive overlay.\n// pointerEvents=\"none\" on the View lets all touches pass through.\nconst toastOverlay: ViewStyle = {\n ...StyleSheet.absoluteFill,\n zIndex: 1,\n alignItems: 'center',\n}\n\ninterface CopiedToast {\n /** The overlay to render; caller owns only where it sits in the tree. */\n toast: ReactNode\n showCopiedToast: () => void\n clearToast: () => void\n}\n\n/**\n * The \"Address copied\" toast: its timing state and the overlay that shows it.\n *\n * Two pieces of state: `copiedToastShown` drives the pill's mount (its\n * reanimated enter/exit plays on mount/unmount), and `toastMounted` keeps\n * the overlay mounted across the pill's exit animation so the fade-out\n * isn't cut off by tearing the View down on the same frame.\n */\nexport function useCopiedToast(): CopiedToast {\n const insets = useSafeAreaInsets()\n const [toastMounted, setToastMounted] = useState(false)\n const [copiedToastShown, setCopiedToastShown] = useState(false)\n const hideTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>(\n undefined,\n )\n const unmountTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>(\n undefined,\n )\n\n const clearToast = useCallback(() => {\n if (hideTimerRef.current) clearTimeout(hideTimerRef.current)\n if (unmountTimerRef.current) clearTimeout(unmountTimerRef.current)\n setCopiedToastShown(false)\n setToastMounted(false)\n }, [])\n\n const showCopiedToast = useCallback(() => {\n if (hideTimerRef.current) clearTimeout(hideTimerRef.current)\n if (unmountTimerRef.current) clearTimeout(unmountTimerRef.current)\n setToastMounted(true)\n setCopiedToastShown(true)\n hideTimerRef.current = setTimeout(() => {\n setCopiedToastShown(false)\n unmountTimerRef.current = setTimeout(\n () => setToastMounted(false),\n TOAST_EXIT_MS,\n )\n }, TOAST_VISIBLE_MS)\n }, [])\n\n useEffect(() => () => clearToast(), [clearToast])\n\n const toast = toastMounted ? (\n <View\n style={[toastOverlay, { paddingTop: insets.top + TOAST_INSET_OFFSET }]}\n pointerEvents=\"none\"\n >\n {copiedToastShown ? <AddressCopiedToast /> : null}\n </View>\n ) : null\n\n return { toast, showCopiedToast, clearToast }\n}\n", "import { StyleSheet, type ViewStyle } from 'react-native'\nimport Animated, { Easing, FadeOutUp, Keyframe } from 'react-native-reanimated'\n\nimport { FigmaSuccessCheckIcon } from '../icons/FigmaSystemIcons'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Text, useTheme } from '../theme/restyle'\n\n/**\n * The \"Address copied\" confirmation pill (Figma: Fun Mobile deposit toast). A\n * rounded pill with the label + a green success check. Surface + label track the\n * theme (`background/pill/default`, `content/elements/primary` via the medium\n * body cut) so it themes with light/dark; only the layout + soft shadow are\n * static (h42, px16, radius999, gap6).\n *\n * Purely presentational + self-animating on mount/unmount \u2014 it owns NO timer and\n * NO positioning. The parent (the deposit flow) mounts/unmounts it to show/hide\n * and absolutely-positions it; mounting plays the enter animation, unmounting\n * plays the exit. Built on `react-native-reanimated` layout animations, which\n * run inside the gorhom bottom-sheet the flow renders in.\n */\n\n// Enter: slide up ~8px + fade in + scale 0.96\u21921 with a bouncy overshoot,\n// matching the web motion spec (CSS cubic-bezier(0.34, 1.36, 0.64, 1) over\n// ~450ms). The easing on the final keyframe drives the transition into it.\nconst enterAnimation = new Keyframe({\n 0: {\n opacity: 0,\n transform: [{ translateY: 8 }, { scale: 0.96 }],\n },\n 100: {\n opacity: 1,\n transform: [{ translateY: 0 }, { scale: 1 }],\n easing: Easing.bezier(0.34, 1.36, 0.64, 1),\n },\n}).duration(450)\n\n// Exit: fade + lift away over 350ms, matching the toast-close timing.\nconst exitAnimation = FadeOutUp.duration(350)\n\nexport function AddressCopiedToast() {\n const { t } = useFunkitTranslation()\n const label = t('common.addressCopied')\n const theme = useTheme()\n return (\n <Animated.View\n entering={enterAnimation}\n exiting={exitAnimation}\n style={[styles.pill, { backgroundColor: theme.background.pill.default }]}\n accessibilityRole=\"alert\"\n accessibilityLabel={label}\n >\n <Text variant=\"bodyMedium\">{label}</Text>\n <FigmaSuccessCheckIcon size={16} />\n </Animated.View>\n )\n}\n\n// Layout + soft shadow only \u2014 the surface color comes from the theme's\n// `background/pill/default` token, applied inline above.\nconst pill: ViewStyle = {\n height: 42,\n paddingHorizontal: 16,\n borderRadius: 999,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 6,\n shadowColor: '#000000',\n shadowOpacity: 0.08,\n shadowOffset: { width: 0, height: 4 },\n shadowRadius: 12,\n}\n\nconst styles = StyleSheet.create({ pill })\n", "import type { SwappedFormOfPayment } from '@funkit/api-base'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { type ReactNode, useCallback, useState } from 'react'\nimport { useCheckoutBlocked } from '../geo/useCheckoutBlocked'\nimport { CryptoBitcoinIcon } from '../icons/CryptoBitcoinIcon'\nimport { PaymentMethodIcon } from '../icons/PaymentMethodIcon'\nimport { logger } from '../logging/logger'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport type { PaymentMethodOption } from '../screens/SelectMethodScreen'\nimport { WithdrawCryptoComplete } from '../screens/WithdrawCryptoComplete'\nimport { WithdrawCryptoSteps } from '../screens/WithdrawCryptoSteps'\nimport { WithdrawMethodScreen } from '../screens/WithdrawMethodScreen'\nimport { SwappedWithdrawScreen } from '../swapped/SwappedWithdrawScreen'\nimport { toWithdrawFopRows } from '../transfer/fops'\nimport {\n WITHDRAW_FOPS_QUERY_KEY,\n useWithdrawalFops,\n} from '../transfer/hooks/useWithdrawalFops'\nimport { useWithdrawalExecution } from '../withdrawal/useWithdrawalExecution'\nimport type { SafeClipboardReader } from '../transfer/clipboard'\nimport type { FlowNav, FlowScreen } from './FunkitFlowProvider'\nimport type {\n WithdrawalFlowCallbacks,\n WithdrawalFlowConfig,\n} from './withdrawalFlowConfig'\n\n// The synthetic id of the built-in \"Crypto address\" payout row. Cash rows are\n// keyed by their positional index, so a non-numeric id can't collide.\nconst CRYPTO_WITHDRAWAL_METHOD_ID = 'crypto-withdrawal'\n\n// Host method ids are opaque strings we don't control, and a cash row is keyed\n// by its index \u2014 so a host id of `\"0\"` would otherwise open the first cash\n// payout embed. Namespaced on the way in, stripped on the way out.\nconst HOST_METHOD_ID_PREFIX = 'method:'\n\n/**\n * The live withdrawal-flow body (Swapped fiat offramp): payout-method list \u2192\n * the Swapped sell embed \u2192 on a validated order, the on-chain leg\n * ({@link useWithdrawalExecution}) delivers the exact ordered amount to\n * Swapped's deposit address through the host wallet. Sibling of the deposit\n * FlowContent, mounted only while a withdrawal flow is open so its\n * queries run only then.\n */\nexport function WithdrawalFlowContent({\n config,\n callbacks,\n current,\n nav,\n pasteFromClipboard,\n}: {\n config: WithdrawalFlowConfig\n callbacks: WithdrawalFlowCallbacks\n current: FlowScreen | undefined\n nav: FlowNav\n /** Fills the recipient field on the address step. Guarded upstream. */\n pasteFromClipboard: SafeClipboardReader\n}): ReactNode {\n const { t } = useFunkitTranslation()\n const { isGeoblocked, isLoadingGeoCheck } = useCheckoutBlocked({\n onCheckoutBlocked: callbacks.onCheckoutBlocked,\n })\n const queryClient = useQueryClient()\n\n const { fops, isLoading, isBelowMinimumBalance, isError, route } =\n useWithdrawalFops({ config })\n\n // Methods the host resolved (see `@funkit/connect-rn/clients/*`). The picked\n // one carries the config the crypto form then runs, so nothing here knows\n // which venue \u2014 or whether there is one.\n const methodOptions = config.methods ?? []\n const [selectedMethodId, setSelectedMethodId] = useState<string>()\n const selectedMethodConfig = methodOptions.find(\n (method) => method.id === selectedMethodId,\n )?.config\n\n // The payout method the user picked (the whole FOP \u2014 the embed URL drives\n // the Swapped screen; type/name feed the decision-point log).\n const [selectedFop, setSelectedFop] = useState<SwappedFormOfPayment>()\n\n // Unrecoverable execution failure \u2014 replaces the embed with a retryable\n // error state (web parity: the iframe controller's error branch).\n const [hasExecutionError, setHasExecutionError] = useState(false)\n\n // Survives the form unmounting so the success screen can report on it.\n const [submittedWithdrawal, setSubmittedWithdrawal] = useState<{\n txHash: string\n amountLabel: string\n usdLabel: string | undefined\n tokenLabel: string | undefined\n }>()\n\n // Stable so it doesn't rebuild `executeOrder` (it's in that useCallback's deps).\n const onExecutionError = useCallback(() => setHasExecutionError(true), [])\n const { executeOrder } = useWithdrawalExecution({\n config,\n route,\n callbacks,\n onError: onExecutionError,\n })\n\n // The embed's method list can go stale while it's open (web parity: the\n // controller invalidates on back/new-withdrawal/success).\n const invalidateWithdrawFops = useCallback(() => {\n void queryClient.invalidateQueries({ queryKey: [WITHDRAW_FOPS_QUERY_KEY] })\n }, [queryClient])\n\n if (hasExecutionError) {\n return (\n <WithdrawMethodScreen\n title={config.title ?? t('withdraw.title')}\n methods={[]}\n hasError\n onRetry={() => {\n setHasExecutionError(false)\n invalidateWithdrawFops()\n // Reset to the method list \u2014 `back()` would close the whole sheet if\n // the user had already popped the embed before execution failed.\n nav.reset('withdrawMethod')\n }}\n onSelectMethod={() => undefined}\n />\n )\n }\n\n switch (current) {\n case 'withdrawMethod': {\n // Id by array index, not `<fopType>:<name>` \u2014 Swapped can return two\n // methods that share both yet carry distinct `embeddedFlowUrl`s, so a\n // key-based lookup could open the wrong payout embed. Rows are positional\n // 1:1 with `fops`, so the index resolves the exact selected FOP.\n const cashMethods: PaymentMethodOption[] = toWithdrawFopRows(t, fops).map(\n (row, i) => ({\n id: String(i),\n title: row.name,\n subtitle: row.subtitle,\n icon: <PaymentMethodIcon fop={fops[i]} />,\n }),\n )\n // Crypto is unconditional \u2014 no provider, no region gate (web geoblocks\n // nothing here either). Cash rows stay while they may still arrive; their\n // absence gets a note, not a takeover (web: showFopsList/NoCashMethodsNote).\n const showCashList = isLoading || cashMethods.length > 0\n const genericCryptoRow: PaymentMethodOption = {\n id: CRYPTO_WITHDRAWAL_METHOD_ID,\n title: t('withdrawCrypto.methodTitle'),\n subtitle: t('withdrawCrypto.methodSubtitle'),\n icon: <CryptoBitcoinIcon />,\n }\n // Host-supplied methods replace the generic crypto row: a venue whose\n // balance lives off-chain has nothing for a plain send-to-address form to\n // send. With none resolved the generic row stays as the floor, so the\n // user is never left unable to withdraw crypto at all.\n const cryptoMethods: PaymentMethodOption[] = methodOptions.length\n ? methodOptions.map((method) => ({\n id: `${HOST_METHOD_ID_PREFIX}${method.id}`,\n title: method.title,\n subtitle: method.subtitle,\n icon: method.icon ?? <CryptoBitcoinIcon />,\n }))\n : [genericCryptoRow]\n const methods: PaymentMethodOption[] = [\n ...cryptoMethods,\n // Below Swapped's minimum sell, cash stays visible but unselectable \u2014\n // dimming explains more than hiding would.\n ...(showCashList\n ? cashMethods.map((row) => ({\n ...row,\n disabled: isBelowMinimumBalance,\n }))\n : []),\n ]\n // A failed or never-run fetch is an error, not a statement about the\n // user's region (web: `hasFopsResult`).\n const cashNote = showCashList\n ? undefined\n : isError\n ? t('withdraw.cashMethodsError')\n : t('withdraw.noCashMethods')\n return (\n <WithdrawMethodScreen\n title={config.title ?? t('withdraw.title')}\n methods={methods}\n // Deliberately NOT gated on the cash fetch: sending on-chain needs\n // nothing from it, so a skeleton over the whole list would hide a\n // ready option. Cash rows append when they arrive, as they do on web.\n loading={isLoadingGeoCheck}\n note={cashNote}\n onSelectMethod={(id) => {\n const hostMethodId = id.startsWith(HOST_METHOD_ID_PREFIX)\n ? id.slice(HOST_METHOD_ID_PREFIX.length)\n : undefined\n if (id === CRYPTO_WITHDRAWAL_METHOD_ID || hostMethodId) {\n // Rail decision point \u2014 which balance and which execution path.\n logger.info('connect-rn:crypto-withdrawal:method_selected', {\n methodId: hostMethodId ?? id,\n })\n // Undefined for the generic row, which runs the host's own config.\n setSelectedMethodId(hostMethodId)\n nav.navigate('withdrawAmount')\n return\n }\n const fop = fops[Number(id)]\n if (!fop?.embeddedFlowUrl) return\n // Payout-provider decision point.\n logger.info('connect-rn:withdrawal:method_selected', {\n fopType: fop.fopType,\n fopName: fop.name,\n })\n setSelectedFop(fop)\n nav.navigate('swapped')\n }}\n />\n )\n }\n case 'withdrawAmount':\n case 'withdrawAddress':\n case 'withdrawReceiveToken':\n return (\n <WithdrawCryptoSteps\n config={selectedMethodConfig ?? config}\n callbacks={callbacks}\n current={current}\n nav={nav}\n pasteFromClipboard={pasteFromClipboard}\n // Off the same config the steps run, so a host that sets a fee without\n // supplying methods still has it charged.\n quoteInputFeeTokens={\n (selectedMethodConfig ?? config).quoteInputFeeTokens ?? 0\n }\n extraSourceGasUsd={\n (selectedMethodConfig ?? config).extraSourceGasUsd ?? 0\n }\n onSubmitted={(result) => {\n setSubmittedWithdrawal(result)\n // Replace, not push: the funds have moved, so going \"back\" into a\n // form that would submit again is the wrong affordance.\n nav.reset('withdrawComplete')\n }}\n />\n )\n case 'withdrawComplete':\n return submittedWithdrawal ? (\n <WithdrawCryptoComplete\n txHash={submittedWithdrawal.txHash}\n amountLabel={submittedWithdrawal.amountLabel}\n usdLabel={submittedWithdrawal.usdLabel}\n tokenLabel={submittedWithdrawal.tokenLabel}\n callbacks={callbacks}\n onDone={nav.closeFlow}\n />\n ) : null\n case 'swapped':\n return selectedFop?.embeddedFlowUrl ? (\n <SwappedWithdrawScreen\n url={selectedFop.embeddedFlowUrl}\n onBack={() => {\n invalidateWithdrawFops()\n nav.back()\n }}\n onClose={() => {\n invalidateWithdrawFops()\n nav.closeFlow()\n }}\n onNewWithdrawal={() => {\n invalidateWithdrawFops()\n nav.back()\n }}\n onWithdrawalSuccess={(data) => {\n invalidateWithdrawFops()\n callbacks.onWithdrawalSuccess?.(data)\n }}\n onOrderData={(order) => {\n // The host notification is informational \u2014 a throw from it must not\n // skip the on-chain execution (the critical leg for this order).\n try {\n callbacks.onWithdrawalOrder?.(order)\n } catch (error) {\n logger.warn('connect-rn:withdrawal:order_callback_threw', {\n order_id: order.order_id,\n error: error instanceof Error ? error.message : String(error),\n })\n }\n void executeOrder(order)\n }}\n />\n ) : null\n default:\n return null\n }\n}\n", "import { useEffect, useRef } from 'react'\n\nimport type { WithdrawalFlowCallbacks } from '../flow/withdrawalFlowConfig'\nimport { logger } from '../logging/logger'\nimport { useWithdrawalStatus } from '../withdrawal/useWithdrawalStatus'\nimport { WithdrawCompleteScreen } from './WithdrawCompleteScreen'\n\n/**\n * Follows a submitted crypto withdrawal to a terminal state. Split from the\n * screen so the polling query unmounts with it, and so the host is told exactly\n * once, when the chain settles rather than when we submitted.\n *\n * The callbacks are fired from an effect, where a throw would unmount the tree \u2014\n * they arrive guarded (`guardHostCallbacks`), which is what makes that safe.\n *\n * Closing the flow ends the follow with it \u2014 the SDK runs no work behind a shut\n * sheet. The host still holds the hash `onWithdrawalSubmitted` gave it at submit\n * and can settle the transfer itself; the log below is how often that happens.\n */\nexport function WithdrawCryptoComplete({\n txHash,\n amountLabel,\n usdLabel,\n tokenLabel,\n callbacks,\n onDone,\n}: {\n txHash: string\n amountLabel: string\n /** What arrived, frozen at submission. */\n usdLabel: string | undefined\n tokenLabel: string | undefined\n callbacks: WithdrawalFlowCallbacks\n onDone: () => void\n}) {\n const { isCompleted, isFailed, isRefunded } = useWithdrawalStatus(txHash)\n const notifiedRef = useRef(false)\n\n useEffect(() => {\n if (notifiedRef.current) return\n if (isCompleted) {\n notifiedRef.current = true\n callbacks.onWithdrawalSuccess?.({ txHash })\n return\n }\n // A relay FAILURE or REFUND is not \"still settling\": the transfer left the\n // wallet but never reached the recipient, so the host hears about it.\n if (isFailed) {\n notifiedRef.current = true\n callbacks.onWithdrawalError?.({\n message: isRefunded\n ? 'Withdrawal was refunded'\n : 'Withdrawal failed on-chain',\n })\n }\n }, [isCompleted, isFailed, isRefunded, callbacks, txHash])\n\n useEffect(\n () => () => {\n if (notifiedRef.current) return\n logger.warn('connect-rn:crypto-withdrawal:outcome_unreported', { txHash })\n },\n [txHash],\n )\n\n return (\n <WithdrawCompleteScreen\n isPending={!isCompleted && !isFailed}\n isFailed={isFailed}\n isRefunded={isRefunded}\n amountLabel={amountLabel}\n usdLabel={usdLabel}\n tokenLabel={tokenLabel}\n onDone={onDone}\n />\n )\n}\n", "import {\n CheckoutState,\n RelayExecutionStatus,\n getDirectExecutionByTxHash,\n} from '@funkit/api-base'\nimport {\n isDirectExecutionNotFound,\n isTerminalRelayStatus,\n mapRelayExecutionStatusToCheckoutState,\n} from '@funkit/connect-core'\nimport { useQuery } from '@tanstack/react-query'\nimport { useRef } from 'react'\n\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\n\nexport const WITHDRAWAL_STATUS_QUERY_KEY = 'withdrawalStatus'\n\n/** Web polls the same record at this cadence. */\nconst POLL_INTERVAL_MS = 1_500\n\n// How many times the backend may say \"no such record\" before we stop asking. Web\n// polls indefinitely, but its caller seeds the query with a record it already\n// has; here the record may never be written, and this screen can sit open.\nconst MAX_FETCHES_WITHOUT_RECORD = 10\n\n/**\n * Whether there is still anything to learn by asking again. Split out because\n * the \"record never appeared\" bound is the part worth testing directly \u2014 driving\n * it through the query would mean waiting out real poll intervals.\n *\n * Only answered-and-absent counts against the bound: a network or 5xx failure\n * says nothing about the record, so giving up on one would abandon a withdrawal\n * we could still have followed.\n */\nexport function shouldKeepPollingStatus({\n status,\n hasRecord,\n notFoundFetches,\n}: {\n status: RelayExecutionStatus | undefined\n hasRecord: boolean\n notFoundFetches: number\n}): boolean {\n if (isTerminalRelayStatus(status)) return false\n return hasRecord || notFoundFetches < MAX_FETCHES_WITHOUT_RECORD\n}\n\nexport interface WithdrawalStatusResult {\n status: RelayExecutionStatus | undefined\n /** Confirmed on-chain. Only `SUCCESS` \u2014 not merely \"stopped moving\". */\n isCompleted: boolean\n /** `FAILURE` or `REFUND`: the transfer did not reach the recipient. */\n isFailed: boolean\n /** Funds came back to the sender, so there is nothing to chase. */\n isRefunded: boolean\n}\n\n/**\n * Follow a submitted withdrawal to a terminal state.\n *\n * The record is written best-effort by the pipeline, so a missing one is not a\n * failure \u2014 the transfer is already on-chain. It just means we cannot report\n * progress, and polling stops rather than hammering the API forever. An\n * explicit terminal failure is different, and is reported as one.\n */\nexport function useWithdrawalStatus(\n txHash: string | undefined,\n): WithdrawalStatusResult {\n const { apiKey } = useFunkitIdentity()\n // Counted here because react-query's own `errorUpdateCount` cannot tell \"no\n // such record\" from \"could not ask\".\n const notFoundFetches = useRef(0)\n\n const query = useQuery({\n queryKey: [WITHDRAWAL_STATUS_QUERY_KEY, apiKey, txHash],\n queryFn: async () => {\n try {\n const record = await getDirectExecutionByTxHash({\n txHash: txHash as `0x${string}`,\n apiKey,\n logger,\n })\n notFoundFetches.current = 0\n return record\n } catch (error) {\n if (isDirectExecutionNotFound(error)) notFoundFetches.current += 1\n throw error\n }\n },\n enabled: !!apiKey && !!txHash,\n refetchInterval: (query) => {\n const hasRecord = query.state.data !== undefined\n const keepPolling = shouldKeepPollingStatus({\n status: query.state.data?.listenerInfo?.status,\n hasRecord,\n notFoundFetches: notFoundFetches.current,\n })\n if (keepPolling) return POLL_INTERVAL_MS\n if (!hasRecord) {\n logger.warn('connect-rn:crypto-withdrawal:status_record_never_appeared')\n }\n return false\n },\n refetchOnWindowFocus: false,\n retry: 3,\n })\n\n const status = query.data?.listenerInfo?.status\n // Same mapping web reads through `useCheckoutDirectExecutionHistory`, so both\n // platforms agree on what a status means.\n const state = status\n ? mapRelayExecutionStatusToCheckoutState(status)\n : undefined\n return {\n status,\n isCompleted: state === CheckoutState.COMPLETED,\n isFailed: state === CheckoutState.CHECKOUT_ERROR,\n isRefunded: status === RelayExecutionStatus.REFUND,\n }\n}\n", "import {\n ActivityIndicator,\n StyleSheet,\n useWindowDimensions,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { PillButton } from '../components/PillButton'\nimport { ReceiveAmountSummary } from '../components/ReceiveAmountSummary'\nimport {\n FigmaAlertCircleIcon,\n FigmaSuccessCheckIcon,\n} from '../icons/FigmaSystemIcons'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { footerBottomMargin } from '../utils/safeArea'\n\n// The design's own check, larger than any `icon/system` step.\nconst OUTCOME_ICON_SIZE = 46\n\nexport interface WithdrawCompleteScreenProps {\n /** Still settling on-chain; the transfer itself is already submitted. */\n isPending: boolean\n /** The relay reported a terminal failure \u2014 not merely a slow settle. */\n isFailed?: boolean\n /** Failed, and the funds are on their way back to the sender. */\n isRefunded?: boolean\n /** What left the account, for the copy a failure needs. */\n amountLabel: string\n /**\n * What arrived, frozen at submission \u2014 the quote is long gone by now, so\n * `undefined` means it was never priced rather than not priced yet.\n */\n usdLabel: string | undefined\n tokenLabel: string | undefined\n onDone: () => void\n}\n\n/**\n * The outcome of a submitted withdrawal, on the figure the recipient step ended\n * on: the amount stays where it was and the chrome around it is gone, so\n * arriving here reads as the same screen settling rather than a new one.\n *\n * A missing or slow record reads as \"still settling\" rather than a failure \u2014 it\n * is written best-effort and the funds have already moved \u2014 but an explicit\n * terminal failure is shown as one.\n */\nexport function WithdrawCompleteScreen({\n isPending,\n isFailed = false,\n isRefunded = false,\n amountLabel,\n usdLabel,\n tokenLabel,\n onDone,\n}: WithdrawCompleteScreenProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const { height } = useWindowDimensions()\n const insets = useSafeAreaInsets()\n // The quote is gone by the time this screen renders, so a figure it never\n // priced is not on its way: lead with what is known \u2014 down to what left the\n // account \u2014 rather than leaving the step's placeholders standing for good.\n const leadLabel = usdLabel ?? tokenLabel ?? amountLabel\n const secondaryLabel = usdLabel === undefined ? undefined : tokenLabel\n\n return (\n <Box\n style={{\n height,\n paddingTop: insets.top,\n backgroundColor: theme.background.modal,\n }}\n >\n <Box flex={1} justifyContent=\"center\" style={styles.summary}>\n <ReceiveAmountSummary\n // Nothing marks the pending state: the button below is already saying\n // it, and a check that arrives before the chain has would be a lie.\n icon={resolveIcon({ theme, isPending, isFailed })}\n label={resolveLabel({ t, isPending, isFailed })}\n usdLabel={leadLabel}\n tokenLabel={secondaryLabel}\n isQuotePending={false}\n />\n {isFailed ? (\n <Text\n variant=\"detail\"\n style={[styles.detail, { color: theme.content.elements.secondary }]}\n >\n {isRefunded\n ? t('withdrawCrypto.refundedMessage', { amount: amountLabel })\n : t('withdrawCrypto.failedMessage', { amount: amountLabel })}\n </Text>\n ) : null}\n </Box>\n\n <Box\n style={[\n styles.footer,\n { marginBottom: footerBottomMargin(insets.bottom) },\n ]}\n >\n {isPending ? (\n <PillButton\n label={t('withdrawAddress.withdrawing')}\n icon={\n <ActivityIndicator\n size=\"small\"\n color={theme.content.button.primary.default}\n />\n }\n disabled\n onPress={onDone}\n />\n ) : (\n <PillButton label={t('common.close')} onPress={onDone} />\n )}\n </Box>\n </Box>\n )\n}\n\ntype TFunc = ReturnType<typeof useFunkitTranslation>['t']\n\nfunction resolveIcon({\n theme,\n isPending,\n isFailed,\n}: {\n theme: ReturnType<typeof useTheme>\n isPending: boolean\n isFailed: boolean\n}) {\n if (isFailed) {\n return (\n <FigmaAlertCircleIcon\n size={OUTCOME_ICON_SIZE}\n color={theme.content.elements.error}\n />\n )\n }\n if (isPending) {\n return undefined\n }\n return <FigmaSuccessCheckIcon size={OUTCOME_ICON_SIZE} />\n}\n\nfunction resolveLabel({\n t,\n isPending,\n isFailed,\n}: {\n t: TFunc\n isPending: boolean\n isFailed: boolean\n}): string {\n if (isFailed) return t('withdrawCrypto.failedTitle')\n // Still going: the design leaves the label as it was on the step before, and\n // lets the button carry the news.\n if (isPending) return t('withdrawAddress.youllReceive')\n return t('withdrawAddress.withdrew')\n}\n\nconst styles = StyleSheet.create({\n // The band the figure is centred in, matching the recipient step's own, so the\n // amount doesn't move when this screen replaces it.\n summary: { paddingHorizontal: 20, paddingVertical: 12, gap: 16 },\n detail: { textAlign: 'center' },\n footer: { marginHorizontal: 20 },\n})\n", "import type { ReactNode } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\n\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport type { FunkitTheme } from '../theme/toRestyleTheme'\n\nexport type PillButtonSize = Extract<\n keyof FunkitTheme['sizes'],\n `button${string}`\n>\n\nexport type PillButtonVariant = 'primary' | 'secondary'\n\nexport interface PillButtonProps {\n label: string\n onPress: () => void\n /** Leading content inside the pill, e.g. a 16px icon. */\n icon?: ReactNode\n size?: PillButtonSize\n /** `secondary` is the quieter fill used for side-by-side actions. */\n variant?: PillButtonVariant\n /** `element` squares the corners off where the design butts the button\n * against a card of the same radius. */\n radius?: Extract<keyof FunkitTheme['borderRadii'], 'button' | 'element'>\n disabled?: boolean\n /** Defaults to `label`. */\n accessibilityLabel?: string\n}\n\n/**\n * The full-width primary action at the foot of a sheet \u2014 Confirm, Cancel, Done.\n * Width comes from the container, so callers control the horizontal inset.\n */\nexport function PillButton({\n label,\n onPress,\n icon,\n size = 'buttonLg',\n variant = 'primary',\n radius = 'button',\n disabled = false,\n accessibilityLabel,\n}: PillButtonProps) {\n const theme = useTheme()\n const surface = theme.background.button[variant]\n const labelColor = theme.content.button[variant].default\n\n return (\n <Pressable\n onPress={onPress}\n disabled={disabled}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel ?? label}\n accessibilityState={{ disabled }}\n >\n {/* Disabled dims the fill rather than recoloring it (the token export has\n no disabled button color), so an opaque backing keeps whatever sits\n behind \u2014 a scrolling list \u2014 from reading through the button. */}\n <Box\n borderRadius={radius}\n style={{ backgroundColor: theme.background.modal }}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius={radius}\n style={[\n styles.pill,\n variant === 'secondary' ? styles.secondaryPill : null,\n {\n height: theme.sizes[size],\n backgroundColor: surface.default,\n opacity: disabled ? theme.opacity.disabled / 100 : 1,\n },\n ]}\n >\n {icon}\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n style={{ color: labelColor }}\n >\n {label}\n </Text>\n </Box>\n </Box>\n </Pressable>\n )\n}\n\nconst styles = StyleSheet.create({\n pill: { paddingHorizontal: 24, gap: 8 },\n // The design's own inset for these (`px-10` vs the primary's `px-24`): they\n // sit several-across, where 24 leaves no room for the label and it ellipsises.\n secondaryPill: { paddingHorizontal: 10 },\n})\n", "import type { ReactNode } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\n\nimport { FigmaInfoCircleIcon } from '../icons/FigmaSystemIcons'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { SkeletonBar } from './SkeletonBar'\n\n// Figma's summary amount, which `font/*` has no step to mirror. The tracking is\n// the design's own -0.96 at 64, kept as a ratio so it travels with the size.\nconst AMOUNT_FONT_SIZE = 64\nconst LETTER_SPACING_RATIO = -0.96 / 64\n// The design trims the amount to its cap box (45 at 64) \u2014 something RN can't do,\n// since the line box is what it lays out. A line box shorter than the font's\n// natural one gets the glyphs cut off on iOS, so the dead space is taken back as\n// a negative margin instead, leaving the design's gaps between the cap boxes.\nconst LINE_HEIGHT_RATIO = 1.25\nconst CAP_BOX_RATIO = 45 / 64\nconst AMOUNT_LINE_HEIGHT = AMOUNT_FONT_SIZE * LINE_HEIGHT_RATIO\nconst AMOUNT_OVERHANG =\n (AMOUNT_FONT_SIZE * (LINE_HEIGHT_RATIO - CAP_BOX_RATIO)) / 2\n// Roughly what a four-figure amount occupies, so the figure landing doesn't\n// shift the block it is centred in.\nconst AMOUNT_SKELETON_WIDTH = 200\nconst TOKEN_SKELETON_WIDTH = 96\n\nexport interface ReceiveAmountSummaryProps {\n /** Sits above the label, e.g. the settled state's check. */\n icon?: ReactNode\n /** Names what the figure is, e.g. `You'll receive`. */\n label: string\n /**\n * The figure the screen leads with, in the user's currency. `undefined` until\n * the quote settles, which is what the placeholders stand in for.\n */\n usdLabel: string | undefined\n /** The same amount in the token that arrives, e.g. `99.78 USDC`. */\n tokenLabel: string | undefined\n /**\n * Whether a missing figure is still on its way. `false` leaves its place\n * empty: once the figures are frozen a placeholder would never resolve.\n */\n isQuotePending?: boolean\n /** Opens the breakdown. Omit to drop the affordance with it. */\n onPressBreakdown?: () => void\n}\n\n/**\n * What the withdrawal lands as: the figure, and the token it arrives in. The\n * screen's centrepiece once there is a quote to show.\n */\nexport function ReceiveAmountSummary({\n icon,\n label,\n usdLabel,\n tokenLabel,\n isQuotePending = true,\n onPressBreakdown,\n}: ReceiveAmountSummaryProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n\n return (\n <Box alignItems=\"center\" justifyContent=\"center\" style={styles.root}>\n {icon}\n <Text\n variant=\"detail\"\n weight=\"medium\"\n style={{ color: theme.content.elements.secondary }}\n >\n {label}\n </Text>\n\n {usdLabel === undefined ? null : (\n <Text\n weight=\"medium\"\n numberOfLines={1}\n style={[styles.amount, { color: theme.content.elements.primary }]}\n >\n {usdLabel}\n </Text>\n )}\n {usdLabel === undefined && isQuotePending ? (\n <SkeletonBar\n width={AMOUNT_SKELETON_WIDTH}\n height={AMOUNT_FONT_SIZE * CAP_BOX_RATIO}\n borderRadius={theme.borderRadii.element}\n />\n ) : null}\n\n {tokenLabel === undefined && isQuotePending ? (\n <SkeletonBar\n width={TOKEN_SKELETON_WIDTH}\n height={theme.textVariants.bodyMedium.lineHeight}\n />\n ) : null}\n {tokenLabel === undefined ? null : (\n <Pressable\n onPress={onPressBreakdown}\n disabled={!onPressBreakdown}\n accessibilityRole={onPressBreakdown ? 'button' : undefined}\n accessibilityLabel={\n onPressBreakdown ? t('withdrawAddress.breakdownTitle') : tokenLabel\n }\n >\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.tokenRow}>\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.secondary }}\n >\n {tokenLabel}\n </Text>\n {onPressBreakdown ? (\n <FigmaInfoCircleIcon\n size={16}\n color={theme.content.elements.secondary}\n />\n ) : null}\n </Box>\n </Pressable>\n )}\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n root: { gap: 24 },\n amount: {\n fontSize: AMOUNT_FONT_SIZE,\n lineHeight: AMOUNT_LINE_HEIGHT,\n letterSpacing: AMOUNT_FONT_SIZE * LETTER_SPACING_RATIO,\n marginVertical: -AMOUNT_OVERHANG,\n },\n tokenRow: { gap: 6 },\n})\n", "import { Animated } from 'react-native'\n\nimport { usePulse } from '../hooks/usePulse'\nimport { useTheme } from '../theme/restyle'\n\nexport interface SkeletonBarProps {\n /** Sized to the text it stands in for, so nothing moves when the value lands. */\n width: number\n height: number\n /** The design rounds a text-height bar at 4, and a display-sized one further. */\n borderRadius?: number\n}\n\n/** A value that hasn't arrived yet. */\nexport function SkeletonBar({\n width,\n height,\n borderRadius = 4,\n}: SkeletonBarProps) {\n const theme = useTheme()\n const opacity = usePulse()\n return (\n <Animated.View\n accessibilityRole=\"progressbar\"\n style={{\n width,\n height,\n borderRadius,\n opacity,\n backgroundColor: theme.background.pill.pressed,\n }}\n />\n )\n}\n", "// The design measures the footer to the top of the home indicator, which only the\n// insets know the height of; the floor stands in on a device without one.\nconst FOOTER_GAP = 16\nconst FOOTER_MIN = 24\n\n/** What a full-window step's footer keeps between itself and the screen edge. */\nexport function footerBottomMargin(bottomInset: number): number {\n return Math.max(FOOTER_GAP + bottomInset, FOOTER_MIN)\n}\n", "import { BottomSheetModal, BottomSheetView } from '@gorhom/bottom-sheet'\nimport { useFeatureGate } from '@funkit/connect-core'\nimport { useState } from 'react'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { FlowSheetBackground } from '../flow/FlowSheet'\nimport {\n isUsableWalletAddress,\n useFunkitIdentity,\n} from '../identity/IdentityContext'\nimport type { FlowNav, FlowScreen } from '../flow/FunkitFlowProvider'\nimport type {\n WithdrawalFlowCallbacks,\n WithdrawalFlowConfig,\n} from '../flow/withdrawalFlowConfig'\nimport { useIsStablecoin } from '../hooks/useIsStablecoin'\nimport { useNestedSheet } from '../hooks/useNestedSheet'\nimport { logger } from '../logging/logger'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport type { SafeClipboardReader } from '../transfer/clipboard'\nimport {\n formatTokenAmount,\n formatUsd,\n groupThousands,\n} from '../utils/formatAmount'\nimport { useCryptoWithdrawalForm } from '../withdrawal/useCryptoWithdrawalForm'\nimport { useCryptoWithdrawalSubmit } from '../withdrawal/useCryptoWithdrawalSubmit'\nimport { SelectReceiveTokenAndChainScreen } from './SelectReceiveTokenAndChainScreen'\nimport { SelectSourceTokenScreen } from './SelectSourceTokenScreen'\nimport { TransactionBreakdownScreen } from './TransactionBreakdownScreen'\nimport { WithdrawAddressScreen } from './WithdrawAddressScreen'\nimport { WithdrawAmountScreen } from './WithdrawAmountScreen'\n\n/** What is presented as a sheet over whichever step opened it. */\ntype WithdrawalNestedScreen = 'transactionBreakdown'\n\n/**\n * The crypto rail's screens, and the one withdrawal they are all building.\n *\n * Each screen is its own entry in the flow's stack \u2014 `back` leaves the screen,\n * not the rail \u2014 while the state behind them lives here, so navigating between\n * them keeps the amount, the source and the quote. A screen added later (the\n * recipient's address is next) is a case below and a `nav.navigate` from the one\n * before it.\n */\nexport function WithdrawCryptoSteps({\n config,\n callbacks,\n current,\n nav,\n quoteInputFeeTokens,\n extraSourceGasUsd,\n pasteFromClipboard,\n onSubmitted,\n}: {\n config: WithdrawalFlowConfig\n callbacks: WithdrawalFlowCallbacks\n current: FlowScreen | undefined\n nav: FlowNav\n /**\n * A flat fee the venue takes off the withdrawal before it is quoted, in\n * source-token units, or 0. The SDK only knows the number, never who charges\n * it.\n */\n quoteInputFeeTokens: number\n /**\n * A venue fee billed as source-chain gas, in USD, for the summary's network\n * row, or 0.\n */\n extraSourceGasUsd: number\n /** Fills the recipient field from the clipboard. Guarded upstream. */\n pasteFromClipboard: SafeClipboardReader\n onSubmitted: (result: {\n txHash: string\n amountLabel: string\n /** What arrived, frozen here: the quote refreshes, the outcome doesn't. */\n usdLabel: string | undefined\n tokenLabel: string | undefined\n }) => void\n}) {\n const { t } = useFunkitTranslation()\n const insets = useSafeAreaInsets()\n const form = useCryptoWithdrawalForm({ config, quoteInputFeeTokens })\n const {\n nestedSheetRef,\n nestedScreen,\n setNestedScreen,\n openNestedScreen,\n renderNestedBackdrop,\n } = useNestedSheet<WithdrawalNestedScreen>()\n const connectedWalletAddress = useConnectedRecipientAddress(config)\n // A 1:1 stablecoin reads the same either way round, so the swap between them\n // is a fake exchange rate \u2014 the same reason web hides it (`InputAmountLayout`).\n const isStablecoin = useIsStablecoin()\n const hideStablecoinSwap =\n useFeatureGate('hide-stablecoin-amount-switch') &&\n isStablecoin(form.sourceToken.symbol)\n const canSwapDenomination = form.canSwapDenomination && !hideStablecoinSwap\n // `undefined` when nothing prices the source, which sends both readers below\n // to token units instead.\n const amountUsdLabel =\n form.amountUsd === undefined ? undefined : formatUsd(Number(form.amountUsd))\n const receiveUsdLabel =\n form.receiveUsd === undefined ? undefined : formatUsd(form.receiveUsd)\n const receiveTokenLabel =\n form.receiveAmount && form.destinationToken\n ? `${formatTokenAmount(form.receiveAmount)} ${form.destinationToken.symbol}`\n : undefined\n const { submit, isSubmitting, isBusy, executionErrorText } =\n useCryptoWithdrawalSubmit({\n config,\n callbacks,\n form,\n // What the outcome reports on, frozen by the hook at the press: the quote\n // goes on refreshing and this step unmounts.\n receiveLabels: {\n usdLabel: receiveUsdLabel,\n tokenLabel: receiveTokenLabel,\n },\n onSubmitted,\n })\n // A picker over whichever screen opened it, not a step of its own: it is\n // reachable from the amount and from the details, and neither is where `back`\n // out of it should land.\n const [isPickingSource, setIsPickingSource] = useState(false)\n\n // A clipboard read can block for seconds on the OS permission prompt, so the\n // Paste pill is held down for the duration: a second tap would queue a second\n // read whose later result wins.\n const [isPasting, setIsPasting] = useState(false)\n\n if (isPickingSource) {\n return (\n <SelectSourceTokenScreen\n options={form.sourceOptions}\n selectedIndex={form.selectedSourceIndex}\n onSelect={(index) => {\n // The amount is cleared with the source, so there is nothing left to\n // review \u2014 the amount screen is where the user belongs.\n if (form.selectSource(index) && current !== 'withdrawAmount') {\n nav.popTo('withdrawAmount')\n }\n setIsPickingSource(false)\n }}\n onBack={() => setIsPickingSource(false)}\n />\n )\n }\n\n if (current === 'withdrawReceiveToken') {\n return (\n <SelectReceiveTokenAndChainScreen\n chains={form.destinationChains}\n committed={form.destinationToken}\n onBack={nav.back}\n onConfirm={(chainId, symbol) => {\n logger.info('withdrawal:destination_selected', {\n toChainId: chainId,\n toToken: symbol,\n })\n form.selectDestinationToken(chainId, symbol)\n nav.popTo('withdrawAddress')\n }}\n />\n )\n }\n\n if (current === 'withdrawAmount') {\n return (\n <WithdrawAmountScreen\n title={t('withdrawCrypto.title')}\n amount={form.amount}\n onChangeAmount={form.setAmount}\n input={form.input}\n onChangeInput={form.setInput}\n inUsd={form.inUsd}\n usdLabel={amountUsdLabel}\n onSwapDenomination={\n canSwapDenomination ? form.swapDenomination : undefined\n }\n sourceDecimals={form.sourceDecimals}\n balance={form.balance}\n source={{\n label: form.sourceLabel,\n symbol: form.sourceToken.symbol,\n chainId: Number(form.sourceToken.chainId),\n iconSrc: form.sourceOption.iconSrc,\n }}\n // Nothing to open with a single source; the receive token is picked on\n // the step that follows.\n onPressSource={\n form.sourceOptions.length > 1\n ? () => setIsPickingSource(true)\n : undefined\n }\n errorText={form.amountError}\n canContinue={form.canContinue}\n onContinue={() => {\n // Amount decision point, recorded where it is committed rather than on\n // every keystroke.\n logger.info('withdrawal:amount_confirmed', {\n fromChainId: form.sourceToken.chainId,\n fromToken: form.sourceToken.address,\n toChainId: form.destinationToken?.chainId,\n toToken: form.destinationToken?.address,\n })\n nav.navigate('withdrawAddress')\n }}\n onBack={nav.back}\n onClose={nav.closeFlow}\n />\n )\n }\n\n return (\n <>\n <WithdrawAddressScreen\n title={t('withdrawAddress.title', {\n amount:\n amountUsdLabel ??\n `${groupThousands(form.amount)} ${form.sourceToken.symbol}`,\n })}\n recipient={form.recipient}\n onChangeRecipient={form.setRecipient}\n isAddress={form.isRecipientAddress}\n isPasting={isPasting}\n onPaste={async () => {\n setIsPasting(true)\n try {\n // Test the trimmed value: a whitespace-only clipboard would\n // otherwise clear a recipient the user already entered.\n const pasted = (await pasteFromClipboard())?.trim()\n if (pasted) {\n form.setRecipient(pasted)\n }\n } finally {\n setIsPasting(false)\n }\n }}\n onUseConnected={\n connectedWalletAddress\n ? () => form.setRecipient(connectedWalletAddress)\n : undefined\n }\n errorText={form.recipientError}\n warningText={form.recipientWarning}\n destinationToken={form.destinationToken}\n onPressReceive={() => nav.navigate('withdrawReceiveToken')}\n usdLabel={receiveUsdLabel}\n tokenLabel={receiveTokenLabel}\n onPressBreakdown={() => openNestedScreen('transactionBreakdown')}\n // Without this the placeholders pulse on and the disabled button says\n // nothing \u2014 the one state the user can act on, by editing.\n quoteErrorText={\n form.isQuoteError ? t('withdrawCrypto.quoteFailed') : undefined\n }\n canSubmit={form.canSubmit}\n isBusy={isBusy}\n isSubmitting={isSubmitting}\n onSubmit={submit}\n executionErrorText={executionErrorText}\n onBack={nav.back}\n onClose={nav.closeFlow}\n />\n\n <BottomSheetModal\n ref={nestedSheetRef}\n // The breakdown is a paragraph, and sizes itself.\n enableDynamicSizing\n topInset={insets.top}\n handleComponent={null}\n backgroundComponent={FlowSheetBackground}\n backdropComponent={renderNestedBackdrop}\n onDismiss={() => setNestedScreen(null)}\n >\n <BottomSheetView>\n {nestedScreen === 'transactionBreakdown' ? (\n <TransactionBreakdownScreen\n usdLabel={receiveUsdLabel ?? ''}\n floorLabel={\n form.receiveFloorUsd === undefined\n ? ''\n : formatUsd(form.receiveFloorUsd)\n }\n />\n ) : null}\n </BottomSheetView>\n </BottomSheetModal>\n </>\n )\n}\n\n/**\n * The connected wallet's address, when it can stand in as the recipient: the\n * host can turn the shortcut off, and on a non-EVM rail the payer identity isn't\n * an address at all.\n */\nfunction useConnectedRecipientAddress(\n config: WithdrawalFlowConfig,\n): string | undefined {\n const { walletAddress } = useFunkitIdentity()\n if (config.disableConnectedWallet || !isUsableWalletAddress(walletAddress)) {\n return undefined\n }\n return walletAddress\n}\n", "import { useCallback } from 'react'\nimport { useDynamicConfig } from '../statsig/useDynamicConfig'\n\nexport type IsStablecoinFn = (symbol: string) => boolean\n\nexport function useIsStablecoin(): IsStablecoinFn {\n const stablecoinSymbols = useDynamicConfig('stablecoinsymbols')\n return useCallback(\n (symbol: string) =>\n stablecoinSymbols.some((stable) =>\n symbol.toLowerCase().includes(stable.toLowerCase()),\n ),\n [stablecoinSymbols],\n )\n}\n", "// Local rather than `@funkit/utils`, whose formatters go through\n// `toLocaleString` \u2014 connect-rn takes no Intl dependency today. Grouping is\n// comma-only, as the design draws it.\n\n/**\n * `1062.11` \u2192 `1,062.11`. The fraction is passed through untouched: rounding a\n * balance would show the user a number they can't withdraw.\n */\nexport function groupThousands(amount: string): string {\n const [whole, ...fraction] = amount.split('.')\n const grouped = whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')\n return fraction.length > 0 ? `${grouped}.${fraction.join('.')}` : grouped\n}\n\n/**\n * The fraction a token amount is shown to, matching web's `ASSET_DECIMALS` (see\n * the checkout's `InputAmount/utils.ts`) so the two flows read the same.\n */\nexport const ASSET_DECIMALS = 5\n\n/**\n * `99.780000` \u2192 `99.78`, capped at {@link ASSET_DECIMALS}.\n *\n * Truncated rather than rounded: a figure the recipient won't actually get is\n * worse than one digit less of it. Trailing zeros go, so a round amount reads as\n * one.\n */\nexport function formatTokenAmount(\n amount: string,\n maxDecimals: number = ASSET_DECIMALS,\n): string {\n const [whole, fraction = ''] = amount.split('.')\n const capped = fraction.slice(0, maxDecimals).replace(/0+$/, '')\n const grouped = groupThousands(whole)\n return capped ? `${grouped}.${capped}` : grouped\n}\n\n/** `99.94` \u2192 `$99.94`. Two decimals, as every USD figure in the design is. */\nexport function formatUsd(value: number): string {\n return `$${groupThousands(value.toFixed(2))}`\n}\n", "import {\n type WithdrawalAmountValidation,\n deductFlatFee,\n isWithdrawalAddressSupported,\n resolveWithdrawalSourceTokenBalance,\n useDebouncedValue,\n} from '@funkit/connect-core'\nimport type { TFunction } from 'i18next'\nimport { useState } from 'react'\n\nimport type { WithdrawalFlowConfig } from '../flow/withdrawalFlowConfig'\nimport { logger } from '../logging/logger'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { resolveWithdrawalSourceTokens } from './sourceToken'\nimport { useCryptoWithdrawalQuote } from './useCryptoWithdrawalQuote'\nimport { useCryptoWithdrawalValidation } from './useCryptoWithdrawalValidation'\nimport { useSourceTokenDecimals } from './useSourceTokenDecimals'\nimport { useSourceTokenUsdPrice } from './useSourceTokenUsdPrice'\nimport { useWithdrawalAmountInput } from './useWithdrawalAmountInput'\nimport { useWithdrawalDestinationTokens } from './useWithdrawalDestinationTokens'\nimport { useWithdrawalRisk } from './useWithdrawalRisk'\nimport { type WithdrawCtaBlocker, isAmountBelowQuoteFee } from './validation'\n\n// Long enough that a typed amount settles before it is priced, short enough\n// that the summary doesn't feel detached from the keystroke (web uses the same).\nconst AMOUNT_DEBOUNCE_MS = 300\n\n/**\n * What the recipient step owns. The rest of what `getWithdrawCtaBlocker` reports\n * is the amount's business, and holding the recipient step on it would strand\n * the user on a screen with nothing to fix.\n */\nconst RECIPIENT_BLOCKERS = new Set<WithdrawCtaBlocker>([\n 'enter-recipient',\n 'unsupported-recipient',\n 'recipient-same-as-source',\n 'select-destination',\n 'invalid-for-chain',\n])\n\n/** What the crypto withdrawal's screens read and write. */\nexport type CryptoWithdrawalForm = ReturnType<typeof useCryptoWithdrawalForm>\n\n/**\n * One withdrawal in progress, across the screens that build it: the amount, the\n * recipient and the fees are asked for a step at a time, and all of it is priced\n * against the same quote.\n *\n * Held above the screens rather than inside one of them, so a step can be added\n * (or reordered) without the state moving house \u2014 and so the quote isn't thrown\n * away and re-fetched on every navigation.\n */\nexport function useCryptoWithdrawalForm({\n config,\n quoteInputFeeTokens,\n}: {\n config: WithdrawalFlowConfig\n /**\n * A flat fee the venue takes off the withdrawal before it is quoted, in\n * source-token units, or 0.\n */\n quoteInputFeeTokens: number\n}) {\n const { t } = useFunkitTranslation()\n const [amount, setAmount] = useState('')\n const [recipient, setRecipient] = useState('')\n\n const sourceOptions = resolveWithdrawalSourceTokens(config)\n // By index, not by symbol: two options can be the same symbol on the same\n // chain and differ only in which balance they draw from.\n const [sourceIndex, setSourceIndex] = useState(0)\n // A host can swap `sourceTokens` under us; falling back without clamping the\n // index would leave the picker with no row checked.\n const selectedSourceIndex =\n sourceIndex < sourceOptions.length ? sourceIndex : 0\n const sourceOption = sourceOptions[selectedSourceIndex]\n const sourceToken = sourceOption.token\n const sourceLabel = sourceOption.label ?? sourceToken.symbol\n const balance = resolveWithdrawalSourceTokenBalance(\n config.withdrawalSourceTokenBalance,\n { sourceToken },\n logger,\n )\n\n // The destination is the point of this rail: the relay quote prices a swap\n // and/or a bridge, so receiving a different asset on a different chain is the\n // normal case, not an edge one.\n const {\n chains: destinationChains,\n destinationToken,\n selectDestinationToken,\n isLoading: isLoadingDestinations,\n } = useWithdrawalDestinationTokens({\n sourceToken,\n defaultReceiveToken: config.defaultReceiveToken,\n })\n\n const { isRecipientBlacklisted, amountValidation, ctaBlocker } =\n useCryptoWithdrawalValidation({\n config,\n sourceToken,\n destinationToken,\n amount,\n recipient,\n balance,\n })\n\n // Screening is address-intrinsic, so it runs off the typed address rather\n // than waiting for the amount.\n const risk = useWithdrawalRisk(\n recipient,\n destinationToken ? Number(destinationToken.chainId) : undefined,\n )\n\n // Hold the quote while the user is mid-keystroke, and never price something\n // we already know we would refuse to submit.\n const { debounced: debouncedAmount, isSettled } = useDebouncedValue(\n amount,\n AMOUNT_DEBOUNCE_MS,\n )\n\n // The account is debited what the user typed; relay moves what is left after\n // the venue's flat fee, so that is what gets priced and signed.\n const quoteAmount = deductFlatFee(debouncedAmount, quoteInputFeeTokens)\n // Shared with the quote's own read (same query key), so this costs no extra\n // call \u2014 it is what tells a sub-base-unit remainder from a real one.\n const sourceDecimals = useSourceTokenDecimals(sourceToken)\n // Shares the validator's own read (same query key), so this costs no extra\n // call and prices the entry off the rate the limits are judged against.\n const sourceUsdPrice = useSourceTokenUsdPrice(sourceToken)\n // Held here rather than in the screen, which unmounts on the way to the\n // recipient and back.\n const amountInput = useWithdrawalAmountInput({\n amount,\n setAmount,\n sourceUsdPrice,\n sourceDecimals,\n })\n // Read off the typed amount, not the debounced one, so the message lands with\n // the keystroke. Validation passes on the gross amount, so without this a fee\n // that eats it leaves nothing to quote and no reason on screen.\n const isAmountBelowFee = isAmountBelowQuoteFee({\n amount,\n feeTokenAmount: quoteInputFeeTokens,\n decimals: sourceDecimals,\n })\n\n const {\n quote,\n isLoading: isQuoteLoading,\n isError: isQuoteError,\n } = useCryptoWithdrawalQuote({\n sourceToken,\n destinationToken,\n recipientAddress: recipient,\n amount: quoteAmount,\n walletAddress: config.withdrawalWallet.address(),\n // Everything the form already knows is wrong, plus the async verdict:\n // `isRisky === false` is required, so in-flight and errored both hold.\n enabled:\n !ctaBlocker && !isAmountBelowFee && isSettled && risk.isRisky === false,\n })\n\n // What the recipient ends up with, in the currency the screen leads with. The\n // token amount is what the quote returns; the price is what turns it into the\n // number beside it. `0` from the price hook means unknown, not free.\n const destinationPrice = useSourceTokenUsdPrice(\n destinationToken ?? sourceToken,\n )\n // Mid-edit the query is disabled and `quote` still holds the previous amount's\n // price, so the figures are withheld until the inputs settle rather than\n // presenting the old estimate as this withdrawal's.\n const settledQuote = isSettled ? quote : undefined\n const receiveAmount = settledQuote?.receiveAmount\n const receiveUsd =\n destinationToken && receiveAmount && destinationPrice > 0\n ? Number(receiveAmount) * destinationPrice\n : undefined\n // The floor the trade won't execute below \u2014 the received amount less the\n // slippage the quote was raised with.\n const receiveFloorUsd =\n receiveUsd === undefined || settledQuote === undefined\n ? undefined\n : receiveUsd * (1 - settledQuote.fees.maxSlippage / 100)\n\n return {\n amount,\n setAmount,\n // The amount as it is being typed; see `useWithdrawalAmountInput`.\n ...amountInput,\n recipient,\n setRecipient,\n\n sourceOptions,\n selectedSourceIndex,\n sourceOption,\n sourceToken,\n sourceLabel,\n sourceDecimals,\n balance,\n /**\n * Records the decision and clears the amount: it was in the previous token's\n * units, and the balance and minimum it was checked against are the new\n * token's. Returns whether the source actually moved.\n */\n selectSource: (index: number) => {\n if (index === selectedSourceIndex) {\n return false\n }\n const picked = sourceOptions[index]\n // Source decision point \u2014 which balance the withdrawal draws from.\n logger.info('connect-rn:withdrawal:source_selected', {\n fromChainId: picked?.token.chainId,\n fromToken: picked?.token.address,\n sourceLabel: picked?.label ?? picked?.token.symbol,\n })\n setSourceIndex(index)\n setAmount('')\n return true\n },\n\n destinationChains,\n destinationToken,\n selectDestinationToken,\n isLoadingDestinations,\n\n isRecipientBlacklisted,\n amountValidation,\n ctaBlocker,\n risk,\n\n /**\n * Whether what has been typed is a wallet address at all \u2014 `undefined` while\n * the field is empty. Being one doesn't make it usable: the blacklist and the\n * destination's chain are the separate verdicts in `recipientError`.\n */\n isRecipientAddress:\n recipient === '' ? undefined : isWithdrawalAddressSupported(recipient),\n /** Why a well-formed address still can't be used. */\n recipientError: resolveRecipientErrorText(t, ctaBlocker),\n /** Screening's non-blocking verdict; the submit is what it gates. */\n recipientWarning: risk.isRisky\n ? t('withdrawCrypto.riskyAddress')\n : undefined,\n /** Enough to leave the recipient step, which the amount's problems don't hold. */\n canConfirmRecipient: !ctaBlocker || !RECIPIENT_BLOCKERS.has(ctaBlocker),\n /**\n * Fail closed: only a completed, clean screening lets the withdrawal through,\n * and only while the quote on screen is the one for what the field says \u2014\n * mid-edit the query is disabled and `quote` still holds the last price.\n */\n canSubmit:\n !ctaBlocker &&\n !isAmountBelowFee &&\n isSettled &&\n risk.isRisky === false &&\n !!quote,\n\n quote,\n quoteAmount,\n /** Destination-token units, absent until the quote matches what is typed. */\n receiveAmount,\n receiveUsd,\n receiveFloorUsd,\n isQuoteLoading,\n isQuoteError,\n isSettled,\n isAmountBelowFee,\n\n /**\n * The amount step's own gate: `ctaBlocker` also weighs the recipient, which\n * isn't asked for until the step after.\n */\n amountError: resolveAmountErrorText({\n t,\n amount,\n amountValidation,\n tokenSymbol: sourceToken.symbol,\n // A per-token floor is already in source-token units; without one the floor\n // came from `getMinWithdrawalUSD`, so it reads as currency.\n isMinInTokenUnits:\n config.getMinWithdrawalAmount?.({ sourceToken }) !== undefined,\n isAmountBelowFee,\n quoteInputFeeTokens,\n }),\n canContinue:\n !!amount &&\n amountValidation.isWithdrawAmountValid &&\n !isAmountBelowFee &&\n !!destinationToken,\n }\n}\n\n/** The recipient's own blockers, as the message under the field. */\nfunction resolveRecipientErrorText(\n t: TFunction,\n blocker: WithdrawCtaBlocker | undefined,\n): string | undefined {\n // `enter-recipient` is left to the field's own verdict, which already says the\n // address isn't one.\n if (blocker === 'unsupported-recipient') {\n return t('withdrawCrypto.unsupportedRecipient')\n }\n if (blocker === 'recipient-same-as-source') {\n return t('withdrawCrypto.ctaRecipientSameAsSource')\n }\n if (blocker === 'invalid-for-chain') {\n return t('withdrawCrypto.ctaInvalidForChain')\n }\n return undefined\n}\n\nfunction resolveAmountErrorText({\n t,\n amount,\n amountValidation,\n tokenSymbol,\n isMinInTokenUnits,\n isAmountBelowFee,\n quoteInputFeeTokens,\n}: {\n t: TFunction\n amount: string\n amountValidation: WithdrawalAmountValidation\n tokenSymbol: string\n /** See {@link WithdrawalAmountValidation.minWithdrawalDisplayValue}. */\n isMinInTokenUnits: boolean\n /** The venue's fee leaves nothing for the quote to price. */\n isAmountBelowFee: boolean\n quoteInputFeeTokens: number\n}): string | undefined {\n if (!amount) return undefined\n if (amountValidation.isWithdrawAmountTooLow) {\n // The floor is either denomination, so it has to be labelled as the one it\n // is: a USD floor shown as token units reads ~4000\u00D7 off on an ETH source.\n const min = amountValidation.minWithdrawalDisplayValue\n return t('withdrawCrypto.belowMinimum', {\n amount: isMinInTokenUnits\n ? `${min} ${tokenSymbol}`\n : `$${min.toFixed(2)}`,\n })\n }\n if (amountValidation.isWithdrawAmountAboveBalance) {\n return t('withdrawCrypto.aboveBalance')\n }\n // After the minimum, which carries the more useful number when both apply.\n if (isAmountBelowFee) {\n return t('withdrawCrypto.belowFee', {\n amount: `${quoteInputFeeTokens} ${tokenSymbol}`,\n })\n }\n return undefined\n}\n", "import type {\n WithdrawalFlowConfig,\n WithdrawalSourceTokenOption,\n} from '../flow/withdrawalFlowConfig'\n\n/**\n * The source tokens the user may pick between. A host with one source omits\n * `sourceTokens`, leaving the single `sourceToken` as the only option.\n *\n * Stays local to React Native: web's option type is keyed by symbol and carries\n * per-option checkout data, so there is no shared shape to resolve against.\n */\nexport function resolveWithdrawalSourceTokens(\n config: Pick<WithdrawalFlowConfig, 'sourceToken' | 'sourceTokens'>,\n): WithdrawalSourceTokenOption[] {\n const options = config.sourceTokens ?? []\n return options.length > 0 ? options : [{ token: config.sourceToken }]\n}\n", "import {\n type CheckoutQuoteResponse,\n extractRelayFeeInfo,\n extractRelayReceiveAmount,\n fetchExactInQuote,\n toWithdrawalAmountBaseUnit,\n} from '@funkit/connect-core'\nimport type { FeeBreakdownV2 } from '@funkit/api-base'\nimport { useQuery } from '@tanstack/react-query'\nimport type { Address } from 'viem'\n\nimport type { WithdrawalToken } from '../flow/withdrawalFlowConfig'\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\nimport { useSourceTokenDecimals } from './useSourceTokenDecimals'\n\nexport const CRYPTO_WITHDRAWAL_QUOTE_QUERY_KEY = 'cryptoWithdrawalQuote'\n\n/**\n * How long a quote stays good for. Used for BOTH `staleTime` and\n * `refetchInterval`, and the equality is load-bearing: with `staleTime: 0`, an\n * `enabled` flip mid-edit remounts the query and refetches the previous key\n * before the new amount lands, replaying a stale quote. The interval keeps it\n * fresh regardless.\n */\nexport const QUOTE_REFRESH_INTERVAL_MS = 25_000\n\nexport interface CryptoWithdrawalQuoteView {\n /** Executed as-is by the pipeline \u2014 never rebuilt from the fields below. */\n raw: CheckoutQuoteResponse\n /** What the recipient gets, in destination-token units. */\n receiveAmount: string | undefined\n fees: FeeBreakdownV2\n}\n\nexport interface UseCryptoWithdrawalQuoteParams {\n sourceToken: WithdrawalToken\n destinationToken: WithdrawalToken | undefined\n recipientAddress: string\n /** Source-token units. Already debounced and settled by the caller. */\n amount: string\n walletAddress: string\n /** The caller's own gate \u2014 validation, risk, blacklist (see `useQuoteGate`). */\n enabled: boolean\n}\n\n/**\n * The EXACT_IN quote for a crypto withdrawal, refreshed on an interval so the\n * fees on screen stay the fees that execute.\n *\n * The query key is the inputs themselves \u2014 no context round-trip \u2014 so a quote\n * can never describe a different withdrawal than the form shows.\n */\nexport function useCryptoWithdrawalQuote({\n sourceToken,\n destinationToken,\n recipientAddress,\n amount,\n walletAddress,\n enabled,\n}: UseCryptoWithdrawalQuoteParams) {\n const { apiKey } = useFunkitIdentity()\n const decimals = useSourceTokenDecimals(sourceToken)\n\n const query = useQuery({\n queryKey: [\n CRYPTO_WITHDRAWAL_QUOTE_QUERY_KEY,\n apiKey,\n sourceToken.chainId,\n sourceToken.address,\n destinationToken?.chainId,\n destinationToken?.address,\n recipientAddress,\n amount,\n // The quote is signed for one sender, so a wallet switch must not read a\n // cached quote built for the previous one.\n walletAddress,\n decimals,\n ],\n queryFn: async (): Promise<CryptoWithdrawalQuoteView> => {\n if (!destinationToken) {\n throw new Error('Quote requested without a destination token')\n }\n if (decimals == null) {\n throw new Error('Quote requested before the source decimals resolved')\n }\n const raw = await fetchExactInQuote({\n apiKey,\n logger,\n fromChainId: sourceToken.chainId,\n fromTokenAddress: sourceToken.address,\n toChainId: destinationToken.chainId,\n toTokenAddress: destinationToken.address,\n recipientAddress: recipientAddress as Address,\n userAddress: walletAddress as Address,\n fromAmountBaseUnit: toWithdrawalAmountBaseUnit(amount, decimals),\n })\n return {\n raw,\n receiveAmount: extractRelayReceiveAmount(raw.metadata, logger),\n fees: extractRelayFeeInfo(raw.metadata, logger),\n }\n },\n enabled:\n enabled &&\n !!apiKey &&\n !!destinationToken &&\n !!recipientAddress &&\n Number(amount) > 0 &&\n decimals != null,\n staleTime: QUOTE_REFRESH_INTERVAL_MS,\n refetchInterval: QUOTE_REFRESH_INTERVAL_MS,\n refetchIntervalInBackground: true,\n // A failed quote is shown, not retried behind the user's back: the inputs\n // usually need changing, and a silent retry would delay that feedback.\n retry: false,\n })\n\n return {\n quote: query.data,\n // Only the first fetch \u2014 `isFetching` would blank the rows and disable the\n // CTA on every background refresh.\n isLoading: query.isLoading,\n isError: query.isError,\n }\n}\n", "import { getPublicClientFor } from '@funkit/connect-core'\nimport { useQuery } from '@tanstack/react-query'\nimport { erc20Abi } from 'viem'\n\nimport type { WithdrawalToken } from '../flow/withdrawalFlowConfig'\n\nexport const SOURCE_TOKEN_DECIMALS_QUERY_KEY = 'sourceTokenDecimals'\n\n/**\n * Decimals for the amount conversion: the host's value when it has one,\n * otherwise read on-chain. A stale host value would mis-scale the transfer, so\n * the read is preferred over a guess.\n *\n * Its own query rather than a step inside the quote, so the read runs once per\n * token \u2014 as soon as the form knows what it is spending \u2014 instead of on every\n * 25-second quote refresh.\n */\nexport function useSourceTokenDecimals(\n sourceToken: WithdrawalToken,\n): number | undefined {\n const query = useQuery({\n queryKey: [\n SOURCE_TOKEN_DECIMALS_QUERY_KEY,\n sourceToken.chainId,\n sourceToken.address,\n ],\n queryFn: async () => {\n const client = getPublicClientFor(Number(sourceToken.chainId))\n if (!client) {\n throw new Error(\n `No RPC client for chain ${sourceToken.chainId} \u2014 cannot read token decimals`,\n )\n }\n return client.readContract({\n address: sourceToken.address,\n abi: erc20Abi,\n functionName: 'decimals',\n })\n },\n enabled: sourceToken.decimals == null,\n // A token's decimals never change, so one read lasts the session.\n staleTime: Number.POSITIVE_INFINITY,\n retry: 1,\n })\n\n return sourceToken.decimals ?? query.data\n}\n", "import {\n type WithdrawalAmountValidation,\n isBlacklistedWithdrawalAddress,\n} from '@funkit/connect-core'\n\nimport type {\n WithdrawalFlowConfig,\n WithdrawalToken,\n} from '../flow/withdrawalFlowConfig'\nimport { useDynamicConfig } from '../statsig/useDynamicConfig'\nimport { useSourceTokenDecimals } from './useSourceTokenDecimals'\nimport { useSourceTokenUsdPrice } from './useSourceTokenUsdPrice'\nimport {\n type WithdrawCtaBlocker,\n getWithdrawCtaBlocker,\n isNoOpSelfWithdrawal,\n validateAmount,\n} from './validation'\n\nexport interface CryptoWithdrawalValidation {\n /** Recipient the funds would be lost in (e.g. a token contract). */\n isRecipientBlacklisted: boolean\n amountValidation: WithdrawalAmountValidation\n /** The single thing left to fix, or `undefined` when the form is complete. */\n ctaBlocker: WithdrawCtaBlocker | undefined\n}\n\n/**\n * Everything the crypto withdrawal form knows synchronously about what the user\n * has typed. The Statsig-backed blacklist is why this is a hook; the verdicts\n * themselves come from the pure functions in `validation.ts`.\n */\nexport function useCryptoWithdrawalValidation({\n config,\n sourceToken,\n destinationToken,\n amount,\n recipient,\n balance,\n}: {\n config: WithdrawalFlowConfig\n sourceToken: WithdrawalToken\n destinationToken: WithdrawalToken | undefined\n amount: string\n recipient: string\n balance: string | undefined\n}): CryptoWithdrawalValidation {\n const blacklist = useDynamicConfig('blacklistedwithdrawaladdress')\n const withdrawalConfig = useDynamicConfig('withdrawalconfig')\n const isRecipientBlacklisted = isBlacklistedWithdrawalAddress({\n address: recipient,\n blacklist,\n withdrawalConfig,\n })\n\n // Inert until the price resolves, so the USD limits switch on rather than\n // rejecting an amount against a price that isn't known yet.\n const sourceTokenUsdPrice = useSourceTokenUsdPrice(sourceToken)\n // Shares the form's own read (same query key), so this costs no extra call.\n // A USD floor converts to a token figure finer than the field can hold, and\n // the typed minimum would sit just under it without this.\n const sourceTokenDecimals = useSourceTokenDecimals(sourceToken)\n\n const amountValidation = validateAmount({\n config,\n sourceToken,\n sourceTokenUsdPrice,\n sourceTokenDecimals,\n amount,\n balance,\n })\n\n return {\n isRecipientBlacklisted,\n amountValidation,\n ctaBlocker: getWithdrawCtaBlocker({\n recipientAddress: recipient,\n isRecipientBlacklisted,\n isRecipientSameAsSource: isNoOpSelfWithdrawal({\n recipientAddress: recipient,\n walletAddress: config.withdrawalWallet.address(),\n sourceToken,\n destinationToken,\n }),\n amount,\n amountValidation,\n destinationToken,\n }),\n }\n}\n", "import { getAssetPriceInfoWithFallback } from '@funkit/connect-core'\nimport { useQuery } from '@tanstack/react-query'\n\nimport type { WithdrawalToken } from '../flow/withdrawalFlowConfig'\nimport { useIsStablecoin } from '../hooks/useIsStablecoin'\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\n\nconst SOURCE_TOKEN_PRICE_QUERY_KEY = 'sourceTokenUsdPrice'\n\n/** Long enough that typing doesn't refetch, short enough to stay honest. */\nconst PRICE_STALE_TIME_MS = 60_000\n\n/** What a dollar stablecoin is worth, without asking anyone. */\nconst STABLECOIN_USD_PRICE = 1\n\n/**\n * Spot USD price of the source token, for the USD floor and ceiling the host\n * configures (`getMinWithdrawalUSD` / `getMaxWithdrawalUSD`).\n *\n * A dollar stablecoin is priced from its symbol and never fetched, as web's\n * `useAssetAddressPrice` does \u2014 it is the common withdrawal source, and the\n * amount screen was waiting on a round trip to be told a dollar is a dollar.\n *\n * `0` means \"unknown\", which is what the core validator reads as \"no price\" \u2014\n * so a failed or in-flight lookup leaves the USD limits inert rather than\n * judging an amount against a made-up rate. Per-token limits and the balance\n * check are unaffected either way.\n *\n * Not every source has a price: Lighter's L2 assets are addressed by index, not\n * by an ERC-20 funkit's price API knows, so that lookup 404s and core's Relay\n * fallback is what prices them.\n */\nexport function useSourceTokenUsdPrice(sourceToken: WithdrawalToken): number {\n const { apiKey } = useFunkitIdentity()\n const isStablecoin = useIsStablecoin()\n const isStable = isStablecoin(sourceToken.symbol)\n\n const { data } = useQuery({\n queryKey: [\n SOURCE_TOKEN_PRICE_QUERY_KEY,\n apiKey,\n sourceToken.chainId,\n sourceToken.address,\n ],\n queryFn: async () => {\n const info = await getAssetPriceInfoWithFallback({\n chainId: sourceToken.chainId,\n assetTokenAddress: sourceToken.address,\n apiKey,\n logger,\n })\n const unitPrice = info.unitPrice\n if (!Number.isFinite(unitPrice) || unitPrice <= 0) {\n // Reported here, not on read: a cached bad price would otherwise warn\n // on every render. A non-positive price would silently scale every USD\n // limit to nothing.\n logger.warn('connect-rn:withdrawal:unusable_source_price', {\n chainId: sourceToken.chainId,\n address: sourceToken.address,\n unitPrice,\n })\n return 0\n }\n return unitPrice\n },\n enabled: !!apiKey && !isStable,\n staleTime: PRICE_STALE_TIME_MS,\n retry: false,\n })\n\n return isStable ? STABLECOIN_USD_PRICE : (data ?? 0)\n}\n", "import {\n type WithdrawalAmountValidation,\n deductFlatFee,\n isAddressCompatibleWithChain,\n isWithdrawalAddressSupported,\n toWithdrawalAmountBaseUnit,\n validateWithdrawalAmount,\n} from '@funkit/connect-core'\n\nimport type {\n WithdrawalFlowConfig,\n WithdrawalToken,\n} from '../flow/withdrawalFlowConfig'\n\n// Everything the crypto withdrawal form derives from what the user has typed.\n// Pure and synchronous \u2014 the async verdicts (risk screening, the quote) are\n// layered on by the caller.\n\n/**\n * The one thing the user has left to fix, named so the submit button can say it.\n *\n * Nothing left to fix is `undefined`, not a `ready` member: these are what the\n * typed form is missing, and that is not the same as being submittable \u2014 the\n * async verdicts (risk screening, a settled quote) decide that.\n */\nexport type WithdrawCtaBlocker =\n | 'enter-recipient'\n | 'unsupported-recipient'\n | 'recipient-same-as-source'\n | 'max-exceeded'\n | 'enter-amount'\n | 'select-destination'\n | 'invalid-for-chain'\n\n/**\n * Amount limits, resolved from the host's callbacks.\n *\n * `sourceTokenUsdPrice` of 0 means unknown, not free: the core validator reads\n * it as \"no price\" and leaves the USD floor and ceiling inert, while the\n * per-token minimum and the balance check still apply. Sources whose price the\n * API cannot resolve (Lighter's index-addressed L2 assets) run that way.\n */\nexport function validateAmount({\n config,\n sourceToken,\n sourceTokenUsdPrice,\n sourceTokenDecimals,\n amount,\n balance,\n}: {\n config: Pick<\n WithdrawalFlowConfig,\n | 'getMinWithdrawalAmount'\n | 'getMinWithdrawalUSD'\n | 'getMaxWithdrawalUSD'\n | 'getMaxWithdrawalAmount'\n >\n sourceToken: WithdrawalToken\n /** Spot USD price of one source token; 0 when unknown. */\n sourceTokenUsdPrice?: number\n /** Fraction digits the source carries; caps how fine the USD floor gets. */\n sourceTokenDecimals?: number\n amount: string\n balance: string | undefined\n}): WithdrawalAmountValidation {\n const result = validateWithdrawalAmount({\n withdrawalInputAmount: amount,\n sourceTokenUsdPrice: sourceTokenUsdPrice ?? 0,\n sourceTokenDecimals,\n sourceTokenBalance: balance ?? '0',\n perTokenMin: config.getMinWithdrawalAmount?.({ sourceToken }),\n perTokenMax: config.getMaxWithdrawalAmount?.({ sourceToken }),\n usdMin: config.getMinWithdrawalUSD?.({ sourceToken }) ?? 0.01,\n usdMax: config.getMaxWithdrawalUSD?.({ sourceToken }),\n })\n\n // Nothing to withdraw is not a valid amount. The core validator compares\n // `Number(amount)`, and both `NaN` (from `'.'`) and 0 fail every comparison,\n // so they come back valid \u2014 the $0.01 floor catches 0 only once a price is\n // known (see above).\n const parsed = Number(amount)\n if (!Number.isFinite(parsed) || parsed <= 0) {\n return { ...result, isWithdrawAmountValid: false }\n }\n\n // An unknown balance is not a zero balance. Coalescing to '0' above keeps the\n // core validator happy, but judging the amount against it would reject every\n // withdrawal a host that supplies no balance callback ever attempts. We\n // cannot know, so we do not block \u2014 an actually-insufficient balance is\n // caught by the quote, which fails with a real reason.\n if (balance == null) {\n return {\n ...result,\n isWithdrawAmountAboveBalance: false,\n isWithdrawAmountValid:\n !result.isWithdrawAmountTooLow && !result.isWithdrawAmountTooHigh,\n }\n }\n return result\n}\n\n/**\n * A same-chain, same-token transfer back to the sending wallet. Relay rejects\n * these with a generic error, so name the reason before quoting.\n */\nexport function isNoOpSelfWithdrawal({\n recipientAddress,\n walletAddress,\n sourceToken,\n destinationToken,\n}: {\n recipientAddress: string\n walletAddress: string\n sourceToken: WithdrawalToken\n destinationToken: WithdrawalToken | undefined\n}): boolean {\n if (!destinationToken) return false\n return (\n recipientAddress.toLowerCase() === walletAddress.toLowerCase() &&\n sourceToken.chainId === destinationToken.chainId &&\n sourceToken.address.toLowerCase() === destinationToken.address.toLowerCase()\n )\n}\n\n/**\n * Order is a faithful port of web's `getWithdrawButtonText`: the most specific\n * blocker wins, so the user is told the one thing to fix next rather than the\n * first thing that happens to fail.\n */\nexport function getWithdrawCtaBlocker({\n recipientAddress,\n isRecipientBlacklisted,\n isRecipientSameAsSource,\n amount,\n amountValidation,\n destinationToken,\n}: {\n recipientAddress: string\n isRecipientBlacklisted: boolean\n isRecipientSameAsSource: boolean\n amount: string\n amountValidation: WithdrawalAmountValidation\n destinationToken: WithdrawalToken | undefined\n}): WithdrawCtaBlocker | undefined {\n if (!isWithdrawalAddressSupported(recipientAddress)) return 'enter-recipient'\n // Sending to a token contract burns the funds.\n if (isRecipientBlacklisted) return 'unsupported-recipient'\n if (isRecipientSameAsSource) return 'recipient-same-as-source'\n if (amountValidation.isWithdrawAmountTooHigh) return 'max-exceeded'\n if (!amount || !amountValidation.isWithdrawAmountValid) return 'enter-amount'\n if (!destinationToken) return 'select-destination'\n if (\n !isAddressCompatibleWithChain(\n recipientAddress,\n Number(destinationToken.chainId),\n )\n ) {\n return 'invalid-for-chain'\n }\n return undefined\n}\n\n/**\n * Whether the venue's flat fee leaves nothing for the quote to price.\n *\n * - Two ways to leave nothing: the fee meets or exceeds the amount, or the\n * remainder is under one base unit of the source token \u2014 `parseUnits` trims\n * the extra digits, so a positive remainder still reaches the quote as 0.\n * - Undefined `decimals` means the read hasn't landed. The quote can't run\n * without it either, so the fee-only verdict stands until it does.\n */\nexport function isAmountBelowQuoteFee({\n amount,\n feeTokenAmount,\n decimals,\n}: {\n amount: string\n feeTokenAmount: number\n decimals: number | undefined\n}): boolean {\n if (feeTokenAmount <= 0 || !amount) return false\n const net = deductFlatFee(amount, feeTokenAmount)\n if (Number(net) <= 0) return true\n if (decimals == null) return false\n try {\n return toWithdrawalAmountBaseUnit(net, decimals) <= 0n\n } catch {\n // An amount `parseUnits` rejects can't be quoted either.\n return true\n }\n}\n", "import { tokenAmountToUsd, usdToTokenAmount } from '@funkit/connect-core'\nimport { useCallback, useState } from 'react'\n\n/**\n * A trailing point is mid-entry, not a different amount \u2014 and `dnum` throws on\n * it, which the converters answer with `'0'`. Every figure crossing between the\n * two denominations goes through here first.\n */\nfunction withoutTrailingDot(value: string): string {\n return value.endsWith('.') ? value.slice(0, -1) : value\n}\n\n/**\n * What the withdrawal is worth in dollars, or `undefined` when nothing prices\n * it. Typed dollars are authoritative: the token amount they bought was\n * rounded down to fit the token, so reading it back reports $9.99 for a $10\n * that was typed \u2014 and the readers of this label sit on later screens, where\n * that cent has no visible explanation.\n */\nfunction usdValueOf({\n amount,\n usdInput,\n inUsd,\n sourceUsdPrice,\n canPriceInUsd,\n}: {\n amount: string\n usdInput: string\n inUsd: boolean\n sourceUsdPrice: number\n canPriceInUsd: boolean\n}): string | undefined {\n if (!canPriceInUsd) {\n return undefined\n }\n if (inUsd) {\n return withoutTrailingDot(usdInput) || '0'\n }\n const typed = withoutTrailingDot(amount)\n return tokenAmountToUsd(typed === '' ? '0' : typed, sourceUsdPrice)\n}\n\n/**\n * The amount as the user types it, and which denomination they are typing in.\n *\n * - `amount` never changes meaning: the quote, the validation and the signature\n * are all in source-token units, so when typing in dollars the typed figure\n * is held here and `amount` is what it converts to.\n * - Held with the form rather than in the screen, which unmounts on the way to\n * the recipient \u2014 local state would drop both on Continue.\n */\nexport function useWithdrawalAmountInput({\n amount,\n setAmount,\n sourceUsdPrice,\n sourceDecimals,\n}: {\n /** The withdrawal amount, in source-token units. */\n amount: string\n setAmount: (amount: string) => void\n /** Spot USD price of the source token; `0` is the price hook's \"unknown\". */\n sourceUsdPrice: number\n /** Fraction digits the source token carries, once they're known. */\n sourceDecimals: number | undefined\n}) {\n const [usdInput, setUsdInput] = useState('')\n // Both halves are required: converting before the token's precision is known\n // mints an amount finer than the token holds, which the numpad then refuses\n // every further digit for.\n const canPriceInUsd = sourceUsdPrice > 0 && sourceDecimals !== undefined\n // The standing preference; a rate that arrives late (or never) is what\n // actually decides it.\n const [prefersUsd, setPrefersUsd] = useState(true)\n const inUsd = prefersUsd && canPriceInUsd\n\n // Re-derived when the amount moves underneath it or a rate first arrives \u2014\n // never every render (that would rewrite `12.` as `12`) and never on a\n // refreshed rate (that would rewrite the figure being edited).\n const [derivedFrom, setDerivedFrom] = useState({\n amount: '',\n isPriced: false,\n })\n if (derivedFrom.amount !== amount || derivedFrom.isPriced !== canPriceInUsd) {\n if (!derivedFrom.isPriced && canPriceInUsd && amount !== '') {\n setPrefersUsd(false)\n }\n setDerivedFrom({ amount, isPriced: canPriceInUsd })\n setUsdInput(\n amount === '' || !canPriceInUsd\n ? ''\n : tokenAmountToUsd(withoutTrailingDot(amount), sourceUsdPrice),\n )\n }\n\n const setInput = useCallback(\n (next: string) => {\n if (!inUsd) {\n setAmount(next)\n return\n }\n // `''` has to stay nothing rather than become `'0'`, which reads as a\n // typed zero and fails the minimum.\n const typed = withoutTrailingDot(next)\n const asTokens =\n typed === ''\n ? ''\n : usdToTokenAmount(typed, sourceUsdPrice, sourceDecimals)\n // Recorded as already derived, so the typed dollars survive a token\n // amount that rounding may have shortened.\n setUsdInput(next)\n setDerivedFrom({ amount: asTokens, isPriced: canPriceInUsd })\n setAmount(asTokens)\n },\n [inUsd, setAmount, sourceUsdPrice, sourceDecimals],\n )\n\n return {\n /** What to show and edit: dollars when {@link inUsd}, else token units. */\n input: inUsd ? usdInput : amount,\n setInput,\n inUsd,\n /**\n * Switches denomination, converting the amount rather than clearing it.\n *\n * - Deliberately does not re-price against a rate that moved since the\n * figure was typed: rewriting what someone entered, under them, is worse\n * than showing it at the rate they entered it at.\n * - The staleness is bounded by refreshing the price on the way into this\n * screen rather than while it is open.\n */\n swapDenomination: useCallback(() => setPrefersUsd((was) => !was), []),\n /** Offering the swap without a rate would promise one we don't have. */\n canSwapDenomination: canPriceInUsd,\n /** What the amount is worth, or `undefined` when nothing prices it. */\n amountUsd: usdValueOf({\n amount,\n usdInput,\n inUsd,\n sourceUsdPrice,\n canPriceInUsd,\n }),\n }\n}\n", "import { getSupportedAssets } from '@funkit/api-base'\nimport { resolveTokenTransferConfig } from '@funkit/connect-core'\nimport { useQuery } from '@tanstack/react-query'\nimport { useMemo, useState } from 'react'\nimport type { Address } from 'viem'\n\nimport type { WithdrawalToken } from '../flow/withdrawalFlowConfig'\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\nimport { useDynamicConfig } from '../statsig/useDynamicConfig'\n\nexport const WITHDRAWAL_DESTINATION_TOKENS_QUERY_KEY = 'withdrawalDestinations'\n\nexport interface DestinationChain {\n chainId: number\n /** Symbols receivable on this chain, priority ones first. */\n symbols: string[]\n}\n\nexport interface UseWithdrawalDestinationTokensResult {\n chains: DestinationChain[]\n /** Where the funds land. `undefined` until the curated list resolves. */\n destinationToken: WithdrawalToken | undefined\n selectDestinationToken: (chainId: number, symbol: string) => void\n isLoading: boolean\n}\n\n/**\n * Everything a withdrawal can be received as: the curated Statsig\n * `withdrawalconfig` chains and assets, minus\n * `disablewithdrawalchainsandassets`, resolved against api-base's asset\n * metadata \u2014 the same pipeline the deposit list uses, and the same one web\n * feeds into its receive-token dropdown.\n *\n * The destination token is the point of this rail. Sending the source token back out\n * on its own chain is a plain transfer with nothing to quote; the relay quote\n * exists precisely so a user holding USDG on one chain can receive USDC on\n * another.\n */\nexport function useWithdrawalDestinationTokens({\n sourceToken,\n defaultReceiveToken,\n}: {\n sourceToken: WithdrawalToken\n /** Symbol to preselect; falls back to the source token's symbol. */\n defaultReceiveToken?: string\n}): UseWithdrawalDestinationTokensResult {\n const { apiKey } = useFunkitIdentity()\n const withdrawalConfig = useDynamicConfig('withdrawalconfig')\n const disabledChainAssets = useDynamicConfig(\n 'disablewithdrawalchainsandassets',\n )\n\n const { data: supportedAssets, isLoading } = useQuery({\n queryKey: [WITHDRAWAL_DESTINATION_TOKENS_QUERY_KEY, apiKey],\n queryFn: () => getSupportedAssets({ apiKey, logger }),\n enabled: !!apiKey,\n staleTime: Number.POSITIVE_INFINITY,\n })\n\n const resolved = useMemo(() => {\n if (!supportedAssets) return undefined\n return resolveTokenTransferConfig({\n chainConfigs: withdrawalConfig.chains ?? [],\n priorityTokens: withdrawalConfig.priorityTokens ?? [],\n disabledChainAssets: disabledChainAssets ?? {},\n supportedAssets,\n logger,\n })\n }, [supportedAssets, withdrawalConfig, disabledChainAssets])\n\n const chains = useMemo<DestinationChain[]>(() => {\n if (!resolved) return []\n return resolved.chainIdSortOrder.map((chainId) => ({\n chainId,\n symbols: resolved.symbolsByChainId[chainId] ?? [],\n }))\n }, [resolved])\n\n const [picked, setPicked] = useState<{ chainId: number; symbol: string }>()\n\n const destinationToken = useMemo<WithdrawalToken | undefined>(() => {\n if (!resolved) return undefined\n\n // The user's pick, else the host's preferred receive token, else the source\n // symbol \u2014 each only if the curated list actually offers it.\n const candidates = picked\n ? [picked]\n : [\n ...(defaultReceiveToken\n ? chains.map((c) => ({\n chainId: c.chainId,\n symbol: defaultReceiveToken,\n }))\n : []),\n ...chains.map((c) => ({\n chainId: c.chainId,\n symbol: sourceToken.symbol,\n })),\n ]\n\n for (const candidate of candidates) {\n const address =\n resolved.addressBySymbolByChainId[candidate.chainId]?.[candidate.symbol]\n if (address) {\n return {\n chainId: String(candidate.chainId),\n address: address as Address,\n symbol: candidate.symbol,\n }\n }\n }\n return undefined\n }, [resolved, picked, chains, defaultReceiveToken, sourceToken.symbol])\n\n return {\n chains,\n destinationToken,\n selectDestinationToken: (chainId, symbol) => setPicked({ chainId, symbol }),\n isLoading,\n }\n}\n", "import {\n isAddressCompatibleWithChain,\n isWithdrawalRisky,\n useFeatureGate,\n} from '@funkit/connect-core'\nimport { useQuery } from '@tanstack/react-query'\n\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\n\nexport const WITHDRAWAL_RISK_QUERY_KEY = 'withdrawalRisk'\n\nexport interface WithdrawalRiskResult {\n /** `true` blocks. `undefined` while unknown \u2014 which also blocks. */\n isRisky: boolean | undefined\n isChecking: boolean\n isError: boolean\n}\n\n/**\n * Chainalysis screening for the recipient.\n *\n * **Fails closed**: callers must require `isRisky === false`, so in-flight and\n * errored both block. The chain id scopes the screen to the destination chain,\n * so it is part of the key (web does the same).\n */\nexport function useWithdrawalRisk(\n address: string,\n chainId: number | undefined,\n): WithdrawalRiskResult {\n const { apiKey } = useFunkitIdentity()\n const screeningDisabled = useFeatureGate('disable-frontend-chainalysis')\n\n const query = useQuery({\n queryKey: [WITHDRAWAL_RISK_QUERY_KEY, apiKey, address, chainId],\n queryFn: () =>\n isWithdrawalRisky({\n address,\n chainId: chainId?.toString(),\n apiKey,\n logger,\n screeningDisabled,\n }),\n // Only screen an address that could actually exist on the destination\n // chain. Without this the query fires on every keystroke of a\n // half-typed address, one Chainalysis call per character.\n enabled:\n !!apiKey &&\n !!address &&\n chainId !== undefined &&\n isAddressCompatibleWithChain(address, chainId),\n // api-base already retries the request; one more attempt before the error\n // state blocks the CTA is enough.\n retry: 1,\n refetchOnMount: false,\n refetchOnReconnect: false,\n refetchOnWindowFocus: false,\n })\n\n return {\n isRisky: query.data,\n isChecking: query.isFetching,\n isError: query.isError,\n }\n}\n", "import { useEffectEvent } from '@funkit/connect-core'\nimport { useEffect, useRef } from 'react'\n\nimport type {\n WithdrawalFlowCallbacks,\n WithdrawalFlowConfig,\n} from '../flow/withdrawalFlowConfig'\nimport { logger } from '../logging/logger'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { executionErrorMessage } from '../utils/executionErrorMessage'\nimport { useCryptoWithdrawalExecution } from './useCryptoWithdrawalExecution'\nimport type { CryptoWithdrawalForm } from './useCryptoWithdrawalForm'\n\n/**\n * Signing the withdrawal {@link CryptoWithdrawalForm} describes: the press, the\n * once-only hand-off to the outcome, and what the step shows while either is in\n * flight.\n *\n * Held apart from the step that renders it so the money path's invariants \u2014 one\n * hand-off, the source the signature was actually raised against, nothing\n * executed but the quote on screen \u2014 can be exercised without a rendered screen.\n */\n/** What the recipient step is showing the withdrawal will land as. */\ninterface ReceiveLabels {\n usdLabel: string | undefined\n tokenLabel: string | undefined\n}\n\nexport function useCryptoWithdrawalSubmit({\n config,\n callbacks,\n form,\n receiveLabels,\n onSubmitted,\n}: {\n config: WithdrawalFlowConfig\n callbacks: WithdrawalFlowCallbacks\n /** The withdrawal being built, which is what gets signed. */\n form: CryptoWithdrawalForm\n receiveLabels: ReceiveLabels\n onSubmitted: (\n result: { txHash: string; amountLabel: string } & ReceiveLabels,\n ) => void\n}) {\n const { t } = useFunkitTranslation()\n const { submission, submit } = useCryptoWithdrawalExecution({\n config,\n sourceToken: form.sourceToken,\n destinationToken: form.destinationToken ?? form.sourceToken,\n callbacks,\n })\n\n // Hand off exactly once. `onSubmitted` is an inline arrow from the flow, so it\n // is a new function every render \u2014 without the ref this re-fires on each one,\n // resetting the navigation stack in a loop.\n const handedOffRef = useRef(false)\n // The source the signature was raised against: a host config change can still\n // move the selection, and the completion screen must name what was sent.\n const submittedSourceLabel = useRef<string | undefined>(undefined)\n // The figures the withdrawal was signed against. The quote goes on refreshing\n // and the recipient step unmounts, so the outcome carries its own copy.\n const submittedFigures = useRef<ReceiveLabels>({\n usdLabel: undefined,\n tokenLabel: undefined,\n })\n const onSubmittedEvent = useEffectEvent(onSubmitted)\n useEffect(() => {\n if (submission.status !== 'submitted' || handedOffRef.current) return\n handedOffRef.current = true\n // The submission's own amount, not the field's: the input stays editable\n // while the signature is in flight, so the two can disagree by now.\n onSubmittedEvent({\n txHash: submission.txHash,\n amountLabel: `${submission.amount} ${submittedSourceLabel.current ?? form.sourceLabel}`,\n ...submittedFigures.current,\n })\n }, [submission, form.sourceLabel])\n\n return {\n isSubmitting: submission.status === 'submitting',\n /** The button holds for the price and the screening too, not only the signature. */\n isBusy:\n form.isQuoteLoading ||\n form.risk.isChecking ||\n submission.status === 'submitting',\n /** An unrecoverable failure from the last attempt, in the user's words. */\n executionErrorText:\n submission.status === 'failed'\n ? executionErrorMessage(t, submission.code, submission.message)\n : undefined,\n /** Executes the quote on screen. `form.canSubmit` is what gates the press. */\n submit: () => {\n if (!form.quote) return\n // Source/destination decision point, recorded before signing.\n logger.info('connect-rn:withdrawal:crypto_submit', {\n fromChainId: form.sourceToken.chainId,\n fromToken: form.sourceToken.address,\n toChainId: form.destinationToken?.chainId,\n toToken: form.destinationToken?.address,\n })\n submittedSourceLabel.current = form.sourceLabel\n submittedFigures.current = receiveLabels\n void submit({\n quote: form.quote.raw,\n recipientAddress: form.recipient,\n amount: form.quoteAmount,\n })\n },\n }\n}\n", "import type { WalletExecutionErrorCode } from '@funkit/connect-core'\nimport type { TFunction } from 'i18next'\n\n// Two lines on a phone. A provider that returns its whole stack should not push\n// the fee summary and the CTA off the sheet.\nconst MAX_ERROR_DETAIL_CHARS = 160\n\n/**\n * What the user reads for a failure core classified. Web's copy, per cause.\n *\n * A cause core could name gets that copy: it is translated and says what to do,\n * which no provider string does. Everything else falls back to the error's own\n * text \u2014 \"please try again\" is the one message that helps nobody, and the\n * failures that land here are the ones neither we nor the user can otherwise\n * diagnose. Truncated, since a relay error can run to paragraphs.\n */\nexport function executionErrorMessage(\n t: TFunction,\n code: WalletExecutionErrorCode,\n message?: string,\n): string {\n switch (code) {\n case 'insufficient-gas':\n return t('withdrawCrypto.errorInsufficientGas')\n case 'switch-chain':\n return t('withdrawCrypto.errorSwitchChain')\n }\n const detail = message?.trim()\n if (!detail) return t('withdrawCrypto.errorGeneric')\n return detail.length > MAX_ERROR_DETAIL_CHARS\n ? `${detail.slice(0, MAX_ERROR_DETAIL_CHARS)}\u2026`\n : detail\n}\n", "import {\n type CheckoutQuoteResponse,\n type CryptoWithdrawalOrder,\n type WalletExecutionErrorCode,\n createWithdrawalSubmissionId,\n ensureRelayClientInitialized,\n isUserRejectedError,\n processCryptoWithdrawalOrder,\n toWalletExecutionErrorCode,\n} from '@funkit/connect-core'\nimport { useCallback, useRef, useState } from 'react'\n\nimport type {\n WithdrawalFlowCallbacks,\n WithdrawalFlowConfig,\n WithdrawalToken,\n} from '../flow/withdrawalFlowConfig'\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\n\n// Module-scoped because the hook and its refs unmount when the sheet closes\n// while the transfer is still running: a reopen mounts a fresh hook whose own\n// ref guard knows nothing about the signature already in flight.\nconst inFlightWithdrawals = new Set<string>()\n\n/** What makes two presses the same withdrawal rather than two of them. */\nfunction withdrawalKey({\n walletAddress,\n recipientAddress,\n amount,\n sourceToken,\n destinationToken,\n}: {\n walletAddress: string\n recipientAddress: string\n amount: string\n sourceToken: WithdrawalToken\n destinationToken: WithdrawalToken\n}): string {\n return [\n walletAddress,\n recipientAddress,\n amount,\n sourceToken.chainId,\n sourceToken.address,\n destinationToken.chainId,\n destinationToken.address,\n ]\n .join('|')\n .toLowerCase()\n}\n\n/**\n * @internal Test-only: clear the process-wide in-flight set so suites that\n * reuse withdrawal details stay isolated. Not part of the public API.\n */\nexport function __resetInFlightCryptoWithdrawals(): void {\n inFlightWithdrawals.clear()\n}\n\nexport type CryptoWithdrawalSubmission =\n | { status: 'idle' }\n | { status: 'submitting'; stepMessage?: string }\n | {\n status: 'submitted'\n txHash: string\n submissionId: string\n /** The amount that executed, not whatever the field says by now. */\n amount: string\n }\n | {\n status: 'failed'\n code: WalletExecutionErrorCode\n /**\n * The error's own text. Read by the form only where the classified cause\n * says nothing the user can act on \u2014 a failure the SDK cannot name is\n * better reported in the provider's words than as \"please try again\".\n */\n message: string\n }\n\nexport interface UseCryptoWithdrawalExecutionParams {\n config: WithdrawalFlowConfig\n sourceToken: WithdrawalToken\n destinationToken: WithdrawalToken\n callbacks: WithdrawalFlowCallbacks\n}\n\n/**\n * Executes the quote the user approved.\n *\n * Both guards are read synchronously inside the async submit \u2014 before the first\n * await \u2014 so neither may wait for a re-render: a ref for a double-tap on this\n * mount, and a module-scoped set of in-flight withdrawals for a second press\n * after the sheet was closed and reopened mid-execution. The set holds only\n * while the signature is outstanding; deliberately sending the same amount to\n * the same address again once it has settled is a legitimate withdrawal.\n */\nexport function useCryptoWithdrawalExecution({\n config,\n sourceToken,\n destinationToken,\n callbacks,\n}: UseCryptoWithdrawalExecutionParams) {\n const { apiKey, userId } = useFunkitIdentity()\n const isSubmittingRef = useRef(false)\n const [submission, setSubmission] = useState<CryptoWithdrawalSubmission>({\n status: 'idle',\n })\n\n const submit = useCallback(\n async ({\n quote,\n recipientAddress,\n amount,\n }: {\n /** The quote on screen \u2014 executed as-is, so fees shown are fees paid. */\n quote: CheckoutQuoteResponse\n recipientAddress: string\n amount: string\n }) => {\n if (isSubmittingRef.current) {\n logger.warn('connect-rn:crypto-withdrawal:already_submitting')\n return\n }\n const key = withdrawalKey({\n walletAddress: config.withdrawalWallet.address(),\n recipientAddress,\n amount,\n sourceToken,\n destinationToken,\n })\n if (inFlightWithdrawals.has(key)) {\n logger.warn('connect-rn:crypto-withdrawal:already_in_flight')\n return\n }\n isSubmittingRef.current = true\n inFlightWithdrawals.add(key)\n\n const order: CryptoWithdrawalOrder = {\n submissionId: createWithdrawalSubmissionId(),\n recipientAddress:\n recipientAddress as CryptoWithdrawalOrder['recipientAddress'],\n sourceAmountHumanUnit: amount,\n sourceToken,\n destinationToken,\n }\n setSubmission({ status: 'submitting' })\n\n let txHash: string\n try {\n ensureRelayClientInitialized(logger, 'funkit-connect-rn')\n ;({ txHash } = await processCryptoWithdrawalOrder({\n order,\n quote,\n wallet: config.withdrawalWallet,\n apiKey,\n userId,\n logger,\n onStepMessage: (stepMessage) =>\n setSubmission({ status: 'submitting', stepMessage }),\n }))\n } catch (error) {\n if (isUserRejectedError(error)) {\n // Declining is recoverable \u2014 the form stays as it was so the user can\n // simply press again.\n logger.warn('connect-rn:crypto-withdrawal:user_rejected', {\n submission_id: order.submissionId,\n })\n setSubmission({ status: 'idle' })\n return\n }\n const message = error instanceof Error ? error.message : String(error)\n logger.error(\n 'connect-rn:crypto-withdrawal:execution_failed',\n error as Error,\n { submission_id: order.submissionId },\n )\n setSubmission({\n status: 'failed',\n code: toWalletExecutionErrorCode(error),\n message,\n })\n callbacks.onWithdrawalError?.({ message })\n return\n } finally {\n isSubmittingRef.current = false\n inFlightWithdrawals.delete(key)\n }\n\n // Funds have moved \u2014 report it outside the try above, so a throw from the\n // host cannot be read as this execution failing. Host callbacks are\n // guarded where they enter the SDK (`guardHostCallbacks`), so this one\n // does not need its own.\n setSubmission({\n status: 'submitted',\n txHash,\n submissionId: order.submissionId,\n amount,\n })\n callbacks.onWithdrawalSubmitted?.(order.submissionId, txHash)\n },\n [apiKey, userId, config, sourceToken, destinationToken, callbacks],\n )\n\n const reset = useCallback(() => setSubmission({ status: 'idle' }), [])\n\n return { submission, submit, reset }\n}\n", "import { BottomSheetModal, BottomSheetScrollView } from '@gorhom/bottom-sheet'\nimport { useMemo, useState } from 'react'\nimport { StyleSheet, View, useWindowDimensions } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { AssetGrid } from '../components/AssetGrid'\nimport { PillButton } from '../components/PillButton'\nimport { ScrollFade, useScrollEdgeFades } from '../components/ScrollFade'\nimport { SheetContent, sheetSizing } from '../components/SheetContent'\nimport { TopBar } from '../components/TopBar'\nimport { FlowSheetBackground } from '../flow/FlowSheet'\nimport type { WithdrawalToken } from '../flow/withdrawalFlowConfig'\nimport { useNestedSheet } from '../hooks/useNestedSheet'\nimport { ChainAvatar } from '../icons/ChainAvatar'\nimport { TokenChainIcon } from '../icons/TokenChainIcon'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, useTheme } from '../theme/restyle'\nimport {\n ASSET_GRID_AVATAR_SIZE,\n ASSET_GRID_COLUMNS,\n gridCells,\n} from '../utils/assetGrid'\nimport { chainIconUri, chainName } from '../utils/chainDisplay'\nimport { footerBottomMargin } from '../utils/safeArea'\nimport {\n chainCarries,\n chainForToken,\n receivableTokens,\n} from '../withdrawal/receiveDestination'\nimport type { DestinationChain } from '../withdrawal/useWithdrawalDestinationTokens'\nimport { SelectReceiveTokenScreen } from './SelectReceiveTokenScreen'\n\nexport interface SelectReceiveTokenAndChainScreenProps {\n chains: DestinationChain[]\n /** What the withdrawal uses now. The draft opens on it; Confirm replaces it. */\n committed?: WithdrawalToken\n onConfirm: (chainId: number, token: string) => void\n onBack: () => void\n}\n\n/**\n * Pick the token and chain a withdrawal lands as. Taps draft, Confirm commits.\n *\n * A step rather than a sheet, so `back` pops it and popping is what discards the\n * draft. The `+N` row's list is a sheet *over* this screen, which therefore stays\n * mounted \u2014 a token picked there is still drafted on the way back.\n */\nexport function SelectReceiveTokenAndChainScreen({\n chains,\n committed,\n onConfirm,\n onBack,\n}: SelectReceiveTokenAndChainScreenProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const { height } = useWindowDimensions()\n const insets = useSafeAreaInsets()\n const { showTopFade, showBottomFade, scrollProps } = useScrollEdgeFades()\n const {\n nestedSheetRef,\n nestedScreen,\n setNestedScreen,\n openNestedScreen,\n closeNestedScreen,\n renderNestedBackdrop,\n } = useNestedSheet<'availableTokens'>()\n\n const [token, setToken] = useState(committed?.symbol)\n const [chainId, setChainId] = useState(\n committed ? Number(committed.chainId) : undefined,\n )\n // Only a pick from the full list moves this, so drafting around the grid can't\n // change which cells are on it.\n const [pinnedToken, setPinnedToken] = useState(committed?.symbol)\n\n const tokens = useMemo(() => receivableTokens(chains), [chains])\n const { cells, overflowCount } = gridCells(tokens, TOKEN_CELLS, pinnedToken)\n\n // A token carries its chain: keep the drafted one if it can deliver.\n const draftToken = (next: string) => {\n setToken(next)\n setChainId((current) => chainForToken(chains, next, current))\n }\n\n const chainLabel = (chain: DestinationChain) =>\n chainName(chain.chainId) ??\n t('networks.chainFallback', { chainId: chain.chainId })\n\n const footerBottom = footerBottomMargin(insets.bottom)\n // i18next picks the locale's own plural category from `count`, which is what\n // Russian needs to decline 2-4 differently from 5+.\n const moreLabel = t('selectReceiveToken.moreTokens', {\n count: overflowCount,\n })\n\n return (\n <Box\n style={{\n height,\n paddingTop: insets.top,\n backgroundColor: theme.background.modal,\n }}\n >\n <TopBar title={t('selectReceiveToken.title')} onBack={onBack} />\n\n <View style={styles.scrollArea}>\n {/* gorhom's scrollable, not RN's \u2014 the sheet's pan gesture otherwise\n wins on Android. The step's sheet is pinned, so nothing depends on\n the content size it reports (see sheetSizing). */}\n <BottomSheetScrollView\n style={styles.scroll}\n contentContainerStyle={[\n styles.content,\n {\n paddingBottom:\n theme.sizes.buttonLg + CONFIRM_SCROLL_GAP + footerBottom,\n },\n ]}\n showsVerticalScrollIndicator={false}\n {...scrollProps}\n >\n <AssetGrid\n title={t('selectReceiveToken.selectToken')}\n items={cells.map((symbol) => ({\n id: symbol,\n label: symbol,\n icon: (\n <TokenChainIcon symbol={symbol} size={ASSET_GRID_AVATAR_SIZE} />\n ),\n selected: symbol === token,\n onPress: () => draftToken(symbol),\n }))}\n overflow={\n overflowCount > 0\n ? {\n label: moreLabel,\n onPress: () => openNestedScreen('availableTokens'),\n accessibilityLabel: moreLabel,\n }\n : undefined\n }\n />\n\n {/* Curated order: a ruled-out chain is struck through where it stands. */}\n <AssetGrid\n title={t('selectReceiveToken.selectChain')}\n items={chains.map((chain) => ({\n id: String(chain.chainId),\n label: chainLabel(chain),\n icon: (\n <ChainAvatar\n uri={chainIconUri(chain.chainId)}\n size={ASSET_GRID_AVATAR_SIZE}\n />\n ),\n selected: chain.chainId === chainId,\n unsupported: !chainCarries(chain, token),\n onPress: () => setChainId(chain.chainId),\n }))}\n />\n </BottomSheetScrollView>\n\n {showTopFade ? (\n <ScrollFade\n edge=\"top\"\n color={theme.background.modal}\n id=\"receive-token-chain-grid\"\n />\n ) : null}\n {showBottomFade ? (\n <ScrollFade\n edge=\"bottom\"\n color={theme.background.modal}\n id=\"receive-token-chain-grid\"\n />\n ) : null}\n\n {/* After the fades, so the button paints over them rather than under. */}\n <Box style={[styles.footer, { bottom: footerBottom }]}>\n <PillButton\n label={t('common.confirm')}\n disabled={token === undefined || chainId === undefined}\n onPress={() => {\n if (token !== undefined && chainId !== undefined) {\n onConfirm(chainId, token)\n }\n }}\n />\n </Box>\n </View>\n\n <BottomSheetModal\n ref={nestedSheetRef}\n {...sheetSizing({ fullHeight: true })}\n topInset={insets.top}\n // No grabber on this screen \u2014 Close dismisses it, a drag shouldn't.\n enablePanDownToClose={false}\n handleComponent={null}\n backgroundComponent={FlowSheetBackground}\n backdropComponent={renderNestedBackdrop}\n onDismiss={() => setNestedScreen(null)}\n >\n <SheetContent fullHeight>\n {nestedScreen === 'availableTokens' ? (\n <SelectReceiveTokenScreen\n tokens={tokens}\n selectedToken={token}\n onSelectToken={(next) => {\n draftToken(next)\n // Claims the grid's last cell, and keeps it.\n setPinnedToken(next)\n closeNestedScreen()\n }}\n onClose={closeNestedScreen}\n />\n ) : null}\n </SheetContent>\n </BottomSheetModal>\n </Box>\n )\n}\n\n/** Two grid rows. */\nconst TOKEN_CELLS = ASSET_GRID_COLUMNS * 2\n\nconst CONFIRM_SCROLL_GAP = 8\n\nconst styles = StyleSheet.create({\n scrollArea: { position: 'relative', flex: 1 },\n scroll: { flex: 1 },\n content: { paddingHorizontal: 24, paddingTop: 13, gap: 40 },\n footer: { position: 'absolute', left: 0, right: 0, paddingHorizontal: 24 },\n})\n", "import type { ReactNode } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\n\nimport {\n FigmaCheckIcon,\n FigmaChevronRightIcon,\n} from '../icons/FigmaSystemIcons'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport {\n ASSET_GRID_AVATAR_SIZE,\n ASSET_GRID_COLUMNS,\n ASSET_GRID_GAP,\n chunk,\n} from '../utils/assetGrid'\n\nexport interface AssetGridItemProps {\n /** A token symbol, or a chain id. */\n id: string\n /** Size it with `ASSET_GRID_AVATAR_SIZE`. */\n icon: ReactNode\n label: string\n selected: boolean\n /** Offered but not pickable, e.g. a chain that doesn't carry the picked token. */\n unsupported?: boolean\n onPress: () => void\n /** Defaults to `label`. */\n accessibilityLabel?: string\n}\n\nexport interface AssetGridOverflow {\n /** Reads as a count, e.g. `+7 tokens`. */\n label: string\n onPress: () => void\n accessibilityLabel: string\n}\n\nexport interface AssetGridProps {\n /** Section header, e.g. \"Select token\". */\n title: string\n items: AssetGridItemProps[]\n /** The `+N tokens \u203A` row. Omit when nothing is hidden. */\n overflow?: AssetGridOverflow\n}\n\n/**\n * A titled grid of asset cells, five to a row, over an optional row leading to the\n * ones that didn't fit.\n *\n * Chunked into explicit rows of flexed columns, not wrapped on percentage widths:\n * Android rounds a percentage up to the nearest physical pixel, so five 20% cells\n * overflow their row and the fifth wraps.\n */\nexport function AssetGrid({ title, items, overflow }: AssetGridProps) {\n const theme = useTheme()\n\n return (\n <Box style={styles.section}>\n <Text variant=\"bodyMedium\" numberOfLines={1} style={styles.title}>\n {title}\n </Text>\n <Box style={styles.grid}>\n {/* Rows are positional, so their index is their identity: keying on a\n cell remounts all five when the list reflows. */}\n {chunk(items, ASSET_GRID_COLUMNS).map((row, rowIndex) => (\n <Box key={rowIndex} flexDirection=\"row\" style={styles.row}>\n {row.map((item) => (\n <AssetGridItem key={item.id} {...item} />\n ))}\n {/* A short last row still has to sit on the column rhythm. */}\n {Array.from(\n { length: ASSET_GRID_COLUMNS - row.length },\n (_, slot) => (\n <Box key={`filler-${slot}`} style={styles.filler} />\n ),\n )}\n </Box>\n ))}\n </Box>\n {overflow ? (\n <Pressable\n onPress={overflow.onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={overflow.accessibilityLabel}\n >\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.overflow}>\n {/* Without a flexed box the label can't shrink, so a long one pushes\n the chevron past the row's edge instead of ellipsizing. */}\n <Box flex={1}>\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n style={{ color: theme.content.elements.secondary }}\n >\n {overflow.label}\n </Text>\n </Box>\n <FigmaChevronRightIcon\n size={20}\n color={theme.content.elements.secondary}\n />\n </Box>\n </Pressable>\n ) : null}\n </Box>\n )\n}\n\n/** One cell of the grid (Figma `icon/crypto-token` + its label). */\nexport function AssetGridItem({\n icon,\n label,\n selected,\n unsupported = false,\n onPress,\n accessibilityLabel,\n}: AssetGridItemProps) {\n const theme = useTheme()\n // Marking a struck-through cell as chosen would contradict itself in the frame\n // before the caller moves the pick off it.\n const isMarked = selected && !unsupported\n\n return (\n <Pressable\n onPress={onPress}\n disabled={unsupported}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel ?? label}\n accessibilityState={{ selected: isMarked, disabled: unsupported }}\n style={styles.cell}\n >\n <Box alignItems=\"center\" style={styles.stack}>\n <Box style={styles.avatar}>\n <Box\n style={\n unsupported\n ? { opacity: theme.opacity.disabled / 100 }\n : undefined\n }\n >\n {icon}\n </Box>\n {isMarked ? (\n <>\n {/* Two rings over the logo rather than a smaller logo inside a\n border: the design crops the avatar, it doesn't scale it. */}\n <Box\n pointerEvents=\"none\"\n style={[\n styles.ringGap,\n { borderColor: theme.background.modal },\n ]}\n />\n <Box\n pointerEvents=\"none\"\n style={[\n styles.ring,\n { borderColor: theme.content.elements.primary },\n ]}\n />\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[\n styles.badge,\n {\n backgroundColor: theme.content.elements.primary,\n borderColor: theme.background.modal,\n },\n ]}\n >\n <FigmaCheckIcon\n size={12}\n color={theme.content.button.primary.default}\n />\n </Box>\n </>\n ) : null}\n </Box>\n <Text\n variant=\"detail\"\n weight=\"medium\"\n numberOfLines={1}\n style={[\n styles.label,\n unsupported\n ? {\n color: theme.content.elements.secondary,\n textDecorationLine: 'line-through',\n }\n : { color: theme.content.elements.primary },\n ]}\n >\n {label}\n </Text>\n </Box>\n </Pressable>\n )\n}\n\nconst BADGE_SIZE = 24\n\nconst styles = StyleSheet.create({\n section: { gap: 4 },\n title: { paddingBottom: 12 },\n grid: { gap: ASSET_GRID_GAP },\n row: { gap: ASSET_GRID_GAP },\n filler: { flex: 1 },\n overflow: { gap: 6, paddingVertical: 13 },\n // Cells are sized by the row they sit in, not by a width of their own.\n cell: { flex: 1 },\n stack: { gap: 6 },\n avatar: { width: ASSET_GRID_AVATAR_SIZE, height: ASSET_GRID_AVATAR_SIZE },\n ringGap: {\n ...StyleSheet.absoluteFill,\n borderRadius: 999,\n borderWidth: 4,\n },\n ring: { ...StyleSheet.absoluteFill, borderRadius: 999, borderWidth: 2 },\n badge: {\n position: 'absolute',\n right: 0,\n bottom: 0,\n width: BADGE_SIZE,\n height: BADGE_SIZE,\n borderRadius: 999,\n borderWidth: 2,\n },\n // A chain name runs wider than the avatar, so it borrows half the gutter either\n // side rather than ellipsizing at the cell's edge.\n label: {\n textAlign: 'center',\n alignSelf: 'stretch',\n marginHorizontal: -ASSET_GRID_GAP / 2,\n },\n})\n", "export const ASSET_GRID_COLUMNS = 5\nexport const ASSET_GRID_GAP = 16\n/** Shared so a cell's selection ring lands on the circle the caller passed it. */\nexport const ASSET_GRID_AVATAR_SIZE = 58\n\n/**\n * The cells a capped grid offers, and how many the `+N` affordance stands for.\n *\n * - `mustShow` takes the **last** slot when the head would have hidden it, so a\n * pick made behind the `+N` row comes back without adding a row or moving any\n * other cell. Matched by identity.\n * - A non-positive `capacity` means no cap, so a caller still resolving its limit\n * shows what it has rather than an empty grid.\n */\nexport function gridCells<T>(\n items: T[],\n capacity: number,\n mustShow?: T,\n): { cells: T[]; overflowCount: number } {\n if (capacity <= 0 || items.length <= capacity) {\n return { cells: items, overflowCount: 0 }\n }\n const head = items.slice(0, capacity)\n const needsSlot =\n mustShow !== undefined &&\n !head.includes(mustShow) &&\n items.includes(mustShow)\n return {\n cells: needsSlot ? [...head.slice(0, -1), mustShow] : head,\n overflowCount: items.length - capacity,\n }\n}\n\n/** A non-positive `size` can't advance the cursor, so it stays one row. */\nexport function chunk<T>(items: T[], size: number): T[][] {\n if (size <= 0) {\n return items.length > 0 ? [items] : []\n }\n const rows: T[][] = []\n for (let i = 0; i < items.length; i += size) {\n rows.push(items.slice(i, i + size))\n }\n return rows\n}\n", "import type { ReactNode } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\n\nimport { FigmaChevronLeftIcon, FigmaCloseIcon } from '../icons/FigmaSystemIcons'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\nconst ICON_SIZE = 20\n\nexport interface TopBarProps {\n title: string\n /** Pops the screen. Omit at the root of a flow. */\n onBack?: () => void\n /** Ends the flow. Omit where this screen can't be abandoned. */\n onClose?: () => void\n}\n\n/**\n * The sheet's header: back, title, close.\n */\nexport function TopBar({ title, onBack, onClose }: TopBarProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n\n return (\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.bar}>\n <IconSlot\n onPress={onBack}\n label={t('common.back')}\n icon={\n <FigmaChevronLeftIcon\n size={ICON_SIZE}\n color={theme.content.button.icon.default}\n />\n }\n />\n <Text\n variant=\"headerTitle\"\n numberOfLines={1}\n // The design's line box, so the title's place in the row doesn't move\n // with the font-size token or the platform's own leading.\n style={[\n styles.title,\n { lineHeight: theme.textVariants.bodyMedium.lineHeight },\n ]}\n >\n {title}\n </Text>\n <IconSlot\n onPress={onClose}\n label={t('common.close')}\n icon={\n <FigmaCloseIcon\n size={ICON_SIZE}\n color={theme.content.button.icon.default}\n />\n }\n />\n </Box>\n )\n}\n\n/** One 32-square of the bar, empty when the host gave it nothing to do. */\nfunction IconSlot({\n onPress,\n label,\n icon,\n}: {\n onPress?: () => void\n label: string\n icon: ReactNode\n}) {\n if (!onPress) {\n return <Box style={styles.slot} />\n }\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n // Takes the 32-square up to the 44 a finger needs.\n hitSlop={6}\n style={styles.slot}\n >\n {icon}\n </Pressable>\n )\n}\n\nconst styles = StyleSheet.create({\n bar: { paddingTop: 20, paddingBottom: 12, paddingHorizontal: 12, gap: 4 },\n slot: {\n width: 32,\n height: 32,\n alignItems: 'center',\n justifyContent: 'center',\n },\n title: { flex: 1 },\n})\n", "import type { DestinationChain } from './useWithdrawalDestinationTokens'\n\n/** Nothing picked rules nothing out. */\nexport function chainCarries(\n chain: DestinationChain,\n token: string | undefined,\n): boolean {\n return !token || chain.symbols.includes(token)\n}\n\n/**\n * The preferred chain if it carries the token, else the first that does \u2014 keeping\n * a still-valid preference is what stops a new token moving the network under it.\n */\nexport function chainForToken(\n chains: DestinationChain[],\n token: string,\n preferredChainId: number | undefined,\n): number | undefined {\n const preferred = chains.find((chain) => chain.chainId === preferredChainId)\n if (preferred?.symbols.includes(token)) return preferred.chainId\n return chains.find((chain) => chain.symbols.includes(token))?.chainId\n}\n\n/** Deduped, curated order intact. */\nexport function receivableTokens(chains: DestinationChain[]): string[] {\n return [...new Set(chains.flatMap((chain) => chain.symbols))]\n}\n", "import { BottomSheetScrollView } from '@gorhom/bottom-sheet'\nimport { useState } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { ScrollFade, useScrollEdgeFades } from '../components/ScrollFade'\nimport { SearchInput } from '../components/SearchInput'\nimport { SelectableAssetRow } from '../components/SelectableAssetRow'\nimport { TopBar } from '../components/TopBar'\nimport { useNestedSheetHeight } from '../hooks/useNestedSheetHeight'\nimport { TokenChainIcon } from '../icons/TokenChainIcon'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, useTheme } from '../theme/restyle'\n\nconst ROW_AVATAR_SIZE = 36\n\nexport interface SelectReceiveTokenScreenProps {\n tokens: string[]\n selectedToken?: string\n /** Drafts the token and hands control back to the screen underneath. */\n onSelectToken: (token: string) => void\n onClose: () => void\n}\n\n/**\n * Every token a withdrawal can be received as, searchable \u2014 the tail behind the\n * grid's `+N tokens` row. A tap drafts and returns; only the grid commits.\n */\nexport function SelectReceiveTokenScreen({\n tokens,\n selectedToken,\n onSelectToken,\n onClose,\n}: SelectReceiveTokenScreenProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const sheetHeight = useNestedSheetHeight()\n const insets = useSafeAreaInsets()\n const { showTopFade, showBottomFade, scrollProps } = useScrollEdgeFades()\n const [query, setQuery] = useState('')\n\n const needle = query.trim().toLowerCase()\n const orderedTokens =\n selectedToken && tokens.includes(selectedToken)\n ? [selectedToken, ...tokens.filter((token) => token !== selectedToken)]\n : tokens\n const matches = orderedTokens.filter((token) =>\n token.toLowerCase().includes(needle),\n )\n const searchPlaceholder = t('selectReceiveToken.searchTokens')\n\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={{\n height: sheetHeight,\n backgroundColor: theme.background.modal,\n }}\n >\n <TopBar\n title={t('selectReceiveToken.availableTokens')}\n onClose={onClose}\n />\n\n <Box style={styles.search}>\n <SearchInput\n value={query}\n onChangeValue={setQuery}\n placeholder={searchPlaceholder}\n accessibilityLabel={searchPlaceholder}\n />\n </Box>\n\n <View style={styles.scrollArea}>\n <BottomSheetScrollView\n style={styles.scroll}\n contentContainerStyle={[\n styles.list,\n { paddingBottom: insets.bottom + LIST_BOTTOM_GAP },\n ]}\n showsVerticalScrollIndicator={false}\n keyboardShouldPersistTaps=\"handled\"\n {...scrollProps}\n >\n {matches.map((token) => (\n <SelectableAssetRow\n key={token}\n name={token}\n icon={<TokenChainIcon symbol={token} size={ROW_AVATAR_SIZE} />}\n selected={token === selectedToken}\n onPress={() => onSelectToken(token)}\n accessibilityLabel={token}\n />\n ))}\n </BottomSheetScrollView>\n\n {showTopFade ? (\n <ScrollFade\n edge=\"top\"\n color={theme.background.modal}\n id=\"receive-token-list\"\n />\n ) : null}\n {showBottomFade ? (\n <ScrollFade\n edge=\"bottom\"\n color={theme.background.modal}\n id=\"receive-token-list\"\n />\n ) : null}\n </View>\n </Box>\n )\n}\n\n// Read off the inset so the last row clears the home indicator on any device.\nconst LIST_BOTTOM_GAP = 16\n\nconst styles = StyleSheet.create({\n search: { paddingHorizontal: 24, paddingBottom: 12 },\n scrollArea: { position: 'relative', flex: 1 },\n scroll: { flex: 1 },\n list: { paddingHorizontal: 16 },\n})\n", "import { BottomSheetTextInput } from '@gorhom/bottom-sheet'\nimport { useState } from 'react'\nimport { StyleSheet } from 'react-native'\n\nimport { FigmaSearchIcon } from '../icons/FigmaSystemIcons'\nimport { Box, useTheme } from '../theme/restyle'\n\nexport interface SearchInputProps {\n value: string\n onChangeValue: (value: string) => void\n placeholder: string\n accessibilityLabel: string\n}\n\n/**\n * A single-line filter field for long pick lists.\n *\n * Uses gorhom's `BottomSheetTextInput`, so the screen hosting it must set\n * `keyboardAvoidEnabled` on `FlowSheet` \u2014 gorhom's native avoidance is inert\n * under `enableDynamicSizing` (see `useKeyboardHeight`).\n */\nexport function SearchInput({\n value,\n onChangeValue,\n placeholder,\n accessibilityLabel,\n}: SearchInputProps) {\n const theme = useTheme()\n const [isFocused, setIsFocused] = useState(false)\n\n return (\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n borderRadius=\"element\"\n style={[\n styles.field,\n {\n backgroundColor: theme.background.modal,\n borderColor: isFocused\n ? theme.border.elements.selected.color\n : theme.border.elements.default.color,\n borderWidth: theme.border.elements.default.weight,\n },\n ]}\n >\n <FigmaSearchIcon size={16} color={theme.content.elements.secondary} />\n <BottomSheetTextInput\n value={value}\n onChangeText={onChangeValue}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n placeholder={placeholder}\n placeholderTextColor={theme.content.elements.secondary}\n accessibilityLabel={accessibilityLabel}\n autoCapitalize=\"characters\"\n autoCorrect={false}\n spellCheck={false}\n returnKeyType=\"search\"\n style={[\n styles.input,\n theme.textVariants.body,\n { color: theme.content.elements.primary },\n ]}\n />\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n field: { height: 48, paddingLeft: 16, paddingRight: 8, gap: 8 },\n // Undo the platform's own padding so the field's height is the box's.\n input: { flex: 1, padding: 0 },\n})\n", "import type { ReactNode } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\n\nimport { FigmaCheckIcon } from '../icons/FigmaSystemIcons'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\nexport interface SelectableAssetRowProps {\n name: string\n /** The 36px leading avatar \u2014 a token, a chain, or a token-on-chain pair. */\n icon: ReactNode\n selected: boolean\n /** Offered but not pickable, e.g. a chain that doesn't carry the picked token. */\n disabled?: boolean\n onPress: () => void\n accessibilityLabel: string\n}\n\n/** One row of a token or chain pick list (Figma `list-item/base`). */\nexport function SelectableAssetRow({\n name,\n icon,\n selected,\n disabled = false,\n onPress,\n accessibilityLabel,\n}: SelectableAssetRowProps) {\n const theme = useTheme()\n\n return (\n <Pressable\n onPress={onPress}\n disabled={disabled}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected, disabled }}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n borderRadius=\"element\"\n style={[\n styles.row,\n selected ? { backgroundColor: theme.background.secondary } : null,\n disabled ? { opacity: theme.opacity.disabled / 100 } : null,\n ]}\n >\n {icon}\n <Box flex={1}>\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n style={{ color: theme.content.elements.primary }}\n >\n {name}\n </Text>\n </Box>\n {selected ? (\n <FigmaCheckIcon size={20} color={theme.content.elements.secondary} />\n ) : null}\n </Box>\n </Pressable>\n )\n}\n\nconst styles = StyleSheet.create({\n row: { gap: 12, paddingHorizontal: 12, paddingVertical: 10 },\n})\n", "import { BottomSheetScrollView } from '@gorhom/bottom-sheet'\nimport { Pressable, StyleSheet, View, useWindowDimensions } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { Grabber } from '../components/Grabber'\nimport { ScrollFade, useScrollEdgeFades } from '../components/ScrollFade'\nimport type { WithdrawalSourceTokenOption } from '../flow/withdrawalFlowConfig'\nimport { FigmaSuccessCheckIcon } from '../icons/FigmaSystemIcons'\nimport { TokenChainIcon } from '../icons/TokenChainIcon'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\nexport interface SelectSourceTokenScreenProps {\n options: WithdrawalSourceTokenOption[]\n /** Index into `options` \u2014 two options can share a symbol (perps vs spot). */\n selectedIndex: number\n onSelect: (index: number) => void\n onBack: () => void\n}\n\n/**\n * Pick which balance the withdrawal comes out of. Flat, not grouped by chain:\n * the sources a host offers are balances on one venue, and two of them can\n * share a symbol (Lighter's perps and spot USDC), so the row identity is the\n * option itself rather than its symbol.\n */\nexport function SelectSourceTokenScreen({\n options,\n selectedIndex,\n onSelect,\n onBack,\n}: SelectSourceTokenScreenProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const { height } = useWindowDimensions()\n const insets = useSafeAreaInsets()\n const { showTopFade, showBottomFade, scrollProps } = useScrollEdgeFades()\n\n return (\n // A full window tall, like the step it replaces \u2014 the flow sheet is pinned\n // to a fixed detent while a crypto withdrawal step is up (see sheetSizing).\n <Box style={{ height, paddingTop: insets.top }}>\n <Grabber />\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n style={[styles.topBar, { height: theme.sizes.topBar }]}\n >\n <Pressable\n onPress={onBack}\n accessibilityRole=\"button\"\n accessibilityLabel={t('common.back')}\n hitSlop={8}\n >\n <Text variant=\"bodyMedium\">{t('common.back')}</Text>\n </Pressable>\n <Text variant=\"headerTitle\" style={styles.title}>\n {t('withdrawCrypto.selectSource')}\n </Text>\n <Box style={styles.spacer} />\n </Box>\n\n <View style={styles.scrollArea}>\n <BottomSheetScrollView\n style={styles.scroll}\n contentContainerStyle={[\n styles.list,\n { paddingBottom: LIST_BOTTOM_GAP + insets.bottom },\n ]}\n showsVerticalScrollIndicator={false}\n {...scrollProps}\n >\n {options.map((option, index) => {\n const label = option.label ?? option.token.symbol\n const isSelected = index === selectedIndex\n return (\n <Pressable\n // Identity is positional \u2014 two options can be the same token\n // with the same label and differ only in which balance they\n // draw from, so the index is the only unique part of the key.\n key={`${index}:${option.token.chainId}:${option.token.address}`}\n onPress={() => onSelect(index)}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n accessibilityState={{ selected: isSelected }}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n borderRadius=\"element\"\n style={[\n styles.row,\n isSelected\n ? { backgroundColor: theme.background.secondary }\n : undefined,\n ]}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n style={styles.token}\n >\n <TokenChainIcon\n symbol={option.token.symbol}\n iconSrc={option.iconSrc}\n />\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {label}\n </Text>\n </Box>\n {isSelected ? <FigmaSuccessCheckIcon size={16} /> : null}\n </Box>\n </Pressable>\n )\n })}\n </BottomSheetScrollView>\n {showTopFade ? (\n <ScrollFade\n edge=\"top\"\n color={theme.background.modal}\n id=\"source-token-list\"\n />\n ) : null}\n {showBottomFade ? (\n <ScrollFade\n edge=\"bottom\"\n color={theme.background.modal}\n id=\"source-token-list\"\n />\n ) : null}\n </View>\n </Box>\n )\n}\n\n/** Keeps the last row clear of the sheet edge. */\nconst LIST_BOTTOM_GAP = 24\n\nconst styles = StyleSheet.create({\n topBar: { paddingHorizontal: 16, gap: 12 },\n title: { flex: 1 },\n spacer: { width: 20 },\n scrollArea: { flex: 1, position: 'relative' },\n scroll: { flex: 1 },\n list: { paddingHorizontal: 16, gap: 4 },\n row: { paddingHorizontal: 12, paddingVertical: 10 },\n token: { gap: 10 },\n})\n", "import { StyleSheet } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { Grabber } from '../components/Grabber'\nimport { TopBar } from '../components/TopBar'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\nexport interface TransactionBreakdownScreenProps {\n /** What the recipient should expect, e.g. `$99.94`. */\n usdLabel: string\n /** The floor the trade won't execute below, e.g. `$99.81`. */\n floorLabel: string\n}\n\n/**\n * What the quoted amount means, in prose: it is an estimate, it has a floor, and\n * it settles in seconds. Opened from the \u24D8 beside the amount.\n */\nexport function TransactionBreakdownScreen({\n usdLabel,\n floorLabel,\n}: TransactionBreakdownScreenProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const insets = useSafeAreaInsets()\n\n return (\n <Box>\n <Grabber />\n <TopBar title={t('withdrawAddress.breakdownTitle')} />\n\n {/* The design's own 16 below the paragraph, and then the home indicator's\n band \u2014 which the sheet sits under, so the inset is added rather than\n standing in for it. */}\n <Box\n style={[styles.body, { paddingBottom: BODY_PADDING + insets.bottom }]}\n >\n <Text\n variant=\"detail\"\n style={{ color: theme.content.elements.secondary }}\n >\n {emphasise(\n t('withdrawAddress.breakdown', {\n amount: usdLabel,\n minimum: floorLabel,\n }),\n [usdLabel, floorLabel],\n theme.content.elements.primary,\n )}\n </Text>\n </Box>\n </Box>\n )\n}\n\n/**\n * The two figures, set in the emphasis the design gives them, without splitting\n * the sentence into fragments a translator can't reorder: the copy stays one\n * string, and the values are found in whatever place the translation puts them.\n */\nfunction emphasise(sentence: string, values: string[], color: string) {\n const pattern = values.filter(Boolean).map(escapeForRegExp).join('|')\n if (!pattern) {\n return sentence\n }\n return sentence.split(new RegExp(`(${pattern})`)).map((part, index) =>\n values.includes(part) ? (\n // Index-keyed: a figure can legitimately appear twice, so the value is\n // not a key.\n <Text key={index} variant=\"detail\" weight=\"medium\" style={{ color }}>\n {part}\n </Text>\n ) : (\n part\n ),\n )\n}\n\nconst escapeForRegExp = (value: string) =>\n value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n\n// Measured off the design: the body is inset 20 across and 16 down.\nconst BODY_PADDING = 16\n\nconst styles = StyleSheet.create({\n body: { paddingHorizontal: 20, paddingTop: BODY_PADDING },\n})\n", "import {\n ActivityIndicator,\n StyleSheet,\n useWindowDimensions,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { PillButton } from '../components/PillButton'\nimport { ReceiveAmountSummary } from '../components/ReceiveAmountSummary'\nimport { ReceiveAsRow } from '../components/ReceiveAsRow'\nimport { TopBar } from '../components/TopBar'\nimport { WalletAddressInput } from '../components/WalletAddressInput'\nimport type { WithdrawalToken } from '../flow/withdrawalFlowConfig'\nimport { useKeyboardHeight } from '../flow/useKeyboardHeight'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { footerBottomMargin } from '../utils/safeArea'\n\nexport interface WithdrawAddressScreenProps {\n /** Names the amount already confirmed, e.g. `Withdraw $100`. */\n title: string\n /** The typed recipient. */\n recipient: string\n onChangeRecipient: (value: string) => void\n /** Whether the recipient is an address at all; `undefined` while empty. */\n isAddress: boolean | undefined\n onPaste: () => void\n /** A clipboard read is out \u2014 the Paste action is held down until it lands. */\n isPasting?: boolean\n /** Omit to drop the connected-wallet shortcut. */\n onUseConnected?: () => void\n /** A reason the address can't be used, past being well-formed. */\n errorText?: string\n /** Non-blocking caution, e.g. a flagged-address notice. */\n warningText?: string\n /** What the withdrawal is received as, and the picker for it. */\n destinationToken: WithdrawalToken | undefined\n onPressReceive: () => void\n /**\n * What the recipient gets, in the currency the screen leads with. `undefined`\n * until the quote settles.\n */\n usdLabel: string | undefined\n /** The same amount in the token that arrives, e.g. `99.78 USDC`. */\n tokenLabel: string | undefined\n onPressBreakdown: () => void\n /** The quote couldn't be got \u2014 shown where the figure would be. */\n quoteErrorText?: string\n canSubmit: boolean\n /** The signature is in flight, or the quote it needs isn't settled. */\n isBusy: boolean\n /** The signature specifically \u2014 what the button reports while it is out. */\n isSubmitting: boolean\n onSubmit: () => void\n /** An unrecoverable failure from the last attempt. */\n executionErrorText?: string\n onBack: () => void\n onClose: () => void\n}\n\n/**\n * Step two of the crypto withdrawal: where the money goes, and what it arrives\n * as. The amount was taken on the step before and is named in the title.\n */\nexport function WithdrawAddressScreen({\n title,\n recipient,\n onChangeRecipient,\n isAddress,\n onPaste,\n isPasting,\n onUseConnected,\n errorText,\n warningText,\n destinationToken,\n onPressReceive,\n usdLabel,\n tokenLabel,\n onPressBreakdown,\n quoteErrorText,\n canSubmit,\n isBusy,\n isSubmitting,\n onSubmit,\n executionErrorText,\n onBack,\n onClose,\n}: WithdrawAddressScreenProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const { height } = useWindowDimensions()\n const insets = useSafeAreaInsets()\n // The screen is already the whole window, so the sheet can't lift it: the\n // footer is what has to clear the keyboard.\n const keyboardHeight = useKeyboardHeight(true)\n const footerErrorText = executionErrorText ?? quoteErrorText\n\n return (\n <Box\n style={{\n height,\n paddingTop: insets.top,\n backgroundColor: theme.background.modal,\n }}\n >\n <TopBar title={title} onBack={onBack} onClose={onClose} />\n\n <Box style={styles.body}>\n <ReceiveAsRow\n destinationToken={destinationToken}\n onPress={onPressReceive}\n />\n <WalletAddressInput\n value={recipient}\n onChangeText={onChangeRecipient}\n isAddress={isAddress}\n onPaste={onPaste}\n isPasting={isPasting}\n onUseConnected={onUseConnected}\n errorText={errorText}\n warningText={warningText}\n />\n </Box>\n\n {/* Only an address gets a figure: there is nothing to quote against one\n that isn't, and a number beside \"no wallet found\" reads as a promise. */}\n <Box flex={1} justifyContent=\"center\" style={styles.summary}>\n {isAddress ? (\n <ReceiveAmountSummary\n label={t('withdrawAddress.youllReceive')}\n usdLabel={usdLabel}\n tokenLabel={tokenLabel}\n // Nothing to break down until there is a figure.\n onPressBreakdown={usdLabel ? onPressBreakdown : undefined}\n />\n ) : null}\n </Box>\n\n {/* The way to send it waits on an address too. */}\n {recipient === '' ? null : (\n <>\n <Box\n style={[\n styles.footer,\n {\n marginBottom:\n keyboardHeight > 0\n ? keyboardHeight + FOOTER_KEYBOARD_GAP\n : footerBottomMargin(insets.bottom),\n },\n ]}\n >\n {/* The last attempt's failure outranks a missing price: it is about\n money that already moved. */}\n {footerErrorText ? (\n <Text\n variant=\"detail\"\n style={[\n styles.footerError,\n { color: theme.content.elements.error },\n ]}\n >\n {footerErrorText}\n </Text>\n ) : null}\n {/* The chrome stays up while the wallet has the signature: the\n design's first submitting beat only changes the button. */}\n <PillButton\n label={\n isSubmitting\n ? t('withdrawAddress.withdrawing')\n : t('withdrawAddress.withdrawNow')\n }\n icon={\n isSubmitting ? (\n <ActivityIndicator\n size=\"small\"\n color={theme.content.button.primary.default}\n />\n ) : undefined\n }\n disabled={!canSubmit || isBusy}\n onPress={onSubmit}\n />\n </Box>\n </>\n )}\n </Box>\n )\n}\n\n// Measured off the design (a 402\u00D7778 content area above the home indicator).\nconst BODY_HORIZONTAL_MARGIN = 20\nconst FOOTER_KEYBOARD_GAP = 12\n\nconst styles = StyleSheet.create({\n body: {\n marginHorizontal: BODY_HORIZONTAL_MARGIN,\n paddingTop: 12,\n gap: 16,\n },\n summary: { paddingHorizontal: BODY_HORIZONTAL_MARGIN, paddingVertical: 12 },\n footer: { marginHorizontal: BODY_HORIZONTAL_MARGIN, gap: 12 },\n footerError: { textAlign: 'center' },\n})\n", "import type { WithdrawalToken } from '../flow/withdrawalFlowConfig'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { chainIconUri, chainName } from '../utils/chainDisplay'\nimport { SelectedChainRow } from './SelectedChainRow'\n\nexport interface ReceiveAsRowProps {\n /** The picked destination, or `undefined` while the list is resolving. */\n destinationToken: WithdrawalToken | undefined\n /** Opens the receive-token picker. */\n onPress: () => void\n}\n\n/**\n * What the withdrawal is received as, and the way to change it. Shared by the\n * screens that show it \u2014 the row is the same on both, and a second copy is how\n * the label and the token/chain wording drift apart.\n */\nexport function ReceiveAsRow({ destinationToken, onPress }: ReceiveAsRowProps) {\n const { t } = useFunkitTranslation()\n const label = t('withdrawCrypto.receiveAs')\n\n return (\n <SelectedChainRow\n label={label}\n name={\n destinationToken\n ? `${destinationToken.symbol} \u00B7 ${\n chainName(Number(destinationToken.chainId)) ??\n t('networks.chainFallback', {\n chainId: destinationToken.chainId,\n })\n }`\n : t('common.loading')\n }\n iconUri={chainIconUri(\n destinationToken ? Number(destinationToken.chainId) : 0,\n )}\n accessibilityLabel={label}\n onPress={onPress}\n />\n )\n}\n", "import { BottomSheetTextInput } from '@gorhom/bottom-sheet'\nimport { StyleSheet } from 'react-native'\n\nimport {\n FigmaAlertCircleIcon,\n FigmaSuccessCheckIcon,\n} from '../icons/FigmaSystemIcons'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { PillButton } from './PillButton'\n\nconst STATUS_ICON_SIZE = 16\n\nexport interface WalletAddressInputProps {\n value: string\n onChangeText: (value: string) => void\n /**\n * Whether what has been typed is an address at all. `undefined` while the\n * field is empty, where the design shows no verdict either way.\n */\n isAddress: boolean | undefined\n /** Fills the field from the clipboard. */\n onPaste: () => void\n /**\n * A clipboard read is out. The read can block for seconds on the OS\n * permission prompt, so Paste is held down until it lands rather than letting\n * a second tap queue a second read.\n */\n isPasting?: boolean\n /**\n * Fills the field with the connected wallet's own address. Omit to drop the\n * shortcut (see `disableConnectedWallet` on the flow config).\n */\n onUseConnected?: () => void\n /** A reason the address can't be used, past being well-formed. */\n errorText?: string\n /** Non-blocking caution, e.g. a flagged-address notice. */\n warningText?: string\n}\n\n/**\n * The recipient field: the address, its verdict, and the two ways to fill it.\n *\n * `Paste` is the primary action while the field is empty \u2014 an address is pasted\n * far more often than typed \u2014 and gives way to the quieter pair once there is\n * something to clear.\n */\nexport function WalletAddressInput({\n value,\n onChangeText,\n isAddress,\n onPaste,\n isPasting = false,\n onUseConnected,\n errorText,\n warningText,\n}: WalletAddressInputProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const label = t('withdrawCrypto.addressPlaceholder')\n const isEmpty = value === ''\n\n // An error outranks a warning: both describe the same field, and the blocking\n // one is what the user has to act on.\n const helperText = errorText ?? warningText\n\n return (\n <Box style={styles.root}>\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n style={styles.header}\n >\n <Text\n variant=\"detail\"\n weight=\"medium\"\n numberOfLines={1}\n style={[styles.label, { color: theme.content.elements.secondary }]}\n >\n {label}\n </Text>\n {isAddress === undefined ? null : (\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.status}>\n {isAddress ? (\n <FigmaSuccessCheckIcon size={STATUS_ICON_SIZE} />\n ) : (\n <FigmaAlertCircleIcon\n size={STATUS_ICON_SIZE}\n color={theme.content.elements.error}\n />\n )}\n <Text\n variant=\"detail\"\n weight=\"medium\"\n style={{\n color: isAddress\n ? theme.content.elements.success\n : theme.content.elements.error,\n }}\n >\n {isAddress\n ? t('withdrawAddress.detected')\n : t('withdrawAddress.notFound')}\n </Text>\n </Box>\n )}\n </Box>\n\n <Box\n borderRadius=\"element\"\n style={[\n styles.field,\n {\n height: theme.sizes.buttonLg,\n borderColor: theme.border.elements.default.color,\n borderWidth: theme.border.elements.default.weight,\n backgroundColor: theme.background.modal,\n },\n ]}\n >\n {/* One line, not wrapped: the verdict beside the label is what says the\n address is complete, so the field doesn't have to show all of it. */}\n <BottomSheetTextInput\n value={value}\n onChangeText={onChangeText}\n placeholder={label}\n placeholderTextColor={theme.content.elements.secondary}\n accessibilityLabel={label}\n autoCapitalize=\"none\"\n autoCorrect={false}\n spellCheck={false}\n style={[\n styles.input,\n theme.textVariants.bodyMedium,\n { color: theme.content.elements.primary },\n ]}\n />\n </Box>\n\n <Box flexDirection=\"row\" style={styles.buttonRow}>\n <Box style={styles.button}>\n <PillButton\n label={t('withdrawAddress.paste')}\n size=\"buttonMd\"\n variant={isEmpty ? 'primary' : 'secondary'}\n onPress={onPaste}\n disabled={isPasting}\n />\n </Box>\n <Box style={styles.button}>\n {isEmpty ? (\n onUseConnected ? (\n <PillButton\n label={t('withdrawAddress.useConnected')}\n size=\"buttonMd\"\n variant=\"secondary\"\n onPress={onUseConnected}\n />\n ) : null\n ) : (\n <PillButton\n label={t('withdrawAddress.clear')}\n size=\"buttonMd\"\n variant=\"secondary\"\n onPress={() => onChangeText('')}\n />\n )}\n </Box>\n </Box>\n\n {helperText ? (\n <Text\n variant=\"detail\"\n style={{\n color: errorText\n ? theme.content.elements.error\n : theme.content.elements.warning,\n }}\n >\n {helperText}\n </Text>\n ) : null}\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n root: { gap: 8 },\n header: { gap: 8 },\n label: { flexShrink: 1 },\n status: { gap: 4 },\n // The design's own asymmetry: the text is inset 16 and the (unused) trailing\n // slot 8, so the field's own padding is what centres the single line.\n field: { paddingLeft: 16, paddingRight: 8, justifyContent: 'center' },\n input: { padding: 0 },\n buttonRow: { gap: 10 },\n // Both halves keep their width whether or not the second one has a button, so\n // Paste doesn't stretch across the row when it stands alone.\n button: { flex: 1 },\n})\n", "import { USD_DECIMALS, percentOfAmount } from '@funkit/connect-core'\nimport { Pressable, StyleSheet, useWindowDimensions } from 'react-native'\nimport Animated, { Keyframe, LinearTransition } from 'react-native-reanimated'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { AmountDisplay } from '../components/AmountDisplay'\nimport { NumPad } from '../components/NumPad'\nimport { PillButton } from '../components/PillButton'\nimport { TopBar } from '../components/TopBar'\nimport { WithdrawSourceCard } from '../components/WithdrawSourceCard'\nimport { FigmaSwapIcon } from '../icons/FigmaSystemIcons'\nimport { TokenChainIcon } from '../icons/TokenChainIcon'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { chainIconUri } from '../utils/chainDisplay'\nimport { formatTokenAmount, groupThousands } from '../utils/formatAmount'\nimport { MOTION_DURATION, MOTION_EASING } from '../utils/motion'\nimport { applyNumpadKey } from '../utils/numpadInput'\n\nconst NUMPAD_BOTTOM_MARGIN = 25\nconst NUMPAD_MIN_BOTTOM_MARGIN = 40\n\nconst AnimatedBox = Animated.createAnimatedComponent(Box)\n\n// The card is what the button displaces, so it rides up with it instead of\n// jumping to the place the button leaves it.\nconst CARD_TRANSITION =\n LinearTransition.duration(MOTION_DURATION).easing(MOTION_EASING)\n// Continue rises out of the card's foot. Short, and fading as it goes: a full\n// travel would have it cross the keypad on the way in.\nconst BUTTON_TRAVEL = 24\nconst BUTTON_ENTERING = new Keyframe({\n 0: { opacity: 0, transform: [{ translateY: BUTTON_TRAVEL }] },\n 100: { opacity: 1, transform: [{ translateY: 0 }], easing: MOTION_EASING },\n}).duration(MOTION_DURATION)\nconst BUTTON_EXITING = new Keyframe({\n 0: { opacity: 1, transform: [{ translateY: 0 }] },\n 100: {\n opacity: 0,\n transform: [{ translateY: BUTTON_TRAVEL }],\n easing: MOTION_EASING,\n },\n}).duration(MOTION_DURATION)\n\nexport interface WithdrawAmountSource {\n /** The source as the host names it, e.g. `USDC (Perps)`. */\n label: string\n /** What the amount and the balance are denominated in, e.g. `USDG`. */\n symbol: string\n chainId: number\n /** Direct token logo URL; falls back to a CDN lookup by symbol. */\n iconSrc?: string\n}\n\nexport interface WithdrawAmountScreenProps {\n title: string\n /** The withdrawal amount, in source-token units. */\n amount: string\n /** Sets the amount outright, in source-token units (Use Max). */\n onChangeAmount: (amount: string) => void\n /**\n * The number in the amount display, which the numpad edits \u2014 dollars when\n * {@link inUsd}, else source-token units. Held by the caller so it survives\n * this screen leaving the stack.\n */\n input: string\n onChangeInput: (input: string) => void\n /** Whether the amount is being typed in dollars rather than token units. */\n inUsd: boolean\n /** The amount in dollars. `undefined` when nothing prices it. */\n usdLabel: string | undefined\n /** Switches denomination. `undefined` drops the swap entirely. */\n onSwapDenomination: (() => void) | undefined\n /** Fraction digits the source token carries; caps what the numpad accepts. */\n sourceDecimals?: number\n /** Spendable balance in source-token units. Omit to drop Use Max. */\n balance?: string\n /** What the withdrawal is drawn from. */\n source: WithdrawAmountSource\n /** Opens the source picker. Omit when the host offers a single source. */\n onPressSource?: () => void\n /** Replaces the converted amount and tints the amount. */\n errorText?: string\n canContinue: boolean\n onContinue: () => void\n onBack: () => void\n onClose: () => void\n}\n\n/**\n * Step one of the crypto withdrawal: how much, and what it comes out of. The\n * destination, the recipient, the fees and the signature are the step that\n * follows.\n *\n * The amount is driven by an in-app numpad rather than the system keyboard, so\n * the sheet never has to move out from under it.\n */\nexport function WithdrawAmountScreen({\n title,\n amount,\n onChangeAmount,\n input,\n onChangeInput,\n inUsd,\n usdLabel,\n onSwapDenomination,\n sourceDecimals,\n balance,\n source,\n onPressSource,\n errorText,\n canContinue,\n onContinue,\n onBack,\n onClose,\n}: WithdrawAmountScreenProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const { height } = useWindowDimensions()\n const insets = useSafeAreaInsets()\n\n // Use Max has nothing to take without a balance, and it gives way to Continue\n // as soon as there is an amount to submit.\n const showUseMax = input === '' && balance !== undefined\n\n // The same amount in the denomination not being typed in \u2014 falling back to\n // the token when nothing prices it, so the units are still named somewhere.\n // Display only \u2014 `amount` keeps every digit, so Use Max still spends the\n // whole balance rather than a truncated copy of it.\n const tokenLabel = `${formatTokenAmount(amount === '' ? '0' : amount)} ${source.symbol}`\n const convertedLabel = inUsd ? tokenLabel : (usdLabel ?? tokenLabel)\n // The error takes the line over, so the swap goes with the figure it labelled.\n const canSwap = !!onSwapDenomination && !errorText\n const convertedLine = (\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.convertedRow}>\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n // Without this the text can't shrink, so a long label overflows the row\n // and pushes the swap icon off screen instead of ellipsising.\n style={{\n flexShrink: 1,\n color: errorText\n ? theme.content.elements.error\n : theme.content.elements.secondary,\n }}\n >\n {errorText ?? convertedLabel}\n </Text>\n {canSwap ? (\n <FigmaSwapIcon size={16} color={theme.content.elements.secondary} />\n ) : null}\n </Box>\n )\n\n return (\n <Box\n style={{\n height,\n paddingTop: insets.top,\n backgroundColor: theme.background.modal,\n }}\n >\n <TopBar title={title} onBack={onBack} onClose={onClose} />\n <Box style={styles.amount}>\n <AmountDisplay\n value={groupThousands(input)}\n prefix={inUsd ? '$' : ''}\n hasError={!!errorText}\n accessibilityLabel={t('withdrawAmount.amountLabel')}\n />\n {/* The same money in the other denomination, and the control that\n switches to it. Inert without a rate to convert at. */}\n <Box style={styles.converted}>\n {canSwap ? (\n <Pressable\n onPress={onSwapDenomination}\n accessibilityRole=\"button\"\n accessibilityLabel={t('withdrawAmount.swapDenomination')}\n hitSlop={8}\n >\n {convertedLine}\n </Pressable>\n ) : (\n convertedLine\n )}\n </Box>\n </Box>\n\n {/* All the slack a taller device brings: the amount stays under the top\n bar and everything below stays pinned above the keypad. */}\n <Box flex={1} />\n\n <AnimatedBox layout={CARD_TRANSITION} style={styles.card}>\n <WithdrawSourceCard\n icon={\n <TokenChainIcon\n symbol={source.symbol}\n iconSrc={source.iconSrc}\n chainIconSrc={chainIconUri(source.chainId)}\n size={36}\n />\n }\n title={source.label}\n subtitle={\n balance ? `${groupThousands(balance)} ${source.symbol}` : undefined\n }\n useMaxLabel={t('withdrawAmount.useMax')}\n onUseMax={\n showUseMax && balance\n ? () =>\n onChangeAmount(percentOfAmount(balance, 100, sourceDecimals))\n : undefined\n }\n onPress={onPressSource}\n accessibilityLabel={t('withdrawCrypto.sendFrom')}\n attachedToButton={!showUseMax}\n />\n {/* The window the button travels through, and never the button: a view\n can't crop what it is carrying. It outlives the button so the way\n out is cropped as well as the way in, and closes to nothing on the\n same clock \u2014 which is also what walks the card back down. */}\n <AnimatedBox\n layout={CARD_TRANSITION}\n style={[styles.buttonClip, showUseMax ? null : styles.buttonSlot]}\n >\n {showUseMax ? null : (\n <AnimatedBox entering={BUTTON_ENTERING} exiting={BUTTON_EXITING}>\n <PillButton\n label={t('common.continue')}\n radius=\"element\"\n disabled={!canContinue}\n onPress={onContinue}\n />\n </AnimatedBox>\n )}\n </AnimatedBox>\n </AnimatedBox>\n\n <Box\n style={[\n styles.numpad,\n {\n marginBottom: Math.max(\n NUMPAD_BOTTOM_MARGIN + insets.bottom,\n NUMPAD_MIN_BOTTOM_MARGIN,\n ),\n },\n ]}\n >\n <NumPad\n backspaceAccessibilityLabel={t('withdrawAmount.delete')}\n // Dollars are typed to cents whatever the token's precision is.\n onPressKey={(key) =>\n onChangeInput(\n applyNumpadKey(input, key, inUsd ? USD_DECIMALS : sourceDecimals),\n )\n }\n />\n </Box>\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n amount: { alignItems: 'center', paddingTop: 78 },\n converted: { paddingTop: 32 },\n convertedRow: { gap: 6 },\n card: { marginHorizontal: 24 },\n buttonClip: { overflow: 'hidden' },\n buttonSlot: { marginTop: -19 },\n numpad: {\n marginHorizontal: 64,\n marginTop: 19,\n height: 240,\n minHeight: 176,\n flexShrink: 1,\n },\n})\n", "import { useMemo } from 'react'\nimport { StyleSheet, useWindowDimensions } from 'react-native'\nimport Animated, {\n Keyframe,\n LinearTransition,\n useAnimatedStyle,\n withTiming,\n} from 'react-native-reanimated'\n\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { type AmountGlyphKind, amountGlyphs } from '../utils/amountGlyphs'\nimport { MOTION_DURATION, MOTION_EASING } from '../utils/motion'\n\n// Figma's amount type; `font/*` has no step this large. The placeholder's 20%\n// is the design's own value, not `opacity/disabled` (40).\nconst AMOUNT_FONT_SIZE = 96\nconst PLACEHOLDER_OPACITY = 0.2\n// Ratios, so a fitted amount scales its line box and tracking too. The box must\n// stay above the font's natural ~1.16em \u2014 iOS honours a shorter one by\n// compressing the line and clipping the glyphs.\nconst LINE_HEIGHT_RATIO = 1.25\nconst LETTER_SPACING_RATIO = -1.44 / 96\n// The design trims to the cap box (68 at 96), which RN can't do \u2014 it lays out\n// the line box. A negative margin takes that dead space back instead, so the\n// glyphs overhang empty gaps rather than being clipped by their parent.\nconst CAP_BOX_RATIO = 68 / 96\n// One character's advance, as a share of its size. The fit is computed from it\n// because `adjustsFontSizeToFit` also reads the frame's *height*, collapsing\n// the number whenever its row is shorter than the line box.\nconst CHARACTER_ADVANCE_RATIO = 0.6\nconst HORIZONTAL_INSET = 16\n// Below this the amount is unreadable anyway, so a long entry runs to the edges.\nconst MIN_FONT_SIZE = 40\n\nconst AnimatedBox = Animated.createAnimatedComponent(Box)\nconst AnimatedText = Animated.createAnimatedComponent(Text)\n\n// A character arriving or leaving re-centres the number, so the ones staying\n// slide to their new place rather than cutting to it.\nconst GLYPH_LAYOUT =\n LinearTransition.duration(MOTION_DURATION).easing(MOTION_EASING)\n\nexport interface AmountDisplayProps {\n /** The typed amount, or `''` for the placeholder. */\n value: string\n /** Written before the number. */\n prefix?: string\n /** Tints the amount, matching the message that replaces the balance line. */\n hasError?: boolean\n accessibilityLabel: string\n}\n\n/**\n * The withdrawal amount, read-only and driven by the numpad \u2014 it looks like a\n * field but isn't one, so tapping it must not open a keyboard.\n *\n * Each character is its own node so it can move on its own: digits rise into the\n * number and drop back out, while the placeholder lifts off the top instead.\n */\nexport function AmountDisplay({\n value,\n prefix = '$',\n hasError = false,\n accessibilityLabel,\n}: AmountDisplayProps) {\n const theme = useTheme()\n const { width } = useWindowDimensions()\n const isEmpty = value === ''\n const glyphs = amountGlyphs(value, prefix)\n const text = glyphs.map((glyph) => glyph.char).join('')\n const fontSize = fitAmountFontSize(text, width - HORIZONTAL_INSET * 2)\n const overhang = (fontSize * (LINE_HEIGHT_RATIO - CAP_BOX_RATIO)) / 2\n\n const lineHeight = fontSize * LINE_HEIGHT_RATIO\n // A whole line box of travel, so a character is clear of the row before it is\n // dropped.\n const slides = useMemo(\n () => ({\n below: slideKeyframes(lineHeight),\n above: slideKeyframes(-lineHeight),\n }),\n [lineHeight],\n )\n\n // The prefix outlives both the placeholder and the digits, so it can only be\n // dimmed by fading with them, not by mounting.\n const prefixDimming = useAnimatedStyle(() => {\n // Spelled out because the plugin workletizes by the hook's name, and esbuild\n // renames this one (`useAnimatedStyle2`) in the bundle.\n 'worklet'\n return {\n opacity: withTiming(isEmpty ? PLACEHOLDER_OPACITY : 1, {\n duration: MOTION_DURATION,\n easing: MOTION_EASING,\n }),\n }\n })\n\n return (\n // The window the characters slide through. What it clips is the dead space\n // the margin takes back, never the glyphs.\n <Box\n accessible\n accessibilityLabel={accessibilityLabel}\n accessibilityValue={{ text }}\n style={[styles.row, { marginVertical: -overhang }]}\n >\n {glyphs.map(({ key, char, kind }) => (\n <AnimatedBox\n key={key}\n entering={slides[glyphSide(kind, isEmpty)].entering}\n exiting={slides[glyphSide(kind, isEmpty)].exiting}\n layout={GLYPH_LAYOUT}\n >\n {/* The fade rides on the text, not on the box: one view driving both\n an animated style and a layout animation breaks reanimated. */}\n <AnimatedText\n weight=\"medium\"\n numberOfLines={1}\n style={[\n {\n fontSize,\n lineHeight,\n letterSpacing: fontSize * LETTER_SPACING_RATIO,\n color: hasError\n ? theme.content.elements.error\n : theme.content.elements.primary,\n opacity: kind === 'placeholder' ? PLACEHOLDER_OPACITY : 1,\n },\n kind === 'prefix' ? prefixDimming : null,\n ]}\n >\n {char}\n </AnimatedText>\n </AnimatedBox>\n ))}\n </Box>\n )\n}\n\n/**\n * Which side of the row a character comes from and goes back to. The prefix\n * travels with whatever it stands next to, so the pair never crosses.\n */\nfunction glyphSide(kind: AmountGlyphKind, isEmpty: boolean) {\n if (kind === 'placeholder') return 'above'\n if (kind === 'prefix' && isEmpty) return 'above'\n return 'below'\n}\n\n/** Enters from `offset` and leaves back to it \u2014 a negative one runs upwards. */\nfunction slideKeyframes(offset: number) {\n return {\n entering: new Keyframe({\n 0: { transform: [{ translateY: offset }] },\n 100: { transform: [{ translateY: 0 }], easing: MOTION_EASING },\n }).duration(MOTION_DURATION),\n exiting: new Keyframe({\n 0: { transform: [{ translateY: 0 }] },\n 100: { transform: [{ translateY: offset }], easing: MOTION_EASING },\n }).duration(MOTION_DURATION),\n }\n}\n\n/** The largest size that keeps `text` on one line within `available`. */\nfunction fitAmountFontSize(text: string, available: number) {\n const fitted = available / (text.length * CHARACTER_ADVANCE_RATIO)\n return Math.max(MIN_FONT_SIZE, Math.min(AMOUNT_FONT_SIZE, fitted))\n}\n\nconst styles = StyleSheet.create({\n row: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignSelf: 'stretch',\n overflow: 'hidden',\n },\n})\n", "/** What a character in the amount is, which is what decides how it moves. */\nexport type AmountGlyphKind = 'prefix' | 'placeholder' | 'digit'\n\nexport interface AmountGlyph {\n /** Identity across renders: what mounts is what animates in. */\n key: string\n char: string\n kind: AmountGlyphKind\n}\n\n/**\n * The amount split into the characters that animate independently. Digits are\n * keyed from the left, so appending or deleting at the right mounts or unmounts\n * exactly that character and an inserted separator shifts the rest along.\n */\nexport function amountGlyphs(value: string, prefix: string): AmountGlyph[] {\n const glyphs: AmountGlyph[] = []\n if (prefix) glyphs.push({ key: 'prefix', char: prefix, kind: 'prefix' })\n\n // Its own identity, not the digit zero, so typing over it unmounts it rather\n // than reading as a `0` that turned into a `1`.\n if (value === '') {\n glyphs.push({ key: 'placeholder', char: '0', kind: 'placeholder' })\n return glyphs\n }\n\n for (const [index, char] of [...value].entries()) {\n glyphs.push({ key: `digit-${index}`, char, kind: 'digit' })\n }\n return glyphs\n}\n", "import { Easing } from 'react-native-reanimated'\n\n// One clock for the amount screen: fast enough that a quick run on the numpad\n// never leaves glyphs queued mid-slide, slow enough to read as a slide.\nexport const MOTION_DURATION = 180\nexport const MOTION_EASING = Easing.bezier(0.33, 1, 0.68, 1)\n", "import { Pressable, StyleSheet } from 'react-native'\n\nimport { useHapticFeedback } from '../haptics/HapticsContext'\nimport { FigmaChevronLeftIcon } from '../icons/FigmaSystemIcons'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport type { NumpadKey } from '../utils/numpadInput'\n\n// Shared with the delete glyph, which sizes to the digits.\nconst KEY_FONT_SIZE = 24\n\n// The design sets the outer columns against the keypad's edges. The touch\n// target is still the whole share.\nconst COLUMN_ALIGNMENT = ['flex-start', 'center', 'flex-end'] as const\n\nconst ROWS: NumpadKey[][] = [\n ['1', '2', '3'],\n ['4', '5', '6'],\n ['7', '8', '9'],\n ['.', '0', 'backspace'],\n]\n\nexport interface NumPadProps {\n onPressKey: (key: NumpadKey) => void\n /** The delete key carries a glyph, so its label can't come from the key. */\n backspaceAccessibilityLabel: string\n}\n\n/**\n * The withdrawal amount keypad. Both dimensions come from the container, so\n * the keys grow with the device rather than leaving a void above them.\n *\n * Emits keys rather than a value: `applyNumpadKey` owns the grammar.\n */\nexport function NumPad({\n onPressKey,\n backspaceAccessibilityLabel,\n}: NumPadProps) {\n const theme = useTheme()\n const haptic = useHapticFeedback()\n\n return (\n <Box flex={1}>\n {ROWS.map((row) => (\n <Box key={row.join('')} flexDirection=\"row\" flex={1}>\n {row.map((key, column) => (\n <Pressable\n key={key}\n onPress={() => {\n // Before the handler: the tap should land with the finger, not\n // after whatever the amount change costs.\n haptic()\n onPressKey(key)\n }}\n accessibilityRole=\"button\"\n accessibilityLabel={\n key === 'backspace' ? backspaceAccessibilityLabel : key\n }\n style={[styles.key, { alignItems: COLUMN_ALIGNMENT[column] }]}\n >\n {key === 'backspace' ? (\n <FigmaChevronLeftIcon\n size={KEY_FONT_SIZE}\n color={theme.content.elements.primary}\n />\n ) : (\n <Text\n weight=\"medium\"\n style={[\n styles.label,\n key === '.' ? styles.decimalLabel : null,\n ]}\n >\n {key}\n </Text>\n )}\n </Pressable>\n ))}\n </Box>\n ))}\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n key: { flex: 1, justifyContent: 'center' },\n label: {\n fontSize: KEY_FONT_SIZE,\n minWidth: KEY_FONT_SIZE,\n lineHeight: 32,\n letterSpacing: -0.36,\n textAlign: 'center',\n },\n decimalLabel: {\n fontSize: 48,\n lineHeight: 56,\n transform: [{ translateY: -14 }],\n },\n})\n", "import { type ReactNode, createContext, useCallback, useContext } from 'react'\n\nimport { hapticTap } from './hapticTap'\nimport { logger } from '../logging/logger'\n\n/**\n * A short tactile tap confirming a discrete input, such as a keypad press.\n *\n * Taps are part of the design rather than a garnish, so the SDK provides them\n * itself from the optional `react-native-haptic-feedback` peer \u2014 see\n * {@link hapticTap}. Hosts on another module (`expo-haptics` in Expo Go), or\n * wanting silence, pass their own through `FunkitProvider`.\n */\nexport type HapticFeedback = () => void | Promise<void>\n\nconst HapticsContext = createContext<HapticFeedback>(hapticTap)\n\nexport function FunkitHapticsProvider({\n hapticFeedback = hapticTap,\n children,\n}: {\n hapticFeedback?: HapticFeedback\n children: ReactNode\n}) {\n return (\n <HapticsContext.Provider value={hapticFeedback}>\n {children}\n </HapticsContext.Provider>\n )\n}\n\n// A misconfigured host would otherwise warn on every single key. The tap is\n// cosmetic, so saying it once is enough to debug it.\nlet hasWarned = false\n\n/**\n * Fire-and-forget haptics. A host's native module must never take a keypress\n * down with it, so a throw or a rejection is swallowed \u2014 the key still registers\n * and the amount still changes.\n */\nexport function useHapticFeedback(): () => void {\n const haptic = useContext(HapticsContext)\n\n return useCallback(() => {\n const warn = (error: unknown) => {\n if (hasWarned) return\n hasWarned = true\n logger.warn('connect-rn: haptic feedback failed; taps will be silent', {\n error: error instanceof Error ? error.message : String(error),\n })\n }\n try {\n Promise.resolve(haptic()).catch(warn)\n } catch (error) {\n warn(error)\n }\n }, [haptic])\n}\n", "import { logger } from '../logging/logger'\n\n/**\n * Resolved once, on the first tap: the peer's tap, or `null` when it isn't\n * installed. Either way the answer is reused, so a host without it doesn't\n * retry a failing import on every keypress.\n */\nlet loading: Promise<(() => void) | null> | undefined\n\n/**\n * Default haptics: lazily loads the optional `react-native-haptic-feedback`\n * peer and taps through it. A host without it taps silently; one that wants a\n * different module passes it to `FunkitProvider` as `hapticFeedback` instead \u2014\n * which is what an Expo Go app does, since it can only link Expo's own modules.\n *\n * The import is dynamic and inside a `try`, which is what makes the peer\n * genuinely optional: Metro marks a dependency optional when its import can\n * reject, and skips it at resolution rather than failing the bundle. It also\n * keeps the native module unevaluated until a tap actually happens.\n */\nexport async function hapticTap(): Promise<void> {\n loading ??= loadTap()\n const tap = await loading\n tap?.()\n}\n\nasync function loadTap(): Promise<(() => void) | null> {\n try {\n const { trigger } = await import('react-native-haptic-feedback')\n // `impactLight`: the design taps to confirm a digit landed, not to mark an\n // event. Options left at their defaults \u2014 no vibrate fallback on hardware\n // without a taptic engine, and Android's system haptics setting respected.\n return () => trigger('impactLight')\n } catch (error) {\n // Not a failure \u2014 the peer is optional, and a silent keypad is a working\n // keypad. Said once, so a host that meant to have taps can find out why.\n logger.info(\n 'connect-rn: taps are silent \u2014 install react-native-haptic-feedback, ' +\n 'or pass FunkitProvider `hapticFeedback` to use your own haptics ' +\n 'module (e.g. expo-haptics in Expo Go).',\n { error: error instanceof Error ? error.message : String(error) },\n )\n return null\n }\n}\n", "import type { ReactNode } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\nimport Animated, { LinearTransition } from 'react-native-reanimated'\n\nimport { FigmaChevronRightIcon } from '../icons/FigmaSystemIcons'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { MOTION_DURATION, MOTION_EASING } from '../utils/motion'\n\nconst AnimatedBox = Animated.createAnimatedComponent(Box)\n\n// The foot grows to seat the button that overlaps it, so it has to grow with\n// that button's entrance rather than pop out from under it.\nconst FOOT_TRANSITION =\n LinearTransition.duration(MOTION_DURATION).easing(MOTION_EASING)\n\n// The card's own inset, and the foot it grows when the Continue button overlaps\n// it \u2014 40 of padding under 19 of button, leaving the design's 21pt gap.\nconst HORIZONTAL_PADDING = 12\nconst VERTICAL_PADDING = 13\nconst ATTACHED_BOTTOM_PADDING = 40\n\nexport interface WithdrawSourceCardProps {\n /** The 36px token-on-chain avatar. */\n icon: ReactNode\n /** The source as the host names it, e.g. `USDC (Perps)`. */\n title: string\n /** The spendable balance, already grouped and denominated. */\n subtitle?: string\n useMaxLabel: string\n /** Omitted once an amount is typed, or when no balance is known. */\n onUseMax?: () => void\n /** Omitted when the host offers a single source \u2014 nothing to pick. */\n onPress?: () => void\n accessibilityLabel: string\n /** Squares the foot of the card off for the button that overlaps it. */\n attachedToButton?: boolean\n}\n\n/**\n * What the withdrawal is drawn from, sitting above the keypad: the source\n * token, its balance, and the shortcut that spends all of it.\n */\nexport function WithdrawSourceCard({\n icon,\n title,\n subtitle,\n useMaxLabel,\n onUseMax,\n onPress,\n accessibilityLabel,\n attachedToButton = false,\n}: WithdrawSourceCardProps) {\n const theme = useTheme()\n\n const card = (\n <AnimatedBox\n flexDirection=\"row\"\n alignItems=\"center\"\n layout={FOOT_TRANSITION}\n style={[\n styles.card,\n {\n backgroundColor: theme.background.secondary,\n borderTopLeftRadius: theme.borderRadii.element,\n borderTopRightRadius: theme.borderRadii.element,\n borderBottomLeftRadius: attachedToButton\n ? 0\n : theme.borderRadii.element,\n borderBottomRightRadius: attachedToButton\n ? 0\n : theme.borderRadii.element,\n paddingBottom: attachedToButton\n ? ATTACHED_BOTTOM_PADDING\n : VERTICAL_PADDING,\n },\n ]}\n >\n <Box\n flex={1}\n flexDirection=\"row\"\n alignItems=\"center\"\n style={styles.token}\n >\n {icon}\n <Box flex={1} style={styles.details}>\n <Text variant=\"bodyMedium\" numberOfLines={1}>\n {title}\n </Text>\n {subtitle ? (\n <Text\n variant=\"detail\"\n numberOfLines={1}\n style={{ color: theme.content.elements.secondary }}\n >\n {subtitle}\n </Text>\n ) : null}\n </Box>\n </Box>\n {onUseMax ? (\n <Pressable\n onPress={onUseMax}\n accessibilityRole=\"button\"\n accessibilityLabel={useMaxLabel}\n >\n {/* Filled from the border token, as the design has it: no button\n surface carries a fill that reads against the card. */}\n <Box\n borderRadius=\"button\"\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[\n styles.useMax,\n {\n height: theme.sizes.buttonXs,\n backgroundColor: theme.border.elements.default.color,\n },\n ]}\n >\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n style={{ color: theme.content.button.secondary.default }}\n >\n {useMaxLabel}\n </Text>\n </Box>\n </Pressable>\n ) : null}\n {onPress ? (\n <FigmaChevronRightIcon\n size={16}\n color={theme.content.elements.secondary}\n />\n ) : null}\n </AnimatedBox>\n )\n\n if (!onPress) return card\n\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n >\n {card}\n </Pressable>\n )\n}\n\nconst styles = StyleSheet.create({\n card: {\n gap: 8,\n paddingHorizontal: HORIZONTAL_PADDING,\n paddingTop: VERTICAL_PADDING,\n },\n token: { gap: 10 },\n details: { gap: 2 },\n useMax: { paddingHorizontal: 16 },\n})\n", "// The amount screen drives its value from an in-app numpad rather than a text\n// input, so every edit is one keypress and the whole grammar lives here.\n\nexport type NumpadDigit =\n | '0'\n | '1'\n | '2'\n | '3'\n | '4'\n | '5'\n | '6'\n | '7'\n | '8'\n | '9'\n\nexport type NumpadKey = NumpadDigit | '.' | 'backspace'\n\nconst DECIMAL_POINT = '.'\n\n/**\n * The typed amount after one keypress, as a decimal string.\n *\n * - A lone `.` is not a number any parser accepts, so the leading zero is\n * written for the user; a second point, and any point at all on a 0-decimal\n * token, is refused rather than swallowed later.\n * - `0` is a placeholder rather than a leading digit, so typing `5` gives `5`.\n * - Fraction digits stop at the token's `decimals`: past that the input is dust\n * the transfer can't carry, and it would silently truncate at signing time.\n */\nexport function applyNumpadKey(\n value: string,\n key: NumpadKey,\n maxDecimals?: number,\n): string {\n if (key === 'backspace') return value.slice(0, -1)\n\n if (key === DECIMAL_POINT) {\n if (value.includes(DECIMAL_POINT) || maxDecimals === 0) return value\n return value === '' ? `0${DECIMAL_POINT}` : `${value}${DECIMAL_POINT}`\n }\n\n const fraction = value.split(DECIMAL_POINT)[1]\n if (\n fraction !== undefined &&\n maxDecimals !== undefined &&\n fraction.length >= maxDecimals\n ) {\n return value\n }\n\n if (value === '0') return key === '0' ? value : key\n return `${value}${key}`\n}\n", "import type { TFunction } from 'i18next'\n\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport {\n type PaymentMethodOption,\n SelectMethodScreen,\n} from './SelectMethodScreen'\n\nexport interface WithdrawMethodScreenProps {\n /** Cash payout methods (Card / Bank Transfer / \u2026). */\n methods: PaymentMethodOption[]\n onSelectMethod: (id: string) => void\n /** Sheet title \u2014 the flow resolves it from the host config. */\n title: string\n loading?: boolean\n /** The payout-method fetch failed \u2014 shows the retryable error state. */\n hasError?: boolean\n onRetry?: () => void\n /**\n * Withdrawals unavailable (Statsig gate off, or Swapped returned no methods\n * for the user's region) \u2014 shows a terminal, non-retryable message.\n */\n isEmpty?: boolean\n /**\n * The balance can't meet Swapped's minimum sell \u2014 shows a distinct terminal\n * message instead of methods that would all reject.\n */\n isBelowMinimum?: boolean\n /** Why the cash rails are missing (web's `NoCashMethodsNote`). */\n note?: string\n}\n\n// Below-minimum wins over empty \u2014 a too-low balance is the more specific reason.\nfunction getTerminalError(\n t: TFunction,\n isBelowMinimum: boolean,\n isEmpty: boolean,\n) {\n if (isBelowMinimum) {\n return {\n title: t('withdraw.belowMinimumTitle'),\n message: t('withdraw.belowMinimumMessage'),\n }\n }\n if (isEmpty) {\n return {\n title: t('withdraw.unavailableTitle'),\n message: t('withdraw.unavailableMessage'),\n }\n }\n return null\n}\n\n/**\n * The withdrawal payout-method picker: the entry screen of `beginWithdrawal`,\n * listing the Swapped `CRYPTO_TO_FIAT` methods. A thin composition over\n * {@link SelectMethodScreen} (no receive-token dropdown \u2192 the bare-list layout),\n * so the list/loading/error visuals stay in lockstep with the deposit flow.\n */\nexport function WithdrawMethodScreen(props: WithdrawMethodScreenProps) {\n const { t } = useFunkitTranslation()\n const {\n methods,\n onSelectMethod,\n title,\n loading = false,\n hasError = false,\n onRetry,\n isEmpty = false,\n isBelowMinimum = false,\n note,\n } = props\n // Fetch errors and loading win over terminal states \u2014 a failed fetch says\n // nothing about availability or balance, and retrying may recover it.\n const terminalError = getTerminalError(t, isBelowMinimum, isEmpty)\n if (terminalError && !hasError && !loading) {\n return (\n <SelectMethodScreen\n title={title}\n methods={[]}\n onSelectMethod={onSelectMethod}\n error\n errorTitle={terminalError.title}\n errorMessage={terminalError.message}\n />\n )\n }\n return (\n <SelectMethodScreen\n title={title}\n methods={methods}\n onSelectMethod={onSelectMethod}\n loading={loading}\n error={hasError}\n onRetry={onRetry}\n errorTitle={t('selectMethod.errorTitle')}\n errorMessage={t('selectMethod.errorMessage')}\n note={note}\n />\n )\n}\n", "import {\n type SwappedInboundMessage,\n type SwappedSellOrderData,\n isValidOrderData,\n} from '@funkit/connect-core'\nimport { useCallback } from 'react'\n\nimport { logger } from '../logging/logger'\nimport {\n type SwappedScreenBaseProps,\n SwappedScreenShell,\n} from './SwappedScreenShell'\n\nexport interface SwappedWithdrawScreenProps extends SwappedScreenBaseProps {\n /** \"Make another withdrawal\" \u2014 back to the method list. */\n onNewWithdrawal?: () => void\n /** Swapped confirmed the fiat payout side. Payload is opaque. */\n onWithdrawalSuccess?: (data?: unknown) => void\n /** Sell order (deposit address + accepted-token amount). Only validated payloads forward. */\n onOrderData?: (order: SwappedSellOrderData) => void\n}\n\n/**\n * Withdrawal-mode host for the Swapped embed (mirroring web's\n * `WithdrawalSwappedIframeController`): back \u2192 {@link onBack},\n * close \u2192 {@link onClose}, new-withdrawal \u2192 {@link onNewWithdrawal},\n * withdrawal-successful \u2192 {@link onWithdrawalSuccess}, order-data \u2192\n * {@link onOrderData}. Deposit-only messages are ignored \u2014 see\n * `SwappedScreen`.\n */\nexport function SwappedWithdrawScreen({\n url,\n onClose,\n onBack,\n onNewWithdrawal,\n onWithdrawalSuccess,\n onOrderData,\n}: SwappedWithdrawScreenProps) {\n const handleMessage = useCallback(\n (msg: SwappedInboundMessage) => {\n switch (msg.type) {\n case 'SWAPPED_GO_BACK':\n logger.info('connect-rn:swapped:back')\n onBack()\n break\n case 'SWAPPED_CLOSE':\n logger.info('connect-rn:swapped:exit')\n onClose()\n break\n case 'SWAPPED_NEW_WITHDRAWAL':\n logger.info('connect-rn:swapped:new_withdrawal')\n onNewWithdrawal?.()\n break\n case 'SWAPPED_WITHDRAWAL_SUCCESSFUL':\n // No auto-close: the embed shows its own success screen with\n // new-withdrawal/close controls (web parity).\n logger.info('connect-rn:swapped:withdrawal_successful')\n onWithdrawalSuccess?.(msg.data)\n break\n case 'SWAPPED_ORDER_DATA':\n if (!isValidOrderData(msg.data)) {\n // Validation rejection, not an unrecoverable failure (WARN \u2014 the\n // embed keeps its own UI in control).\n logger.warn('connect-rn:swapped:order_data:invalid', {\n data: msg.data ?? {},\n })\n break\n }\n logger.info('connect-rn:swapped:order_data', {\n order_id: msg.data.order_id,\n })\n onOrderData?.(msg.data)\n break\n default:\n // READY / NAVIGATION / LOGOUT / ERROR handled in the shell or\n // tracked elsewhere; deposit-only messages (new-deposit,\n // transaction-successful) belong to SwappedScreen.\n break\n }\n },\n [onBack, onClose, onNewWithdrawal, onWithdrawalSuccess, onOrderData],\n )\n\n return <SwappedScreenShell url={url} onMessage={handleMessage} />\n}\n", "import {\n RailConfigType,\n type SwappedFormOfPayment,\n getFops,\n} from '@funkit/api-base'\nimport {\n DEFAULT_FIAT_CURRENCY,\n FOPS_STALE_TIME,\n type SwappedWithdrawalLegs,\n buildSwappedSellLimits,\n buildSwappedThirdPartyPaymentConfigs,\n findSwappedSourceOverride,\n getExchangeRate,\n getSwappedCashMinUsd,\n getSwappedSellCapEur,\n resolveSwappedWithdrawalLegs,\n sortFops,\n useSwappedDefaultCurrencyQuery,\n} from '@funkit/connect-core'\nimport { useDynamicConfig } from '../../statsig/useDynamicConfig'\nimport { useTheme } from '@shopify/restyle'\nimport { useStatsigClient } from '@statsig/react-bindings'\nimport { useQuery } from '@tanstack/react-query'\nimport { useMemo } from 'react'\n\nimport type {\n WithdrawalFlowConfig,\n WithdrawalToken,\n} from '../../flow/withdrawalFlowConfig'\nimport { useUserIpInfo } from '../../geo/useUserIpInfo'\nimport { useFunkitIdentity } from '../../identity/IdentityContext'\nimport { logger } from '../../logging/logger'\nimport { buildSwappedThemeQueryParamsRN } from '../../swapped/buildSwappedTheme'\nimport type { FunkitTheme } from '../../theme/toRestyleTheme'\nimport { useFiatExchangeRates } from './useFiatExchangeRates'\n\n/** Base react-query key for the withdrawal `/fops` query \u2014 shared with the\n * flow's invalidation so the two can't drift. */\nexport const WITHDRAW_FOPS_QUERY_KEY = 'withdrawFops'\n\nexport interface UseWithdrawalFopsParams {\n config: WithdrawalFlowConfig\n enabled?: boolean\n}\n\nexport interface UseWithdrawalFopsResult {\n /**\n * Generic cash payout methods (Card / Bank Transfer / \u2026). Saved FOPs are not\n * supported for withdrawals (web parity) and are never returned.\n */\n fops: SwappedFormOfPayment[]\n isLoading: boolean\n isError: boolean\n /**\n * True only once we KNOW there's nothing to show (gate off, or a settled\n * fetch returned zero) \u2014 never during a load, so the non-retryable\n * \"unavailable\" screen can't flash.\n */\n noPaymentMethodsAvailable: boolean\n /** Source balance can't clear Swapped's \u20AC7 minimum sell (cash impossible). */\n isBelowMinimumBalance: boolean\n refetch: () => void\n /** Whether the Statsig `enableswappedwithdrawal` gate is on for this apiKey. */\n isWithdrawalEnabled: boolean\n /** Resolved source\u2192accepted-token route, shared by the fops fetch and quote. */\n route: SwappedWithdrawalLegs\n}\n\n// \u2500\u2500 Step: resolve the withdrawal route \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Resolve the on-chain route legs (source the user sells \u2192 the token Swapped\n * accepts), applying the Statsig `swappedwithdrawalsourceoverrides` rule.\n * Memoized so the returned object stays referentially stable for the downstream\n * execution `useCallback`.\n */\nfunction useWithdrawalRoute(\n config: WithdrawalFlowConfig,\n): SwappedWithdrawalLegs {\n const sourceOverrides = useDynamicConfig('swappedwithdrawalsourceoverrides')\n return useMemo(\n () =>\n resolveSwappedWithdrawalLegs({\n source: config.sourceToken,\n target: config.swappedAcceptedToken,\n override: findSwappedSourceOverride(sourceOverrides, {\n chainId: config.sourceToken.chainId,\n tokenAddress: config.sourceToken.address,\n }),\n }),\n [config.sourceToken, config.swappedAcceptedToken, sourceOverrides],\n )\n}\n\n// \u2500\u2500 Step: source balance \u2192 EUR sell cap \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\ninterface WithdrawalSellCap {\n /** Host balance in USD (0 when none is configured or it hasn't resolved). */\n usdBalance: number\n /** Floored EUR cap forwarded to Swapped, or undefined when uncapped. */\n eurMax: number | undefined\n /** Balance can't clear Swapped's EUR minimum \u2192 cash methods are impossible. */\n isBelowMinimumBalance: boolean\n /** A cap is still resolving \u2014 hold /fops so its first request isn't uncapped. */\n isAwaitingCap: boolean\n}\n\n/**\n * Resolve the host's USD balance and derive the EUR sell cap (web parity:\n * `WithdrawalMethodSelect`). A callback balance (e.g. an on-chain `balanceOf`)\n * is fetched via query; a plain number is used as-is.\n */\nfunction useWithdrawalSellCap(\n config: WithdrawalFlowConfig,\n walletAddress: string,\n): WithdrawalSellCap {\n const { sourceUsdBalance } = config\n const isBalanceCallback = typeof sourceUsdBalance === 'function'\n const hasBalanceInfo = sourceUsdBalance != null\n\n const balanceQuery = useQuery({\n queryKey: [\n 'withdrawSourceUsdBalance',\n walletAddress,\n config.sourceToken.chainId,\n config.sourceToken.address,\n ] as const,\n queryFn: async () => {\n const value = isBalanceCallback ? await sourceUsdBalance() : 0\n return Number.isFinite(value) && value > 0 ? value : 0\n },\n enabled: isBalanceCallback && !!walletAddress && walletAddress !== '0x',\n staleTime: 30_000,\n refetchOnWindowFocus: false,\n })\n const isLoadingBalance = isBalanceCallback && balanceQuery.isLoading\n // Sanitize both paths \u2014 the callback result is already clamped in its queryFn,\n // but a host could also pass a negative / NaN plain number.\n const rawUsdBalance = isBalanceCallback\n ? (balanceQuery.data ?? 0)\n : (sourceUsdBalance ?? 0)\n const usdBalance =\n Number.isFinite(rawUsdBalance) && rawUsdBalance > 0 ? rawUsdBalance : 0\n\n // markup 0 so the cap reflects the true balance (not an inflated +5%); floor\n // it so the sell never exceeds what the user holds and the fops query key\n // stays stable against sub-unit balance jitter (web parity).\n //\n // Enabled on `hasBalanceInfo` (not `usdBalance > 0`) so the keyless rates\n // table fetches in parallel with the balance callback instead of waiting for\n // it \u2014 `isAwaitingCap` still holds /fops until both resolve.\n const { data: exchangeRates, isLoading: isLoadingRates } =\n useFiatExchangeRates(hasBalanceInfo)\n const eurRate = getExchangeRate('EUR', exchangeRates, 0)\n const eurMax = getSwappedSellCapEur(usdBalance, eurRate)\n\n const cashMinUsd = getSwappedCashMinUsd(eurRate)\n const isBelowMinimumBalance =\n hasBalanceInfo &&\n !isLoadingBalance &&\n cashMinUsd != null &&\n usdBalance < cashMinUsd\n\n const isAwaitingCap =\n hasBalanceInfo && (isLoadingBalance || (usdBalance > 0 && isLoadingRates))\n\n return { usdBalance, eurMax, isBelowMinimumBalance, isAwaitingCap }\n}\n\n// \u2500\u2500 Step: the /fops request \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\ninterface FetchWithdrawalFopsArgs {\n apiKey: string\n userId: string\n walletAddress: string\n countryCode: string\n swappedCurrencyCode: string\n fopPriority: Parameters<typeof sortFops>[1]\n themeConfig: ReturnType<typeof buildSwappedThemeQueryParamsRN>\n route: SwappedWithdrawalLegs\n eurMax: number | undefined\n usdBalance: number\n /** The user's raw source token \u2014 for the route-decision log only. */\n sourceToken: WithdrawalToken\n /** Host-supplied email prefilled into the Swapped payout widget, if any. */\n prefillFiatEmail: string | undefined\n}\n\n/**\n * Fetch + sort the Swapped `CRYPTO_TO_FIAT` payout methods for the accepted\n * token. The rail's `sourceToken` is the resolved ACCEPTED token (not the\n * user's raw source) \u2014 mirroring web, where the override/config target feeds\n * the `/fops` rail. `recipientAddress`/`destinationToken` are schema-required\n * but ignored for off-ramp; the wallet address fills the former.\n */\nasync function fetchWithdrawalFops({\n apiKey,\n userId,\n walletAddress,\n countryCode,\n swappedCurrencyCode,\n fopPriority,\n themeConfig,\n route,\n eurMax,\n usdBalance,\n sourceToken,\n prefillFiatEmail,\n}: FetchWithdrawalFopsArgs): Promise<SwappedFormOfPayment[]> {\n const acceptedToken = {\n chainId: route.targetChainId,\n address: route.targetTokenAddress,\n }\n\n // Decision point: which accepted-token rail we request the methods for, and\n // why (Statsig source override vs configured/source token). Logged at fetch\n // time so sessions that list methods but never place an order still record\n // how the route was chosen (web parity: `withdraw-fops`).\n logger.info('connect-rn:withdrawFops:source_override', {\n overrideApplied: route.overrideApplied,\n sourceChainId: sourceToken.chainId,\n sourceTokenAddress: sourceToken.address,\n acceptedChainId: route.targetChainId,\n acceptedTokenAddress: route.targetTokenAddress,\n acceptedTokenSymbol: route.targetTokenSymbol,\n })\n\n // Decision point: whether the balance-derived EUR cap is forwarded as the\n // sell limit or suppressed (at/below the minimum \u2014 a contradictory range).\n const sellLimits = buildSwappedSellLimits(eurMax)\n logger.info('connect-rn:withdrawFops:sellLimits', {\n defaultMinAmount: sellLimits.defaultMinAmount,\n usdBalance,\n eurMax,\n capForwarded: sellLimits.defaultMaxAmount != null,\n })\n\n const response = await getFops({\n apiKey,\n logger,\n params: {\n recipientAddress: walletAddress,\n userId,\n destinationToken: acceptedToken,\n fiatCurrencyCode: swappedCurrencyCode,\n countryCode,\n railConfigs: [\n {\n type: RailConfigType.CRYPTO_TO_FIAT,\n userId,\n countryCode,\n fiatCurrencyCode: swappedCurrencyCode,\n sourceToken: acceptedToken,\n thirdPartyPaymentConfigs: buildSwappedThirdPartyPaymentConfigs({\n prefillFiatEmail,\n themeConfig,\n logTag: 'connect-rn:withdrawFops',\n logger,\n }),\n checkoutLimitsCriteria: sellLimits,\n },\n ],\n },\n })\n\n const fops = sortFops(response.genericFormsOfPayments, fopPriority)\n if (fops.length === 0) {\n logger.info('connect-rn:withdrawFops:empty', {\n countryCode,\n targetChainId: route.targetChainId,\n targetTokenAddress: route.targetTokenAddress,\n })\n }\n return fops\n}\n\n// \u2500\u2500 Hook \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * RN port of web's `useWithdrawFops`. Orchestrates the steps: resolve the\n * accepted-token legs, the region country/currency, the balance-derived sell\n * cap, then run the gated `/fops` query.\n */\nexport function useWithdrawalFops({\n config,\n enabled = true,\n}: UseWithdrawalFopsParams): UseWithdrawalFopsResult {\n const { apiKey, userId, prefillFiatEmail } = useFunkitIdentity()\n // Statsig readiness: while it's loading, the gate reads its `false` fallback,\n // which is indistinguishable from a genuinely-off gate \u2014 treat init as\n // loading, not \"unavailable\".\n const { isLoading: isStatsigLoading } = useStatsigClient()\n const isWithdrawalEnabled = !!useDynamicConfig('enableswappedwithdrawal')\n const fopPriority = useDynamicConfig('foppriority')\n const walletAddress = config.withdrawalWallet.address()\n\n const route = useWithdrawalRoute(config)\n\n // Country from the user's IP; no default (web parity). How an unresolved or\n // empty country is handled lives downstream: the fetch holds on it (isEnabled)\n // and a settled-but-empty lookup surfaces as an error (isError).\n const { userIpInfo, isLoadingGeoCheck } = useUserIpInfo()\n const countryCode = userIpInfo?.alpha2\n\n // Region-default fiat currency (web parity); falls back to USD. Gating /fops\n // on its loading state avoids an initial USD fetch that refetches once the\n // region currency resolves.\n const {\n data: swappedCurrencyCode = DEFAULT_FIAT_CURRENCY,\n isLoading: isSwappedCurrencyCodeLoading,\n } = useSwappedDefaultCurrencyQuery({\n apiKey,\n countryCode: userIpInfo?.alpha2,\n logger,\n })\n\n // Loading-state theme baked into the returned embeddedFlowUrls (web parity).\n const theme = useTheme<FunkitTheme>()\n const themeConfig = useMemo(\n () => buildSwappedThemeQueryParamsRN(theme),\n [theme],\n )\n\n const { usdBalance, eurMax, isBelowMinimumBalance, isAwaitingCap } =\n useWithdrawalSellCap(config, walletAddress)\n\n const isEnabled =\n enabled &&\n isWithdrawalEnabled &&\n !!apiKey &&\n !!userId &&\n !!walletAddress &&\n walletAddress !== '0x' &&\n !!countryCode &&\n !isSwappedCurrencyCodeLoading &&\n !isAwaitingCap\n\n const query = useQuery({\n // `prefillFiatEmail` is intentionally NOT in the queryKey (web parity): it's\n // read at fetch time, so post-mount changes don't trigger a refetch.\n queryKey: [\n WITHDRAW_FOPS_QUERY_KEY,\n userId,\n walletAddress,\n apiKey,\n countryCode,\n swappedCurrencyCode,\n fopPriority,\n themeConfig,\n route.targetChainId,\n route.targetTokenAddress,\n eurMax,\n ] as const,\n // `countryCode` is guaranteed by `isEnabled` (query stays disabled until it\n // resolves); the guard just narrows the type \u2014 the empty fallback is unreachable.\n queryFn: () =>\n countryCode\n ? fetchWithdrawalFops({\n apiKey,\n userId,\n walletAddress,\n countryCode,\n swappedCurrencyCode,\n fopPriority,\n themeConfig,\n route,\n eurMax,\n usdBalance,\n sourceToken: config.sourceToken,\n prefillFiatEmail,\n })\n : Promise.resolve([]),\n enabled: isEnabled,\n staleTime: FOPS_STALE_TIME,\n refetchOnWindowFocus: false,\n })\n\n // Loading spans every window where the answer isn't knowable yet: Statsig\n // init, the geo lookup, the region-currency lookup, the balance/rate cap\n // resolution, and the enabled fops fetch.\n const isLoading =\n isStatsigLoading ||\n isLoadingGeoCheck ||\n isSwappedCurrencyCodeLoading ||\n isAwaitingCap ||\n (isEnabled && query.isLoading)\n\n // Known-empty only once we actually know: gate confirmed off (Statsig\n // settled) or a settled fetch that returned nothing. Never during a load.\n const noPaymentMethodsAvailable =\n !isLoading &&\n (!isWithdrawalEnabled ||\n (query.isSuccess && (query.data?.length ?? 0) === 0))\n\n return {\n fops: query.data ?? [],\n isLoading,\n noPaymentMethodsAvailable,\n isBelowMinimumBalance,\n // Tie the query error to isEnabled (\"gate off \u21D2 no error\"), plus web's\n // no-country case: geo settled without a country is unrecoverable here.\n isError:\n (isEnabled && query.isError) || (!isLoadingGeoCheck && !countryCode),\n // Respect the enabled gate \u2014 refetch() would otherwise force a fetch even\n // when disabled (e.g. no resolved country).\n refetch: () => {\n if (isEnabled) void query.refetch()\n },\n isWithdrawalEnabled,\n route,\n }\n}\n", "import {\n type SwappedSellOrderData,\n type SwappedWithdrawalLegs,\n ensureRelayClientInitialized,\n getPublicClientFor,\n isUserRejectedError,\n processFiatWithdrawalOrder,\n toFiatWithdrawalOrder,\n} from '@funkit/connect-core'\nimport { useCallback, useRef } from 'react'\n\nimport type {\n WithdrawalFlowCallbacks,\n WithdrawalFlowConfig,\n} from '../flow/withdrawalFlowConfig'\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\n\n// Module-scoped so a submitted order stays deduped across sheet close/reopen \u2014\n// the hook (and its refs) unmount on close, but the embed can re-emit\n// SWAPPED_ORDER_DATA for the same order_id after a reopen. Provider order ids\n// are globally unique, so a process-wide set is safe.\nconst submittedOrderIds = new Set<string>()\n\n/**\n * @internal Test-only: clear the process-wide submitted-order dedupe set so\n * suites that reuse order ids stay isolated. Not part of the public API.\n */\nexport function __resetSubmittedWithdrawalOrders(): void {\n submittedOrderIds.clear()\n}\n\nexport interface UseWithdrawalExecutionParams {\n config: WithdrawalFlowConfig\n /** The route resolved by `useWithdrawalFops` \u2014 one resolution for fetch + quote. */\n route: SwappedWithdrawalLegs\n callbacks: WithdrawalFlowCallbacks\n /** Unrecoverable failure \u2014 the flow shows its error state. */\n onError: () => void\n}\n\n/**\n * Thin React wrapper over connect-core's `processFiatWithdrawalOrder`: owns\n * the control-flow guards for the unreliable embed message stream and maps\n * outcomes onto host callbacks. The guards are intentionally refs, not state \u2014\n * both are read synchronously inside the async `executeOrder` (a re-entrancy\n * flag set before the first await, and a dedupe set) and must not re-render.\n */\nexport function useWithdrawalExecution({\n config,\n route,\n callbacks,\n onError,\n}: UseWithdrawalExecutionParams): {\n executeOrder: (data: SwappedSellOrderData) => Promise<void>\n} {\n const { apiKey, userId } = useFunkitIdentity()\n\n const isProcessingRef = useRef(false)\n\n const executeOrder = useCallback(\n async (data: SwappedSellOrderData) => {\n const order = toFiatWithdrawalOrder(data)\n if (isProcessingRef.current) {\n logger.warn('connect-rn:withdrawal:already_processing', {\n order_id: order.orderId,\n })\n return\n }\n if (submittedOrderIds.has(order.orderId)) {\n logger.warn('connect-rn:withdrawal:duplicate', {\n order_id: order.orderId,\n })\n return\n }\n isProcessingRef.current = true\n\n // Routing decision point: the requested target (config) vs the enforced\n // target (after the Statsig source override) alongside what the provider\n // reported it accepts, for off-ramp reconciliation (web parity).\n logger.info('connect-rn:withdrawal:route_decision', {\n order_id: order.orderId,\n overrideApplied: route.overrideApplied,\n requestedTargetChainId: config.swappedAcceptedToken?.chainId,\n requestedTargetTokenAddress: config.swappedAcceptedToken?.address,\n enforcedTargetChainId: route.targetChainId,\n enforcedTargetTokenAddress: route.targetTokenAddress,\n enforcedTargetTokenSymbol: route.targetTokenSymbol,\n providerCrypto: order.providerCrypto,\n providerNetwork: order.providerNetwork,\n })\n\n let txHash: string\n try {\n ensureRelayClientInitialized(logger, 'funkit-connect-rn')\n ;({ txHash } = await processFiatWithdrawalOrder({\n order,\n wallet: config.withdrawalWallet,\n legs: route,\n apiKey,\n userId,\n logger,\n // Read the target token's decimals on-chain (via publicClient) rather\n // than trusting host-config `decimals` \u2014 a stale/wrong value would\n // mis-scale the amount transferred to Swapped's deposit address.\n publicClient: getPublicClientFor(Number(route.targetChainId)),\n }))\n } catch (error) {\n if (isUserRejectedError(error)) {\n // The user declined the signature \u2014 the embed stays interactive.\n logger.warn('connect-rn:withdrawal:user_rejected', {\n order_id: order.orderId,\n })\n return\n }\n // Unrecoverable: funds did not move (or the record failed) and the\n // user sees the error state.\n logger.error('connect-rn:withdrawal:execution_failed', error as Error, {\n order_id: order.orderId,\n })\n callbacks.onWithdrawalError?.({\n message: error instanceof Error ? error.message : String(error),\n })\n onError()\n return\n } finally {\n isProcessingRef.current = false\n }\n\n // Funds moved \u2014 mark submitted and correlate the provider order id to the\n // on-chain hash. The host callback runs in its own guard: a throw here is\n // NOT an execution failure (money already moved), so it must not fall into\n // the error path above and fire `onWithdrawalError` for a success.\n submittedOrderIds.add(order.orderId)\n try {\n callbacks.onWithdrawalSubmitted?.(order.orderId, txHash)\n } catch (error) {\n logger.warn('connect-rn:withdrawal:submitted_callback_threw', {\n order_id: order.orderId,\n error: error instanceof Error ? error.message : String(error),\n })\n }\n },\n [apiKey, userId, config, route, callbacks, onError],\n )\n\n return { executeOrder }\n}\n", "// `__CONNECT_RN_VERSION__` is replaced at build time with the package version\n// via esbuild `define` (see build.js). The `typeof` guard keeps this safe under\n// vitest / tsc, where the define isn't applied and the identifier is undefined.\ndeclare const __CONNECT_RN_VERSION__: string\n\nexport const CONNECT_RN_VERSION: string =\n typeof __CONNECT_RN_VERSION__ === 'string'\n ? __CONNECT_RN_VERSION__\n : '0.0.0-dev'\n", "import {\n LogEventCompressionMode,\n LogLevel,\n StatsigProvider,\n type StatsigUser,\n} from '@statsig/react-bindings'\nimport { type ReactNode, useMemo } from 'react'\n\nimport { useClientAsyncInitRN } from '../statsig/useClientAsyncInitRN'\n\n// React Native counterpart of @funkit/connect's FunkitStatsigProvider. Same Fun\n// client key + custom proxy (the Statsig domain is usually blocked by adblockers\n// \u2014 https://docs.statsig.com/infrastructure/api_proxy/custom_proxy), but the\n// client is created with the RN bindings (AsyncStorage persistence, AppState\n// visibility) via `useClientAsyncInitRN`. The web-only Datadog `values_updated`\n// correlation is omitted (RN logging is wired separately).\nconst STATSIG_API = 'https://data-api.fun.xyz/v1'\nexport const STATSIG_CLIENT_KEY =\n 'client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM' as const\n\n// Hardcoded SDK marker (not UA/OS-parsed, so present on every eval). Lets a\n// config shared with the web SDK be scoped per-SDK via a targeting rule.\nexport const STATSIG_SDK_TYPE = 'react-native' as const\n\n/**\n * Statsig user for the RN SDK: `customIDs.apiKey` drives customer-gated configs;\n * `custom.sdkType` scopes shared configs to this SDK (see {@link STATSIG_SDK_TYPE}).\n */\nexport function buildFunkitStatsigUser(\n userId: string,\n apiKey: string,\n): StatsigUser {\n return {\n userID: userId,\n customIDs: { apiKey },\n custom: { sdkType: STATSIG_SDK_TYPE },\n }\n}\n\ninterface FunkitStatsigProviderProps {\n children: ReactNode\n /** Customer apiKey \u2014 gates customer-scoped configs (e.g. `enableswappeddeposit`). */\n apiKey: string\n /** Resolved funkit user id (apiKey|externalUserId, else wallet address). */\n userId: string\n isDevelopment?: boolean\n}\n\nexport function FunkitStatsigProvider({\n children,\n apiKey,\n userId,\n isDevelopment = false,\n}: FunkitStatsigProviderProps) {\n const user = useMemo<StatsigUser>(\n () => buildFunkitStatsigUser(userId, apiKey),\n [userId, apiKey],\n )\n\n const { client } = useClientAsyncInitRN(STATSIG_CLIENT_KEY, user, {\n networkConfig: {\n api: STATSIG_API,\n // default timeout (10s) is too large; statsig usually responds <200ms\n networkTimeoutMs: 5_000,\n },\n // Our proxy supports compression; force it on to save bandwidth.\n logEventCompressionMode: LogEventCompressionMode.Forced,\n // Silence harmless warnings from hooks running before async init (we have\n // bootstrap fallbacks).\n logLevel: isDevelopment ? undefined : LogLevel.Error,\n environment: {\n tier: isDevelopment ? 'development' : 'production',\n },\n })\n\n return <StatsigProvider client={client}>{children}</StatsigProvider>\n}\n", "import {\n type StatsigOptions,\n type StatsigUser,\n useStatsigInternalClientFactoryAsync,\n} from '@statsig/react-bindings'\n\nimport { StatsigClientRN } from './StatsigClientRN'\n\n// Vendored from @statsig/react-native-bindings. Creates an RN client and runs\n// `initializeAsync` (network fetch); `isLoading` flips false when ready.\nexport function useClientAsyncInitRN(\n sdkKey: string,\n initialUser: StatsigUser,\n statsigOptions: StatsigOptions | null = null,\n): { isLoading: boolean; client: StatsigClientRN } {\n return useStatsigInternalClientFactoryAsync(\n (args) =>\n new StatsigClientRN(args.sdkKey, args.initialUser, args.statsigOptions),\n {\n sdkKey,\n initialUser,\n statsigOptions,\n },\n )\n}\n", "import {\n StatsigClient,\n type StatsigOptions,\n type StatsigUser,\n} from '@statsig/react-bindings'\n\nimport { setupStatsigForReactNative } from './rnSetup'\nimport { getStatsigMetadataAdditions } from './statsigMetadata'\n\n// Vendored from @statsig/react-native-bindings' StatsigClientRN. A StatsigClient\n// pre-configured for React Native: AsyncStorage persistence, AppState-driven\n// visibility, and (device-info-free) metadata additions.\nexport class StatsigClientRN extends StatsigClient {\n readonly __isRnClient = true\n\n constructor(\n sdkKey: string,\n user: StatsigUser,\n options: StatsigOptions | null = null,\n ) {\n const opts = options ?? {}\n setupStatsigForReactNative(getStatsigMetadataAdditions(), opts)\n\n super(sdkKey, user, opts)\n }\n}\n", "import {\n type AnyStatsigOptions,\n type NetworkArgs,\n SDKType,\n StatsigMetadataProvider,\n} from '@statsig/react-bindings'\n\nimport { applyAppStateVisibilityShim } from './appVisibilityShim'\nimport { createPreloadedAsyncStorage } from './preloadedAsyncStorage'\n\n// Vendored from @statsig/react-native-core's RNSetup. Wires the RN platform\n// concerns into a StatsigOptions before the client is constructed: the AppState\n// visibility shim, the binding type, the AsyncStorage-backed storage provider\n// (unless the host supplied its own), and a fetch-based network override that\n// sets the JSON content-type header.\n\nexport function setupStatsigForReactNative(\n statsigMetadataAdditions: Record<string, string | undefined> | null,\n options: AnyStatsigOptions,\n): void {\n applyAppStateVisibilityShim()\n\n SDKType._setBindingType('rn')\n if (statsigMetadataAdditions) {\n StatsigMetadataProvider.add(statsigMetadataAdditions)\n }\n\n if (options.storageProvider == null) {\n options.storageProvider = createPreloadedAsyncStorage()\n }\n\n applyNetworkFix(options)\n}\n\nfunction applyNetworkFix(options: AnyStatsigOptions) {\n if (options.networkConfig?.networkOverrideFunc != null) {\n return\n }\n\n const networkOverrideFunc = (url: string, args: NetworkArgs) => {\n if (args.body != null && args.method === 'POST') {\n args.headers = {\n 'Content-Type': 'application/json',\n ...args.headers,\n }\n }\n return fetch(url, args)\n }\n\n options.networkConfig = {\n networkOverrideFunc,\n ...options.networkConfig,\n }\n}\n", "import { _notifyVisibilityChanged } from '@statsig/react-bindings'\nimport { AppState } from 'react-native'\n\n// Vendored from @statsig/react-native-core's AppVisiblityShim. statsig's event\n// logger flushes on visibility changes; on web that's driven by\n// `document`/`window` events, which don't exist in RN. Bridge RN's `AppState`\n// to statsig's `_notifyVisibilityChanged` so flush-on-background works.\n\nlet isApplied = false\n\nexport function applyAppStateVisibilityShim(): void {\n if (isApplied) {\n return\n }\n\n isApplied = true\n AppState.addEventListener('change', (nextAppState) =>\n _notifyVisibilityChanged(\n nextAppState === 'active' ? 'foreground' : 'background',\n ),\n )\n}\n", "import AsyncStorage from '@react-native-async-storage/async-storage'\nimport { Log, type StorageProvider } from '@statsig/react-bindings'\n\n// Vendored from @statsig/react-native-core's PreloadedAsyncStorage, unchanged\n// except for sourcing `Log`/`StorageProvider` from `@statsig/react-bindings`\n// (which re-exports `@statsig/client-core`) so there's a single statsig copy.\n//\n// Statsig's storage API is synchronous, but AsyncStorage is async. This bridges\n// them: prefetch all `statsig.*` keys into an in-memory mirror once, serve reads\n// synchronously from the mirror, and write through to AsyncStorage in the\n// background. Persistence (warm cache across launches) without any native\n// module beyond AsyncStorage.\n\nconst NOT_READY_ERROR =\n 'Attempting to alter AsyncStorage before it is ready. Values will not be persisted.'\n\nexport function createPreloadedAsyncStorage(): StorageProvider {\n const inMemoryStore: Record<string, string> = {}\n let isResolved = false\n let readyPromise: Promise<void> | null = null\n\n const enforceIsResolved = () => {\n if (!isResolved) {\n Log.error(NOT_READY_ERROR)\n }\n\n return isResolved\n }\n\n const provider: StorageProvider = {\n getProviderName: (): string => 'AsyncStorage',\n\n isReady: () => isResolved,\n\n isReadyResolver: () => {\n if (!readyPromise) {\n readyPromise = prefetchFromAsyncStorage(inMemoryStore).finally(() => {\n isResolved = true\n })\n }\n return readyPromise\n },\n\n getItem: (key: string): string | null => {\n if (!enforceIsResolved()) {\n return null\n }\n\n return inMemoryStore[key] ?? null\n },\n\n setItem: (key: string, value: string): void => {\n inMemoryStore[key] = value\n if (!enforceIsResolved()) {\n return\n }\n\n AsyncStorage.setItem(key, value).catch(Log.error)\n },\n\n removeItem: (key: string): void => {\n delete inMemoryStore[key]\n if (!enforceIsResolved()) {\n return\n }\n\n AsyncStorage.removeItem(key).catch(Log.error)\n },\n\n getAllKeys: (): readonly string[] => {\n if (!enforceIsResolved()) {\n return []\n }\n\n return Object.keys(inMemoryStore)\n },\n }\n\n return provider\n}\n\nasync function prefetchFromAsyncStorage(\n inMemoryStore: Record<string, string>,\n): Promise<void> {\n const keys = await AsyncStorage.getAllKeys()\n\n await Promise.all(\n keys.map(async (key) => {\n if (!key.startsWith('statsig.')) {\n return\n }\n\n const cache = await AsyncStorage.getItem(key)\n if (!cache) {\n return\n }\n\n inMemoryStore[key] = cache\n }),\n )\n}\n", "import { NativeModules, Platform } from 'react-native'\n\n// Vendored from @statsig/react-native-core's StatsigMetadataAdditions, with the\n// `react-native-device-info` dependency intentionally REMOVED \u2014 that package is\n// a native module (not in Expo Go, needs a dev build) and we don't want to\n// require it. The app-version / device-model fields it provided are simply left\n// `undefined`; we still surface `systemName` (free via `Platform.OS`) and the\n// `locale` (read from RN's built-in NativeModules, no extra dependency).\n\ntype I18nManagerModule = { localeIdentifier?: string }\ntype SettingsManagerModule = {\n settings?: { AppLocale?: string; AppleLanguages?: string[] }\n}\n\nfunction resolveLocale(): string | undefined {\n if (Platform.OS === 'android') {\n const i18nManager = NativeModules.I18nManager as\n | I18nManagerModule\n | undefined\n return i18nManager?.localeIdentifier ?? undefined\n }\n\n if (Platform.OS === 'ios') {\n const settings = (\n NativeModules.SettingsManager as SettingsManagerModule | undefined\n )?.settings\n return settings?.AppLocale ?? settings?.AppleLanguages?.[0] ?? undefined\n }\n\n return undefined\n}\n\nexport function getStatsigMetadataAdditions(): Record<\n string,\n string | undefined\n> {\n return {\n // Device-info-derived fields are dropped (no react-native-device-info).\n appVersion: undefined,\n systemVersion: undefined,\n deviceModelName: undefined,\n deviceModel: undefined,\n // Available without any native module:\n systemName: Platform.OS,\n locale: resolveLocale(),\n }\n}\n", "import { useCallback } from 'react'\n\nimport type {\n DepositFlowCallbacks,\n DepositFlowConfig,\n} from '../flow/depositFlowConfig'\nimport { useFunkitFlow } from '../flow/FunkitFlowProvider'\nimport type {\n WithdrawalFlowCallbacks,\n WithdrawalFlowConfig,\n} from '../flow/withdrawalFlowConfig'\n\n/** Lifecycle callbacks for both managed flows (overlapping keys are identical). */\nexport type FunkitCheckoutCallbacks = DepositFlowCallbacks &\n WithdrawalFlowCallbacks\n\n/**\n * The connect-rn entry hook, mirroring `@funkit/connect`'s `useFunkitCheckout`.\n * Returns imperative `begin*` calls that open the SDK's managed modal flow \u2014 the\n * host renders no screens itself.\n *\n * `beginDeposit(config)` opens the deposit flow (Add money \u2192 Transfer/UDA \u2192\n * Choose chain / Supported tokens / QR). `beginWithdrawal(config)` opens the\n * fiat-offramp withdrawal flow (payout methods \u2192 Swapped sell embed).\n * `beginCheckout` will be added here as that flow lands, matching the web\n * surface.\n */\nexport function useFunkitCheckout(callbacks: FunkitCheckoutCallbacks = {}) {\n const { beginDeposit: openDepositFlow, beginWithdrawal: openWithdrawalFlow } =\n useFunkitFlow()\n\n const beginDeposit = useCallback(\n (config: DepositFlowConfig) => openDepositFlow(config, callbacks),\n [openDepositFlow, callbacks],\n )\n\n const beginWithdrawal = useCallback(\n (config: WithdrawalFlowConfig) => openWithdrawalFlow(config, callbacks),\n [openWithdrawalFlow, callbacks],\n )\n\n return { beginDeposit, beginWithdrawal }\n}\n", "import type { DirectExecution } from '@funkit/api-base'\nimport {\n type PurifiedCheckoutHistoryItem,\n processRecentDepositsForNotifications,\n purifyCheckoutHistoryItem,\n useRecentDepositsApiQuery,\n} from '@funkit/connect-core'\nimport { useMemo } from 'react'\n\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\nimport { useDynamicConfig } from '../statsig/useDynamicConfig'\n\ninterface UseFunkitRecentDepositsParams {\n isVisible: boolean\n fetchSize?: number\n cutOffTimeMs?: number\n /**\n * Optional filter to refine which deposits are returned. Pass a stable\n * reference (`useCallback`) \u2014 an unstable one recomputes the merge each render.\n */\n memoizedFilterFunc?: (de: DirectExecution) => boolean\n}\n\ninterface UseFunkitRecentDepositsImplParams extends UseFunkitRecentDepositsParams {\n apiKey: string\n userId: string\n refreshIntervalMs: number\n}\n\n/**\n * Fetch the current user's recent deposits, polling the funkit server. Mirrors\n * `@funkit/connect`'s `useFunkitRecentDeposits`.\n *\n * **Requirements**: must be used inside `<FunkitProvider>` \u2014 it reads the\n * apiKey/userId configured there and the shared refresh interval. The `'0x'`\n * sentinel (no wallet / no externalUserId) disables polling.\n *\n * @returns `{ data }` \u2014 purified deposit rows, or `undefined` while loading.\n *\n * @example\n * ```tsx\n * const { data: recentDeposits } = useFunkitRecentDeposits({\n * isVisible: true,\n * fetchSize: 10,\n * cutOffTimeMs: 24 * 60 * 60 * 1000, // last 24h\n * })\n * ```\n */\nexport function useFunkitRecentDeposits(query: UseFunkitRecentDepositsParams): {\n data: PurifiedCheckoutHistoryItem[] | undefined\n} {\n const { apiKey, userId } = useFunkitIdentity()\n const { listRefresh } = useDynamicConfig(\n 'checkoutnotificationsrefreshinterval',\n )\n\n return useFunkitRecentDepositsImpl({\n ...query,\n apiKey,\n // The '0x' sentinel means no wallet / no externalUserId \u2014 disables polling.\n userId: userId === '0x' ? '' : userId,\n refreshIntervalMs: listRefresh,\n })\n}\n\n/**\n * Explicit-params variant of `useFunkitRecentDeposits`. Mirrors\n * `@funkit/connect`'s `useFunkitRecentDepositsImpl`.\n *\n * **Requirements**: does NOT require `<FunkitProvider>` \u2014 the host passes\n * identity and the refresh interval itself. Use it when polling outside the\n * provider hierarchy, or for a user other than the configured one.\n *\n * @returns `{ data }` \u2014 purified deposit rows, or `undefined` while loading.\n *\n * @example\n * ```tsx\n * const { data: recentDeposits } = useFunkitRecentDepositsImpl({\n * isVisible: true,\n * apiKey: 'your-api-key',\n * userId: 'funkit|external-user-42',\n * refreshIntervalMs: 5000,\n * fetchSize: 10,\n * })\n * ```\n */\nexport function useFunkitRecentDepositsImpl({\n isVisible,\n fetchSize = 5,\n cutOffTimeMs,\n memoizedFilterFunc,\n apiKey,\n userId,\n refreshIntervalMs,\n}: UseFunkitRecentDepositsImplParams): {\n data: PurifiedCheckoutHistoryItem[] | undefined\n} {\n const { data: directExecutions } = useRecentDepositsApiQuery({\n isVisible,\n apiKey,\n userId,\n refreshIntervalMs,\n fetchSize: fetchSize * 2, // over-fetch to account for merging\n logger,\n })\n\n const mergedDirectExecutions = useMemo(\n () =>\n processRecentDepositsForNotifications(\n memoizedFilterFunc\n ? directExecutions?.filter(memoizedFilterFunc)\n : directExecutions,\n { cutOffTimeMs },\n ),\n [directExecutions, cutOffTimeMs, memoizedFilterFunc],\n )\n\n return useMemo(\n () => ({\n data: mergedDirectExecutions\n ?.map((de) => purifyCheckoutHistoryItem(de))\n .slice(0, fetchSize),\n }),\n [mergedDirectExecutions, fetchSize],\n )\n}\n", "import {\n getCheckoutsByUserId,\n getDirectExecutionsByUserId,\n} from '@funkit/api-base'\nimport {\n type PurifiedCheckoutHistoryItem,\n purifyCheckoutHistoryItem,\n} from '@funkit/connect-core'\nimport { useQuery } from '@tanstack/react-query'\n\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\nimport { useDynamicConfig } from '../statsig/useDynamicConfig'\n\nconst CHECKOUT_HISTORY_HOOK_LIMIT = 100\n\n/**\n * Poll the current user's checkout + deposit history, mirroring\n * `@funkit/connect`'s `useCheckoutsListenerByUserId`. Fetches both checkouts and\n * direct executions, purifies them, and returns a single list sorted\n * newest-first.\n *\n * **Requirements**: must be used inside `<FunkitProvider>`. `userId` is optional\n * and defaults to the identity configured there \u2014 RN's `userId` is a synthetic\n * internal id the host can't easily supply, so the common case is to omit it.\n * The `'0x'` sentinel (no wallet / no externalUserId) disables polling.\n *\n * @returns `{ data, isLoading }` \u2014 purified rows, or `undefined` while loading.\n */\nexport function useCheckoutsListenerByUserId(userId?: string): {\n data?: PurifiedCheckoutHistoryItem[]\n isLoading: boolean\n} {\n const { apiKey, userId: identityUserId } = useFunkitIdentity()\n const { listRefresh } = useDynamicConfig(\n 'checkoutnotificationsrefreshinterval',\n )\n\n const resolvedUserId = userId ?? identityUserId\n const effectiveUserId = resolvedUserId === '0x' ? '' : resolvedUserId\n\n const { data, isLoading } = useQuery({\n enabled: !!effectiveUserId,\n queryKey: ['getPurifiedCheckoutsByUserId', effectiveUserId],\n queryFn: async () => {\n const [checkouts, directExecutions] = await Promise.all([\n getCheckoutsByUserId({\n apiKey,\n logger,\n userId: effectiveUserId,\n limit: CHECKOUT_HISTORY_HOOK_LIMIT,\n }),\n getDirectExecutionsByUserId({\n apiKey,\n logger,\n userId: effectiveUserId,\n limit: CHECKOUT_HISTORY_HOOK_LIMIT,\n }),\n ])\n\n return [...checkouts, ...directExecutions]\n .map(purifyCheckoutHistoryItem)\n .sort((a, b) => b.createdTimeMs - a.createdTimeMs)\n .slice(0, CHECKOUT_HISTORY_HOOK_LIMIT)\n },\n refetchInterval: listRefresh,\n })\n\n return { data, isLoading }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;AAgKO,SAAS,oBACd,QACA,WACQ;AACR,SAAO,GAAG,MAAM,IAAI,SAAS;AAC/B;AAGO,IAAM,wBAGT;AAAA,EACF,SAAS;AAAA,EACT,QAAQ;AACV;AAEO,IAAM,cAA4B;AAAA,EACvC,YAAY;AAAA,IACV,OAAO;AAAA,IACP,WAAW;AAAA,IACX,QAAQ;AAAA,MACN,SAAS,EAAE,SAAS,WAAW,SAAS,UAAU;AAAA,MAClD,WAAW,EAAE,SAAS,WAAW,SAAS,UAAU;AAAA,MACpD,UAAU,EAAE,SAAS,WAAW,SAAS,UAAU;AAAA,MACnD,MAAM,EAAE,SAAS,WAAW,SAAS,UAAU;AAAA,MAC/C,aAAa;AAAA,QACX,SAAS;AAAA,QACT,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,MAAM,EAAE,SAAS,WAAW,SAAS,WAAW,UAAU,UAAU;AAAA,I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C,kBAAgB;AAMzB,IAAM,8BAA8B;AAe7B,SAAS,6BAA6B,QAG3C;AACA,QAAM,EAAE,QAAQ,QAAQ,eAAe,IAAI,kBAAkB;AAC7D,QAAM,EAAE,YAAY,IAAI;AAAA,IACtB;AAAA,EACF;AAEA,QAAM,iBAAiB,UAAU;AACjC,QAAM,kBAAkB,mBAAmB,OAAO,KAAK;AAEvD,QAAM,EAAE,MAAM,UAAU,IAAIC,WAAS;AAAA,IACnC,SAAS,CAAC,CAAC;AAAA,IACX,UAAU,CAAC,gCAAgC,eAAe;AAAA,IAC1D,SAAS,YAAY;AACnB,YAAM,CAAC,WAAW,gBAAgB,IAAI,MAAM,QAAQ,IAAI;AAAA,QACtD,qBAAqB;AAAA,UACnB;AAAA,UACA;AAAA,UACA,QAAQ;AAAA,UACR,OAAO;AAAA,QACT,CAAC;AAAA,QACD,4BAA4B;AAAA,UAC1B;AAAA,UACA;AAAA,UACA,QAAQ;AAAA,UACR,OAAO;AAAA,QACT,CAAC;AAAA,MACH,CAAC;AAED,aAAO,CAAC,GAAG,WAAW,GAAG,gBAAgB,EACtC,IAAIC,0BAAyB,EAC7B,KAAK,CAAC,GAAG,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAChD,MAAM,GAAG,2BAA2B;AAAA,IACzC;AAAA,IACA,iBAAiB;AAAA,EACnB,CAAC;AAED,SAAO,EAAE,MAAM,UAAU;AAC3B;",
6
- "names": ["Text", "useMemo", "useState", "useState", "useMemo", "useEffect", "useMemo", "useRef", "createContext", "useCallback", "useContext", "useMemo", "useState", "View", "BottomSheetModal", "useCallback", "useEffect", "useState", "useSafeAreaInsets", "jsx", "useEffect", "useMemo", "useMemo", "useEffect", "useCallback", "useEffect", "useState", "jsx", "jsx", "useEffect", "useState", "jsx", "useState", "useEffect", "SvgXml", "jsx", "jsx", "SvgXml", "jsx", "jsx", "SvgXml", "jsx", "SvgXml", "jsx", "toIconUri", "jsx", "jsxs", "StyleSheet", "jsx", "jsx", "jsxs", "styles", "StyleSheet", "useEffect", "useRef", "useState", "Pressable", "StyleSheet", "jsx", "styles", "StyleSheet", "SvgXml", "jsx", "SvgXml", "jsx", "jsxs", "useState", "useRef", "useEffect", "Pressable", "Pressable", "StyleSheet", "View", "useSafeAreaInsets", "useRef", "useState", "StyleSheet", "jsx", "jsxs", "styles", "useWindowDimensions", "StyleSheet", "jsx", "styles", "StyleSheet", "jsx", "jsxs", "useSafeAreaInsets", "styles", "Pressable", "loading", "View", "StyleSheet", "useEffect", "useState", "Animated", "Pressable", "useEffect", "useRef", "Fragment", "jsx", "jsxs", "Pressable", "loading", "t", "useState", "topBar", "useEffect", "Animated", "useEffect", "useRef", "useState", "Pressable", "StyleSheet", "useSafeAreaInsets", "Pressable", "StyleSheet", "jsx", "jsxs", "Pressable", "styles", "StyleSheet", "jsx", "jsxs", "useSafeAreaInsets", "useState", "useRef", "useEffect", "styles", "Pressable", "StyleSheet", "useCallback", "useCallback", "useTheme", "useCallback", "useEffect", "useMemo", "useRef", "View", "content", "jsx", "useRef", "useMemo", "useTheme", "useEffect", "useCallback", "View", "jsx", "useCallback", "sheet", "jsx", "useCallback", "chainIconUri", "chainIconUri", "useCallback", "useEffect", "useRef", "copyToClipboard", "useCallback", "useRef", "useEffect", "getConfiguredMinDepositUsd", "useTheme", "useQuery", "useMemo", "useQuery", "useEffect", "useMemo", "useEffect", "useQuery", "useTheme", "useMemo", "getConfiguredMinDepositUsd", "useQuery", "useQuery", "useMemo", "useQuery", "useMemo", "solanaChain", "getDepositAddressForChain", "solanaChain", "getDepositAddressForChain", "jsx", "useCallback", "useEffect", "useRef", "StyleSheet", "View", "BottomSheetBackdrop", "Easing", "useSafeAreaInsets", "useEffect", "useState", "jsx", "jsxs", "content", "useRef", "useCallback", "useSafeAreaInsets", "useEffect", "Easing", "BottomSheetBackdrop", "View", "StyleSheet", "scrim", "Fragment", "jsx", "jsxs", "copyToClipboard", "useSafeAreaInsets", "useState", "useEffect", "BottomSheetModal", "fops", "row", "useCallback", "useCallback", "useEffect", "useRef", "useState", "StyleSheet", "View", "useSafeAreaInsets", "StyleSheet", "Animated", "Easing", "Keyframe", "jsx", "jsxs", "Keyframe", "Easing", "Animated", "styles", "StyleSheet", "jsx", "StyleSheet", "useSafeAreaInsets", "useState", "useRef", "useCallback", "useEffect", "View", "useCallback", "useState", "useEffect", "useRef", "useQuery", "useRef", "useRef", "useQuery", "query", "ActivityIndicator", "StyleSheet", "useWindowDimensions", "useSafeAreaInsets", "Pressable", "StyleSheet", "jsx", "jsxs", "PillButton", "Pressable", "styles", "StyleSheet", "Pressable", "StyleSheet", "Animated", "jsx", "Animated", "jsx", "jsxs", "styles", "Pressable", "StyleSheet", "bottomInset", "jsx", "jsxs", "useWindowDimensions", "useSafeAreaInsets", "styles", "PillButton", "ActivityIndicator", "StyleSheet", "jsx", "useRef", "useEffect", "BottomSheetModal", "BottomSheetView", "useFeatureGate", "useState", "useSafeAreaInsets", "useCallback", "useCallback", "deductFlatFee", "isWithdrawalAddressSupported", "useState", "useQuery", "useQuery", "useQuery", "useQuery", "useQuery", "toWithdrawalAmountBaseUnit", "useCallback", "useState", "getSupportedAssets", "resolveTokenTransferConfig", "useQuery", "useMemo", "useState", "useQuery", "getSupportedAssets", "useMemo", "resolveTokenTransferConfig", "useState", "isAddressCompatibleWithChain", "useQuery", "useQuery", "isAddressCompatibleWithChain", "useState", "deductFlatFee", "isWithdrawalAddressSupported", "useEffectEvent", "useEffect", "useRef", "useCallback", "useRef", "useState", "useRef", "useState", "useCallback", "useRef", "useEffectEvent", "useEffect", "BottomSheetModal", "BottomSheetScrollView", "useMemo", "useState", "StyleSheet", "View", "useWindowDimensions", "useSafeAreaInsets", "Pressable", "StyleSheet", "Fragment", "jsx", "jsxs", "styles", "row", "Pressable", "StyleSheet", "Pressable", "StyleSheet", "jsx", "jsxs", "styles", "Pressable", "StyleSheet", "BottomSheetScrollView", "useState", "StyleSheet", "View", "useSafeAreaInsets", "useState", "StyleSheet", "jsx", "jsxs", "useState", "styles", "StyleSheet", "Pressable", "StyleSheet", "jsx", "jsxs", "Pressable", "styles", "StyleSheet", "jsx", "jsxs", "useSafeAreaInsets", "useState", "styles", "View", "BottomSheetScrollView", "StyleSheet", "jsx", "jsxs", "useWindowDimensions", "useSafeAreaInsets", "useState", "useMemo", "View", "styles", "BottomSheetScrollView", "chainIconUri", "PillButton", "BottomSheetModal", "StyleSheet", "BottomSheetScrollView", "Pressable", "StyleSheet", "View", "useWindowDimensions", "useSafeAreaInsets", "jsx", "jsxs", "useWindowDimensions", "useSafeAreaInsets", "styles", "Pressable", "View", "BottomSheetScrollView", "LIST_BOTTOM_GAP", "StyleSheet", "StyleSheet", "useSafeAreaInsets", "jsx", "jsxs", "useSafeAreaInsets", "styles", "StyleSheet", "ActivityIndicator", "StyleSheet", "useWindowDimensions", "useSafeAreaInsets", "jsx", "chainIconUri", "BottomSheetTextInput", "StyleSheet", "jsx", "jsxs", "errorText", "styles", "BottomSheetTextInput", "PillButton", "StyleSheet", "Fragment", "jsx", "jsxs", "errorText", "useWindowDimensions", "useSafeAreaInsets", "styles", "PillButton", "ActivityIndicator", "StyleSheet", "Pressable", "StyleSheet", "useWindowDimensions", "Animated", "Keyframe", "LinearTransition", "useSafeAreaInsets", "useMemo", "StyleSheet", "useWindowDimensions", "Animated", "Keyframe", "useAnimatedStyle", "withTiming", "Easing", "jsx", "AMOUNT_FONT_SIZE", "LINE_HEIGHT_RATIO", "LETTER_SPACING_RATIO", "CAP_BOX_RATIO", "Animated", "useWindowDimensions", "useMemo", "useAnimatedStyle", "withTiming", "styles", "Keyframe", "StyleSheet", "Pressable", "StyleSheet", "createContext", "useCallback", "useContext", "jsx", "createContext", "useContext", "useCallback", "warn", "jsx", "row", "Pressable", "styles", "StyleSheet", "Pressable", "StyleSheet", "Animated", "LinearTransition", "jsx", "jsxs", "AnimatedBox", "Animated", "LinearTransition", "card", "styles", "Pressable", "StyleSheet", "jsx", "jsxs", "AnimatedBox", "Animated", "LinearTransition", "Keyframe", "errorText", "useWindowDimensions", "useSafeAreaInsets", "styles", "Pressable", "chainIconUri", "PillButton", "StyleSheet", "Fragment", "jsx", "jsxs", "pasteFromClipboard", "useSafeAreaInsets", "useFeatureGate", "useState", "BottomSheetModal", "BottomSheetView", "jsx", "loading", "useCallback", "jsx", "useCallback", "getFops", "DEFAULT_FIAT_CURRENCY", "FOPS_STALE_TIME", "buildSwappedThirdPartyPaymentConfigs", "sortFops", "useSwappedDefaultCurrencyQuery", "useTheme", "useStatsigClient", "useQuery", "useMemo", "useMemo", "useQuery", "getFops", "buildSwappedThirdPartyPaymentConfigs", "sortFops", "useStatsigClient", "DEFAULT_FIAT_CURRENCY", "useSwappedDefaultCurrencyQuery", "useTheme", "FOPS_STALE_TIME", "ensureRelayClientInitialized", "getPublicClientFor", "isUserRejectedError", "useCallback", "useRef", "useRef", "useCallback", "ensureRelayClientInitialized", "getPublicClientFor", "isUserRejectedError", "jsx", "pasteFromClipboard", "useState", "useCallback", "row", "jsx", "jsxs", "createContext", "copyToClipboard", "pasteFromClipboard", "useState", "useMemo", "useCallback", "View", "useContext", "useMemo", "AsyncStorage", "Platform", "jsx", "useMemo", "jsx", "copyToClipboard", "pasteFromClipboard", "useRef", "useMemo", "useEffect", "useCallback", "useCallback", "useMemo", "useMemo", "purifyCheckoutHistoryItem", "useQuery", "useQuery", "purifyCheckoutHistoryItem"]
3
+ "sources": ["../src/theme/tokens.ts", "../src/theme/toRestyleTheme.ts", "../src/theme/buildFunkitTheme.ts", "../src/theme/themes.ts", "../src/theme/useColorScheme.ts", "../src/theme/useFunkitTheme.ts", "../src/theme/restyle.ts", "../src/theme/FunkitThemeProvider.tsx", "../src/providers/FunkitProvider.tsx", "../src/flow/FunkitFlowProvider.tsx", "../src/transfer/clipboard.ts", "../src/flow/DepositFlowContent.tsx", "../src/geo/useCheckoutBlocked.ts", "../src/geo/isCountryBlocked.ts", "../src/hooks/useNestedSheet.tsx", "../src/icons/CryptoBitcoinIcon.tsx", "../src/icons/PaymentMethodIcon.tsx", "../src/icons/assetLogos.ts", "../src/icons/FunIcon.tsx", "../src/icons/PaymentBrandIcons.tsx", "../src/icons/funIconUri.ts", "../src/icons/QrChainCluster.tsx", "../src/icons/FigmaSystemIcons.tsx", "../src/icons/SourceTokenCluster.tsx", "../src/icons/TokenChainIcon.tsx", "../src/screens/CheckoutBlockedScreen.tsx", "../src/icons/StatusIcon.tsx", "../src/screens/QrCodeScreen.tsx", "../src/components/Grabber.tsx", "../src/hooks/useScreenSize.ts", "../src/icons/CopyAddressIcon.tsx", "../src/screens/SelectChainScreen.tsx", "../src/components/ScrollFade.tsx", "../src/hooks/useNestedSheetHeight.ts", "../src/icons/ChainAvatar.tsx", "../src/screens/SelectMethodScreen.tsx", "../src/hooks/usePulse.ts", "../src/screens/TransferCryptoScreen.tsx", "../src/components/SelectedChainRow.tsx", "../src/swapped/SwappedScreen.tsx", "../src/swapped/SwappedScreenShell.tsx", "../src/swapped/SwappedWebView.tsx", "../src/swapped/buildSwappedTheme.ts", "../src/swapped/webViewSwappedTransport.ts", "../src/transfer/availableChains.ts", "../src/utils/chainDisplay.ts", "../src/transfer/fops.ts", "../src/transfer/formatDepositAddress.ts", "../src/transfer/hooks/useCopyDepositAddress.ts", "../src/transfer/hooks/useFiatExchangeRates.ts", "../src/transfer/hooks/useFops.ts", "../src/transfer/hooks/useTransferInit.ts", "../src/transfer/hooks/useLighterDepositRecipientOverride.ts", "../src/transfer/hooks/useUDAParams.ts", "../src/transfer/hooks/useSupportedTokens.ts", "../src/transfer/supportedTokens.ts", "../src/transfer/hooks/useTokenTransfer.ts", "../src/transfer/QrCode.tsx", "../src/flow/depositFlowConfig.ts", "../src/flow/FlowSheet.tsx", "../src/flow/sheetSizing.ts", "../src/flow/useKeyboardHeight.ts", "../src/flow/selectedChainStorage.ts", "../src/flow/guardHostCallbacks.ts", "../src/flow/useCopiedToast.tsx", "../src/flow/AddressCopiedToast.tsx", "../src/flow/WithdrawalFlowContent.tsx", "../src/screens/WithdrawCryptoComplete.tsx", "../src/withdrawal/useDepositAddressWithdrawalStatus.ts", "../src/withdrawal/useWithdrawalStatus.ts", "../src/screens/WithdrawCompleteScreen.tsx", "../src/components/PillButton.tsx", "../src/components/ReceiveAmountSummary.tsx", "../src/components/SkeletonBar.tsx", "../src/utils/safeArea.ts", "../src/screens/WithdrawCryptoSteps.tsx", "../src/utils/formatAmount.ts", "../src/withdrawal/useCryptoWithdrawalForm.ts", "../src/withdrawal/sourceToken.ts", "../src/withdrawal/useCryptoWithdrawalQuote.ts", "../src/withdrawal/useSourceTokenDecimals.ts", "../src/withdrawal/useCryptoWithdrawalValidation.ts", "../src/withdrawal/validation.ts", "../src/withdrawal/useWithdrawalAmountInput.ts", "../src/withdrawal/useWithdrawalDestinationTokens.ts", "../src/withdrawal/useWithdrawalRisk.ts", "../src/withdrawal/useCryptoWithdrawalSubmit.ts", "../src/utils/executionErrorMessage.ts", "../src/withdrawal/useCryptoWithdrawalExecution.ts", "../src/screens/SelectReceiveTokenAndChainScreen.tsx", "../src/components/AssetGrid.tsx", "../src/utils/assetGrid.ts", "../src/components/TopBar.tsx", "../src/withdrawal/receiveDestination.ts", "../src/screens/SelectReceiveTokenScreen.tsx", "../src/components/SearchInput.tsx", "../src/components/SelectableAssetRow.tsx", "../src/screens/SelectSourceTokenScreen.tsx", "../src/screens/TransactionBreakdownScreen.tsx", "../src/screens/WithdrawAddressScreen.tsx", "../src/components/ReceiveAsRow.tsx", "../src/components/WalletAddressInput.tsx", "../src/screens/WithdrawAmountScreen.tsx", "../src/components/AmountDisplay.tsx", "../src/utils/amountGlyphs.ts", "../src/utils/motion.ts", "../src/components/NumPad.tsx", "../src/haptics/HapticsContext.tsx", "../src/haptics/hapticTap.ts", "../src/components/WithdrawSourceCard.tsx", "../src/utils/numpadInput.ts", "../src/screens/WithdrawMethodScreen.tsx", "../src/swapped/SwappedWithdrawScreen.tsx", "../src/transfer/hooks/useWithdrawalFops.ts", "../src/withdrawal/useWithdrawalExecution.ts", "../src/version.ts", "../src/providers/FunkitStatsigProvider.tsx", "../src/statsig/useClientAsyncInitRN.ts", "../src/statsig/StatsigClientRN.ts", "../src/statsig/rnSetup.ts", "../src/statsig/appVisibilityShim.ts", "../src/statsig/preloadedAsyncStorage.ts", "../src/statsig/statsigMetadata.ts", "../src/providers/useFunkitCheckout.ts", "../src/history/useRecentDeposits.ts", "../src/history/useCheckoutsListenerByUserId.ts"],
4
+ "sourcesContent": ["// Local design tokens for @funkit/connect-rn, generated from the \"Fun Variables\"\n// Figma export (`Fun Variables/{Light,Dark}.tokens.json`). This file is a STRICT\n// mirror of that export: the token tree reproduces Figma's variable HIERARCHY\n// one-to-one (`background` / `content` / `border` / `font` / `spacing` / `brand`\n// / `button` / `opacity`), values are the resolved concrete values, and nothing\n// is invented \u2014 if a state (hover, focused, \u2026) or token isn't in Fun Variables,\n// it isn't here either.\n//\n// Multi-word Figma leaves are camelCased so they're valid TS identifiers\n// (`element-inner` \u2192 `elementInner`, `loading alpha` \u2192 `loadingAlpha`,\n// `amount input` \u2192 `amountInput`, `top bar` \u2192 `topBar`); the nesting is\n// otherwise identical to the JSON.\n//\n// `buildFunkitTheme` (buildFunkitTheme.ts) FLATTENS this tree into the flat\n// `@shopify/restyle` theme components consume (`bgButtonPrimary`, \u2026). The\n// Figma-path \u2192 flat-key convention is documented in\n// `packages/connect-rn/CLAUDE.md` (\u00A7 \"Figma Fun Variables \u2192 tokens.ts\").\n//\n// connect-rn's theme is intentionally NOT shared with @funkit/connect-core (web\n// keeps its separate `ThemeVars`).\n\nimport type { TextStyle } from 'react-native'\n\n/**\n * A Figma font-style name (`font/\u2026/weight`). The Fun Variables export defines\n * exactly these two cuts \u2014 there is no semibold/bold, so any `fontWeight: '600'`\n * in a component is a smell that should route through the token instead.\n */\nexport type FunkitFontStyleName = 'Regular' | 'Medium'\n\n/** Logical weight a component's `Text` can request; maps onto `font/body/weight/*`. */\nexport type FunkitFontWeight = 'base' | 'medium'\n\n/** `font/*` \u2014 body and header typography. Family is shared by both in Light/Dark. */\nexport interface FunkitFontTokens {\n body: {\n /**\n * `font/body/family`. The Fun Variables value is `Inter`, so the host must\n * register `Inter-Regular` / `Inter-Medium` (see {@link fontFamilyForWeight});\n * if it doesn't, RN falls back to the platform system font.\n */\n family: string\n weight: Record<FunkitFontWeight, FunkitFontStyleName>\n size: { base: number; detail: number }\n // Absolute px (RN's TextStyle.lineHeight).\n leading: { base: number; detail: number }\n }\n header: {\n family: string\n weight: FunkitFontStyleName\n alignment: 'Left' | 'Center' | 'Right'\n // `amount input` / `amount summary` are single-line; Figma defines no leading.\n size: {\n title: number\n subtitle: number\n amountInput: number\n amountSummary: number\n }\n }\n}\n\n/** One button state's fill (`background/button/*` \u2014 only `default` + `pressed`). */\nexport interface ButtonSurface {\n default: string\n pressed: string\n}\n\n/**\n * The full token set for one mode \u2014 a one-to-one mirror of the Fun Variables\n * Figma variable groups.\n */\nexport interface FunkitTokens {\n background: {\n modal: string\n secondary: string\n button: {\n primary: ButtonSurface\n secondary: ButtonSurface\n tertiary: ButtonSurface\n icon: ButtonSurface\n destructive: ButtonSurface & { disabled: string }\n }\n pill: { default: string; pressed: string; disabled: string }\n /**\n * Scrim dimming the host app behind the flow sheet. NOT yet a Fun Variable\n * \u2014 the design (13315:9391) hardcodes it \u2014 so it lives here to stay\n * per-client overridable. Fold it in when the export gains the variable.\n */\n overlay: string\n }\n /** `opacity/disabled` \u2014 a percentage (0\u2013100); divide by 100 for RN `opacity`. */\n opacity: {\n disabled: number\n }\n content: {\n elements: {\n primary: string\n secondary: string\n success: string\n error: string\n hyperlink: string\n warning: string\n }\n // Label/icon color on a button surface. `loadingAlpha` (`loading alpha`) is\n // the same color at reduced alpha, shown while the button is loading.\n button: {\n primary: { default: string; loadingAlpha: string }\n secondary: { default: string; loadingAlpha: string }\n tertiary: { default: string }\n icon: { default: string }\n destructive: { default: string; loadingAlpha: string }\n }\n }\n border: {\n radius: {\n modal: number\n element: number\n elementInner: number\n button: number\n }\n modal: { default: string; weight: number }\n elements: {\n default: { color: string; weight: number }\n selected: { color: string; weight: number }\n }\n button: { primary: string; secondary: string; weight: number }\n }\n font: FunkitFontTokens\n spacing: {\n padding: {\n elements: { horizontal: number }\n modal: { horizontal: number }\n }\n heights: { topBar: number; button: number }\n }\n brand: {\n primary: string\n }\n button: {\n // Icon tiers collapse per the export: xs === sm (16) and md === lg (20).\n // The four tiers are kept so call sites stay semantic.\n icon: {\n size: { xs: number; sm: number; md: number; lg: number }\n }\n size: { xs: number; sm: number; md: number; lg: number }\n }\n}\n\n/**\n * Resolves a font family + Figma style name to the concrete native font-family\n * name the host must register \u2014 e.g. `('Inter', 'Medium')` \u2192 `'Inter-Medium'`.\n *\n * This is connect-rn's whole answer to a React Native / Expo quirk: you cannot\n * reliably select a custom font's weight via `fontWeight`. Android matches custom\n * fonts by exact family-name string, and a font loaded at runtime (`expo-font`)\n * registers one native Typeface per name \u2014 so `fontWeight: '500'` on\n * `fontFamily: 'Inter'` is silently ignored and every weight renders identically.\n * Weight therefore has to be baked into the family name, and every text style\n * goes through here.\n */\nexport function fontFamilyForWeight(\n family: string,\n styleName: FunkitFontStyleName,\n): string {\n return `${family}-${styleName}`\n}\n\n/** Figma font-style name \u2192 CSS numeric weight (for the Swapped WebView / RN `fontWeight`). */\nexport const FONT_STYLE_CSS_WEIGHT: Record<\n FunkitFontStyleName,\n TextStyle['fontWeight']\n> = {\n Regular: '400',\n Medium: '500',\n}\n\nexport const lightTokens: FunkitTokens = {\n background: {\n modal: '#FFFFFF',\n secondary: '#F9F9F9',\n button: {\n primary: { default: '#0F0F0F', pressed: '#1B1B1B' },\n secondary: { default: '#F9F9F9', pressed: '#DDDDDD' },\n tertiary: { default: '#FFFFFF', pressed: '#EFEFEF' },\n icon: { default: '#FFFFFF', pressed: '#EFEFEF' },\n destructive: {\n default: '#F34126',\n pressed: '#C2341E',\n disabled: '#F34126',\n },\n },\n pill: { default: '#FFFFFF', pressed: '#EFEFEF', disabled: '#FFFFFF' },\n overlay: '#131313CC',\n },\n opacity: {\n disabled: 40,\n },\n content: {\n elements: {\n primary: '#0F0F0F',\n secondary: '#6C6C6C',\n success: '#52A300',\n error: '#F34126',\n hyperlink: '#0F0F0F',\n warning: '#F97316',\n },\n button: {\n primary: { default: '#FFFFFF', loadingAlpha: '#FFFFFF4D' },\n secondary: { default: '#0F0F0F', loadingAlpha: '#0000004D' },\n tertiary: { default: '#0F0F0F' },\n icon: { default: '#6C6C6C' },\n destructive: { default: '#FFFFFF', loadingAlpha: '#FFFFFF80' },\n },\n },\n border: {\n radius: { modal: 24, element: 12, elementInner: 8, button: 999 },\n modal: { default: '#FFFFFF', weight: 1 },\n elements: {\n default: { color: '#EFEFEF', weight: 1 },\n selected: { color: '#0F0F0F', weight: 1 },\n },\n button: { primary: '#0F0F0F', secondary: '#F9F9F9', weight: 0 },\n },\n font: {\n body: {\n family: 'Inter',\n weight: { base: 'Regular', medium: 'Medium' },\n size: { base: 16, detail: 14 },\n leading: { base: 22, detail: 20 },\n },\n header: {\n family: 'Inter',\n weight: 'Medium',\n alignment: 'Center',\n size: { title: 18, subtitle: 16, amountInput: 48, amountSummary: 48 },\n },\n },\n spacing: {\n padding: {\n elements: { horizontal: 12 },\n modal: { horizontal: 16 },\n },\n heights: { topBar: 56, button: 42 },\n },\n brand: {\n primary: '#0F0F0F',\n },\n button: {\n icon: { size: { xs: 16, sm: 16, md: 20, lg: 20 } },\n size: { xs: 36, sm: 40, md: 48, lg: 56 },\n },\n}\n\nexport const darkTokens: FunkitTokens = {\n background: {\n modal: '#0F0F0F',\n secondary: '#1B1B1B',\n button: {\n primary: { default: '#FFFFFF', pressed: '#F9F9F9' },\n secondary: { default: '#1B1B1B', pressed: '#2D2D2D' },\n tertiary: { default: '#1B1B1B', pressed: '#2D2D2D' },\n icon: { default: '#0F0F0F', pressed: '#1B1B1B' },\n destructive: {\n default: '#DB3B22',\n pressed: '#F34126',\n disabled: '#DB3B22',\n },\n },\n pill: { default: '#0F0F0F', pressed: '#1B1B1B', disabled: '#0F0F0F' },\n overlay: '#131313CC',\n },\n opacity: {\n disabled: 40,\n },\n content: {\n elements: {\n primary: '#FFFFFF',\n secondary: '#929292',\n success: '#52A300',\n error: '#F34126',\n hyperlink: '#FFFFFF',\n warning: '#F97316',\n },\n button: {\n primary: { default: '#000000', loadingAlpha: '#0000004D' },\n secondary: { default: '#F9F9F9', loadingAlpha: '#FFFFFF4D' },\n tertiary: { default: '#F9F9F9' },\n icon: { default: '#929292' },\n destructive: { default: '#FFFFFF', loadingAlpha: '#FFFFFF80' },\n },\n },\n border: {\n radius: { modal: 24, element: 12, elementInner: 8, button: 999 },\n modal: { default: '#1B1B1B', weight: 1 },\n elements: {\n default: { color: '#2D2D2D', weight: 1 },\n selected: { color: '#FFFFFF', weight: 1 },\n },\n button: { primary: '#FFFFFF', secondary: '#1B1B1B', weight: 0 },\n },\n font: {\n body: {\n family: 'Inter',\n weight: { base: 'Regular', medium: 'Medium' },\n size: { base: 16, detail: 14 },\n leading: { base: 22, detail: 20 },\n },\n header: {\n family: 'Inter',\n weight: 'Medium',\n alignment: 'Center',\n size: { title: 18, subtitle: 16, amountInput: 48, amountSummary: 48 },\n },\n },\n spacing: {\n padding: {\n elements: { horizontal: 12 },\n modal: { horizontal: 16 },\n },\n heights: { topBar: 56, button: 42 },\n },\n brand: {\n primary: '#0F0F0F',\n },\n button: {\n icon: { size: { xs: 16, sm: 16, md: 20, lg: 20 } },\n size: { xs: 36, sm: 40, md: 48, lg: 56 },\n },\n}\n", "import { createTheme } from '@shopify/restyle'\n\nimport { buildFunkitTheme } from './buildFunkitTheme'\nimport { type FunkitTokens, darkTokens, lightTokens } from './tokens'\n\n/**\n * Wraps the pure {@link buildFunkitTheme} projection in Restyle's `createTheme`.\n * All the real work \u2014 mirroring the Fun Variables Figma groups onto the theme \u2014\n * lives in `buildFunkitTheme`; this is just the thin Restyle boundary so the\n * projection stays testable without Restyle's react-native imports.\n */\nexport function toRestyleTheme(tokens: FunkitTokens) {\n return createTheme(buildFunkitTheme(tokens))\n}\n\n/** The Restyle theme type all connect-rn components are written against. */\nexport type FunkitTheme = ReturnType<typeof toRestyleTheme>\n\n/** Built-in default Restyle themes derived from the Fun Variables Light/Dark tokens. */\nexport const defaultLightTheme = toRestyleTheme(lightTokens)\nexport const defaultDarkTheme = toRestyleTheme(darkTokens)\n", "import type { TextStyle } from 'react-native'\n\nimport {\n FONT_STYLE_CSS_WEIGHT,\n type FunkitFontStyleName,\n type FunkitTokens,\n fontFamilyForWeight,\n} from './tokens'\n\n// A resolved text cut: the native family (weight baked into the name, see\n// `fontFamilyForWeight`) plus the numeric weight kept for the Swapped WebView\n// (CSS) theme and the system-font fallback.\nfunction cut(family: string, styleName: FunkitFontStyleName) {\n return {\n fontFamily: fontFamilyForWeight(family, styleName),\n fontWeight: FONT_STYLE_CSS_WEIGHT[styleName],\n }\n}\n\n/**\n * Projects the nested Fun Variables {@link FunkitTokens} onto the object\n * `@shopify/restyle`'s `createTheme` consumes \u2014 kept as a pure function (no\n * Restyle import) so tests can build the theme without pulling Restyle's\n * react-native Flow source into the node env.\n *\n * The design deliberately DOESN'T use Restyle's `colors` prop system: `colors`\n * is empty and components read colors straight from the Figma-shaped groups\n * (`theme.background.button.primary.default`, `theme.content.elements.primary`,\n * \u2026) via `useTheme()`, so the theme stays a faithful mirror of Figma. Only the\n * non-color numeric buckets Restyle genuinely needs (`spacing`, `borderRadii`,\n * `borderWidths`, `sizes`, `breakpoints`) are projected onto its reserved keys.\n */\nexport function buildFunkitTheme(tokens: FunkitTokens) {\n const { font } = tokens\n const base = cut(font.body.family, font.body.weight.base)\n const medium = cut(font.body.family, font.body.weight.medium)\n const header = cut(font.header.family, font.header.weight)\n const headerAlign =\n font.header.alignment.toLowerCase() as TextStyle['textAlign']\n\n return {\n // Restyle's BaseTheme requires `colors`; intentionally empty \u2014 see above.\n colors: {},\n\n // \u2500\u2500 Figma variable groups, verbatim \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n background: tokens.background,\n content: tokens.content,\n border: tokens.border,\n brand: tokens.brand,\n opacity: tokens.opacity,\n font: tokens.font,\n\n // \u2500\u2500 Non-color numeric buckets projected onto Restyle's reserved keys \u2500\n spacing: {\n none: 0,\n elementsHorizontal: tokens.spacing.padding.elements.horizontal,\n modalHorizontal: tokens.spacing.padding.modal.horizontal,\n },\n borderRadii: {\n modal: tokens.border.radius.modal,\n element: tokens.border.radius.element,\n elementInner: tokens.border.radius.elementInner,\n button: tokens.border.radius.button,\n // Structural (no Figma token): fully-circular avatars / icon wells.\n rounded: 999,\n },\n borderWidths: {\n modal: tokens.border.modal.weight,\n elementsDefault: tokens.border.elements.default.weight,\n elementsSelected: tokens.border.elements.selected.weight,\n button: tokens.border.button.weight,\n },\n sizes: {\n topBar: tokens.spacing.heights.topBar,\n buttonHeight: tokens.spacing.heights.button,\n buttonXs: tokens.button.size.xs,\n buttonSm: tokens.button.size.sm,\n buttonMd: tokens.button.size.md,\n buttonLg: tokens.button.size.lg,\n iconXs: tokens.button.icon.size.xs,\n iconSm: tokens.button.icon.size.sm,\n iconMd: tokens.button.icon.size.md,\n iconLg: tokens.button.icon.size.lg,\n },\n breakpoints: {\n phone: 0,\n tablet: 768,\n },\n\n // Text variants carry no `color` (Restyle colors is unused); the `Text`\n // component defaults the color from `content/elements/*` and callers\n // override per-node via `style`.\n textVariants: {\n defaults: {\n ...base,\n fontSize: font.body.size.base,\n lineHeight: font.body.leading.base,\n },\n body: {\n ...base,\n fontSize: font.body.size.base,\n lineHeight: font.body.leading.base,\n },\n bodyMedium: {\n ...medium,\n fontSize: font.body.size.base,\n lineHeight: font.body.leading.base,\n },\n detail: {\n ...base,\n fontSize: font.body.size.detail,\n lineHeight: font.body.leading.detail,\n },\n headerTitle: {\n ...header,\n fontSize: font.header.size.title,\n textAlign: headerAlign,\n },\n headerSubtitle: {\n ...header,\n fontSize: font.header.size.subtitle,\n textAlign: headerAlign,\n },\n amountInput: {\n ...medium,\n fontSize: font.header.size.amountInput,\n },\n amountSummary: {\n ...medium,\n fontSize: font.header.size.amountSummary,\n },\n },\n // Per-weight `{ fontFamily, fontWeight }` the `Text` `weight` prop applies on\n // top of any variant (both are required for custom fonts \u2014 see\n // `fontFamilyForWeight`).\n textWeights: {\n base,\n medium,\n },\n }\n}\n", "import { type FunkitTheme, toRestyleTheme } from './toRestyleTheme'\nimport { type FunkitTokens, darkTokens, lightTokens } from './tokens'\n\n/** Recursive partial \u2014 every group/leaf of the nested token tree is optional. */\ntype DeepPartial<T> = T extends object\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : T\n\n/**\n * A deep-partial override of the nested Fun Variables {@link FunkitTokens}\n * groups. Pass to {@link lightTheme} / {@link darkTheme} to restyle only the\n * leaves a brand changes (`background` / `content` / `border` / `brand` / \u2026);\n * anything omitted keeps the base token's value.\n */\nexport type FunkitTokensOverride = DeepPartial<FunkitTokens>\n\n/** A mergeable plain object \u2014 not null, not an array. */\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * Deep-merge `override` onto a deep *clone* of `base`. The result shares no\n * object references with `base`, so the built-in tokens are never aliased into a\n * theme \u2014 and thus can't be mutated through one. Non-object values (and arrays)\n * replace the base value whole.\n */\nfunction deepMerge<T>(base: T, override?: DeepPartial<T>): T {\n if (!isPlainObject(base)) {\n return override === undefined ? base : (override as T)\n }\n const source: Record<string, unknown> = isPlainObject(override)\n ? override\n : {}\n const cloned: Record<string, unknown> = {}\n for (const key of Object.keys(base)) {\n cloned[key] = deepMerge(base[key], source[key])\n }\n return cloned as T\n}\n\n/**\n * Build a light {@link FunkitTheme}, deep-merging an optional brand override\n * onto the SDK's `lightTokens`. A brand specifies only the leaves it changes \u2014\n * the design defines `default` / `pressed` states \u2014 and everything else keeps\n * the default value. Called with no argument it returns the default light theme.\n *\n * @example\n * const theme = lightTheme({\n * background: { button: { primary: { default: '#1e3b25', pressed: '#264e30' } } },\n * brand: { primary: '#1e3b25' },\n * })\n */\nexport function lightTheme(override?: FunkitTokensOverride): FunkitTheme {\n return toRestyleTheme(deepMerge(lightTokens, override))\n}\n\n/**\n * Build a dark {@link FunkitTheme}, deep-merging an optional brand override onto\n * the SDK's `darkTokens`. See {@link lightTheme}. For a dark-only brand, call\n * this once and reuse the theme for both `light` and `dark`.\n */\nexport function darkTheme(override?: FunkitTokensOverride): FunkitTheme {\n return toRestyleTheme(deepMerge(darkTokens, override))\n}\n", "import { useEffect, useState } from 'react'\nimport { Appearance, type ColorSchemeName } from 'react-native'\n\nexport type SystemColorScheme = 'light' | 'dark' | undefined\n\n/** A concrete, resolved color scheme (never undefined). */\nexport type ColorScheme = 'light' | 'dark'\n\n/**\n * Resolve the active color scheme with this precedence (pure, exported for\n * testing):\n * 1. `controlled` \u2014 the `FunkitProvider` `colorScheme` prop. When set, it\n * wins over everything, so a manual toggle / system change can't move it.\n * 2. `override` \u2014 a manual `toggleColorScheme()` choice (uncontrolled only).\n * 3. `system` \u2014 the live OS Appearance.\n * 4. `'light'` \u2014 fallback when the system scheme is unknown.\n */\nexport function resolveColorScheme(\n controlled: ColorScheme | undefined,\n override: ColorScheme | undefined,\n system: SystemColorScheme,\n): ColorScheme {\n if (controlled) {\n return controlled\n }\n return override ?? system ?? 'light'\n}\n\n/**\n * Normalize React Native's `ColorSchemeName` (`'light' | 'dark' | null |\n * undefined`) to `'light' | 'dark' | undefined`. Pure \u2014 exported for testing.\n */\nexport function normalizeColorScheme(\n scheme: ColorSchemeName | null | undefined,\n): SystemColorScheme {\n return scheme === 'light' || scheme === 'dark' ? scheme : undefined\n}\n\n/**\n * Reads the system color scheme from RN's `Appearance` API and re-renders on\n * change. The RN counterpart to web's `prefers-color-scheme` media query.\n */\nexport function useColorScheme(): SystemColorScheme {\n const [scheme, setScheme] = useState<SystemColorScheme>(() =>\n normalizeColorScheme(Appearance.getColorScheme()),\n )\n\n useEffect(() => {\n const subscription = Appearance.addChangeListener(({ colorScheme }) => {\n setScheme(normalizeColorScheme(colorScheme))\n })\n return () => subscription.remove()\n }, [])\n\n return scheme\n}\n", "import { useMemo } from 'react'\n\nimport {\n defaultDarkTheme,\n defaultLightTheme,\n type FunkitTheme,\n} from './toRestyleTheme'\nimport { type SystemColorScheme, useColorScheme } from './useColorScheme'\n\n/**\n * A light/dark Restyle theme set. **At least one mode must be provided**; a\n * missing mode falls back to the one that is set. Only Restyle themes (produced\n * by `toRestyleTheme`) are accepted \u2014 raw token objects are not, so callers\n * can't accidentally pass a half-built theme.\n */\nexport type FunkitThemeSet =\n | { light: FunkitTheme; dark?: FunkitTheme }\n | { light?: FunkitTheme; dark: FunkitTheme }\n\nconst DEFAULT_THEME_SET: FunkitThemeSet = {\n light: defaultLightTheme,\n dark: defaultDarkTheme,\n}\n\n/**\n * Pick the Restyle theme for a color scheme, falling back to the other mode\n * when the requested one isn't in the set. The `FunkitThemeSet` union\n * guarantees at least one mode is present.\n */\nexport function selectTheme(\n themeSet: FunkitThemeSet,\n scheme: SystemColorScheme,\n): FunkitTheme {\n const primary = scheme === 'dark' ? themeSet.dark : themeSet.light\n const fallback = scheme === 'dark' ? themeSet.light : themeSet.dark\n if (primary) {\n return primary\n }\n if (fallback) {\n return fallback\n }\n // Unreachable for typed callers; guards untyped (JS) misuse.\n throw new Error(\n 'FunkitProvider: `themes` must include at least one of { light, dark }',\n )\n}\n\n/**\n * Resolves the active Restyle theme from the live system color scheme, to hand\n * to Restyle's `ThemeProvider`. Pass a custom theme set to override the\n * built-in Fun Mobile themes. Falls back to light when the system scheme is\n * unknown.\n */\nexport function useFunkitTheme(\n themeSet: FunkitThemeSet = DEFAULT_THEME_SET,\n): FunkitTheme {\n const scheme = useColorScheme()\n // Depend on the individual theme refs, not the `themeSet` object \u2014 an inline\n // set is a new object each render and would defeat the memo.\n return useMemo(\n () => selectTheme(themeSet, scheme),\n [scheme, themeSet.light, themeSet.dark],\n )\n}\n", "import {\n createBox,\n createText,\n useTheme as useRestyleTheme,\n} from '@shopify/restyle'\nimport {\n type ComponentProps,\n type ComponentRef,\n createElement,\n forwardRef,\n} from 'react'\n\nimport type { FunkitTheme } from './toRestyleTheme'\nimport type { FunkitFontWeight } from './tokens'\n\n/**\n * `@shopify/restyle` primitives bound to the connect-rn {@link FunkitTheme}.\n * Components use these instead of raw `View` / `Text` so style props\n * (`backgroundColor`, `padding`, `borderRadius`, `variant`, \u2026) resolve to theme\n * tokens with full type safety.\n */\nexport const Box = createBox<FunkitTheme>()\n\nconst RestyleText = createText<FunkitTheme>()\n\nexport interface TextProps extends ComponentProps<typeof RestyleText> {\n /**\n * Override the font weight for this node regardless of `variant`. Applies the\n * resolved per-cut family AND numeric weight \u2014 both are required, since RN/Expo\n * can't select a custom font's weight via `fontWeight` alone (see\n * {@link fontFamilyForWeight}). So `variant=\"detail\" weight=\"medium\"` renders\n * the detail style in `Inter-Medium`. An explicit `style` still wins over it.\n */\n weight?: FunkitFontWeight\n}\n\n/**\n * {@link FunkitTheme}-bound Restyle `Text` with a `weight` escape hatch: set\n * `weight` to render a single node at a different cut than its `variant` without\n * minting a `*Medium` twin variant. Without `weight` it's the plain Restyle Text.\n */\nexport const Text = forwardRef<ComponentRef<typeof RestyleText>, TextProps>(\n function Text({ weight, variant, style, ...rest }, ref) {\n const theme = useRestyleTheme<FunkitTheme>()\n // Apply the weight override *before* `style` so a caller's explicit style\n // still wins; `?.` guards mocked themes that omit `textWeights`.\n const weightStyle = weight ? theme.textWeights?.[weight] : undefined\n // Text color isn't a Restyle color prop \u2014 the theme has no `colors` bucket;\n // colors live under the Figma groups. Default it here from `content/elements`\n // by variant (detail/subtitle are secondary, the rest primary); an explicit\n // `style` color still wins. `?.` guards mocked themes.\n const elements = theme.content?.elements\n const secondary = variant === 'detail' || variant === 'headerSubtitle'\n const colorStyle = elements\n ? { color: secondary ? elements.secondary : elements.primary }\n : undefined\n return createElement(RestyleText, {\n ref,\n variant,\n style: [colorStyle, weightStyle, style],\n ...rest,\n })\n },\n)\n\n/** {@link FunkitTheme}-typed `useTheme`, for reading raw token values. */\nexport const useTheme = () => useRestyleTheme<FunkitTheme>()\n", "import { ThemeProvider } from '@shopify/restyle'\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from 'react'\n\nimport { defaultDarkTheme, defaultLightTheme } from './toRestyleTheme'\nimport {\n type ColorScheme,\n resolveColorScheme,\n useColorScheme,\n} from './useColorScheme'\nimport { type FunkitThemeSet, selectTheme } from './useFunkitTheme'\n\nconst DEFAULT_THEMES: FunkitThemeSet = {\n light: defaultLightTheme,\n dark: defaultDarkTheme,\n}\n\ninterface FunkitColorSchemeValue {\n /** The active, resolved color scheme. */\n colorScheme: ColorScheme\n /**\n * Flip light\u2194dark, or set a specific scheme when an argument is given.\n * **No-op when the provider's `colorScheme` prop is set** (controlled mode) \u2014\n * the host owns the scheme in that case.\n */\n toggleColorScheme: (next?: ColorScheme) => void\n /** True when the scheme is forced by the `colorScheme` prop (uncontrolled toggle disabled). */\n isControlled: boolean\n}\n\nconst FunkitColorSchemeContext = createContext<FunkitColorSchemeValue | null>(\n null,\n)\n\nexport interface FunkitThemeProviderProps {\n children: ReactNode\n /**\n * The light/dark Restyle theme set. Defaults to the built-in Fun Mobile\n * themes. Pass `{ light, dark }` from `toRestyleTheme(...)` to customize.\n */\n themes?: FunkitThemeSet\n /**\n * Force a color scheme. When provided the provider is **controlled**: it\n * always renders this scheme, ignores the system Appearance, and\n * `toggleColorScheme()` becomes a no-op. When omitted the provider is\n * **uncontrolled**: the scheme follows the system Appearance and can be\n * flipped with `toggleColorScheme()`.\n */\n colorScheme?: ColorScheme\n}\n\n/**\n * The styling layer for `@funkit/connect-rn`. Resolves the active Restyle theme\n * (selected from `themes` by color scheme), wires it into Restyle's\n * `ThemeProvider`, and exposes the scheme + a manual toggle via\n * {@link useFunkitColorScheme}.\n *\n * This is an internal-ish provider \u2014 host apps mount the user-facing\n * {@link FunkitProvider}, which passes `themes` / `colorScheme` down to this.\n */\nexport function FunkitThemeProvider({\n children,\n themes = DEFAULT_THEMES,\n colorScheme,\n}: FunkitThemeProviderProps) {\n const isControlled = colorScheme != null\n const systemScheme = useColorScheme()\n // Manual override, used only in uncontrolled mode. Sticky once set \u2014 later\n // system changes are ignored until the next toggle (matches web behavior).\n const [override, setOverride] = useState<ColorScheme | undefined>(undefined)\n\n const activeScheme = resolveColorScheme(colorScheme, override, systemScheme)\n\n const toggleColorScheme = useCallback(\n (next?: ColorScheme) => {\n if (colorScheme != null) {\n return // controlled: the host owns the scheme\n }\n setOverride((prev) => {\n if (next != null) {\n return next\n }\n const current = resolveColorScheme(undefined, prev, systemScheme)\n return current === 'dark' ? 'light' : 'dark'\n })\n },\n [colorScheme, systemScheme],\n )\n\n const theme = selectTheme(themes, activeScheme)\n\n const value = useMemo<FunkitColorSchemeValue>(\n () => ({ colorScheme: activeScheme, toggleColorScheme, isControlled }),\n [activeScheme, toggleColorScheme, isControlled],\n )\n\n return (\n <FunkitColorSchemeContext.Provider value={value}>\n <ThemeProvider theme={theme}>{children}</ThemeProvider>\n </FunkitColorSchemeContext.Provider>\n )\n}\n\n/**\n * Read the active color scheme and toggle it. Must be used within a\n * {@link FunkitProvider} (which mounts {@link FunkitThemeProvider}).\n * `toggleColorScheme` is a no-op when the provider is in controlled mode (a\n * `colorScheme` prop was passed).\n */\nexport function useFunkitColorScheme(): FunkitColorSchemeValue {\n const value = useContext(FunkitColorSchemeContext)\n if (value == null) {\n throw new Error('useFunkitColorScheme must be used within <FunkitProvider>')\n }\n return value\n}\n", "import { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { type ReactNode, useEffect, useMemo, useRef } from 'react'\nimport { SafeAreaProvider } from 'react-native-safe-area-context'\n\nimport type { BackdropBlurRenderer } from '../flow/FlowSheet'\nimport { FunkitFlowProvider } from '../flow/FunkitFlowProvider'\nimport {\n FunkitHapticsProvider,\n type HapticFeedback,\n} from '../haptics/HapticsContext'\nimport {\n type FunkitConfig,\n FunkitIdentityProvider,\n resolveFunkitIdentity,\n} from '../identity/IdentityContext'\nimport type { Locale } from '../locales/i18n'\nimport { logger } from '../logging/logger'\nimport {\n FunkitThemeProvider,\n type FunkitThemeProviderProps,\n} from '../theme/FunkitThemeProvider'\nimport type { ClipboardReader, ClipboardWriter } from '../transfer/clipboard'\nimport { CONNECT_RN_VERSION } from '../version'\nimport { FunkitI18nProvider } from './FunkitI18nProvider'\nimport { FunkitStatsigProvider } from './FunkitStatsigProvider'\n\nexport interface FunkitProviderProps {\n children: ReactNode\n /**\n * Identity config \u2014 `apiKey` (+ optional `externalUserId`). Mirrors the\n * identity-relevant subset of the web SDK's `funkitConfig`. Required for the\n * SDK to generate deposit addresses; when omitted, the deposit flow falls\n * back to any host-supplied `depositAddress` on the flow config.\n */\n config?: FunkitConfig\n /**\n * The connected wallet address (default transfer recipient). On web this\n * comes from wagmi; RN has no wallet provider, so the host passes it here.\n */\n walletAddress?: string\n /**\n * React Query client. Web requires the host to supply one; for single-provider\n * RN ergonomics we default to an internally-created client when omitted (pass\n * your own to share a cache with the rest of the app).\n */\n queryClient?: QueryClient\n /**\n * Light/dark Restyle theme set. Defaults to the built-in Fun Mobile themes.\n * Forwarded to {@link FunkitThemeProvider}.\n */\n themes?: FunkitThemeProviderProps['themes']\n /**\n * Optional forced color scheme. When set, the scheme is controlled (system\n * Appearance ignored, `toggleColorScheme()` disabled); when omitted it\n * follows the system Appearance and is toggleable. Forwarded to\n * {@link FunkitThemeProvider}.\n */\n colorScheme?: FunkitThemeProviderProps['colorScheme']\n /**\n * Run Statsig in development mode (dev environment tier + verbose logging).\n * Mirrors `@funkit/connect`'s `debug`.\n */\n debug?: boolean\n /**\n * UI language for the SDK's own copy (defaults to English). Mirrors\n * `@funkit/connect`'s `locale`.\n */\n locale?: Locale\n /**\n * Clipboard write used by the deposit flow's \"Copy address\" buttons. Defaults\n * to the bare-RN `@react-native-clipboard/clipboard` peer (lazily loaded).\n * Inject your own to use a different module \u2014 e.g. pass `setStringAsync` from\n * `expo-clipboard` when running in **Expo Go**, where the native module isn't\n * linked. Return the write's success to drive the \"Copied!\" confirmation; a\n * `void` return is treated as success.\n */\n copyToClipboard?: ClipboardWriter\n /**\n * Clipboard read behind the withdrawal's \"Paste\" button. Defaults to the same\n * bare-RN peer as {@link FunkitProviderProps.copyToClipboard} \u2014 inject your own\n * (e.g. `getStringAsync` from `expo-clipboard`) where that module isn't linked.\n */\n pasteFromClipboard?: ClipboardReader\n /**\n * Blur behind the flow sheet's scrim. The SDK ships the scrim only (no native\n * blur dependency), so pass your own blur view \u2014 e.g.\n * `() => <BlurView style={StyleSheet.absoluteFill} />` \u2014 to complete the\n * design's blurred backdrop.\n */\n renderBackdropBlur?: BackdropBlurRenderer\n /**\n * Tactile tap for the withdrawal keypad. Omitted, the SDK taps through the\n * optional `react-native-haptic-feedback` peer when it is installed, and\n * stays silent when it isn't. Pass your own to use another module \u2014\n * `expo-haptics` in Expo Go, which links only Expo's own \u2014 or a no-op for\n * silence.\n */\n hapticFeedback?: HapticFeedback\n}\n\n// Sentinel identity used when the host mounts the provider without a `config`.\n// `'0x'` userId/address disables the transfer query (getCheckoutTokenTransferParams\n// returns undefined), so the flow shows its fallback rather than firing a bad\n// request.\nconst ANONYMOUS_CONFIG: FunkitConfig = { apiKey: '' }\n\n// Metro's debug-build global; `typeof`-probed so non-RN runtimes (tests, SSR)\n// resolve to false. Declared locally \u2014 this tsconfig loads only node types.\ndeclare const __DEV__: boolean | undefined\nconst IS_DEV_BUILD = typeof __DEV__ !== 'undefined' && !!__DEV__\n\n// Conservative default for the internally-created fallback client. Stock\n// react-query staleTime of 0 marks data stale immediately, so every remount\n// refetches and needlessly hits the API on mobile; a 60s floor stops that.\n// Retry is intentionally left at the react-query default \u2014 lowering it would\n// weaken flaky-network resilience (the case this SDK most needs to survive) and\n// can make the geo-compliance lookup fail closed. Hooks that need fresher or\n// staler data set their own staleTime.\nfunction createFallbackQueryClient(): QueryClient {\n return new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60_000,\n },\n },\n })\n}\n\n/**\n * Top-level, user-facing provider for `@funkit/connect-rn` \u2014 the single\n * provider host apps mount around their tree.\n *\n * Composes the platform halves, mirroring the web `FunkitProvider` nesting\n * (Statsig flags \u2192 React Query \u2192 identity \u2192 theme \u2192 i18n \u2192 the managed flow). Statsig\n * stays outermost so flags are available everywhere; the deposit-flow query\n * hooks below it read identity from {@link FunkitIdentityProvider} and run on\n * the {@link QueryClientProvider}. Host integration stays a single\n * `<FunkitProvider>`.\n */\nexport function FunkitProvider({\n children,\n config,\n walletAddress,\n queryClient,\n themes,\n colorScheme,\n debug = IS_DEV_BUILD,\n locale,\n copyToClipboard,\n pasteFromClipboard,\n renderBackdropBlur,\n hapticFeedback,\n}: FunkitProviderProps) {\n // Stable default client when the host doesn't supply one.\n const fallbackClient = useRef<QueryClient>(undefined)\n fallbackClient.current ??= createFallbackQueryClient()\n const client = queryClient ?? fallbackClient.current\n\n const identity = useMemo(\n () => resolveFunkitIdentity(config ?? ANONYMOUS_CONFIG, walletAddress),\n [config, walletAddress],\n )\n\n // Configure the Datadog logger once the apiKey is known. Without this the\n // FunLogger stays unconfigured, queues every record, and never emits to the\n // transport. Mirrors the web FunkitProvider. Only configure when an apiKey is\n // present \u2014 configuring with none makes every log a console \"apiKey not set\"\n // error, and there's nothing to ship to Datadog anyway.\n useEffect(() => {\n if (!config?.apiKey) {\n return\n }\n logger.configure(config.apiKey, debug, CONNECT_RN_VERSION)\n }, [config?.apiKey, debug])\n\n // Attach user context to every log (no apiKey required).\n useEffect(() => {\n logger.setUserInfo(\n identity.userId,\n identity.walletAddress,\n '',\n identity.loginType ?? '',\n '',\n )\n }, [identity])\n\n return (\n <SafeAreaProvider>\n <FunkitStatsigProvider\n apiKey={identity.apiKey}\n userId={identity.userId}\n isDevelopment={debug}\n >\n <QueryClientProvider client={client}>\n <FunkitIdentityProvider identity={identity}>\n <FunkitThemeProvider themes={themes} colorScheme={colorScheme}>\n <FunkitI18nProvider locale={locale}>\n <FunkitHapticsProvider hapticFeedback={hapticFeedback}>\n <FunkitFlowProvider\n copyToClipboard={copyToClipboard}\n pasteFromClipboard={pasteFromClipboard}\n renderBackdropBlur={renderBackdropBlur}\n >\n {children}\n </FunkitFlowProvider>\n </FunkitHapticsProvider>\n </FunkitI18nProvider>\n </FunkitThemeProvider>\n </FunkitIdentityProvider>\n </QueryClientProvider>\n </FunkitStatsigProvider>\n </SafeAreaProvider>\n )\n}\n", "import {\n type ReactNode,\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from 'react'\nimport { View, type ViewStyle } from 'react-native'\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\nimport {\n type ClipboardReader,\n type ClipboardWriter,\n copyToClipboard as defaultCopyToClipboard,\n pasteFromClipboard as defaultPasteFromClipboard,\n guardClipboardReader,\n} from '../transfer/clipboard'\nimport { FlowContent } from './DepositFlowContent'\nimport type {\n DepositFlowCallbacks,\n DepositFlowConfig,\n} from './depositFlowConfig'\nimport { type BackdropBlurRenderer, FlowSheet } from './FlowSheet'\nimport { guardHostCallbacks } from './guardHostCallbacks'\nimport { useCopiedToast } from './useCopiedToast'\nimport { WithdrawalFlowContent } from './WithdrawalFlowContent'\nimport type {\n WithdrawalFlowCallbacks,\n WithdrawalFlowConfig,\n} from './withdrawalFlowConfig'\n\nexport type FlowScreen =\n | 'addMoney'\n | 'transfer'\n | 'swapped'\n | 'withdrawMethod'\n | 'withdrawAmount'\n | 'withdrawAddress'\n | 'withdrawReceiveToken'\n | 'withdrawComplete'\n\n/**\n * The open flow's mode + its config/callbacks, as a discriminated union so\n * deposit and withdrawal state can't cross-contaminate (a `beginDeposit` after\n * a withdrawal fully replaces the slot, and vice versa).\n */\ntype ActiveFlow =\n | {\n mode: 'deposit'\n config: DepositFlowConfig\n callbacks: DepositFlowCallbacks\n }\n | {\n mode: 'withdrawal'\n config: WithdrawalFlowConfig\n callbacks: WithdrawalFlowCallbacks\n }\n\ninterface FlowState {\n isOpen: boolean\n stack: FlowScreen[]\n flow: ActiveFlow | null\n /**\n * Bumped on every `begin*`. The sheet keys its present on this, so a new\n * session opened while a previous one is mid-dismiss re-presents (cancelling\n * the stale dismiss) instead of letting the late `onDismiss` close it.\n */\n session: number\n}\n\nconst CRYPTO_WITHDRAWAL_STEPS = new Set<FlowScreen>([\n 'withdrawAmount',\n 'withdrawAddress',\n 'withdrawReceiveToken',\n 'withdrawComplete',\n])\n\nconst CLOSED: FlowState = {\n isOpen: false,\n stack: [],\n flow: null,\n session: 0,\n}\n\ninterface FunkitFlowContextValue {\n /** Open the managed deposit flow at the Add money screen. */\n beginDeposit: (\n config: DepositFlowConfig,\n callbacks?: DepositFlowCallbacks,\n ) => void\n /** Open the managed withdrawal flow at the payout-method screen. */\n beginWithdrawal: (\n config: WithdrawalFlowConfig,\n callbacks?: WithdrawalFlowCallbacks,\n ) => void\n /** Close the flow. */\n closeFlow: () => void\n}\n\nconst FunkitFlowContext = createContext<FunkitFlowContextValue | null>(null)\n\nexport interface FlowNav {\n navigate: (s: FlowScreen) => void\n back: () => void\n /** Replace the whole stack with a single screen (never closes the sheet). */\n reset: (s: FlowScreen) => void\n /**\n * Pop back to `s`, however many screens deep it is \u2014 what `back` can't do once\n * a step lands between two that navigate to each other. A no-op when `s` isn't\n * on the stack.\n */\n popTo: (s: FlowScreen) => void\n closeFlow: () => void\n}\n\n/**\n * Mounts the managed deposit-flow modal and exposes `beginDeposit` to\n * {@link useFunkitCheckout}. The five screens are rendered + navigated here\n * (host apps never render them directly), mirroring how `@funkit/connect`'s\n * `FunkitProvider` owns the checkout modal.\n */\nexport function FunkitFlowProvider({\n children,\n copyToClipboard = defaultCopyToClipboard,\n pasteFromClipboard = defaultPasteFromClipboard,\n renderBackdropBlur,\n}: {\n children: ReactNode\n /** Host clipboard override; defaults to the bare-RN clipboard peer. */\n copyToClipboard?: ClipboardWriter\n /** Host clipboard-read override; defaults to the bare-RN clipboard peer. */\n pasteFromClipboard?: ClipboardReader\n /** Host blur under the sheet's scrim. See {@link BackdropBlurRenderer}. */\n renderBackdropBlur?: BackdropBlurRenderer\n}) {\n const [state, setState] = useState<FlowState>(CLOSED)\n const { hideCryptoDeposit } = useFunkitIdentity()\n\n // Guarded here for the same reason as the callbacks below. The write isn't:\n // its `void` return means success, so a swallowed failure would read as one\n // (see useCopyDepositAddress, which guards it where the result is compared).\n const readClipboard = useMemo(\n () => guardClipboardReader(pasteFromClipboard),\n [pasteFromClipboard],\n )\n\n // The two doors host callbacks come in through: guarded here, so everything\n // downstream reads them off flow state already wrapped.\n const beginDeposit = useCallback(\n (config: DepositFlowConfig, hostCallbacks: DepositFlowCallbacks = {}) => {\n // Provider-level funding-option decisions ride along with the config.\n logger.info('beginDeposit', { ...config, hideCryptoDeposit })\n const callbacks = guardHostCallbacks(hostCallbacks)\n callbacks.onOpen?.()\n setState((prev) => ({\n isOpen: true,\n stack: ['addMoney'],\n flow: { mode: 'deposit', config, callbacks },\n session: prev.session + 1,\n }))\n },\n [hideCryptoDeposit],\n )\n\n const beginWithdrawal = useCallback(\n (\n config: WithdrawalFlowConfig,\n hostCallbacks: WithdrawalFlowCallbacks = {},\n ) => {\n logger.info('beginWithdrawal', config)\n const callbacks = guardHostCallbacks(hostCallbacks)\n callbacks.onOpen?.()\n setState((prev) => ({\n isOpen: true,\n stack: ['withdrawMethod'],\n flow: { mode: 'withdrawal', config, callbacks },\n session: prev.session + 1,\n }))\n },\n [],\n )\n\n const { toast, showCopiedToast, clearToast } = useCopiedToast()\n\n const closeFlow = useCallback(() => {\n setState((prev) => {\n // Idempotent: fire onClose only on the open\u2192closed transition. The gorhom\n // sheet's dismiss animation re-invokes this (via onDismiss) after the host\n // has already closed, so a guard keeps onClose firing exactly once.\n if (!prev.isOpen) {\n return prev\n }\n prev.flow?.callbacks.onClose?.()\n return CLOSED\n })\n clearToast()\n }, [clearToast])\n\n const navigate = useCallback((screen: FlowScreen) => {\n setState((prev) => ({ ...prev, stack: [...prev.stack, screen] }))\n }, [])\n\n const reset = useCallback((screen: FlowScreen) => {\n setState((prev) => (prev.isOpen ? { ...prev, stack: [screen] } : prev))\n }, [])\n\n const popTo = useCallback((screen: FlowScreen) => {\n setState((prev) => {\n const index = prev.stack.lastIndexOf(screen)\n if (!prev.isOpen || index < 0) {\n return prev\n }\n return { ...prev, stack: prev.stack.slice(0, index + 1) }\n })\n }, [])\n\n const back = useCallback(() => {\n setState((prev) => {\n if (!prev.isOpen) {\n return prev\n }\n if (prev.stack.length <= 1) {\n prev.flow?.callbacks.onClose?.()\n return CLOSED\n }\n return { ...prev, stack: prev.stack.slice(0, -1) }\n })\n }, [])\n\n const value = useMemo<FunkitFlowContextValue>(\n () => ({ beginDeposit, beginWithdrawal, closeFlow }),\n [beginDeposit, beginWithdrawal, closeFlow],\n )\n\n const current = state.stack[state.stack.length - 1]\n // Each flow's home screen is its stack root (Add money / payout methods) \u2014\n // they only ever appear at depth 0.\n const isHomeScreen = state.stack.length <= 1\n const isCryptoWithdrawalStep =\n !!current && CRYPTO_WITHDRAWAL_STEPS.has(current)\n const nav = useMemo<FlowNav>(\n () => ({ navigate, back, reset, popTo, closeFlow }),\n [navigate, back, reset, popTo, closeFlow],\n )\n\n return (\n <FunkitFlowContext.Provider value={value}>\n <View style={rootContainer}>\n {/* FlowSheet wraps the host app (children) so the gorhom path's portal\n host spans the full screen; the flow screens render as `content`. */}\n <FlowSheet\n isOpen={state.isOpen}\n session={state.session}\n onClose={closeFlow}\n // The Swapped embed focuses an input inside its WebView, which gorhom\n // can't see; the rail's own screens are a full window and pad their own\n // footer. See useKeyboardHeight.\n keyboardAvoidEnabled={current === 'swapped'}\n // Transfer opts in (swiping it exits the flow); other pushed screens \u2014\n // especially the Swapped embed mid-payment \u2014 must not be dismissable.\n // The outcome opts in too: the funds have already moved, and while it\n // settles the design's button is a spinner, so a swipe is the only way\n // out of a poll that never comes back.\n enableSwipeToDismiss={\n isHomeScreen ||\n current === 'transfer' ||\n current === 'withdrawComplete'\n }\n // See {@link CRYPTO_WITHDRAWAL_STEPS}.\n fullHeight={isCryptoWithdrawalStep}\n renderBackdropBlur={renderBackdropBlur}\n content={\n // Mounted only while open so the flow queries run only then.\n state.isOpen && state.flow ? (\n state.flow.mode === 'deposit' ? (\n <FlowContent\n config={state.flow.config}\n current={current}\n nav={nav}\n copyToClipboard={copyToClipboard}\n onCopySuccess={showCopiedToast}\n callbacks={state.flow.callbacks}\n />\n ) : (\n <WithdrawalFlowContent\n config={state.flow.config}\n callbacks={state.flow.callbacks}\n current={current}\n nav={nav}\n pasteFromClipboard={readClipboard}\n />\n )\n ) : null\n }\n >\n {children}\n </FlowSheet>\n {/* A later sibling of FlowSheet: later siblings sit on top in RN, so\n the toast floats above the gorhom sheet without a <Modal> (which\n would block all touches for its entire lifetime). */}\n {toast}\n </View>\n </FunkitFlowContext.Provider>\n )\n}\n\nconst rootContainer: ViewStyle = { flex: 1 }\n\nexport function useFunkitFlow(): FunkitFlowContextValue {\n const value = useContext(FunkitFlowContext)\n if (value == null) {\n throw new Error('useFunkitFlow must be used within <FunkitProvider>')\n }\n return value\n}\n", "import { logger } from '../logging/logger'\n\n/**\n * A clipboard write the host can inject via `FunkitProvider`'s `copyToClipboard`\n * to use their own clipboard module \u2014 e.g. `expo-clipboard` in Expo Go, where\n * the bare-RN native module isn't linked. Given the address text; returns\n * whether the write succeeded (a `void` return is treated as success).\n */\nexport type ClipboardWriter = (value: string) => void | Promise<boolean>\n\n/**\n * Default clipboard: lazily (dynamic import) loads the bare-RN\n * `@react-native-clipboard/clipboard` peer and writes via `setString`.\n *\n * The import is dynamic + guarded so the native module is only **evaluated when\n * a copy actually happens** \u2014 not at startup. A host that hasn't linked it\n * (e.g. Expo Go, where `getEnforcing('RNCClipboard')` would throw) should inject\n * its own writer through `FunkitProvider`'s `copyToClipboard`; that override\n * runs instead, so this path \u2014 and the throw \u2014 never execute. If the module is\n * absent and no override is provided, the copy degrades to a no-op + warning\n * instead of crashing.\n *\n * Returns whether the copy succeeded.\n */\nexport async function copyToClipboard(value: string): Promise<boolean> {\n try {\n const { default: Clipboard } =\n await import('@react-native-clipboard/clipboard')\n Clipboard.setString(value)\n return true\n } catch (error) {\n logger.warn(\n 'connect-rn: clipboard write failed; address not copied. Inject ' +\n 'FunkitProvider `copyToClipboard` to use your own clipboard module ' +\n '(e.g. expo-clipboard in Expo Go).',\n { error: error instanceof Error ? error.message : String(error) },\n )\n return false\n }\n}\n\n/**\n * A clipboard read the host can inject via `FunkitProvider`'s\n * `pasteFromClipboard`, for the same reason as {@link ClipboardWriter}: the\n * bare-RN native module isn't linked everywhere. Returns the clipboard's text,\n * or `undefined` when it can't be read.\n */\nexport type ClipboardReader = () =>\n | string\n | undefined\n | Promise<string | undefined>\n\n/** A {@link ClipboardReader} that resolves to `undefined` instead of rejecting. */\nexport type SafeClipboardReader = () => Promise<string | undefined>\n\n/**\n * Wraps a host-injected reader where it enters the SDK, so no paste call site\n * has to defend itself. Only injected readers can fail; the default below is\n * already guarded, and the type lets a host throw as easily as reject.\n */\nexport function guardClipboardReader(\n read: ClipboardReader,\n): SafeClipboardReader {\n return async () => {\n try {\n const value = await read()\n // A host that ignores the type can resolve a non-string (e.g. the\n // `ClipboardItem[]` of `navigator.clipboard.read`), and call sites go\n // straight to `.trim()` \u2014 same unhandled rejection this guard exists for.\n if (value !== undefined && typeof value !== 'string') {\n logger.warn('connect-rn:host_callback_threw', {\n callback: 'pasteFromClipboard',\n error: `resolved ${typeof value}, expected string`,\n })\n return undefined\n }\n return value\n } catch (error) {\n logger.warn('connect-rn:host_callback_threw', {\n callback: 'pasteFromClipboard',\n error: error instanceof Error ? error.message : String(error),\n })\n return undefined\n }\n }\n}\n\n/**\n * Default clipboard read \u2014 the mirror of {@link copyToClipboard}, and dynamic for\n * the same reason: the native module is only evaluated when a paste actually\n * happens, so a host that hasn't linked it degrades to a warning instead of\n * crashing at startup.\n */\nexport async function pasteFromClipboard(): Promise<string | undefined> {\n try {\n const { default: Clipboard } =\n await import('@react-native-clipboard/clipboard')\n return await Clipboard.getString()\n } catch (error) {\n logger.warn(\n 'connect-rn: clipboard read failed; nothing pasted. Inject ' +\n 'FunkitProvider `pasteFromClipboard` to use your own clipboard module ' +\n '(e.g. expo-clipboard in Expo Go).',\n { error: error instanceof Error ? error.message : String(error) },\n )\n return undefined\n }\n}\n", "import { BottomSheetModal, BottomSheetView } from '@gorhom/bottom-sheet'\nimport { useStatsigClient } from '@statsig/react-bindings'\nimport { type ReactNode, useCallback, useEffect, useState } from 'react'\nimport { Share } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { SelectedChainRow } from '../components/SelectedChainRow'\nimport { useCheckoutBlocked } from '../geo/useCheckoutBlocked'\nimport { useNestedSheet } from '../hooks/useNestedSheet'\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { CryptoBitcoinIcon } from '../icons/CryptoBitcoinIcon'\nimport { PaymentMethodIcon } from '../icons/PaymentMethodIcon'\nimport { QrChainCluster } from '../icons/QrChainCluster'\nimport { SourceTokenCluster } from '../icons/SourceTokenCluster'\nimport { TokenChainIcon } from '../icons/TokenChainIcon'\nimport { logger } from '../logging/logger'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { CheckoutBlockedScreen } from '../screens/CheckoutBlockedScreen'\nimport { QrCodeScreen } from '../screens/QrCodeScreen'\nimport {\n ChangeChainScreen,\n SelectChainScreen,\n} from '../screens/SelectChainScreen'\nimport {\n type PaymentMethodOption,\n type ReceiveTokenOption,\n SelectMethodScreen,\n} from '../screens/SelectMethodScreen'\nimport { TransferCryptoScreen } from '../screens/TransferCryptoScreen'\nimport { useDynamicConfig } from '../statsig/useDynamicConfig'\nimport { SwappedScreen } from '../swapped/SwappedScreen'\nimport {\n type AvailableChain,\n buildAvailableChains,\n} from '../transfer/availableChains'\nimport type { ClipboardWriter } from '../transfer/clipboard'\nimport { toFopRows } from '../transfer/fops'\nimport { formatDepositAddress } from '../transfer/formatDepositAddress'\nimport { useCopyDepositAddress } from '../transfer/hooks/useCopyDepositAddress'\nimport { useFiatExchangeRates } from '../transfer/hooks/useFiatExchangeRates'\nimport { type UseFopsResult, useFops } from '../transfer/hooks/useFops'\nimport { useSupportedTokens } from '../transfer/hooks/useSupportedTokens'\nimport { useTokenTransfer } from '../transfer/hooks/useTokenTransfer'\nimport { QrCode } from '../transfer/QrCode'\nimport type {\n DepositCheckoutConfig,\n DepositFlowCallbacks,\n DepositFlowConfig,\n DynamicTargetAssetCandidate,\n} from './depositFlowConfig'\nimport { getDefaultDynamicTargetAsset } from './depositFlowConfig'\nimport { FlowSheetBackground } from './FlowSheet'\nimport { sheetSizing, useInertScrollableFocus } from './sheetSizing'\nimport type { FlowNav, FlowScreen } from './FunkitFlowProvider'\nimport {\n readSelectedChainId,\n writeSelectedChainId,\n} from './selectedChainStorage'\n\n/**\n * Screens presented as a nested sheet on top of the current FlowScreen. Adding\n * one is a member here plus a branch in {@link DepositNestedSheet}.\n */\ntype NestedScreen = 'selectChain' | 'changeChain' | 'qrCode'\n\n/** Fill the sheet instead of hugging content; a record so new screens must choose. */\nconst FULL_HEIGHT_SCREENS: Record<NestedScreen, boolean> = {\n selectChain: true,\n changeChain: true,\n qrCode: false,\n}\n\n// The synthetic id of the built-in \"Crypto\" funding row. Payment methods are\n// derived internally (not host-configured), mirroring web \u2014 the crypto row\n// routes into the Transfer screen; the rest are Swapped FOPs.\nconst CRYPTO_METHOD_ID = 'crypto'\n\n/**\n * The live flow body. Drives the deposit-address + QR generation\n * ({@link useTokenTransfer}) for the open flow and renders the active screen\n * with the resolved data. Kept separate from the provider so its\n * hooks run only while the modal is open (it isn't mounted when closed).\n */\nexport function FlowContent({\n config,\n current,\n nav,\n copyToClipboard,\n onCopySuccess,\n callbacks,\n}: {\n config: DepositFlowConfig\n current: FlowScreen | undefined\n nav: FlowNav\n copyToClipboard: ClipboardWriter\n onCopySuccess: () => void\n callbacks: DepositFlowCallbacks\n}): ReactNode {\n const { t } = useFunkitTranslation()\n const insets = useSafeAreaInsets()\n const { userId, hideCryptoDeposit } = useFunkitIdentity()\n const { isGeoblocked, isLoadingGeoCheck } = useCheckoutBlocked({\n onCheckoutBlocked: callbacks.onCheckoutBlocked,\n })\n\n const { selectedChainId, rememberChainId } = useRememberedChain(userId)\n const targetAsset = useDepositTargetAsset(config)\n const {\n depositAddress: generatedAddress,\n qrCodeUri,\n transferInit,\n isLoading: isAddressLoading,\n } = useTokenTransfer({\n checkoutConfig: targetAsset.activeCheckoutConfig,\n selectedChainId: selectedChainId ? Number(selectedChainId) : undefined,\n dynamicRoutingId: targetAsset.activeDynamicRoutingId,\n enabled: true,\n })\n\n // Curated deposit chains, fetched + resolved from the Statsig\n // `tokentransferconfig` (host config can override). `transferInit` gates\n // Solana/Bitcoin/Tron until their deposit address exists. The chain list\n // drives the \"Available chains\" screen.\n const fetched = useSupportedTokens({ transferInit })\n const tokenChainFilters = config.tokenChainFilters ?? fetched.chainFilters\n // Until the fetch settles there are no chains, so the Crypto row's trailing\n // logo cluster would render empty and pop in after. Only wait when the list\n // is actually being fetched (a host-supplied one is ready immediately).\n const isChainListLoading = !config.tokenChainFilters && fetched.isLoading\n\n // Per-chain minimum transfer values (Statsig), mirroring web's TransferToken.\n const minTransferLimits = useDynamicConfig('mintokentransfervalue')\n\n // Swapped forms of payment (Card / Apple Pay / Revolut Pay / Bank Transfer),\n // fetched the same way web does (minus geo). Mobile has no Crypto/Cash tabs \u2014\n // these are merged into the single Add money list (saved FOPs on top, then\n // Crypto, then the rest), so `isSwappedEnabled` just decides whether the cash\n // methods are present.\n const fops = useFops({\n checkoutConfig: targetAsset.activeCheckoutConfig,\n dynamicRoutingId: targetAsset.activeDynamicRoutingId,\n })\n\n // Statsig readiness gates the Add money skeleton: until it resolves,\n // `isSwappedEnabled` reads its `false` fallback (see `isAddMoneyLoading`).\n const { isLoading: isStatsigLoading } = useStatsigClient()\n\n // The embedded-flow URL of the cash method the user picked (drives the\n // Swapped WebView screen).\n const [selectedSwappedUrl, setSelectedSwappedUrl] = useState<string>()\n\n const minDepositTarget = {\n targetChain: targetAsset.activeCheckoutConfig?.targetChain,\n targetAsset: targetAsset.activeCheckoutConfig?.targetAsset,\n dynamicRoutingId: targetAsset.activeDynamicRoutingId,\n getMinDepositUSD: config.checkoutConfig?.getMinDepositUSD,\n }\n\n // The pickers list EVM and non-EVM chains together, so no network filter.\n const allChains = buildAvailableChains({\n t,\n chainFilters: tokenChainFilters,\n minTransferLimits,\n target: minDepositTarget,\n })\n\n const selectedChain = allChains.find((chain) => chain.id === selectedChainId)\n\n // Transfer can't render without a chain, so head back to Add money \u2014 the\n // Crypto row reads the same value and reopens the picker.\n useEffect(() => {\n if (current === 'transfer' && allChains.length && !selectedChain) {\n nav.back()\n }\n }, [current, allChains.length, selectedChain, nav])\n\n const selectChain = (chain: AvailableChain) => {\n // Source-chain decision point: drives the deposit address + QR generation.\n logger.info('connect-rn:deposit:chain_selected', {\n chainId: chain.id,\n chainName: chain.name,\n })\n rememberChainId(chain.id)\n }\n\n // Prefer the generated address; fall back to a host-supplied one while it\n // loads or when no identity is configured.\n const rawAddress = generatedAddress ?? config.depositAddress\n const displayAddress = rawAddress\n ? formatDepositAddress(rawAddress)\n : t('transferCrypto.generating')\n\n const copyAddressAndToast = useCopyDepositAddress({\n copyToClipboard,\n onCopySuccess,\n isTransferOpen: current === 'transfer',\n address: rawAddress,\n })\n\n const {\n nestedSheetRef,\n nestedScreen,\n setNestedScreen,\n openNestedScreen,\n closeNestedScreen,\n renderNestedBackdrop,\n } = useNestedSheet<NestedScreen>()\n const isFullHeightScreen = !!nestedScreen && FULL_HEIGHT_SCREENS[nestedScreen]\n\n const openSwappedFlow = (embeddedFlowUrl: string) => {\n setSelectedSwappedUrl(embeddedFlowUrl)\n nav.navigate('swapped')\n }\n\n const addMoneyMethods = useAddMoneyMethods({\n allChains,\n selectedChain,\n fops,\n targetAsset,\n hideCryptoDeposit,\n nav,\n openNestedScreen,\n openSwappedFlow,\n })\n\n const screen = ((): ReactNode => {\n switch (current) {\n case 'addMoney': {\n // Every gate that changes what the list shows, so no row pops in late.\n // `isStatsigLoading` is one of them because `isSwappedEnabled` reads\n // `false` until it resolves \u2014 indistinguishable from an off gate.\n const isLoading =\n isLoadingGeoCheck ||\n isAddressLoading ||\n isStatsigLoading ||\n isChainListLoading ||\n (fops.isSwappedEnabled && fops.isLoading)\n const isFetchError = fops.isSwappedEnabled && fops.isError\n // Crypto hidden + no methods leaves nothing to pick \u2014 error, not an\n // empty sheet.\n const isEmpty = !isLoading && addMoneyMethods.methods.length === 0\n // Retry only helps while the FOPs fetch can actually run \u2014 a refetch\n // can then recover an error or reload an empty success. Swapped off,\n // or its recipient/target inputs missing, is a dead-end where a\n // refetch returns the same empty list, so omit onRetry rather than\n // loop back to this same terminal error.\n const canRetry = fops.canRefetch\n return (\n <SelectMethodScreen\n {...addMoneyMethods}\n title={t('selectMethod.title')}\n errorTitle={t('selectMethod.errorTitle')}\n errorMessage={t('selectMethod.errorMessage')}\n loading={isLoading}\n error={isFetchError || isEmpty}\n onRetry={canRetry ? fops.refetch : undefined}\n />\n )\n }\n case 'transfer':\n return selectedChain ? (\n <TransferCryptoScreen\n depositAddress={displayAddress}\n selectedChain={selectedChain}\n onBack={nav.back}\n onChangeChain={() => openNestedScreen('changeChain')}\n onShowQrCode={() => openNestedScreen('qrCode')}\n // Copy/share the FULL address (the screen only shows it truncated).\n // Clipboard is loaded lazily + guarded (see copyToClipboard) so a\n // missing native module degrades gracefully instead of crashing. The\n // toast is shown only after the write lands (see copyAddressAndToast).\n onCopyAddress={\n rawAddress\n ? () => void copyAddressAndToast(rawAddress)\n : undefined\n }\n onShareAddress={\n rawAddress\n ? () => void Share.share({ message: rawAddress })\n : undefined\n }\n />\n ) : null\n case 'swapped':\n return selectedSwappedUrl ? (\n <SwappedScreen\n url={selectedSwappedUrl}\n onBack={nav.back}\n onClose={nav.closeFlow}\n />\n ) : null\n default:\n return null\n }\n })()\n\n if (isGeoblocked) {\n return <CheckoutBlockedScreen />\n }\n\n return (\n <>\n {screen}\n <BottomSheetModal\n ref={nestedSheetRef}\n {...sheetSizing({ fullHeight: isFullHeightScreen })}\n // Same status-bar cap as FlowSheet \u2014 the chain list can grow tall.\n topInset={insets.top}\n // Every nested screen draws its own <Grabber />; `null` suppresses gorhom's.\n handleComponent={null}\n backgroundComponent={FlowSheetBackground}\n backdropComponent={renderNestedBackdrop}\n onDismiss={() => setNestedScreen(null)}\n >\n <BottomSheetView\n focusHook={isFullHeightScreen ? useInertScrollableFocus : undefined}\n >\n <DepositNestedSheet\n nestedScreen={nestedScreen}\n allChains={allChains}\n selectedChain={selectedChain}\n isChainListLoading={isChainListLoading}\n selectChain={selectChain}\n closeNestedScreen={closeNestedScreen}\n nav={nav}\n qrCode={config.qrCode}\n qrCodeUri={qrCodeUri}\n rawAddress={rawAddress}\n copyAddressAndToast={copyAddressAndToast}\n />\n </BottomSheetView>\n </BottomSheetModal>\n </>\n )\n}\n\n/** What {@link SelectMethodScreen} renders, minus its i18n strings + load state. */\ninterface AddMoneyMethods {\n methods: PaymentMethodOption[]\n receiveTokens: ReceiveTokenOption[] | undefined\n selectedReceiveTokenId: string | undefined\n onSelectReceiveToken: (id: string) => void\n onSelectMethod: (id: string) => void\n}\n\n/**\n * The Add money list \u2014 saved FOPs, the built-in Crypto row, cash FOPs \u2014 and\n * where picking a row routes to. Derivation only: the caller owns the loading\n * and error gates, since those depend on flow-wide state this hook never sees.\n */\nfunction useAddMoneyMethods({\n allChains,\n selectedChain,\n fops,\n targetAsset,\n hideCryptoDeposit,\n nav,\n openNestedScreen,\n openSwappedFlow,\n}: {\n allChains: AvailableChain[]\n /** Gates the Crypto row: with no chain yet, pick one before Transfer. */\n selectedChain: AvailableChain | undefined\n fops: UseFopsResult\n targetAsset: DepositTargetAsset\n hideCryptoDeposit: boolean\n nav: FlowNav\n openNestedScreen: (screen: NestedScreen) => void\n openSwappedFlow: (embeddedFlowUrl: string) => void\n}): AddMoneyMethods {\n const { t } = useFunkitTranslation()\n const { savedFops, genericFops, isSwappedEnabled } = fops\n const { candidates, selectedCandidate, setSelectedCandidate } = targetAsset\n\n // Only cash rows show a converted limit; skip the fetch when Swapped is off.\n const { data: exchangeRates } = useFiatExchangeRates(isSwappedEnabled)\n\n // The built-in crypto/transfer row (Figma: Add money crypto row): a\n // Bitcoin glyph leading + a trailing stack of supported source-chain\n // logos with a \"+N\" overflow. The row is derived internally (not\n // host-supplied, like web); its source icons come from the curated\n // deposit networks (deduped), not a host-passed list.\n const cryptoSourceIcons = allChains.map((c) => c.iconUri)\n const cryptoMethod: PaymentMethodOption[] = hideCryptoDeposit\n ? []\n : [\n {\n id: CRYPTO_METHOD_ID,\n title: t('selectMethod.crypto'),\n subtitle: t('selectMethod.noLimit'),\n icon: <CryptoBitcoinIcon />,\n trailing: cryptoSourceIcons.length ? (\n <SourceTokenCluster icons={cryptoSourceIcons} overflowMode=\"plus\" />\n ) : undefined,\n },\n ]\n const toCashRows = (fops: typeof savedFops): PaymentMethodOption[] =>\n toFopRows(t, fops, exchangeRates).map((row, i) => ({\n id: row.id,\n title: row.name,\n subtitle: row.subtitle,\n icon: <PaymentMethodIcon fop={fops[i]} />,\n }))\n // Single flat list (no tabs on mobile): saved FOPs on top, then the\n // Crypto row, then the generic cash FOPs \u2014 matching the Figma order. When\n // Swapped is off there are no FOPs, so it's just the host's methods.\n const methods: PaymentMethodOption[] = isSwappedEnabled\n ? [...toCashRows(savedFops), ...cryptoMethod, ...toCashRows(genericFops)]\n : cryptoMethod\n // Receive-token dropdown options. Keyed by array index \u2014 the only handle\n // guaranteed unique + stable across candidates, since `tokenSymbol` can\n // repeat (USDG with Perps/Spot `badgeText`) and `dynamicRoutingId` can be\n // absent. Selecting one rebinds the target asset (see\n // {@link useDepositTargetAsset}).\n const receiveTokens: ReceiveTokenOption[] | undefined = candidates?.map(\n (c, i) => ({\n id: String(i),\n label: c.badgeText ? `${c.tokenSymbol} (${c.badgeText})` : c.tokenSymbol,\n icon: <TokenChainIcon symbol={c.tokenSymbol} iconSrc={c.iconSrc} />,\n }),\n )\n const selectedReceiveTokenId =\n selectedCandidate && candidates\n ? String(candidates.indexOf(selectedCandidate))\n : undefined\n\n return {\n methods,\n receiveTokens,\n selectedReceiveTokenId,\n onSelectReceiveToken: (id) => {\n const picked = candidates?.[Number(id)]\n if (picked) {\n setSelectedCandidate(picked)\n }\n },\n onSelectMethod: (id) => {\n if (id === CRYPTO_METHOD_ID) {\n // First deposit picks a chain first, so the address + QR are\n // generated for one the user chose; after that, straight through.\n if (selectedChain == null) {\n openNestedScreen('selectChain')\n return\n }\n nav.navigate('transfer')\n return\n }\n // FOP rows use a `<fopType>:<name>` id (see `toFopRows`). Open the\n // selected method's Swapped embedded flow in the WebView screen.\n if (id.includes(':')) {\n const fop = [...savedFops, ...genericFops].find(\n (f) => `${f.fopType}:${f.name}` === id,\n )\n if (fop?.embeddedFlowUrl) {\n openSwappedFlow(fop.embeddedFlowUrl)\n }\n return\n }\n // TODO(connect-rn): other host methods route to their own flows\n // once those land.\n },\n }\n}\n\n/**\n * Content of the overlay sheet on top of the current deposit screen. Every\n * branch overlays rather than pushes, so Add money stays the stack root and\n * Transfer's back button returns there instead of to a picker.\n */\nfunction DepositNestedSheet({\n nestedScreen,\n allChains,\n selectedChain,\n isChainListLoading,\n selectChain,\n closeNestedScreen,\n nav,\n qrCode,\n qrCodeUri,\n rawAddress,\n copyAddressAndToast,\n}: {\n nestedScreen: NestedScreen | null\n allChains: AvailableChain[]\n selectedChain: AvailableChain | undefined\n isChainListLoading: boolean\n selectChain: (chain: AvailableChain) => void\n closeNestedScreen: () => void\n nav: FlowNav\n /** Host-supplied QR override; falls back to one rendered from `qrCodeUri`. */\n qrCode: ReactNode\n qrCodeUri: string | undefined\n rawAddress: string | undefined\n copyAddressAndToast: (value: string) => Promise<boolean>\n}): ReactNode {\n switch (nestedScreen) {\n case 'selectChain':\n return (\n <SelectChainScreen\n chains={allChains}\n selectedChain={selectedChain}\n loading={isChainListLoading}\n onBack={closeNestedScreen}\n onSelectChain={(chain) => {\n selectChain(chain)\n closeNestedScreen()\n nav.navigate('transfer')\n }}\n />\n )\n case 'changeChain':\n return (\n <ChangeChainScreen\n chains={allChains}\n selectedChain={selectedChain}\n onCancel={closeNestedScreen}\n onSelectChain={(chain) => {\n selectChain(chain)\n closeNestedScreen()\n }}\n />\n )\n case 'qrCode':\n return (\n <QrCodeScreen\n qrCode={\n qrCode ??\n (qrCodeUri ? <QrCode value={qrCodeUri} size={235} /> : null)\n }\n // Selected network's logos overlaid on the QR center (single network \u2192\n // one logo; multi-chain \u2192 a 2\u00D72 grid).\n centerIcon={\n <QrChainCluster\n iconKeys={selectedChain ? [selectedChain.iconUri] : []}\n />\n }\n // The full (untruncated) address; omitted while it's still\n // generating (the QR screen hides the address block until then).\n address={rawAddress}\n // Returns the copy's success so the screen only confirms \"Copied!\"\n // when the write actually landed (copyToClipboard is warn-only on\n // failure). Clipboard is loaded lazily + guarded (see copyToClipboard)\n // so a missing native module degrades gracefully instead of crashing.\n // The \"Address copied\" toast is also shown only on a successful write\n // (see copyAddressAndToast).\n onCopyAddress={\n rawAddress ? () => copyAddressAndToast(rawAddress) : undefined\n }\n onClose={closeNestedScreen}\n />\n )\n default:\n return null\n }\n}\n\ninterface DepositTargetAsset {\n /** The receive-token dropdown's options, in config order. */\n candidates: DynamicTargetAssetCandidate[] | undefined\n selectedCandidate: DynamicTargetAssetCandidate | undefined\n setSelectedCandidate: (candidate: DynamicTargetAssetCandidate) => void\n activeCheckoutConfig: DepositCheckoutConfig | undefined\n activeDynamicRoutingId: string | undefined\n}\n\n/**\n * The target token a deposit routes to, and the receive-token candidate the\n * user picked. Selecting a candidate re-targets the deposit address + QR and\n * the `dynamicRoutingId` in lockstep.\n */\nfunction useDepositTargetAsset(config: DepositFlowConfig): DepositTargetAsset {\n // Initialised to the resolved default for the config's `dynamicRoutingId`.\n const [selectedCandidate, setSelectedCandidate] = useState(() =>\n getDefaultDynamicTargetAsset(\n config.dynamicTargetAssetCandidates,\n config.dynamicRoutingId,\n ),\n )\n\n // The candidate's chain/asset win; the routing id falls back to the config's\n // existing value (NOT cleared) when the candidate omits one.\n const activeCheckoutConfig = selectedCandidate\n ? {\n ...config.checkoutConfig,\n targetChain: selectedCandidate.tokenChainId,\n targetAsset: selectedCandidate.tokenAddress,\n }\n : config.checkoutConfig\n const activeDynamicRoutingId =\n selectedCandidate?.dynamicRoutingId ?? config.dynamicRoutingId\n\n return {\n candidates: config.dynamicTargetAssetCandidates,\n selectedCandidate,\n setSelectedCandidate,\n activeCheckoutConfig,\n activeDynamicRoutingId,\n }\n}\n\ninterface RememberedChain {\n selectedChainId: string | undefined\n /** Persist the pick for this identity and apply it immediately. */\n rememberChainId: (chainId: string) => void\n}\n\n/**\n * The deposit chain the user picked, remembered across launches.\n *\n * The id, not the row \u2014 the row is derived from the curated chain list, so a\n * chain disabled after it was picked stops resolving instead of going stale.\n */\nfunction useRememberedChain(userId: string): RememberedChain {\n const [selectedChainId, setSelectedChainId] = useState<string>()\n\n useEffect(() => {\n let active = true\n // The selection belongs to an identity, so drop the previous one's before\n // reading; `current ??` alone can't tell a stale pick from a fresh one.\n setSelectedChainId(undefined)\n void readSelectedChainId(userId).then((storedId) => {\n // `active` drops a read whose identity has changed; `current ??` keeps a\n // slow one from clobbering a fresh pick.\n if (active && storedId) {\n setSelectedChainId((current) => current ?? storedId)\n }\n })\n return () => {\n active = false\n }\n }, [userId])\n\n const rememberChainId = useCallback(\n (chainId: string) => {\n setSelectedChainId(chainId)\n void writeSelectedChainId(userId, chainId)\n },\n [userId],\n )\n\n return { selectedChainId, rememberChainId }\n}\n", "import { useEffect, useMemo } from 'react'\nimport { useEffectEvent } from '@funkit/connect-core'\n\nimport { useDynamicConfig } from '../statsig/useDynamicConfig'\n\nimport { isCountryBlocked } from './isCountryBlocked'\nimport { useUserIpInfo } from './useUserIpInfo'\n\ninterface UseCheckoutBlockedParams {\n onCheckoutBlocked?: () => void\n}\n\ninterface UseCheckoutBlockedResult {\n isGeoblocked: boolean\n isLoadingGeoCheck: boolean\n}\n\nexport function useCheckoutBlocked(\n params: UseCheckoutBlockedParams,\n): UseCheckoutBlockedResult {\n const { userIpInfo, isLoadingGeoCheck } = useUserIpInfo()\n const blockedCountries = useDynamicConfig('blockedcountries')\n\n const isGeoblocked = useMemo(() => {\n if (isLoadingGeoCheck) {\n return false\n }\n if (!userIpInfo) {\n return true\n }\n return isCountryBlocked(blockedCountries, userIpInfo)\n }, [blockedCountries, isLoadingGeoCheck, userIpInfo])\n\n const onCheckoutBlockedEvent = useEffectEvent(() => {\n params.onCheckoutBlocked?.()\n })\n\n useEffect(() => {\n if (isGeoblocked) {\n onCheckoutBlockedEvent()\n }\n }, [isGeoblocked])\n\n return { isGeoblocked, isLoadingGeoCheck }\n}\n", "import { logger } from '../logging/logger'\nimport type { FunkitUserIpInfo } from './useUserIpInfo'\n\nconst ALL_MATCH = '*'\n\nexport function isCountryBlocked(\n blockedList: readonly string[],\n userIpInfo: FunkitUserIpInfo,\n): boolean {\n if (!userIpInfo.alpha2) {\n logger.log('isUserBlockedForCheckout_NoIpDetected')\n return true\n }\n\n const isBlocked =\n blockedList.includes(ALL_MATCH) || blockedList.includes(userIpInfo.alpha2)\n\n logger.info('isUserBlockedForCheckoutResult', {\n isBlocked,\n blockedList,\n alpha2: userIpInfo.alpha2,\n })\n return isBlocked\n}\n", "import {\n BottomSheetBackdrop,\n type BottomSheetModal,\n} from '@gorhom/bottom-sheet'\nimport {\n type ComponentProps,\n type ReactNode,\n type RefObject,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react'\n\nexport interface NestedSheet<TScreen extends string> {\n nestedSheetRef: RefObject<BottomSheetModal | null>\n nestedScreen: TScreen | null\n setNestedScreen: (screen: TScreen | null) => void\n openNestedScreen: (screen: TScreen) => void\n closeNestedScreen: () => void\n renderNestedBackdrop: (\n props: ComponentProps<typeof BottomSheetBackdrop>,\n ) => ReactNode\n}\n\n/**\n * Which overlay screen is showing, plus the sheet handle and backdrop the\n * caller feeds to its BottomSheetModal. `TScreen` is the flow's own union of\n * overlay screen names, so each flow keeps its screens typed to its own set.\n */\nexport function useNestedSheet<TScreen extends string>(): NestedSheet<TScreen> {\n const nestedSheetRef = useRef<BottomSheetModal>(null)\n const [nestedScreen, setNestedScreen] = useState<TScreen | null>(null)\n const openNestedScreen = useCallback((screen: TScreen) => {\n setNestedScreen(screen)\n }, [])\n useEffect(() => {\n if (nestedScreen) {\n nestedSheetRef.current?.present()\n }\n }, [nestedScreen])\n const closeNestedScreen = useCallback(() => {\n nestedSheetRef.current?.dismiss()\n }, [])\n const renderNestedBackdrop = useCallback(\n (props: ComponentProps<typeof BottomSheetBackdrop>) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n pressBehavior=\"close\"\n />\n ),\n [],\n )\n return {\n nestedSheetRef,\n nestedScreen,\n setNestedScreen,\n openNestedScreen,\n closeNestedScreen,\n renderNestedBackdrop,\n }\n}\n", "import { SvgXml } from 'react-native-svg'\n\nimport { useTheme } from '../theme/restyle'\n\n// Verbatim port of web's `CircleBitcoinIcon`\n// (`packages/connect/src/components/Icons/New/CircleBitcoinIcon.tsx`) \u2014 the\n// glyph the web \"Use Crypto\" tab uses. Kept as inline SVG (rendered via\n// `SvgXml`, like FunIcon) so the package stays asset-free. `fill=\"currentColor\"`\n// is resolved by the `color` prop below, so the disc tracks the active theme's\n// text color (dark disc in light mode, light disc in dark mode) \u2014 matching web.\nconst CIRCLE_BITCOIN_SVG = `<svg viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12.9168 11.8737C12.9168 12.449 12.4505 12.9154 11.8752 12.9154H8.75016V10.832H11.8752C12.4505 10.832 12.9168 11.2984 12.9168 11.8737Z\" fill=\"currentColor\"/><path d=\"M11.4585 7.08203H8.75016V9.16536H11.4585C12.0338 9.16536 12.5002 8.69899 12.5002 8.1237C12.5002 7.5484 12.0338 7.08203 11.4585 7.08203Z\" fill=\"currentColor\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.0002 0.832031C4.93755 0.832031 0.833496 4.93609 0.833496 9.9987C0.833496 15.0613 4.93755 19.1654 10.0002 19.1654C15.0628 19.1654 19.1668 15.0613 19.1668 9.9987C19.1668 4.93609 15.0628 0.832031 10.0002 0.832031ZM8.3335 4.16536C8.79373 4.16536 9.16683 4.53846 9.16683 4.9987V5.41536H10.0002V4.9987C10.0002 4.53846 10.3733 4.16536 10.8335 4.16536C11.2937 4.16536 11.6668 4.53846 11.6668 4.9987V5.42326C13.0653 5.52964 14.1668 6.69803 14.1668 8.1237C14.1668 8.74941 13.9546 9.32557 13.5983 9.78413C14.2 10.2809 14.5835 11.0325 14.5835 11.8737C14.5835 13.3695 13.3709 14.582 11.8752 14.582H11.6668V14.9987C11.6668 15.4589 11.2937 15.832 10.8335 15.832C10.3733 15.832 10.0002 15.4589 10.0002 14.9987V14.582H9.16683V14.9987C9.16683 15.4589 8.79373 15.832 8.3335 15.832C7.87326 15.832 7.50016 15.4589 7.50016 14.9987V14.582H6.66683C6.20659 14.582 5.8335 14.2089 5.8335 13.7487C5.8335 13.2885 6.20659 12.9154 6.66683 12.9154H7.0835V7.08203H6.66683C6.20659 7.08203 5.8335 6.70894 5.8335 6.2487C5.8335 5.78846 6.20659 5.41536 6.66683 5.41536H7.50016V4.9987C7.50016 4.53846 7.87326 4.16536 8.3335 4.16536Z\" fill=\"currentColor\"/></svg>`\n\n/**\n * The \"Crypto\" funding-source glyph (Figma: Add money crypto row leading) \u2014 the\n * RN port of web's `CircleBitcoinIcon`. Renders the bitcoin disc in the theme's\n * primary text color.\n */\nexport function CryptoBitcoinIcon({ size = 28 }: { size?: number }) {\n const theme = useTheme()\n return (\n <SvgXml\n xml={CIRCLE_BITCOIN_SVG}\n width={size}\n height={size}\n color={theme.content.elements.primary}\n />\n )\n}\n", "import type { SwappedFormOfPayment } from '@funkit/api-base'\nimport { getSwappedIcon, isSavedFormOfPaymentType } from '@funkit/connect-core'\n\nimport { useFunkitColorScheme } from '../theme/FunkitThemeProvider'\nimport { FALLBACK_ASSET_LOGO } from './assetLogos'\nimport { FunIcon } from './FunIcon'\nimport {\n JcbIcon,\n MastercardIcon,\n UnionPayIcon,\n VisaIcon,\n} from './PaymentBrandIcons'\n\n// RN can't render the CDN card-brand logos (embedded-raster SVGs), so use local\n// vectors where we have them and fall back to this generic glyph otherwise.\nconst CARD_ICON = 'https://sdk-cdn.fun.xyz/images/swapped/card-payment.svg'\n\n// Local brand vectors, keyed by the normalized cardBrand (spaces\u2192_, lowercased)\n// to match SWAPPED_CARD_BRANDS. Cartes Bancaires is intentionally absent \u2014 its\n// only logo is a raster inside an SVG <pattern> RN can't draw, so it falls back\n// to the generic card glyph.\nconst BRAND_ICONS: Record<string, typeof MastercardIcon> = {\n mastercard: MastercardIcon,\n visa: VisaIcon,\n jcb: JcbIcon,\n unionpay: UnionPayIcon,\n}\n\nconst genericCardIcon = (isDarkMode: boolean) =>\n isDarkMode ? CARD_ICON.replace('.svg', '-light.svg') : CARD_ICON\n\nexport function PaymentMethodIcon({ fop }: { fop: SwappedFormOfPayment }) {\n const isDarkMode = useFunkitColorScheme().colorScheme === 'dark'\n if (isSavedFormOfPaymentType(fop)) {\n const BrandIcon =\n BRAND_ICONS[fop.cardBrand.replace(/ /g, '_').toLowerCase()]\n if (BrandIcon) {\n return <BrandIcon size={32} />\n }\n return (\n <FunIcon\n uri={genericCardIcon(isDarkMode)}\n fallbackUri={FALLBACK_ASSET_LOGO}\n />\n )\n }\n return (\n <FunIcon\n uri={getSwappedIcon(fop, isDarkMode)}\n fallbackUri={FALLBACK_ASSET_LOGO}\n />\n )\n}\n", "// Symbol \u2192 Fun CDN logo map, duplicated verbatim from `@funkit/fun-relay`\n// (`src/assets.ts`). We copy rather than import because `@funkit/fun-relay` has\n// no subpath export \u2014 importing it would pull its relay-sdk / bitcoin adapter\n// graph into the React Native bundle. This is a pure data map with no deps, so\n// the cost of duplication is low; keep it in sync with fun-relay when symbols\n// are added there.\n//\n// This is the primary symbol\u2192logo source for the deposit token list. See\n// `funIconUri.ts#tokenLogoUri` for how the transfer screen resolves icons\n// (mirrors web's `getTokenIconUrl`, NOT the wallet-assets `getAssetLogoSrc`).\nexport const ASSET_LOGO_SRCS: Record<string, string> = {\n $MFER: 'https://sdk-cdn.fun.xyz/images/mfer.png',\n AARBUSDCN: 'https://sdk-cdn.fun.xyz/images/aarbusdcn.png',\n AAVE: 'https://sdk-cdn.fun.xyz/images/aave.svg',\n AERO: 'https://sdk-cdn.fun.xyz/images/aero.svg',\n APE: 'https://sdk-cdn.fun.xyz/images/ape.svg',\n APOLWMATIC: 'https://sdk-cdn.fun.xyz/images/apolwmatic.png',\n ARB: 'https://sdk-cdn.fun.xyz/images/arb.svg',\n BEHYPE: 'https://sdk-cdn.fun.xyz/images/behype.svg',\n BENTO: 'https://sdk-cdn.fun.xyz/images/bento.png',\n BLERF: 'https://sdk-cdn.fun.xyz/images/blerf.png',\n BRETT: 'https://sdk-cdn.fun.xyz/images/brett.svg',\n BSHIB: 'https://sdk-cdn.fun.xyz/images/bshib.png',\n BTC: 'https://sdk-cdn.fun.xyz/images/btc.svg',\n CBBTC: 'https://sdk-cdn.fun.xyz/images/cbbtc.svg',\n CBETH: 'https://sdk-cdn.fun.xyz/images/cbeth.png',\n CRO: 'https://sdk-cdn.fun.xyz/images/cro.svg',\n CRV: 'https://sdk-cdn.fun.xyz/images/crv.svg',\n DAI: 'https://sdk-cdn.fun.xyz/images/dai.svg',\n DEGEN: 'https://sdk-cdn.fun.xyz/images/degen.svg',\n ETH: 'https://sdk-cdn.fun.xyz/images/eth.svg',\n GMX: 'https://sdk-cdn.fun.xyz/images/gmx.svg',\n GRT: 'https://sdk-cdn.fun.xyz/images/grt.svg',\n HYPE: 'https://sdk-cdn.fun.xyz/images/hype.svg',\n IMX: 'https://sdk-cdn.fun.xyz/images/imx.svg',\n INJ: 'https://sdk-cdn.fun.xyz/images/inj.svg',\n LDO: 'https://sdk-cdn.fun.xyz/images/ldo.svg',\n LINK: 'https://sdk-cdn.fun.xyz/images/link.png',\n LUCK: 'https://sdk-cdn.fun.xyz/images/luck.png',\n MATIC: 'https://sdk-cdn.fun.xyz/images/matic.svg',\n MFER: 'https://sdk-cdn.fun.xyz/images/mfer.png',\n MKR: 'https://sdk-cdn.fun.xyz/images/mkr.svg',\n MNT: 'https://sdk-cdn.fun.xyz/images/mnt.svg',\n OP: 'https://sdk-cdn.fun.xyz/images/optimism.svg',\n PENDLE: 'https://sdk-cdn.fun.xyz/images/pendle.svg',\n POL: 'https://sdk-cdn.fun.xyz/images/matic.svg',\n PYUSD: 'https://sdk-cdn.fun.xyz/images/pyusd.svg',\n QNT: 'https://sdk-cdn.fun.xyz/images/qnt.svg',\n RNDR: 'https://sdk-cdn.fun.xyz/images/rndr.svg',\n ROOST: 'https://sdk-cdn.fun.xyz/images/roost.png',\n SAND: 'https://sdk-cdn.fun.xyz/images/sand.svg',\n SHIB: 'https://sdk-cdn.fun.xyz/images/shib.svg',\n SNX: 'https://sdk-cdn.fun.xyz/images/snx.svg',\n SOL: 'https://sdk-cdn.fun.xyz/images/sol.svg',\n SUSDS: 'https://sdk-cdn.fun.xyz/images/susds.svg',\n TYBG: 'https://sdk-cdn.fun.xyz/images/tybg.png',\n UNI: 'https://sdk-cdn.fun.xyz/images/uni.png',\n USDC: 'https://sdk-cdn.fun.xyz/images/usdc.svg',\n 'USDC.E': 'https://sdk-cdn.fun.xyz/images/usdc.svg',\n USDBC: 'https://sdk-cdn.fun.xyz/images/usdc.svg',\n USDE: 'https://sdk-cdn.fun.xyz/images/usde.svg',\n WUSDE: 'https://sdk-cdn.fun.xyz/images/usde.svg',\n EUSDE: 'https://sdk-cdn.fun.xyz/images/eusde.svg',\n USDT: 'https://sdk-cdn.fun.xyz/images/usdt.svg',\n 'USD\u20AE0': 'https://sdk-cdn.fun.xyz/images/usdt0.svg',\n USDT0: 'https://sdk-cdn.fun.xyz/images/usdt0.svg',\n USDS: 'https://sdk-cdn.fun.xyz/images/usds.svg',\n USDH: 'https://sdk-cdn.fun.xyz/images/usdh.svg',\n VRTX: 'https://sdk-cdn.fun.xyz/images/vrtx.svg',\n WBTC: 'https://sdk-cdn.fun.xyz/images/wbtc.svg',\n WEETH: 'https://sdk-cdn.fun.xyz/images/weeth.png',\n WETH: 'https://sdk-cdn.fun.xyz/images/weth.svg',\n WHYPE: 'https://sdk-cdn.fun.xyz/images/whype.png',\n WSTETH: 'https://sdk-cdn.fun.xyz/images/wsteth.png',\n TRUMP: 'https://sdk-cdn.fun.xyz/images/trump.png',\n BNB: 'https://sdk-cdn.fun.xyz/images/bsc.svg',\n WBNB: 'https://sdk-cdn.fun.xyz/images/bsc.svg',\n BTCB: 'https://sdk-cdn.fun.xyz/images/btc.svg',\n UBTC: 'https://sdk-cdn.fun.xyz/images/btc.svg',\n BUSD: 'https://sdk-cdn.fun.xyz/images/busd.svg',\n XAUT: 'https://sdk-cdn.fun.xyz/images/xaut.png',\n ADA: 'https://sdk-cdn.fun.xyz/images/ada.svg',\n XRP: 'https://sdk-cdn.fun.xyz/images/xrp.svg',\n UDOGE: 'https://sdk-cdn.fun.xyz/images/doge.svg',\n DOGE: 'https://sdk-cdn.fun.xyz/images/doge.svg',\n LTC: 'https://sdk-cdn.fun.xyz/images/ltc.svg',\n HNT: 'https://sdk-cdn.fun.xyz/images/hnt.svg',\n COMP: 'https://sdk-cdn.fun.xyz/images/comp.svg',\n PEPE: 'https://sdk-cdn.fun.xyz/images/pepe.svg',\n LSTHYPE: 'https://sdk-cdn.fun.xyz/images/lsthype.svg',\n HBUSDT: 'https://sdk-cdn.fun.xyz/images/hbusdt.svg',\n WVLP: 'https://sdk-cdn.fun.xyz/images/wvlp.svg',\n LIQUIDHYPE: 'https://sdk-cdn.fun.xyz/images/liquidhype.svg',\n VHYPE: 'https://sdk-cdn.fun.xyz/images/vhype.png',\n HBHYPE: 'https://sdk-cdn.fun.xyz/images/hbhype.svg',\n MON: 'https://sdk-cdn.fun.xyz/images/monad.svg',\n WMON: 'https://sdk-cdn.fun.xyz/images/wmon.svg',\n AUSD: 'https://sdk-cdn.fun.xyz/images/ausd.svg',\n SUSHI: 'https://sdk-cdn.fun.xyz/images/sushi.svg',\n SKY: 'https://sdk-cdn.fun.xyz/images/sky.svg',\n LIT: 'https://sdk-cdn.fun.xyz/images/lit.svg',\n AZTEC: 'https://sdk-cdn.fun.xyz/images/aztec.svg',\n U: 'https://sdk-cdn.fun.xyz/images/u.png',\n PUSD: 'https://sdk-cdn.fun.xyz/images/pusd.svg',\n}\n\n/** Generic fallback logo when a symbol isn't in the map. */\nexport const FALLBACK_ASSET_LOGO =\n 'https://sdk-cdn.fun.xyz/images/dollar_circle.png'\n\n/**\n * Verbatim mirror of `@funkit/fun-relay`'s `getAssetLogoSrc`: resolve a token's\n * logo URL by symbol (case-insensitive), falling back to a generic dollar-circle.\n * This is web's *wallet-assets* resolver. NOTE: the deposit/transfer token list\n * does NOT use this \u2014 it uses {@link tokenLogoUri} (web's `getTokenIconUrl`),\n * which falls back to `<symbol>.svg` rather than the dollar-circle.\n */\nexport function getAssetLogoSrc(symbol: string): string {\n return ASSET_LOGO_SRCS[symbol.toUpperCase()] ?? FALLBACK_ASSET_LOGO\n}\n", "import { useEffect, useState } from 'react'\nimport { Image, type ViewStyle } from 'react-native'\nimport { SvgCss } from 'react-native-svg/css'\n\nimport { Box, useTheme } from '../theme/restyle'\n\n/**\n * Fun's CDN chain logos are inconsistent: some ship `width`/`height` with **no\n * `viewBox`** (e.g. the 28\u00D728 EVM coins \u2014 these don't scale unless we add one),\n * while others ship their own `viewBox` at a different scale/origin (e.g. Solana\n * 16\u00D716, Tron `138.8 49.5 522 500.2`). A blanket `viewBox` override therefore\n * breaks the latter \u2014 squashing Solana into a corner and pushing Tron entirely\n * off-screen. So we fetch the SVG and **synthesize a `viewBox` only when one is\n * missing** (derived from width/height), never clobbering an existing one, then\n * render with {@link SvgCss}. Results are cached per URL.\n */\nconst svgCache = new Map<string, string>()\n\nfunction ensureViewBox(svg: string): string {\n if (/\\bviewBox\\s*=/.test(svg)) {\n return svg\n }\n const width = svg.match(/\\bwidth=\"([\\d.]+)\"/)?.[1]\n const height = svg.match(/\\bheight=\"([\\d.]+)\"/)?.[1]\n if (!width || !height) {\n return svg\n }\n return svg.replace(/<svg\\b/, `<svg viewBox=\"0 0 ${width} ${height}\"`)\n}\n\n/**\n * Renders a Fun CDN icon. SVG URLs (chain logos) are fetched, viewBox-normalized\n * and drawn via `SvgCss` (RN's built-in `Image` can't render SVG); raster URLs\n * (token PNGs) go through `Image`. Clipped to a circle.\n *\n * `SvgCss` over `SvgXml` because many CDN logos style their paths only through a\n * `<style>` block, which `SvgXml` drops \u2014 leaving them to paint black.\n */\nexport interface FunIconProps {\n uri: string\n size?: number\n /**\n * Raster URL to swap in if `uri` fails to load (SVG fetch error or `<Image>`\n * `onError`). Mirrors web's `AsyncImage` `fallbackSrc` \u2014 the token list passes\n * `FALLBACK_ASSET_LOGO` (dollar-circle) so a dead CDN URL degrades to the same\n * icon web shows, rather than a blank placeholder.\n */\n fallbackUri?: string\n}\n\nexport function FunIcon({ uri, size = 32, fallbackUri }: FunIconProps) {\n // The URL we're actually rendering; on load failure we swap to `fallbackUri`\n // (once), matching web's `AsyncImage` fallback-on-error behavior.\n const [currentUri, setCurrentUri] = useState(uri)\n const isSvg = currentUri.endsWith('.svg')\n const [xml, setXml] = useState<string | null>(\n () => svgCache.get(currentUri) ?? null,\n )\n // Raster (Image) load state \u2014 drives the placeholder until the logo paints.\n const [rasterLoaded, setRasterLoaded] = useState(false)\n const theme = useTheme()\n\n // Reset when the requested icon changes (e.g. a different token row).\n useEffect(() => {\n setCurrentUri(uri)\n setRasterLoaded(false)\n setXml(svgCache.get(uri) ?? null)\n }, [uri])\n\n // Swap to the fallback once if the current URL can't be rendered.\n const onFailure = () => {\n if (fallbackUri && currentUri !== fallbackUri) {\n setCurrentUri(fallbackUri)\n setRasterLoaded(false)\n setXml(svgCache.get(fallbackUri) ?? null)\n }\n }\n\n useEffect(() => {\n if (!isSvg) {\n return\n }\n const cached = svgCache.get(currentUri)\n if (cached != null) {\n setXml(cached)\n return\n }\n let active = true\n fetch(currentUri)\n .then((res) => {\n // A 404 still resolves; its body is an error page, not SVG. Treat a\n // non-OK response as a failure so it falls back instead of rendering a\n // blank circle (e.g. a mistyped CDN chain key like `bnb` vs `bsc`).\n if (!res.ok) {\n throw new Error(`icon fetch ${res.status}`)\n }\n return res.text()\n })\n .then((text) => {\n if (!text.includes('<svg')) {\n throw new Error('icon response is not an SVG')\n }\n const normalized = ensureViewBox(text)\n svgCache.set(currentUri, normalized)\n if (active) {\n setXml(normalized)\n }\n })\n .catch(() => {\n // Fetch failed: fall back to the dollar-circle (like web) if one was\n // supplied; otherwise the placeholder fill stays visible.\n if (active) {\n onFailure()\n }\n })\n return () => {\n active = false\n }\n }, [currentUri, isSvg])\n\n // Show a neutral placeholder circle until the icon is ready \u2014 i.e. while the\n // SVG is being fetched (or its fetch failed \u2192 `xml` stays null) or while the\n // raster logo hasn't painted (or 404'd \u2192 `onLoad` never fires). Avoids the\n // bare/broken icon gap seen on slow networks or missing CDN assets.\n const ready = isSvg ? xml != null : rasterLoaded\n const clip: ViewStyle = { overflow: 'hidden' }\n return (\n <Box\n width={size}\n height={size}\n borderRadius=\"rounded\"\n style={[\n clip,\n { backgroundColor: ready ? undefined : theme.background.secondary },\n ]}\n >\n {isSvg ? (\n xml != null ? (\n <SvgCss xml={xml} width={size} height={size} />\n ) : null\n ) : (\n <Image\n source={{ uri: currentUri }}\n style={{ width: size, height: size }}\n onLoad={() => setRasterLoaded(true)}\n onError={onFailure}\n />\n )}\n </Box>\n )\n}\n", "import { SvgXml } from 'react-native-svg'\n\nimport { useTheme } from '../theme/restyle'\n\n/**\n * Payment-method brand glyphs for the \"Add money\" funding-source picker (Figma:\n * Fun Mobile / Add money, node 11202:8263). Each is a byte-for-byte SVG export\n * from that Figma frame \u2014 Mastercard keeps its brand colors; the monochrome\n * marks (Apple, Revolut, Bank, Crypto) swap their fill/stroke to the theme's\n * primary content color so they track light/dark. Host apps may pass their own\n * brand icons instead; these are the package's design-matched defaults used by\n * the stories.\n */\n\ntype BrandIconProps = {\n /** Glyph box size in px (the leading slot centers it). */\n size?: number\n /** Override the monochrome color; defaults to the theme primary. */\n color?: string\n}\n\nfunction useGlyphColor(color?: string) {\n const theme = useTheme()\n return color ?? theme.content.elements.primary\n}\n\n// Mastercard: the two interlocking circles (red / amber + overlap), drawn at the\n// Figma 24\u00D718 aspect. Brand colors are fixed (not themed).\nconst MASTERCARD_SVG =\n '<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"8.5\" cy=\"9\" r=\"7.5\" fill=\"#EB001B\"/><circle cx=\"15.5\" cy=\"9\" r=\"7.5\" fill=\"#F79E1B\"/><path d=\"M12 3.3A7.49 7.49 0 0 1 12 14.7 7.49 7.49 0 0 1 12 3.3Z\" fill=\"#FF5F00\"/></svg>'\n\n// Apple logo (Figma node 788:9641), rendered in the theme primary color.\nconst APPLE_SVG =\n '<svg width=\"11.7334\" height=\"14.4\" viewBox=\"0 0 11.7334 14.4\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M8.63605 6.48119e-06C8.66955 6.48119e-06 8.70304 6.48119e-06 8.73843 6.48119e-06C8.82059 1.01552 8.43319 1.77432 7.96236 2.32381C7.50039 2.86951 6.86777 3.39877 5.8446 3.31846C5.77635 2.31749 6.16438 1.61497 6.63457 1.06674C7.07064 0.555823 7.87009 0.101179 8.63605 6.48119e-06Z\" fill=\"currentColor\"/><path d=\"M11.7334 10.57C11.7334 10.5801 11.7334 10.589 11.7334 10.5984C11.4459 11.4698 11.0357 12.2166 10.5352 12.9096C10.0783 13.5388 9.51835 14.3854 8.51856 14.3854C7.65465 14.3854 7.08081 13.8296 6.1954 13.8145C5.25881 13.7993 4.74375 14.2792 3.88741 14.4C3.78946 14.4 3.6915 14.4 3.59544 14.4C2.96662 14.3089 2.45914 13.8107 2.08943 13.3617C0.999267 12.0351 0.156839 10.3215 0.000107765 8.12857C0.000107765 7.91357 0.000107765 7.69922 0.000107765 7.48422C0.0664656 5.91479 0.828633 4.63875 1.8417 4.02033C2.37635 3.69152 3.11134 3.4114 3.92976 3.5366C4.28051 3.59098 4.63884 3.71112 4.95293 3.83C5.25059 3.94445 5.62283 4.14743 5.97548 4.13668C6.21436 4.12972 6.45199 4.00516 6.69277 3.91726C7.39806 3.66243 8.08945 3.3703 9.00076 3.50751C10.096 3.67318 10.8733 4.16008 11.3536 4.91128C10.4271 5.50124 9.69468 6.3903 9.81981 7.90852C9.93104 9.28762 10.7324 10.0945 11.7334 10.57Z\" fill=\"currentColor\"/></svg>'\n\n// Revolut \"R\" wordmark (Figma node 823426821), theme-colored.\nconst REVOLUT_SVG =\n '<svg width=\"15.9174\" height=\"20\" viewBox=\"0 0 15.9174 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3.7156 4.90723H0V19.9531H3.7156V4.90723Z\" fill=\"currentColor\"/><path d=\"M15.4128 5.77982C15.4128 2.56881 12.7982 0 9.63303 0H0V3.21101H9.12844C10.5963 3.21101 11.789 4.3578 11.789 5.73395C11.789 6.42202 11.5596 7.11009 11.055 7.61468C10.5505 8.11927 9.90826 8.3945 9.22018 8.3945H5.6422C5.50459 8.3945 5.41284 8.48624 5.41284 8.62385V11.4679C5.41284 11.5138 5.41284 11.5596 5.45872 11.6055L11.5138 20H15.9174L9.90826 11.5596C12.9358 11.422 15.4128 8.85321 15.4128 5.77982Z\" fill=\"currentColor\"/></svg>'\n\n// Bitcoin \"B\" coin (Figma icon/system, node b8d97bb3), theme-colored.\nconst CRYPTO_SVG =\n '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M15.5 14.25C15.5 14.9404 14.9404 15.5 14.25 15.5H10.5V13H14.25C14.9404 13 15.5 13.5596 15.5 14.25Z\" fill=\"currentColor\"/><path d=\"M13.75 8.5H10.5V11H13.75C14.4404 11 15 10.4404 15 9.75C15 9.05964 14.4404 8.5 13.75 8.5Z\" fill=\"currentColor\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1ZM10 5C10.5523 5 11 5.44772 11 6V6.5H12V6C12 5.44772 12.4477 5 13 5C13.5523 5 14 5.44772 14 6V6.50947C15.6781 6.63713 17 8.03919 17 9.75C17 10.5009 16.7454 11.1922 16.3178 11.7425C17.0398 12.3386 17.5 13.2406 17.5 14.25C17.5 16.0449 16.0449 17.5 14.25 17.5H14V18C14 18.5523 13.5523 19 13 19C12.4477 19 12 18.5523 12 18V17.5H11V18C11 18.5523 10.5523 19 10 19C9.44772 19 9 18.5523 9 18V17.5H8C7.44772 17.5 7 17.0523 7 16.5C7 15.9477 7.44772 15.5 8 15.5H8.5V8.5H8C7.44772 8.5 7 8.05228 7 7.5C7 6.94772 7.44772 6.5 8 6.5H9V6C9 5.44772 9.44772 5 10 5Z\" fill=\"currentColor\"/></svg>'\n\n// Bank \"source-and-destination\" line glyph (Figma node a82cc93d), theme-colored.\nconst BANK_SVG =\n '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3 21H21M6 18V9.99998M10 18V9.99998M14 18V9.99998M18 18V9.99998M20 6.99998L12.424 2.26498C12.2702 2.16884 12.1933 2.12077 12.1108 2.10203C12.0379 2.08546 11.9621 2.08546 11.8892 2.10203C11.8067 2.12077 11.7298 2.16884 11.576 2.26498L4 6.99998H20Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\n\n// Card-brand marks below keep their fixed brand colors (like Mastercard) and\n// are byte-for-byte SVG path exports. RN can render these vectors where it\n// cannot draw the CDN logos, which embed a raster inside an SVG <pattern>.\nconst VISA_SVG =\n '<svg width=\"24\" height=\"19\" viewBox=\"0 0 24 19\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M24 0.00405757L15.7253 19H10.3255L6.25345 3.83691C6.17546 3.09873 5.70545 2.48223 5.05208 2.17398L5.03943 2.16789C3.58936 1.48244 1.90322 0.924752 0.139106 0.573914L0 0.551607L0.122245 0.00202878H8.81426C9.99877 0.00202878 10.9831 0.835522 11.1664 1.92454L11.1685 1.93671L13.3205 12.9303L18.636 0L24 0.00405757Z\" fill=\"#1B33C3\"/></svg>'\n\nconst JCB_SVG =\n '<svg width=\"24\" height=\"19\" viewBox=\"0 0 24 19\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><g clip-path=\"url(#clip0_5933_159)\"><path d=\"M23.9201 15.1208C23.9201 17.2137 22.2589 18.9179 20.2188 18.9179H0.0800781V3.8791C0.0800781 1.78623 1.7413 0.0820312 3.7814 0.0820312H23.9201V15.1208Z\" fill=\"white\"/><path d=\"M17.3625 11.264H18.8926C18.9363 11.264 19.0383 11.249 19.0821 11.249C19.3735 11.1892 19.6212 10.9201 19.6212 10.5464C19.6212 10.1876 19.3735 9.91855 19.0821 9.84381C19.0383 9.82886 18.9509 9.82886 18.8926 9.82886H17.3625V11.264Z\" fill=\"url(#paint0_linear_5933_159)\"/><path d=\"M18.7177 1.35266C17.2605 1.35266 16.0656 2.56354 16.0656 4.0734V6.89878H19.8106C19.8981 6.89878 20.0001 6.89878 20.0729 6.91373C20.9181 6.95857 21.5447 7.40705 21.5447 8.1844C21.5447 8.79731 21.1221 9.32053 20.3352 9.42517V9.45507C21.195 9.51487 21.8507 10.0082 21.8507 10.7706C21.8507 11.5928 21.1221 12.131 20.1604 12.131H16.051V17.6621H19.9418C21.399 17.6621 22.5939 16.4512 22.5939 14.9414V1.35266H18.7177Z\" fill=\"url(#paint1_linear_5933_159)\"/><path d=\"M19.4318 8.36381C19.4318 8.00504 19.1841 7.76585 18.8926 7.721C18.8635 7.721 18.7906 7.70605 18.7469 7.70605H17.3625V9.02158H18.7469C18.7906 9.02158 18.8781 9.02158 18.8926 9.00663C19.1841 8.96178 19.4318 8.72259 19.4318 8.36381Z\" fill=\"url(#paint2_linear_5933_159)\"/><path d=\"M4.0583 1.35266C2.60109 1.35266 1.40617 2.56354 1.40617 4.0734V10.7855C2.14935 11.1593 2.92168 11.3985 3.694 11.3985C4.61204 11.3985 5.10749 10.8304 5.10749 10.053V6.88383H7.38075V10.0381C7.38075 11.2639 6.63757 12.2655 4.11659 12.2655C2.58652 12.2655 1.3916 11.9217 1.3916 11.9217V17.6472H5.28236C6.73957 17.6472 7.93449 16.4363 7.93449 14.9264V1.35266H4.0583Z\" fill=\"url(#paint3_linear_5933_159)\"/><path d=\"M11.388 1.35266C9.93075 1.35266 8.73584 2.56354 8.73584 4.0734V7.63128C9.40616 7.04827 10.5719 6.67454 12.4517 6.76423C13.4572 6.80908 14.5355 7.09311 14.5355 7.09311V8.24419C13.9964 7.96016 13.3552 7.70603 12.5246 7.64623C11.0965 7.54159 10.2368 8.25914 10.2368 9.51487C10.2368 10.7855 11.0965 11.5031 12.5246 11.3835C13.3552 11.3237 13.9964 11.0546 14.5355 10.7855V11.9366C14.5355 11.9366 13.4718 12.2207 12.4517 12.2655C10.5719 12.3552 9.40616 11.9815 8.73584 11.3985V17.6771H12.6266C14.0838 17.6771 15.2787 16.4662 15.2787 14.9563V1.35266H11.388Z\" fill=\"url(#paint4_linear_5933_159)\"/></g><defs><linearGradient id=\"paint0_linear_5933_159\" x1=\"16.0632\" y1=\"10.5482\" x2=\"22.6115\" y2=\"10.5482\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#007940\"/><stop offset=\"0.2285\" stop-color=\"#00873F\"/><stop offset=\"0.7433\" stop-color=\"#40A737\"/><stop offset=\"1\" stop-color=\"#5CB531\"/></linearGradient><linearGradient id=\"paint1_linear_5933_159\" x1=\"16.063\" y1=\"9.50087\" x2=\"22.6118\" y2=\"9.50087\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#007940\"/><stop offset=\"0.2285\" stop-color=\"#00873F\"/><stop offset=\"0.7433\" stop-color=\"#40A737\"/><stop offset=\"1\" stop-color=\"#5CB531\"/></linearGradient><linearGradient id=\"paint2_linear_5933_159\" x1=\"16.063\" y1=\"8.36194\" x2=\"22.6116\" y2=\"8.36194\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#007940\"/><stop offset=\"0.2285\" stop-color=\"#00873F\"/><stop offset=\"0.7433\" stop-color=\"#40A737\"/><stop offset=\"1\" stop-color=\"#5CB531\"/></linearGradient><linearGradient id=\"paint3_linear_5933_159\" x1=\"1.40309\" y1=\"9.50086\" x2=\"8.05279\" y2=\"9.50086\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#1F286F\"/><stop offset=\"0.4751\" stop-color=\"#004E94\"/><stop offset=\"0.8261\" stop-color=\"#0066B1\"/><stop offset=\"1\" stop-color=\"#006FBC\"/></linearGradient><linearGradient id=\"paint4_linear_5933_159\" x1=\"8.69816\" y1=\"9.50086\" x2=\"15.1566\" y2=\"9.50086\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#6C2C2F\"/><stop offset=\"0.1735\" stop-color=\"#882730\"/><stop offset=\"0.5731\" stop-color=\"#BE1833\"/><stop offset=\"0.8585\" stop-color=\"#DC0436\"/><stop offset=\"1\" stop-color=\"#E60039\"/></linearGradient><clipPath id=\"clip0_5933_159\"><rect width=\"24\" height=\"19\" fill=\"white\"/></clipPath></defs></svg>'\n\nconst UNIONPAY_SVG =\n '<svg width=\"256px\" height=\"160px\" viewBox=\"0 0 256 160\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" preserveAspectRatio=\"xMidYMid\"><g><path d=\"M50.041631,0.000667563305 L113.820211,0.000667563305 C122.723127,0.000667563305 128.260438,7.25731345 126.183558,16.1897657 L96.4900715,143.675416 C94.3945365,152.576777 85.480739,159.839641 76.571605,159.839641 L12.7992433,159.839641 C3.908764,159.839641 -1.64098444,152.576777 0.435896208,143.675416 L30.1418186,16.1897657 C32.2186993,7.25731345 41.1278333,0.000667563305 50.041631,0.000667563305\" fill=\"#E21836\"></path><path d=\"M108.513283,0.000667563305 L181.857018,0.000667563305 C190.758378,0.000667563305 186.744527,7.25731345 184.650546,16.1897657 L154.961724,143.675416 C152.878625,152.576777 153.528427,159.839641 144.608411,159.839641 L71.2646775,159.839641 C62.3446615,159.839641 56.8244495,152.576777 58.919985,143.675416 L88.6072525,16.1897657 C90.715224,7.25731345 99.6057035,0.000667563305 108.513283,0.000667563305\" fill=\"#00447C\"></path><path d=\"M178.94783,0.000667563305 L242.726409,0.000667563305 C251.641762,0.000667563305 257.179074,7.25731345 255.085093,16.1897657 L225.396271,143.675416 C223.300736,152.576777 214.380719,159.839641 205.466922,159.839641 L141.717879,159.839641 C132.797863,159.839641 127.265215,152.576777 129.354532,143.675416 L159.048017,16.1897657 C161.124899,7.25731345 170.027814,0.000667563305 178.94783,0.000667563305\" fill=\"#007B84\"></path><path d=\"M66.698338,40.8561434 C60.139686,40.9229891 58.202715,40.8561434 57.5840035,40.7100156 C57.346157,41.8401744 52.920349,62.256098 52.9079125,62.273198 C51.9549725,66.403641 51.261643,69.347961 48.9064975,71.2491775 C47.5695833,72.3544635 46.0088137,72.8876745 44.1993159,72.8876745 C41.2907503,72.8876745 39.5962892,71.4434965 39.3118063,68.704377 L39.2573971,67.7638735 C39.2573971,67.7638735 40.1434913,62.231225 40.1434913,62.200134 C40.1434913,62.200134 44.7884909,43.5952629 45.6201759,41.1359627 C45.6637033,40.9960531 45.6761397,40.9229891 45.6870215,40.8561434 C36.6457507,40.9354255 35.0430082,40.8561434 34.9326351,40.7100156 C34.8720075,40.9105527 34.6481522,42.0640298 34.6481522,42.0640298 L29.9052159,63.0333735 L29.4979234,64.8117805 L28.7097659,70.6289115 C28.7097659,72.3544635 29.0486581,73.762887 29.7233334,74.9536735 C31.8841598,78.729679 38.0479561,79.2955355 41.5348148,79.2955355 C46.0274683,79.2955355 50.241857,78.341041 53.089795,76.598389 C58.0332685,73.677387 59.3266555,69.1116695 60.4801325,65.0542905 L61.014898,62.972746 C61.014898,62.972746 65.7998075,43.6496723 66.6128375,41.1359627 C66.643929,40.9960531 66.656365,40.9229891 66.698338,40.8561434 Z M82.9786885,56.444252 C81.825211,56.444252 79.7172395,56.724071 77.823796,57.6521385 C77.1366845,58.0050215 76.486882,58.412314 75.8013245,58.818052 L76.420036,56.5841615 L76.081144,56.20796 C72.0657375,57.0209905 71.167207,57.129809 67.4580475,57.6521385 L67.147137,57.8588935 C66.7165265,61.4296985 66.3341065,64.1144085 64.7375825,71.133208 C64.129753,73.7199815 63.498605,76.331628 62.8659025,78.912183 L63.036903,79.2401935 C66.8377815,79.0396565 67.9912585,79.0396565 71.29468,79.0940655 L71.562063,78.8033645 C71.981792,76.65342 72.036201,76.1497455 72.965823,71.795447 C73.402652,69.7310025 74.313619,65.1948215 74.7628845,63.579643 C75.588351,63.197223 76.402936,62.8210215 77.1802115,62.8210215 C79.0316825,62.8210215 78.8062725,64.4362005 78.734763,65.079785 C78.655481,66.160198 77.9808055,69.68903 77.2890305,72.7188505 L76.8273285,74.674476 C76.5055365,76.1186545 76.152653,77.522414 75.830861,78.954156 L75.9707705,79.2401935 C79.7172395,79.0396565 80.859835,79.0396565 84.0591015,79.0940655 L84.435303,78.8033645 C85.013596,75.4455335 85.183042,74.547003 86.209046,69.6579385 L86.725157,67.411612 C87.727843,63.0153405 88.2315175,60.786114 87.4728965,58.970398 C86.670748,56.93549 84.7462135,56.444252 82.9786885,56.444252 Z M101.165696,61.047123 C99.1743155,61.429543 97.904247,61.684489 96.6419515,61.8492715 C95.3905375,62.049809 94.1702145,62.2316915 92.24568,62.499074 L92.093334,62.637429 L91.9534245,62.7478025 C91.7528875,64.181099 91.6129775,65.420076 91.3471495,66.876691 C91.1217395,68.383051 90.7750745,70.094612 90.2107725,72.5539125 C89.7739435,74.436474 89.5485335,75.092495 89.299805,75.754734 C89.057295,76.4169725 88.7899125,77.060557 88.298674,78.9120275 L88.413711,79.0830285 L88.510093,79.240038 C90.308709,79.1545375 91.4855045,79.09391 92.6949455,79.0830285 C93.902832,79.039501 95.1542455,79.0830285 97.0912165,79.09391 L97.260663,78.955555 L97.4425455,78.803209 C97.7223645,77.133621 97.7643375,76.6843555 97.935338,75.8697705 C98.104784,74.9961125 98.39704,73.786672 99.113688,70.556314 C99.4525805,69.039072 99.8303365,67.5264935 100.181665,65.97816 C100.546985,64.436045 100.929404,62.9172485 101.293169,61.4000065 L101.23876,61.2165695 L101.165696,61.047123 Z M101.208135,54.841043 C99.3986375,53.7730665 96.222689,54.1119585 94.0851805,55.587228 C91.953891,57.0329605 91.711381,59.0849685 93.5146605,60.166936 C95.293067,61.2053765 98.481452,60.896021 100.600305,59.408315 C102.726932,57.9314915 102.99276,55.898138 101.208135,54.841043 Z M112.151399,79.574733 C115.812368,79.574733 119.565055,78.565829 122.389675,75.571763 C124.562938,73.143554 125.559405,69.5307765 125.904516,68.043071 C127.028457,63.112034 126.153244,60.809743 125.054176,59.407538 C123.384588,57.2700295 120.43405,56.5844725 117.373138,56.5844725 C115.532549,56.5844725 111.148714,56.766355 107.724038,59.923649 C105.264737,62.2010665 104.12836,65.291515 103.442803,68.2544895 C102.751028,71.2734285 101.955097,76.70814 106.95298,78.7306115 C108.495095,79.3928505 110.718104,79.574733 112.151399,79.574733 Z M111.865362,68.4798995 C112.709484,64.7458675 113.705951,61.6118915 116.249197,61.6118915 C118.242132,61.6118915 118.386705,63.943719 117.500611,67.6901875 C117.342047,68.5218725 116.614517,71.6138755 115.630486,72.9305805 C114.943374,73.902175 114.130344,74.49135 113.231813,74.49135 C112.96443,74.49135 111.374124,74.49135 111.349251,72.1299865 C111.336815,70.964073 111.574661,69.7732865 111.865362,68.4798995 Z M135.05616,79.094532 L135.342197,78.803831 C135.747935,76.6538865 135.814781,76.148657 136.713312,71.7959135 C137.162577,69.731469 138.092198,65.195288 138.529028,63.580109 C139.356049,63.196135 140.156643,62.8199335 140.958791,62.8199335 C142.797825,62.8199335 142.57397,64.4351125 142.500907,65.0786965 C142.43406,66.1606645 141.759386,69.6879415 141.055173,72.717762 L140.618345,74.673388 C140.284116,76.1191205 139.920351,77.521326 139.598559,78.9546225 L139.738469,79.24066 C143.497374,79.0401225 144.596441,79.0401225 147.814363,79.094532 L148.203001,78.803831 C148.767303,75.4444455 148.919649,74.5459145 149.976744,69.658405 L150.480419,67.410524 C151.487768,63.0142525 151.99766,60.7865805 151.251476,58.9708645 C150.426009,56.9359565 148.489038,56.4447185 146.746386,56.4447185 C145.591354,56.4447185 143.472501,56.722983 141.589939,57.652605 C140.916819,58.005488 140.242143,58.411226 139.579904,58.8185185 L140.156643,56.584628 L139.847287,56.206872 C135.833436,57.021457 134.91625,57.1302755 131.211754,57.652605 L130.927271,57.85936 C130.478006,61.4301645 130.112686,64.1133205 128.516162,71.1336745 C127.908333,73.720448 127.277185,76.332094 126.646037,78.9126495 L126.815483,79.24066 C130.622579,79.0401225 131.758957,79.0401225 135.05616,79.094532 Z M162.673542,79.2398825 C162.909834,78.0864055 164.313594,71.2494885 164.32603,71.2494885 C164.32603,71.2494885 165.52148,66.232951 165.594545,66.0510685 C165.594545,66.0510685 165.970746,65.5287395 166.346947,65.321984 L166.900367,65.321984 C172.122106,65.321984 178.018519,65.321984 182.6402,61.92218 C185.785058,59.590353 187.935002,56.1470215 188.89416,51.9621695 C189.142889,50.9361655 189.326326,49.7158426 189.326326,48.4955199 C189.326326,46.8927774 189.004534,45.3071349 188.074912,44.0681575 C185.718212,40.770954 181.025022,40.7103265 175.60741,40.6854536 C175.59031,40.6854536 172.93669,40.7103265 172.93669,40.7103265 C166.001837,40.7958268 163.220744,40.770954 162.078149,40.6310444 C161.981767,41.1362735 161.799884,42.0348043 161.799884,42.0348043 C161.799884,42.0348043 159.315711,53.547812 159.315711,53.5664665 C159.315711,53.5664665 153.371107,78.0444325 153.091287,79.1979095 C159.146265,79.124846 161.628884,79.124846 162.673542,79.2398825 Z M167.276569,58.7882045 C167.276569,58.7882045 169.917752,47.2985153 169.905316,47.3420427 L169.990815,46.7528678 L170.028125,46.3036024 L171.083665,46.4124209 C171.083665,46.4124209 176.530813,46.8803409 176.658287,46.8927774 C178.808231,47.7244624 179.694325,49.8681887 179.075614,52.666381 C178.511312,55.223618 176.852606,57.373563 174.721316,58.412003 C172.966227,59.291879 170.816282,59.364943 168.601047,59.364943 L167.167751,59.364943 L167.276569,58.7882045 Z M183.721236,68.692718 C183.023242,71.668129 182.221093,77.102841 187.194103,79.039812 C188.779745,79.714487 190.200605,79.915024 191.644784,79.8419605 C193.169799,79.759569 194.582886,78.99473 195.891818,77.8941075 C195.773673,78.346482 195.655527,78.7988565 195.537381,79.2527855 L195.76279,79.5434865 C199.339813,79.392695 200.449763,79.392695 204.325259,79.4222315 L204.676588,79.1548485 C205.242445,75.8281085 205.775656,72.597751 207.246262,66.2334175 C207.962909,63.184942 208.678003,60.1660035 209.413306,57.1299645 L209.29827,56.795736 C205.296854,57.537257 204.227323,57.6958215 200.378253,58.241469 L200.085998,58.479315 C200.047134,58.788671 200.006716,59.08559 199.969406,59.3825095 C199.370904,58.4155785 198.503465,57.590112 197.164996,57.0755555 C195.453434,56.4024345 191.433365,57.269874 187.977597,60.416286 C185.549388,62.662613 184.383475,65.7406245 183.721236,68.692718 Z M192.12514,68.8746005 C192.981698,65.2074135 193.965729,62.104529 196.515194,62.104529 C198.127263,62.104529 198.976048,63.5922345 198.803493,66.1292625 C198.666693,66.761965 198.51901,67.4288675 198.343345,68.182825 C198.0884,69.2725655 197.811689,70.3529785 197.542752,71.4349465 C197.26915,72.174913 196.950468,72.8729065 196.600694,73.3377175 C195.944673,74.267339 194.383904,74.8440775 193.485373,74.8440775 C193.230426,74.8440775 191.65722,74.8440775 191.602811,72.524687 C191.590374,71.3696555 191.828221,70.1804235 192.12514,68.8746005 Z M236.010903,56.766044 L235.701548,56.413161 C231.742105,57.2153095 231.025456,57.3427825 227.387807,57.834021 L227.120423,58.1014035 C227.107988,58.144931 227.097105,58.211777 227.078451,58.2724045 L227.066014,58.211777 C224.357986,64.459519 224.437268,63.111723 222.232914,68.0303235 C222.220477,67.806468 222.220477,67.6665585 222.208042,67.428712 L221.656175,56.766044 L221.30951,56.413161 C217.161968,57.2153095 217.064031,57.3427825 213.233616,57.834021 L212.935143,58.1014035 C212.893169,58.228877 212.893169,58.3687865 212.868297,58.5211325 L212.893169,58.575542 C213.371971,61.022406 213.256934,60.4767585 213.737291,64.338264 C213.961146,66.233262 214.25962,68.139142 214.483475,70.010822 C214.861232,73.143243 215.072651,74.685358 215.534352,79.4656035 C212.947578,83.7344015 212.335085,85.3495805 209.844694,89.0960495 L209.861794,89.1333585 L208.10826,91.906678 C207.907723,92.198934 207.725841,92.399471 207.470894,92.4849715 C207.191075,92.6233265 206.82731,92.648199 206.32208,92.648199 L205.350486,92.648199 L203.906308,97.451763 L208.860663,97.5372635 C211.769228,97.524827 213.597381,96.1645945 214.581412,94.336442 L217.696733,88.9981125 L217.646987,88.9981125 L217.974998,88.621911 C220.070533,84.110603 236.010903,56.766044 236.010903,56.766044 Z M183.72108,119.853625 L181.619326,119.853625 L189.398302,94.1242455 L191.978857,94.1242455 L192.798105,91.4737355 L192.877387,94.421165 C192.781005,96.243099 194.214302,97.858278 197.979425,97.5908955 L202.333723,97.5908955 L203.832311,92.63654 L202.193814,92.63654 C201.251756,92.63654 200.814927,92.3986935 200.869337,91.888801 L200.790054,88.890071 L192.726596,88.890071 L192.726596,88.9056165 C190.119614,88.960026 182.33442,89.1558995 180.758105,89.5756285 C178.850671,90.0668665 176.840635,91.5125995 176.840635,91.5125995 L177.630347,88.85898 L170.087664,88.85898 L168.516013,94.1242455 L160.632883,120.246927 L159.103204,120.246927 L157.603062,125.165528 L172.626247,125.165528 L172.122572,126.805579 L179.525345,126.805579 L180.016584,125.165528 L182.093465,125.165528 L183.72108,119.853625 Z M177.557284,99.352202 C176.349398,99.6864305 174.101516,100.699998 174.101516,100.699998 L176.100669,94.1242455 L182.093465,94.1242455 L180.647732,98.915373 C180.647732,98.915373 178.796261,99.0241915 177.557284,99.352202 Z M177.672321,108.746356 C177.672321,108.746356 175.789759,108.982648 174.550781,109.262467 C173.330458,109.632451 171.042159,110.798364 171.042159,110.798364 L173.106603,103.955229 L179.13049,103.955229 L177.672321,108.746356 Z M174.31449,119.914253 L168.30304,119.914253 L170.045692,114.139095 L176.038487,114.139095 L174.31449,119.914253 Z M188.791404,103.955229 L197.456474,103.955229 L196.211278,107.987735 L187.431173,107.987735 L186.112912,112.396443 L193.795505,112.396443 L187.978375,120.587374 C187.571082,121.188986 187.205762,121.401959 186.800025,121.571405 C186.392732,121.77816 185.857967,122.02067 185.239255,122.02067 L183.107965,122.02067 L181.643577,126.849107 L187.218198,126.849107 C190.115882,126.849107 191.827443,125.530847 193.091294,123.800631 L197.080273,118.341047 L197.936831,123.884578 C198.118713,124.923017 198.864898,125.530847 199.370127,125.767139 C199.928211,126.046958 200.50495,126.527315 201.319535,126.598824 C202.193192,126.636133 202.82434,126.66567 203.244069,126.66567 L205.983189,126.66567 L207.627904,121.262049 L206.547491,121.262049 C205.927224,121.262049 204.859248,121.157894 204.677366,120.963575 C204.495483,120.727283 204.495483,120.363518 204.397546,119.810098 L203.528552,114.254131 L199.970183,114.254131 L201.530954,112.396443 L210.293959,112.396443 L211.641755,107.987735 L203.528552,107.987735 L204.792402,103.955229 L212.880733,103.955229 L214.380875,98.982219 L190.266674,98.982219 L188.791404,103.955229 Z M115.605924,121.037106 L117.628395,114.309008 L125.940582,114.309008 L127.459378,109.304907 L119.139419,109.304907 L120.409488,105.163582 L128.539791,105.163582 L130.046152,100.318045 L109.703292,100.318045 L108.228023,105.163582 L112.849704,105.163582 L111.616945,109.304907 L106.982827,109.304907 L105.446931,114.394508 L110.067057,114.394508 L107.371465,123.295869 C107.0077,124.474219 107.542466,124.923484 107.881358,125.470686 C108.228023,126.003897 108.579352,126.35678 109.369064,126.557317 C110.183649,126.7392 110.741733,126.848018 111.500354,126.848018 L120.87119,126.848018 L122.540778,121.304488 L118.387016,121.875009 C117.584868,121.875009 115.363414,121.778627 115.605924,121.037106 Z M116.55933,88.8286665 L114.452913,92.635763 C114.002093,93.4674475 113.596355,93.983559 113.231036,94.221405 C112.909244,94.4219425 112.271878,94.505888 111.348474,94.505888 L110.249406,94.505888 L108.780355,99.3762975 L112.430442,99.3762975 C114.18553,99.3762975 115.533326,98.7327135 116.176911,98.410921 C116.868686,98.040938 117.050568,98.252357 117.585334,97.736246 L118.818094,96.668269 L130.216064,96.668269 L131.728643,91.5973225 L123.385365,91.5973225 L124.84198,88.8286665 L116.55933,88.8286665 Z M133.386416,121.134887 C133.192097,120.855067 133.332007,120.362275 133.628926,119.336271 L136.744247,109.024932 L147.826644,109.024932 C149.441823,109.001614 150.607736,108.982959 151.366357,108.92855 C152.180942,108.843049 153.067037,108.552348 154.032413,108.030019 C155.028881,107.482817 155.538773,106.906078 155.969384,106.243839 C156.44974,105.583155 157.220798,104.137422 157.883037,101.908196 L161.798952,88.859291 L150.298381,88.926137 C150.298381,88.926137 146.757113,89.448466 145.197898,90.0252045 C143.624692,90.668789 141.37681,92.4658505 141.37681,92.4658505 L142.415251,88.8888275 L135.31095,88.8888275 L125.364931,121.874854 C125.012048,123.155803 124.775756,124.085425 124.721347,124.643509 C124.702692,125.245121 125.479968,125.840514 125.983643,126.289779 C126.579036,126.739045 127.458911,126.665981 128.303033,126.739045 C129.190682,126.805891 130.452978,126.847863 132.195629,126.847863 L137.655214,126.847863 L139.33102,121.189296 L134.443511,121.650998 C133.921182,121.650998 133.543426,121.371178 133.386416,121.134887 Z M138.754282,102.060541 L150.394763,102.060541 L149.654797,104.379932 C149.550642,104.434341 149.301913,104.264895 148.117345,104.404805 L138.037634,104.404805 L138.754282,102.060541 Z M141.086109,94.2815665 L152.824526,94.2815665 L151.980405,97.075095 C151.980405,97.075095 146.447757,97.020686 145.561663,97.1839135 C141.662847,97.858589 139.38543,99.941688 139.38543,99.941688 L141.086109,94.2815665 Z M149.915339,112.146937 C149.818957,112.493602 149.666611,112.705021 149.453638,112.863585 C149.217345,113.015931 148.834926,113.07034 148.264406,113.07034 L146.605699,113.07034 L146.703636,110.245721 L139.804537,110.245721 L139.524718,124.054801 C139.513836,125.051268 139.610218,125.628007 140.339303,126.089709 C141.068387,126.666447 143.314714,126.739511 146.338316,126.739511 L150.661524,126.739511 L152.222294,121.570628 L148.458724,121.777383 L147.207311,121.850447 C147.03631,121.777383 146.873082,121.710537 146.6912,121.528655 C146.532635,121.371645 146.265253,121.468028 146.30878,120.47156 L146.338316,116.931847 L150.285323,116.768619 C152.416613,116.768619 153.32758,116.075288 154.104855,115.414604 C154.846376,114.781902 155.088886,114.054372 155.368706,113.07034 L156.030945,109.936365 L150.607114,109.936365 L149.915339,112.146937 Z\" fill=\"#FEFEFE\"></path></g></svg>'\n\nexport function MastercardIcon({ size = 24 }: { size?: number }) {\n return <SvgXml xml={MASTERCARD_SVG} width={size} height={size * (18 / 24)} />\n}\n\nexport function VisaIcon({ size = 24 }: { size?: number }) {\n return <SvgXml xml={VISA_SVG} width={size} height={size * (19 / 24)} />\n}\n\nexport function JcbIcon({ size = 24 }: { size?: number }) {\n return <SvgXml xml={JCB_SVG} width={size} height={size * (19 / 24)} />\n}\n\nexport function UnionPayIcon({ size = 24 }: { size?: number }) {\n return <SvgXml xml={UNIONPAY_SVG} width={size} height={size * (160 / 256)} />\n}\n\nexport function ApplePayIcon({ size = 20, color }: BrandIconProps) {\n const c = useGlyphColor(color)\n const w = size * (11.7334 / 14.4)\n return (\n <SvgXml\n xml={APPLE_SVG.replace('currentColor', c).replace('currentColor', c)}\n width={w}\n height={size}\n />\n )\n}\n\nexport function RevolutIcon({ size = 20, color }: BrandIconProps) {\n const c = useGlyphColor(color)\n const w = size * (15.9174 / 20)\n return (\n <SvgXml\n xml={REVOLUT_SVG.replace('currentColor', c).replace('currentColor', c)}\n width={w}\n height={size}\n />\n )\n}\n\nexport function CryptoCoinIcon({ size = 24, color }: BrandIconProps) {\n const c = useGlyphColor(color)\n return (\n <SvgXml\n xml={CRYPTO_SVG.replace(/currentColor/g, c)}\n width={size}\n height={size}\n />\n )\n}\n\nexport function BankIcon({ size = 24, color }: BrandIconProps) {\n const c = useGlyphColor(color)\n return (\n <SvgXml\n xml={BANK_SVG.replace(/currentColor/g, c)}\n width={size}\n height={size}\n />\n )\n}\n", "import { ASSET_LOGO_SRCS } from './assetLogos'\n\n// Fun's icon CDN. Chain logos are SVG; token logos vary (svg/png). {@link FunIcon}\n// picks the renderer by extension (SvgXml for `.svg`, Image otherwise).\nconst CDN_BASE = 'https://sdk-cdn.fun.xyz/images'\n\n/** CDN URL for a chain logo, e.g. `chainIconUri('ethereum')`. SVG. */\nexport const chainIconUri = (chainKey: string): string =>\n `${CDN_BASE}/${chainKey}.svg`\n\n/**\n * Resolve a deposit token's logo URL by symbol \u2014 a verbatim mirror of the web\n * SDK's `getLocalTokenIconUrl` (`packages/connect/src/utils/tokenIconUrl.ts`),\n * the resolver the web *token-transfer* screen uses via `getTokenIconUrl`.\n *\n * IMPORTANT: web's transfer screen resolves the icon PURELY by symbol \u2014 it does\n * NOT consult the `/assets/supported` API `logo` field (that field is only used\n * by the wallet-holdings screen, via `getAssetLogoSrc`). The fallback for an\n * unknown symbol is `<symbol>.svg` on the CDN, NOT the dollar-circle. Matching\n * this exactly is why most tokens (USDT/DAI/WETH \u2026) now render: the CDN files\n * are `.svg`, and special cases like POL live in {@link ASSET_LOGO_SRCS}.\n */\nexport const tokenLogoUri = (symbol: string): string =>\n ASSET_LOGO_SRCS[symbol.toUpperCase()] ??\n `${CDN_BASE}/${symbol.toLowerCase()}.svg`\n", "import type { ViewStyle } from 'react-native'\n\nimport { Box } from '../theme/restyle'\nimport { FALLBACK_ASSET_LOGO } from './assetLogos'\nimport { FunIcon } from './FunIcon'\nimport { chainIconUri } from './funIconUri'\n\n/**\n * The chain-logo cluster shown in the center of the deposit QR (Figma: qr-code\n * \u2192 `icon/chain`). It reflects the selected network: a single network renders\n * one large logo (e.g. Solana), a multi-chain network renders a 2\u00D72 grid of\n * small logos (e.g. EVM: Ethereum / Aptos / Base / BNB). Logos resolve from CDN\n * chain keys OR full image URLs so the package stays asset-free.\n *\n * The QR behind it is drawn at high error-correction ({@link QrCode} `ecl=\"H\"`),\n * so this central occlusion stays scannable.\n */\nexport interface QrChainClusterProps {\n /**\n * Logos for the selected network \u2014 either CDN chain **keys** (e.g.\n * `['ethereum', 'bsc']`) or full image **URLs** (`@funkit/chains` `iconUrl`s).\n * One entry \u2192 a single logo; 2\u20134 \u2192 a 2\u00D72 grid.\n */\n iconKeys: string[]\n /** Max logos in the grid before the rest are dropped (Figma shows 4). */\n max?: number\n}\n\n/** A full URL is used as-is; anything else is treated as a CDN chain key. */\nfunction toIconUri(icon: string): string {\n return icon.startsWith('http') ? icon : chainIconUri(icon)\n}\n\n// Smaller logos with clear padding inside the quiet-zone card, so the center\n// occludes fewer QR modules (denser read) and the icons don't touch the edge.\n// Figma `icon/chain` card (node 12782:5552): 46px quiet-zone card, 12px radius\n// (border/radius/element). The 2\u00D72 grid is centered inside it, so the icons\n// keep a clean margin from the card edge.\nconst CARD_SIZE = 46\nconst CARD_RADIUS = 12\n// Single logo fills the card with the same ~6px margin the 2\u00D72 grid keeps.\nconst SINGLE_SIZE = 34\nconst GRID_SIZE = 16\nconst GRID_GAP = 3\n\nexport function QrChainCluster({ iconKeys, max = 4 }: QrChainClusterProps) {\n const keys = iconKeys.slice(0, max)\n const first = keys[0]\n if (first == null) {\n return null\n }\n\n if (keys.length === 1) {\n return (\n <Box alignItems=\"center\" justifyContent=\"center\" style={card}>\n <Box style={ring(SINGLE_SIZE)}>\n <FunIcon\n uri={toIconUri(first)}\n size={SINGLE_SIZE}\n fallbackUri={FALLBACK_ASSET_LOGO}\n />\n </Box>\n </Box>\n )\n }\n\n return (\n <Box alignItems=\"center\" justifyContent=\"center\" style={card}>\n <Box flexDirection=\"row\" flexWrap=\"wrap\" style={grid}>\n {keys.map((key) => (\n <Box key={key} style={ring(GRID_SIZE)}>\n <FunIcon\n uri={toIconUri(key)}\n size={GRID_SIZE}\n fallbackUri={FALLBACK_ASSET_LOGO}\n />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n\n// Cap the row at two columns so 3\u20134 logos wrap into a 2\u00D72.\nconst grid: ViewStyle = {\n width: GRID_SIZE * 2 + GRID_GAP,\n gap: GRID_GAP,\n}\n// The white rounded-square \"quiet zone\" behind the cluster (Figma `icon/chain`).\n// The QR is drawn at high error-correction so this central occlusion stays\n// scannable \u2014 without it the QR pattern bleeds through the gaps between the\n// circular logos. Padded so a little white shows around the 2\u00D72 grid.\nconst card: ViewStyle = {\n width: CARD_SIZE,\n height: CARD_SIZE,\n borderRadius: CARD_RADIUS,\n backgroundColor: '#FFFFFF',\n}\n// A logo clipped to a circle (no border \u2014 the chain SVGs carry their own\n// shape). The fill is an opaque white \u2014 the QR is always drawn on white cells\n// ({@link QrCode}), so transparent chain-logo SVGs need a white backing or the\n// QR pattern bleeds through behind the icon.\nconst ring = (iconSize: number): ViewStyle => ({\n width: iconSize,\n height: iconSize,\n borderRadius: 999,\n backgroundColor: '#FFFFFF',\n overflow: 'hidden',\n})\n", "import { SvgXml } from 'react-native-svg'\n\nimport { useTheme } from '../theme/restyle'\n\ntype IconProps = {\n size?: number\n color?: string\n}\n\nfunction useIconColor(color?: string) {\n const theme = useTheme()\n return color ?? theme.content.elements.primary\n}\n\nfunction renderIcon(svg: string, size: number, color: string) {\n return (\n <SvgXml\n xml={svg.replace(/currentColor/g, color)}\n width={size}\n height={size}\n />\n )\n}\n\n// Exact SVG icons exported from the Fun Mobile Figma file (node 10121:4436,\n// \"Fun Mobile (Copy)\" icon export set). Monochrome fills/strokes are swapped to\n// `currentColor` so the icons inherit theme colors; the success check keeps its\n// semantic green. Geometry is byte-for-byte from the export \u2014 nothing composed.\nconst CLOSE_SVG =\n '<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M4.41291 3.08709C4.0468 2.72097 3.4532 2.72097 3.08709 3.08709C2.72097 3.4532 2.72097 4.0468 3.08709 4.41291L8.67417 10L3.08709 15.5871C2.72097 15.9532 2.72097 16.5468 3.08709 16.9129C3.4532 17.279 4.0468 17.279 4.41291 16.9129L10 11.3258L15.5871 16.9129C15.9532 17.279 16.5468 17.279 16.9129 16.9129C17.279 16.5468 17.279 15.9532 16.9129 15.5871L11.3258 10L16.9129 4.41291C17.279 4.0468 17.279 3.4532 16.9129 3.08709C16.5468 2.72097 15.9532 2.72097 15.5871 3.08709L10 8.67417L4.41291 3.08709Z\" fill=\"currentColor\"/></svg>'\n\nconst QR_SCAN_SVG =\n '<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5.83333 9.99935H10V14.166M2.50833 9.99935H2.5M6.675 14.166H6.66667M10.0083 17.4993H10M17.5083 9.99935H17.5M2.5 14.166H3.75M12.9167 9.99935H14.5833M2.5 17.4993H6.66667M10 1.66602V6.66602M14.6667 17.4993H16.1667C16.6334 17.4993 16.8667 17.4993 17.045 17.4085C17.2018 17.3286 17.3293 17.2011 17.4092 17.0443C17.5 16.8661 17.5 16.6327 17.5 16.166V14.666C17.5 14.1993 17.5 13.966 17.4092 13.7877C17.3293 13.6309 17.2018 13.5034 17.045 13.4235C16.8667 13.3327 16.6334 13.3327 16.1667 13.3327H14.6667C14.2 13.3327 13.9666 13.3327 13.7883 13.4235C13.6315 13.5034 13.5041 13.6309 13.4242 13.7877C13.3333 13.966 13.3333 14.1993 13.3333 14.666V16.166C13.3333 16.6327 13.3333 16.8661 13.4242 17.0443C13.5041 17.2011 13.6315 17.3286 13.7883 17.4085C13.9666 17.4993 14.2 17.4993 14.6667 17.4993ZM14.6667 6.66602H16.1667C16.6334 6.66602 16.8667 6.66602 17.045 6.57519C17.2018 6.49529 17.3293 6.36781 17.4092 6.21101C17.5 6.03275 17.5 5.79939 17.5 5.33268V3.83268C17.5 3.36597 17.5 3.13262 17.4092 2.95436C17.3293 2.79756 17.2018 2.67007 17.045 2.59018C16.8667 2.49935 16.6334 2.49935 16.1667 2.49935H14.6667C14.2 2.49935 13.9666 2.49935 13.7883 2.59018C13.6315 2.67007 13.5041 2.79756 13.4242 2.95436C13.3333 3.13262 13.3333 3.36597 13.3333 3.83268V5.33268C13.3333 5.79939 13.3333 6.03275 13.4242 6.21101C13.5041 6.36781 13.6315 6.49529 13.7883 6.57519C13.9666 6.66602 14.2 6.66602 14.6667 6.66602ZM3.83333 6.66602H5.33333C5.80004 6.66602 6.0334 6.66602 6.21166 6.57519C6.36846 6.49529 6.49594 6.36781 6.57584 6.21101C6.66667 6.03275 6.66667 5.79939 6.66667 5.33268V3.83268C6.66667 3.36597 6.66667 3.13262 6.57584 2.95436C6.49594 2.79756 6.36846 2.67007 6.21166 2.59018C6.0334 2.49935 5.80004 2.49935 5.33333 2.49935H3.83333C3.36662 2.49935 3.13327 2.49935 2.95501 2.59018C2.79821 2.67007 2.67072 2.79756 2.59083 2.95436C2.5 3.13262 2.5 3.36597 2.5 3.83268V5.33268C2.5 5.79939 2.5 6.03275 2.59083 6.21101C2.67072 6.36781 2.79821 6.49529 2.95501 6.57519C3.13327 6.66602 3.36662 6.66602 3.83333 6.66602Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\n\nconst COPY_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5.6 10.4V12.08C5.6 12.7521 5.6 13.0881 5.73079 13.3448C5.84584 13.5706 6.02942 13.7542 6.25521 13.8692C6.51191 14 6.84794 14 7.52 14H12.08C12.7521 14 13.0881 14 13.3448 13.8692C13.5706 13.7542 13.7542 13.5706 13.8692 13.3448C14 13.0881 14 12.7521 14 12.08V7.52C14 6.84794 14 6.51191 13.8692 6.25521C13.7542 6.02942 13.5706 5.84584 13.3448 5.73079C13.0881 5.6 12.7521 5.6 12.08 5.6H10.4M3.92 10.4H8.48C9.15206 10.4 9.48809 10.4 9.74479 10.2692C9.97058 10.1542 10.1542 9.97058 10.2692 9.74479C10.4 9.48809 10.4 9.15206 10.4 8.48V3.92C10.4 3.24794 10.4 2.91191 10.2692 2.65521C10.1542 2.42942 9.97058 2.24584 9.74479 2.13079C9.48809 2 9.15206 2 8.48 2H3.92C3.24794 2 2.91191 2 2.65521 2.13079C2.42942 2.24584 2.24584 2.42942 2.13079 2.65521C2 2.91191 2 3.24794 2 3.92V8.48C2 9.15206 2 9.48809 2.13079 9.74479C2.24584 9.97058 2.42942 10.1542 2.65521 10.2692C2.91191 10.4 3.24794 10.4 3.92 10.4Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\n\nconst SHARE_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M14 8V10.8C14 11.9201 14 12.4802 13.782 12.908C13.5903 13.2843 13.2843 13.5903 12.908 13.782C12.4802 14 11.9201 14 10.8 14H5.2C4.07989 14 3.51984 14 3.09202 13.782C2.71569 13.5903 2.40973 13.2843 2.21799 12.908C2 12.4802 2 11.9201 2 10.8V8M5.33333 4.66667L8 2L10.6667 4.66667M8 2V10\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\n\nconst CHEVRON_RIGHT_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.71967 12.5303C5.42678 12.2374 5.42678 11.7626 5.71967 11.4697L9.18934 8L5.71967 4.53033C5.42678 4.23744 5.42678 3.76256 5.71967 3.46967C6.01256 3.17678 6.48744 3.17678 6.78033 3.46967L10.7803 7.46967C11.0732 7.76256 11.0732 8.23744 10.7803 8.53033L6.78033 12.5303C6.48744 12.8232 6.01256 12.8232 5.71967 12.5303Z\" fill=\"currentColor\"/></svg>'\n\nconst CHEVRON_LEFT_SVG =\n '<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12.8504 15.6629C13.2165 15.2968 13.2165 14.7032 12.8504 14.3371L8.51333 10L12.8504 5.66291C13.2165 5.2968 13.2165 4.7032 12.8504 4.33709C12.4843 3.97097 11.8907 3.97097 11.5246 4.33709L6.52459 9.33709C6.15847 9.7032 6.15847 10.2968 6.52459 10.6629L11.5246 15.6629C11.8907 16.029 12.4843 16.029 12.8504 15.6629Z\" fill=\"currentColor\"/></svg>'\n\n// Semantic success check-in-circle \u2014 keeps its Figma green (#52A300) regardless\n// of theme color, since it signals a confirmed action (\"Address copied\").\nconst SUCCESS_CHECK_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5.5 8.5L7 10L10.5 6.5M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z\" stroke=\"#52A300\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\n\n// The Fun Mobile export set does not include a down-chevron or a plain selection\n// check (the token dropdown's expanded state is not part of the exported frames),\n// so these stay as the matching Fun Brand Guidelines system glyphs.\nconst CHEVRON_DOWN_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M3.46967 5.71967C3.76256 5.42678 4.23744 5.42678 4.53033 5.71967L8 9.18934L11.4697 5.71967C11.7626 5.42678 12.2374 5.42678 12.5303 5.71967C12.8232 6.01256 12.8232 6.48744 12.5303 6.78033L8.53033 10.7803C8.23744 11.0732 7.76256 11.0732 7.46967 10.7803L3.46967 6.78033C3.17678 6.48744 3.17678 6.01256 3.46967 5.71967Z\" fill=\"currentColor\"/></svg>'\n\n// The denomination swap (node 13928:63184). Path is the export verbatim; the\n// wrapper applies the quarter turn, since the export draws it lying down.\nconst SWAP_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><g transform=\"translate(1 14) rotate(-90)\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M8.21967 0.21967C8.51256 -0.0732233 8.98744 -0.0732233 9.28033 0.21967L11.947 2.88634C12.2399 3.17923 12.2399 3.6541 11.947 3.947L9.28033 6.61366C8.98744 6.90656 8.51256 6.90656 8.21967 6.61366C7.92678 6.32077 7.92678 5.8459 8.21967 5.553L9.60601 4.16667H0.75C0.335786 4.16667 0 3.83088 0 3.41667C0 3.00245 0.335786 2.66667 0.75 2.66667H9.60601L8.21967 1.28033C7.92678 0.987437 7.92678 0.512563 8.21967 0.21967ZM3.947 6.88634C4.23989 7.17923 4.23989 7.6541 3.947 7.947L2.56066 9.33333H11.4167C11.8309 9.33333 12.1667 9.66912 12.1667 10.0833C12.1667 10.4975 11.8309 10.8333 11.4167 10.8333H2.56066L3.947 12.2197C4.23989 12.5126 4.23989 12.9874 3.947 13.2803C3.6541 13.5732 3.17923 13.5732 2.88634 13.2803L0.21967 10.6137C-0.0732233 10.3208 -0.0732233 9.8459 0.21967 9.553L2.88634 6.88634C3.17923 6.59344 3.6541 6.59344 3.947 6.88634Z\" fill=\"currentColor\"/></g></svg>'\n\nconst CHECK_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M13.8047 4.19526C14.0651 4.45561 14.0651 4.87772 13.8047 5.13807L6.80474 12.1381C6.54439 12.3984 6.12228 12.3984 5.86193 12.1381L2.5286 8.80474C2.26825 8.54439 2.26825 8.12228 2.5286 7.86193C2.78895 7.60158 3.21106 7.60158 3.4714 7.86193L6.33333 10.7239L12.8619 4.19526C13.1223 3.93491 13.5444 3.93491 13.8047 4.19526Z\" fill=\"currentColor\"/></svg>'\n\nexport function FigmaCloseIcon({ size = 20, color }: IconProps) {\n return renderIcon(CLOSE_SVG, size, useIconColor(color))\n}\n\nexport function FigmaQrScanIcon({ size = 20, color }: IconProps) {\n return renderIcon(QR_SCAN_SVG, size, useIconColor(color))\n}\n\nexport function FigmaCopyIcon({ size = 16, color }: IconProps) {\n return renderIcon(COPY_SVG, size, useIconColor(color))\n}\n\nexport function FigmaShareIcon({ size = 16, color }: IconProps) {\n return renderIcon(SHARE_SVG, size, useIconColor(color))\n}\n\nexport function FigmaChevronRightIcon({ size = 16, color }: IconProps) {\n return renderIcon(CHEVRON_RIGHT_SVG, size, useIconColor(color))\n}\n\nexport function FigmaChevronLeftIcon({ size = 20, color }: IconProps) {\n return renderIcon(CHEVRON_LEFT_SVG, size, useIconColor(color))\n}\n\nexport function FigmaSuccessCheckIcon({ size = 16 }: { size?: number }) {\n return <SvgXml xml={SUCCESS_CHECK_SVG} width={size} height={size} />\n}\n\nexport function FigmaChevronDownIcon({ size = 16, color }: IconProps) {\n return renderIcon(CHEVRON_DOWN_SVG, size, useIconColor(color))\n}\n\nexport function FigmaSwapIcon({ size = 16, color }: IconProps) {\n return renderIcon(SWAP_SVG, size, useIconColor(color))\n}\n\nexport function FigmaCheckIcon({ size = 16, color }: IconProps) {\n return renderIcon(CHECK_SVG, size, useIconColor(color))\n}\n\nconst INFO_CIRCLE_SVG =\n '<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10 9.16667V13.3333M10 6.66667H10.0083M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\n\nexport function FigmaInfoCircleIcon({ size = 20, color }: IconProps) {\n return renderIcon(INFO_CIRCLE_SVG, size, useIconColor(color))\n}\n\n// Just the \"+\" stroke from the Add money Crypto-row overflow chip (Figma\n// list-item `plus.svg`). The source asset bakes in a #F9F9F9 circle, but the\n// SourceTokenCluster pill already draws the themed `bgSecondary` circle, so we\n// keep only the glyph and let it inherit the theme via `currentColor` \u2014 drawn\n// as geometry it centers cleanly where the text \"+\" did not.\nconst PLUS_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M8.20833 5V11.4167M5 8.20833H11.4167\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>'\n\nexport function FigmaPlusIcon({ size = 16, color }: IconProps) {\n return renderIcon(PLUS_SVG, size, useIconColor(color))\n}\n\n// The export is a 13.5 glyph centered in a 16 box, so the translate reproduces\n// the padding the design gives it rather than filling the icon slot.\nconst SEARCH_SVG =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><g transform=\"translate(1.25 1.25)\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.75 0C2.57436 0 0 2.57436 0 5.75C0 8.92564 2.57436 11.5 5.75 11.5C7.06745 11.5 8.28141 11.0569 9.25101 10.3117L12.2197 13.2803C12.5126 13.5732 12.9874 13.5732 13.2803 13.2803C13.5732 12.9874 13.5732 12.5126 13.2803 12.2197L10.3117 9.25101C11.0569 8.28141 11.5 7.06745 11.5 5.75C11.5 2.57436 8.92564 0 5.75 0ZM1.5 5.75C1.5 3.40279 3.40279 1.5 5.75 1.5C8.09721 1.5 10 3.40279 10 5.75C10 8.09721 8.09721 10 5.75 10C3.40279 10 1.5 8.09721 1.5 5.75Z\" fill=\"currentColor\"/></g></svg>'\n\nexport function FigmaSearchIcon({ size = 16, color }: IconProps) {\n return renderIcon(SEARCH_SVG, size, useIconColor(color))\n}\n\nconst ALERT_CIRCLE_SVG =\n '<svg width=\"20\" height=\"20\" viewBox=\"0 0 22.21 22.19\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11.0993 22.1908C9.5667 22.1908 8.1308 21.9008 6.7916 21.3207C5.4524 20.7478 4.2744 19.9529 3.2575 18.9359C2.2405 17.919 1.442 16.741 0.862 15.4018C0.289 14.0626 0.0026 12.6267 0.0026 11.0941C0.0026 9.5616 0.289 8.1257 0.862 6.7865C1.442 5.4402 2.2405 4.2621 3.2575 3.2523C4.2744 2.2354 5.4524 1.4405 6.7916 0.8676C8.1308 0.2875 9.5667 -0.0025 11.0993 -0.0025C12.6318 -0.0025 14.0677 0.2875 15.4069 0.8676C16.7532 1.4405 17.9349 2.2354 18.9518 3.2523C19.9687 4.2621 20.7636 5.4402 21.3366 6.7865C21.9166 8.1257 22.2067 9.5616 22.2067 11.0941C22.2067 12.6267 21.9166 14.0626 21.3366 15.4018C20.7636 16.741 19.9687 17.919 18.9518 18.9359C17.9349 19.9529 16.7532 20.7478 15.4069 21.3207C14.0677 21.9008 12.6318 22.1908 11.0993 22.1908ZM11.11 12.9525C11.7474 12.9525 12.0732 12.6195 12.0875 11.9535L12.2594 6.5609C12.2737 6.2315 12.1699 5.963 11.9479 5.7553C11.7259 5.5404 11.443 5.433 11.0993 5.433C10.7483 5.433 10.4655 5.5404 10.2506 5.7553C10.0358 5.963 9.9355 6.2279 9.9498 6.5502L10.1002 11.9643C10.1217 12.6231 10.4583 12.9525 11.11 12.9525ZM11.11 16.6479C11.4681 16.6479 11.776 16.5333 12.0338 16.3041C12.2916 16.0749 12.4205 15.7813 12.4205 15.4232C12.4205 15.0723 12.2916 14.7787 12.0338 14.5424C11.776 14.3061 11.4681 14.1879 11.11 14.1879C10.7448 14.1879 10.4332 14.3061 10.1754 14.5424C9.9176 14.7787 9.7887 15.0723 9.7887 15.4232C9.7887 15.7813 9.9176 16.0749 10.1754 16.3041C10.4404 16.5333 10.7519 16.6479 11.11 16.6479Z\" fill=\"currentColor\"/></svg>'\n\nexport function FigmaAlertCircleIcon({ size = 22, color }: IconProps) {\n return renderIcon(ALERT_CIRCLE_SVG, size, useIconColor(color))\n}\n", "import type { ViewStyle } from 'react-native'\n\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { FALLBACK_ASSET_LOGO } from './assetLogos'\nimport { FigmaPlusIcon } from './FigmaSystemIcons'\nimport { FunIcon } from './FunIcon'\nimport { chainIconUri } from './funIconUri'\n\n/**\n * The crypto-row trailing avatar stack (Figma: Add money `list-item/base` \u2192\n * `trailing` \u2192 `crypto2`). A short row of supported source-asset logos \u2014\n * 16px thin-bordered circles \u2014 followed by a \"+N\" pill counting the rest, e.g.\n * `\u25C7 \u25CE \u2B21 \u2296 +7`. Logos resolve from CDN chain keys so the package stays\n * asset-free.\n */\nexport interface SourceTokenClusterProps {\n /**\n * Logos to show \u2014 either CDN chain **keys** (e.g. `['ethereum', 'base', \u2026]`)\n * or full image **URLs** (e.g. `@funkit/chains` `iconUrl`s); each entry is\n * resolved independently. The first `maxVisible` render as logos; the rest\n * collapse into the \"+N\" pill.\n */\n icons: string[]\n /** Logos shown before collapsing the rest into \"+N\". Defaults to 4 (Figma). */\n maxVisible?: number\n /** Logo diameter in px. Defaults to 16 (Add money row); 20 on Transfer. */\n size?: number\n /** Gap between chips. Figma: 2 on the Add money row, 4 on Transfer. */\n gap?: number\n /**\n * Overflow chip style. `'count'` (default) shows \"+N\" with the remaining count\n * in a `pillPressed` circle (Transfer deposit row, Figma `tap-target`).\n * `'plus'` shows a bare \"+\" glyph in a `bgSecondary` circle regardless of count\n * (Add money Crypto row, Figma `crypto2`).\n */\n overflowMode?: 'count' | 'plus'\n}\n\n/** A full URL is used as-is; anything else is treated as a CDN chain key. */\nfunction toIconUri(icon: string): string {\n return icon.startsWith('http') ? icon : chainIconUri(icon)\n}\n\nexport function SourceTokenCluster({\n icons,\n maxVisible = 4,\n size = 16,\n gap = 2,\n overflowMode = 'count',\n}: SourceTokenClusterProps) {\n const theme = useTheme()\n const visible = icons.slice(0, maxVisible)\n const overflow = icons.length - visible.length\n return (\n <Box flexDirection=\"row\" alignItems=\"center\" style={{ gap }}>\n {visible.map((icon) => (\n <Box\n key={icon}\n style={[\n iconRing(size),\n { backgroundColor: theme.background.secondary },\n ]}\n >\n <FunIcon\n uri={toIconUri(icon)}\n size={size}\n fallbackUri={FALLBACK_ASSET_LOGO}\n />\n </Box>\n ))}\n {overflow > 0 ? (\n // Both chips are a fixed `size`\u00D7`size` circle (Figma). The \"+\" glyph sits\n // on `bgSecondary` (Add money `crypto2`); the \"+N\" count on `pillPressed`\n // (Transfer `tap-target`).\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[\n overflowCircle(size),\n {\n backgroundColor:\n overflowMode === 'plus'\n ? theme.background.secondary\n : theme.background.pill.pressed,\n },\n ]}\n >\n {overflowMode === 'plus' ? (\n // The geometric \"+\" glyph centers cleanly; the text \"+\" did not.\n <FigmaPlusIcon\n size={size}\n color={theme.content.elements.secondary}\n />\n ) : (\n <Text\n variant=\"bodyMedium\"\n style={[\n overflowText(size),\n { color: theme.content.elements.secondary },\n ]}\n >\n {`+${overflow}`}\n </Text>\n )}\n </Box>\n ) : null}\n </Box>\n )\n}\n\n// A logo in a circle with the Figma `border/icon` hairline. `overflow: hidden`\n// clips the CDN logo to the circle so the border reads cleanly.\nconst iconRing = (size: number): ViewStyle => ({\n width: size,\n height: size,\n borderRadius: 999,\n borderWidth: 1,\n borderColor: 'rgba(0,0,0,0.1)',\n overflow: 'hidden',\n // Center the same-size FunIcon so the border-box hairline doesn't push it 1px\n // off and clip the bottom-right; it fills the circle with the border on edge.\n alignItems: 'center',\n justifyContent: 'center',\n})\n// Both overflow chips are a fixed `size`\u00D7`size` circle (Figma) \u2014 no horizontal\n// padding (which made the single-glyph \"+\" read as an oval).\nconst overflowCircle = (size: number): ViewStyle => ({\n width: size,\n height: size,\n borderRadius: 999,\n})\n// \"+N\" count text: Inter-Medium (via `bodyMedium`) at ~0.6\u00D7 the chip, tracking\n// -0.48 per the Figma `tap-target` (`+4`).\nconst overflowText = (size: number) =>\n ({\n fontSize: Math.round(size * 0.6),\n letterSpacing: -0.48,\n }) as const\n", "import type { ViewStyle } from 'react-native'\n\nimport { Box, useTheme } from '../theme/restyle'\nimport { FALLBACK_ASSET_LOGO } from './assetLogos'\nimport { FunIcon } from './FunIcon'\nimport { chainIconUri, tokenLogoUri } from './funIconUri'\n\n/**\n * A token logo with a small chain badge overlaid bottom-right (Figma: the\n * `icon/crypto` avatar) \u2014 the RN analogue of web's `FunAssetAvatar`. The token\n * icon resolves from `iconSrc` (direct URL, matching web's\n * `DynamicTargetAssetCandidate.iconSrc`) or falls back to CDN via `symbol`\n * ({@link tokenLogoUri}). The badge resolves by CDN chain key. Omit `chainKey`\n * to render the token logo alone.\n */\nexport interface TokenChainIconProps {\n /** Token symbol \u2192 CDN token logo fallback, e.g. `\"USDG\"`. */\n symbol: string\n /** Direct URL for the token icon \u2014 preferred over CDN `symbol` lookup. */\n iconSrc?: string\n /** CDN chain key for the badge overlay, e.g. `\"ethereum\"`. Omit to hide it. */\n chainKey?: string\n /**\n * Direct URL for the badge \u2014 preferred over `chainKey`, and the way to badge\n * by chain id, whose logo comes from `@funkit/chains` rather than the CDN key.\n */\n chainIconSrc?: string\n size?: number\n}\n\nexport function TokenChainIcon({\n symbol,\n iconSrc,\n chainKey,\n chainIconSrc,\n size = 24,\n}: TokenChainIconProps) {\n const theme = useTheme()\n const badge = Math.round(size * 0.5)\n const badgeUri =\n chainIconSrc ?? (chainKey ? chainIconUri(chainKey) : undefined)\n return (\n <Box width={size} height={size}>\n <FunIcon\n uri={iconSrc ?? tokenLogoUri(symbol)}\n size={size}\n fallbackUri={FALLBACK_ASSET_LOGO}\n />\n {badgeUri ? (\n <Box\n borderRadius=\"rounded\"\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[\n badgeRing(badge),\n { backgroundColor: theme.background.modal },\n ]}\n >\n <FunIcon\n uri={badgeUri}\n size={badge}\n fallbackUri={FALLBACK_ASSET_LOGO}\n />\n </Box>\n ) : null}\n </Box>\n )\n}\n\nconst badgeRing = (badge: number): ViewStyle => ({\n position: 'absolute',\n right: -1,\n bottom: -1,\n width: badge + 2,\n height: badge + 2,\n})\n", "import { Linking, Pressable, StyleSheet } from 'react-native'\n\nimport { StatusIcon } from '../icons/StatusIcon'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\nconst FUN_REGIONAL_RESTRICTIONS_URL =\n 'https://intercom.help/funxyz/en/articles/9827689-regional-restrictions'\n\nexport function CheckoutBlockedScreen() {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={{ backgroundColor: theme.background.modal }}\n >\n <Box alignItems=\"center\" style={styles.topBar}>\n <Box\n style={[\n styles.grabber,\n { backgroundColor: theme.border.elements.default.color },\n ]}\n />\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {t('selectMethod.title')}\n </Text>\n </Box>\n\n <Box alignItems=\"center\" justifyContent=\"center\" style={styles.content}>\n <StatusIcon />\n <Box alignItems=\"center\" style={styles.textGroup}>\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {t('checkoutBlocked.notAvailable')}\n </Text>\n <Box alignItems=\"center\">\n <Text\n variant=\"detail\"\n style={[\n styles.descriptionText,\n { color: theme.content.elements.secondary },\n ]}\n >\n {t('checkoutBlocked.regionMessage')}\n </Text>\n <Pressable\n onPress={() => Linking.openURL(FUN_REGIONAL_RESTRICTIONS_URL)}\n >\n <Text\n variant=\"detail\"\n style={[\n styles.linkText,\n { color: theme.content.elements.secondary },\n ]}\n >\n {t('checkoutBlocked.viewRegions')}\n </Text>\n </Pressable>\n </Box>\n </Box>\n </Box>\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n topBar: { height: 64, paddingTop: 25, paddingBottom: 12 },\n grabber: {\n position: 'absolute',\n top: 8,\n width: 36,\n height: 5,\n borderRadius: 999,\n },\n content: {\n height: 390,\n gap: 24,\n paddingHorizontal: 16,\n paddingBottom: 34,\n },\n textGroup: { gap: 8 },\n descriptionText: { textAlign: 'center' },\n linkText: { textAlign: 'center', textDecorationLine: 'underline' },\n})\n", "import { StyleSheet } from 'react-native'\n\nimport { Box, useTheme } from '../theme/restyle'\nimport { FigmaAlertCircleIcon } from './FigmaSystemIcons'\n\n// Shared status circle (Figma: Fun Mobile `status-icon`) for the geo-blocked\n// and unavailable/error screens.\nexport function StatusIcon() {\n const theme = useTheme()\n return (\n <Box\n borderRadius=\"rounded\"\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[styles.circle, { backgroundColor: theme.background.secondary }]}\n >\n <FigmaAlertCircleIcon\n size={20}\n color={theme.content.button.icon.default}\n />\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n circle: { width: 48, height: 48 },\n})\n", "import { type ReactNode, useEffect, useRef, useState } from 'react'\nimport { Pressable, type TextStyle, type ViewStyle } from 'react-native'\n\nimport { Grabber } from '../components/Grabber'\nimport { useScreenSize } from '../hooks/useScreenSize'\nimport { CopyAddressIcon } from '../icons/CopyAddressIcon'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\n/**\n * The deposit QR-code screen (Figma: Fun Mobile / qr-code-modal, node\n * 11636:2663). Presented as a nested bottom sheet: a centered \"QR Code\"\n * title (no close button), the framed QR with the selected network's chain\n * logos overlaid in its center, the full deposit address with a\n * \"Copy address\" button, and a \"Done\" primary button that dismisses the sheet.\n *\n * Vertical padding adapts to screen height via {@link useScreenSize} so the\n * sheet doesn't overflow on compact devices (iPhone SE).\n *\n * The scannable QR itself is host-supplied (`qrCode`, e.g.\n * `react-native-qrcode-svg`) so the package stays `react-native-svg`-free;\n * this screen renders the themed frame and the centered chain-logo overlay.\n */\nexport interface QrCodeScreenProps {\n /** The rendered QR code node (host-supplied). */\n qrCode: ReactNode\n /**\n * Chain logos centered on the QR \u2014 the selected network's icons (see\n * {@link QrChainCluster}). Omit to render the QR with no center overlay.\n */\n centerIcon?: ReactNode\n /** The full deposit address shown (wrapping) below the QR. */\n address?: string\n /** How long the \"Copied\" confirmation stays on the Copy button (ms). */\n copiedFeedbackMs?: number\n onClose?: () => void\n /**\n * Copy the full address to the clipboard. Omit to hide the Copy button.\n * May return whether the copy succeeded; when it resolves `false` the\n * \"Copied!\" confirmation is suppressed (a `void` return is treated as\n * success).\n */\n onCopyAddress?: () => void | Promise<boolean>\n}\n\nexport function QrCodeScreen(props: QrCodeScreenProps) {\n const { t } = useFunkitTranslation()\n const {\n qrCode,\n centerIcon,\n address,\n copiedFeedbackMs = 1800,\n onClose,\n onCopyAddress,\n } = props\n const doneLabel = t('common.done')\n const { isShort } = useScreenSize()\n const theme = useTheme()\n\n const [copied, setCopied] = useState(false)\n const copyTimer = useRef<ReturnType<typeof setTimeout>>(undefined)\n\n useEffect(() => () => clearTimeout(copyTimer.current), [])\n\n const handleCopy = async () => {\n // Only confirm \"Copied!\" when the write actually landed: copyToClipboard\n // returns false on its warn-only no-op path (e.g. no clipboard module), so\n // we don't claim success falsely. A void-returning handler is success.\n const ok = await onCopyAddress?.()\n if (ok === false) {\n return\n }\n setCopied(true)\n clearTimeout(copyTimer.current)\n copyTimer.current = setTimeout(() => setCopied(false), copiedFeedbackMs)\n }\n\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={[sheet, { backgroundColor: theme.background.modal }]}\n >\n {/* Top bar: grabber \u00B7 centered title (no back/close in this variant) */}\n <Box alignItems=\"center\" style={topBar}>\n <Grabber />\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {t('qrCode.title')}\n </Text>\n </Box>\n <Box style={{ paddingVertical: isShort ? 0 : 16 }}>\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[content, { paddingVertical: isShort ? 24 : 82 }]}\n >\n <Box\n borderWidth={1.5}\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[\n qrFrame,\n {\n backgroundColor: theme.background.modal,\n borderColor: theme.border.elements.default.color,\n },\n ]}\n >\n {qrCode}\n {centerIcon ? (\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n style={centerOverlay}\n >\n {centerIcon}\n </Box>\n ) : null}\n </Box>\n\n {address ? (\n <Box alignItems=\"center\" style={addressGroup}>\n <Text\n variant=\"body\"\n style={[\n addressText,\n { color: theme.content.elements.secondary },\n ]}\n >\n {address}\n </Text>\n {onCopyAddress ? (\n <Pressable\n onPress={handleCopy}\n accessibilityRole=\"button\"\n accessibilityLabel={\n copied ? t('common.addressCopied') : t('common.copyAddress')\n }\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n borderWidth={1}\n borderRadius=\"element\"\n style={[\n copyButton,\n {\n backgroundColor:\n theme.background.button.secondary.default,\n borderColor: theme.background.button.secondary.default,\n },\n ]}\n >\n <CopyAddressIcon />\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.button.secondary.default }}\n >\n {copied ? t('common.copied') : t('common.copyAddress')}\n </Text>\n </Box>\n </Pressable>\n ) : null}\n </Box>\n ) : null}\n </Box>\n\n <Box style={buttonContainer}>\n <Pressable\n onPress={onClose}\n accessibilityRole=\"button\"\n accessibilityLabel={doneLabel}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius=\"button\"\n style={[\n doneButton,\n { backgroundColor: theme.background.button.primary.default },\n ]}\n >\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.button.primary.default }}\n >\n {doneLabel}\n </Text>\n </Box>\n </Pressable>\n </Box>\n </Box>\n </Box>\n )\n}\n\nconst sheet: ViewStyle = { paddingBottom: 34 }\nconst topBar: ViewStyle = {\n height: 64,\n paddingTop: 25,\n paddingBottom: 12,\n paddingHorizontal: 24,\n}\n// QR card and address group share a 40px gap (Figma `content`).\nconst content: ViewStyle = {\n paddingHorizontal: 20,\n gap: 40,\n}\nconst qrFrame: ViewStyle = {\n width: 275,\n height: 275,\n borderRadius: 20,\n padding: 18,\n // Figma shadow/md: a soft lift under the card.\n shadowColor: '#000',\n shadowOpacity: 0.1,\n shadowOffset: { width: 0, height: 4 },\n shadowRadius: 16,\n elevation: 3,\n}\nconst centerOverlay: ViewStyle = {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n pointerEvents: 'none',\n}\nconst addressGroup: ViewStyle = { gap: 16 }\n// Constrained so the 42-char address wraps to two centered lines (Figma).\nconst addressText: TextStyle = { textAlign: 'center', maxWidth: 220 }\nconst copyButton: ViewStyle = {\n height: 48,\n paddingHorizontal: 20,\n gap: 8,\n}\nconst buttonContainer: ViewStyle = { paddingHorizontal: 20 }\nconst doneButton: ViewStyle = { height: 56, paddingHorizontal: 24 }\n", "import { StyleSheet } from 'react-native'\n\nimport { Box, useTheme } from '../theme/restyle'\n\n/**\n * The bottom-sheet drag affordance. Absolutely positioned so each top bar lays\n * out its own content independently. Sheets rendering this must pass\n * `handleComponent={null}` to gorhom, or its default handle draws a second\n * grabber above it.\n */\nexport function Grabber() {\n const theme = useTheme()\n return (\n <Box\n testID=\"grabber\"\n alignItems=\"center\"\n pointerEvents=\"none\"\n style={styles.overlay}\n >\n <Box\n style={[\n styles.bar,\n { backgroundColor: theme.border.elements.default.color },\n ]}\n />\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n overlay: { position: 'absolute', top: 8, left: 0, right: 0 },\n bar: { width: 36, height: 5, borderRadius: 999 },\n})\n", "import { useWindowDimensions } from 'react-native'\n\nexport function useScreenSize() {\n const { height } = useWindowDimensions()\n\n // Add additional breakpoints as needed (e.g. isTall).\n const isShort = height < 700\n\n return { isShort }\n}\n", "import { SvgXml } from 'react-native-svg'\n\nimport { useTheme } from '../theme/restyle'\n\n// Verbatim port of web's `CopyDoubleRoundedSquareIcon`\n// (`packages/connect/src/components/Icons/CopyDoubleRoundedSquareIcon.tsx`) \u2014\n// two overlapping rounded squares. Kept as inline SVG (rendered via `SvgXml`,\n// like the other connect-rn glyphs) so the package stays asset-free.\n// `stroke=\"currentColor\"` is resolved by the `color` prop below, so the glyph\n// tracks the secondary-button label color.\nconst COPY_ADDRESS_SVG = `<svg viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10.2 5.8V4.26C10.2 3.64394 10.2 3.33591 10.0801 3.10061C9.97465 2.89363 9.80637 2.72535 9.59939 2.61989C9.36409 2.5 9.05606 2.5 8.44 2.5H4.26C3.64394 2.5 3.33591 2.5 3.10061 2.61989C2.89363 2.72535 2.72535 2.89363 2.61989 3.10061C2.5 3.33591 2.5 3.64394 2.5 4.26V8.44C2.5 9.05606 2.5 9.36409 2.61989 9.59939C2.72535 9.80637 2.89363 9.97465 3.10061 10.0801C3.33591 10.2 3.64394 10.2 4.26 10.2H5.8M7.56 13.5H11.74C12.3561 13.5 12.6641 13.5 12.8994 13.3801C13.1064 13.2746 13.2746 13.1064 13.3801 12.8994C13.5 12.6641 13.5 12.3561 13.5 11.74V7.56C13.5 6.94394 13.5 6.63591 13.3801 6.40061C13.2746 6.19363 13.1064 6.02535 12.8994 5.91989C12.6641 5.8 12.3561 5.8 11.74 5.8H7.56C6.94394 5.8 6.63591 5.8 6.40061 5.91989C6.19363 6.02535 6.02535 6.19363 5.91989 6.40061C5.8 6.63591 5.8 6.94394 5.8 7.56V11.74C5.8 12.3561 5.8 12.6641 5.91989 12.8994C6.02535 13.1064 6.19363 13.2746 6.40061 13.3801C6.63591 13.5 6.94394 13.5 7.56 13.5Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>`\n\n/**\n * The \"Copy address\" button glyph \u2014 the RN port of web's\n * `CopyDoubleRoundedSquareIcon`. Renders in the theme's secondary-button label\n * color so it matches the button text.\n */\nexport function CopyAddressIcon({ size = 16 }: { size?: number }) {\n const theme = useTheme()\n return (\n <SvgXml\n xml={COPY_ADDRESS_SVG}\n width={size}\n height={size}\n color={theme.content.button.secondary.default}\n />\n )\n}\n", "import { BottomSheetScrollView } from '@gorhom/bottom-sheet'\nimport type { ReactNode } from 'react'\nimport { Pressable, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { Grabber } from '../components/Grabber'\nimport { ScrollFade, useScrollEdgeFades } from '../components/ScrollFade'\nimport { useNestedSheetHeight } from '../hooks/useNestedSheetHeight'\nimport { ChainAvatar } from '../icons/ChainAvatar'\nimport { FigmaCheckIcon, FigmaChevronLeftIcon } from '../icons/FigmaSystemIcons'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport type { AvailableChain } from '../transfer/availableChains'\n\ninterface ChainListProps {\n chains: AvailableChain[]\n /** Marks a row selected: `background/secondary` fill + a trailing check. */\n selectedChain?: AvailableChain\n onSelectChain?: (chain: AvailableChain) => void\n loading?: boolean\n skeletonCount?: number\n}\n\n/**\n * The \"Deposit crypto\" chain picker \u2014 the first-run variant, shown before the\n * user has chosen a deposit network.\n */\nexport interface SelectChainScreenProps extends ChainListProps {\n onBack?: () => void\n}\n\nexport function SelectChainScreen(props: SelectChainScreenProps) {\n const { t } = useFunkitTranslation()\n const { onBack, ...chainList } = props\n const theme = useTheme()\n const insets = useSafeAreaInsets()\n const sheetHeight = useNestedSheetHeight()\n\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={{\n height: sheetHeight,\n backgroundColor: theme.background.modal,\n paddingBottom: bottomInset(insets.bottom),\n }}\n >\n <Box style={styles.backTopBar}>\n <Grabber />\n <Pressable\n onPress={onBack}\n hitSlop={8}\n accessibilityRole=\"button\"\n accessibilityLabel={t('common.back')}\n style={styles.backPress}\n >\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[\n styles.backButton,\n {\n backgroundColor: theme.background.secondary,\n borderColor: theme.border.elements.default.color,\n },\n ]}\n >\n <FigmaChevronLeftIcon\n size={24}\n color={theme.content.button.icon.default}\n />\n </Box>\n </Pressable>\n </Box>\n\n <ChainList\n {...chainList}\n header={\n <Box style={styles.titleBlock}>\n <Text\n variant=\"bodyMedium\"\n style={[\n styles.titleText,\n { color: theme.content.elements.primary },\n ]}\n >\n {t('selectChain.title')}\n </Text>\n <Text\n variant=\"body\"\n style={{ color: theme.content.elements.secondary }}\n >\n {t('selectChain.subtitle')}\n </Text>\n </Box>\n }\n />\n </Box>\n )\n}\n\n/**\n * The \"Select a chain\" picker \u2014 the same list reopened from Transfer to change\n * networks. Cancel dismisses; the current chain is checked.\n */\nexport interface ChangeChainScreenProps extends ChainListProps {\n onCancel?: () => void\n}\n\nexport function ChangeChainScreen(props: ChangeChainScreenProps) {\n const { t } = useFunkitTranslation()\n const { onCancel, ...chainList } = props\n const theme = useTheme()\n const insets = useSafeAreaInsets()\n const sheetHeight = useNestedSheetHeight()\n const cancelLabel = t('common.cancel')\n\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={{\n height: sheetHeight,\n backgroundColor: theme.background.modal,\n paddingBottom: bottomInset(insets.bottom),\n }}\n >\n <Box alignItems=\"center\" style={styles.titleTopBar}>\n <Grabber />\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {t('changeChain.title')}\n </Text>\n </Box>\n\n <ChainList {...chainList} />\n\n <Box style={styles.buttonContainer}>\n <Pressable\n onPress={onCancel}\n accessibilityRole=\"button\"\n accessibilityLabel={cancelLabel}\n >\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius=\"button\"\n style={[\n styles.cancelButton,\n { backgroundColor: theme.background.button.primary.default },\n ]}\n >\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.button.primary.default }}\n >\n {cancelLabel}\n </Text>\n </Box>\n </Pressable>\n </Box>\n </Box>\n )\n}\n\n/** The scrollable chain rows shared by both pickers. */\nfunction ChainList({\n chains,\n selectedChain,\n onSelectChain,\n loading = false,\n skeletonCount = 8,\n header,\n}: ChainListProps & { header?: ReactNode }) {\n const theme = useTheme()\n const { showTopFade, showBottomFade, scrollProps } = useScrollEdgeFades()\n\n return (\n <View style={styles.scrollArea}>\n <BottomSheetScrollView\n style={styles.list}\n showsVerticalScrollIndicator={false}\n contentContainerStyle={styles.listContent}\n {...scrollProps}\n >\n {header}\n {loading\n ? Array.from({ length: skeletonCount }, (_, index) => (\n <ChainRowSkeleton key={index} />\n ))\n : chains.map((chain) => (\n <ChainRow\n key={chain.id}\n chain={chain}\n selected={chain.id === selectedChain?.id}\n onPress={onSelectChain}\n />\n ))}\n </BottomSheetScrollView>\n {showTopFade ? (\n <ScrollFade edge=\"top\" color={theme.background.modal} id=\"chain-list\" />\n ) : null}\n {showBottomFade ? (\n <ScrollFade\n edge=\"bottom\"\n color={theme.background.modal}\n id=\"chain-list\"\n />\n ) : null}\n </View>\n )\n}\n\nfunction ChainRow({\n chain,\n selected,\n onPress,\n}: {\n chain: AvailableChain\n selected: boolean\n onPress?: (chain: AvailableChain) => void\n}) {\n const theme = useTheme()\n return (\n <Pressable\n onPress={() => onPress?.(chain)}\n accessibilityRole=\"button\"\n accessibilityLabel={chain.name}\n accessibilityState={{ selected }}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n borderRadius=\"element\"\n style={[\n styles.row,\n selected ? { backgroundColor: theme.background.secondary } : null,\n ]}\n >\n <ChainAvatar uri={chain.iconUri} />\n <Box flex={1}>\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n style={{ color: theme.content.elements.primary }}\n >\n {chain.name}\n </Text>\n </Box>\n {selected ? (\n <FigmaCheckIcon size={20} color={theme.content.elements.secondary} />\n ) : null}\n </Box>\n </Pressable>\n )\n}\n\nfunction ChainRowSkeleton() {\n const theme = useTheme()\n return (\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.row}>\n <Box\n style={[\n styles.skeletonIcon,\n { backgroundColor: theme.background.pill.pressed },\n ]}\n />\n <Box flex={1}>\n <Box\n style={[\n styles.skeletonName,\n { backgroundColor: theme.background.pill.pressed },\n ]}\n />\n </Box>\n </Box>\n )\n}\n\n// Devices without a home indicator report a 0 bottom inset, which would leave\n// the cancel button flush against the screen edge.\nconst MIN_BOTTOM_INSET = 16\nconst bottomInset = (inset: number) => Math.max(inset, MIN_BOTTOM_INSET)\n\nconst styles = StyleSheet.create({\n backTopBar: { paddingHorizontal: 20, paddingTop: 20, paddingBottom: 12 },\n backPress: { alignSelf: 'flex-start' },\n // A white fill on the white sheet reads as nothing on device, so the circle\n // takes the secondary surface + hairline.\n backButton: {\n width: 48,\n height: 48,\n borderRadius: 999,\n borderWidth: 1,\n shadowColor: '#000',\n shadowOpacity: 0.05,\n shadowOffset: { width: 0, height: 4 },\n shadowRadius: 8,\n elevation: 2,\n },\n // Same geometry as the Add money sheet.\n titleTopBar: { height: 64, paddingTop: 25, paddingBottom: 12 },\n // Inside the list's 16 inset, so 12 more lines it up with the row text.\n titleBlock: {\n paddingHorizontal: 12,\n paddingTop: 12,\n paddingBottom: 24,\n gap: 2,\n },\n // No theme variant for 21/25; the medium cut rides on `bodyMedium` because an\n // inline fontWeight can't select a custom font's cut in RN/Expo.\n titleText: { fontSize: 21, lineHeight: 25 },\n scrollArea: { flex: 1, position: 'relative' },\n list: { flex: 1, width: '100%' },\n // The trailing buffer keeps the last row clear of the sheet edge.\n listContent: { paddingHorizontal: 16, paddingBottom: 16 },\n row: { gap: 12, paddingHorizontal: 12, paddingVertical: 10 },\n buttonContainer: { paddingHorizontal: 20, paddingTop: 8 },\n cancelButton: { height: 56, paddingHorizontal: 24 },\n skeletonIcon: { width: 36, height: 36, borderRadius: 999 },\n skeletonName: { width: 157, height: 16, borderRadius: 4 },\n})\n", "import { useRef, useState } from 'react'\nimport type {\n LayoutChangeEvent,\n NativeScrollEvent,\n NativeSyntheticEvent,\n} from 'react-native'\nimport { StyleSheet, View } from 'react-native'\nimport Svg, { Defs, LinearGradient, Rect, Stop } from 'react-native-svg'\n\n// Height of the full-width edge gradient.\nconst SCROLL_FADE_HEIGHT = 42\n\n// Keeps sub-pixel offsets from flipping a fade on/off at the very top/bottom.\nconst SCROLL_EPSILON = 1\n\n/**\n * Fades a scrolling list into the modal surface at one edge. Uses\n * react-native-svg since RN has no CSS gradient. Pair with\n * `useScrollEdgeFades` to decide when each edge shows.\n */\nexport function ScrollFade({\n edge,\n color,\n id,\n}: {\n edge: 'top' | 'bottom'\n color: string\n /** Gradient id prefix \u2014 must be unique per screen on one mounted tree. */\n id: string\n}) {\n const gradientId = `${id}-fade-${edge}`\n const topOpaque = edge === 'top'\n return (\n <View\n pointerEvents=\"none\"\n style={[styles.fade, edge === 'top' ? { top: 0 } : { bottom: 0 }]}\n >\n <Svg width=\"100%\" height=\"100%\">\n <Defs>\n <LinearGradient id={gradientId} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <Stop\n offset=\"0\"\n stopColor={color}\n stopOpacity={topOpaque ? 1 : 0}\n />\n <Stop\n offset=\"1\"\n stopColor={color}\n stopOpacity={topOpaque ? 0 : 1}\n />\n </LinearGradient>\n </Defs>\n <Rect\n x=\"0\"\n y=\"0\"\n width=\"100%\"\n height=\"100%\"\n fill={`url(#${gradientId})`}\n />\n </Svg>\n </View>\n )\n}\n\n/**\n * Tracks which edges of a `ScrollView` still have content beyond them, for\n * `ScrollFade`. Spread `scrollProps` onto the `ScrollView`.\n */\nexport function useScrollEdgeFades() {\n const [showTopFade, setShowTopFade] = useState(false)\n const [showBottomFade, setShowBottomFade] = useState(false)\n const metrics = useRef({ scrollY: 0, viewportH: 0, contentH: 0 })\n\n const recomputeFades = () => {\n const { scrollY, viewportH, contentH } = metrics.current\n const overflows = contentH > viewportH + SCROLL_EPSILON\n setShowTopFade(overflows && scrollY > SCROLL_EPSILON)\n setShowBottomFade(\n overflows && scrollY + viewportH < contentH - SCROLL_EPSILON,\n )\n }\n\n const onScroll = (e: NativeSyntheticEvent<NativeScrollEvent>) => {\n metrics.current.scrollY = e.nativeEvent.contentOffset.y\n recomputeFades()\n }\n const onLayout = (e: LayoutChangeEvent) => {\n metrics.current.viewportH = e.nativeEvent.layout.height\n recomputeFades()\n }\n const onContentSizeChange = (_w: number, h: number) => {\n metrics.current.contentH = h\n // A shorter replacement list can clamp the native offset without firing\n // onScroll, so re-clamp scrollY to the new max or the bottom fade may hide\n // while the list still overflows.\n metrics.current.scrollY = Math.min(\n metrics.current.scrollY,\n Math.max(0, h - metrics.current.viewportH),\n )\n recomputeFades()\n }\n\n return {\n showTopFade,\n showBottomFade,\n scrollProps: { onScroll, onLayout, onContentSizeChange },\n }\n}\n\nconst styles = StyleSheet.create({\n fade: {\n position: 'absolute',\n left: 0,\n right: 0,\n height: SCROLL_FADE_HEIGHT,\n },\n})\n", "import { useWindowDimensions } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\n/**\n * Fills a nested sheet \u2014 the same `insets.top` its `BottomSheetModal` is capped\n * by, so the screen and the sheet can't drift apart. A `FlowSheet` step waives\n * that cap (`topInset={0}`) and takes the whole window instead.\n */\nexport function useNestedSheetHeight() {\n const { height } = useWindowDimensions()\n const insets = useSafeAreaInsets()\n return height - insets.top\n}\n", "import { StyleSheet } from 'react-native'\n\nimport { Box } from '../theme/restyle'\nimport { FALLBACK_ASSET_LOGO } from './assetLogos'\nimport { FunIcon } from './FunIcon'\n\nexport interface ChainAvatarProps {\n /** Full CDN logo URL, e.g. `chainIconUri('base')`. */\n uri: string\n size?: number\n}\n\n/**\n * A chain logo clipped to a circle with a hairline border. Centering a same-size\n * {@link FunIcon} keeps it from sitting 1px off, since the border-box hairline\n * shrinks the content box.\n */\nexport function ChainAvatar({ uri, size = 36 }: ChainAvatarProps) {\n return (\n <Box style={[styles.ring, { width: size, height: size }]}>\n <FunIcon uri={uri} size={size} fallbackUri={FALLBACK_ASSET_LOGO} />\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n // `border/icon` has no dark-mode counterpart in the token export, so it isn't\n // in tokens.ts and the hairline stays a literal.\n ring: {\n borderRadius: 999,\n borderWidth: 1,\n borderColor: 'rgba(0,0,0,0.1)',\n overflow: 'hidden',\n alignItems: 'center',\n justifyContent: 'center',\n },\n})\n", "import { type ReactNode, useEffect, useRef, useState } from 'react'\nimport { Animated, Pressable, ScrollView, type ViewStyle } from 'react-native'\n// `Animated` (above) is React Native's legacy API, still used by the loading\n// pulse. The \"Deposit to\" dropdown motion uses `react-native-reanimated`,\n// imported here as `Reanimated` so the two namespaces don't collide.\nimport Reanimated, {\n Easing,\n Keyframe,\n useAnimatedStyle,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated'\n\nimport { FigmaCheckIcon, FigmaChevronDownIcon } from '../icons/FigmaSystemIcons'\nimport { StatusIcon } from '../icons/StatusIcon'\nimport { usePulse } from '../hooks/usePulse'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\n// Motion tokens for the \"Deposit to\" dropdown open/close \u2014 transitions.dev\n// `menu-dropdown` recipe translated to reanimated. The web recipe grows the\n// menu from its trigger (transform-origin top, scale 0.97\u21921, opacity 0\u21921); RN\n// has no transform-origin, so a small translateY (-4\u21920) gives the same\n// \"emerging from the trigger top\" read. Open = Fast (250ms), close = Quick\n// (150ms), Smooth ease-out easing (cubic-bezier(0.22, 1, 0.36, 1)).\nconst DROPDOWN_OPEN_DURATION = 250\nconst DROPDOWN_CLOSE_DURATION = 150\nconst DROPDOWN_EASING = Easing.bezier(0.22, 1, 0.36, 1)\nconst DROPDOWN_PRE_SCALE = 0.97\nconst DROPDOWN_TRANSLATE_Y = -4\n\nconst AnimatedPressable = Reanimated.createAnimatedComponent(Pressable)\n\n// The menu is conditionally rendered (closed = unmounted), so the open/close\n// motion rides reanimated layout animations \u2014 `entering` on mount, `exiting`\n// on unmount \u2014 the same pattern as AddressCopiedToast. Enter grows from the\n// trigger top (opacity + scale 0.97\u21921 + translateY -4\u21920); exit reverses it.\n// Easing lives on the destination keyframe (per reanimated's Keyframe API).\nconst menuEnter = new Keyframe({\n 0: {\n opacity: 0,\n transform: [\n { translateY: DROPDOWN_TRANSLATE_Y },\n { scale: DROPDOWN_PRE_SCALE },\n ],\n },\n 100: {\n opacity: 1,\n transform: [{ translateY: 0 }, { scale: 1 }],\n easing: DROPDOWN_EASING,\n },\n}).duration(DROPDOWN_OPEN_DURATION)\nconst menuExit = new Keyframe({\n 0: {\n opacity: 1,\n transform: [{ translateY: 0 }, { scale: 1 }],\n },\n 100: {\n opacity: 0,\n transform: [\n { translateY: DROPDOWN_TRANSLATE_Y },\n { scale: DROPDOWN_PRE_SCALE },\n ],\n easing: DROPDOWN_EASING,\n },\n}).duration(DROPDOWN_CLOSE_DURATION)\n// The dimming scrim fades in/out (opacity only) in sync with the menu.\nconst scrimEnter = new Keyframe({\n 0: { opacity: 0 },\n 100: { opacity: 1, easing: DROPDOWN_EASING },\n}).duration(DROPDOWN_OPEN_DURATION)\nconst scrimExit = new Keyframe({\n 0: { opacity: 1 },\n 100: { opacity: 0, easing: DROPDOWN_EASING },\n}).duration(DROPDOWN_CLOSE_DURATION)\n\n/**\n * One selectable funding source in {@link SelectMethodScreen}. Brand icons are\n * host-supplied (`icon` / `trailing`) so the package stays asset- and\n * `react-native-svg`-free; the screen renders a themed circular slot for each.\n */\nexport interface PaymentMethodOption {\n /** Stable id passed back to `onSelectMethod`. */\n id: string\n title: string\n /** Secondary line: balance, limit, timing, etc. */\n subtitle?: string\n /** Leading icon, centered in the themed circle. */\n icon?: ReactNode\n /** Trailing accessory, e.g. a token cluster for the Crypto row. */\n trailing?: ReactNode\n /**\n * Shown but not selectable \u2014 e.g. a cash payout whose minimum the balance\n * can't meet. Dimmed rather than hidden so the option stays discoverable.\n */\n disabled?: boolean\n}\n\n/**\n * One option in the \"Deposit to\" receive-token dropdown (Figma: Fun Mobile /\n * Add money). Mirrors web's `ReceiveTokenDropdown` items. The icon is supplied\n * by the flow (keeping this screen asset-free) and `label` is the composed\n * destination text, e.g. `\"USDG (Perps)\"`.\n */\nexport interface ReceiveTokenOption {\n id: string\n label: string\n icon?: ReactNode\n}\n\nexport interface SelectMethodScreenProps {\n methods: PaymentMethodOption[]\n onSelectMethod: (id: string) => void\n /** Sheet title \u2014 the caller owns the copy (\"Add money\" vs \"Withdraw\"). */\n title: string\n /**\n * Receive-token candidates shown in the \"Deposit to\" dropdown above the\n * payment methods (web: `ReceiveTokenDropdown`). When set, the screen shows\n * the dropdown + a \"Pay with\" section label. Omit to render just the\n * methods list (back-compat with hosts that don't pass candidates).\n */\n receiveTokens?: ReceiveTokenOption[]\n selectedReceiveTokenId?: string\n onSelectReceiveToken?: (id: string) => void\n /**\n * Show the loading skeleton instead of the method list (Figma: Fun Mobile /\n * Add money, loading). Set while the funding sources are still being fetched\n * (e.g. the Swapped cash methods) so the list doesn't pop in row-by-row.\n */\n loading?: boolean\n /**\n * Number of skeleton rows rendered while `loading`. Defaults to 5 when the\n * deposit selector shows, 6 otherwise (it reclaims the selector's room).\n */\n skeletonCount?: number\n /**\n * Show the error state instead of the list (Figma: Fun Mobile / Add money,\n * error) \u2014 a \"Something went wrong\" message + a \"Try again\" button. Takes\n * precedence over `loading`. Set when fetching the funding sources failed.\n */\n error?: boolean\n /** \"Try again\" handler shown with the error state. */\n onRetry?: () => void\n /** Error-state copy \u2014 the caller owns it (generic fetch failure vs\n withdraw's terminal states). */\n errorTitle: string\n errorMessage: string\n /**\n * Open the \"Deposit to\" dropdown on mount. For previews/tests of the expanded\n * state (Figma node 11200:8055); hosts leave this `false` and let the user\n * tap the trigger.\n */\n initialDropdownOpen?: boolean\n /**\n * Secondary line under the list, for why part of it is missing (web's\n * `NoCashMethodsNote`). A note, not a takeover: the rows that DID load stay\n * usable.\n */\n note?: string\n}\n\n/**\n * The \"Add money\" funding-source picker (Figma: Fun Mobile / Add money). A\n * bottom-sheet-style surface \u2014 grabber + centered title + a scrollable list of\n * payment methods \u2014 built from the connect-rn Restyle theme so it tracks the\n * active light/dark scheme. Selecting a method (e.g. Crypto) routes the host to\n * the next screen (Transfer/UDA).\n *\n * When `receiveTokens` are given, a fixed \"Deposit to\" selector sits above the\n * scrollable list. Opening it floats the option list as an overlay (it does\n * NOT reflow the list) over a dimming scrim \u2014 matching web's\n * `ReceiveTokenDropdown`.\n */\nexport function SelectMethodScreen(props: SelectMethodScreenProps) {\n const { t } = useFunkitTranslation()\n const {\n methods,\n onSelectMethod,\n title,\n loading = false,\n skeletonCount,\n error = false,\n onRetry,\n note,\n errorTitle,\n errorMessage,\n receiveTokens,\n selectedReceiveTokenId,\n onSelectReceiveToken,\n initialDropdownOpen = false,\n } = props\n const theme = useTheme()\n const selected = receiveTokens?.find((t) => t.id === selectedReceiveTokenId)\n const showDropdown = receiveTokens && receiveTokens.length > 0 && selected\n\n // Dropdown open-state lives here (not in the dropdown) so the screen can lay\n // a dimming scrim over the whole sheet while the option list floats above it.\n const [dropdownOpen, setDropdownOpen] = useState(initialDropdownOpen)\n const scrimVisible = !error && showDropdown && dropdownOpen\n\n // The rows are the same in both layouts; only the chrome around them differs\n // (bordered \"Pay with\" card vs. a bare scrolling list).\n const methodRows = methods.map((method, i) => (\n <Box key={method.id}>\n {i > 0 ? <MethodDivider /> : null}\n <Pressable\n onPress={method.disabled ? undefined : () => onSelectMethod(method.id)}\n disabled={method.disabled}\n accessibilityRole=\"button\"\n accessibilityLabel={method.title}\n accessibilityState={{ disabled: !!method.disabled }}\n style={\n method.disabled\n ? { opacity: theme.opacity.disabled / 100 }\n : undefined\n }\n >\n <PaymentMethodRow method={method} />\n </Pressable>\n </Box>\n ))\n\n // Sits with the rows, inside the same scroll content \u2014 after the list it would\n // be laid out past the sheet's measured height and render outside it.\n const noteText = note ? (\n <Box style={noteBox}>\n <Text\n variant=\"detail\"\n style={{ color: theme.content.elements.secondary }}\n >\n {note}\n </Text>\n </Box>\n ) : null\n\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={{ backgroundColor: theme.background.modal }}\n >\n <Box alignItems=\"center\" style={topBar}>\n <Box\n style={[\n grabber,\n { backgroundColor: theme.border.elements.default.color },\n ]}\n />\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {title}\n </Text>\n </Box>\n\n {error ? (\n <SelectMethodError\n title={errorTitle}\n message={errorMessage}\n onRetry={onRetry}\n />\n ) : loading ? (\n <SelectMethodLoading\n count={skeletonCount}\n showDropdown={Boolean(showDropdown)}\n />\n ) : (\n <>\n {/* Fixed \"Deposit to\" selector. Sits above the scrollable list and\n stays above the scrim (so it reads bright while the rest dims). */}\n {showDropdown ? (\n <Box style={depositSection}>\n <Box style={sectionLabel}>\n <Text\n variant=\"detail\"\n weight=\"medium\"\n style={{ color: theme.content.elements.secondary }}\n >\n {t('selectMethod.depositTo')}\n </Text>\n </Box>\n <ReceiveTokenDropdown\n tokens={receiveTokens}\n selected={selected}\n open={dropdownOpen}\n onToggle={() => setDropdownOpen((o) => !o)}\n onSelect={(id) => {\n onSelectReceiveToken?.(id)\n setDropdownOpen(false)\n }}\n />\n </Box>\n ) : null}\n\n {showDropdown ? (\n // \"Pay with\" section: a labeled, bordered card wrapping the method\n // rows with hairline dividers between them (Figma node 11202:8282).\n <Box style={payWithSection}>\n <Box style={sectionLabel}>\n <Text\n variant=\"detail\"\n weight=\"medium\"\n style={{ color: theme.content.elements.secondary }}\n >\n {t('selectMethod.payWith')}\n </Text>\n </Box>\n <Box\n borderWidth={1}\n borderRadius=\"element\"\n style={[\n methodsCard,\n {\n backgroundColor: theme.background.modal,\n borderColor: theme.border.elements.default.color,\n },\n ]}\n >\n {methodRows}\n </Box>\n {noteText}\n </Box>\n ) : (\n // Methods-only: bare rows with full-width hairline dividers, no\n // outer border (Figma node 11202:8632).\n <ScrollView\n contentContainerStyle={listContent}\n showsVerticalScrollIndicator={false}\n >\n {methodRows}\n {noteText}\n </ScrollView>\n )}\n </>\n )}\n\n {/* Dimming scrim (Figma: background-overlay, rgba(0,0,0,0.2)). Sits below\n the deposit selector + option list but above the rest of the sheet;\n tapping it closes the dropdown. */}\n {scrimVisible ? (\n <AnimatedPressable\n entering={scrimEnter}\n exiting={scrimExit}\n style={scrim}\n onPress={() => setDropdownOpen(false)}\n accessibilityRole=\"button\"\n accessibilityLabel={t('common.close')}\n />\n ) : null}\n </Box>\n )\n}\n\nfunction SelectMethodError({\n title,\n message,\n onRetry,\n}: {\n title: string\n message: string\n onRetry?: () => void\n}) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const retryLabel = t('common.tryAgain')\n return (\n <Box alignItems=\"center\" justifyContent=\"center\" style={errorContainer}>\n <StatusIcon />\n <Box alignItems=\"center\" style={errorText}>\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {title}\n </Text>\n <Text\n variant=\"detail\"\n style={[\n errorMessageText,\n { color: theme.content.elements.secondary },\n ]}\n >\n {message}\n </Text>\n </Box>\n {/* No handler \u2192 non-retryable state (e.g. withdrawals unavailable in\n region): show the message alone instead of a dead button. */}\n {onRetry ? (\n <Pressable\n onPress={onRetry}\n accessibilityRole=\"button\"\n accessibilityLabel={retryLabel}\n >\n <Box\n borderRadius=\"button\"\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[\n retryButton,\n { backgroundColor: theme.background.button.primary.default },\n ]}\n >\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.button.primary.default }}\n >\n {retryLabel}\n </Text>\n </Box>\n </Pressable>\n ) : null}\n </Box>\n )\n}\n\nfunction PaymentMethodRow({ method }: { method: PaymentMethodOption }) {\n const theme = useTheme()\n return (\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n gap=\"elementsHorizontal\"\n style={row}\n >\n <Box width={48} height={48} alignItems=\"center\" justifyContent=\"center\">\n {method.icon}\n </Box>\n <Box flex={1} style={details}>\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {method.title}\n </Text>\n {method.subtitle ? (\n <Text\n variant=\"detail\"\n style={{ color: theme.content.elements.secondary }}\n >\n {method.subtitle}\n </Text>\n ) : null}\n </Box>\n {method.trailing}\n </Box>\n )\n}\n\n/**\n * Hairline divider between method rows (Figma `line-container`, 1px\n * `border/elements/default`), spanning the full row width.\n */\nfunction MethodDivider() {\n const theme = useTheme()\n return (\n <Box\n style={[\n divider,\n { backgroundColor: theme.border.elements.default.color },\n ]}\n />\n )\n}\n\n/**\n * The \"Deposit to\" receive-token dropdown (Figma: Fun Mobile / Add money) \u2014\n * RN analogue of web's `ReceiveTokenDropdown`. A bordered trigger pill\n * (icon + label + chevron); when `open`, the option list floats below it as an\n * absolute overlay (`top: '100%'`) so it never reflows the list underneath.\n * Open-state is controlled by the screen (which also lays the scrim).\n */\nfunction ReceiveTokenDropdown({\n tokens,\n selected,\n open,\n onToggle,\n onSelect,\n}: {\n tokens: ReceiveTokenOption[]\n selected: ReceiveTokenOption\n open: boolean\n onToggle: () => void\n onSelect: (id: string) => void\n}) {\n const theme = useTheme()\n const selectable = tokens.length > 1\n\n return (\n <Box style={dropdownAnchor}>\n <Pressable\n onPress={selectable ? onToggle : undefined}\n accessibilityRole=\"button\"\n accessibilityLabel={selected.label}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n borderWidth={1}\n borderRadius=\"element\"\n style={[\n dropdownTrigger,\n {\n backgroundColor: theme.background.modal,\n borderColor: theme.border.elements.default.color,\n },\n ]}\n >\n <Box flexDirection=\"row\" alignItems=\"center\" style={triggerLeft}>\n {selected.icon ?? <ReceiveTokenIconFallback />}\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n style={[triggerLabel, { color: theme.content.elements.primary }]}\n >\n {selected.label}\n </Text>\n </Box>\n {selectable ? <AnimatedChevron open={open} /> : null}\n </Box>\n </Pressable>\n {open && selectable ? (\n <Reanimated.View\n entering={menuEnter}\n exiting={menuExit}\n style={dropdownMenuOverlay}\n >\n <Box\n borderRadius=\"element\"\n style={[dropdownMenu, { backgroundColor: theme.background.modal }]}\n >\n {tokens.map((token) => (\n <Pressable\n key={token.id}\n onPress={() => onSelect(token.id)}\n accessibilityRole=\"menuitem\"\n accessibilityLabel={token.label}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n style={dropdownItem}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n style={triggerLeft}\n >\n {token.icon ?? <ReceiveTokenIconFallback />}\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {token.label}\n </Text>\n </Box>\n {token.id === selected.id ? <CheckIcon /> : null}\n </Box>\n </Pressable>\n ))}\n </Box>\n </Reanimated.View>\n ) : null}\n </Box>\n )\n}\n\nfunction ReceiveTokenIconFallback() {\n const theme = useTheme()\n return (\n <Box\n width={24}\n height={24}\n borderRadius=\"rounded\"\n style={{ backgroundColor: theme.background.pill.pressed }}\n />\n )\n}\n\nfunction ChevronDownIcon() {\n return <FigmaChevronDownIcon size={16} />\n}\n\n/**\n * The trigger chevron, rotated ~180\u00B0 while the dropdown is open (same\n * timing/easing as the menu) so it reads as flipping up as the menu opens.\n */\nfunction AnimatedChevron({ open }: { open: boolean }) {\n const rotation = useSharedValue(open ? 1 : 0)\n useEffect(() => {\n rotation.value = withTiming(open ? 1 : 0, {\n duration: open ? DROPDOWN_OPEN_DURATION : DROPDOWN_CLOSE_DURATION,\n easing: DROPDOWN_EASING,\n })\n }, [open, rotation])\n // Spelled out because the plugin workletizes by the hook's name, which esbuild\n // renames once a second module imports it \u2014 this worked on import order alone.\n const style = useAnimatedStyle(() => {\n 'worklet'\n return { transform: [{ rotate: `${rotation.value * 180}deg` }] }\n })\n return (\n <Reanimated.View style={style}>\n <FigmaChevronDownIcon size={16} />\n </Reanimated.View>\n )\n}\n\nfunction CheckIcon() {\n return <FigmaCheckIcon size={16} />\n}\n\n/**\n * Loading skeleton for the Add money screen. Mirrors the populated layout so\n * content swaps in without a shift: when `showDropdown`, a \"Deposit to\"\n * selector skeleton + \"Pay with\" label sit above the method skeletons (matching\n * the loaded view's sections); otherwise just the method skeletons. Shapes\n * pulse opacity in sync; labels + chevron stay static.\n */\nfunction SelectMethodLoading({\n count,\n showDropdown,\n}: {\n count?: number\n showDropdown: boolean\n}) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const opacity = usePulse()\n // The deposit selector takes vertical room, so fewer method rows fit.\n const rowCount = count ?? (showDropdown ? 5 : 6)\n return (\n <>\n {showDropdown ? (\n <Box style={depositSection}>\n <Box style={sectionLabel}>\n <Text\n variant=\"detail\"\n style={{ color: theme.content.elements.secondary }}\n >\n {t('selectMethod.depositTo')}\n </Text>\n </Box>\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n borderWidth={1}\n borderRadius=\"element\"\n style={[\n dropdownTrigger,\n {\n backgroundColor: theme.background.modal,\n borderColor: theme.border.elements.default.color,\n },\n ]}\n >\n <Animated.View style={[loadingSelectorLeft, { opacity }]}>\n <Box\n width={20}\n height={20}\n borderRadius=\"rounded\"\n style={{ backgroundColor: theme.background.pill.pressed }}\n />\n <Box\n style={[\n skeletonTitleBar,\n { backgroundColor: theme.background.pill.pressed },\n ]}\n />\n </Animated.View>\n <ChevronDownIcon />\n </Box>\n </Box>\n ) : null}\n\n {showDropdown ? (\n <Box style={payWithSection}>\n <Box style={sectionLabel}>\n <Text\n variant=\"detail\"\n style={{ color: theme.content.elements.secondary }}\n >\n {t('selectMethod.payWith')}\n </Text>\n </Box>\n <Box\n borderWidth={1}\n borderRadius=\"element\"\n style={[\n methodsCard,\n {\n backgroundColor: theme.background.modal,\n borderColor: theme.border.elements.default.color,\n },\n ]}\n >\n <Animated.View\n style={{ opacity }}\n accessibilityLabel={t('selectMethod.loadingMethods')}\n >\n {Array.from({ length: rowCount }, (_, i) => (\n <PaymentMethodRowSkeleton key={i} />\n ))}\n </Animated.View>\n </Box>\n </Box>\n ) : (\n <Box style={skeletonListContent}>\n <Animated.View\n style={{ opacity }}\n accessibilityLabel={t('selectMethod.loadingMethods')}\n >\n {Array.from({ length: rowCount }, (_, i) => (\n <PaymentMethodRowSkeleton key={i} />\n ))}\n </Animated.View>\n </Box>\n )}\n </>\n )\n}\n\n/**\n * One skeleton row in the loading list (Figma node 11333:2346): a fixed 68px\n * row (48px circular leading slot + 10px vertical padding) plus two stacked\n * bars (157\u00D716, 83\u00D714, 4px gap) \u2014 the exact Figma loading geometry.\n */\nfunction PaymentMethodRowSkeleton() {\n const theme = useTheme()\n return (\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n gap=\"elementsHorizontal\"\n style={skeletonRow}\n >\n <Box\n width={48}\n height={48}\n borderRadius=\"rounded\"\n style={{ backgroundColor: theme.background.pill.pressed }}\n />\n <Box flex={1} style={skeletonDetails}>\n <Box\n style={[\n skeletonTitleBar,\n { backgroundColor: theme.background.pill.pressed },\n ]}\n />\n <Box\n style={[\n skeletonSubtitleBar,\n { backgroundColor: theme.background.pill.pressed },\n ]}\n />\n </Box>\n </Box>\n )\n}\n\nconst topBar: ViewStyle = { height: 64, paddingTop: 25, paddingBottom: 12 }\nconst grabber: ViewStyle = {\n position: 'absolute',\n top: 8,\n width: 36,\n height: 5,\n borderRadius: 999,\n}\n// Methods-only list (Figma node 11202:8632): rows padded 16 horizontal, no\n// outer border, hairline dividers between them.\n// Gap between the last row and the screen bottom (Figma / design review).\nconst BOTTOM_GAP = 50\nconst listContent: ViewStyle = {\n paddingHorizontal: 16,\n paddingBottom: BOTTOM_GAP,\n}\n// list-item/base: 12px padding all sides (Figma), gap 12 between leading slot\n// and details supplied by the Box `gap` prop.\nconst row: ViewStyle = { padding: 12 }\nconst details: ViewStyle = { gap: 2 }\n// The fixed deposit selector. zIndex keeps it (and its overlaid option list)\n// above the scrim; the rest of the sheet sits below it and dims.\nconst depositSection: ViewStyle = {\n paddingHorizontal: 16,\n zIndex: 2,\n}\n// \"Pay with\" section: label + bordered method card, 12px gap between (Figma\n// node 11202:8279, pt-12 on the section).\nconst payWithSection: ViewStyle = {\n paddingHorizontal: 16,\n paddingTop: 12,\n paddingBottom: BOTTOM_GAP,\n}\n// Label rows sit with 12px horizontal padding so they align with the row text\n// inside the cards/triggers below them (Figma px-12 on the label).\nconst sectionLabel: ViewStyle = { paddingHorizontal: 12, paddingBottom: 6 }\n// Bordered card wrapping the method rows (Figma node 11202:8282): py-2 inset so\n// the first/last rows clear the rounded corners.\nconst methodsCard: ViewStyle = { paddingVertical: 2, overflow: 'hidden' }\n\n// The enclosing section already pads 16 horizontally; the extra 12 aligns the\n// note with the row text above it, as the section labels do.\nconst noteBox: ViewStyle = { paddingHorizontal: 12, paddingTop: 12 }\n// Hairline divider between rows.\nconst divider: ViewStyle = { height: 1 }\nconst dropdownAnchor: ViewStyle = { position: 'relative' }\nconst dropdownTrigger: ViewStyle = { height: 48, paddingHorizontal: 12 }\nconst triggerLeft: ViewStyle = { gap: 6, flex: 1 }\nconst triggerLabel: ViewStyle = { flex: 1 }\n// Floating option list: anchored just below the trigger as an overlay, so it\n// never reflows the method list. The animated wrapper owns the positioning\n// (and the open/close transform + opacity); the inner Box owns the surface.\nconst dropdownMenuOverlay: ViewStyle = {\n position: 'absolute',\n top: '100%',\n left: 0,\n right: 0,\n marginTop: 4,\n zIndex: 30,\n}\n// shadow/lg from Figma (0,8 / blur 32\u219216 radius / rgba(0,0,0,0.12)); no border.\n// Kept on the surface Box (which has a background) so the iOS shadow renders.\nconst dropdownMenu: ViewStyle = {\n shadowColor: '#000',\n shadowOpacity: 0.12,\n shadowOffset: { width: 0, height: 8 },\n shadowRadius: 16,\n elevation: 8,\n}\nconst dropdownItem: ViewStyle = { height: 48, paddingHorizontal: 12 }\nconst scrim: ViewStyle = {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: 'rgba(0,0,0,0.2)',\n zIndex: 1,\n}\nconst errorContainer: ViewStyle = {\n height: 468,\n gap: 24,\n paddingHorizontal: 16,\n}\nconst errorText: ViewStyle = { gap: 8 }\nconst errorMessageText = { textAlign: 'center' } as const\nconst retryButton: ViewStyle = { height: 48, paddingHorizontal: 20 }\n// The loading list (Figma node 11333:2342): same horizontal/bottom padding as\n// the loaded list (so the sheet doesn't jump height when loading finishes) but\n// no inter-row gap \u2014 the 68px skeleton rows stack flush (their py-10 supplies\n// the breathing room), matching the Figma frame exactly.\nconst skeletonListContent: ViewStyle = {\n paddingHorizontal: 16,\n paddingBottom: BOTTOM_GAP,\n}\n// Figma list-item/base: 12px padding all sides (48px leading circle + 12 each\n// side = 72px row). No inter-row gap; rows abut directly inside the card.\nconst skeletonRow: ViewStyle = { padding: 12 }\n// Row layout for the skeleton selector's left (Animated.View takes no Restyle\n// props, so flexDirection lives here, not as a prop).\nconst loadingSelectorLeft: ViewStyle = {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 6,\n flex: 1,\n}\nconst skeletonDetails: ViewStyle = { gap: 4 }\nconst skeletonTitleBar: ViewStyle = { width: 157, height: 16, borderRadius: 4 }\nconst skeletonSubtitleBar: ViewStyle = {\n width: 83,\n height: 14,\n borderRadius: 4,\n}\n", "import { useEffect, useRef } from 'react'\nimport { Animated } from 'react-native'\n\nconst PULSE_DURATION_MS = 700\nconst PULSE_MIN_OPACITY = 0.5\n\n/**\n * The breathing opacity every loading placeholder shares, so two skeletons on\n * screen at once pulse as one thing rather than two.\n */\nexport function usePulse() {\n const opacity = useRef(new Animated.Value(1)).current\n useEffect(() => {\n const loop = Animated.loop(\n Animated.sequence([\n Animated.timing(opacity, {\n toValue: PULSE_MIN_OPACITY,\n duration: PULSE_DURATION_MS,\n useNativeDriver: true,\n }),\n Animated.timing(opacity, {\n toValue: 1,\n duration: PULSE_DURATION_MS,\n useNativeDriver: true,\n }),\n ]),\n )\n loop.start()\n return () => loop.stop()\n }, [opacity])\n return opacity\n}\n", "import { type ReactNode, useEffect, useRef, useState } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { Grabber } from '../components/Grabber'\nimport { SelectedChainRow } from '../components/SelectedChainRow'\nimport {\n FigmaChevronLeftIcon,\n FigmaCopyIcon,\n FigmaQrScanIcon,\n FigmaShareIcon,\n} from '../icons/FigmaSystemIcons'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\n/**\n * The Transfer Crypto / Universal-Deposit-Address screen. A themed bottom-sheet\n * surface: a back + QR top bar, the tappable selected-chain card, a centered\n * deposit-address card with the chain's minimum, and full-width Copy / Share\n * buttons. UI only \u2014 the host wires the data + callbacks (the deposit-address\n * resolution lives in the transfer hooks).\n */\nexport interface TransferCryptoScreenProps {\n /** Pre-formatted deposit address, e.g. `0x7854...5139F0`. */\n depositAddress: string\n /** The chain the address was generated for, with its minimum-deposit label. */\n selectedChain: { name: string; iconUri: string; minLabel?: string }\n /** How long the \"Copied\" confirmation stays on the Copy button (ms). */\n copiedFeedbackMs?: number\n /** Leading top-bar action \u2014 returns to the Add money screen. */\n onBack?: () => void\n onShowQrCode?: () => void\n /** Tapping the selected-chain card (opens the chain picker). */\n onChangeChain?: () => void\n onCopyAddress?: () => void\n onShareAddress?: () => void\n}\n\nexport function TransferCryptoScreen(props: TransferCryptoScreenProps) {\n const { t } = useFunkitTranslation()\n const {\n depositAddress,\n selectedChain,\n copiedFeedbackMs = 1800,\n onBack,\n onShowQrCode,\n onChangeChain,\n onCopyAddress,\n onShareAddress,\n } = props\n const theme = useTheme()\n const insets = useSafeAreaInsets()\n const [copied, setCopied] = useState(false)\n const copyTimer = useRef<ReturnType<typeof setTimeout>>(undefined)\n\n useEffect(() => () => clearTimeout(copyTimer.current), [])\n\n const handleCopy = () => {\n onCopyAddress?.()\n setCopied(true)\n clearTimeout(copyTimer.current)\n copyTimer.current = setTimeout(() => setCopied(false), copiedFeedbackMs)\n }\n\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={{ backgroundColor: theme.background.modal }}\n >\n {/* Top bar: back \u00B7 title \u00B7 QR */}\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.topBar}>\n <Grabber />\n <Pressable\n onPress={onBack}\n hitSlop={12}\n accessibilityRole=\"button\"\n accessibilityLabel={t('common.back')}\n >\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n style={styles.iconButton}\n >\n <FigmaChevronLeftIcon />\n </Box>\n </Pressable>\n <Box flex={1} alignItems=\"center\">\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {t('transferCrypto.title')}\n </Text>\n </Box>\n <Pressable\n onPress={onShowQrCode}\n hitSlop={12}\n accessibilityRole=\"button\"\n accessibilityLabel={t('transferCrypto.showQrCode')}\n >\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n style={styles.iconButton}\n >\n <FigmaQrScanIcon />\n </Box>\n </Pressable>\n </Box>\n\n <Box style={[styles.content, { paddingBottom: insets.bottom + 16 }]}>\n <SelectedChainRow\n label={t('transferCrypto.selectedChain')}\n name={selectedChain.name}\n iconUri={selectedChain.iconUri}\n accessibilityLabel={t('transferCrypto.changeChain')}\n onPress={onChangeChain}\n />\n\n <Box alignItems=\"center\" style={styles.addressRegion}>\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n borderWidth={1}\n borderRadius=\"element\"\n style={[\n styles.addressCard,\n {\n backgroundColor: theme.background.modal,\n borderColor: theme.border.elements.default.color,\n },\n ]}\n >\n <Box alignItems=\"center\" style={styles.addressColumn}>\n <Box alignItems=\"center\" style={styles.addressGroup}>\n <Text\n variant=\"detail\"\n style={{ color: theme.content.elements.secondary }}\n >\n {t('transferCrypto.depositAddressLabel')}\n </Text>\n <Text\n variant=\"bodyMedium\"\n style={[\n styles.addressText,\n { color: theme.content.elements.primary },\n ]}\n >\n {depositAddress}\n </Text>\n </Box>\n {selectedChain.minLabel ? (\n <Text\n variant=\"body\"\n style={{ color: theme.content.elements.secondary }}\n >\n {selectedChain.minLabel}\n </Text>\n ) : null}\n </Box>\n </Box>\n\n {/* Copy / Share */}\n <Box flexDirection=\"row\" style={styles.buttonsRow}>\n <PillButton\n label={copied ? t('common.copied') : t('common.copy')}\n accessibilityLabel={\n copied ? t('common.addressCopied') : t('common.copyAddress')\n }\n icon={\n <FigmaCopyIcon color={theme.content.button.primary.default} />\n }\n onPress={handleCopy}\n />\n <PillButton\n label={t('transferCrypto.share')}\n accessibilityLabel={t('transferCrypto.shareAddress')}\n icon={\n <FigmaShareIcon color={theme.content.button.primary.default} />\n }\n onPress={onShareAddress}\n />\n </Box>\n </Box>\n </Box>\n </Box>\n )\n}\n\n/** A full-width black pill action button (Copy / Share). */\nfunction PillButton({\n label,\n accessibilityLabel,\n icon,\n onPress,\n}: {\n label: string\n accessibilityLabel: string\n icon: ReactNode\n onPress?: () => void\n}) {\n const theme = useTheme()\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n style={styles.pillButtonPress}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius=\"button\"\n style={[\n styles.pillButton,\n { backgroundColor: theme.background.button.primary.default },\n ]}\n >\n {icon}\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.button.primary.default }}\n >\n {label}\n </Text>\n </Box>\n </Pressable>\n )\n}\n\nconst styles = StyleSheet.create({\n topBar: {\n paddingTop: 16,\n paddingBottom: 16,\n paddingHorizontal: 24,\n gap: 4,\n },\n // 32px touch target centers the 20px glyph so it visually aligns with the\n // px-20 content below.\n iconButton: { width: 32, height: 32 },\n content: {\n paddingHorizontal: 20,\n // paddingBottom is set inline: safe-area inset + 16 so the buttons keep a\n // 16px gap above the home indicator on every device.\n paddingTop: 8,\n gap: 16,\n },\n addressRegion: { gap: 12, width: '100%' },\n addressCard: {\n width: '100%',\n // Centres the address block in the card at the designed height.\n paddingVertical: 148,\n paddingHorizontal: 20,\n // The card MUST keep an opaque `backgroundColor`: on Android `elevation`\n // draws its shadow from the view outline, and without a solid background it\n // can't clip to the rounded corners \u2014 it bleeds as a gray rectangular\n // border around the card.\n shadowColor: '#000',\n shadowOpacity: 0.02,\n shadowOffset: { width: 0, height: 8 },\n shadowRadius: 32,\n elevation: 1,\n },\n // 6 inside the label+address pair, 8 out to the minimum.\n addressColumn: { gap: 8 },\n addressGroup: { gap: 6 },\n // Weight (medium) comes from the `bodyMedium` variant's Inter-Medium family \u2014\n // an inline `fontWeight` wouldn't select the cut on a custom font in RN/Expo.\n addressText: { fontSize: 28, lineHeight: 39 },\n buttonsRow: { gap: 10, width: '100%' },\n pillButtonPress: { flex: 1 },\n pillButton: { height: 56, paddingHorizontal: 24, gap: 8 },\n})\n", "import { Pressable, StyleSheet } from 'react-native'\n\nimport { FigmaChevronRightIcon } from '../icons/FigmaSystemIcons'\nimport { ChainAvatar } from '../icons/ChainAvatar'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\nexport interface SelectedChainRowProps {\n /** Section label above the chain name, e.g. `Selected chain`. */\n label: string\n /** The chain's display name, e.g. `Base`. */\n name: string\n /** Full CDN logo URL for the 32px chain icon. */\n iconUri: string\n accessibilityLabel: string\n onPress?: () => void\n}\n\n/**\n * The tappable \"Selected chain\" card on the Transfer screen. Shows the chain the\n * deposit address was generated for and opens the chain picker to change it.\n */\nexport function SelectedChainRow({\n label,\n name,\n iconUri,\n accessibilityLabel,\n onPress,\n}: SelectedChainRowProps) {\n const theme = useTheme()\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n borderRadius=\"element\"\n style={[styles.card, { backgroundColor: theme.background.secondary }]}\n >\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.chain}>\n <ChainAvatar uri={iconUri} size={32} />\n <Box>\n <Text\n variant=\"detail\"\n style={{ color: theme.content.elements.secondary }}\n >\n {label}\n </Text>\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n style={{ color: theme.content.elements.primary }}\n >\n {name}\n </Text>\n </Box>\n </Box>\n <FigmaChevronRightIcon\n size={20}\n color={theme.content.button.icon.default}\n />\n </Box>\n </Pressable>\n )\n}\n\nconst styles = StyleSheet.create({\n card: { padding: 16 },\n chain: { gap: 12, flex: 1 },\n})\n", "import type { SwappedInboundMessage } from '@funkit/connect-core'\nimport { useCallback } from 'react'\n\nimport { logger } from '../logging/logger'\nimport {\n type SwappedScreenBaseProps,\n SwappedScreenShell,\n} from './SwappedScreenShell'\n\nexport interface SwappedScreenProps extends SwappedScreenBaseProps {\n /** Fired when the embed reports a successful transaction. */\n onSuccess?: () => void\n}\n\n/**\n * Deposit-mode host for the Swapped embed (mirroring web's\n * `SwappedIframeController`): back / new-deposit \u2192 {@link onBack},\n * close \u2192 {@link onClose}, transaction-successful \u2192 {@link onSuccess}.\n * Withdrawal lifecycle messages are ignored \u2014 see `SwappedWithdrawScreen`.\n */\nexport function SwappedScreen({\n url,\n onClose,\n onBack,\n onSuccess,\n}: SwappedScreenProps) {\n const handleMessage = useCallback(\n (msg: SwappedInboundMessage) => {\n switch (msg.type) {\n // Same destination, logged apart: \"went back\" and \"started another\n // deposit\" are different intents (web parity).\n case 'SWAPPED_GO_BACK':\n logger.info('connect-rn:swapped:back')\n onBack()\n break\n case 'SWAPPED_NEW_DEPOSIT':\n logger.info('connect-rn:swapped:back_and_new_deposit')\n onBack()\n break\n case 'SWAPPED_CLOSE':\n logger.info('connect-rn:swapped:exit')\n onClose()\n break\n case 'SWAPPED_TRANSACTION_SUCCESSFUL':\n logger.info('connect-rn:swapped:transaction_successful')\n onSuccess?.()\n break\n default:\n // READY / NAVIGATION / LOGOUT / ERROR handled in the shell or\n // tracked elsewhere; withdrawal lifecycle messages belong to\n // SwappedWithdrawScreen.\n break\n }\n },\n [onBack, onClose, onSuccess],\n )\n\n return <SwappedScreenShell url={url} onMessage={handleMessage} />\n}\n", "import type { SwappedInboundMessage } from '@funkit/connect-core'\nimport { useCallback } from 'react'\nimport type { ViewStyle } from 'react-native'\n\nimport { logger } from '../logging/logger'\nimport { Box, useTheme } from '../theme/restyle'\nimport { SwappedWebView } from './SwappedWebView'\n\n/** Props shared by both Swapped embed hosts (deposit and withdrawal). */\nexport interface SwappedScreenBaseProps {\n /** The selected FOP's `embeddedFlowUrl` to load in the embed. */\n url: string\n /** Close the whole flow (embed asked to exit, e.g. its own \u2715). */\n onClose: () => void\n /** Go back to the method list (embed's own back). */\n onBack: () => void\n}\n\ninterface SwappedScreenShellProps {\n url: string\n onMessage: (msg: SwappedInboundMessage) => void\n}\n\n/**\n * Full-screen host frame for the Swapped embedded payment flow\n * ({@link SwappedWebView}). The embed ships its own top bar, so we render no\n * RN header. Mode-agnostic message handling (error and navigation logging)\n * lives here;\n * mode-specific dispatch lives in `SwappedScreen` (deposit) and\n * `SwappedWithdrawScreen` (withdrawal).\n */\nexport function SwappedScreenShell({\n url,\n onMessage,\n}: SwappedScreenShellProps) {\n const theme = useTheme()\n const handleMessage = useCallback(\n (msg: SwappedInboundMessage) => {\n switch (msg.type) {\n case 'SWAPPED_ERROR':\n // Recoverable \u2014 the embed surfaces its own error UI (WARN, not ERROR).\n logger.warn('connect-rn:swapped:error', {\n data: msg.data ?? {},\n })\n break\n case 'SWAPPED_READY':\n // Unconditional boot signal. `swapped:theme_sent` also fires on READY\n // but only once the theme send succeeds, so it can't be relied on to\n // count how many times the embed (re)initialised.\n logger.info('connect-rn:swapped:ready')\n break\n case 'SWAPPED_LOGOUT':\n logger.info('connect-rn:swapped:logout')\n break\n case 'SWAPPED_NAVIGATION':\n // Which step the embed moved to. The only signal we get about what\n // it's showing \u2014 without it a blank embed is indistinguishable from\n // a user sitting still, which is why this exists (mirrors the web\n // SDK's `swapped-iframe:navigation`).\n logger.info('connect-rn:swapped:navigation', {\n step: msg.data?.step || 'unknown',\n })\n break\n default:\n break\n }\n onMessage(msg)\n },\n [onMessage],\n )\n\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={[sheet, { backgroundColor: theme.background.modal }]}\n >\n <SwappedWebView url={url} onMessage={handleMessage} style={fill} />\n </Box>\n )\n}\n\n// Fixed sheet height (the embed needs a concrete area; a flex WebView in the\n// content-sized bottom sheet would collapse to grey). Clipped to the rounded\n// top corners.\nconst SHEET_HEIGHT = 550\nconst sheet: ViewStyle = { height: SHEET_HEIGHT, overflow: 'hidden' }\nconst fill: ViewStyle = { flex: 1 }\n", "import type { SwappedInboundMessage } from '@funkit/connect-core'\nimport { useTheme } from '@shopify/restyle'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport { ActivityIndicator, View, type ViewStyle } from 'react-native'\nimport Animated, { FadeOut } from 'react-native-reanimated'\nimport {\n WebView,\n type WebViewMessageEvent,\n type WebViewNavigation,\n} from 'react-native-webview'\n\nimport { logger } from '../logging/logger'\nimport { useFunkitColorScheme } from '../theme/FunkitThemeProvider'\nimport type { FunkitTheme } from '../theme/toRestyleTheme'\nimport { buildSwappedThemeRN } from './buildSwappedTheme'\nimport {\n SWAPPED_WEBVIEW_INJECTED_JS,\n createWebViewSwappedTransport,\n} from './webViewSwappedTransport'\n\nexport interface SwappedWebViewProps {\n /** The selected FOP's `embeddedFlowUrl` (a swapped.com/.dev widget URL). */\n url: string\n /** Typed, origin-validated inbound messages from the embed. */\n onMessage: (msg: SwappedInboundMessage) => void\n style?: ViewStyle\n}\n\n/**\n * Renders the Swapped embedded payment flow in a `WebView` and bridges its\n * messages to the typed {@link SwappedTransport} contract \u2014 the React Native\n * counterpart of web's iframe. The {@link SWAPPED_WEBVIEW_INJECTED_JS} bridge\n * redirects the embed's `postMessage` to the native channel; `onMessage` is\n * parsed + origin-validated before reaching the handler.\n */\nexport function SwappedWebView({ url, onMessage, style }: SwappedWebViewProps) {\n const webViewRef = useRef<WebView>(null)\n // Last main-frame URL reported by the WebView's NATIVE layer \u2014 the fallback\n // when `nativeEvent.url` is empty on a message event (some webview builds omit\n // it). Seeded with the widget url so a message before the first navigation\n // callback still validates against a real Swapped origin. Never sourced from\n // page JS, so it stays trustworthy for the fail-closed origin gate.\n const lastCommittedUrlRef = useRef(url)\n const { transport, dispatch } = useMemo(\n () =>\n createWebViewSwappedTransport({\n getWebView: () => webViewRef.current,\n }),\n [],\n )\n\n const theme = useTheme<FunkitTheme>()\n const { colorScheme } = useFunkitColorScheme()\n const swappedTheme = useMemo(\n () => buildSwappedThemeRN(theme, colorScheme === 'dark'),\n [theme, colorScheme],\n )\n // Latest theme/scheme without resubscribing the message handler below.\n const swappedThemeRef = useRef(swappedTheme)\n swappedThemeRef.current = swappedTheme\n const colorSchemeRef = useRef(colorScheme)\n colorSchemeRef.current = colorScheme\n\n // Themed cover until the embed paints. `startInLoadingState` can't do it: its\n // spinner clears on load end, exposing WKWebView's bare page canvas \u2014 dark\n // under a dark system appearance, the ENG-5506 flash.\n const [isEmbedReady, setIsEmbedReady] = useState(false)\n\n // A new url reloads the WebView, so cover it again. The timeout uncovers when\n // READY never lands, so a broken bridge can't hide the page for good.\n useEffect(() => {\n setIsEmbedReady(false)\n const timer = setTimeout(\n () => setIsEmbedReady(true),\n EMBED_READY_TIMEOUT_MS,\n )\n return () => clearTimeout(timer)\n }, [url])\n\n // Keep the latest handler without re-subscribing on every render. When the\n // embed announces SWAPPED_READY (its message listener is attached \u2014 reaches\n // us via the bridge's `window.opener` shim), send it the active theme:\n // the same READY-gated send web's iframe does via core `useSwappedSession`.\n const handlerRef = useRef(onMessage)\n handlerRef.current = onMessage\n useEffect(\n () =>\n transport.onMessage((msg) => {\n if (msg.type === 'SWAPPED_READY') {\n setIsEmbedReady(true)\n transport.send({\n type: 'SWAPPED_THEME',\n data: swappedThemeRef.current,\n })\n logger.info('connect-rn:swapped:theme_sent', {\n colorScheme: colorSchemeRef.current,\n })\n }\n handlerRef.current(msg)\n }),\n [transport],\n )\n\n const handleNavigationStateChange = (navState: WebViewNavigation) => {\n if (navState.url) {\n lastCommittedUrlRef.current = navState.url\n }\n }\n\n const handleMessage = (event: WebViewMessageEvent) => {\n // onNavigationStateChange doesn't fire for SPA route changes inside the\n // widget, but those never change the origin \u2014 all the gate reads.\n dispatch(\n event.nativeEvent.data,\n event.nativeEvent.url || lastCommittedUrlRef.current,\n )\n }\n\n // Load failures are recoverable (the embed shows its own retry UI) \u2192 WARN.\n // Event types inlined: the exact exported names vary across webview versions.\n const handleError = (event: {\n nativeEvent: { code: number; description: string; url: string }\n }) => {\n // Nothing is coming, so stop covering. HTTP errors still deliver a page\n // that can boot and send READY, so those wait for the timeout.\n setIsEmbedReady(true)\n logger.warn('connect-rn:swapped:webview:error', {\n code: String(event.nativeEvent.code),\n description: event.nativeEvent.description,\n url: event.nativeEvent.url,\n })\n }\n const handleHttpError = (event: {\n nativeEvent: { statusCode: number; url: string }\n }) => {\n logger.warn('connect-rn:swapped:webview:httpError', {\n status: String(event.nativeEvent.statusCode),\n url: event.nativeEvent.url,\n })\n }\n\n return (\n <View style={[fill, style]}>\n <WebView\n ref={webViewRef}\n source={{ uri: url }}\n onMessage={handleMessage}\n onNavigationStateChange={handleNavigationStateChange}\n onError={handleError}\n onHttpError={handleHttpError}\n scrollEnabled={false}\n injectedJavaScriptBeforeContentLoaded={SWAPPED_WEBVIEW_INJECTED_JS}\n // The Swapped flow needs these to run its KYC / payment widgets.\n javaScriptEnabled\n domStorageEnabled\n // The embed relies on its own session cookies (login / KYC state).\n sharedCookiesEnabled\n thirdPartyCookiesEnabled\n // Cards / Apple Pay / Google Pay surfaces inside the embed.\n allowsInlineMediaPlayback\n // The embed auto-focuses its amount input on open. iOS suppresses the\n // keyboard for programmatic (non-tap) focus by default, so the input\n // would sit focused with no keyboard \u2014 raise it without a user gesture.\n // (iOS-only prop; Android already shows the keyboard on focus.)\n keyboardDisplayRequiresUserAction={false}\n // Drop iOS's form accessory bar (the \u2039 \u203A / Done toolbar above the\n // keyboard) \u2014 the embed has no multi-field navigation to drive it, so it\n // just adds a strip between the sheet and the keyboard. (iOS-only.)\n hideKeyboardAccessoryView\n // The embed renders its own bottom sheet anchored to the viewport bottom.\n // By default WKWebView ALSO insets its scroll view by the keyboard height,\n // so its content shifts up while the sheet itself (gorhom's `interactive`\n // keyboard behavior) is already moving up \u2014 double-compensating. Pin the\n // insets so the WebView stays a fixed canvas and the sheet is the single\n // thing that moves. (iOS-only.)\n automaticallyAdjustContentInsets={false}\n contentInsetAdjustmentBehavior=\"never\"\n // Some embed steps open provider pages in a new window.\n setSupportMultipleWindows={false}\n // WKWebView routes SUBFRAME navigations through this gate too, and\n // react-native-webview cancels non-matching ones with no onError. The 3DS\n // card challenge is an `<iframe srcdoc>` (`about:srcdoc`) \u2014 without it the\n // card step renders blank. Safe to admit: it inherits the embed's origin\n // and the bridge already validates every message against the Swapped origin.\n originWhitelist={['https://*', 'about:srcdoc']}\n // Match the theme while the page itself paints (the platform WebView\n // is opaque white by default \u2014 visible as a flash in dark/custom themes).\n style={[fill, { backgroundColor: theme.background.modal }]}\n />\n {isEmbedReady ? null : (\n <Animated.View\n exiting={coverFadeOut}\n style={[loadingOverlay, { backgroundColor: theme.background.modal }]}\n >\n <ActivityIndicator color={theme.content.elements.secondary} />\n </Animated.View>\n )}\n </View>\n )\n}\n\n// Covers a slow embed without stranding the user behind a broken bridge.\nconst EMBED_READY_TIMEOUT_MS = 10_000\n\n// Fast (250ms) motion token \u2014 what the Add money dropdown opens on.\nconst coverFadeOut = FadeOut.duration(250)\n\nconst fill: ViewStyle = { flex: 1 }\n\nconst loadingOverlay: ViewStyle = {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n alignItems: 'center',\n justifyContent: 'center',\n}\n", "import type { SwappedTheme } from '@funkit/connect-core'\n\nimport type { FunkitTheme } from '../theme/toRestyleTheme'\n\nconst px = (value: number) => `${value}px`\nconst toRawHex = (color: string) => color.replace(/^#/, '')\n\n/**\n * Loading-state theme for the Swapped embed: the query params sent to `/fops`\n * (`thirdPartyPaymentConfigs.swapped.themeConfig`) that the API bakes into the\n * returned `embeddedFlowUrl` (e.g. `\u2026&iframeBackground=fbf9f4&textColor=282828`)\n * \u2014 the widget themes its boot spinner / skeleton straight from the URL, before\n * its message listener is up and any `SWAPPED_THEME` postMessage can land.\n * Mirrors web's `buildSwappedThemeQueryParams(resolvedTheme)`; colors are raw\n * hex (no `#`, they travel in a URL).\n *\n * Web also pins `height`/`width` to its dialog constants; omitted here \u2014 the\n * widget sizes to the WebView's real viewport.\n */\nexport function buildSwappedThemeQueryParamsRN(\n theme: FunkitTheme,\n): Record<string, string> {\n const { background, content, border, borderRadii } = theme\n return {\n iframeBackground: toRawHex(background.modal),\n widgetBackground: toRawHex(background.modal),\n textColor: toRawHex(content.elements.primary),\n spinnerColor: toRawHex(content.elements.primary),\n modalRadii: px(borderRadii.modal),\n skeletonColor: toRawHex(border.elements.default.color),\n skeletonSecondaryColor: toRawHex(background.secondary),\n }\n}\n\n/**\n * Builds the {@link SwappedTheme} payload for the embedded Swapped flow from\n * the active Restyle theme \u2014 the React Native counterpart of web's\n * `buildSwappedTheme(ThemeVars)`. RN tokens are concrete hex / numbers (no\n * CSS-var indirection), so unlike web no `resolveObjectCssVars` pass is needed.\n *\n * The Swapped widget's vocabulary is richer than the Fun Variables export: it\n * has hover / focused / disabled slots the mobile design doesn't define. Since\n * connect-rn's tokens are a strict mirror of Figma (only default / pressed /\n * some disabled states exist), those extra slots are adapted here at the\n * boundary: hover \u2190 pressed, primary/tertiary disabled \u2190 the default fill (the\n * widget dims via opacity), and the widget's neutral \"focused\" strokes map onto\n * the `border/elements/{default,selected}` variables.\n *\n * Fonts are intentionally omitted: Swapped expects a slug from its hosted\n * webfont set, and RN font families (system/native names) don't map onto it.\n */\nexport function buildSwappedThemeRN(\n theme: FunkitTheme,\n isDarkMode: boolean,\n): SwappedTheme {\n const {\n background,\n content,\n border,\n brand,\n borderRadii,\n sizes,\n spacing,\n textVariants,\n } = theme\n return {\n colors: {\n // \u2500\u2500 Core text \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n primaryText: content.elements.primary,\n secondaryText: content.elements.secondary,\n tertiaryText: content.elements.secondary,\n\n // \u2500\u2500 Surfaces \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n modalBackground: background.modal,\n offBackground: background.secondary,\n hoverState: background.secondary,\n lightStroke: border.elements.default.color,\n mediumStroke: border.elements.default.color,\n heavyStroke: border.elements.default.color,\n modalBorder: border.modal.default,\n modalHeaderDivider: border.elements.default.color,\n modalFooterDivider: border.elements.default.color,\n\n // \u2500\u2500 Accent / brand \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n actionColor: brand.primary,\n accentColor: brand.primary,\n accentColorForeground: content.button.primary.default,\n\n // \u2500\u2500 Status \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n error: content.elements.error,\n success: content.elements.success,\n\n // \u2500\u2500 Spinner \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n spinnerIndicator: content.elements.primary,\n spinnerBackground: border.elements.default.color,\n\n // \u2500\u2500 Primary button (hover \u2190 pressed, disabled \u2190 default fill) \u2500\u2500\u2500\u2500\u2500\n // web spreads both `buttonBackground*` (ThemeVars) and `buttonPrimary*`\n // (widget aliases); the widget reads whichever is present.\n buttonBackground: background.button.primary.default,\n buttonBackgroundHover: background.button.primary.pressed,\n buttonBackgroundPressed: background.button.primary.pressed,\n buttonBackgroundDisabled: background.button.primary.default,\n buttonPrimary: background.button.primary.default,\n buttonPrimaryHover: background.button.primary.pressed,\n buttonDisabled: background.button.primary.default,\n buttonTextPrimary: content.button.primary.default,\n buttonTextHover: content.button.primary.default,\n buttonTextDisabled: content.button.primary.default,\n buttonTextSecondary: content.button.secondary.default,\n buttonTextSecondaryDisabled: content.button.secondary.default,\n buttonFocusedOutline: 'none',\n buttonBorderGradient: 'none',\n buttonHoverBorderGradient: 'none',\n buttonDisabledBorderGradient: 'none',\n\n // \u2500\u2500 Tertiary button (hover \u2190 pressed, disabled \u2190 default fill) \u2500\u2500\u2500\u2500\n buttonBackgroundTertiary: background.button.tertiary.default,\n buttonBackgroundHoverTertiary: background.button.tertiary.pressed,\n buttonBackgroundDisabledTertiary: background.button.tertiary.default,\n buttonTextTertiary: content.button.tertiary.default,\n buttonTextDisabledTertiary: content.button.tertiary.default,\n buttonBorderTertiary: 'transparent',\n buttonBorderFocusedTertiary: border.elements.selected.color,\n\n // \u2500\u2500 Icon button / top bar (hover \u2190 pressed) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n headerButtonBackground: background.button.icon.default,\n buttonIconBackgroundHover: background.button.icon.pressed,\n buttonIconBackgroundPressed: background.button.icon.pressed,\n buttonIconStroke: content.button.icon.default,\n modalTopbarIcon: content.button.icon.default,\n modalTopbarIconBackground: background.button.icon.default,\n modalTopbarIconBackgroundHover: background.button.icon.pressed,\n modalTopbarIconBackgroundPressed: background.button.icon.pressed,\n\n // \u2500\u2500 Input (hover/focused \u2190 border/elements variables) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n inputBackground: background.modal,\n inputBackgroundHover: background.secondary,\n inputBorderBase: border.elements.default.color,\n inputBorderHover: border.elements.selected.color,\n inputLabel: content.elements.primary,\n inputBorder: border.elements.default.color,\n inputBorderFocused: content.elements.secondary,\n inputBorderActive: content.elements.secondary,\n inputPlaceholder: content.elements.secondary,\n\n // \u2500\u2500 Selection \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n selectedOptionBorder: border.elements.selected.color,\n focusedOptionBorder: border.elements.selected.color,\n\n // \u2500\u2500 Widget aliases (mirrors web buildSwappedTheme) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n boxBackground: background.secondary,\n secondaryButtonBg: background.button.tertiary.default,\n secondaryButtonText: content.button.tertiary.default,\n secondaryButtonHover: background.button.tertiary.pressed,\n secondaryButtonTextHover: content.button.tertiary.default,\n },\n radii: {\n modal: px(borderRadii.modal),\n actionButton: px(borderRadii.button),\n summaryBox: px(borderRadii.element),\n box: px(borderRadii.element),\n otpInput: px(borderRadii.button),\n calculatorInput: px(borderRadii.button),\n amountPill: px(borderRadii.button),\n },\n paymentMethodLightLogos: !isDarkMode,\n headerHeight: px(sizes.topBar),\n headerFontWeight: String(textVariants.headerTitle.fontWeight ?? '500'),\n // web: topbarIconColor \u2190 modalTopbarIcon (the icon on the top-bar buttons)\n topbarIconColor: content.button.icon.default,\n topbarTextFontSize: px(textVariants.headerTitle.fontSize ?? 13),\n headerIconWrapperSize: px(sizes.buttonXs),\n headerIconSize: px(sizes.iconMd),\n buttonFontWeight: String(textVariants.bodyMedium.fontWeight ?? '500'),\n modalBottomBarButtonHeight: px(sizes.buttonHeight),\n iframeBackground: background.modal,\n // Same fixed paddings web sends (web: modalBaseHorizontalPadding + 6px).\n topbarPaddingX: px(spacing.modalHorizontal + 6),\n topbarPaddingY: '12px',\n boxPaddingY: '16px',\n boxPaddingX: '16px',\n paddingPrimary: '20px',\n paddingSecondary: '12px',\n paddingTertiary: '20px',\n }\n}\n", "import {\n type SwappedInboundMessage,\n type SwappedOutboundMessage,\n type SwappedTransport,\n getSwappedOrigin,\n} from '@funkit/connect-core'\n\n/**\n * Marker key on host \u2192 embed envelopes (see {@link buildSwappedSendScript}).\n * The injected bridge recognizes the mark, unwraps the payload, and delivers it\n * to the page; everything unmarked is embed traffic and goes to native.\n */\nexport const FUNKIT_ENVELOPE_KEY = '__funkitSwapped'\n\n/**\n * Injected into the Swapped WebView before its content loads. Installs one\n * bridged `postMessage` that routes BOTH directions:\n *\n * - **embed \u2192 native**: the embed talks to its host by calling\n * `window.parent.postMessage(obj, origin)` (the web iframe contract); at the\n * top level `window.parent === window`, so overriding `window.postMessage`\n * intercepts those calls and forwards them \u2014 JSON-stringified \u2014 to React\n * Native via `window.ReactNativeWebView.postMessage`. The RN side parses +\n * origin-validates via {@link handleWebViewMessage}.\n * - **native \u2192 embed**: messages injected by {@link buildSwappedSendScript}\n * arrive at the same bridged function wrapped in a funkit-marked envelope\n * ({@link FUNKIT_ENVELOPE_KEY}); the bridge unwraps them and re-dispatches\n * the payload through the REAL `postMessage` (captured before the override),\n * so the embed's `message` listeners receive a genuine, trusted MessageEvent\n * with an object `event.data` \u2014 exactly what they get from an iframe parent.\n *\n * It also installs a fake `window.opener` wired to the native channel: with no\n * parent frame the widget posts its lifecycle messages (`SWAPPED_READY`, \u2026) to\n * `opener` instead of `parent`, and a top-level WebView has neither \u2014 without\n * the shim those messages are silently dropped.\n */\nexport const SWAPPED_WEBVIEW_INJECTED_JS = `(function () {\n if (window.${FUNKIT_ENVELOPE_KEY}Bridge) { return; }\n window.${FUNKIT_ENVELOPE_KEY}Bridge = true;\n // The REAL postMessage, captured before the override below.\n var postToPage = window.postMessage.bind(window);\n function forwardToNative(message) {\n try {\n var data = typeof message === 'string' ? message : JSON.stringify(message);\n window.ReactNativeWebView && window.ReactNativeWebView.postMessage(data);\n } catch (e) {}\n }\n function bridged(message) {\n // funkit envelope (host \u2192 embed): unwrap + deliver to the page's listeners.\n if (message && message.${FUNKIT_ENVELOPE_KEY}) {\n try { postToPage(message.payload, '*'); } catch (e) {}\n return;\n }\n // Anything else is the embed talking to its host \u2192 forward to native.\n forwardToNative(message);\n }\n try { window.postMessage = bridged; } catch (e) {}\n // The widget only emits some messages (notably SWAPPED_ORDER_DATA, the sell\n // deposit address) when it believes it is embedded in a parent frame \u2014 on web\n // that's a real <iframe> so window.parent !== window. A top-level WebView has\n // window.parent === window, so present a DISTINCT parent/top (a proxy over\n // window) whose postMessage forwards to native; the get-trap delegates every\n // other property to the real window so the widget's other parent.* access works.\n var frameProxy = window;\n try {\n frameProxy = new Proxy(window, {\n get: function (target, prop) {\n if (prop === 'postMessage') { return bridged; }\n var value = target[prop];\n return typeof value === 'function' ? value.bind(target) : value;\n },\n });\n } catch (e) {\n // Proxy unavailable \u2192 fall back to bridging the real parent.\n try { if (window.parent) { window.parent.postMessage = bridged; } } catch (e2) {}\n }\n // Guard parent/top independently: parent is [Replaceable] so it sticks, but\n // top is [LegacyUnforgeable] (HTML spec) and throws on conforming engines\n // while succeeding on the WebView builds that gate embed detection on it \u2014\n // isolating them means a throw on one never skips the other.\n try { Object.defineProperty(window, 'parent', { configurable: true, get: function () { return frameProxy; } }); } catch (e) {}\n try { Object.defineProperty(window, 'top', { configurable: true, get: function () { return frameProxy; } }); } catch (e) {}\n // No parent frame \u2192 the widget posts lifecycle messages to window.opener.\n try { if (!window.opener) { window.opener = { postMessage: forwardToNative }; } } catch (e) {}\n true;\n})();\ntrue;`\n\n/**\n * Build the JS snippet that delivers an outbound message INTO the embed, run\n * via `webView.injectJavaScript`. One shape for every message type: the payload\n * is wrapped in a funkit-marked envelope and handed to the (bridged)\n * `window.postMessage` \u2014 the bridge unwraps it and re-dispatches via the real\n * `postMessage` (see {@link SWAPPED_WEBVIEW_INJECTED_JS}). If the bridge isn't\n * installed, the envelope dispatches as-is and the embed ignores it (no `type`).\n */\nexport function buildSwappedSendScript(msg: SwappedOutboundMessage): string {\n const envelope = JSON.stringify({ [FUNKIT_ENVELOPE_KEY]: true, payload: msg })\n return `(function () {\n try { window.postMessage(${envelope}, '*'); } catch (e) {}\n})();\ntrue;`\n}\n\n/**\n * Parse + validate a raw WebView `onMessage` payload into a typed inbound\n * Swapped message. Returns `null` (drop the message) when the payload isn't\n * valid JSON with a string `type`, or `url`'s origin isn't a Swapped origin\n * (mirrors web's `isSwappedOrigin(event.origin)` iframe guard).\n *\n * `url` is the page URL to validate against. The caller passes `nativeEvent.url`,\n * falling back to the last committed navigation URL when a webview build omits it\n * (see {@link SwappedWebView}) \u2014 so a missing url here means no trustworthy\n * source, and we fail closed.\n */\nexport function handleWebViewMessage(\n rawData: unknown,\n url?: string,\n): SwappedInboundMessage | null {\n // Fail closed: no verifiable Swapped page URL \u2192 drop.\n if (!url || getSwappedOrigin(url) == null) {\n return null\n }\n let parsed: unknown\n if (typeof rawData === 'string') {\n try {\n parsed = JSON.parse(rawData)\n } catch {\n return null\n }\n } else {\n parsed = rawData\n }\n const data = parsed as { type?: unknown } | null | undefined\n if (!data || typeof data.type !== 'string') {\n return null\n }\n return data as SwappedInboundMessage\n}\n\n/** Minimal surface of `react-native-webview`'s ref the transport needs. */\nexport interface WebViewLike {\n injectJavaScript(script: string): void\n}\n\nexport interface WebViewSwappedTransport {\n /** Implements the shared {@link SwappedTransport} contract. */\n transport: SwappedTransport\n /**\n * Feed a raw WebView `onMessage` payload (+ optional page url) through origin\n * validation and fan it out to `transport.onMessage` subscribers.\n */\n dispatch(rawData: unknown, url?: string): void\n}\n\n/**\n * React Native {@link SwappedTransport}: bridges the typed Swapped message\n * contract over a `WebView` instead of web's `<iframe>` + `window.postMessage`.\n * `send` delivers into the embed by injecting an in-page `postMessage` call\n * ({@link buildSwappedSendScript}); inbound messages arrive through\n * {@link dispatch} (wired to the WebView's `onMessage`).\n */\nexport function createWebViewSwappedTransport({\n getWebView,\n}: {\n getWebView: () => WebViewLike | null\n}): WebViewSwappedTransport {\n const handlers = new Set<(msg: SwappedInboundMessage) => void>()\n\n const transport: SwappedTransport = {\n send(msg: SwappedOutboundMessage): boolean {\n const webView = getWebView()\n if (!webView) {\n return false\n }\n webView.injectJavaScript(buildSwappedSendScript(msg))\n return true\n },\n onMessage(handler: (msg: SwappedInboundMessage) => void): () => void {\n handlers.add(handler)\n return () => {\n handlers.delete(handler)\n }\n },\n }\n\n function dispatch(rawData: unknown, url?: string): void {\n const msg = handleWebViewMessage(rawData, url)\n if (msg) {\n for (const handler of handlers) {\n handler(msg)\n }\n }\n }\n\n return { transport, dispatch }\n}\n", "import {\n type MinDepositTarget,\n type MinTransferConfig,\n getConfiguredMinDepositUsd,\n getMinTransferValueUsd,\n} from '@funkit/connect-core'\nimport type { TFunction } from 'i18next'\n\nimport { chainIconUri, chainName } from '../utils/chainDisplay'\nimport type { TokenChainFilter } from './supportedTokens'\n\n/** A curated deposit chain the user can pick to send funds on. */\nexport interface AvailableChain {\n /** Numeric chain id as a string. */\n id: string\n /** Display name, e.g. `Ethereum`, `Binance Smart Chain`. */\n name: string\n /** Full CDN logo URL. */\n iconUri: string\n /** Minimum-deposit label, e.g. `$10 minimum`. */\n minLabel?: string\n}\n\n/**\n * Build the chain-picker rows from the curated chain list (the\n * `tokentransferconfig` chains resolved by `useSupportedTokens`, as chain-filter\n * chips), enriched with `@funkit/chains` logos and the per-chain minimum.\n *\n * The minimum mirrors web's `TransferToken`:\n * `ceil(getMinTransferValueForChain(chainId, mintokentransfervalue) +\n * getMinDepositUSD(target))`.\n */\nexport function buildAvailableChains({\n t,\n chainFilters,\n minTransferLimits,\n target,\n}: {\n t: TFunction\n /** `useSupportedTokens().chainFilters` \u2014 `All` + one chip per curated chain. */\n chainFilters: TokenChainFilter[]\n minTransferLimits: MinTransferConfig\n target?: MinDepositTarget\n}): AvailableChain[] {\n const minDepositAddOn = getConfiguredMinDepositUsd(target)\n\n return chainFilters\n .filter((f) => f.id !== 'all')\n .map((f) => ({ chainId: Number(f.id), name: f.label }))\n .map(({ chainId, name }) => {\n const min = getMinTransferValueUsd(\n chainId,\n minTransferLimits,\n minDepositAddOn,\n )\n return {\n id: String(chainId),\n name:\n name ||\n chainName(chainId) ||\n t('networks.chainFallback', { chainId }),\n iconUri: chainIconUri(chainId),\n minLabel: t('networks.minimum', { min }),\n }\n })\n}\n", "import { chainMetadataById } from '@funkit/chains'\n\nimport { FALLBACK_ASSET_LOGO } from '../icons/assetLogos'\n\n// How a chain is shown, read from `@funkit/chains` \u2014 the metadata both SDKs\n// already share. The fallbacks are the platform-specific half: the CDN\n// placeholder and the locale string are RN's own.\n\n/** Chain logo, or the placeholder for a chain the metadata doesn't cover. */\nexport function chainIconUri(chainId: number): string {\n return chainMetadataById[chainId]?.iconUrl ?? FALLBACK_ASSET_LOGO\n}\n\n/**\n * The chain's name, or `undefined` when the metadata doesn't know it \u2014 callers\n * supply their own fallback, since not all of them have a `t` to hand.\n */\nexport function chainName(chainId: number): string | undefined {\n return chainMetadataById[chainId]?.name\n}\n", "import {\n type ExchangeRates,\n FormOfPaymentType,\n type SwappedFormOfPayment,\n} from '@funkit/api-base'\nimport { getFopsLimit, getFormOfPaymentDisplayName } from '@funkit/connect-core'\nimport type { TFunction } from 'i18next'\n\n/** A cash-tab payment row, derived from a Swapped form of payment. */\nexport interface FopRow {\n /** Stable id passed back to `onSelectFop`. */\n id: string\n /** Display name, e.g. \"Card\", \"Apple Pay\". */\n name: string\n /** Subtitle, e.g. \"$10,000.00 limit \u2022 Instant\". */\n subtitle: string\n /**\n * Disabled when the FOP has no embedded-flow URL \u2014 these are the\n * \"coming soon\" placeholders Swapped returns when geoblocked/unavailable.\n */\n disabled: boolean\n}\n\n/**\n * Map Swapped forms of payment to Add money rows. Subtitle mirrors the Figma:\n * `\"<limit> limit\"`, with `\" \u00B7 1-2 days\"` appended for bank transfers (the\n * only FOP the Figma gives a timing suffix). The limit is the FOP's max\n * converted to USD via {@link getFopsLimit} (falls back to a default when no\n * exchange rate is available \u2014 RN doesn't fetch rates in V1).\n */\nexport function toFopRows(\n t: TFunction,\n fops: SwappedFormOfPayment[],\n exchangeRates?: ExchangeRates,\n): FopRow[] {\n return fops.map((fop) => {\n const limit = getFopsLimit(fop, exchangeRates)\n // Two full keys instead of concatenating around \"\u00B7\" \u2014 locales own the\n // separator and word order.\n const subtitle =\n fop.fopType === FormOfPaymentType.BANK_TRANSFER\n ? t('fops.bankTransferSubtitle', { limit })\n : t('fops.limit', { limit })\n return {\n id: `${fop.fopType}:${fop.name}`,\n name: getFormOfPaymentDisplayName(fop),\n subtitle,\n disabled: !fop.embeddedFlowUrl,\n }\n })\n}\n\n/**\n * Map Swapped payout methods to Withdraw rows. Deliberately NOT {@link toFopRows}:\n * its `getFopsLimit` default invents a \"$10k limit\" when no exchange rate is\n * available, which would misstate a limit on the user's own money (web's\n * `getWithdrawalFopsDisclaimerLimit` returns no limit without rates). Subtitle\n * is timing-only: bank transfers settle in days, everything else is instant.\n */\nexport function toWithdrawFopRows(\n t: TFunction,\n fops: SwappedFormOfPayment[],\n): FopRow[] {\n return fops.map((fop) => ({\n id: `${fop.fopType}:${fop.name}`,\n name: getFormOfPaymentDisplayName(fop),\n subtitle:\n fop.fopType === FormOfPaymentType.BANK_TRANSFER\n ? t('fops.bankTransferTime')\n : t('fops.instant'),\n disabled: !fop.embeddedFlowUrl,\n }))\n}\n", "/**\n * Truncate a deposit address for display, e.g.\n * `0x7854f3\u20265139F0` (Figma: Transfer Crypto). Keeps the leading + trailing\n * characters with an ellipsis between; short strings are returned unchanged.\n * Kept local (not `@funkit/utils`) so connect-rn doesn't take that dep just for\n * one formatter, and so the lead/trail counts can match the RN design.\n */\nexport function formatDepositAddress(\n address: string | undefined,\n leading = 6,\n trailing = 6,\n): string {\n if (!address) {\n return ''\n }\n if (address.length <= leading + trailing) {\n return address\n }\n return `${address.slice(0, leading)}\u2026${address.slice(-trailing)}`\n}\n", "import { useCallback, useEffect, useRef } from 'react'\n\nimport { logger } from '../../logging/logger'\nimport type { ClipboardWriter } from '../clipboard'\n\nexport interface UseCopyDepositAddressParams {\n copyToClipboard: ClipboardWriter\n /** Shows the \"Address copied\" toast. */\n onCopySuccess: () => void\n isTransferOpen: boolean\n /** Undefined while it's still generating. */\n address: string | undefined\n}\n\n/**\n * The Copy buttons' clipboard write + toast, plus the auto-copy when Transfer\n * opens and whenever the address changes.\n *\n * The returned write never rejects; `false` means the address wasn't copied.\n */\nexport function useCopyDepositAddress({\n copyToClipboard,\n onCopySuccess,\n isTransferOpen,\n address,\n}: UseCopyDepositAddressParams): (value: string) => Promise<boolean> {\n const copyAddress = useCallback(\n async (value: string): Promise<boolean> => {\n try {\n // A void return is success (see ClipboardWriter).\n const ok = (await copyToClipboard(value)) !== false\n if (ok) {\n onCopySuccess()\n }\n return ok\n } catch (error) {\n // Only host-injected writers reject; the default is already guarded.\n logger.warn('connect-rn: clipboard write threw; address not copied', {\n error: error instanceof Error ? error.message : String(error),\n })\n return false\n }\n },\n [copyToClipboard, onCopySuccess],\n )\n\n // Keyed on the address, so a switch between chains sharing one doesn't\n // re-copy; cleared on leaving Transfer so re-opening copies again.\n const copiedAddressRef = useRef<string | undefined>(undefined)\n useEffect(() => {\n if (!isTransferOpen) {\n copiedAddressRef.current = undefined\n return\n }\n if (!address || copiedAddressRef.current === address) {\n return\n }\n copiedAddressRef.current = address\n void copyAddress(address)\n }, [isTransferOpen, address, copyAddress])\n\n return copyAddress\n}\n", "import { getFiatExchangeRates } from '@funkit/api-base'\nimport { useQuery } from '@tanstack/react-query'\n\nimport { logger } from '../../logging/logger'\n\n/**\n * RN port of web's `useFiatExchangeRates`: the fiat exchange-rate table used to\n * convert the host's USD source balance into Swapped's EUR sell cap. Keyless\n * endpoint, cached for an hour (rates barely move within a session).\n */\nexport function useFiatExchangeRates(enabled = true) {\n const { data, isLoading, error } = useQuery({\n queryKey: ['fiatExchangeRates'],\n queryFn: () => getFiatExchangeRates({ logger }),\n refetchOnMount: false,\n refetchOnReconnect: false,\n refetchOnWindowFocus: false,\n gcTime: 1000 * 60 * 60, // 1 hour\n enabled,\n })\n\n return { data, isLoading, error }\n}\n", "import {\n type RecipientTarget,\n type SwappedFormOfPayment,\n getFops,\n} from '@funkit/api-base'\nimport {\n FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS,\n solanaChain,\n} from '@funkit/chains'\nimport {\n DEFAULT_FIAT_CURRENCY,\n FOPS_STALE_TIME,\n buildSwappedThirdPartyPaymentConfigs,\n getConfiguredMinDepositUsd,\n getDepositAddressForChain,\n getMinTransferValueEur,\n sortFops,\n useSwappedDefaultCurrencyQuery,\n} from '@funkit/connect-core'\nimport { useDynamicConfig } from '../../statsig/useDynamicConfig'\nimport { useTheme } from '@shopify/restyle'\nimport { useQuery } from '@tanstack/react-query'\nimport { useMemo } from 'react'\n\nimport type { DepositCheckoutConfig } from '../../flow/depositFlowConfig'\nimport { useUserIpInfo } from '../../geo/useUserIpInfo'\nimport { useFunkitIdentity } from '../../identity/IdentityContext'\nimport { logger } from '../../logging/logger'\nimport { buildSwappedThemeQueryParamsRN } from '../../swapped/buildSwappedTheme'\nimport type { FunkitTheme } from '../../theme/toRestyleTheme'\nimport { useFiatExchangeRates } from './useFiatExchangeRates'\nimport { useTransferInit } from './useTransferInit'\n\n// Swapped enumerates region-specific payment methods by country, so the /fops\n// call needs *a* country. We send the user's real country (resolved from their\n// IP via {@link useUserIpInfo}), falling back to this default while the geo\n// lookup is in flight or if it fails \u2014 so the cash list still populates.\n//\n// TODO(connect-rn): per-region geoblocking. Web also compares `blockedcountries`\n// (Statsig) against the resolved country and disables/hides methods for blocked\n// regions (`useFunkitUserIp().isUserGeoblocked` \u2192\n// `PaymentMethodDisabledBadge reason=\"geoblocked\"`). This wires the country in;\n// the per-method gating is the remaining step.\nconst DEFAULT_COUNTRY_CODE = 'US'\n\nexport interface UseFopsParams {\n /**\n * Destination chain/asset \u2014 drives the deposit recipient + FOP query. Its\n * optional `getMinDepositUSD` feeds the fiat (Swapped) buy minimum.\n */\n checkoutConfig: DepositCheckoutConfig | undefined\n dynamicRoutingId?: string\n enabled?: boolean\n}\n\nexport interface UseFopsResult {\n /**\n * The user's saved forms of payment (e.g. \"Mastercard (\u20263869)\"). Rendered at\n * the top of the Add money list, above the Crypto row \u2014 mirroring web, where\n * saved FOPs sort first.\n */\n savedFops: SwappedFormOfPayment[]\n /** Generic forms of payment (Card / Apple Pay / Revolut Pay / Bank Transfer). */\n genericFops: SwappedFormOfPayment[]\n isLoading: boolean\n isFetching: boolean\n /** The FOPs fetch failed (network / API). Drives the Add money error state. */\n isError: boolean\n /** Re-run the FOPs fetch (the Add money \"Try again\" action). */\n refetch: () => void\n /** Whether Swapped (cash) methods are offered at all. */\n isSwappedEnabled: boolean\n /**\n * The /fops fetch has every input it needs to run (Swapped on, recipient +\n * target resolved) \u2014 only then can a refetch change the result. Gates the\n * Add money \"Try again\".\n */\n canRefetch: boolean\n}\n\n/**\n * Thin RN port of `@funkit/connect`'s `useFops`: fetches the Swapped forms of\n * payment (`getFops`) that populate the \"Use Cash\" tab. Identity comes from\n * {@link useFunkitIdentity}; the deposit recipient is derived from\n * {@link useTransferInit} + the core `getDepositAddressForChain`.\n *\n * Theme, buy minimum, and region currency reach web parity (see the inline\n * notes below). V1 still omits web's per-region geoblocking and `validateFops`.\n */\nexport function useFops({\n checkoutConfig,\n dynamicRoutingId,\n enabled = true,\n}: UseFopsParams): UseFopsResult {\n const isSwappedEnabled = !!useDynamicConfig('enableswappeddeposit')\n const input = useFopsQueryInput({\n checkoutConfig,\n dynamicRoutingId,\n enabled: enabled && isSwappedEnabled,\n })\n const query = useDoFetchFops(input)\n\n // The region-currency / rate lookups keep the fetch disabled, and a disabled\n // query's `isLoading` reads false \u2014 indistinguishable from \"settled, no cash\n // methods\". Cover those windows too, or callers paint a cash-less list before\n // /fops has even been requested.\n const isLoading =\n isSwappedEnabled &&\n (input.isDependencyLoading || (input.enabled && query.isLoading))\n\n return {\n savedFops: query.data?.savedFormsOfPayments ?? [],\n genericFops: query.data?.genericFormsOfPayments ?? [],\n isLoading,\n isFetching: input.isTransferInitFetching,\n isError: query.isError,\n refetch: () => void query.refetch(),\n isSwappedEnabled,\n canRefetch: input.enabled,\n }\n}\n\n/**\n * Resolves the /fops request into a query key \u2014 identity, region (country +\n * fiat currency), Swapped theme, deposit recipient, EUR buy minimum \u2014 plus\n * whether the fetch may run and which upstream lookups are still pending.\n *\n * The key and the loading flags live together on purpose: a dependency added to\n * the key has to declare its loading state right here, so it can't be forgotten\n * when `useFops` composes `isLoading`.\n */\nfunction useFopsQueryInput({\n checkoutConfig,\n dynamicRoutingId,\n enabled,\n}: {\n checkoutConfig: DepositCheckoutConfig | undefined\n dynamicRoutingId: string | undefined\n enabled: boolean\n}) {\n const { apiKey, userId, prefillFiatEmail } = useFunkitIdentity()\n const fopPriority = useDynamicConfig('foppriority')\n\n // Real country from the user's IP; default while it loads / if it fails.\n const { userIpInfo } = useUserIpInfo()\n\n // Region-default fiat currency (web parity); falls back to USD. Resolved from\n // the *real* IP country (not the DEFAULT_COUNTRY_CODE fallback above) so a\n // non-US user isn't briefly quoted in USD. Gating /fops on its loading state\n // avoids an initial USD fetch that refetches once the region currency resolves.\n const {\n data: fiatCurrencyCode = DEFAULT_FIAT_CURRENCY,\n isLoading: isFiatCurrencyCodeLoading,\n } = useSwappedDefaultCurrencyQuery({\n apiKey,\n countryCode: userIpInfo?.alpha2,\n logger,\n })\n\n // Loading-state theme baked into the returned embeddedFlowUrls (web parity).\n const theme = useTheme<FunkitTheme>()\n const themeConfig = useMemo(\n () => buildSwappedThemeQueryParamsRN(theme),\n [theme],\n )\n\n const {\n transferInit,\n isLoading: isTransferInitLoading,\n isFetching: isTransferInitFetching,\n } = useTransferInit({ checkoutConfig, dynamicRoutingId, enabled })\n\n const targetAsset = checkoutConfig?.targetAsset\n const targetChain = checkoutConfig?.targetChain\n const recipientAddress = targetChain\n ? getDepositAddressForChain(Number(targetChain), transferInit)\n : undefined\n\n const { defaultMinAmount, isLoading: isExchangeRatesLoading } =\n useDefaultMinAmountEur({ checkoutConfig, dynamicRoutingId, enabled })\n\n return {\n // `prefillFiatEmail` is intentionally kept out of the key (web parity):\n // it's read at fetch time, so post-mount changes don't refetch.\n queryKey: [\n 'fops',\n {\n apiKey,\n userId,\n recipientAddress,\n solanaAddress: transferInit?.solanaAddr,\n targetAsset,\n targetChain,\n // fallback to DEFAULT_COUNTRY_CODE, do not use it in useSwappedDefaultCurrencyQuery\n countryCode: userIpInfo?.alpha2 || DEFAULT_COUNTRY_CODE,\n fiatCurrencyCode,\n fopPriority,\n themeConfig,\n defaultMinAmount,\n },\n ] as const,\n prefillFiatEmail,\n enabled:\n enabled &&\n !!apiKey &&\n !!targetAsset &&\n !!targetChain &&\n !!recipientAddress &&\n !!transferInit &&\n !isFiatCurrencyCodeLoading &&\n !isExchangeRatesLoading,\n isDependencyLoading:\n isTransferInitLoading ||\n isFiatCurrencyCodeLoading ||\n isExchangeRatesLoading,\n isTransferInitFetching,\n }\n}\n\n/**\n * Swapped enforces its own minimum inside the widget; we hand it the same floor\n * web sends (shared `getMinTransferValueEur`) \u2014 the chain transfer minimum plus\n * the config's `getMinDepositUSD`, converted to EUR. Callers gate /fops on\n * `isLoading` so the first request already carries the real EUR floor rather\n * than a 1:1 estimate that later churns the query key.\n */\nfunction useDefaultMinAmountEur({\n checkoutConfig,\n dynamicRoutingId,\n enabled,\n}: {\n checkoutConfig: DepositCheckoutConfig | undefined\n dynamicRoutingId: string | undefined\n enabled: boolean\n}) {\n const minTransferLimits = useDynamicConfig('mintokentransfervalue')\n const { data: exchangeRates, isLoading } = useFiatExchangeRates(enabled)\n\n const targetChain = checkoutConfig?.targetChain\n const defaultMinAmount = getMinTransferValueEur(\n targetChain ? Number(targetChain) : undefined,\n minTransferLimits,\n getConfiguredMinDepositUsd({\n targetChain,\n targetAsset: checkoutConfig?.targetAsset,\n dynamicRoutingId,\n getMinDepositUSD: checkoutConfig?.getMinDepositUSD,\n }),\n exchangeRates,\n )\n\n return { defaultMinAmount, isLoading }\n}\n\n/** Runs the /fops fetch off the key built by {@link useFopsQueryInput}. */\nfunction useDoFetchFops({\n queryKey,\n prefillFiatEmail,\n enabled,\n}: ReturnType<typeof useFopsQueryInput>) {\n return useQuery({\n queryKey,\n queryFn: async ({ queryKey: [_, params] }) => {\n const { recipientAddress, targetAsset, targetChain, fopPriority } = params\n if (!recipientAddress || !targetChain || !targetAsset) {\n return { genericFormsOfPayments: [], savedFormsOfPayments: [] }\n }\n const destinationToken = { chainId: targetChain, address: targetAsset }\n // Swapped recommends a Solana fallback recipient when one was minted.\n const recipientTargets: RecipientTarget[] = [\n { recipientAddress, destinationToken },\n ...(params.solanaAddress\n ? [\n {\n recipientAddress: params.solanaAddress,\n destinationToken: {\n chainId: solanaChain.id.toString(),\n address: FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS,\n },\n },\n ]\n : []),\n ]\n\n const response = await getFops({\n apiKey: params.apiKey,\n logger,\n params: {\n recipientAddress,\n userId: params.userId,\n destinationToken,\n fiatCurrencyCode: params.fiatCurrencyCode,\n countryCode: params.countryCode,\n recipientTargets,\n thirdPartyPaymentConfigs: buildSwappedThirdPartyPaymentConfigs({\n prefillFiatEmail,\n themeConfig: params.themeConfig,\n logTag: 'connect-rn:useFops',\n logger,\n }),\n checkoutLimitsCriteria: { defaultMinAmount: params.defaultMinAmount },\n },\n })\n\n return {\n genericFormsOfPayments: sortFops(\n response.genericFormsOfPayments,\n fopPriority,\n ),\n savedFormsOfPayments: sortFops(\n response.savedFormsOfPayments,\n fopPriority,\n ),\n }\n },\n enabled,\n staleTime: FOPS_STALE_TIME,\n refetchOnWindowFocus: false,\n })\n}\n", "import {\n type CheckoutInitTokenTransferResponse,\n type FunAddress,\n initializeCheckoutTokenTransferAddress,\n} from '@funkit/api-base'\nimport {\n type CheckoutTokenTransferConfig,\n getCheckoutTokenTransferParams,\n} from '@funkit/connect-core'\nimport { useQuery } from '@tanstack/react-query'\nimport { useEffect } from 'react'\n\nimport { useFunkitIdentity } from '../../identity/IdentityContext'\nimport { logger } from '../../logging/logger'\nimport { useLighterDepositRecipientOverride } from './useLighterDepositRecipientOverride'\nimport { useUDAParams } from './useUDAParams'\n\n// clientMetadata is stored alongside the transfer record; web ships a full\n// HistoricalCheckoutItem stub, but the thin RN flow has no checkout history, so\n// an empty object is sent. It MUST be a stable reference \u2014 re-creating it each\n// render would change the query and cause refetch/flicker.\nconst TRANSFER_CLIENT_METADATA: NonNullable<object> = {}\n\nexport interface UseTransferInitParams {\n /** Destination chain/asset to derive the deposit address for. */\n checkoutConfig: CheckoutTokenTransferConfig | undefined\n /** Final recipient. Defaults to the identity's wallet address. */\n recipientAddr?: FunAddress\n /** Dynamic-routing id used to resolve UDA params. */\n dynamicRoutingId?: string\n /** Gate the network call (e.g. only when the screen is visible). */\n enabled?: boolean\n}\n\nexport interface UseTransferInitResult {\n transferInit: CheckoutInitTokenTransferResponse | undefined\n recipientAddr: FunAddress\n isLoading: boolean\n isFetching: boolean\n}\n\n/**\n * Thin RN reimplementation of `@funkit/connect`'s `useCheckoutTransferInit`:\n * builds the (customer-agnostic) transfer params via the core helper and\n * creates the deposit-address EOA through `@funkit/api-base`. Identity comes\n * from {@link useFunkitIdentity}; web's Polymarket target override and geo /\n * post-action gating are dropped. Lighter's main-account override is kept \u2014\n * see {@link useLighterDepositRecipientOverride}.\n */\nexport function useTransferInit({\n checkoutConfig,\n recipientAddr,\n dynamicRoutingId,\n enabled = true,\n}: UseTransferInitParams): UseTransferInitResult {\n const { apiKey, userId, walletAddress } = useFunkitIdentity()\n const udaParams = useUDAParams(dynamicRoutingId)\n const {\n isLighterDeposit,\n recipientOverride: lighterRecipientOverride,\n isLookupFetching,\n lookupStatus,\n } = useLighterDepositRecipientOverride({\n apiKey,\n targetChain: udaParams?.targetChain,\n walletAddress,\n })\n\n // Mirrors web's useCheckoutTransferInit priority: a resolved Lighter L2\n // main-account index outranks an explicit recipientAddr override, which\n // outranks the wallet.\n const resolvedRecipient = ((): FunAddress => {\n if (isLighterDeposit && lighterRecipientOverride) {\n return lighterRecipientOverride as FunAddress\n }\n return (recipientAddr || walletAddress || '0x') as FunAddress\n })()\n\n // Lighter EOA generation targets the L2 main-account index \u2014 the backend\n // rejects a raw L1 wallet address. When the lookup is pending, failed, or\n // found no main account (and no explicit recipientAddr pins the\n // destination), hold the request instead of sending one that 400s.\n const isLighterWalletFallback =\n isLighterDeposit && !lighterRecipientOverride && !recipientAddr\n\n // Money-path decision log \u2014 same key/payload as web's useCheckoutTransferInit.\n useEffect(() => {\n if (isLighterDeposit && lighterRecipientOverride) {\n logger.info('checkout:recipient:lighterMainAccount', {\n mainAccountIndex: lighterRecipientOverride,\n targetChain: udaParams?.targetChain,\n })\n }\n }, [isLighterDeposit, lighterRecipientOverride, udaParams?.targetChain])\n\n // The hold is user-visible (no deposit address) \u2014 surface it once the lookup\n // settles without an index instead of staying silent.\n useEffect(() => {\n if (isLighterWalletFallback && !isLookupFetching) {\n logger.warn('checkout:recipient:lighterMainAccountUnresolved', {\n targetChain: udaParams?.targetChain,\n lookupStatus,\n })\n }\n }, [\n isLighterWalletFallback,\n isLookupFetching,\n lookupStatus,\n udaParams?.targetChain,\n ])\n\n // `undefined` when required params are missing \u2014 also disables the query.\n const params = getCheckoutTokenTransferParams({\n checkoutConfig,\n userId,\n apiKey,\n recipientAddr: resolvedRecipient,\n udaParams,\n })\n\n const { data, isLoading, isFetching } = useQuery({\n queryKey: ['initializeCheckoutTokenTransferAddress', params] as const,\n queryFn: ({ queryKey: [, queryParams] }) =>\n queryParams\n ? initializeCheckoutTokenTransferAddress({\n ...queryParams,\n logger,\n clientMetadata: TRANSFER_CLIENT_METADATA,\n })\n : undefined,\n enabled: enabled && !!params && !isLighterWalletFallback,\n refetchOnWindowFocus: false,\n refetchOnMount: false,\n })\n\n return {\n transferInit: isFetching ? undefined : data,\n recipientAddr: resolvedRecipient,\n isLoading,\n isFetching,\n }\n}\n", "import { LIGHTER_CHAIN_ID } from '@funkit/chains'\nimport { useLighterAccountsQuery } from '@funkit/connect-core'\nimport type { Address } from 'viem'\nimport { isLighterxyzApiKey } from '../../utils/customers'\n\nexport interface LighterDepositRecipientOverride {\n /** True when this deposit targets Lighter \u2014 callers must not fall back to the L1 wallet address. */\n isLighterDeposit: boolean\n /** The L2 main-account index. Undefined while the lookup is pending, failed, or found no main account. */\n recipientOverride: string | undefined\n /** True while the account lookup is in flight \u2014 an unresolved recipient is expected then. */\n isLookupFetching: boolean\n /** Lookup query status, for the unresolved-recipient WARN log. */\n lookupStatus: 'pending' | 'error' | 'success'\n}\n\n/**\n * Lighter EOA generation targets the L2 main-account index, not the L1\n * address \u2014 resolves it as a deposit recipientAddr override (mirrors web's\n * `useLighterAccounts`). `isLighterDeposit` lets callers withhold the L1\n * wallet fallback until `recipientOverride` resolves, since the backend\n * rejects an L1 address for Lighter.\n */\nexport function useLighterDepositRecipientOverride({\n apiKey,\n targetChain,\n walletAddress,\n}: {\n apiKey: string\n targetChain: string | undefined\n walletAddress: string | undefined\n}): LighterDepositRecipientOverride {\n const isLighterDeposit =\n isLighterxyzApiKey(apiKey) && targetChain === LIGHTER_CHAIN_ID.toString()\n\n const { mainAccountIndex, isFetching, status } = useLighterAccountsQuery({\n address: isLighterDeposit ? (walletAddress as Address) : undefined,\n })\n\n return {\n isLighterDeposit,\n recipientOverride: mainAccountIndex,\n isLookupFetching: isFetching,\n lookupStatus: status,\n }\n}\n", "import type { UDAConfig } from '@funkit/connect-core'\n\nimport { useDynamicConfig } from '../../statsig/useDynamicConfig'\nimport { useMemo } from 'react'\n\n/**\n * Thin RN reimplementation of `@funkit/connect`'s `useUDAParams`. Resolves the\n * Universal Deposit Address config for a dynamic-routing id from the\n * `uda_params` Statsig dynamic config. Unlike web, the routing id is passed in\n * (web reads it from the checkout context, which RN doesn't have).\n */\nexport function useUDAParams(dynamicRoutingId?: string): UDAConfig | undefined {\n const udaParams = useDynamicConfig('uda_params')\n return useMemo(\n () =>\n udaParams.find((param) => param.dynamicRoutingId === dynamicRoutingId)\n ?.params,\n [udaParams, dynamicRoutingId],\n )\n}\n", "import type { CheckoutInitTokenTransferResponse } from '@funkit/api-base'\nimport { getSupportedAssets } from '@funkit/api-base'\nimport {\n isTransferChainEnabled,\n resolveTokenTransferConfig,\n} from '@funkit/connect-core'\nimport { useDynamicConfig } from '../../statsig/useDynamicConfig'\nimport { useQuery } from '@tanstack/react-query'\nimport { useMemo } from 'react'\n\nimport { useFunkitIdentity } from '../../identity/IdentityContext'\nimport { logger } from '../../logging/logger'\nimport {\n buildSupportedTokenList,\n type SupportedToken,\n type TokenChainFilter,\n} from '../supportedTokens'\n\nexport interface UseSupportedTokensResult {\n /** Curated deposit tokens (no icons attached), priority symbols first. */\n tokens: SupportedToken[]\n /** `All` + one chip per configured chain. */\n chainFilters: TokenChainFilter[]\n isLoading: boolean\n}\n\n/**\n * Fetch + resolve the deposit token list the same way the web SDK does: the\n * curated Statsig `tokentransferconfig` (chains + asset addresses), filtered by\n * the disabled list and merged with `@funkit/api-base`'s `getSupportedAssets`\n * metadata (`resolveTokenTransferConfig`, shared via connect-core) \u2014 NOT the raw\n * allow-list. Identity (apiKey) comes from {@link useFunkitIdentity}; the query\n * is disabled until an apiKey is present.\n *\n * `transferInit` gates which chains are offered: Solana / Bitcoin / Tron only\n * appear once the deposit-init response carries their address (mirrors web's\n * `useEnabledTokenTransferChainTokens` via the shared `isTransferChainEnabled`).\n */\nexport function useSupportedTokens({\n enabled = true,\n transferInit,\n}: {\n enabled?: boolean\n transferInit?: CheckoutInitTokenTransferResponse\n} = {}): UseSupportedTokensResult {\n const { apiKey } = useFunkitIdentity()\n const tokenTransferConfig = useDynamicConfig('tokentransferconfig')\n const disabledChainAssets = useDynamicConfig(\n 'disabletokentransferchainsandassets',\n )\n\n const { data, isLoading } = useQuery({\n queryKey: ['getSupportedAssets', apiKey] as const,\n queryFn: ({ queryKey: [, key] }) =>\n getSupportedAssets({ apiKey: key, logger }),\n enabled: enabled && !!apiKey,\n staleTime: 5 * 60_000,\n refetchOnWindowFocus: false,\n })\n\n const { tokens, chainFilters } = useMemo(() => {\n if (!data) {\n return { tokens: [], chainFilters: [{ id: 'all', label: 'All' }] }\n }\n const resolved = resolveTokenTransferConfig({\n chainConfigs: tokenTransferConfig.chains ?? [],\n priorityTokens: tokenTransferConfig.priorityTokens ?? [],\n disabledChainAssets,\n supportedAssets: data,\n logger,\n })\n const built = buildSupportedTokenList(resolved)\n\n // Hide chains whose deposit address hasn't been minted (Solana/Bitcoin/Tron)\n // \u2014 leaving EVM chains always enabled. The `all` chip is always kept.\n const isEnabled = (chainId: number | undefined) =>\n chainId == null || isTransferChainEnabled(chainId, transferInit)\n return {\n tokens: built.tokens.filter((t) => isEnabled(t.chainId)),\n chainFilters: built.chainFilters.filter(\n (c) => c.id === 'all' || isEnabled(Number(c.id)),\n ),\n }\n }, [data, tokenTransferConfig, disabledChainAssets, transferInit])\n\n return { tokens, chainFilters, isLoading }\n}\n", "import type { TokenTransferConfigResult } from '@funkit/connect-core'\n\n/**\n * One curated deposit token (chain + asset), produced from the resolved\n * `tokentransferconfig`. Consumed by the deposit flow (its chains drive the\n * \"Available chains\" list).\n */\nexport interface SupportedToken {\n id: string\n symbol: string\n /** Chain shown on the trailing side, e.g. \"Ethereum\". */\n chainLabel: string\n /** Numeric chain id \u2014 used to derive the available-chains list + re-target. */\n chainId?: number\n /** Token contract address. */\n address?: string\n}\n\n/** A curated chain entry. The first is usually `{ id: 'all', label: 'All' }`. */\nexport interface TokenChainFilter {\n id: string\n label: string\n}\n\n/**\n * Flatten a resolved token-transfer config (the curated Statsig\n * `tokentransferconfig` merged with `/assets/supported` metadata \u2014 see\n * `resolveTokenTransferConfig`) into the supported-tokens screen's token rows +\n * chain-filter chips. One row per curated (chain, asset); chains keep their\n * config order; priority symbols float to the top. NOT the raw allow-list, so\n * no meme coins \u2014 only the customer's configured deposit tokens.\n */\nexport function buildSupportedTokenList(resolved: TokenTransferConfigResult): {\n tokens: SupportedToken[]\n chainFilters: TokenChainFilter[]\n} {\n const priorityIndex = new Map(\n resolved.priorityTokenSymbols.map((symbol, i) => [symbol, i]),\n )\n\n const tokens: SupportedToken[] = []\n const chainFilters: TokenChainFilter[] = [{ id: 'all', label: 'All' }]\n\n for (const chainId of resolved.chainIdSortOrder) {\n const assets = Object.values(resolved.supportedAssets[chainId] ?? {})\n if (assets.length === 0) {\n continue\n }\n chainFilters.push({ id: String(chainId), label: assets[0].chainName })\n for (const asset of assets) {\n tokens.push({\n id: `${asset.chainId}:${asset.address}`,\n symbol: asset.symbol,\n chainLabel: asset.chainName,\n chainId: Number(asset.chainId),\n address: asset.address,\n })\n }\n }\n\n // Stable sort: priority symbols first (in priority order); everything else\n // keeps its chain/insertion order.\n const rank = (symbol: string) =>\n priorityIndex.get(symbol) ?? Number.POSITIVE_INFINITY\n tokens.sort((a, b) => rank(a.symbol) - rank(b.symbol))\n\n return { tokens, chainFilters }\n}\n", "import type {\n CheckoutInitTokenTransferResponse,\n FunAddress,\n} from '@funkit/api-base'\nimport { bitcoinChain, solanaChain, tronChain } from '@funkit/chains'\nimport {\n type CheckoutTokenTransferConfig,\n type QRCodeUri,\n type TransferTokenQrCodeType,\n getDepositAddressForChain,\n getTransferTokenQrCodeUri,\n} from '@funkit/connect-core'\n\nimport { useTransferInit } from './useTransferInit'\n\n// Web applies a per-customer slippage matrix; the thin RN flow uses a single\n// default (web's fallback value) until a customer needs otherwise.\nconst DEFAULT_MAX_SLIPPAGE_PERCENT = 0.25\n\nfunction resolveBlockchain(\n chainId: number | undefined,\n): TransferTokenQrCodeType {\n if (chainId === solanaChain.id) {\n return 'solana'\n }\n if (chainId === bitcoinChain.id) {\n return 'bitcoin'\n }\n if (chainId === tronChain.id) {\n return 'tron'\n }\n return 'ethereum'\n}\n\nexport interface UseTokenTransferParams {\n checkoutConfig: CheckoutTokenTransferConfig | undefined\n /** Chain the user picked to send funds on. */\n selectedChainId: number | undefined\n dynamicRoutingId?: string\n enabled?: boolean\n}\n\nexport interface UseTokenTransferResult {\n /** Where the user sends funds first. */\n depositAddress: FunAddress | undefined\n /** Raw deposit-init response (per-chain addresses); gates which chains show. */\n transferInit: CheckoutInitTokenTransferResponse | undefined\n /** Final destination of the funds. */\n recipientAddr: string\n /** Default max slippage, as a percent. */\n maxSlippagePercent: number\n qrCodeUri: QRCodeUri | undefined\n blockchain: TransferTokenQrCodeType\n isLoading: boolean\n}\n\n/**\n * Thin RN reimplementation of `@funkit/connect`'s `useTokenTransfer`: resolves\n * the deposit address + QR URI for the selected chain. The web hook's i18n\n * tooltips, fiat conversion, price-impact estimate, per-customer slippage, and\n * Polygon \"original recipient\" special-case are intentionally omitted. (The\n * per-chain minimums are computed in `buildAvailableChains`, not here.)\n */\nexport function useTokenTransfer({\n checkoutConfig,\n selectedChainId,\n dynamicRoutingId,\n enabled,\n}: UseTokenTransferParams): UseTokenTransferResult {\n const { transferInit, recipientAddr, isLoading } = useTransferInit({\n checkoutConfig,\n dynamicRoutingId,\n enabled,\n })\n\n const depositAddress =\n selectedChainId !== undefined\n ? getDepositAddressForChain(selectedChainId, transferInit)\n : undefined\n\n const blockchain = resolveBlockchain(selectedChainId)\n\n const qrCodeUri = depositAddress\n ? getTransferTokenQrCodeUri({\n depositAddress,\n type: blockchain,\n chainId: selectedChainId,\n })\n : undefined\n\n return {\n depositAddress,\n transferInit,\n recipientAddr,\n maxSlippagePercent: DEFAULT_MAX_SLIPPAGE_PERCENT,\n qrCodeUri,\n blockchain,\n isLoading,\n }\n}\n", "import QRCode from 'react-native-qrcode-svg'\n\n/**\n * Renders the scannable deposit QR from the EIP-681 URI produced by the\n * transfer hooks (e.g. `ethereum:0x\u2026`). Built on `react-native-qrcode-svg`\n * (which renders via `react-native-svg`, already a peer for the CDN icons).\n *\n * The QR is always drawn as near-black (`#101010`, matching the Figma deposit\n * frame) modules on a white cell \u2014 fixed colors, NOT the Restyle theme: in dark\n * mode `textPrimary` is light, which over the light cell background renders\n * white-on-white (invisible/unscannable). QR contrast must hold regardless of\n * the app's color scheme.\n */\nexport interface QrCodeProps {\n /** The value to encode \u2014 the EIP-681 URI / address from `useTokenTransfer`. */\n value: string\n size?: number\n /**\n * Error-correction level. Defaults to `'H'` (highest) so the centered\n * chain-logo overlay ({@link QrChainCluster}) stays within scannable\n * tolerance.\n */\n ecl?: 'L' | 'M' | 'Q' | 'H'\n}\n\nexport function QrCode({ value, size = 220, ecl = 'H' }: QrCodeProps) {\n return (\n <QRCode\n value={value}\n size={size}\n ecl={ecl}\n color=\"#101010\"\n backgroundColor=\"#FFFFFF\"\n />\n )\n}\n", "import type {\n CheckoutTokenTransferConfig,\n DynamicTargetAssetCandidate,\n MinDepositTarget,\n} from '@funkit/connect-core'\nimport type { ReactNode } from 'react'\n\nimport type {\n SupportedToken,\n TokenChainFilter,\n} from '../transfer/supportedTokens'\n\nexport type { DynamicTargetAssetCandidate } from '@funkit/connect-core'\n\n/**\n * Destination chain/asset for a deposit, plus the customer `getMinDepositUSD`\n * closure that feeds the transfer minimums and the fiat (Swapped) buy floor.\n * The web `FunkitCheckoutConfig` satisfies this structurally. Named once here so\n * the flow provider and `useFops` share exactly one shape.\n */\nexport type DepositCheckoutConfig = CheckoutTokenTransferConfig &\n Pick<MinDepositTarget, 'getMinDepositUSD'>\n\n/**\n * Resolve the active target-asset candidate from a list + routing id (RN-only).\n *\n * This is intentionally NOT a drop-in equivalent of web's\n * `getDefaultDynamicTargetAsset` (`packages/connect/src/utils/assets.ts`), which\n * takes the whole checkout config (synthesizing a guaranteed fallback) and adds\n * a `tokenSymbol === targetAssetTicker` match step. The RN flow only needs to\n * pick a candidate from the configured list:\n *\n * 1. Match `dynamicRoutingId`\n * 2. Match `isDefault`\n * 3. First candidate\n */\nexport function getDefaultDynamicTargetAsset(\n candidates: DynamicTargetAssetCandidate[] | undefined,\n dynamicRoutingId: string | undefined,\n): DynamicTargetAssetCandidate | undefined {\n if (!candidates?.length) {\n return undefined\n }\n if (candidates.length === 1) {\n return candidates[0]\n }\n\n const routingId = dynamicRoutingId ?? ''\n return (\n candidates.find((c) => c.dynamicRoutingId === routingId) ??\n candidates.find((c) => c.isDefault) ??\n candidates[0]\n )\n}\n\n/**\n * @deprecated Unused \u2014 the deposit chain is chosen on the Select chain screen,\n * which lists every curated chain individually instead of network segments.\n */\nexport interface ChainOption {\n /** Stable id used for selection (e.g. the network id). */\n id: string\n label: string\n /**\n * CDN chain keys for the segment glyph: one \u2192 a single logo, several \u2192 a 2\u00D72\n * cluster (e.g. the EVM group).\n */\n iconKeys?: string[]\n /**\n * Numeric chain id this network selects \u2014 drives which generated deposit\n * address + QR (EVM / Solana / Bitcoin / Tron) the flow shows.\n */\n chainId?: number\n}\n\n/**\n * Data the managed deposit flow renders.\n *\n * The deposit address + QR are now SDK-generated: given `checkoutConfig` (the\n * destination chain/asset) and the identity on `<FunkitProvider>`, the flow\n * resolves the Universal Deposit Address and EIP-681 QR URI via the transfer\n * hooks. `depositAddress`/`qrCode` remain as optional host overrides / fallbacks\n * (shown while generation is loading or when no identity is configured).\n *\n * TODO(connect-rn): source the remaining lists internally too \u2014 payment methods\n * from config/Statsig, supported tokens from `@funkit/api-base` \u2014 so\n * `beginDeposit` ultimately takes just a target, like the web `beginCheckout`.\n */\nexport interface DepositFlowConfig {\n /**\n * Candidate target assets for the \"Deposit to\" row, following web's\n * `FunkitCheckoutConfig.dynamicTargetAssetCandidates`. The active candidate is\n * resolved via {@link getDefaultDynamicTargetAsset} using `dynamicRoutingId`.\n * Omit to hide the deposit-target row.\n */\n dynamicTargetAssetCandidates?: DynamicTargetAssetCandidate[]\n /**\n * Destination of the deposit (target chain + asset). Drives deposit-address\n * generation via the transfer hooks, and its optional `getMinDepositUSD`\n * feeds the per-chain transfer minimums and the fiat (Swapped) sell floor.\n * The web `FunkitCheckoutConfig` satisfies this structurally.\n */\n checkoutConfig?: DepositCheckoutConfig\n /**\n * @deprecated Ignored \u2014 the user picks the source chain on the Select chain\n * screen, which drives the generated address and QR type.\n */\n sourceChain?: string\n /** Dynamic-routing id used to resolve UDA params for `checkoutConfig`. */\n dynamicRoutingId?: string\n /**\n * Deposit address fallback/override. The flow prefers the SDK-generated\n * address; this is shown while it loads or when generation is unavailable\n * (no identity). Display formatting (truncation) is applied by the flow.\n */\n depositAddress?: string\n /** Tokens shown on the supported-tokens screen (host-filtered). */\n supportedTokens?: SupportedToken[]\n tokenChainFilters?: TokenChainFilter[]\n /**\n * QR code override. By default the flow renders the generated EIP-681 URI\n * with `react-native-qrcode-svg`; supply a node only to override.\n */\n qrCode?: ReactNode\n}\n\n/** Lifecycle callbacks passed to `useFunkitCheckout`. */\nexport interface DepositFlowCallbacks {\n onOpen?: () => void\n onClose?: () => void\n onCheckoutBlocked?: () => void\n}\n", "import {\n type ComponentProps,\n type ReactNode,\n useCallback,\n useEffect,\n useRef,\n} from 'react'\nimport { StyleSheet, View, type ViewStyle } from 'react-native'\nimport {\n BottomSheetBackdrop,\n type BottomSheetBackgroundProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n BottomSheetView,\n useBottomSheetTimingConfigs,\n} from '@gorhom/bottom-sheet'\nimport { Easing } from 'react-native-reanimated'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { useTheme } from '../theme/restyle'\nimport { sheetSizing, useInertScrollableFocus } from './sheetSizing'\nimport { useKeyboardHeight } from './useKeyboardHeight'\n\n/**\n * Host-supplied blur laid under the sheet's scrim. The package ships no blur\n * module of its own \u2014 every option is native, so it would cost consumers a\n * rebuild and a peer-dep bump. Rendered into a full-bleed container, so\n * `flex: 1` or `StyleSheet.absoluteFill` fills the screen.\n */\nexport type BackdropBlurRenderer = () => ReactNode\n\nexport interface FlowSheetProps {\n isOpen: boolean\n /**\n * Per-`beginDeposit` id. A change while open re-presents the sheet, which\n * cancels an in-flight dismiss \u2014 so opening a new session mid-swipe-dismiss\n * isn't closed by the previous session's late `onDismiss`.\n */\n session: number\n onClose: () => void\n /** The flow screens rendered inside the sheet. */\n content: ReactNode\n /** The host app subtree the sheet is presented above. */\n children: ReactNode\n /**\n * Lift the sheet above the keyboard. Scoped to the screen that needs it (the\n * Swapped embed's WebView): a generic flow screen with no inputs shouldn't\n * subscribe to keyboard events, and a future `BottomSheetTextInput` screen\n * would be handled by gorhom natively instead. See {@link useKeyboardHeight}.\n */\n keyboardAvoidEnabled?: boolean\n enableSwipeToDismiss?: boolean\n /** Let the sheet reach the top of the screen for a screen that is a full window tall. */\n fullHeight?: boolean\n /** Optional blur behind the scrim. See {@link BackdropBlurRenderer}. */\n renderBackdropBlur?: BackdropBlurRenderer\n}\n\n/** The subset of `BottomSheetModal`'s imperative handle the flow drives. */\ninterface SheetHandle {\n present: () => void\n dismiss: () => void\n}\n\n/**\n * Host for the managed deposit-flow surface: a `@gorhom/bottom-sheet` modal\n * (native gestures + spring physics), sized to its content. The flow screens\n * draw their own grabber, so the sheet runs handle-less; its surface is painted\n * by {@link FlowSheetBackground} (which also fills the over-drag gap).\n *\n * Requires the gorhom peer stack (`@gorhom/bottom-sheet`,\n * `react-native-gesture-handler`, `react-native-reanimated`) and a\n * `<GestureHandlerRootView>` at the app root.\n */\nexport function FlowSheet({\n isOpen,\n session,\n onClose,\n content,\n children,\n keyboardAvoidEnabled = false,\n enableSwipeToDismiss = true,\n fullHeight = false,\n renderBackdropBlur,\n}: FlowSheetProps) {\n const ref = useRef<SheetHandle | null>(null)\n const setRef = useCallback((instance: SheetHandle | null) => {\n ref.current = instance\n }, [])\n\n const keyboardHeight = useKeyboardHeight(keyboardAvoidEnabled)\n const insets = useSafeAreaInsets()\n const theme = useTheme()\n\n // Bridge the flow's `isOpen` state onto the modal's imperative present/dismiss.\n // Two guards avoid gorhom's \"dismiss on an already-closed modal \u2192 unmount +\n // mark DISMISSED (can't re-present)\" footgun:\n // - `hasPresented`: never dismiss a modal we never presented (initial mount).\n // - `sheetSelfDismissed`: when a swipe/backdrop closes the sheet, gorhom\n // already dismissed it and fired onDismiss \u2192 onClose \u2192 isOpen=false; skip\n // the redundant dismiss so it can reopen.\n const hasPresented = useRef(false)\n const sheetSelfDismissed = useRef(false)\n useEffect(() => {\n if (isOpen) {\n sheetSelfDismissed.current = false\n ref.current?.present()\n hasPresented.current = true\n return\n }\n if (!hasPresented.current) {\n return\n }\n hasPresented.current = false\n if (sheetSelfDismissed.current) {\n sheetSelfDismissed.current = false\n return\n }\n ref.current?.dismiss()\n // `session` is a dep so a new beginDeposit while open re-presents (and\n // cancels any in-flight dismiss) rather than leaving a stale close pending.\n }, [isOpen, session])\n\n const handleDismiss = useCallback(() => {\n sheetSelfDismissed.current = true\n onClose()\n }, [onClose])\n\n // Smooth the dynamic-size morph: when the active flow screen changes height,\n // gorhom recomputes the dynamic snap point and animates to it with these\n // configs (this also governs present/dismiss). Ease-out cubic-bezier\n // (0.22, 1, 0.36, 1) over 300ms matches the team's container-resize motion\n // token, so the sheet tweens between screen heights instead of snapping.\n const animationConfigs = useBottomSheetTimingConfigs({\n duration: 300,\n easing: Easing.bezier(0.22, 1, 0.36, 1),\n })\n\n // Both layers hang off gorhom's backdrop so its fade and tap-to-close own\n // them, with the scrim over the blur (the design's `backdrop-filter` order).\n const renderBackdrop = useCallback(\n (props: ComponentProps<typeof BottomSheetBackdrop>) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n pressBehavior=\"close\"\n // gorhom's backdrop paints opaque black scaled by `opacity`; the alpha\n // rides our scrim color instead, so the container clears to transparent\n // and `opacity` only drives the fade.\n opacity={1}\n style={backdropContainer}\n >\n {renderBackdropBlur ? (\n <View style={StyleSheet.absoluteFill} pointerEvents=\"none\">\n {renderBackdropBlur()}\n </View>\n ) : null}\n <View\n style={[scrim, { backgroundColor: theme.background.overlay }]}\n pointerEvents=\"none\"\n />\n </BottomSheetBackdrop>\n ),\n [renderBackdropBlur, theme.background.overlay],\n )\n\n return (\n <BottomSheetModalProvider>\n {children}\n <BottomSheetModal\n ref={setRef}\n // We lift the sheet ourselves by growing the content (the spacer below,\n // driven by `keyboardAvoidEnabled`). gorhom doesn't react to the\n // WebView's keyboard, so `extend` just keeps it at its (grown) content\n // height \u2014 our spacer is the single source of truth.\n keyboardBehavior=\"extend\"\n // While the keyboard is up, disable over-drag: rubber-banding the sheet\n // up would otherwise lift the keyboard-compensation spacer into view as\n // blank space. Over-drag (and its surface fill, see FlowSheetBackground)\n // stays on the rest of the time.\n enableOverDrag={keyboardHeight === 0}\n // Full-height steps scroll with gorhom's scrollable, which can't be\n // measured (see sheetSizing); the rest are sized to their content.\n {...sheetSizing({ fullHeight })}\n // Cap the sheet at the bottom of the status bar: gorhom subtracts this\n // from the container height, so a tall screen tops out flush below it\n // instead of sliding behind it. A full-height screen waives the cap and\n // pays the inset itself, or the scrim shows as a strip above it.\n topInset={fullHeight ? 0 : insets.top}\n // Off on non-home screens: the drag rubber-bands back instead of\n // closing (gorhom keeps the pan gesture, just not the dismissal).\n enablePanDownToClose={enableSwipeToDismiss}\n animationConfigs={animationConfigs}\n onDismiss={handleDismiss}\n backdropComponent={renderBackdrop}\n // The flow screens render their own grabber; the sheet paints the\n // surface (see FlowSheetBackground) so over-drag doesn't expose a gap.\n handleComponent={null}\n backgroundComponent={FlowSheetBackground}\n >\n {/* Wrapped either way \u2014 swapping the element on a `fullHeight` flip\n would remount the flow and lose its state. */}\n <BottomSheetView\n focusHook={fullHeight ? useInertScrollableFocus : undefined}\n >\n {content}\n {/* Lift the sheet above the keyboard. The Swapped embed focuses an\n input inside its WebView (see useKeyboardHeight) which gorhom's\n keyboard handling can't see, so the sheet won't move on its own.\n Growing the dynamically-sized content by the keyboard height\n slides the whole sheet up instead of letting the keyboard overlap\n it (which reflows the WebView's viewport smaller \u2014 the \"shrink\").\n gorhom tweens the resize with `animationConfigs`. */}\n {keyboardHeight > 0 ? (\n <View style={{ height: keyboardHeight }} />\n ) : null}\n </BottomSheetView>\n </BottomSheetModal>\n </BottomSheetModalProvider>\n )\n}\n\n/**\n * Sheet surface for the flow modal. gorhom sizes the sheet body to its content,\n * so a flat background fills only the content area; over-dragging the sheet\n * above its content height lifts the body off the bottom and would otherwise\n * expose the backdrop below it (ENG-4340: \"you can see how the drawer ends\").\n *\n * We paint the `bgModal` surface (matching each screen's own surface + rounded\n * top) and hang a tall extension off the content's bottom edge. Anchored at\n * `top: '100%'`, the extension tracks the body as it lifts, so the rubber-band\n * over-drag reveals more surface instead of empty space \u2014 the bounce is kept.\n */\nexport function FlowSheetBackground({\n pointerEvents,\n style,\n}: BottomSheetBackgroundProps) {\n const theme = useTheme()\n const surface: ViewStyle = {\n backgroundColor: theme.background.modal,\n borderTopLeftRadius: theme.borderRadii.modal,\n borderTopRightRadius: theme.borderRadii.modal,\n }\n const extension: ViewStyle = {\n ...bottomExtension,\n backgroundColor: theme.background.modal,\n }\n return (\n <View pointerEvents={pointerEvents} style={[style, surface]}>\n <View style={extension} />\n </View>\n )\n}\n\nconst backdropContainer: ViewStyle = { backgroundColor: 'transparent' }\n\nconst scrim: ViewStyle = StyleSheet.absoluteFill\n\n// Comfortably taller than any phone screen so even a hard rubber-band pull never\n// drags past the surface; it extends below the device edge and stays off-screen\n// at rest.\nconst bottomExtension: ViewStyle = {\n position: 'absolute',\n top: '100%',\n left: 0,\n right: 0,\n height: 1000,\n}\n", "import { useEffect } from 'react'\n\nconst FULL_HEIGHT_DETENT = ['100%']\n\n/**\n * Sizing props for a `BottomSheetModal`; `topInset` stays with the caller. A\n * gorhom scrollable reports only its own height, so a screen with one can't be\n * measured \u2014 it takes a fixed detent and sizes itself.\n */\nexport function sheetSizing({ fullHeight }: { fullHeight: boolean }) {\n return fullHeight\n ? { enableDynamicSizing: false, snapPoints: FULL_HEIGHT_DETENT }\n : { enableDynamicSizing: true }\n}\n\nconst noop = () => {}\n\n/**\n * `focusHook` that keeps `BottomSheetView`'s measuring but drops its\n * static-view registration, which over-drags the sheet on first touch. Calls\n * `useEffect` the way the default does, deps argument and all: React rejects a\n * slot whose argument count changes when a screen flips between the two.\n */\nexport function useInertScrollableFocus(_register: () => void) {\n useEffect(noop)\n}\n", "import { useEffect, useState } from 'react'\nimport { Keyboard, Platform } from 'react-native'\n\n/**\n * The on-screen keyboard height (0 when hidden), tracked from the global\n * keyboard events. Pass `enabled` to scope it to the screen that needs it: when\n * `false`, no listeners are registered and it always reports 0.\n *\n * This is the ONLY thing that lifts the flow sheet, for native inputs and the\n * Swapped WebView alike: gorhom's own avoidance runs `keyboardBehavior=\"extend\"`\n * under `enableDynamicSizing`, where the max snap point is already the content\n * height \u2014 a no-op, verified on device even with a `BottomSheetTextInput`.\n *\n * iOS emits the `Will` events (ahead of the keyboard animation, so the sheet\n * lifts in sync); Android only reliably emits the `Did` events.\n */\nexport function useKeyboardHeight(enabled: boolean): number {\n const [height, setHeight] = useState(0)\n useEffect(() => {\n if (!enabled) {\n setHeight(0)\n return\n }\n const showEvent =\n Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow'\n const hideEvent =\n Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide'\n const show = Keyboard.addListener(showEvent, (e) =>\n setHeight(e.endCoordinates.height),\n )\n const hide = Keyboard.addListener(hideEvent, () => setHeight(0))\n return () => {\n show.remove()\n hide.remove()\n }\n }, [enabled])\n return height\n}\n", "import AsyncStorage from '@react-native-async-storage/async-storage'\n\nimport { logger } from '../logging/logger'\n\n// Per Fun user, so two accounts don't inherit each other's chain. Hosts that\n// omit `externalUserId` get the wallet address as the userId, so for them a\n// wallet change already scopes to a new key.\nconst storageKey = (userId: string) => `funkit.selectedChain.${userId}`\n\n/** Null when nothing is stored, or the read failed \u2014 the caller just asks. */\nexport async function readSelectedChainId(\n userId: string,\n): Promise<string | null> {\n try {\n return await AsyncStorage.getItem(storageKey(userId))\n } catch (error) {\n logger.warn('connect-rn:deposit:chain_read_failed', {\n error: error instanceof Error ? error.message : String(error),\n })\n return null\n }\n}\n\nexport async function writeSelectedChainId(\n userId: string,\n chainId: string,\n): Promise<void> {\n try {\n await AsyncStorage.setItem(storageKey(userId), chainId)\n } catch (error) {\n logger.warn('connect-rn:deposit:chain_write_failed', {\n chainId,\n error: error instanceof Error ? error.message : String(error),\n })\n }\n}\n", "import { logger } from '../logging/logger'\n\ntype HostCallback = (...args: never[]) => unknown\n\n/**\n * Wraps every function on a host callback object so an integrator's throw stays\n * the integrator's problem.\n *\n * Applied where callbacks enter the SDK rather than at each call site: some of\n * those sites can't defend themselves usefully \u2014 `onClose` runs inside a\n * `setState` updater, `onOpen` runs before the sheet is open \u2014 and a call site\n * added later would otherwise be unguarded by default.\n */\nexport function guardHostCallbacks<T extends object>(callbacks: T): T {\n const guarded: Record<string, unknown> = {}\n for (const [name, value] of Object.entries(callbacks)) {\n guarded[name] =\n typeof value === 'function'\n ? guardOne(name, value as HostCallback)\n : value\n }\n return guarded as T\n}\n\nfunction guardOne(name: string, callback: HostCallback): HostCallback {\n return (...args) => {\n try {\n const result = callback(...args)\n // The callback types are all void, but nothing stops a host passing an\n // `async` function, whose rejection no try/catch here would see.\n if (result instanceof Promise) {\n return result.catch((error: unknown) => warn(name, error))\n }\n return result\n } catch (error) {\n warn(name, error)\n return undefined\n }\n }\n}\n\nfunction warn(name: string, error: unknown): void {\n logger.warn('connect-rn:host_callback_threw', {\n callback: name,\n error: error instanceof Error ? error.message : String(error),\n })\n}\n", "import { type ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport { StyleSheet, View, type ViewStyle } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { AddressCopiedToast } from './AddressCopiedToast'\n\n// How long the pill stays fully shown, and the duration of its exit animation\n// (kept in sync with AddressCopiedToast's FadeOutUp) used to defer the overlay\n// teardown until the fade-out finishes.\nconst TOAST_VISIBLE_MS = 1800\nconst TOAST_EXIT_MS = 350\nconst TOAST_INSET_OFFSET = 20\n\n// Full-screen, top-anchored, non-interactive overlay.\n// pointerEvents=\"none\" on the View lets all touches pass through.\nconst toastOverlay: ViewStyle = {\n ...StyleSheet.absoluteFill,\n zIndex: 1,\n alignItems: 'center',\n}\n\ninterface CopiedToast {\n /** The overlay to render; caller owns only where it sits in the tree. */\n toast: ReactNode\n showCopiedToast: () => void\n clearToast: () => void\n}\n\n/**\n * The \"Address copied\" toast: its timing state and the overlay that shows it.\n *\n * Two pieces of state: `copiedToastShown` drives the pill's mount (its\n * reanimated enter/exit plays on mount/unmount), and `toastMounted` keeps\n * the overlay mounted across the pill's exit animation so the fade-out\n * isn't cut off by tearing the View down on the same frame.\n */\nexport function useCopiedToast(): CopiedToast {\n const insets = useSafeAreaInsets()\n const [toastMounted, setToastMounted] = useState(false)\n const [copiedToastShown, setCopiedToastShown] = useState(false)\n const hideTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>(\n undefined,\n )\n const unmountTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>(\n undefined,\n )\n\n const clearToast = useCallback(() => {\n if (hideTimerRef.current) {\n clearTimeout(hideTimerRef.current)\n }\n if (unmountTimerRef.current) {\n clearTimeout(unmountTimerRef.current)\n }\n setCopiedToastShown(false)\n setToastMounted(false)\n }, [])\n\n const showCopiedToast = useCallback(() => {\n if (hideTimerRef.current) {\n clearTimeout(hideTimerRef.current)\n }\n if (unmountTimerRef.current) {\n clearTimeout(unmountTimerRef.current)\n }\n setToastMounted(true)\n setCopiedToastShown(true)\n hideTimerRef.current = setTimeout(() => {\n setCopiedToastShown(false)\n unmountTimerRef.current = setTimeout(\n () => setToastMounted(false),\n TOAST_EXIT_MS,\n )\n }, TOAST_VISIBLE_MS)\n }, [])\n\n useEffect(() => () => clearToast(), [clearToast])\n\n const toast = toastMounted ? (\n <View\n style={[toastOverlay, { paddingTop: insets.top + TOAST_INSET_OFFSET }]}\n pointerEvents=\"none\"\n >\n {copiedToastShown ? <AddressCopiedToast /> : null}\n </View>\n ) : null\n\n return { toast, showCopiedToast, clearToast }\n}\n", "import { StyleSheet, type ViewStyle } from 'react-native'\nimport Animated, { Easing, FadeOutUp, Keyframe } from 'react-native-reanimated'\n\nimport { FigmaSuccessCheckIcon } from '../icons/FigmaSystemIcons'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Text, useTheme } from '../theme/restyle'\n\n/**\n * The \"Address copied\" confirmation pill (Figma: Fun Mobile deposit toast). A\n * rounded pill with the label + a green success check. Surface + label track the\n * theme (`background/pill/default`, `content/elements/primary` via the medium\n * body cut) so it themes with light/dark; only the layout + soft shadow are\n * static (h42, px16, radius999, gap6).\n *\n * Purely presentational + self-animating on mount/unmount \u2014 it owns NO timer and\n * NO positioning. The parent (the deposit flow) mounts/unmounts it to show/hide\n * and absolutely-positions it; mounting plays the enter animation, unmounting\n * plays the exit. Built on `react-native-reanimated` layout animations, which\n * run inside the gorhom bottom-sheet the flow renders in.\n */\n\n// Enter: slide up ~8px + fade in + scale 0.96\u21921 with a bouncy overshoot,\n// matching the web motion spec (CSS cubic-bezier(0.34, 1.36, 0.64, 1) over\n// ~450ms). The easing on the final keyframe drives the transition into it.\nconst enterAnimation = new Keyframe({\n 0: {\n opacity: 0,\n transform: [{ translateY: 8 }, { scale: 0.96 }],\n },\n 100: {\n opacity: 1,\n transform: [{ translateY: 0 }, { scale: 1 }],\n easing: Easing.bezier(0.34, 1.36, 0.64, 1),\n },\n}).duration(450)\n\n// Exit: fade + lift away over 350ms, matching the toast-close timing.\nconst exitAnimation = FadeOutUp.duration(350)\n\nexport function AddressCopiedToast() {\n const { t } = useFunkitTranslation()\n const label = t('common.addressCopied')\n const theme = useTheme()\n return (\n <Animated.View\n entering={enterAnimation}\n exiting={exitAnimation}\n style={[styles.pill, { backgroundColor: theme.background.pill.default }]}\n accessibilityRole=\"alert\"\n accessibilityLabel={label}\n >\n <Text variant=\"bodyMedium\">{label}</Text>\n <FigmaSuccessCheckIcon size={16} />\n </Animated.View>\n )\n}\n\n// Layout + soft shadow only \u2014 the surface color comes from the theme's\n// `background/pill/default` token, applied inline above.\nconst pill: ViewStyle = {\n height: 42,\n paddingHorizontal: 16,\n borderRadius: 999,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 6,\n shadowColor: '#000000',\n shadowOpacity: 0.08,\n shadowOffset: { width: 0, height: 4 },\n shadowRadius: 12,\n}\n\nconst styles = StyleSheet.create({ pill })\n", "import type { SwappedFormOfPayment } from '@funkit/api-base'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { type ReactNode, useCallback, useState } from 'react'\nimport { useCheckoutBlocked } from '../geo/useCheckoutBlocked'\nimport { CryptoBitcoinIcon } from '../icons/CryptoBitcoinIcon'\nimport { PaymentMethodIcon } from '../icons/PaymentMethodIcon'\nimport { logger } from '../logging/logger'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport type { PaymentMethodOption } from '../screens/SelectMethodScreen'\nimport { WithdrawCryptoComplete } from '../screens/WithdrawCryptoComplete'\nimport { WithdrawCryptoSteps } from '../screens/WithdrawCryptoSteps'\nimport { WithdrawMethodScreen } from '../screens/WithdrawMethodScreen'\nimport { SwappedWithdrawScreen } from '../swapped/SwappedWithdrawScreen'\nimport { toWithdrawFopRows } from '../transfer/fops'\nimport {\n WITHDRAW_FOPS_QUERY_KEY,\n useWithdrawalFops,\n} from '../transfer/hooks/useWithdrawalFops'\nimport type { DepositAddressOrHash } from '../withdrawal/useCryptoWithdrawalExecution'\nimport { useWithdrawalExecution } from '../withdrawal/useWithdrawalExecution'\nimport type { SafeClipboardReader } from '../transfer/clipboard'\nimport type { FlowNav, FlowScreen } from './FunkitFlowProvider'\nimport type {\n WithdrawalFlowCallbacks,\n WithdrawalFlowConfig,\n} from './withdrawalFlowConfig'\n\n// The synthetic id of the built-in \"Crypto address\" payout row. Cash rows are\n// keyed by their positional index, so a non-numeric id can't collide.\nconst CRYPTO_WITHDRAWAL_METHOD_ID = 'crypto-withdrawal'\n\n// Host method ids are opaque strings we don't control, and a cash row is keyed\n// by its index \u2014 so a host id of `\"0\"` would otherwise open the first cash\n// payout embed. Namespaced on the way in, stripped on the way out.\nconst HOST_METHOD_ID_PREFIX = 'method:'\n\n/**\n * The live withdrawal-flow body (Swapped fiat offramp): payout-method list \u2192\n * the Swapped sell embed \u2192 on a validated order, the on-chain leg\n * ({@link useWithdrawalExecution}) delivers the exact ordered amount to\n * Swapped's deposit address through the host wallet. Sibling of the deposit\n * FlowContent, mounted only while a withdrawal flow is open so its\n * queries run only then.\n */\nexport function WithdrawalFlowContent({\n config,\n callbacks,\n current,\n nav,\n pasteFromClipboard,\n}: {\n config: WithdrawalFlowConfig\n callbacks: WithdrawalFlowCallbacks\n current: FlowScreen | undefined\n nav: FlowNav\n /** Fills the recipient field on the address step. Guarded upstream. */\n pasteFromClipboard: SafeClipboardReader\n}): ReactNode {\n const { t } = useFunkitTranslation()\n const { isGeoblocked, isLoadingGeoCheck } = useCheckoutBlocked({\n onCheckoutBlocked: callbacks.onCheckoutBlocked,\n })\n const queryClient = useQueryClient()\n\n const { fops, isLoading, isBelowMinimumBalance, isError, route } =\n useWithdrawalFops({ config })\n\n // Methods the host resolved (see `@funkit/connect-rn/clients/*`). The picked\n // one carries the config the crypto form then runs, so nothing here knows\n // which venue \u2014 or whether there is one.\n const methodOptions = config.methods ?? []\n const [selectedMethodId, setSelectedMethodId] = useState<string>()\n const selectedMethodConfig = methodOptions.find(\n (method) => method.id === selectedMethodId,\n )?.config\n\n // The payout method the user picked (the whole FOP \u2014 the embed URL drives\n // the Swapped screen; type/name feed the decision-point log).\n const [selectedFop, setSelectedFop] = useState<SwappedFormOfPayment>()\n\n // Unrecoverable execution failure \u2014 replaces the embed with a retryable\n // error state (web parity: the iframe controller's error branch).\n const [hasExecutionError, setHasExecutionError] = useState(false)\n\n // Survives the form unmounting so the success screen can report on it.\n const [submittedWithdrawal, setSubmittedWithdrawal] = useState<{\n depositAddressOrHash: DepositAddressOrHash\n amountLabel: string\n usdLabel: string | undefined\n tokenLabel: string | undefined\n }>()\n\n // Stable so it doesn't rebuild `executeOrder` (it's in that useCallback's deps).\n const onExecutionError = useCallback(() => setHasExecutionError(true), [])\n const { executeOrder } = useWithdrawalExecution({\n config,\n route,\n callbacks,\n onError: onExecutionError,\n })\n\n // The embed's method list can go stale while it's open (web parity: the\n // controller invalidates on back/new-withdrawal/success).\n const invalidateWithdrawFops = useCallback(() => {\n void queryClient.invalidateQueries({ queryKey: [WITHDRAW_FOPS_QUERY_KEY] })\n }, [queryClient])\n\n if (hasExecutionError) {\n return (\n <WithdrawMethodScreen\n title={config.title ?? t('withdraw.title')}\n methods={[]}\n hasError\n onRetry={() => {\n setHasExecutionError(false)\n invalidateWithdrawFops()\n // Reset to the method list \u2014 `back()` would close the whole sheet if\n // the user had already popped the embed before execution failed.\n nav.reset('withdrawMethod')\n }}\n onSelectMethod={() => undefined}\n />\n )\n }\n\n switch (current) {\n case 'withdrawMethod': {\n // Id by array index, not `<fopType>:<name>` \u2014 Swapped can return two\n // methods that share both yet carry distinct `embeddedFlowUrl`s, so a\n // key-based lookup could open the wrong payout embed. Rows are positional\n // 1:1 with `fops`, so the index resolves the exact selected FOP.\n const cashMethods: PaymentMethodOption[] = toWithdrawFopRows(t, fops).map(\n (row, i) => ({\n id: String(i),\n title: row.name,\n subtitle: row.subtitle,\n icon: <PaymentMethodIcon fop={fops[i]} />,\n }),\n )\n // Crypto is unconditional \u2014 no provider, no region gate (web geoblocks\n // nothing here either). Cash rows stay while they may still arrive; their\n // absence gets a note, not a takeover (web: showFopsList/NoCashMethodsNote).\n const showCashList = isLoading || cashMethods.length > 0\n const genericCryptoRow: PaymentMethodOption = {\n id: CRYPTO_WITHDRAWAL_METHOD_ID,\n title: t('withdrawCrypto.methodTitle'),\n subtitle: t('withdrawCrypto.methodSubtitle'),\n icon: <CryptoBitcoinIcon />,\n }\n // Host-supplied methods replace the generic crypto row: a venue whose\n // balance lives off-chain has nothing for a plain send-to-address form to\n // send. With none resolved the generic row stays as the floor, so the\n // user is never left unable to withdraw crypto at all.\n const cryptoMethods: PaymentMethodOption[] = methodOptions.length\n ? methodOptions.map((method) => ({\n id: `${HOST_METHOD_ID_PREFIX}${method.id}`,\n title: method.title,\n subtitle: method.subtitle,\n icon: method.icon ?? <CryptoBitcoinIcon />,\n }))\n : [genericCryptoRow]\n const methods: PaymentMethodOption[] = [\n ...cryptoMethods,\n // Below Swapped's minimum sell, cash stays visible but unselectable \u2014\n // dimming explains more than hiding would.\n ...(showCashList\n ? cashMethods.map((row) => ({\n ...row,\n disabled: isBelowMinimumBalance,\n }))\n : []),\n ]\n // A failed or never-run fetch is an error, not a statement about the\n // user's region (web: `hasFopsResult`).\n const cashNote = showCashList\n ? undefined\n : isError\n ? t('withdraw.cashMethodsError')\n : t('withdraw.noCashMethods')\n return (\n <WithdrawMethodScreen\n title={config.title ?? t('withdraw.title')}\n methods={methods}\n // Deliberately NOT gated on the cash fetch: sending on-chain needs\n // nothing from it, so a skeleton over the whole list would hide a\n // ready option. Cash rows append when they arrive, as they do on web.\n loading={isLoadingGeoCheck}\n note={cashNote}\n onSelectMethod={(id) => {\n const hostMethodId = id.startsWith(HOST_METHOD_ID_PREFIX)\n ? id.slice(HOST_METHOD_ID_PREFIX.length)\n : undefined\n if (id === CRYPTO_WITHDRAWAL_METHOD_ID || hostMethodId) {\n // Rail decision point \u2014 which balance and which execution path.\n logger.info('connect-rn:crypto-withdrawal:method_selected', {\n methodId: hostMethodId ?? id,\n })\n // Undefined for the generic row, which runs the host's own config.\n setSelectedMethodId(hostMethodId)\n nav.navigate('withdrawAmount')\n return\n }\n const fop = fops[Number(id)]\n if (!fop?.embeddedFlowUrl) {\n return\n }\n // Payout-provider decision point.\n logger.info('connect-rn:withdrawal:method_selected', {\n fopType: fop.fopType,\n fopName: fop.name,\n })\n setSelectedFop(fop)\n nav.navigate('swapped')\n }}\n />\n )\n }\n case 'withdrawAmount':\n case 'withdrawAddress':\n case 'withdrawReceiveToken':\n return (\n <WithdrawCryptoSteps\n config={selectedMethodConfig ?? config}\n callbacks={callbacks}\n current={current}\n nav={nav}\n pasteFromClipboard={pasteFromClipboard}\n // Off the same config the steps run, so a host that sets a fee without\n // supplying methods still has it charged.\n quoteInputFeeTokens={\n (selectedMethodConfig ?? config).quoteInputFeeTokens ?? 0\n }\n quoteInputFeeSettled={\n (selectedMethodConfig ?? config).quoteInputFeeSettled ?? true\n }\n extraSourceGasUsd={\n (selectedMethodConfig ?? config).extraSourceGasUsd ?? 0\n }\n onSubmitted={(result) => {\n setSubmittedWithdrawal(result)\n // Replace, not push: the funds have moved, so going \"back\" into a\n // form that would submit again is the wrong affordance.\n nav.reset('withdrawComplete')\n }}\n />\n )\n case 'withdrawComplete':\n return submittedWithdrawal ? (\n <WithdrawCryptoComplete\n depositAddressOrHash={submittedWithdrawal.depositAddressOrHash}\n amountLabel={submittedWithdrawal.amountLabel}\n usdLabel={submittedWithdrawal.usdLabel}\n tokenLabel={submittedWithdrawal.tokenLabel}\n callbacks={callbacks}\n onDone={nav.closeFlow}\n />\n ) : null\n case 'swapped':\n return selectedFop?.embeddedFlowUrl ? (\n <SwappedWithdrawScreen\n url={selectedFop.embeddedFlowUrl}\n onBack={() => {\n invalidateWithdrawFops()\n nav.back()\n }}\n onClose={() => {\n invalidateWithdrawFops()\n nav.closeFlow()\n }}\n onNewWithdrawal={() => {\n invalidateWithdrawFops()\n nav.back()\n }}\n onWithdrawalSuccess={(data) => {\n invalidateWithdrawFops()\n callbacks.onWithdrawalSuccess?.(data)\n }}\n onOrderData={(order) => {\n // The host notification is informational \u2014 a throw from it must not\n // skip the on-chain execution (the critical leg for this order).\n try {\n callbacks.onWithdrawalOrder?.(order)\n } catch (error) {\n logger.warn('connect-rn:withdrawal:order_callback_threw', {\n order_id: order.order_id,\n error: error instanceof Error ? error.message : String(error),\n })\n }\n void executeOrder(order)\n }}\n />\n ) : null\n default:\n return null\n }\n}\n", "import { useEffect, useRef } from 'react'\n\nimport type { WithdrawalFlowCallbacks } from '../flow/withdrawalFlowConfig'\nimport { logger } from '../logging/logger'\nimport type { DepositAddressOrHash } from '../withdrawal/useCryptoWithdrawalExecution'\nimport { useDepositAddressWithdrawalStatus } from '../withdrawal/useDepositAddressWithdrawalStatus'\nimport { useWithdrawalStatus } from '../withdrawal/useWithdrawalStatus'\nimport {\n WithdrawCompleteScreen,\n type WithdrawalStatus,\n} from './WithdrawCompleteScreen'\n\n/**\n * Follows a submitted crypto withdrawal to a terminal state. Split from the\n * screen so the polling query unmounts with it, and so the host is told exactly\n * once, when the chain settles rather than when we submitted.\n *\n * Both trackers are called on every render and the unused one idles on\n * `undefined` \u2014 a hook cannot be called conditionally, and the rail is fixed for\n * the life of this screen anyway.\n *\n * The callbacks are fired from an effect, where a throw would unmount the tree \u2014\n * they arrive guarded (`guardHostCallbacks`), which is what makes that safe.\n *\n * Closing the flow ends the follow with it \u2014 the SDK runs no work behind a shut\n * sheet. The host still holds what `onWithdrawalSubmitted` gave it at submit and\n * can settle the transfer itself; the log below is how often that happens.\n */\nexport function WithdrawCryptoComplete({\n depositAddressOrHash,\n amountLabel,\n usdLabel,\n tokenLabel,\n callbacks,\n onDone,\n}: {\n depositAddressOrHash: DepositAddressOrHash\n amountLabel: string\n /** What arrived, frozen at submission. */\n usdLabel: string | undefined\n tokenLabel: string | undefined\n callbacks: WithdrawalFlowCallbacks\n onDone: () => void\n}) {\n const isVenueSubmitted = depositAddressOrHash.kind === 'depositAddress'\n const byTransaction = useWithdrawalStatus(\n depositAddressOrHash.kind === 'transaction'\n ? depositAddressOrHash.txHash\n : undefined,\n )\n const byDepositAddress = useDepositAddressWithdrawalStatus(\n depositAddressOrHash.kind === 'depositAddress'\n ? depositAddressOrHash.depositAddress\n : undefined,\n )\n const { isCompleted, isFailed, isRefunded } = isVenueSubmitted\n ? byDepositAddress\n : byTransaction\n // Completion is always established from a transaction, whichever rail ran \u2014\n // ours on the relay path, the one recording the arrival on the venue path.\n const txHash = isVenueSubmitted\n ? byDepositAddress.txHash\n : depositAddressOrHash.txHash\n const notifiedRef = useRef(false)\n\n useEffect(() => {\n if (notifiedRef.current) {\n return\n }\n if (isCompleted) {\n notifiedRef.current = true\n callbacks.onWithdrawalSuccess?.({ txHash })\n return\n }\n // A relay FAILURE or REFUND is not \"still settling\": the transfer left the\n // wallet but never reached the recipient, so the host hears about it.\n if (isFailed) {\n notifiedRef.current = true\n callbacks.onWithdrawalError?.({\n message: isRefunded\n ? 'Withdrawal was refunded'\n : 'Withdrawal failed on-chain',\n })\n }\n }, [isCompleted, isFailed, isRefunded, callbacks, txHash])\n\n useEffect(\n () => () => {\n if (notifiedRef.current) {\n return\n }\n // The venue rail settles minutes after \"requested\", so closing first is\n // the expected path.\n if (isVenueSubmitted) {\n logger.info('crypto-withdrawal:closed_before_arrival', {\n depositAddressOrHash,\n })\n return\n }\n logger.warn('connect-rn:crypto-withdrawal:outcome_unreported', {\n depositAddressOrHash,\n })\n },\n [depositAddressOrHash, isVenueSubmitted],\n )\n\n return (\n <WithdrawCompleteScreen\n status={resolveStatus({\n isCompleted,\n isFailed,\n isRefunded,\n isVenueSubmitted,\n })}\n amountLabel={amountLabel}\n usdLabel={usdLabel}\n tokenLabel={tokenLabel}\n onDone={onDone}\n />\n )\n}\n\n/**\n * A venue-submitted withdrawal reads as done the moment the venue takes it: the\n * rest is out of the user's hands, and nothing of ours is on-chain to watch. It\n * still upgrades to `complete` if the funds land while the sheet is open.\n */\nfunction resolveStatus({\n isCompleted,\n isFailed,\n isRefunded,\n isVenueSubmitted,\n}: {\n isCompleted: boolean\n isFailed: boolean\n isRefunded: boolean\n isVenueSubmitted: boolean\n}): WithdrawalStatus {\n if (isRefunded) {\n return 'refunded'\n }\n if (isFailed) {\n return 'failed'\n }\n if (isCompleted) {\n return 'complete'\n }\n return isVenueSubmitted ? 'requested' : 'settling'\n}\n", "import {\n getCompletionTxInfo,\n resolveOnChainCompletionTxHash,\n useDirectExecutionForDepositAddress,\n} from '@funkit/connect-core'\nimport { useEffect, useState } from 'react'\nimport type { Address } from 'viem'\n\nimport {\n UNSET_WALLET_ADDRESS,\n useFunkitIdentity,\n} from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\nimport {\n type WithdrawalStatusResult,\n useWithdrawalStatus,\n} from './useWithdrawalStatus'\n\n/**\n * Slow by default because a venue settles in minutes, not seconds \u2014 a faster\n * cadence only burns polls on a record the backend has not seen yet. Callers\n * that know their venue's cadence can say so.\n */\nconst DEFAULT_POLL_INTERVAL_MS = 10_000\n\nexport interface DepositAddressWithdrawalStatus extends WithdrawalStatusResult {\n /**\n * Tx hash of the transaction that delivered the funds on the destination chain.\n * Undefined cross-chain until the bridge fills and reports that transaction.\n */\n txHash: string | undefined\n}\n\n/**\n * Follows a withdrawal a venue submitted for us, which left a deposit address\n * rather than a transaction of ours.\n *\n * Two stages: find the direct execution that records the arrival at that\n * address, then follow it with {@link useWithdrawalStatus} exactly as the relay\n * rail does \u2014 so both rails agree on what a status means. Stage one is shared\n * with web, including the guard against an earlier withdrawal that reused the\n * same address reading as an instant success.\n */\nexport function useDepositAddressWithdrawalStatus(\n depositAddress: Address | undefined,\n pollIntervalMs: number = DEFAULT_POLL_INTERVAL_MS,\n): DepositAddressWithdrawalStatus {\n const { apiKey, walletAddress } = useFunkitIdentity()\n\n // The finder takes a flat interval and would keep asking about a finished\n // withdrawal, so the outcome is latched for the next render.\n const [hasSettled, setHasSettled] = useState(false)\n\n const { latestStep, isFinalStep } = useDirectExecutionForDepositAddress({\n depositAddress,\n apiKey,\n // The wallet, not the host's `userId`: the deposit address is registered\n // under the owner wallet, and the scanner records the arrival there.\n // The unset sentinel is truthy, so the finder needs it mapped away or it\n // polls for a user that does not exist.\n walletAddress: walletAddress === UNSET_WALLET_ADDRESS ? '' : walletAddress,\n pollIntervalMs,\n hasSettled,\n logger,\n })\n\n const arrivalStatus = useWithdrawalStatus(latestStep?.txHash)\n // SUCCESS on an intermediary step is not delivery \u2014 the funds are still\n // bridging, and saying otherwise would land the screen early.\n const isCompleted = arrivalStatus.isCompleted && isFinalStep\n const completionTxHash = latestStep\n ? resolveOnChainCompletionTxHash(\n latestStep,\n getCompletionTxInfo(latestStep).txHash,\n )\n : undefined\n\n useEffect(() => {\n if (isCompleted || arrivalStatus.isFailed) {\n setHasSettled(true)\n }\n }, [isCompleted, arrivalStatus.isFailed])\n\n return { ...arrivalStatus, isCompleted, txHash: completionTxHash }\n}\n", "import {\n CheckoutState,\n RelayExecutionStatus,\n getDirectExecutionByTxHash,\n} from '@funkit/api-base'\nimport {\n isDirectExecutionNotFound,\n isTerminalRelayStatus,\n mapRelayExecutionStatusToCheckoutState,\n} from '@funkit/connect-core'\nimport { useQuery } from '@tanstack/react-query'\nimport { useRef } from 'react'\n\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\n\nexport const WITHDRAWAL_STATUS_QUERY_KEY = 'withdrawalStatus'\n\n/** Web polls the same record at this cadence. */\nconst POLL_INTERVAL_MS = 1_500\n\n// How many times the backend may say \"no such record\" before we stop asking. Web\n// polls indefinitely, but its caller seeds the query with a record it already\n// has; here the record may never be written, and this screen can sit open.\nconst MAX_FETCHES_WITHOUT_RECORD = 10\n\n/**\n * Whether there is still anything to learn by asking again. Split out because\n * the \"record never appeared\" bound is the part worth testing directly \u2014 driving\n * it through the query would mean waiting out real poll intervals.\n *\n * Only answered-and-absent counts against the bound: a network or 5xx failure\n * says nothing about the record, so giving up on one would abandon a withdrawal\n * we could still have followed.\n */\nexport function shouldKeepPollingStatus({\n status,\n hasRecord,\n notFoundFetches,\n}: {\n status: RelayExecutionStatus | undefined\n hasRecord: boolean\n notFoundFetches: number\n}): boolean {\n if (isTerminalRelayStatus(status)) {\n return false\n }\n return hasRecord || notFoundFetches < MAX_FETCHES_WITHOUT_RECORD\n}\n\nexport interface WithdrawalStatusResult {\n status: RelayExecutionStatus | undefined\n /** Confirmed on-chain. Only `SUCCESS` \u2014 not merely \"stopped moving\". */\n isCompleted: boolean\n /** `FAILURE` or `REFUND`: the transfer did not reach the recipient. */\n isFailed: boolean\n /** Funds came back to the sender, so there is nothing to chase. */\n isRefunded: boolean\n}\n\n/**\n * Follow a submitted withdrawal to a terminal state.\n *\n * The record is written best-effort by the pipeline, so a missing one is not a\n * failure \u2014 the transfer is already on-chain. It just means we cannot report\n * progress, and polling stops rather than hammering the API forever. An\n * explicit terminal failure is different, and is reported as one.\n */\nexport function useWithdrawalStatus(\n txHash: string | undefined,\n): WithdrawalStatusResult {\n const { apiKey } = useFunkitIdentity()\n // Counted here because react-query's own `errorUpdateCount` cannot tell \"no\n // such record\" from \"could not ask\".\n const notFoundFetches = useRef(0)\n\n // The bound is per hash, not per mount: a caller that advances through the\n // steps of a route would otherwise hand the arrival a budget an earlier step\n // had already spent, and never poll it.\n const countedFor = useRef(txHash)\n if (countedFor.current !== txHash) {\n countedFor.current = txHash\n notFoundFetches.current = 0\n }\n\n const query = useQuery({\n queryKey: [WITHDRAWAL_STATUS_QUERY_KEY, apiKey, txHash],\n queryFn: async () => {\n try {\n const record = await getDirectExecutionByTxHash({\n txHash: txHash as `0x${string}`,\n apiKey,\n logger,\n })\n notFoundFetches.current = 0\n return record\n } catch (error) {\n if (isDirectExecutionNotFound(error)) {\n notFoundFetches.current += 1\n }\n throw error\n }\n },\n enabled: !!apiKey && !!txHash,\n refetchInterval: (query) => {\n const hasRecord = query.state.data !== undefined\n const keepPolling = shouldKeepPollingStatus({\n status: query.state.data?.listenerInfo?.status,\n hasRecord,\n notFoundFetches: notFoundFetches.current,\n })\n if (keepPolling) {\n return POLL_INTERVAL_MS\n }\n if (!hasRecord) {\n logger.warn('connect-rn:crypto-withdrawal:status_record_never_appeared')\n }\n return false\n },\n refetchOnWindowFocus: false,\n retry: 3,\n })\n\n const status = query.data?.listenerInfo?.status\n // Same mapping web reads through `useCheckoutDirectExecutionHistory`, so both\n // platforms agree on what a status means.\n const state = status\n ? mapRelayExecutionStatusToCheckoutState(status)\n : undefined\n return {\n status,\n isCompleted: state === CheckoutState.COMPLETED,\n isFailed: state === CheckoutState.CHECKOUT_ERROR,\n isRefunded: status === RelayExecutionStatus.REFUND,\n }\n}\n", "import {\n ActivityIndicator,\n StyleSheet,\n useWindowDimensions,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { PillButton } from '../components/PillButton'\nimport { ReceiveAmountSummary } from '../components/ReceiveAmountSummary'\nimport {\n FigmaAlertCircleIcon,\n FigmaSuccessCheckIcon,\n} from '../icons/FigmaSystemIcons'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { footerBottomMargin } from '../utils/safeArea'\n\n// The design's own check, larger than any `icon/system` step.\nconst OUTCOME_ICON_SIZE = 46\n\n/**\n * Where the withdrawal has got to. One value rather than a set of booleans:\n * `settling` and `requested` differ only in whether anything of ours is still\n * being watched, and as flags they could both be set at once.\n */\nexport type WithdrawalStatus =\n /** Ours is on-chain and still settling. */\n | 'settling'\n /** A venue accepted it; there is nothing of ours left to watch. */\n | 'requested'\n | 'complete'\n /** The relay reported a terminal failure \u2014 not merely a slow settle. */\n | 'failed'\n /** Failed, and the funds are on their way back to the sender. */\n | 'refunded'\n\nexport interface WithdrawCompleteScreenProps {\n status: WithdrawalStatus\n /** What left the account, for the copy a failure needs. */\n amountLabel: string\n /**\n * What arrived, frozen at submission \u2014 the quote is long gone by now, so\n * `undefined` means it was never priced rather than not priced yet.\n */\n usdLabel: string | undefined\n tokenLabel: string | undefined\n onDone: () => void\n}\n\n/**\n * The outcome of a submitted withdrawal, on the figure the recipient step ended\n * on: the amount stays where it was and the chrome around it is gone, so\n * arriving here reads as the same screen settling rather than a new one.\n *\n * A missing or slow record reads as \"still settling\" rather than a failure \u2014 it\n * is written best-effort and the funds have already moved \u2014 but an explicit\n * terminal failure is shown as one.\n */\nexport function WithdrawCompleteScreen({\n status,\n amountLabel,\n usdLabel,\n tokenLabel,\n onDone,\n}: WithdrawCompleteScreenProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const { height } = useWindowDimensions()\n const insets = useSafeAreaInsets()\n // The quote is gone by the time this screen renders, so a figure it never\n // priced is not on its way: lead with what is known \u2014 down to what left the\n // account \u2014 rather than leaving the step's placeholders standing for good.\n const leadLabel = usdLabel ?? tokenLabel ?? amountLabel\n const secondaryLabel = usdLabel === undefined ? undefined : tokenLabel\n const isFailed = status === 'failed' || status === 'refunded'\n // Only our own transfer is still being watched; a requested one is done here.\n const isSettling = status === 'settling'\n\n return (\n <Box\n style={{\n height,\n paddingTop: insets.top,\n backgroundColor: theme.background.modal,\n }}\n >\n <Box flex={1} justifyContent=\"center\" style={styles.summary}>\n <ReceiveAmountSummary\n icon={resolveIcon({ theme, status })}\n label={resolveLabel({ t, status })}\n usdLabel={leadLabel}\n tokenLabel={secondaryLabel}\n isQuotePending={false}\n />\n {isFailed ? (\n <Text\n variant=\"detail\"\n style={[styles.detail, { color: theme.content.elements.secondary }]}\n >\n {status === 'refunded'\n ? t('withdrawCrypto.refundedMessage', { amount: amountLabel })\n : t('withdrawCrypto.failedMessage', { amount: amountLabel })}\n </Text>\n ) : null}\n </Box>\n\n <Box\n style={[\n styles.footer,\n { marginBottom: footerBottomMargin(insets.bottom) },\n ]}\n >\n {isSettling ? (\n <PillButton\n label={t('withdrawAddress.withdrawing')}\n icon={\n <ActivityIndicator\n size=\"small\"\n color={theme.content.button.primary.default}\n />\n }\n disabled\n onPress={onDone}\n />\n ) : (\n <PillButton label={t('common.close')} onPress={onDone} />\n )}\n </Box>\n </Box>\n )\n}\n\ntype TFunc = ReturnType<typeof useFunkitTranslation>['t']\n\nfunction resolveIcon({\n theme,\n status,\n}: {\n theme: ReturnType<typeof useTheme>\n status: WithdrawalStatus\n}) {\n switch (status) {\n case 'failed':\n case 'refunded':\n return (\n <FigmaAlertCircleIcon\n size={OUTCOME_ICON_SIZE}\n color={theme.content.elements.error}\n />\n )\n // Nothing marks it: a check that arrived before the chain had would be a lie.\n case 'settling':\n return undefined\n default:\n return <FigmaSuccessCheckIcon size={OUTCOME_ICON_SIZE} />\n }\n}\n\nfunction resolveLabel({\n t,\n status,\n}: {\n t: TFunc\n status: WithdrawalStatus\n}): string {\n switch (status) {\n case 'failed':\n case 'refunded':\n return t('withdrawCrypto.failedTitle')\n // Still going: the design leaves the label as it was on the step before, and\n // lets the button carry the news.\n case 'settling':\n return t('withdrawAddress.youllReceive')\n case 'requested':\n return t('withdrawAddress.requested')\n default:\n return t('withdrawAddress.withdrew')\n }\n}\n\nconst styles = StyleSheet.create({\n // The band the figure is centred in, matching the recipient step's own, so the\n // amount doesn't move when this screen replaces it.\n summary: { paddingHorizontal: 20, paddingVertical: 12, gap: 16 },\n detail: { textAlign: 'center' },\n footer: { marginHorizontal: 20 },\n})\n", "import type { ReactNode } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\n\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport type { FunkitTheme } from '../theme/toRestyleTheme'\n\nexport type PillButtonSize = Extract<\n keyof FunkitTheme['sizes'],\n `button${string}`\n>\n\nexport type PillButtonVariant = 'primary' | 'secondary'\n\nexport interface PillButtonProps {\n label: string\n onPress: () => void\n /** Leading content inside the pill, e.g. a 16px icon. */\n icon?: ReactNode\n size?: PillButtonSize\n /** `secondary` is the quieter fill used for side-by-side actions. */\n variant?: PillButtonVariant\n /** `element` squares the corners off where the design butts the button\n * against a card of the same radius. */\n radius?: Extract<keyof FunkitTheme['borderRadii'], 'button' | 'element'>\n disabled?: boolean\n /** Defaults to `label`. */\n accessibilityLabel?: string\n}\n\n/**\n * The full-width primary action at the foot of a sheet \u2014 Confirm, Cancel, Done.\n * Width comes from the container, so callers control the horizontal inset.\n */\nexport function PillButton({\n label,\n onPress,\n icon,\n size = 'buttonLg',\n variant = 'primary',\n radius = 'button',\n disabled = false,\n accessibilityLabel,\n}: PillButtonProps) {\n const theme = useTheme()\n const surface = theme.background.button[variant]\n const labelColor = theme.content.button[variant].default\n\n return (\n <Pressable\n onPress={onPress}\n disabled={disabled}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel ?? label}\n accessibilityState={{ disabled }}\n >\n {/* Disabled dims the fill rather than recoloring it (the token export has\n no disabled button color), so an opaque backing keeps whatever sits\n behind \u2014 a scrolling list \u2014 from reading through the button. */}\n <Box\n borderRadius={radius}\n style={{ backgroundColor: theme.background.modal }}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius={radius}\n style={[\n styles.pill,\n variant === 'secondary' ? styles.secondaryPill : null,\n {\n height: theme.sizes[size],\n backgroundColor: surface.default,\n opacity: disabled ? theme.opacity.disabled / 100 : 1,\n },\n ]}\n >\n {icon}\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n style={{ color: labelColor }}\n >\n {label}\n </Text>\n </Box>\n </Box>\n </Pressable>\n )\n}\n\nconst styles = StyleSheet.create({\n pill: { paddingHorizontal: 24, gap: 8 },\n // The design's own inset for these (`px-10` vs the primary's `px-24`): they\n // sit several-across, where 24 leaves no room for the label and it ellipsises.\n secondaryPill: { paddingHorizontal: 10 },\n})\n", "import type { ReactNode } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\nimport Animated, {\n Easing,\n FadeIn,\n LinearTransition,\n} from 'react-native-reanimated'\n\nimport { FigmaInfoCircleIcon } from '../icons/FigmaSystemIcons'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { SkeletonBar } from './SkeletonBar'\n\nconst AnimatedBox = Animated.createAnimatedComponent(Box)\n\n// The settled state's check mounting fresh \u2014 a plain fade, no scale or travel\n// of its own. What moves is the figure it displaces.\nconst ICON_ENTERING = FadeIn.duration(420)\n// The figure riding down as the check claims the line above it. The overshoot\n// is where the design's bounce actually lives, not on the check. Both boxes the\n// check displaces carry it \u2014 the block re-centres as it grows while the figure\n// drops inside it, and animating only one of them snaps the other.\nconst DISPLACED_TRANSITION = LinearTransition.duration(420).easing(\n Easing.bezier(0.34, 1.56, 0.64, 1),\n)\n\n// Figma's summary amount, which `font/*` has no step to mirror. The tracking is\n// the design's own -0.96 at 64, kept as a ratio so it travels with the size.\nconst AMOUNT_FONT_SIZE = 64\nconst LETTER_SPACING_RATIO = -0.96 / 64\n// The design trims the amount to its cap box (45 at 64) \u2014 something RN can't do,\n// since the line box is what it lays out. A line box shorter than the font's\n// natural one gets the glyphs cut off on iOS, so the dead space is taken back as\n// a negative margin instead, leaving the design's gaps between the cap boxes.\nconst LINE_HEIGHT_RATIO = 1.25\nconst CAP_BOX_RATIO = 45 / 64\nconst AMOUNT_LINE_HEIGHT = AMOUNT_FONT_SIZE * LINE_HEIGHT_RATIO\nconst AMOUNT_OVERHANG =\n (AMOUNT_FONT_SIZE * (LINE_HEIGHT_RATIO - CAP_BOX_RATIO)) / 2\n// Roughly what a four-figure amount occupies, so the figure landing doesn't\n// shift the block it is centred in.\nconst AMOUNT_SKELETON_WIDTH = 200\nconst TOKEN_SKELETON_WIDTH = 96\n\nexport interface ReceiveAmountSummaryProps {\n /** Sits above the label, e.g. the settled state's check. */\n icon?: ReactNode\n /** Names what the figure is, e.g. `You'll receive`. */\n label: string\n /**\n * The figure the screen leads with, in the user's currency. `undefined` until\n * the quote settles, which is what the placeholders stand in for.\n */\n usdLabel: string | undefined\n /** The same amount in the token that arrives, e.g. `99.78 USDC`. */\n tokenLabel: string | undefined\n /**\n * Whether a missing figure is still on its way. `false` leaves its place\n * empty: once the figures are frozen a placeholder would never resolve.\n */\n isQuotePending?: boolean\n /** Opens the breakdown. Omit to drop the affordance with it. */\n onPressBreakdown?: () => void\n}\n\n/**\n * What the withdrawal lands as: the figure, and the token it arrives in. The\n * screen's centrepiece once there is a quote to show.\n */\nexport function ReceiveAmountSummary({\n icon,\n label,\n usdLabel,\n tokenLabel,\n isQuotePending = true,\n onPressBreakdown,\n}: ReceiveAmountSummaryProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n\n return (\n <AnimatedBox\n alignItems=\"center\"\n justifyContent=\"center\"\n layout={DISPLACED_TRANSITION}\n style={styles.root}\n >\n {icon ? <AnimatedBox entering={ICON_ENTERING}>{icon}</AnimatedBox> : null}\n <AnimatedBox\n alignItems=\"center\"\n alignSelf=\"stretch\"\n layout={DISPLACED_TRANSITION}\n style={styles.figure}\n >\n <Text\n variant=\"detail\"\n weight=\"medium\"\n style={{ color: theme.content.elements.secondary }}\n >\n {label}\n </Text>\n\n {usdLabel === undefined ? null : (\n <Text\n weight=\"medium\"\n numberOfLines={1}\n style={[styles.amount, { color: theme.content.elements.primary }]}\n >\n {usdLabel}\n </Text>\n )}\n {usdLabel === undefined && isQuotePending ? (\n <SkeletonBar\n width={AMOUNT_SKELETON_WIDTH}\n height={AMOUNT_FONT_SIZE * CAP_BOX_RATIO}\n borderRadius={theme.borderRadii.element}\n />\n ) : null}\n\n {tokenLabel === undefined && isQuotePending ? (\n <SkeletonBar\n width={TOKEN_SKELETON_WIDTH}\n height={theme.textVariants.bodyMedium.lineHeight}\n />\n ) : null}\n {tokenLabel === undefined ? null : (\n <Pressable\n onPress={onPressBreakdown}\n disabled={!onPressBreakdown}\n accessibilityRole={onPressBreakdown ? 'button' : undefined}\n accessibilityLabel={\n onPressBreakdown\n ? t('withdrawAddress.breakdownTitle')\n : tokenLabel\n }\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n style={styles.tokenRow}\n >\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.secondary }}\n >\n {tokenLabel}\n </Text>\n {onPressBreakdown ? (\n <FigmaInfoCircleIcon\n size={16}\n color={theme.content.elements.secondary}\n />\n ) : null}\n </Box>\n </Pressable>\n )}\n </AnimatedBox>\n </AnimatedBox>\n )\n}\n\nconst styles = StyleSheet.create({\n root: { gap: 24 },\n figure: { gap: 24 },\n amount: {\n fontSize: AMOUNT_FONT_SIZE,\n lineHeight: AMOUNT_LINE_HEIGHT,\n letterSpacing: AMOUNT_FONT_SIZE * LETTER_SPACING_RATIO,\n marginVertical: -AMOUNT_OVERHANG,\n },\n tokenRow: { gap: 6 },\n})\n", "import { Animated } from 'react-native'\n\nimport { usePulse } from '../hooks/usePulse'\nimport { useTheme } from '../theme/restyle'\n\nexport interface SkeletonBarProps {\n /** Sized to the text it stands in for, so nothing moves when the value lands. */\n width: number\n height: number\n /** The design rounds a text-height bar at 4, and a display-sized one further. */\n borderRadius?: number\n}\n\n/** A value that hasn't arrived yet. */\nexport function SkeletonBar({\n width,\n height,\n borderRadius = 4,\n}: SkeletonBarProps) {\n const theme = useTheme()\n const opacity = usePulse()\n return (\n <Animated.View\n accessibilityRole=\"progressbar\"\n style={{\n width,\n height,\n borderRadius,\n opacity,\n backgroundColor: theme.background.pill.pressed,\n }}\n />\n )\n}\n", "// The design measures the footer to the top of the home indicator, which only the\n// insets know the height of; the floor stands in on a device without one.\nconst FOOTER_GAP = 16\nconst FOOTER_MIN = 24\n\n/** What a full-window step's footer keeps between itself and the screen edge. */\nexport function footerBottomMargin(bottomInset: number): number {\n return Math.max(FOOTER_GAP + bottomInset, FOOTER_MIN)\n}\n", "import { BottomSheetModal, BottomSheetView } from '@gorhom/bottom-sheet'\nimport { useFeatureGate } from '@funkit/connect-core'\nimport { useState } from 'react'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { FlowSheetBackground } from '../flow/FlowSheet'\nimport {\n isUsableWalletAddress,\n useFunkitIdentity,\n} from '../identity/IdentityContext'\nimport type { FlowNav, FlowScreen } from '../flow/FunkitFlowProvider'\nimport type {\n WithdrawalFlowCallbacks,\n WithdrawalFlowConfig,\n} from '../flow/withdrawalFlowConfig'\nimport { useIsStablecoin } from '../hooks/useIsStablecoin'\nimport { useNestedSheet } from '../hooks/useNestedSheet'\nimport { logger } from '../logging/logger'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport type { SafeClipboardReader } from '../transfer/clipboard'\nimport {\n formatTokenAmount,\n formatUsd,\n groupThousands,\n} from '../utils/formatAmount'\nimport { useCryptoWithdrawalForm } from '../withdrawal/useCryptoWithdrawalForm'\nimport type { DepositAddressOrHash } from '../withdrawal/useCryptoWithdrawalExecution'\nimport { useCryptoWithdrawalSubmit } from '../withdrawal/useCryptoWithdrawalSubmit'\nimport { SelectReceiveTokenAndChainScreen } from './SelectReceiveTokenAndChainScreen'\nimport { SelectSourceTokenScreen } from './SelectSourceTokenScreen'\nimport { TransactionBreakdownScreen } from './TransactionBreakdownScreen'\nimport { WithdrawAddressScreen } from './WithdrawAddressScreen'\nimport { WithdrawAmountScreen } from './WithdrawAmountScreen'\n\n/** What is presented as a sheet over whichever step opened it. */\ntype WithdrawalNestedScreen = 'transactionBreakdown'\n\n/**\n * The crypto rail's screens, and the one withdrawal they are all building.\n *\n * Each screen is its own entry in the flow's stack \u2014 `back` leaves the screen,\n * not the rail \u2014 while the state behind them lives here, so navigating between\n * them keeps the amount, the source and the quote. A screen added later (the\n * recipient's address is next) is a case below and a `nav.navigate` from the one\n * before it.\n */\nexport function WithdrawCryptoSteps({\n config,\n callbacks,\n current,\n nav,\n quoteInputFeeTokens,\n quoteInputFeeSettled = true,\n extraSourceGasUsd,\n pasteFromClipboard,\n onSubmitted,\n}: {\n config: WithdrawalFlowConfig\n callbacks: WithdrawalFlowCallbacks\n current: FlowScreen | undefined\n nav: FlowNav\n /**\n * A flat fee the venue takes off the withdrawal before it is quoted, in\n * source-token units, or 0. The SDK only knows the number, never who charges\n * it.\n */\n quoteInputFeeTokens: number\n quoteInputFeeSettled?: boolean\n /**\n * A venue fee billed as source-chain gas, in USD, for the summary's network\n * row, or 0.\n */\n extraSourceGasUsd: number\n /** Fills the recipient field from the clipboard. Guarded upstream. */\n pasteFromClipboard: SafeClipboardReader\n onSubmitted: (result: {\n depositAddressOrHash: DepositAddressOrHash\n amountLabel: string\n /** What arrived, frozen here: the quote refreshes, the outcome doesn't. */\n usdLabel: string | undefined\n tokenLabel: string | undefined\n }) => void\n}) {\n const { t } = useFunkitTranslation()\n const insets = useSafeAreaInsets()\n const formOptions = { config, quoteInputFeeTokens, quoteInputFeeSettled }\n const form = useCryptoWithdrawalForm(formOptions)\n const {\n nestedSheetRef,\n nestedScreen,\n setNestedScreen,\n openNestedScreen,\n renderNestedBackdrop,\n } = useNestedSheet<WithdrawalNestedScreen>()\n const connectedWalletAddress = useConnectedRecipientAddress(config)\n // A 1:1 stablecoin reads the same either way round, so the swap between them\n // is a fake exchange rate \u2014 the same reason web hides it (`InputAmountLayout`).\n const isStablecoin = useIsStablecoin()\n const hideStablecoinSwap =\n useFeatureGate('hide-stablecoin-amount-switch') &&\n isStablecoin(form.sourceToken.symbol)\n const canSwapDenomination = form.canSwapDenomination && !hideStablecoinSwap\n // `undefined` when nothing prices the source, which sends both readers below\n // to token units instead.\n const amountUsdLabel =\n form.amountUsd === undefined ? undefined : formatUsd(Number(form.amountUsd))\n const receiveUsdLabel =\n form.receiveUsd === undefined ? undefined : formatUsd(form.receiveUsd)\n const receiveTokenLabel =\n form.receiveAmount && form.destinationToken\n ? `${formatTokenAmount(form.receiveAmount)} ${form.destinationToken.symbol}`\n : undefined\n const { submit, isSubmitting, isBusy, executionErrorText } =\n useCryptoWithdrawalSubmit({\n config,\n callbacks,\n form,\n // What the outcome reports on, frozen by the hook at the press: the quote\n // goes on refreshing and this step unmounts.\n receiveLabels: {\n usdLabel: receiveUsdLabel,\n tokenLabel: receiveTokenLabel,\n },\n onSubmitted,\n })\n // A picker over whichever screen opened it, not a step of its own: it is\n // reachable from the amount and from the details, and neither is where `back`\n // out of it should land.\n const [isPickingSource, setIsPickingSource] = useState(false)\n\n // A clipboard read can block for seconds on the OS permission prompt, so the\n // Paste pill is held down for the duration: a second tap would queue a second\n // read whose later result wins.\n const [isPasting, setIsPasting] = useState(false)\n\n if (isPickingSource) {\n return (\n <SelectSourceTokenScreen\n options={form.sourceOptions}\n selectedIndex={form.selectedSourceIndex}\n onSelect={(index) => {\n // The amount is cleared with the source, so there is nothing left to\n // review \u2014 the amount screen is where the user belongs.\n if (form.selectSource(index) && current !== 'withdrawAmount') {\n nav.popTo('withdrawAmount')\n }\n setIsPickingSource(false)\n }}\n onBack={() => setIsPickingSource(false)}\n />\n )\n }\n\n if (current === 'withdrawReceiveToken') {\n return (\n <SelectReceiveTokenAndChainScreen\n chains={form.destinationChains}\n committed={form.destinationToken}\n onBack={nav.back}\n onConfirm={(chainId, symbol) => {\n logger.info('withdrawal:destination_selected', {\n toChainId: chainId,\n toToken: symbol,\n })\n form.selectDestinationToken(chainId, symbol)\n nav.popTo('withdrawAddress')\n }}\n />\n )\n }\n\n if (current === 'withdrawAmount') {\n return (\n <WithdrawAmountScreen\n title={t('withdrawCrypto.title')}\n amount={form.amount}\n onChangeAmount={form.setAmount}\n input={form.input}\n onChangeInput={form.setInput}\n inUsd={form.inUsd}\n usdLabel={amountUsdLabel}\n onSwapDenomination={\n canSwapDenomination ? form.swapDenomination : undefined\n }\n sourceDecimals={form.sourceDecimals}\n balance={form.balance}\n source={{\n label: form.sourceLabel,\n symbol: form.sourceToken.symbol,\n chainId: Number(form.sourceToken.chainId),\n iconSrc: form.sourceOption.iconSrc,\n }}\n // Nothing to open with a single source; the receive token is picked on\n // the step that follows.\n onPressSource={\n form.sourceOptions.length > 1\n ? () => setIsPickingSource(true)\n : undefined\n }\n errorText={form.amountError}\n canContinue={form.canContinue}\n onContinue={() => {\n // Amount decision point, recorded where it is committed rather than on\n // every keystroke.\n logger.info('withdrawal:amount_confirmed', {\n fromChainId: form.sourceToken.chainId,\n fromToken: form.sourceToken.address,\n toChainId: form.destinationToken?.chainId,\n toToken: form.destinationToken?.address,\n })\n nav.navigate('withdrawAddress')\n }}\n onBack={nav.back}\n onClose={nav.closeFlow}\n />\n )\n }\n\n return (\n <>\n <WithdrawAddressScreen\n title={t('withdrawAddress.title', {\n amount:\n amountUsdLabel ??\n `${groupThousands(form.amount)} ${form.sourceToken.symbol}`,\n })}\n recipient={form.recipient}\n onChangeRecipient={form.setRecipient}\n isAddress={form.isRecipientAddress}\n isPasting={isPasting}\n onPaste={async () => {\n setIsPasting(true)\n try {\n // Test the trimmed value: a whitespace-only clipboard would\n // otherwise clear a recipient the user already entered.\n const pasted = (await pasteFromClipboard())?.trim()\n if (pasted) {\n form.setRecipient(pasted)\n }\n } finally {\n setIsPasting(false)\n }\n }}\n onUseConnected={\n connectedWalletAddress\n ? () => form.setRecipient(connectedWalletAddress)\n : undefined\n }\n errorText={form.recipientError}\n warningText={form.recipientWarning}\n destinationToken={form.destinationToken}\n onPressReceive={() => nav.navigate('withdrawReceiveToken')}\n usdLabel={receiveUsdLabel}\n tokenLabel={receiveTokenLabel}\n onPressBreakdown={() => openNestedScreen('transactionBreakdown')}\n // Without this the placeholders pulse on and the disabled button says\n // nothing \u2014 the one state the user can act on, by editing.\n quoteErrorText={\n form.isQuoteError ? t('withdrawCrypto.quoteFailed') : undefined\n }\n canSubmit={form.canSubmit}\n isBusy={isBusy}\n isSubmitting={isSubmitting}\n onSubmit={submit}\n executionErrorText={executionErrorText}\n onBack={nav.back}\n onClose={nav.closeFlow}\n />\n\n <BottomSheetModal\n ref={nestedSheetRef}\n // The breakdown is a paragraph, and sizes itself.\n enableDynamicSizing\n topInset={insets.top}\n handleComponent={null}\n backgroundComponent={FlowSheetBackground}\n backdropComponent={renderNestedBackdrop}\n onDismiss={() => setNestedScreen(null)}\n >\n <BottomSheetView>\n {nestedScreen === 'transactionBreakdown' ? (\n <TransactionBreakdownScreen\n usdLabel={receiveUsdLabel ?? ''}\n floorLabel={\n form.receiveFloorUsd === undefined\n ? ''\n : formatUsd(form.receiveFloorUsd)\n }\n />\n ) : null}\n </BottomSheetView>\n </BottomSheetModal>\n </>\n )\n}\n\n/**\n * The connected wallet's address, when it can stand in as the recipient: the\n * host can turn the shortcut off, and on a non-EVM rail the payer identity isn't\n * an address at all.\n */\nfunction useConnectedRecipientAddress(\n config: WithdrawalFlowConfig,\n): string | undefined {\n const { walletAddress } = useFunkitIdentity()\n if (config.disableConnectedWallet || !isUsableWalletAddress(walletAddress)) {\n return undefined\n }\n return walletAddress\n}\n", "// Local rather than `@funkit/utils`, whose formatters go through\n// `toLocaleString` \u2014 connect-rn takes no Intl dependency today. Grouping is\n// comma-only, as the design draws it.\n\n/**\n * `1062.11` \u2192 `1,062.11`. The fraction is passed through untouched: rounding a\n * balance would show the user a number they can't withdraw.\n */\nexport function groupThousands(amount: string): string {\n const [whole, ...fraction] = amount.split('.')\n const grouped = whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')\n return fraction.length > 0 ? `${grouped}.${fraction.join('.')}` : grouped\n}\n\n/**\n * The fraction a token amount is shown to, matching web's `ASSET_DECIMALS` (see\n * the checkout's `InputAmount/utils.ts`) so the two flows read the same.\n */\nexport const ASSET_DECIMALS = 5\n\n/**\n * `99.780000` \u2192 `99.78`, capped at {@link ASSET_DECIMALS}.\n *\n * Truncated rather than rounded: a figure the recipient won't actually get is\n * worse than one digit less of it. Trailing zeros go, so a round amount reads as\n * one.\n */\nexport function formatTokenAmount(\n amount: string,\n maxDecimals: number = ASSET_DECIMALS,\n): string {\n const [whole, fraction = ''] = amount.split('.')\n const capped = fraction.slice(0, maxDecimals).replace(/0+$/, '')\n const grouped = groupThousands(whole)\n return capped ? `${grouped}.${capped}` : grouped\n}\n\n/** `99.94` \u2192 `$99.94`. Two decimals, as every USD figure in the design is. */\nexport function formatUsd(value: number): string {\n return `$${groupThousands(value.toFixed(2))}`\n}\n", "import {\n type WithdrawalAmountValidation,\n deductFlatFee,\n isWithdrawalAddressSupported,\n resolveWithdrawalSourceTokenBalance,\n useDebouncedValue,\n} from '@funkit/connect-core'\nimport type { TFunction } from 'i18next'\nimport { useState } from 'react'\n\nimport type { WithdrawalFlowConfig } from '../flow/withdrawalFlowConfig'\nimport { logger } from '../logging/logger'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { resolveWithdrawalSourceTokens } from './sourceToken'\nimport { useCryptoWithdrawalQuote } from './useCryptoWithdrawalQuote'\nimport { useCryptoWithdrawalValidation } from './useCryptoWithdrawalValidation'\nimport { useSourceTokenDecimals } from './useSourceTokenDecimals'\nimport { useSourceTokenUsdPrice } from './useSourceTokenUsdPrice'\nimport { useWithdrawalAmountInput } from './useWithdrawalAmountInput'\nimport { useWithdrawalDestinationTokens } from './useWithdrawalDestinationTokens'\nimport { useWithdrawalRisk } from './useWithdrawalRisk'\nimport { type WithdrawCtaBlocker, isAmountBelowQuoteFee } from './validation'\n\n// Long enough that a typed amount settles before it is priced, short enough\n// that the summary doesn't feel detached from the keystroke (web uses the same).\nconst AMOUNT_DEBOUNCE_MS = 300\n\n/**\n * What the recipient step owns. The rest of what `getWithdrawCtaBlocker` reports\n * is the amount's business, and holding the recipient step on it would strand\n * the user on a screen with nothing to fix.\n */\nconst RECIPIENT_BLOCKERS = new Set<WithdrawCtaBlocker>([\n 'enter-recipient',\n 'unsupported-recipient',\n 'recipient-same-as-source',\n 'select-destination',\n 'invalid-for-chain',\n])\n\n/** What the crypto withdrawal's screens read and write. */\nexport type CryptoWithdrawalForm = ReturnType<typeof useCryptoWithdrawalForm>\n\n/**\n * One withdrawal in progress, across the screens that build it: the amount, the\n * recipient and the fees are asked for a step at a time, and all of it is priced\n * against the same quote.\n *\n * Held above the screens rather than inside one of them, so a step can be added\n * (or reordered) without the state moving house \u2014 and so the quote isn't thrown\n * away and re-fetched on every navigation.\n */\nexport function useCryptoWithdrawalForm({\n config,\n quoteInputFeeTokens,\n quoteInputFeeSettled = true,\n}: {\n config: WithdrawalFlowConfig\n /**\n * A flat fee the venue takes off the withdrawal before it is quoted, in\n * source-token units, or 0.\n */\n quoteInputFeeTokens: number\n /** See `WithdrawalFlowConfig.quoteInputFeeSettled`. */\n quoteInputFeeSettled?: boolean\n}) {\n const { t } = useFunkitTranslation()\n const [amount, setAmount] = useState('')\n const [recipient, setRecipient] = useState('')\n\n const sourceOptions = resolveWithdrawalSourceTokens(config)\n // By index, not by symbol: two options can be the same symbol on the same\n // chain and differ only in which balance they draw from.\n const [sourceIndex, setSourceIndex] = useState(0)\n // A host can swap `sourceTokens` under us; falling back without clamping the\n // index would leave the picker with no row checked.\n const selectedSourceIndex =\n sourceIndex < sourceOptions.length ? sourceIndex : 0\n const sourceOption = sourceOptions[selectedSourceIndex]\n const sourceToken = sourceOption.token\n const sourceLabel = sourceOption.label ?? sourceToken.symbol\n const balance = resolveWithdrawalSourceTokenBalance(\n config.withdrawalSourceTokenBalance,\n { sourceToken },\n logger,\n )\n\n // The destination is the point of this rail: the relay quote prices a swap\n // and/or a bridge, so receiving a different asset on a different chain is the\n // normal case, not an edge one.\n const {\n chains: destinationChains,\n destinationToken,\n selectDestinationToken,\n isLoading: isLoadingDestinations,\n } = useWithdrawalDestinationTokens({\n sourceToken,\n defaultReceiveToken: config.defaultReceiveToken,\n })\n\n const { isRecipientBlacklisted, amountValidation, ctaBlocker } =\n useCryptoWithdrawalValidation({\n config,\n sourceToken,\n destinationToken,\n amount,\n recipient,\n balance,\n })\n\n // Screening is address-intrinsic, so it runs off the typed address rather\n // than waiting for the amount.\n const risk = useWithdrawalRisk(\n recipient,\n destinationToken ? Number(destinationToken.chainId) : undefined,\n )\n\n // Hold the quote while the user is mid-keystroke, and never price something\n // we already know we would refuse to submit.\n const { debounced: debouncedAmount, isSettled } = useDebouncedValue(\n amount,\n AMOUNT_DEBOUNCE_MS,\n )\n\n // The account is debited what the user typed; relay moves what is left after\n // the venue's flat fee, so that is what gets priced and signed.\n const quoteAmount = deductFlatFee(debouncedAmount, quoteInputFeeTokens)\n // Shared with the quote's own read (same query key), so this costs no extra\n // call \u2014 it is what tells a sub-base-unit remainder from a real one.\n const sourceDecimals = useSourceTokenDecimals(sourceToken)\n // Shares the validator's own read (same query key), so this costs no extra\n // call and prices the entry off the rate the limits are judged against.\n const sourceUsdPrice = useSourceTokenUsdPrice(sourceToken)\n // Held here rather than in the screen, which unmounts on the way to the\n // recipient and back.\n const amountInput = useWithdrawalAmountInput({\n amount,\n setAmount,\n sourceUsdPrice,\n sourceDecimals,\n })\n // Read off the typed amount, not the debounced one, so the message lands with\n // the keystroke. Validation passes on the gross amount, so without this a fee\n // that eats it leaves nothing to quote and no reason on screen.\n const isAmountBelowFee = isAmountBelowQuoteFee({\n amount,\n feeTokenAmount: quoteInputFeeTokens,\n decimals: sourceDecimals,\n })\n\n const {\n quote,\n isLoading: isQuoteLoading,\n isError: isQuoteError,\n } = useCryptoWithdrawalQuote({\n sourceToken,\n destinationToken,\n recipientAddress: recipient,\n amount: quoteAmount,\n walletAddress: config.withdrawalWallet.address(),\n // Everything the form already knows is wrong, plus the async verdict:\n // `isRisky === false` is required, so in-flight and errored both hold. A\n // venue fee that hasn't settled yet would move `quoteAmount` underneath\n // this query, so it holds too.\n enabled:\n !ctaBlocker &&\n !isAmountBelowFee &&\n isSettled &&\n risk.isRisky === false &&\n quoteInputFeeSettled,\n })\n\n // What the recipient ends up with, in the currency the screen leads with. The\n // token amount is what the quote returns; the price is what turns it into the\n // number beside it. `0` from the price hook means unknown, not free.\n const destinationPrice = useSourceTokenUsdPrice(\n destinationToken ?? sourceToken,\n )\n // Mid-edit the query is disabled and `quote` still holds the previous amount's\n // price, so the figures are withheld until the inputs settle rather than\n // presenting the old estimate as this withdrawal's.\n const settledQuote = isSettled ? quote : undefined\n const receiveAmount = settledQuote?.receiveAmount\n const receiveUsd =\n destinationToken && receiveAmount && destinationPrice > 0\n ? Number(receiveAmount) * destinationPrice\n : undefined\n // The floor the trade won't execute below \u2014 the received amount less the\n // slippage the quote was raised with.\n const receiveFloorUsd =\n receiveUsd === undefined || settledQuote === undefined\n ? undefined\n : receiveUsd * (1 - settledQuote.fees.maxSlippage / 100)\n\n return {\n amount,\n setAmount,\n // The amount as it is being typed; see `useWithdrawalAmountInput`.\n ...amountInput,\n recipient,\n setRecipient,\n\n sourceOptions,\n selectedSourceIndex,\n sourceOption,\n sourceToken,\n sourceLabel,\n sourceDecimals,\n balance,\n /**\n * Records the decision and clears the amount: it was in the previous token's\n * units, and the balance and minimum it was checked against are the new\n * token's. Returns whether the source actually moved.\n */\n selectSource: (index: number) => {\n if (index === selectedSourceIndex) {\n return false\n }\n const picked = sourceOptions[index]\n // Source decision point \u2014 which balance the withdrawal draws from.\n logger.info('connect-rn:withdrawal:source_selected', {\n fromChainId: picked?.token.chainId,\n fromToken: picked?.token.address,\n sourceLabel: picked?.label ?? picked?.token.symbol,\n })\n setSourceIndex(index)\n setAmount('')\n return true\n },\n\n destinationChains,\n destinationToken,\n selectDestinationToken,\n isLoadingDestinations,\n\n isRecipientBlacklisted,\n amountValidation,\n ctaBlocker,\n risk,\n\n /**\n * Whether what has been typed is a wallet address at all \u2014 `undefined` while\n * the field is empty. Being one doesn't make it usable: the blacklist and the\n * destination's chain are the separate verdicts in `recipientError`.\n */\n isRecipientAddress:\n recipient === '' ? undefined : isWithdrawalAddressSupported(recipient),\n /** Why a well-formed address still can't be used. */\n recipientError: resolveRecipientErrorText(t, ctaBlocker),\n /** Screening's non-blocking verdict; the submit is what it gates. */\n recipientWarning: risk.isRisky\n ? t('withdrawCrypto.riskyAddress')\n : undefined,\n /** Enough to leave the recipient step, which the amount's problems don't hold. */\n canConfirmRecipient: !ctaBlocker || !RECIPIENT_BLOCKERS.has(ctaBlocker),\n /**\n * Fail closed: only a completed, clean screening lets the withdrawal through,\n * and only while the quote on screen is the one for what the field says \u2014\n * mid-edit the query is disabled and `quote` still holds the last price.\n */\n canSubmit:\n !ctaBlocker &&\n !isAmountBelowFee &&\n isSettled &&\n risk.isRisky === false &&\n quoteInputFeeSettled &&\n !!quote,\n\n quote,\n quoteAmount,\n /** Destination-token units, absent until the quote matches what is typed. */\n receiveAmount,\n receiveUsd,\n receiveFloorUsd,\n isQuoteLoading,\n isQuoteError,\n isSettled,\n isAmountBelowFee,\n\n /**\n * The amount step's own gate: `ctaBlocker` also weighs the recipient, which\n * isn't asked for until the step after.\n */\n amountError: resolveAmountErrorText({\n t,\n amount,\n amountValidation,\n tokenSymbol: sourceToken.symbol,\n // A per-token floor is already in source-token units; without one the floor\n // came from `getMinWithdrawalUSD`, so it reads as currency.\n isMinInTokenUnits:\n config.getMinWithdrawalAmount?.({ sourceToken }) !== undefined,\n isAmountBelowFee,\n quoteInputFeeTokens,\n }),\n canContinue:\n !!amount &&\n amountValidation.isWithdrawAmountValid &&\n !isAmountBelowFee &&\n !!destinationToken,\n }\n}\n\n/** The recipient's own blockers, as the message under the field. */\nfunction resolveRecipientErrorText(\n t: TFunction,\n blocker: WithdrawCtaBlocker | undefined,\n): string | undefined {\n // `enter-recipient` is left to the field's own verdict, which already says the\n // address isn't one.\n if (blocker === 'unsupported-recipient') {\n return t('withdrawCrypto.unsupportedRecipient')\n }\n if (blocker === 'recipient-same-as-source') {\n return t('withdrawCrypto.ctaRecipientSameAsSource')\n }\n if (blocker === 'invalid-for-chain') {\n return t('withdrawCrypto.ctaInvalidForChain')\n }\n return undefined\n}\n\nfunction resolveAmountErrorText({\n t,\n amount,\n amountValidation,\n tokenSymbol,\n isMinInTokenUnits,\n isAmountBelowFee,\n quoteInputFeeTokens,\n}: {\n t: TFunction\n amount: string\n amountValidation: WithdrawalAmountValidation\n tokenSymbol: string\n /** See {@link WithdrawalAmountValidation.minWithdrawalDisplayValue}. */\n isMinInTokenUnits: boolean\n /** The venue's fee leaves nothing for the quote to price. */\n isAmountBelowFee: boolean\n quoteInputFeeTokens: number\n}): string | undefined {\n if (!amount) {\n return undefined\n }\n if (amountValidation.isWithdrawAmountTooLow) {\n // The floor is either denomination, so it has to be labelled as the one it\n // is: a USD floor shown as token units reads ~4000\u00D7 off on an ETH source.\n const min = amountValidation.minWithdrawalDisplayValue\n return t('withdrawCrypto.belowMinimum', {\n amount: isMinInTokenUnits\n ? `${min} ${tokenSymbol}`\n : `$${min.toFixed(2)}`,\n })\n }\n if (amountValidation.isWithdrawAmountAboveBalance) {\n return t('withdrawCrypto.aboveBalance')\n }\n // After the minimum, which carries the more useful number when both apply.\n if (isAmountBelowFee) {\n return t('withdrawCrypto.belowFee', {\n amount: `${quoteInputFeeTokens} ${tokenSymbol}`,\n })\n }\n return undefined\n}\n", "import type {\n WithdrawalFlowConfig,\n WithdrawalSourceTokenOption,\n} from '../flow/withdrawalFlowConfig'\n\n/**\n * The source tokens the user may pick between. A host with one source omits\n * `sourceTokens`, leaving the single `sourceToken` as the only option.\n *\n * Stays local to React Native: web's option type is keyed by symbol and carries\n * per-option checkout data, so there is no shared shape to resolve against.\n */\nexport function resolveWithdrawalSourceTokens(\n config: Pick<WithdrawalFlowConfig, 'sourceToken' | 'sourceTokens'>,\n): WithdrawalSourceTokenOption[] {\n const options = config.sourceTokens ?? []\n return options.length > 0 ? options : [{ token: config.sourceToken }]\n}\n", "import {\n type CheckoutQuoteResponse,\n extractRelayFeeInfo,\n extractRelayReceiveAmount,\n fetchExactInQuote,\n toWithdrawalAmountBaseUnit,\n} from '@funkit/connect-core'\nimport type { FeeBreakdownV2 } from '@funkit/api-base'\nimport { useQuery } from '@tanstack/react-query'\nimport type { Address } from 'viem'\n\nimport type { WithdrawalToken } from '../flow/withdrawalFlowConfig'\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\nimport { useSourceTokenDecimals } from './useSourceTokenDecimals'\n\nexport const CRYPTO_WITHDRAWAL_QUOTE_QUERY_KEY = 'cryptoWithdrawalQuote'\n\n/**\n * How long a quote stays good for. Used for BOTH `staleTime` and\n * `refetchInterval`, and the equality is load-bearing: with `staleTime: 0`, an\n * `enabled` flip mid-edit remounts the query and refetches the previous key\n * before the new amount lands, replaying a stale quote. The interval keeps it\n * fresh regardless.\n */\nexport const QUOTE_REFRESH_INTERVAL_MS = 25_000\n\nexport interface CryptoWithdrawalQuoteView {\n /** Executed as-is by the pipeline \u2014 never rebuilt from the fields below. */\n raw: CheckoutQuoteResponse\n /** What the recipient gets, in destination-token units. */\n receiveAmount: string | undefined\n fees: FeeBreakdownV2\n}\n\nexport interface UseCryptoWithdrawalQuoteParams {\n sourceToken: WithdrawalToken\n destinationToken: WithdrawalToken | undefined\n recipientAddress: string\n /** Source-token units. Already debounced and settled by the caller. */\n amount: string\n walletAddress: string\n /** The caller's own gate \u2014 validation, risk, blacklist (see `useQuoteGate`). */\n enabled: boolean\n}\n\n/**\n * The EXACT_IN quote for a crypto withdrawal, refreshed on an interval so the\n * fees on screen stay the fees that execute.\n *\n * The query key is the inputs themselves \u2014 no context round-trip \u2014 so a quote\n * can never describe a different withdrawal than the form shows.\n */\nexport function useCryptoWithdrawalQuote({\n sourceToken,\n destinationToken,\n recipientAddress,\n amount,\n walletAddress,\n enabled,\n}: UseCryptoWithdrawalQuoteParams) {\n const { apiKey } = useFunkitIdentity()\n const decimals = useSourceTokenDecimals(sourceToken)\n\n const query = useQuery({\n queryKey: [\n CRYPTO_WITHDRAWAL_QUOTE_QUERY_KEY,\n apiKey,\n sourceToken.chainId,\n sourceToken.address,\n destinationToken?.chainId,\n destinationToken?.address,\n recipientAddress,\n amount,\n // The quote is signed for one sender, so a wallet switch must not read a\n // cached quote built for the previous one.\n walletAddress,\n decimals,\n ],\n queryFn: async (): Promise<CryptoWithdrawalQuoteView> => {\n if (!destinationToken) {\n throw new Error('Quote requested without a destination token')\n }\n if (decimals == null) {\n throw new Error('Quote requested before the source decimals resolved')\n }\n const raw = await fetchExactInQuote({\n apiKey,\n logger,\n fromChainId: sourceToken.chainId,\n fromTokenAddress: sourceToken.address,\n toChainId: destinationToken.chainId,\n toTokenAddress: destinationToken.address,\n recipientAddress: recipientAddress as Address,\n userAddress: walletAddress as Address,\n fromAmountBaseUnit: toWithdrawalAmountBaseUnit(amount, decimals),\n })\n return {\n raw,\n receiveAmount: extractRelayReceiveAmount(raw.metadata, logger),\n fees: extractRelayFeeInfo(raw.metadata, logger),\n }\n },\n enabled:\n enabled &&\n !!apiKey &&\n !!destinationToken &&\n !!recipientAddress &&\n Number(amount) > 0 &&\n decimals != null,\n staleTime: QUOTE_REFRESH_INTERVAL_MS,\n refetchInterval: QUOTE_REFRESH_INTERVAL_MS,\n refetchIntervalInBackground: true,\n // A failed quote is shown, not retried behind the user's back: the inputs\n // usually need changing, and a silent retry would delay that feedback.\n retry: false,\n })\n\n return {\n quote: query.data,\n // Only the first fetch \u2014 `isFetching` would blank the rows and disable the\n // CTA on every background refresh.\n isLoading: query.isLoading,\n isError: query.isError,\n }\n}\n", "import { getPublicClientFor } from '@funkit/connect-core'\nimport { useQuery } from '@tanstack/react-query'\nimport { erc20Abi } from 'viem'\n\nimport type { WithdrawalToken } from '../flow/withdrawalFlowConfig'\n\nexport const SOURCE_TOKEN_DECIMALS_QUERY_KEY = 'sourceTokenDecimals'\n\n/**\n * Decimals for the amount conversion: the host's value when it has one,\n * otherwise read on-chain. A stale host value would mis-scale the transfer, so\n * the read is preferred over a guess.\n *\n * Its own query rather than a step inside the quote, so the read runs once per\n * token \u2014 as soon as the form knows what it is spending \u2014 instead of on every\n * 25-second quote refresh.\n */\nexport function useSourceTokenDecimals(\n sourceToken: WithdrawalToken,\n): number | undefined {\n const query = useQuery({\n queryKey: [\n SOURCE_TOKEN_DECIMALS_QUERY_KEY,\n sourceToken.chainId,\n sourceToken.address,\n ],\n queryFn: async () => {\n const client = getPublicClientFor(Number(sourceToken.chainId))\n if (!client) {\n throw new Error(\n `No RPC client for chain ${sourceToken.chainId} \u2014 cannot read token decimals`,\n )\n }\n return client.readContract({\n address: sourceToken.address,\n abi: erc20Abi,\n functionName: 'decimals',\n })\n },\n enabled: sourceToken.decimals == null,\n // A token's decimals never change, so one read lasts the session.\n staleTime: Number.POSITIVE_INFINITY,\n retry: 1,\n })\n\n return sourceToken.decimals ?? query.data\n}\n", "import {\n type WithdrawalAmountValidation,\n isBlacklistedWithdrawalAddress,\n} from '@funkit/connect-core'\n\nimport type {\n WithdrawalFlowConfig,\n WithdrawalToken,\n} from '../flow/withdrawalFlowConfig'\nimport { useDynamicConfig } from '../statsig/useDynamicConfig'\nimport { useSourceTokenDecimals } from './useSourceTokenDecimals'\nimport { useSourceTokenUsdPrice } from './useSourceTokenUsdPrice'\nimport {\n type WithdrawCtaBlocker,\n getWithdrawCtaBlocker,\n isNoOpSelfWithdrawal,\n validateAmount,\n} from './validation'\n\nexport interface CryptoWithdrawalValidation {\n /** Recipient the funds would be lost in (e.g. a token contract). */\n isRecipientBlacklisted: boolean\n amountValidation: WithdrawalAmountValidation\n /** The single thing left to fix, or `undefined` when the form is complete. */\n ctaBlocker: WithdrawCtaBlocker | undefined\n}\n\n/**\n * Everything the crypto withdrawal form knows synchronously about what the user\n * has typed. The Statsig-backed blacklist is why this is a hook; the verdicts\n * themselves come from the pure functions in `validation.ts`.\n */\nexport function useCryptoWithdrawalValidation({\n config,\n sourceToken,\n destinationToken,\n amount,\n recipient,\n balance,\n}: {\n config: WithdrawalFlowConfig\n sourceToken: WithdrawalToken\n destinationToken: WithdrawalToken | undefined\n amount: string\n recipient: string\n balance: string | undefined\n}): CryptoWithdrawalValidation {\n const blacklist = useDynamicConfig('blacklistedwithdrawaladdress')\n const withdrawalConfig = useDynamicConfig('withdrawalconfig')\n const isRecipientBlacklisted = isBlacklistedWithdrawalAddress({\n address: recipient,\n blacklist,\n withdrawalConfig,\n })\n\n // Inert until the price resolves, so the USD limits switch on rather than\n // rejecting an amount against a price that isn't known yet.\n const sourceTokenUsdPrice = useSourceTokenUsdPrice(sourceToken)\n // Shares the form's own read (same query key), so this costs no extra call.\n // A USD floor converts to a token figure finer than the field can hold, and\n // the typed minimum would sit just under it without this.\n const sourceTokenDecimals = useSourceTokenDecimals(sourceToken)\n\n const amountValidation = validateAmount({\n config,\n sourceToken,\n sourceTokenUsdPrice,\n sourceTokenDecimals,\n amount,\n balance,\n })\n\n return {\n isRecipientBlacklisted,\n amountValidation,\n ctaBlocker: getWithdrawCtaBlocker({\n recipientAddress: recipient,\n isRecipientBlacklisted,\n isRecipientSameAsSource: isNoOpSelfWithdrawal({\n recipientAddress: recipient,\n walletAddress: config.withdrawalWallet.address(),\n sourceToken,\n destinationToken,\n }),\n amount,\n amountValidation,\n destinationToken,\n }),\n }\n}\n", "import {\n type WithdrawalAmountValidation,\n deductFlatFee,\n isAddressCompatibleWithChain,\n isWithdrawalAddressSupported,\n toWithdrawalAmountBaseUnit,\n validateWithdrawalAmount,\n} from '@funkit/connect-core'\n\nimport type {\n WithdrawalFlowConfig,\n WithdrawalToken,\n} from '../flow/withdrawalFlowConfig'\n\n// Everything the crypto withdrawal form derives from what the user has typed.\n// Pure and synchronous \u2014 the async verdicts (risk screening, the quote) are\n// layered on by the caller.\n\n/**\n * The one thing the user has left to fix, named so the submit button can say it.\n *\n * Nothing left to fix is `undefined`, not a `ready` member: these are what the\n * typed form is missing, and that is not the same as being submittable \u2014 the\n * async verdicts (risk screening, a settled quote) decide that.\n */\nexport type WithdrawCtaBlocker =\n | 'enter-recipient'\n | 'unsupported-recipient'\n | 'recipient-same-as-source'\n | 'max-exceeded'\n | 'enter-amount'\n | 'select-destination'\n | 'invalid-for-chain'\n\n/**\n * Amount limits, resolved from the host's callbacks.\n *\n * `sourceTokenUsdPrice` of 0 means unknown, not free: the core validator reads\n * it as \"no price\" and leaves the USD floor and ceiling inert, while the\n * per-token minimum and the balance check still apply. Sources whose price the\n * API cannot resolve (Lighter's index-addressed L2 assets) run that way.\n */\nexport function validateAmount({\n config,\n sourceToken,\n sourceTokenUsdPrice,\n sourceTokenDecimals,\n amount,\n balance,\n}: {\n config: Pick<\n WithdrawalFlowConfig,\n | 'getMinWithdrawalAmount'\n | 'getMinWithdrawalUSD'\n | 'getMaxWithdrawalUSD'\n | 'getMaxWithdrawalAmount'\n >\n sourceToken: WithdrawalToken\n /** Spot USD price of one source token; 0 when unknown. */\n sourceTokenUsdPrice?: number\n /** Fraction digits the source carries; caps how fine the USD floor gets. */\n sourceTokenDecimals?: number\n amount: string\n balance: string | undefined\n}): WithdrawalAmountValidation {\n const result = validateWithdrawalAmount({\n withdrawalInputAmount: amount,\n sourceTokenUsdPrice: sourceTokenUsdPrice ?? 0,\n sourceTokenDecimals,\n sourceTokenBalance: balance ?? '0',\n perTokenMin: config.getMinWithdrawalAmount?.({ sourceToken }),\n perTokenMax: config.getMaxWithdrawalAmount?.({ sourceToken }),\n usdMin: config.getMinWithdrawalUSD?.({ sourceToken }) ?? 0.01,\n usdMax: config.getMaxWithdrawalUSD?.({ sourceToken }),\n })\n\n // Nothing to withdraw is not a valid amount. The core validator compares\n // `Number(amount)`, and both `NaN` (from `'.'`) and 0 fail every comparison,\n // so they come back valid \u2014 the $0.01 floor catches 0 only once a price is\n // known (see above).\n const parsed = Number(amount)\n if (!Number.isFinite(parsed) || parsed <= 0) {\n return { ...result, isWithdrawAmountValid: false }\n }\n\n // An unknown balance is not a zero balance. Coalescing to '0' above keeps the\n // core validator happy, but judging the amount against it would reject every\n // withdrawal a host that supplies no balance callback ever attempts. We\n // cannot know, so we do not block \u2014 an actually-insufficient balance is\n // caught by the quote, which fails with a real reason.\n if (balance == null) {\n return {\n ...result,\n isWithdrawAmountAboveBalance: false,\n isWithdrawAmountValid:\n !result.isWithdrawAmountTooLow && !result.isWithdrawAmountTooHigh,\n }\n }\n return result\n}\n\n/**\n * A same-chain, same-token transfer back to the sending wallet. Relay rejects\n * these with a generic error, so name the reason before quoting.\n */\nexport function isNoOpSelfWithdrawal({\n recipientAddress,\n walletAddress,\n sourceToken,\n destinationToken,\n}: {\n recipientAddress: string\n walletAddress: string\n sourceToken: WithdrawalToken\n destinationToken: WithdrawalToken | undefined\n}): boolean {\n if (!destinationToken) {\n return false\n }\n return (\n recipientAddress.toLowerCase() === walletAddress.toLowerCase() &&\n sourceToken.chainId === destinationToken.chainId &&\n sourceToken.address.toLowerCase() === destinationToken.address.toLowerCase()\n )\n}\n\n/**\n * Order is a faithful port of web's `getWithdrawButtonText`: the most specific\n * blocker wins, so the user is told the one thing to fix next rather than the\n * first thing that happens to fail.\n */\nexport function getWithdrawCtaBlocker({\n recipientAddress,\n isRecipientBlacklisted,\n isRecipientSameAsSource,\n amount,\n amountValidation,\n destinationToken,\n}: {\n recipientAddress: string\n isRecipientBlacklisted: boolean\n isRecipientSameAsSource: boolean\n amount: string\n amountValidation: WithdrawalAmountValidation\n destinationToken: WithdrawalToken | undefined\n}): WithdrawCtaBlocker | undefined {\n if (!isWithdrawalAddressSupported(recipientAddress)) {\n return 'enter-recipient'\n }\n // Sending to a token contract burns the funds.\n if (isRecipientBlacklisted) {\n return 'unsupported-recipient'\n }\n if (isRecipientSameAsSource) {\n return 'recipient-same-as-source'\n }\n if (amountValidation.isWithdrawAmountTooHigh) {\n return 'max-exceeded'\n }\n if (!amount || !amountValidation.isWithdrawAmountValid) {\n return 'enter-amount'\n }\n if (!destinationToken) {\n return 'select-destination'\n }\n if (\n !isAddressCompatibleWithChain(\n recipientAddress,\n Number(destinationToken.chainId),\n )\n ) {\n return 'invalid-for-chain'\n }\n return undefined\n}\n\n/**\n * Whether the venue's flat fee leaves nothing for the quote to price.\n *\n * - Two ways to leave nothing: the fee meets or exceeds the amount, or the\n * remainder is under one base unit of the source token \u2014 `parseUnits` trims\n * the extra digits, so a positive remainder still reaches the quote as 0.\n * - Undefined `decimals` means the read hasn't landed. The quote can't run\n * without it either, so the fee-only verdict stands until it does.\n */\nexport function isAmountBelowQuoteFee({\n amount,\n feeTokenAmount,\n decimals,\n}: {\n amount: string\n feeTokenAmount: number\n decimals: number | undefined\n}): boolean {\n if (feeTokenAmount <= 0 || !amount) {\n return false\n }\n const net = deductFlatFee(amount, feeTokenAmount)\n if (Number(net) <= 0) {\n return true\n }\n if (decimals == null) {\n return false\n }\n try {\n return toWithdrawalAmountBaseUnit(net, decimals) <= 0n\n } catch {\n // An amount `parseUnits` rejects can't be quoted either.\n return true\n }\n}\n", "import { tokenAmountToUsd, usdToTokenAmount } from '@funkit/connect-core'\nimport { useCallback, useState } from 'react'\n\n/**\n * A trailing point is mid-entry, not a different amount \u2014 and `dnum` throws on\n * it, which the converters answer with `'0'`. Every figure crossing between the\n * two denominations goes through here first.\n */\nfunction withoutTrailingDot(value: string): string {\n return value.endsWith('.') ? value.slice(0, -1) : value\n}\n\n/**\n * What the withdrawal is worth in dollars, or `undefined` when nothing prices\n * it. Typed dollars are authoritative: the token amount they bought was\n * rounded down to fit the token, so reading it back reports $9.99 for a $10\n * that was typed \u2014 and the readers of this label sit on later screens, where\n * that cent has no visible explanation.\n */\nfunction usdValueOf({\n amount,\n usdInput,\n inUsd,\n sourceUsdPrice,\n canPriceInUsd,\n}: {\n amount: string\n usdInput: string\n inUsd: boolean\n sourceUsdPrice: number\n canPriceInUsd: boolean\n}): string | undefined {\n if (!canPriceInUsd) {\n return undefined\n }\n if (inUsd) {\n return withoutTrailingDot(usdInput) || '0'\n }\n const typed = withoutTrailingDot(amount)\n return tokenAmountToUsd(typed === '' ? '0' : typed, sourceUsdPrice)\n}\n\n/**\n * The amount as the user types it, and which denomination they are typing in.\n *\n * - `amount` never changes meaning: the quote, the validation and the signature\n * are all in source-token units, so when typing in dollars the typed figure\n * is held here and `amount` is what it converts to.\n * - Held with the form rather than in the screen, which unmounts on the way to\n * the recipient \u2014 local state would drop both on Continue.\n */\nexport function useWithdrawalAmountInput({\n amount,\n setAmount,\n sourceUsdPrice,\n sourceDecimals,\n}: {\n /** The withdrawal amount, in source-token units. */\n amount: string\n setAmount: (amount: string) => void\n /** Spot USD price of the source token; `0` is the price hook's \"unknown\". */\n sourceUsdPrice: number\n /** Fraction digits the source token carries, once they're known. */\n sourceDecimals: number | undefined\n}) {\n const [usdInput, setUsdInput] = useState('')\n // Both halves are required: converting before the token's precision is known\n // mints an amount finer than the token holds, which the numpad then refuses\n // every further digit for.\n const canPriceInUsd = sourceUsdPrice > 0 && sourceDecimals !== undefined\n // The standing preference; a rate that arrives late (or never) is what\n // actually decides it.\n const [prefersUsd, setPrefersUsd] = useState(true)\n const inUsd = prefersUsd && canPriceInUsd\n\n // Re-derived when the amount moves underneath it or a rate first arrives \u2014\n // never every render (that would rewrite `12.` as `12`) and never on a\n // refreshed rate (that would rewrite the figure being edited).\n const [derivedFrom, setDerivedFrom] = useState({\n amount: '',\n isPriced: false,\n })\n if (derivedFrom.amount !== amount || derivedFrom.isPriced !== canPriceInUsd) {\n if (!derivedFrom.isPriced && canPriceInUsd && amount !== '') {\n setPrefersUsd(false)\n }\n setDerivedFrom({ amount, isPriced: canPriceInUsd })\n setUsdInput(\n amount === '' || !canPriceInUsd\n ? ''\n : tokenAmountToUsd(withoutTrailingDot(amount), sourceUsdPrice),\n )\n }\n\n const setInput = useCallback(\n (next: string) => {\n if (!inUsd) {\n setAmount(next)\n return\n }\n // `''` has to stay nothing rather than become `'0'`, which reads as a\n // typed zero and fails the minimum.\n const typed = withoutTrailingDot(next)\n const asTokens =\n typed === ''\n ? ''\n : usdToTokenAmount(typed, sourceUsdPrice, sourceDecimals)\n // Recorded as already derived, so the typed dollars survive a token\n // amount that rounding may have shortened.\n setUsdInput(next)\n setDerivedFrom({ amount: asTokens, isPriced: canPriceInUsd })\n setAmount(asTokens)\n },\n [inUsd, setAmount, sourceUsdPrice, sourceDecimals],\n )\n\n return {\n /** What to show and edit: dollars when {@link inUsd}, else token units. */\n input: inUsd ? usdInput : amount,\n setInput,\n inUsd,\n /**\n * Switches denomination, converting the amount rather than clearing it.\n *\n * - Deliberately does not re-price against a rate that moved since the\n * figure was typed: rewriting what someone entered, under them, is worse\n * than showing it at the rate they entered it at.\n * - The staleness is bounded by refreshing the price on the way into this\n * screen rather than while it is open.\n */\n swapDenomination: useCallback(() => setPrefersUsd((was) => !was), []),\n /** Offering the swap without a rate would promise one we don't have. */\n canSwapDenomination: canPriceInUsd,\n /** What the amount is worth, or `undefined` when nothing prices it. */\n amountUsd: usdValueOf({\n amount,\n usdInput,\n inUsd,\n sourceUsdPrice,\n canPriceInUsd,\n }),\n }\n}\n", "import { getSupportedAssets } from '@funkit/api-base'\nimport { resolveTokenTransferConfig } from '@funkit/connect-core'\nimport { useQuery } from '@tanstack/react-query'\nimport { useMemo, useState } from 'react'\nimport type { Address } from 'viem'\n\nimport type { WithdrawalToken } from '../flow/withdrawalFlowConfig'\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\nimport { useDynamicConfig } from '../statsig/useDynamicConfig'\n\nexport const WITHDRAWAL_DESTINATION_TOKENS_QUERY_KEY = 'withdrawalDestinations'\n\nexport interface DestinationChain {\n chainId: number\n /** Symbols receivable on this chain, priority ones first. */\n symbols: string[]\n}\n\nexport interface UseWithdrawalDestinationTokensResult {\n chains: DestinationChain[]\n /** Where the funds land. `undefined` until the curated list resolves. */\n destinationToken: WithdrawalToken | undefined\n selectDestinationToken: (chainId: number, symbol: string) => void\n isLoading: boolean\n}\n\n/**\n * Everything a withdrawal can be received as: the curated Statsig\n * `withdrawalconfig` chains and assets, minus\n * `disablewithdrawalchainsandassets`, resolved against api-base's asset\n * metadata \u2014 the same pipeline the deposit list uses, and the same one web\n * feeds into its receive-token dropdown.\n *\n * The destination token is the point of this rail. Sending the source token back out\n * on its own chain is a plain transfer with nothing to quote; the relay quote\n * exists precisely so a user holding USDG on one chain can receive USDC on\n * another.\n */\nexport function useWithdrawalDestinationTokens({\n sourceToken,\n defaultReceiveToken,\n}: {\n sourceToken: WithdrawalToken\n /** Symbol to preselect; falls back to the source token's symbol. */\n defaultReceiveToken?: string\n}): UseWithdrawalDestinationTokensResult {\n const { apiKey } = useFunkitIdentity()\n const withdrawalConfig = useDynamicConfig('withdrawalconfig')\n const disabledChainAssets = useDynamicConfig(\n 'disablewithdrawalchainsandassets',\n )\n\n const { data: supportedAssets, isLoading } = useQuery({\n queryKey: [WITHDRAWAL_DESTINATION_TOKENS_QUERY_KEY, apiKey],\n queryFn: () => getSupportedAssets({ apiKey, logger }),\n enabled: !!apiKey,\n staleTime: Number.POSITIVE_INFINITY,\n })\n\n const resolved = useMemo(() => {\n if (!supportedAssets) {\n return undefined\n }\n return resolveTokenTransferConfig({\n chainConfigs: withdrawalConfig.chains ?? [],\n priorityTokens: withdrawalConfig.priorityTokens ?? [],\n disabledChainAssets: disabledChainAssets ?? {},\n supportedAssets,\n logger,\n })\n }, [supportedAssets, withdrawalConfig, disabledChainAssets])\n\n const chains = useMemo<DestinationChain[]>(() => {\n if (!resolved) {\n return []\n }\n return resolved.chainIdSortOrder.map((chainId) => ({\n chainId,\n symbols: resolved.symbolsByChainId[chainId] ?? [],\n }))\n }, [resolved])\n\n const [picked, setPicked] = useState<{ chainId: number; symbol: string }>()\n\n const destinationToken = useMemo<WithdrawalToken | undefined>(() => {\n if (!resolved) {\n return undefined\n }\n\n // The user's pick, else the host's preferred receive token, else the source\n // symbol \u2014 each only if the curated list actually offers it.\n const candidates = picked\n ? [picked]\n : [\n ...(defaultReceiveToken\n ? chains.map((c) => ({\n chainId: c.chainId,\n symbol: defaultReceiveToken,\n }))\n : []),\n ...chains.map((c) => ({\n chainId: c.chainId,\n symbol: sourceToken.symbol,\n })),\n ]\n\n for (const candidate of candidates) {\n const address =\n resolved.addressBySymbolByChainId[candidate.chainId]?.[candidate.symbol]\n if (address) {\n return {\n chainId: String(candidate.chainId),\n address: address as Address,\n symbol: candidate.symbol,\n }\n }\n }\n return undefined\n }, [resolved, picked, chains, defaultReceiveToken, sourceToken.symbol])\n\n return {\n chains,\n destinationToken,\n selectDestinationToken: (chainId, symbol) => setPicked({ chainId, symbol }),\n isLoading,\n }\n}\n", "import {\n isAddressCompatibleWithChain,\n isWithdrawalRisky,\n useFeatureGate,\n} from '@funkit/connect-core'\nimport { useQuery } from '@tanstack/react-query'\n\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\n\nexport const WITHDRAWAL_RISK_QUERY_KEY = 'withdrawalRisk'\n\nexport interface WithdrawalRiskResult {\n /** `true` blocks. `undefined` while unknown \u2014 which also blocks. */\n isRisky: boolean | undefined\n isChecking: boolean\n isError: boolean\n}\n\n/**\n * Chainalysis screening for the recipient.\n *\n * **Fails closed**: callers must require `isRisky === false`, so in-flight and\n * errored both block. The chain id scopes the screen to the destination chain,\n * so it is part of the key (web does the same).\n */\nexport function useWithdrawalRisk(\n address: string,\n chainId: number | undefined,\n): WithdrawalRiskResult {\n const { apiKey } = useFunkitIdentity()\n const screeningDisabled = useFeatureGate('disable-frontend-chainalysis')\n\n const query = useQuery({\n queryKey: [WITHDRAWAL_RISK_QUERY_KEY, apiKey, address, chainId],\n queryFn: () =>\n isWithdrawalRisky({\n address,\n chainId: chainId?.toString(),\n apiKey,\n logger,\n screeningDisabled,\n }),\n // Only screen an address that could actually exist on the destination\n // chain. Without this the query fires on every keystroke of a\n // half-typed address, one Chainalysis call per character.\n enabled:\n !!apiKey &&\n !!address &&\n chainId !== undefined &&\n isAddressCompatibleWithChain(address, chainId),\n // api-base already retries the request; one more attempt before the error\n // state blocks the CTA is enough.\n retry: 1,\n refetchOnMount: false,\n refetchOnReconnect: false,\n refetchOnWindowFocus: false,\n })\n\n return {\n isRisky: query.data,\n isChecking: query.isFetching,\n isError: query.isError,\n }\n}\n", "import { useEffectEvent } from '@funkit/connect-core'\nimport { useEffect, useRef } from 'react'\n\nimport type {\n WithdrawalFlowCallbacks,\n WithdrawalFlowConfig,\n} from '../flow/withdrawalFlowConfig'\nimport { logger } from '../logging/logger'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { executionErrorMessage } from '../utils/executionErrorMessage'\nimport {\n type DepositAddressOrHash,\n useCryptoWithdrawalExecution,\n} from './useCryptoWithdrawalExecution'\nimport type { CryptoWithdrawalForm } from './useCryptoWithdrawalForm'\n\n/**\n * Signing the withdrawal {@link CryptoWithdrawalForm} describes: the press, the\n * once-only hand-off to the outcome, and what the step shows while either is in\n * flight.\n *\n * Held apart from the step that renders it so the money path's invariants \u2014 one\n * hand-off, the source the signature was actually raised against, nothing\n * executed but the quote on screen \u2014 can be exercised without a rendered screen.\n */\n/** What the recipient step is showing the withdrawal will land as. */\ninterface ReceiveLabels {\n usdLabel: string | undefined\n tokenLabel: string | undefined\n}\n\nexport function useCryptoWithdrawalSubmit({\n config,\n callbacks,\n form,\n receiveLabels,\n onSubmitted,\n}: {\n config: WithdrawalFlowConfig\n callbacks: WithdrawalFlowCallbacks\n /** The withdrawal being built, which is what gets signed. */\n form: CryptoWithdrawalForm\n receiveLabels: ReceiveLabels\n onSubmitted: (\n result: {\n depositAddressOrHash: DepositAddressOrHash\n amountLabel: string\n } & ReceiveLabels,\n ) => void\n}) {\n const { t } = useFunkitTranslation()\n const { submission, submit } = useCryptoWithdrawalExecution({\n config,\n sourceToken: form.sourceToken,\n destinationToken: form.destinationToken ?? form.sourceToken,\n callbacks,\n })\n\n // Hand off exactly once. `onSubmitted` is an inline arrow from the flow, so it\n // is a new function every render \u2014 without the ref this re-fires on each one,\n // resetting the navigation stack in a loop.\n const handedOffRef = useRef(false)\n // The source the signature was raised against: a host config change can still\n // move the selection, and the completion screen must name what was sent.\n const submittedSourceLabel = useRef<string | undefined>(undefined)\n // The figures the withdrawal was signed against. The quote goes on refreshing\n // and the recipient step unmounts, so the outcome carries its own copy.\n const submittedFigures = useRef<ReceiveLabels>({\n usdLabel: undefined,\n tokenLabel: undefined,\n })\n const onSubmittedEvent = useEffectEvent(onSubmitted)\n useEffect(() => {\n if (submission.status !== 'submitted' || handedOffRef.current) {\n return\n }\n handedOffRef.current = true\n // The submission's own amount, not the field's: the input stays editable\n // while the signature is in flight, so the two can disagree by now.\n onSubmittedEvent({\n depositAddressOrHash: submission.depositAddressOrHash,\n amountLabel: `${submission.amount} ${submittedSourceLabel.current ?? form.sourceLabel}`,\n ...submittedFigures.current,\n })\n }, [submission, form.sourceLabel])\n\n // A landed signature still counts: the hand-off above is an effect, so the step\n // paints once more and would flash its editable chrome back before unmounting.\n const isInFlight =\n submission.status === 'submitting' || submission.status === 'submitted'\n\n return {\n isSubmitting: isInFlight,\n /** The button holds for the price and the screening too, not only the signature. */\n isBusy: form.isQuoteLoading || form.risk.isChecking || isInFlight,\n /** An unrecoverable failure from the last attempt, in the user's words. */\n executionErrorText:\n submission.status === 'failed'\n ? executionErrorMessage(t, submission.code, submission.message)\n : undefined,\n /** Executes the quote on screen. `form.canSubmit` is what gates the press. */\n submit: () => {\n if (!form.quote) {\n return\n }\n // Source/destination decision point, recorded before signing.\n logger.info('connect-rn:withdrawal:crypto_submit', {\n fromChainId: form.sourceToken.chainId,\n fromToken: form.sourceToken.address,\n toChainId: form.destinationToken?.chainId,\n toToken: form.destinationToken?.address,\n })\n submittedSourceLabel.current = form.sourceLabel\n submittedFigures.current = receiveLabels\n void submit({\n quote: form.quote.raw,\n recipientAddress: form.recipient,\n amount: form.quoteAmount,\n })\n },\n }\n}\n", "import type { WalletExecutionErrorCode } from '@funkit/connect-core'\nimport type { TFunction } from 'i18next'\n\n// Two lines on a phone. A provider that returns its whole stack should not push\n// the fee summary and the CTA off the sheet.\nconst MAX_ERROR_DETAIL_CHARS = 160\n\n/**\n * What the user reads for a failure core classified. Web's copy, per cause.\n *\n * A cause core could name gets that copy: it is translated and says what to do,\n * which no provider string does. Everything else falls back to the error's own\n * text \u2014 \"please try again\" is the one message that helps nobody, and the\n * failures that land here are the ones neither we nor the user can otherwise\n * diagnose. Truncated, since a relay error can run to paragraphs.\n */\nexport function executionErrorMessage(\n t: TFunction,\n code: WalletExecutionErrorCode,\n message?: string,\n): string {\n switch (code) {\n case 'insufficient-gas':\n return t('withdrawCrypto.errorInsufficientGas')\n case 'switch-chain':\n return t('withdrawCrypto.errorSwitchChain')\n }\n const detail = message?.trim()\n if (!detail) {\n return t('withdrawCrypto.errorGeneric')\n }\n return detail.length > MAX_ERROR_DETAIL_CHARS\n ? `${detail.slice(0, MAX_ERROR_DETAIL_CHARS)}\u2026`\n : detail\n}\n", "import {\n type CheckoutQuoteResponse,\n type CryptoWithdrawalOrder,\n type WalletExecutionErrorCode,\n createWithdrawalSubmissionId,\n ensureRelayClientInitialized,\n isUserRejectedError,\n processCryptoWithdrawalOrder,\n toWalletExecutionErrorCode,\n} from '@funkit/connect-core'\nimport { useCallback, useRef, useState } from 'react'\nimport type { Address } from 'viem'\n\nimport type {\n WithdrawalFlowCallbacks,\n WithdrawalFlowConfig,\n WithdrawalToken,\n} from '../flow/withdrawalFlowConfig'\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\n\n// Module-scoped because the hook and its refs unmount when the sheet closes\n// while the transfer is still running: a reopen mounts a fresh hook whose own\n// ref guard knows nothing about the signature already in flight.\nconst inFlightWithdrawals = new Set<string>()\n\n/** What makes two presses the same withdrawal rather than two of them. */\nfunction withdrawalKey({\n walletAddress,\n recipientAddress,\n amount,\n sourceToken,\n destinationToken,\n}: {\n walletAddress: string\n recipientAddress: string\n amount: string\n sourceToken: WithdrawalToken\n destinationToken: WithdrawalToken\n}): string {\n return [\n walletAddress,\n recipientAddress,\n amount,\n sourceToken.chainId,\n sourceToken.address,\n destinationToken.chainId,\n destinationToken.address,\n ]\n .join('|')\n .toLowerCase()\n}\n\n/**\n * @internal Test-only: clear the process-wide in-flight set so suites that\n * reuse withdrawal details stay isolated. Not part of the public API.\n */\nexport function __resetInFlightCryptoWithdrawals(): void {\n inFlightWithdrawals.clear()\n}\n\n/**\n * What a submitted withdrawal can be followed by: a venue that submits\n * off-chain leaves an address, not a transaction of ours. A union rather than\n * two optionals, so the completion screen cannot read the wrong one.\n */\nexport type DepositAddressOrHash =\n | { kind: 'transaction'; txHash: string }\n | { kind: 'depositAddress'; depositAddress: Address }\n\n/**\n * Stands in when a venue submits but reports no address back. Matches web's\n * `generateSyntheticDepositAddress`, so one sentinel means the same thing on\n * both platforms.\n */\nconst SYNTHETIC_DEPOSIT_ADDRESS =\n '0x0000000000000000000000000000000000000001' as const\n\nexport type CryptoWithdrawalSubmission =\n | { status: 'idle' }\n | { status: 'submitting'; stepMessage?: string }\n | {\n status: 'submitted'\n depositAddressOrHash: DepositAddressOrHash\n submissionId: string\n /** The amount that executed, not whatever the field says by now. */\n amount: string\n }\n | {\n status: 'failed'\n code: WalletExecutionErrorCode\n /**\n * The error's own text. Read by the form only where the classified cause\n * says nothing the user can act on \u2014 a failure the SDK cannot name is\n * better reported in the provider's words than as \"please try again\".\n */\n message: string\n }\n\nexport interface UseCryptoWithdrawalExecutionParams {\n config: WithdrawalFlowConfig\n sourceToken: WithdrawalToken\n destinationToken: WithdrawalToken\n callbacks: WithdrawalFlowCallbacks\n}\n\n/**\n * Runs the withdrawal the user approved, down whichever rail the config names:\n * the relay quote, or `config.submitWithdrawal` when the venue moves the funds.\n *\n * Both guards are read synchronously inside the async submit \u2014 before the first\n * await \u2014 so neither may wait for a re-render: a ref for a double-tap on this\n * mount, and a module-scoped set of in-flight withdrawals for a second press\n * after the sheet was closed and reopened mid-execution. The set holds only\n * while the signature is outstanding; deliberately sending the same amount to\n * the same address again once it has settled is a legitimate withdrawal.\n */\nexport function useCryptoWithdrawalExecution({\n config,\n sourceToken,\n destinationToken,\n callbacks,\n}: UseCryptoWithdrawalExecutionParams) {\n const { apiKey, userId } = useFunkitIdentity()\n const isSubmittingRef = useRef(false)\n const [submission, setSubmission] = useState<CryptoWithdrawalSubmission>({\n status: 'idle',\n })\n\n const submit = useCallback(\n async ({\n quote,\n recipientAddress,\n amount,\n }: {\n /** The quote on screen \u2014 executed as-is, so fees shown are fees paid. */\n quote: CheckoutQuoteResponse\n recipientAddress: string\n amount: string\n }) => {\n if (isSubmittingRef.current) {\n logger.warn('connect-rn:crypto-withdrawal:already_submitting')\n return\n }\n const key = withdrawalKey({\n walletAddress: config.withdrawalWallet.address(),\n recipientAddress,\n amount,\n sourceToken,\n destinationToken,\n })\n if (inFlightWithdrawals.has(key)) {\n logger.warn('connect-rn:crypto-withdrawal:already_in_flight')\n return\n }\n isSubmittingRef.current = true\n inFlightWithdrawals.add(key)\n\n const submissionId = createWithdrawalSubmissionId()\n setSubmission({ status: 'submitting' })\n\n logger.info('crypto-withdrawal:rail_selected', {\n rail: config.submitWithdrawal ? 'venue' : 'relay',\n submissionId,\n fromChainId: sourceToken.chainId,\n fromToken: sourceToken.address,\n toChainId: destinationToken.chainId,\n toToken: destinationToken.address,\n })\n\n let depositAddressOrHash: DepositAddressOrHash\n try {\n if (config.submitWithdrawal) {\n // Priced, not executed: nothing of ours goes on-chain here.\n const { depositAddress } = await config.submitWithdrawal({\n quote,\n recipientAddress: recipientAddress as Address,\n sourceToken,\n destinationToken,\n amountTokenUnits: amount,\n })\n depositAddressOrHash = {\n kind: 'depositAddress',\n depositAddress: depositAddress ?? SYNTHETIC_DEPOSIT_ADDRESS,\n }\n } else {\n const order: CryptoWithdrawalOrder = {\n submissionId,\n recipientAddress:\n recipientAddress as CryptoWithdrawalOrder['recipientAddress'],\n sourceAmountHumanUnit: amount,\n sourceToken,\n destinationToken,\n }\n ensureRelayClientInitialized(logger, 'funkit-connect-rn')\n const { txHash } = await processCryptoWithdrawalOrder({\n order,\n quote,\n wallet: config.withdrawalWallet,\n apiKey,\n userId,\n logger,\n onStepMessage: (stepMessage) =>\n setSubmission({ status: 'submitting', stepMessage }),\n })\n depositAddressOrHash = { kind: 'transaction', txHash }\n }\n } catch (error) {\n if (isUserRejectedError(error)) {\n // Declining is recoverable \u2014 the form stays as it was so the user can\n // simply press again.\n logger.warn('connect-rn:crypto-withdrawal:user_rejected', {\n submission_id: submissionId,\n })\n setSubmission({ status: 'idle' })\n return\n }\n const message = error instanceof Error ? error.message : String(error)\n logger.error(\n 'connect-rn:crypto-withdrawal:execution_failed',\n error as Error,\n { submission_id: submissionId },\n )\n setSubmission({\n status: 'failed',\n code: toWalletExecutionErrorCode(error),\n message,\n })\n callbacks.onWithdrawalError?.({ message })\n return\n } finally {\n isSubmittingRef.current = false\n inFlightWithdrawals.delete(key)\n }\n\n // Funds have moved \u2014 report it outside the try above, so a throw from the\n // host cannot be read as this execution failing. Host callbacks are\n // guarded where they enter the SDK (`guardHostCallbacks`), so this one\n // does not need its own.\n setSubmission({\n status: 'submitted',\n depositAddressOrHash,\n submissionId,\n amount,\n })\n callbacks.onWithdrawalSubmitted?.(\n submissionId,\n depositAddressOrHash.kind === 'transaction'\n ? depositAddressOrHash.txHash\n : depositAddressOrHash.depositAddress,\n )\n },\n [apiKey, userId, config, sourceToken, destinationToken, callbacks],\n )\n\n const reset = useCallback(() => setSubmission({ status: 'idle' }), [])\n\n return { submission, submit, reset }\n}\n", "import {\n BottomSheetModal,\n BottomSheetScrollView,\n BottomSheetView,\n} from '@gorhom/bottom-sheet'\nimport { useMemo, useState } from 'react'\nimport { StyleSheet, View, useWindowDimensions } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { AssetGrid } from '../components/AssetGrid'\nimport { PillButton } from '../components/PillButton'\nimport { ScrollFade, useScrollEdgeFades } from '../components/ScrollFade'\nimport { TopBar } from '../components/TopBar'\nimport { FlowSheetBackground } from '../flow/FlowSheet'\nimport { sheetSizing, useInertScrollableFocus } from '../flow/sheetSizing'\nimport type { WithdrawalToken } from '../flow/withdrawalFlowConfig'\nimport { useNestedSheet } from '../hooks/useNestedSheet'\nimport { ChainAvatar } from '../icons/ChainAvatar'\nimport { TokenChainIcon } from '../icons/TokenChainIcon'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, useTheme } from '../theme/restyle'\nimport {\n ASSET_GRID_AVATAR_SIZE,\n ASSET_GRID_COLUMNS,\n gridCells,\n} from '../utils/assetGrid'\nimport { chainIconUri, chainName } from '../utils/chainDisplay'\nimport { footerBottomMargin } from '../utils/safeArea'\nimport {\n chainCarries,\n chainForToken,\n receivableTokens,\n} from '../withdrawal/receiveDestination'\nimport type { DestinationChain } from '../withdrawal/useWithdrawalDestinationTokens'\nimport { SelectReceiveTokenScreen } from './SelectReceiveTokenScreen'\n\nexport interface SelectReceiveTokenAndChainScreenProps {\n chains: DestinationChain[]\n /** What the withdrawal uses now. The draft opens on it; Confirm replaces it. */\n committed?: WithdrawalToken\n onConfirm: (chainId: number, token: string) => void\n onBack: () => void\n}\n\n/**\n * Pick the token and chain a withdrawal lands as. Taps draft, Confirm commits.\n *\n * A step rather than a sheet, so `back` pops it and popping is what discards the\n * draft. The `+N` row's list is a sheet *over* this screen, which therefore stays\n * mounted \u2014 a token picked there is still drafted on the way back.\n */\nexport function SelectReceiveTokenAndChainScreen({\n chains,\n committed,\n onConfirm,\n onBack,\n}: SelectReceiveTokenAndChainScreenProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const { height } = useWindowDimensions()\n const insets = useSafeAreaInsets()\n const { showTopFade, showBottomFade, scrollProps } = useScrollEdgeFades()\n const {\n nestedSheetRef,\n nestedScreen,\n setNestedScreen,\n openNestedScreen,\n closeNestedScreen,\n renderNestedBackdrop,\n } = useNestedSheet<'availableTokens'>()\n\n const [token, setToken] = useState(committed?.symbol)\n const [chainId, setChainId] = useState(\n committed ? Number(committed.chainId) : undefined,\n )\n // Only a pick from the full list moves this, so drafting around the grid can't\n // change which cells are on it.\n const [pinnedToken, setPinnedToken] = useState(committed?.symbol)\n\n const tokens = useMemo(() => receivableTokens(chains), [chains])\n const { cells, overflowCount } = gridCells(tokens, TOKEN_CELLS, pinnedToken)\n\n // A token carries its chain: keep the drafted one if it can deliver.\n const draftToken = (next: string) => {\n setToken(next)\n setChainId((current) => chainForToken(chains, next, current))\n }\n\n const chainLabel = (chain: DestinationChain) =>\n chainName(chain.chainId) ??\n t('networks.chainFallback', { chainId: chain.chainId })\n\n const footerBottom = footerBottomMargin(insets.bottom)\n // i18next picks the locale's own plural category from `count`, which is what\n // Russian needs to decline 2-4 differently from 5+.\n const moreLabel = t('selectReceiveToken.moreTokens', {\n count: overflowCount,\n })\n\n return (\n <Box\n style={{\n height,\n paddingTop: insets.top,\n backgroundColor: theme.background.modal,\n }}\n >\n <TopBar title={t('selectReceiveToken.title')} onBack={onBack} />\n\n <View style={styles.scrollArea}>\n {/* gorhom's scrollable, not RN's \u2014 the sheet's pan gesture otherwise\n wins on Android. The step's sheet is pinned, so nothing depends on\n the content size it reports (see sheetSizing). */}\n <BottomSheetScrollView\n style={styles.scroll}\n contentContainerStyle={[\n styles.content,\n {\n paddingBottom:\n theme.sizes.buttonLg + CONFIRM_SCROLL_GAP + footerBottom,\n },\n ]}\n showsVerticalScrollIndicator={false}\n {...scrollProps}\n >\n <AssetGrid\n title={t('selectReceiveToken.selectToken')}\n items={cells.map((symbol) => ({\n id: symbol,\n label: symbol,\n icon: (\n <TokenChainIcon symbol={symbol} size={ASSET_GRID_AVATAR_SIZE} />\n ),\n selected: symbol === token,\n onPress: () => draftToken(symbol),\n }))}\n overflow={\n overflowCount > 0\n ? {\n label: moreLabel,\n onPress: () => openNestedScreen('availableTokens'),\n accessibilityLabel: moreLabel,\n }\n : undefined\n }\n />\n\n {/* Curated order: a ruled-out chain is struck through where it stands. */}\n <AssetGrid\n title={t('selectReceiveToken.selectChain')}\n items={chains.map((chain) => ({\n id: String(chain.chainId),\n label: chainLabel(chain),\n icon: (\n <ChainAvatar\n uri={chainIconUri(chain.chainId)}\n size={ASSET_GRID_AVATAR_SIZE}\n />\n ),\n selected: chain.chainId === chainId,\n unsupported: !chainCarries(chain, token),\n onPress: () => setChainId(chain.chainId),\n }))}\n />\n </BottomSheetScrollView>\n\n {showTopFade ? (\n <ScrollFade\n edge=\"top\"\n color={theme.background.modal}\n id=\"receive-token-chain-grid\"\n />\n ) : null}\n {showBottomFade ? (\n <ScrollFade\n edge=\"bottom\"\n color={theme.background.modal}\n id=\"receive-token-chain-grid\"\n />\n ) : null}\n\n {/* After the fades, so the button paints over them rather than under. */}\n <Box style={[styles.footer, { bottom: footerBottom }]}>\n <PillButton\n label={t('common.confirm')}\n disabled={token === undefined || chainId === undefined}\n onPress={() => {\n if (token !== undefined && chainId !== undefined) {\n onConfirm(chainId, token)\n }\n }}\n />\n </Box>\n </View>\n\n <BottomSheetModal\n ref={nestedSheetRef}\n {...sheetSizing({ fullHeight: true })}\n topInset={insets.top}\n // No grabber on this screen \u2014 Close dismisses it, a drag shouldn't.\n enablePanDownToClose={false}\n handleComponent={null}\n backgroundComponent={FlowSheetBackground}\n backdropComponent={renderNestedBackdrop}\n onDismiss={() => setNestedScreen(null)}\n >\n <BottomSheetView focusHook={useInertScrollableFocus}>\n {nestedScreen === 'availableTokens' ? (\n <SelectReceiveTokenScreen\n tokens={tokens}\n selectedToken={token}\n onSelectToken={(next) => {\n draftToken(next)\n // Claims the grid's last cell, and keeps it.\n setPinnedToken(next)\n closeNestedScreen()\n }}\n onClose={closeNestedScreen}\n />\n ) : null}\n </BottomSheetView>\n </BottomSheetModal>\n </Box>\n )\n}\n\n/** Two grid rows. */\nconst TOKEN_CELLS = ASSET_GRID_COLUMNS * 2\n\nconst CONFIRM_SCROLL_GAP = 8\n\nconst styles = StyleSheet.create({\n scrollArea: { position: 'relative', flex: 1 },\n scroll: { flex: 1 },\n content: { paddingHorizontal: 24, paddingTop: 13, gap: 40 },\n footer: { position: 'absolute', left: 0, right: 0, paddingHorizontal: 24 },\n})\n", "import type { ReactNode } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\n\nimport {\n FigmaCheckIcon,\n FigmaChevronRightIcon,\n} from '../icons/FigmaSystemIcons'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport {\n ASSET_GRID_AVATAR_SIZE,\n ASSET_GRID_COLUMNS,\n ASSET_GRID_GAP,\n chunk,\n} from '../utils/assetGrid'\n\nexport interface AssetGridItemProps {\n /** A token symbol, or a chain id. */\n id: string\n /** Size it with `ASSET_GRID_AVATAR_SIZE`. */\n icon: ReactNode\n label: string\n selected: boolean\n /** Offered but not pickable, e.g. a chain that doesn't carry the picked token. */\n unsupported?: boolean\n onPress: () => void\n /** Defaults to `label`. */\n accessibilityLabel?: string\n}\n\nexport interface AssetGridOverflow {\n /** Reads as a count, e.g. `+7 tokens`. */\n label: string\n onPress: () => void\n accessibilityLabel: string\n}\n\nexport interface AssetGridProps {\n /** Section header, e.g. \"Select token\". */\n title: string\n items: AssetGridItemProps[]\n /** The `+N tokens \u203A` row. Omit when nothing is hidden. */\n overflow?: AssetGridOverflow\n}\n\n/**\n * A titled grid of asset cells, five to a row, over an optional row leading to the\n * ones that didn't fit.\n *\n * Chunked into explicit rows of flexed columns, not wrapped on percentage widths:\n * Android rounds a percentage up to the nearest physical pixel, so five 20% cells\n * overflow their row and the fifth wraps.\n */\nexport function AssetGrid({ title, items, overflow }: AssetGridProps) {\n const theme = useTheme()\n\n return (\n <Box style={styles.section}>\n <Text variant=\"bodyMedium\" numberOfLines={1} style={styles.title}>\n {title}\n </Text>\n <Box style={styles.grid}>\n {/* Rows are positional, so their index is their identity: keying on a\n cell remounts all five when the list reflows. */}\n {chunk(items, ASSET_GRID_COLUMNS).map((row, rowIndex) => (\n <Box key={rowIndex} flexDirection=\"row\" style={styles.row}>\n {row.map((item) => (\n <AssetGridItem key={item.id} {...item} />\n ))}\n {/* A short last row still has to sit on the column rhythm. */}\n {Array.from(\n { length: ASSET_GRID_COLUMNS - row.length },\n (_, slot) => (\n <Box key={`filler-${slot}`} style={styles.filler} />\n ),\n )}\n </Box>\n ))}\n </Box>\n {overflow ? (\n <Pressable\n onPress={overflow.onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={overflow.accessibilityLabel}\n >\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.overflow}>\n {/* Without a flexed box the label can't shrink, so a long one pushes\n the chevron past the row's edge instead of ellipsizing. */}\n <Box flex={1}>\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n style={{ color: theme.content.elements.secondary }}\n >\n {overflow.label}\n </Text>\n </Box>\n <FigmaChevronRightIcon\n size={20}\n color={theme.content.elements.secondary}\n />\n </Box>\n </Pressable>\n ) : null}\n </Box>\n )\n}\n\n/** One cell of the grid (Figma `icon/crypto-token` + its label). */\nexport function AssetGridItem({\n icon,\n label,\n selected,\n unsupported = false,\n onPress,\n accessibilityLabel,\n}: AssetGridItemProps) {\n const theme = useTheme()\n // Marking a struck-through cell as chosen would contradict itself in the frame\n // before the caller moves the pick off it.\n const isMarked = selected && !unsupported\n\n return (\n <Pressable\n onPress={onPress}\n disabled={unsupported}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel ?? label}\n accessibilityState={{ selected: isMarked, disabled: unsupported }}\n style={styles.cell}\n >\n <Box alignItems=\"center\" style={styles.stack}>\n <Box style={styles.avatar}>\n <Box\n style={\n unsupported\n ? { opacity: theme.opacity.disabled / 100 }\n : undefined\n }\n >\n {icon}\n </Box>\n {isMarked ? (\n <>\n {/* Two rings over the logo rather than a smaller logo inside a\n border: the design crops the avatar, it doesn't scale it. */}\n <Box\n pointerEvents=\"none\"\n style={[\n styles.ringGap,\n { borderColor: theme.background.modal },\n ]}\n />\n <Box\n pointerEvents=\"none\"\n style={[\n styles.ring,\n { borderColor: theme.content.elements.primary },\n ]}\n />\n <Box\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[\n styles.badge,\n {\n backgroundColor: theme.content.elements.primary,\n borderColor: theme.background.modal,\n },\n ]}\n >\n <FigmaCheckIcon\n size={12}\n color={theme.content.button.primary.default}\n />\n </Box>\n </>\n ) : null}\n </Box>\n <Text\n variant=\"detail\"\n weight=\"medium\"\n numberOfLines={1}\n style={[\n styles.label,\n unsupported\n ? {\n color: theme.content.elements.secondary,\n textDecorationLine: 'line-through',\n }\n : { color: theme.content.elements.primary },\n ]}\n >\n {label}\n </Text>\n </Box>\n </Pressable>\n )\n}\n\nconst BADGE_SIZE = 24\n\nconst styles = StyleSheet.create({\n section: { gap: 4 },\n title: { paddingBottom: 12 },\n grid: { gap: ASSET_GRID_GAP },\n row: { gap: ASSET_GRID_GAP },\n filler: { flex: 1 },\n overflow: { gap: 6, paddingVertical: 13 },\n // Cells are sized by the row they sit in, not by a width of their own.\n cell: { flex: 1 },\n stack: { gap: 6 },\n avatar: { width: ASSET_GRID_AVATAR_SIZE, height: ASSET_GRID_AVATAR_SIZE },\n ringGap: {\n ...StyleSheet.absoluteFill,\n borderRadius: 999,\n borderWidth: 4,\n },\n ring: { ...StyleSheet.absoluteFill, borderRadius: 999, borderWidth: 2 },\n badge: {\n position: 'absolute',\n right: 0,\n bottom: 0,\n width: BADGE_SIZE,\n height: BADGE_SIZE,\n borderRadius: 999,\n borderWidth: 2,\n },\n // A chain name runs wider than the avatar, so it borrows half the gutter either\n // side rather than ellipsizing at the cell's edge.\n label: {\n textAlign: 'center',\n alignSelf: 'stretch',\n marginHorizontal: -ASSET_GRID_GAP / 2,\n },\n})\n", "export const ASSET_GRID_COLUMNS = 5\nexport const ASSET_GRID_GAP = 16\n/** Shared so a cell's selection ring lands on the circle the caller passed it. */\nexport const ASSET_GRID_AVATAR_SIZE = 58\n\n/**\n * The cells a capped grid offers, and how many the `+N` affordance stands for.\n *\n * - `mustShow` takes the **last** slot when the head would have hidden it, so a\n * pick made behind the `+N` row comes back without adding a row or moving any\n * other cell. Matched by identity.\n * - A non-positive `capacity` means no cap, so a caller still resolving its limit\n * shows what it has rather than an empty grid.\n */\nexport function gridCells<T>(\n items: T[],\n capacity: number,\n mustShow?: T,\n): { cells: T[]; overflowCount: number } {\n if (capacity <= 0 || items.length <= capacity) {\n return { cells: items, overflowCount: 0 }\n }\n const head = items.slice(0, capacity)\n const needsSlot =\n mustShow !== undefined &&\n !head.includes(mustShow) &&\n items.includes(mustShow)\n return {\n cells: needsSlot ? [...head.slice(0, -1), mustShow] : head,\n overflowCount: items.length - capacity,\n }\n}\n\n/** A non-positive `size` can't advance the cursor, so it stays one row. */\nexport function chunk<T>(items: T[], size: number): T[][] {\n if (size <= 0) {\n return items.length > 0 ? [items] : []\n }\n const rows: T[][] = []\n for (let i = 0; i < items.length; i += size) {\n rows.push(items.slice(i, i + size))\n }\n return rows\n}\n", "import type { ReactNode } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\n\nimport { FigmaChevronLeftIcon, FigmaCloseIcon } from '../icons/FigmaSystemIcons'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\nconst ICON_SIZE = 20\n\nexport interface TopBarProps {\n title: string\n /** Pops the screen. Omit at the root of a flow. */\n onBack?: () => void\n /** Ends the flow. Omit where this screen can't be abandoned. */\n onClose?: () => void\n}\n\n/**\n * The sheet's header: back, title, close.\n */\nexport function TopBar({ title, onBack, onClose }: TopBarProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n\n return (\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.bar}>\n <IconSlot\n onPress={onBack}\n label={t('common.back')}\n icon={\n <FigmaChevronLeftIcon\n size={ICON_SIZE}\n color={theme.content.button.icon.default}\n />\n }\n />\n <Text\n variant=\"headerTitle\"\n numberOfLines={1}\n // The design's line box, so the title's place in the row doesn't move\n // with the font-size token or the platform's own leading.\n style={[\n styles.title,\n { lineHeight: theme.textVariants.bodyMedium.lineHeight },\n ]}\n >\n {title}\n </Text>\n <IconSlot\n onPress={onClose}\n label={t('common.close')}\n icon={\n <FigmaCloseIcon\n size={ICON_SIZE}\n color={theme.content.button.icon.default}\n />\n }\n />\n </Box>\n )\n}\n\n/** One 32-square of the bar, empty when the host gave it nothing to do. */\nfunction IconSlot({\n onPress,\n label,\n icon,\n}: {\n onPress?: () => void\n label: string\n icon: ReactNode\n}) {\n if (!onPress) {\n return <Box style={styles.slot} />\n }\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n // Takes the 32-square up to the 44 a finger needs.\n hitSlop={6}\n style={styles.slot}\n >\n {icon}\n </Pressable>\n )\n}\n\nconst styles = StyleSheet.create({\n bar: { paddingTop: 20, paddingBottom: 12, paddingHorizontal: 12, gap: 4 },\n slot: {\n width: 32,\n height: 32,\n alignItems: 'center',\n justifyContent: 'center',\n },\n title: { flex: 1 },\n})\n", "import type { DestinationChain } from './useWithdrawalDestinationTokens'\n\n/** Nothing picked rules nothing out. */\nexport function chainCarries(\n chain: DestinationChain,\n token: string | undefined,\n): boolean {\n return !token || chain.symbols.includes(token)\n}\n\n/**\n * The preferred chain if it carries the token, else the first that does \u2014 keeping\n * a still-valid preference is what stops a new token moving the network under it.\n */\nexport function chainForToken(\n chains: DestinationChain[],\n token: string,\n preferredChainId: number | undefined,\n): number | undefined {\n const preferred = chains.find((chain) => chain.chainId === preferredChainId)\n if (preferred?.symbols.includes(token)) {\n return preferred.chainId\n }\n return chains.find((chain) => chain.symbols.includes(token))?.chainId\n}\n\n/** Deduped, curated order intact. */\nexport function receivableTokens(chains: DestinationChain[]): string[] {\n return [...new Set(chains.flatMap((chain) => chain.symbols))]\n}\n", "import { BottomSheetScrollView } from '@gorhom/bottom-sheet'\nimport { useState } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { ScrollFade, useScrollEdgeFades } from '../components/ScrollFade'\nimport { SearchInput } from '../components/SearchInput'\nimport { SelectableAssetRow } from '../components/SelectableAssetRow'\nimport { TopBar } from '../components/TopBar'\nimport { useNestedSheetHeight } from '../hooks/useNestedSheetHeight'\nimport { TokenChainIcon } from '../icons/TokenChainIcon'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, useTheme } from '../theme/restyle'\n\nconst ROW_AVATAR_SIZE = 36\n\nexport interface SelectReceiveTokenScreenProps {\n tokens: string[]\n selectedToken?: string\n /** Drafts the token and hands control back to the screen underneath. */\n onSelectToken: (token: string) => void\n onClose: () => void\n}\n\n/**\n * Every token a withdrawal can be received as, searchable \u2014 the tail behind the\n * grid's `+N tokens` row. A tap drafts and returns; only the grid commits.\n */\nexport function SelectReceiveTokenScreen({\n tokens,\n selectedToken,\n onSelectToken,\n onClose,\n}: SelectReceiveTokenScreenProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const sheetHeight = useNestedSheetHeight()\n const insets = useSafeAreaInsets()\n const { showTopFade, showBottomFade, scrollProps } = useScrollEdgeFades()\n const [query, setQuery] = useState('')\n\n const needle = query.trim().toLowerCase()\n const orderedTokens =\n selectedToken && tokens.includes(selectedToken)\n ? [selectedToken, ...tokens.filter((token) => token !== selectedToken)]\n : tokens\n const matches = orderedTokens.filter((token) =>\n token.toLowerCase().includes(needle),\n )\n const searchPlaceholder = t('selectReceiveToken.searchTokens')\n\n return (\n <Box\n borderTopLeftRadius=\"modal\"\n borderTopRightRadius=\"modal\"\n style={{\n height: sheetHeight,\n backgroundColor: theme.background.modal,\n }}\n >\n <TopBar\n title={t('selectReceiveToken.availableTokens')}\n onClose={onClose}\n />\n\n <Box style={styles.search}>\n <SearchInput\n value={query}\n onChangeValue={setQuery}\n placeholder={searchPlaceholder}\n accessibilityLabel={searchPlaceholder}\n />\n </Box>\n\n <View style={styles.scrollArea}>\n <BottomSheetScrollView\n style={styles.scroll}\n contentContainerStyle={[\n styles.list,\n { paddingBottom: insets.bottom + LIST_BOTTOM_GAP },\n ]}\n showsVerticalScrollIndicator={false}\n keyboardShouldPersistTaps=\"handled\"\n {...scrollProps}\n >\n {matches.map((token) => (\n <SelectableAssetRow\n key={token}\n name={token}\n icon={<TokenChainIcon symbol={token} size={ROW_AVATAR_SIZE} />}\n selected={token === selectedToken}\n onPress={() => onSelectToken(token)}\n accessibilityLabel={token}\n />\n ))}\n </BottomSheetScrollView>\n\n {showTopFade ? (\n <ScrollFade\n edge=\"top\"\n color={theme.background.modal}\n id=\"receive-token-list\"\n />\n ) : null}\n {showBottomFade ? (\n <ScrollFade\n edge=\"bottom\"\n color={theme.background.modal}\n id=\"receive-token-list\"\n />\n ) : null}\n </View>\n </Box>\n )\n}\n\n// Read off the inset so the last row clears the home indicator on any device.\nconst LIST_BOTTOM_GAP = 16\n\nconst styles = StyleSheet.create({\n search: { paddingHorizontal: 24, paddingBottom: 12 },\n scrollArea: { position: 'relative', flex: 1 },\n scroll: { flex: 1 },\n list: { paddingHorizontal: 16 },\n})\n", "import { BottomSheetTextInput } from '@gorhom/bottom-sheet'\nimport { useState } from 'react'\nimport { StyleSheet } from 'react-native'\n\nimport { FigmaSearchIcon } from '../icons/FigmaSystemIcons'\nimport { Box, useTheme } from '../theme/restyle'\n\nexport interface SearchInputProps {\n value: string\n onChangeValue: (value: string) => void\n placeholder: string\n accessibilityLabel: string\n}\n\n/**\n * A single-line filter field for long pick lists.\n *\n * Uses gorhom's `BottomSheetTextInput`, so the screen hosting it must set\n * `keyboardAvoidEnabled` on `FlowSheet` \u2014 gorhom's native avoidance is inert\n * under `enableDynamicSizing` (see `useKeyboardHeight`).\n */\nexport function SearchInput({\n value,\n onChangeValue,\n placeholder,\n accessibilityLabel,\n}: SearchInputProps) {\n const theme = useTheme()\n const [isFocused, setIsFocused] = useState(false)\n\n return (\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n borderRadius=\"element\"\n style={[\n styles.field,\n {\n backgroundColor: theme.background.modal,\n borderColor: isFocused\n ? theme.border.elements.selected.color\n : theme.border.elements.default.color,\n borderWidth: theme.border.elements.default.weight,\n },\n ]}\n >\n <FigmaSearchIcon size={16} color={theme.content.elements.secondary} />\n <BottomSheetTextInput\n value={value}\n onChangeText={onChangeValue}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n placeholder={placeholder}\n placeholderTextColor={theme.content.elements.secondary}\n accessibilityLabel={accessibilityLabel}\n autoCapitalize=\"characters\"\n autoCorrect={false}\n spellCheck={false}\n returnKeyType=\"search\"\n style={[\n styles.input,\n theme.textVariants.body,\n { color: theme.content.elements.primary },\n ]}\n />\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n field: { height: 48, paddingLeft: 16, paddingRight: 8, gap: 8 },\n // Undo the platform's own padding so the field's height is the box's.\n input: { flex: 1, padding: 0 },\n})\n", "import type { ReactNode } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\n\nimport { FigmaCheckIcon } from '../icons/FigmaSystemIcons'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\nexport interface SelectableAssetRowProps {\n name: string\n /** The 36px leading avatar \u2014 a token, a chain, or a token-on-chain pair. */\n icon: ReactNode\n selected: boolean\n /** Offered but not pickable, e.g. a chain that doesn't carry the picked token. */\n disabled?: boolean\n onPress: () => void\n accessibilityLabel: string\n}\n\n/** One row of a token or chain pick list (Figma `list-item/base`). */\nexport function SelectableAssetRow({\n name,\n icon,\n selected,\n disabled = false,\n onPress,\n accessibilityLabel,\n}: SelectableAssetRowProps) {\n const theme = useTheme()\n\n return (\n <Pressable\n onPress={onPress}\n disabled={disabled}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected, disabled }}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n borderRadius=\"element\"\n style={[\n styles.row,\n selected ? { backgroundColor: theme.background.secondary } : null,\n disabled ? { opacity: theme.opacity.disabled / 100 } : null,\n ]}\n >\n {icon}\n <Box flex={1}>\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n style={{ color: theme.content.elements.primary }}\n >\n {name}\n </Text>\n </Box>\n {selected ? (\n <FigmaCheckIcon size={20} color={theme.content.elements.secondary} />\n ) : null}\n </Box>\n </Pressable>\n )\n}\n\nconst styles = StyleSheet.create({\n row: { gap: 12, paddingHorizontal: 12, paddingVertical: 10 },\n})\n", "import { BottomSheetScrollView } from '@gorhom/bottom-sheet'\nimport { Pressable, StyleSheet, View, useWindowDimensions } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { Grabber } from '../components/Grabber'\nimport { ScrollFade, useScrollEdgeFades } from '../components/ScrollFade'\nimport type { WithdrawalSourceTokenOption } from '../flow/withdrawalFlowConfig'\nimport { FigmaSuccessCheckIcon } from '../icons/FigmaSystemIcons'\nimport { TokenChainIcon } from '../icons/TokenChainIcon'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\nexport interface SelectSourceTokenScreenProps {\n options: WithdrawalSourceTokenOption[]\n /** Index into `options` \u2014 two options can share a symbol (perps vs spot). */\n selectedIndex: number\n onSelect: (index: number) => void\n onBack: () => void\n}\n\n/**\n * Pick which balance the withdrawal comes out of. Flat, not grouped by chain:\n * the sources a host offers are balances on one venue, and two of them can\n * share a symbol (Lighter's perps and spot USDC), so the row identity is the\n * option itself rather than its symbol.\n */\nexport function SelectSourceTokenScreen({\n options,\n selectedIndex,\n onSelect,\n onBack,\n}: SelectSourceTokenScreenProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const { height } = useWindowDimensions()\n const insets = useSafeAreaInsets()\n const { showTopFade, showBottomFade, scrollProps } = useScrollEdgeFades()\n\n return (\n // A full window tall, like the step it replaces \u2014 the flow sheet is pinned\n // to a fixed detent while a crypto withdrawal step is up (see sheetSizing).\n <Box style={{ height, paddingTop: insets.top }}>\n <Grabber />\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n style={[styles.topBar, { height: theme.sizes.topBar }]}\n >\n <Pressable\n onPress={onBack}\n accessibilityRole=\"button\"\n accessibilityLabel={t('common.back')}\n hitSlop={8}\n >\n <Text variant=\"bodyMedium\">{t('common.back')}</Text>\n </Pressable>\n <Text variant=\"headerTitle\" style={styles.title}>\n {t('withdrawCrypto.selectSource')}\n </Text>\n <Box style={styles.spacer} />\n </Box>\n\n <View style={styles.scrollArea}>\n <BottomSheetScrollView\n style={styles.scroll}\n contentContainerStyle={[\n styles.list,\n { paddingBottom: LIST_BOTTOM_GAP + insets.bottom },\n ]}\n showsVerticalScrollIndicator={false}\n {...scrollProps}\n >\n {options.map((option, index) => {\n const label = option.label ?? option.token.symbol\n const isSelected = index === selectedIndex\n return (\n <Pressable\n // Identity is positional \u2014 two options can be the same token\n // with the same label and differ only in which balance they\n // draw from, so the index is the only unique part of the key.\n key={`${index}:${option.token.chainId}:${option.token.address}`}\n onPress={() => onSelect(index)}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n accessibilityState={{ selected: isSelected }}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n borderRadius=\"element\"\n style={[\n styles.row,\n isSelected\n ? { backgroundColor: theme.background.secondary }\n : undefined,\n ]}\n >\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n style={styles.token}\n >\n <TokenChainIcon\n symbol={option.token.symbol}\n iconSrc={option.iconSrc}\n />\n <Text\n variant=\"bodyMedium\"\n style={{ color: theme.content.elements.primary }}\n >\n {label}\n </Text>\n </Box>\n {isSelected ? <FigmaSuccessCheckIcon size={16} /> : null}\n </Box>\n </Pressable>\n )\n })}\n </BottomSheetScrollView>\n {showTopFade ? (\n <ScrollFade\n edge=\"top\"\n color={theme.background.modal}\n id=\"source-token-list\"\n />\n ) : null}\n {showBottomFade ? (\n <ScrollFade\n edge=\"bottom\"\n color={theme.background.modal}\n id=\"source-token-list\"\n />\n ) : null}\n </View>\n </Box>\n )\n}\n\n/** Keeps the last row clear of the sheet edge. */\nconst LIST_BOTTOM_GAP = 24\n\nconst styles = StyleSheet.create({\n topBar: { paddingHorizontal: 16, gap: 12 },\n title: { flex: 1 },\n spacer: { width: 20 },\n scrollArea: { flex: 1, position: 'relative' },\n scroll: { flex: 1 },\n list: { paddingHorizontal: 16, gap: 4 },\n row: { paddingHorizontal: 12, paddingVertical: 10 },\n token: { gap: 10 },\n})\n", "import { StyleSheet } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { Grabber } from '../components/Grabber'\nimport { TopBar } from '../components/TopBar'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\n\nexport interface TransactionBreakdownScreenProps {\n /** What the recipient should expect, e.g. `$99.94`. */\n usdLabel: string\n /** The floor the trade won't execute below, e.g. `$99.81`. */\n floorLabel: string\n}\n\n/**\n * What the quoted amount means, in prose: it is an estimate, it has a floor, and\n * it settles in seconds. Opened from the \u24D8 beside the amount.\n */\nexport function TransactionBreakdownScreen({\n usdLabel,\n floorLabel,\n}: TransactionBreakdownScreenProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const insets = useSafeAreaInsets()\n\n return (\n <Box>\n <Grabber />\n <TopBar title={t('withdrawAddress.breakdownTitle')} />\n\n {/* The design's own 16 below the paragraph, and then the home indicator's\n band \u2014 which the sheet sits under, so the inset is added rather than\n standing in for it. */}\n <Box\n style={[styles.body, { paddingBottom: BODY_PADDING + insets.bottom }]}\n >\n <Text\n variant=\"detail\"\n style={{ color: theme.content.elements.secondary }}\n >\n {emphasise(\n t('withdrawAddress.breakdown', {\n amount: usdLabel,\n minimum: floorLabel,\n }),\n [usdLabel, floorLabel],\n theme.content.elements.primary,\n )}\n </Text>\n </Box>\n </Box>\n )\n}\n\n/**\n * The two figures, set in the emphasis the design gives them, without splitting\n * the sentence into fragments a translator can't reorder: the copy stays one\n * string, and the values are found in whatever place the translation puts them.\n */\nfunction emphasise(sentence: string, values: string[], color: string) {\n const pattern = values.filter(Boolean).map(escapeForRegExp).join('|')\n if (!pattern) {\n return sentence\n }\n return sentence.split(new RegExp(`(${pattern})`)).map((part, index) =>\n values.includes(part) ? (\n // Index-keyed: a figure can legitimately appear twice, so the value is\n // not a key.\n <Text key={index} variant=\"detail\" weight=\"medium\" style={{ color }}>\n {part}\n </Text>\n ) : (\n part\n ),\n )\n}\n\nconst escapeForRegExp = (value: string) =>\n value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n\n// Measured off the design: the body is inset 20 across and 16 down.\nconst BODY_PADDING = 16\n\nconst styles = StyleSheet.create({\n body: { paddingHorizontal: 20, paddingTop: BODY_PADDING },\n})\n", "import {\n ActivityIndicator,\n Keyboard,\n StyleSheet,\n useWindowDimensions,\n} from 'react-native'\nimport Animated, {\n Easing,\n Keyframe,\n LinearTransition,\n} from 'react-native-reanimated'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { PillButton } from '../components/PillButton'\nimport { ReceiveAmountSummary } from '../components/ReceiveAmountSummary'\nimport { ReceiveAsRow } from '../components/ReceiveAsRow'\nimport { TopBar } from '../components/TopBar'\nimport { WalletAddressInput } from '../components/WalletAddressInput'\nimport type { WithdrawalToken } from '../flow/withdrawalFlowConfig'\nimport { useKeyboardHeight } from '../flow/useKeyboardHeight'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { footerBottomMargin } from '../utils/safeArea'\n\nconst AnimatedBox = Animated.createAnimatedComponent(Box)\n\n// Withdrawing commits the screen: the nav and the inputs above the figure\n// have nothing left to do, so they clear out and let it take the space.\nconst SUBMIT_TRANSITION_DURATION = 380\nconst SUBMIT_TRANSITION_EASING = Easing.bezier(0.16, 1, 0.3, 1)\nconst SUBMIT_TRAVEL = 24\nconst FADE_SLIDE_UP_EXITING = new Keyframe({\n 0: { opacity: 1, transform: [{ translateY: 0 }] },\n 100: {\n opacity: 0,\n transform: [{ translateY: -SUBMIT_TRAVEL }],\n easing: SUBMIT_TRANSITION_EASING,\n },\n}).duration(SUBMIT_TRANSITION_DURATION)\n// The figure rides into the space the nav and inputs leave. Every box between\n// the screen and it shares this clock: a layout animation interpolates only its\n// own view's parent-relative origin, so an unanimated box in between snaps its\n// whole delta on the first frame and the figure snaps with it.\nconst SUBMIT_TRANSITION = LinearTransition.duration(\n SUBMIT_TRANSITION_DURATION,\n).easing(SUBMIT_TRANSITION_EASING)\n\nexport interface WithdrawAddressScreenProps {\n /** Names the amount already confirmed, e.g. `Withdraw $100`. */\n title: string\n /** The typed recipient. */\n recipient: string\n onChangeRecipient: (value: string) => void\n /** Whether the recipient is an address at all; `undefined` while empty. */\n isAddress: boolean | undefined\n onPaste: () => void\n /** A clipboard read is out \u2014 the Paste action is held down until it lands. */\n isPasting?: boolean\n /** Omit to drop the connected-wallet shortcut. */\n onUseConnected?: () => void\n /** A reason the address can't be used, past being well-formed. */\n errorText?: string\n /** Non-blocking caution, e.g. a flagged-address notice. */\n warningText?: string\n /** What the withdrawal is received as, and the picker for it. */\n destinationToken: WithdrawalToken | undefined\n onPressReceive: () => void\n /**\n * What the recipient gets, in the currency the screen leads with. `undefined`\n * until the quote settles.\n */\n usdLabel: string | undefined\n /** The same amount in the token that arrives, e.g. `99.78 USDC`. */\n tokenLabel: string | undefined\n onPressBreakdown: () => void\n /** The quote couldn't be got \u2014 shown where the figure would be. */\n quoteErrorText?: string\n canSubmit: boolean\n /** The signature is in flight, or the quote it needs isn't settled. */\n isBusy: boolean\n /** The signature is out, or has landed and the outcome is taking over. */\n isSubmitting: boolean\n onSubmit: () => void\n /** An unrecoverable failure from the last attempt. */\n executionErrorText?: string\n onBack: () => void\n onClose: () => void\n}\n\n/**\n * Step two of the crypto withdrawal: where the money goes, and what it arrives\n * as. The amount was taken on the step before and is named in the title.\n */\nexport function WithdrawAddressScreen({\n title,\n recipient,\n onChangeRecipient,\n isAddress,\n onPaste,\n isPasting,\n onUseConnected,\n errorText,\n warningText,\n destinationToken,\n onPressReceive,\n usdLabel,\n tokenLabel,\n onPressBreakdown,\n quoteErrorText,\n canSubmit,\n isBusy,\n isSubmitting,\n onSubmit,\n executionErrorText,\n onBack,\n onClose,\n}: WithdrawAddressScreenProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const { height } = useWindowDimensions()\n const insets = useSafeAreaInsets()\n // The screen is already the whole window, so the sheet can't lift it: the\n // footer is what has to clear the keyboard.\n const keyboardHeight = useKeyboardHeight(true)\n const footerErrorText = executionErrorText ?? quoteErrorText\n\n return (\n <Box\n style={{\n height,\n paddingTop: insets.top,\n backgroundColor: theme.background.modal,\n }}\n >\n {isSubmitting ? null : (\n <AnimatedBox exiting={FADE_SLIDE_UP_EXITING}>\n <TopBar title={title} onBack={onBack} onClose={onClose} />\n </AnimatedBox>\n )}\n\n {isSubmitting ? null : (\n <AnimatedBox exiting={FADE_SLIDE_UP_EXITING} style={styles.body}>\n <ReceiveAsRow\n destinationToken={destinationToken}\n onPress={onPressReceive}\n />\n <WalletAddressInput\n value={recipient}\n onChangeText={onChangeRecipient}\n isAddress={isAddress}\n onPaste={onPaste}\n isPasting={isPasting}\n onUseConnected={onUseConnected}\n errorText={errorText}\n warningText={warningText}\n />\n </AnimatedBox>\n )}\n\n {/* Only an address gets a figure: there is nothing to quote against one\n that isn't, and a number beside \"no wallet found\" reads as a promise.\n Its band grows to fill the nav and inputs' place once withdrawing\n clears them out. */}\n <AnimatedBox\n layout={SUBMIT_TRANSITION}\n flex={1}\n justifyContent=\"center\"\n style={styles.summary}\n >\n {isAddress ? (\n <AnimatedBox layout={SUBMIT_TRANSITION}>\n <ReceiveAmountSummary\n label={t('withdrawAddress.youllReceive')}\n usdLabel={usdLabel}\n tokenLabel={tokenLabel}\n // Nothing to break down until there is a figure.\n onPressBreakdown={usdLabel ? onPressBreakdown : undefined}\n />\n </AnimatedBox>\n ) : null}\n </AnimatedBox>\n\n {/* The way to send it waits on an address too. */}\n {recipient === '' ? null : (\n <AnimatedBox\n layout={SUBMIT_TRANSITION}\n style={[\n styles.footer,\n {\n // Withdrawing drops the keyboard, so stop clearing it in the same\n // commit that frees the space above: waiting for the hide event\n // would relayout the column a second time, mid-transition.\n marginBottom:\n keyboardHeight > 0 && !isSubmitting\n ? keyboardHeight + FOOTER_KEYBOARD_GAP\n : footerBottomMargin(insets.bottom),\n },\n ]}\n >\n {/* The last attempt's failure outranks a missing price: it is about\n money that already moved. */}\n {footerErrorText ? (\n <Text\n variant=\"detail\"\n style={[\n styles.footerError,\n { color: theme.content.elements.error },\n ]}\n >\n {footerErrorText}\n </Text>\n ) : null}\n <PillButton\n label={\n isSubmitting\n ? t('withdrawAddress.withdrawing')\n : t('withdrawAddress.withdrawNow')\n }\n icon={\n isSubmitting ? (\n <ActivityIndicator\n size=\"small\"\n color={theme.content.button.primary.default}\n />\n ) : undefined\n }\n disabled={!canSubmit || isBusy}\n onPress={() => {\n // The field outlives the press by the exit's length, and would\n // hold the keyboard over the footer until it unmounts.\n Keyboard.dismiss()\n onSubmit()\n }}\n />\n </AnimatedBox>\n )}\n </Box>\n )\n}\n\n// Measured off the design (a 402\u00D7778 content area above the home indicator).\nconst BODY_HORIZONTAL_MARGIN = 20\nconst FOOTER_KEYBOARD_GAP = 12\n\nconst styles = StyleSheet.create({\n body: {\n marginHorizontal: BODY_HORIZONTAL_MARGIN,\n paddingTop: 12,\n gap: 16,\n },\n summary: { paddingHorizontal: BODY_HORIZONTAL_MARGIN, paddingVertical: 12 },\n footer: { marginHorizontal: BODY_HORIZONTAL_MARGIN, gap: 12 },\n footerError: { textAlign: 'center' },\n})\n", "import type { WithdrawalToken } from '../flow/withdrawalFlowConfig'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { chainIconUri, chainName } from '../utils/chainDisplay'\nimport { SelectedChainRow } from './SelectedChainRow'\n\nexport interface ReceiveAsRowProps {\n /** The picked destination, or `undefined` while the list is resolving. */\n destinationToken: WithdrawalToken | undefined\n /** Opens the receive-token picker. */\n onPress: () => void\n}\n\n/**\n * What the withdrawal is received as, and the way to change it. Shared by the\n * screens that show it \u2014 the row is the same on both, and a second copy is how\n * the label and the token/chain wording drift apart.\n */\nexport function ReceiveAsRow({ destinationToken, onPress }: ReceiveAsRowProps) {\n const { t } = useFunkitTranslation()\n const label = t('withdrawCrypto.receiveAs')\n\n return (\n <SelectedChainRow\n label={label}\n name={\n destinationToken\n ? `${destinationToken.symbol} \u00B7 ${\n chainName(Number(destinationToken.chainId)) ??\n t('networks.chainFallback', {\n chainId: destinationToken.chainId,\n })\n }`\n : t('common.loading')\n }\n iconUri={chainIconUri(\n destinationToken ? Number(destinationToken.chainId) : 0,\n )}\n accessibilityLabel={label}\n onPress={onPress}\n />\n )\n}\n", "import { BottomSheetTextInput } from '@gorhom/bottom-sheet'\nimport { StyleSheet } from 'react-native'\n\nimport {\n FigmaAlertCircleIcon,\n FigmaSuccessCheckIcon,\n} from '../icons/FigmaSystemIcons'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { PillButton } from './PillButton'\n\nconst STATUS_ICON_SIZE = 16\n\nexport interface WalletAddressInputProps {\n value: string\n onChangeText: (value: string) => void\n /**\n * Whether what has been typed is an address at all. `undefined` while the\n * field is empty, where the design shows no verdict either way.\n */\n isAddress: boolean | undefined\n /** Fills the field from the clipboard. */\n onPaste: () => void\n /**\n * A clipboard read is out. The read can block for seconds on the OS\n * permission prompt, so Paste is held down until it lands rather than letting\n * a second tap queue a second read.\n */\n isPasting?: boolean\n /**\n * Fills the field with the connected wallet's own address. Omit to drop the\n * shortcut (see `disableConnectedWallet` on the flow config).\n */\n onUseConnected?: () => void\n /** A reason the address can't be used, past being well-formed. */\n errorText?: string\n /** Non-blocking caution, e.g. a flagged-address notice. */\n warningText?: string\n}\n\n/**\n * The recipient field: the address, its verdict, and the two ways to fill it.\n *\n * `Paste` is the primary action while the field is empty \u2014 an address is pasted\n * far more often than typed \u2014 and gives way to the quieter pair once there is\n * something to clear.\n */\nexport function WalletAddressInput({\n value,\n onChangeText,\n isAddress,\n onPaste,\n isPasting = false,\n onUseConnected,\n errorText,\n warningText,\n}: WalletAddressInputProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const label = t('withdrawCrypto.addressPlaceholder')\n const isEmpty = value === ''\n\n // An error outranks a warning: both describe the same field, and the blocking\n // one is what the user has to act on.\n const helperText = errorText ?? warningText\n\n return (\n <Box style={styles.root}>\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n style={styles.header}\n >\n <Text\n variant=\"detail\"\n weight=\"medium\"\n numberOfLines={1}\n style={[styles.label, { color: theme.content.elements.secondary }]}\n >\n {label}\n </Text>\n {isAddress === undefined ? null : (\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.status}>\n {isAddress ? (\n <FigmaSuccessCheckIcon size={STATUS_ICON_SIZE} />\n ) : (\n <FigmaAlertCircleIcon\n size={STATUS_ICON_SIZE}\n color={theme.content.elements.error}\n />\n )}\n <Text\n variant=\"detail\"\n weight=\"medium\"\n style={{\n color: isAddress\n ? theme.content.elements.success\n : theme.content.elements.error,\n }}\n >\n {isAddress\n ? t('withdrawAddress.detected')\n : t('withdrawAddress.notFound')}\n </Text>\n </Box>\n )}\n </Box>\n\n <Box\n borderRadius=\"element\"\n style={[\n styles.field,\n {\n height: theme.sizes.buttonLg,\n borderColor: theme.border.elements.default.color,\n borderWidth: theme.border.elements.default.weight,\n backgroundColor: theme.background.modal,\n },\n ]}\n >\n {/* One line, not wrapped: the verdict beside the label is what says the\n address is complete, so the field doesn't have to show all of it. */}\n <BottomSheetTextInput\n value={value}\n onChangeText={onChangeText}\n placeholder={label}\n placeholderTextColor={theme.content.elements.secondary}\n accessibilityLabel={label}\n autoCapitalize=\"none\"\n autoCorrect={false}\n spellCheck={false}\n style={[\n styles.input,\n theme.textVariants.bodyMedium,\n { color: theme.content.elements.primary },\n ]}\n />\n </Box>\n\n <Box flexDirection=\"row\" style={styles.buttonRow}>\n <Box style={styles.button}>\n <PillButton\n label={t('withdrawAddress.paste')}\n size=\"buttonMd\"\n variant={isEmpty ? 'primary' : 'secondary'}\n onPress={onPaste}\n disabled={isPasting}\n />\n </Box>\n <Box style={styles.button}>\n {isEmpty ? (\n onUseConnected ? (\n <PillButton\n label={t('withdrawAddress.useConnected')}\n size=\"buttonMd\"\n variant=\"secondary\"\n onPress={onUseConnected}\n />\n ) : null\n ) : (\n <PillButton\n label={t('withdrawAddress.clear')}\n size=\"buttonMd\"\n variant=\"secondary\"\n onPress={() => onChangeText('')}\n />\n )}\n </Box>\n </Box>\n\n {helperText ? (\n <Text\n variant=\"detail\"\n style={{\n color: errorText\n ? theme.content.elements.error\n : theme.content.elements.warning,\n }}\n >\n {helperText}\n </Text>\n ) : null}\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n root: { gap: 8 },\n header: { gap: 8 },\n label: { flexShrink: 1 },\n status: { gap: 4 },\n // The design's own asymmetry: the text is inset 16 and the (unused) trailing\n // slot 8, so the field's own padding is what centres the single line.\n field: { paddingLeft: 16, paddingRight: 8, justifyContent: 'center' },\n input: { padding: 0 },\n buttonRow: { gap: 10 },\n // Both halves keep their width whether or not the second one has a button, so\n // Paste doesn't stretch across the row when it stands alone.\n button: { flex: 1 },\n})\n", "import { USD_DECIMALS, percentOfAmount } from '@funkit/connect-core'\nimport { Pressable, StyleSheet, useWindowDimensions } from 'react-native'\nimport Animated, { Keyframe, LinearTransition } from 'react-native-reanimated'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nimport { AmountDisplay } from '../components/AmountDisplay'\nimport { NumPad } from '../components/NumPad'\nimport { PillButton } from '../components/PillButton'\nimport { TopBar } from '../components/TopBar'\nimport { WithdrawSourceCard } from '../components/WithdrawSourceCard'\nimport { FigmaSwapIcon } from '../icons/FigmaSystemIcons'\nimport { TokenChainIcon } from '../icons/TokenChainIcon'\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { chainIconUri } from '../utils/chainDisplay'\nimport { formatTokenAmount, groupThousands } from '../utils/formatAmount'\nimport { MOTION_DURATION, MOTION_EASING } from '../utils/motion'\nimport { applyNumpadKey } from '../utils/numpadInput'\n\nconst NUMPAD_BOTTOM_MARGIN = 25\nconst NUMPAD_MIN_BOTTOM_MARGIN = 40\n\nconst AnimatedBox = Animated.createAnimatedComponent(Box)\n\n// The card is what the button displaces, so it rides up with it instead of\n// jumping to the place the button leaves it.\nconst CARD_TRANSITION =\n LinearTransition.duration(MOTION_DURATION).easing(MOTION_EASING)\n// Continue rises out of the card's foot. Short, and fading as it goes: a full\n// travel would have it cross the keypad on the way in.\nconst BUTTON_TRAVEL = 24\nconst BUTTON_ENTERING = new Keyframe({\n 0: { opacity: 0, transform: [{ translateY: BUTTON_TRAVEL }] },\n 100: { opacity: 1, transform: [{ translateY: 0 }], easing: MOTION_EASING },\n}).duration(MOTION_DURATION)\nconst BUTTON_EXITING = new Keyframe({\n 0: { opacity: 1, transform: [{ translateY: 0 }] },\n 100: {\n opacity: 0,\n transform: [{ translateY: BUTTON_TRAVEL }],\n easing: MOTION_EASING,\n },\n}).duration(MOTION_DURATION)\n\nexport interface WithdrawAmountSource {\n /** The source as the host names it, e.g. `USDC (Perps)`. */\n label: string\n /** What the amount and the balance are denominated in, e.g. `USDG`. */\n symbol: string\n chainId: number\n /** Direct token logo URL; falls back to a CDN lookup by symbol. */\n iconSrc?: string\n}\n\nexport interface WithdrawAmountScreenProps {\n title: string\n /** The withdrawal amount, in source-token units. */\n amount: string\n /** Sets the amount outright, in source-token units (Use Max). */\n onChangeAmount: (amount: string) => void\n /**\n * The number in the amount display, which the numpad edits \u2014 dollars when\n * {@link inUsd}, else source-token units. Held by the caller so it survives\n * this screen leaving the stack.\n */\n input: string\n onChangeInput: (input: string) => void\n /** Whether the amount is being typed in dollars rather than token units. */\n inUsd: boolean\n /** The amount in dollars. `undefined` when nothing prices it. */\n usdLabel: string | undefined\n /** Switches denomination. `undefined` drops the swap entirely. */\n onSwapDenomination: (() => void) | undefined\n /** Fraction digits the source token carries; caps what the numpad accepts. */\n sourceDecimals?: number\n /** Spendable balance in source-token units. Omit to drop Use Max. */\n balance?: string\n /** What the withdrawal is drawn from. */\n source: WithdrawAmountSource\n /** Opens the source picker. Omit when the host offers a single source. */\n onPressSource?: () => void\n /** Replaces the converted amount and tints the amount. */\n errorText?: string\n canContinue: boolean\n onContinue: () => void\n onBack: () => void\n onClose: () => void\n}\n\n/**\n * Step one of the crypto withdrawal: how much, and what it comes out of. The\n * destination, the recipient, the fees and the signature are the step that\n * follows.\n *\n * The amount is driven by an in-app numpad rather than the system keyboard, so\n * the sheet never has to move out from under it.\n */\nexport function WithdrawAmountScreen({\n title,\n amount,\n onChangeAmount,\n input,\n onChangeInput,\n inUsd,\n usdLabel,\n onSwapDenomination,\n sourceDecimals,\n balance,\n source,\n onPressSource,\n errorText,\n canContinue,\n onContinue,\n onBack,\n onClose,\n}: WithdrawAmountScreenProps) {\n const { t } = useFunkitTranslation()\n const theme = useTheme()\n const { height } = useWindowDimensions()\n const insets = useSafeAreaInsets()\n\n // Use Max has nothing to take without a balance, and it gives way to Continue\n // as soon as there is an amount to submit.\n const showUseMax = input === '' && balance !== undefined\n\n // The same amount in the denomination not being typed in \u2014 falling back to\n // the token when nothing prices it, so the units are still named somewhere.\n // Display only \u2014 `amount` keeps every digit, so Use Max still spends the\n // whole balance rather than a truncated copy of it.\n const tokenLabel = `${formatTokenAmount(amount === '' ? '0' : amount)} ${source.symbol}`\n const convertedLabel = inUsd ? tokenLabel : (usdLabel ?? tokenLabel)\n // The error takes the line over, so the swap goes with the figure it labelled.\n const canSwap = !!onSwapDenomination && !errorText\n const convertedLine = (\n <Box flexDirection=\"row\" alignItems=\"center\" style={styles.convertedRow}>\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n // Without this the text can't shrink, so a long label overflows the row\n // and pushes the swap icon off screen instead of ellipsising.\n style={{\n flexShrink: 1,\n color: errorText\n ? theme.content.elements.error\n : theme.content.elements.secondary,\n }}\n >\n {errorText ?? convertedLabel}\n </Text>\n {canSwap ? (\n <FigmaSwapIcon size={16} color={theme.content.elements.secondary} />\n ) : null}\n </Box>\n )\n\n return (\n <Box\n style={{\n height,\n paddingTop: insets.top,\n backgroundColor: theme.background.modal,\n }}\n >\n <TopBar title={title} onBack={onBack} onClose={onClose} />\n <Box style={styles.amount}>\n <AmountDisplay\n value={groupThousands(input)}\n prefix={inUsd ? '$' : ''}\n hasError={!!errorText}\n accessibilityLabel={t('withdrawAmount.amountLabel')}\n />\n {/* The same money in the other denomination, and the control that\n switches to it. Inert without a rate to convert at. */}\n <Box style={styles.converted}>\n {canSwap ? (\n <Pressable\n onPress={onSwapDenomination}\n accessibilityRole=\"button\"\n accessibilityLabel={t('withdrawAmount.swapDenomination')}\n hitSlop={8}\n >\n {convertedLine}\n </Pressable>\n ) : (\n convertedLine\n )}\n </Box>\n </Box>\n\n {/* All the slack a taller device brings: the amount stays under the top\n bar and everything below stays pinned above the keypad. */}\n <Box flex={1} />\n\n <AnimatedBox layout={CARD_TRANSITION} style={styles.card}>\n <WithdrawSourceCard\n icon={\n <TokenChainIcon\n symbol={source.symbol}\n iconSrc={source.iconSrc}\n chainIconSrc={chainIconUri(source.chainId)}\n size={36}\n />\n }\n title={source.label}\n subtitle={\n balance ? `${groupThousands(balance)} ${source.symbol}` : undefined\n }\n useMaxLabel={t('withdrawAmount.useMax')}\n onUseMax={\n showUseMax && balance\n ? () =>\n onChangeAmount(percentOfAmount(balance, 100, sourceDecimals))\n : undefined\n }\n onPress={onPressSource}\n accessibilityLabel={t('withdrawCrypto.sendFrom')}\n attachedToButton={!showUseMax}\n />\n {/* The window the button travels through, and never the button: a view\n can't crop what it is carrying. It outlives the button so the way\n out is cropped as well as the way in, and closes to nothing on the\n same clock \u2014 which is also what walks the card back down. */}\n <AnimatedBox\n layout={CARD_TRANSITION}\n style={[styles.buttonClip, showUseMax ? null : styles.buttonSlot]}\n >\n {showUseMax ? null : (\n <AnimatedBox entering={BUTTON_ENTERING} exiting={BUTTON_EXITING}>\n <PillButton\n label={t('common.continue')}\n radius=\"element\"\n disabled={!canContinue}\n onPress={onContinue}\n />\n </AnimatedBox>\n )}\n </AnimatedBox>\n </AnimatedBox>\n\n <Box\n style={[\n styles.numpad,\n {\n marginBottom: Math.max(\n NUMPAD_BOTTOM_MARGIN + insets.bottom,\n NUMPAD_MIN_BOTTOM_MARGIN,\n ),\n },\n ]}\n >\n <NumPad\n backspaceAccessibilityLabel={t('withdrawAmount.delete')}\n // Dollars are typed to cents whatever the token's precision is.\n onPressKey={(key) =>\n onChangeInput(\n applyNumpadKey(input, key, inUsd ? USD_DECIMALS : sourceDecimals),\n )\n }\n />\n </Box>\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n amount: { alignItems: 'center', paddingTop: 78 },\n converted: { paddingTop: 32 },\n convertedRow: { gap: 6 },\n card: { marginHorizontal: 24 },\n buttonClip: { overflow: 'hidden' },\n buttonSlot: { marginTop: -19 },\n numpad: {\n marginHorizontal: 64,\n marginTop: 19,\n height: 240,\n minHeight: 176,\n flexShrink: 1,\n },\n})\n", "import { useMemo } from 'react'\nimport { StyleSheet, useWindowDimensions } from 'react-native'\nimport Animated, {\n Keyframe,\n LinearTransition,\n useAnimatedStyle,\n withTiming,\n} from 'react-native-reanimated'\n\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { type AmountGlyphKind, amountGlyphs } from '../utils/amountGlyphs'\nimport { MOTION_DURATION, MOTION_EASING } from '../utils/motion'\n\n// Figma's amount type; `font/*` has no step this large. The placeholder's 20%\n// is the design's own value, not `opacity/disabled` (40).\nconst AMOUNT_FONT_SIZE = 96\nconst PLACEHOLDER_OPACITY = 0.2\n// Ratios, so a fitted amount scales its line box and tracking too. The box must\n// stay above the font's natural ~1.16em \u2014 iOS honours a shorter one by\n// compressing the line and clipping the glyphs.\nconst LINE_HEIGHT_RATIO = 1.25\nconst LETTER_SPACING_RATIO = -1.44 / 96\n// The design trims to the cap box (68 at 96), which RN can't do \u2014 it lays out\n// the line box. A negative margin takes that dead space back instead, so the\n// glyphs overhang empty gaps rather than being clipped by their parent.\nconst CAP_BOX_RATIO = 68 / 96\n// One character's advance, as a share of its size. The fit is computed from it\n// because `adjustsFontSizeToFit` also reads the frame's *height*, collapsing\n// the number whenever its row is shorter than the line box.\nconst CHARACTER_ADVANCE_RATIO = 0.6\nconst HORIZONTAL_INSET = 16\n// Below this the amount is unreadable anyway, so a long entry runs to the edges.\nconst MIN_FONT_SIZE = 40\n\nconst AnimatedBox = Animated.createAnimatedComponent(Box)\nconst AnimatedText = Animated.createAnimatedComponent(Text)\n\n// A character arriving or leaving re-centres the number, so the ones staying\n// slide to their new place rather than cutting to it.\nconst GLYPH_LAYOUT =\n LinearTransition.duration(MOTION_DURATION).easing(MOTION_EASING)\n\nexport interface AmountDisplayProps {\n /** The typed amount, or `''` for the placeholder. */\n value: string\n /** Written before the number. */\n prefix?: string\n /** Tints the amount, matching the message that replaces the balance line. */\n hasError?: boolean\n accessibilityLabel: string\n}\n\n/**\n * The withdrawal amount, read-only and driven by the numpad \u2014 it looks like a\n * field but isn't one, so tapping it must not open a keyboard.\n *\n * Each character is its own node so it can move on its own: digits rise into the\n * number and drop back out, while the placeholder lifts off the top instead.\n */\nexport function AmountDisplay({\n value,\n prefix = '$',\n hasError = false,\n accessibilityLabel,\n}: AmountDisplayProps) {\n const theme = useTheme()\n const { width } = useWindowDimensions()\n const isEmpty = value === ''\n const glyphs = amountGlyphs(value, prefix)\n const text = glyphs.map((glyph) => glyph.char).join('')\n const fontSize = fitAmountFontSize(text, width - HORIZONTAL_INSET * 2)\n const overhang = (fontSize * (LINE_HEIGHT_RATIO - CAP_BOX_RATIO)) / 2\n\n const lineHeight = fontSize * LINE_HEIGHT_RATIO\n // A whole line box of travel, so a character is clear of the row before it is\n // dropped.\n const slides = useMemo(\n () => ({\n below: slideKeyframes(lineHeight),\n above: slideKeyframes(-lineHeight),\n }),\n [lineHeight],\n )\n\n // The prefix outlives both the placeholder and the digits, so it can only be\n // dimmed by fading with them, not by mounting.\n const prefixDimming = useAnimatedStyle(() => {\n // Spelled out because the plugin workletizes by the hook's name, and esbuild\n // renames this one (`useAnimatedStyle2`) in the bundle.\n 'worklet'\n return {\n opacity: withTiming(isEmpty ? PLACEHOLDER_OPACITY : 1, {\n duration: MOTION_DURATION,\n easing: MOTION_EASING,\n }),\n }\n })\n\n return (\n // The window the characters slide through. What it clips is the dead space\n // the margin takes back, never the glyphs.\n <Box\n accessible\n accessibilityLabel={accessibilityLabel}\n accessibilityValue={{ text }}\n style={[styles.row, { marginVertical: -overhang }]}\n >\n {glyphs.map(({ key, char, kind }) => (\n <AnimatedBox\n key={key}\n entering={slides[glyphSide(kind, isEmpty)].entering}\n exiting={slides[glyphSide(kind, isEmpty)].exiting}\n layout={GLYPH_LAYOUT}\n >\n {/* The fade rides on the text, not on the box: one view driving both\n an animated style and a layout animation breaks reanimated. */}\n <AnimatedText\n weight=\"medium\"\n numberOfLines={1}\n style={[\n {\n fontSize,\n lineHeight,\n letterSpacing: fontSize * LETTER_SPACING_RATIO,\n color: hasError\n ? theme.content.elements.error\n : theme.content.elements.primary,\n opacity: kind === 'placeholder' ? PLACEHOLDER_OPACITY : 1,\n },\n kind === 'prefix' ? prefixDimming : null,\n ]}\n >\n {char}\n </AnimatedText>\n </AnimatedBox>\n ))}\n </Box>\n )\n}\n\n/**\n * Which side of the row a character comes from and goes back to. The prefix\n * travels with whatever it stands next to, so the pair never crosses.\n */\nfunction glyphSide(kind: AmountGlyphKind, isEmpty: boolean) {\n if (kind === 'placeholder') {\n return 'above'\n }\n if (kind === 'prefix' && isEmpty) {\n return 'above'\n }\n return 'below'\n}\n\n/** Enters from `offset` and leaves back to it \u2014 a negative one runs upwards. */\nfunction slideKeyframes(offset: number) {\n return {\n entering: new Keyframe({\n 0: { transform: [{ translateY: offset }] },\n 100: { transform: [{ translateY: 0 }], easing: MOTION_EASING },\n }).duration(MOTION_DURATION),\n exiting: new Keyframe({\n 0: { transform: [{ translateY: 0 }] },\n 100: { transform: [{ translateY: offset }], easing: MOTION_EASING },\n }).duration(MOTION_DURATION),\n }\n}\n\n/** The largest size that keeps `text` on one line within `available`. */\nfunction fitAmountFontSize(text: string, available: number) {\n const fitted = available / (text.length * CHARACTER_ADVANCE_RATIO)\n return Math.max(MIN_FONT_SIZE, Math.min(AMOUNT_FONT_SIZE, fitted))\n}\n\nconst styles = StyleSheet.create({\n row: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignSelf: 'stretch',\n overflow: 'hidden',\n },\n})\n", "/** What a character in the amount is, which is what decides how it moves. */\nexport type AmountGlyphKind = 'prefix' | 'placeholder' | 'digit'\n\nexport interface AmountGlyph {\n /** Identity across renders: what mounts is what animates in. */\n key: string\n char: string\n kind: AmountGlyphKind\n}\n\n/**\n * The amount split into the characters that animate independently. Digits are\n * keyed from the left, so appending or deleting at the right mounts or unmounts\n * exactly that character and an inserted separator shifts the rest along.\n */\nexport function amountGlyphs(value: string, prefix: string): AmountGlyph[] {\n const glyphs: AmountGlyph[] = []\n if (prefix) {\n glyphs.push({ key: 'prefix', char: prefix, kind: 'prefix' })\n }\n\n // Its own identity, not the digit zero, so typing over it unmounts it rather\n // than reading as a `0` that turned into a `1`.\n if (value === '') {\n glyphs.push({ key: 'placeholder', char: '0', kind: 'placeholder' })\n return glyphs\n }\n\n for (const [index, char] of [...value].entries()) {\n glyphs.push({ key: `digit-${index}`, char, kind: 'digit' })\n }\n return glyphs\n}\n", "import { Easing } from 'react-native-reanimated'\n\n// One clock for the amount screen: fast enough that a quick run on the numpad\n// never leaves glyphs queued mid-slide, slow enough to read as a slide.\nexport const MOTION_DURATION = 180\nexport const MOTION_EASING = Easing.bezier(0.33, 1, 0.68, 1)\n", "import { Pressable, StyleSheet } from 'react-native'\n\nimport { useHapticFeedback } from '../haptics/HapticsContext'\nimport { FigmaChevronLeftIcon } from '../icons/FigmaSystemIcons'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport type { NumpadKey } from '../utils/numpadInput'\n\n// Shared with the delete glyph, which sizes to the digits.\nconst KEY_FONT_SIZE = 24\n\n// The design sets the outer columns against the keypad's edges. The touch\n// target is still the whole share.\nconst COLUMN_ALIGNMENT = ['flex-start', 'center', 'flex-end'] as const\n\nconst ROWS: NumpadKey[][] = [\n ['1', '2', '3'],\n ['4', '5', '6'],\n ['7', '8', '9'],\n ['.', '0', 'backspace'],\n]\n\nexport interface NumPadProps {\n onPressKey: (key: NumpadKey) => void\n /** The delete key carries a glyph, so its label can't come from the key. */\n backspaceAccessibilityLabel: string\n}\n\n/**\n * The withdrawal amount keypad. Both dimensions come from the container, so\n * the keys grow with the device rather than leaving a void above them.\n *\n * Emits keys rather than a value: `applyNumpadKey` owns the grammar.\n */\nexport function NumPad({\n onPressKey,\n backspaceAccessibilityLabel,\n}: NumPadProps) {\n const theme = useTheme()\n const haptic = useHapticFeedback()\n\n return (\n <Box flex={1}>\n {ROWS.map((row) => (\n <Box key={row.join('')} flexDirection=\"row\" flex={1}>\n {row.map((key, column) => (\n <Pressable\n key={key}\n onPress={() => {\n // Before the handler: the tap should land with the finger, not\n // after whatever the amount change costs.\n haptic()\n onPressKey(key)\n }}\n accessibilityRole=\"button\"\n accessibilityLabel={\n key === 'backspace' ? backspaceAccessibilityLabel : key\n }\n style={[styles.key, { alignItems: COLUMN_ALIGNMENT[column] }]}\n >\n {key === 'backspace' ? (\n <FigmaChevronLeftIcon\n size={KEY_FONT_SIZE}\n color={theme.content.elements.primary}\n />\n ) : (\n <Text\n weight=\"medium\"\n style={[\n styles.label,\n key === '.' ? styles.decimalLabel : null,\n ]}\n >\n {key}\n </Text>\n )}\n </Pressable>\n ))}\n </Box>\n ))}\n </Box>\n )\n}\n\nconst styles = StyleSheet.create({\n key: { flex: 1, justifyContent: 'center' },\n label: {\n fontSize: KEY_FONT_SIZE,\n minWidth: KEY_FONT_SIZE,\n lineHeight: 32,\n letterSpacing: -0.36,\n textAlign: 'center',\n },\n decimalLabel: {\n fontSize: 48,\n lineHeight: 56,\n transform: [{ translateY: -14 }],\n },\n})\n", "import { type ReactNode, createContext, useCallback, useContext } from 'react'\n\nimport { hapticTap } from './hapticTap'\nimport { logger } from '../logging/logger'\n\n/**\n * A short tactile tap confirming a discrete input, such as a keypad press.\n *\n * Taps are part of the design rather than a garnish, so the SDK provides them\n * itself from the optional `react-native-haptic-feedback` peer \u2014 see\n * {@link hapticTap}. Hosts on another module (`expo-haptics` in Expo Go), or\n * wanting silence, pass their own through `FunkitProvider`.\n */\nexport type HapticFeedback = () => void | Promise<void>\n\nconst HapticsContext = createContext<HapticFeedback>(hapticTap)\n\nexport function FunkitHapticsProvider({\n hapticFeedback = hapticTap,\n children,\n}: {\n hapticFeedback?: HapticFeedback\n children: ReactNode\n}) {\n return (\n <HapticsContext.Provider value={hapticFeedback}>\n {children}\n </HapticsContext.Provider>\n )\n}\n\n// A misconfigured host would otherwise warn on every single key. The tap is\n// cosmetic, so saying it once is enough to debug it.\nlet hasWarned = false\n\n/**\n * Fire-and-forget haptics. A host's native module must never take a keypress\n * down with it, so a throw or a rejection is swallowed \u2014 the key still registers\n * and the amount still changes.\n */\nexport function useHapticFeedback(): () => void {\n const haptic = useContext(HapticsContext)\n\n return useCallback(() => {\n const warn = (error: unknown) => {\n if (hasWarned) {\n return\n }\n hasWarned = true\n logger.warn('connect-rn: haptic feedback failed; taps will be silent', {\n error: error instanceof Error ? error.message : String(error),\n })\n }\n try {\n Promise.resolve(haptic()).catch(warn)\n } catch (error) {\n warn(error)\n }\n }, [haptic])\n}\n", "import { logger } from '../logging/logger'\n\n/**\n * Resolved once, on the first tap: the peer's tap, or `null` when it isn't\n * installed. Either way the answer is reused, so a host without it doesn't\n * retry a failing import on every keypress.\n */\nlet loading: Promise<(() => void) | null> | undefined\n\n/**\n * Default haptics: lazily loads the optional `react-native-haptic-feedback`\n * peer and taps through it. A host without it taps silently; one that wants a\n * different module passes it to `FunkitProvider` as `hapticFeedback` instead \u2014\n * which is what an Expo Go app does, since it can only link Expo's own modules.\n *\n * The import is dynamic and inside a `try`, which is what makes the peer\n * genuinely optional: Metro marks a dependency optional when its import can\n * reject, and skips it at resolution rather than failing the bundle. It also\n * keeps the native module unevaluated until a tap actually happens.\n */\nexport async function hapticTap(): Promise<void> {\n loading ??= loadTap()\n const tap = await loading\n tap?.()\n}\n\nasync function loadTap(): Promise<(() => void) | null> {\n try {\n const { trigger } = await import('react-native-haptic-feedback')\n // `impactLight`: the design taps to confirm a digit landed, not to mark an\n // event. Options left at their defaults \u2014 no vibrate fallback on hardware\n // without a taptic engine, and Android's system haptics setting respected.\n return () => trigger('impactLight')\n } catch (error) {\n // Not a failure \u2014 the peer is optional, and a silent keypad is a working\n // keypad. Said once, so a host that meant to have taps can find out why.\n logger.info(\n 'connect-rn: taps are silent \u2014 install react-native-haptic-feedback, ' +\n 'or pass FunkitProvider `hapticFeedback` to use your own haptics ' +\n 'module (e.g. expo-haptics in Expo Go).',\n { error: error instanceof Error ? error.message : String(error) },\n )\n return null\n }\n}\n", "import type { ReactNode } from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\nimport Animated, { LinearTransition } from 'react-native-reanimated'\n\nimport { FigmaChevronRightIcon } from '../icons/FigmaSystemIcons'\nimport { Box, Text, useTheme } from '../theme/restyle'\nimport { MOTION_DURATION, MOTION_EASING } from '../utils/motion'\n\nconst AnimatedBox = Animated.createAnimatedComponent(Box)\n\n// The foot grows to seat the button that overlaps it, so it has to grow with\n// that button's entrance rather than pop out from under it.\nconst FOOT_TRANSITION =\n LinearTransition.duration(MOTION_DURATION).easing(MOTION_EASING)\n\n// The card's own inset, and the foot it grows when the Continue button overlaps\n// it \u2014 40 of padding under 19 of button, leaving the design's 21pt gap.\nconst HORIZONTAL_PADDING = 12\nconst VERTICAL_PADDING = 13\nconst ATTACHED_BOTTOM_PADDING = 40\n\nexport interface WithdrawSourceCardProps {\n /** The 36px token-on-chain avatar. */\n icon: ReactNode\n /** The source as the host names it, e.g. `USDC (Perps)`. */\n title: string\n /** The spendable balance, already grouped and denominated. */\n subtitle?: string\n useMaxLabel: string\n /** Omitted once an amount is typed, or when no balance is known. */\n onUseMax?: () => void\n /** Omitted when the host offers a single source \u2014 nothing to pick. */\n onPress?: () => void\n accessibilityLabel: string\n /** Squares the foot of the card off for the button that overlaps it. */\n attachedToButton?: boolean\n}\n\n/**\n * What the withdrawal is drawn from, sitting above the keypad: the source\n * token, its balance, and the shortcut that spends all of it.\n */\nexport function WithdrawSourceCard({\n icon,\n title,\n subtitle,\n useMaxLabel,\n onUseMax,\n onPress,\n accessibilityLabel,\n attachedToButton = false,\n}: WithdrawSourceCardProps) {\n const theme = useTheme()\n\n const card = (\n <AnimatedBox\n flexDirection=\"row\"\n alignItems=\"center\"\n layout={FOOT_TRANSITION}\n style={[\n styles.card,\n {\n backgroundColor: theme.background.secondary,\n borderTopLeftRadius: theme.borderRadii.element,\n borderTopRightRadius: theme.borderRadii.element,\n borderBottomLeftRadius: attachedToButton\n ? 0\n : theme.borderRadii.element,\n borderBottomRightRadius: attachedToButton\n ? 0\n : theme.borderRadii.element,\n paddingBottom: attachedToButton\n ? ATTACHED_BOTTOM_PADDING\n : VERTICAL_PADDING,\n },\n ]}\n >\n <Box\n flex={1}\n flexDirection=\"row\"\n alignItems=\"center\"\n style={styles.token}\n >\n {icon}\n <Box flex={1} style={styles.details}>\n <Text variant=\"bodyMedium\" numberOfLines={1}>\n {title}\n </Text>\n {subtitle ? (\n <Text\n variant=\"detail\"\n numberOfLines={1}\n style={{ color: theme.content.elements.secondary }}\n >\n {subtitle}\n </Text>\n ) : null}\n </Box>\n </Box>\n {onUseMax ? (\n <Pressable\n onPress={onUseMax}\n accessibilityRole=\"button\"\n accessibilityLabel={useMaxLabel}\n >\n {/* Filled from the border token, as the design has it: no button\n surface carries a fill that reads against the card. */}\n <Box\n borderRadius=\"button\"\n alignItems=\"center\"\n justifyContent=\"center\"\n style={[\n styles.useMax,\n {\n height: theme.sizes.buttonXs,\n backgroundColor: theme.border.elements.default.color,\n },\n ]}\n >\n <Text\n variant=\"bodyMedium\"\n numberOfLines={1}\n style={{ color: theme.content.button.secondary.default }}\n >\n {useMaxLabel}\n </Text>\n </Box>\n </Pressable>\n ) : null}\n {onPress ? (\n <FigmaChevronRightIcon\n size={16}\n color={theme.content.elements.secondary}\n />\n ) : null}\n </AnimatedBox>\n )\n\n if (!onPress) {\n return card\n }\n\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n >\n {card}\n </Pressable>\n )\n}\n\nconst styles = StyleSheet.create({\n card: {\n gap: 8,\n paddingHorizontal: HORIZONTAL_PADDING,\n paddingTop: VERTICAL_PADDING,\n },\n token: { gap: 10 },\n details: { gap: 2 },\n useMax: { paddingHorizontal: 16 },\n})\n", "// The amount screen drives its value from an in-app numpad rather than a text\n// input, so every edit is one keypress and the whole grammar lives here.\n\nexport type NumpadDigit =\n | '0'\n | '1'\n | '2'\n | '3'\n | '4'\n | '5'\n | '6'\n | '7'\n | '8'\n | '9'\n\nexport type NumpadKey = NumpadDigit | '.' | 'backspace'\n\nconst DECIMAL_POINT = '.'\n\n/**\n * The typed amount after one keypress, as a decimal string.\n *\n * - A lone `.` is not a number any parser accepts, so the leading zero is\n * written for the user; a second point, and any point at all on a 0-decimal\n * token, is refused rather than swallowed later.\n * - `0` is a placeholder rather than a leading digit, so typing `5` gives `5`.\n * - Fraction digits stop at the token's `decimals`: past that the input is dust\n * the transfer can't carry, and it would silently truncate at signing time.\n */\nexport function applyNumpadKey(\n value: string,\n key: NumpadKey,\n maxDecimals?: number,\n): string {\n if (key === 'backspace') {\n return value.slice(0, -1)\n }\n\n if (key === DECIMAL_POINT) {\n if (value.includes(DECIMAL_POINT) || maxDecimals === 0) {\n return value\n }\n return value === '' ? `0${DECIMAL_POINT}` : `${value}${DECIMAL_POINT}`\n }\n\n const fraction = value.split(DECIMAL_POINT)[1]\n if (\n fraction !== undefined &&\n maxDecimals !== undefined &&\n fraction.length >= maxDecimals\n ) {\n return value\n }\n\n if (value === '0') {\n return key === '0' ? value : key\n }\n return `${value}${key}`\n}\n", "import type { TFunction } from 'i18next'\n\nimport { useFunkitTranslation } from '../providers/FunkitI18nProvider'\nimport {\n type PaymentMethodOption,\n SelectMethodScreen,\n} from './SelectMethodScreen'\n\nexport interface WithdrawMethodScreenProps {\n /** Cash payout methods (Card / Bank Transfer / \u2026). */\n methods: PaymentMethodOption[]\n onSelectMethod: (id: string) => void\n /** Sheet title \u2014 the flow resolves it from the host config. */\n title: string\n loading?: boolean\n /** The payout-method fetch failed \u2014 shows the retryable error state. */\n hasError?: boolean\n onRetry?: () => void\n /**\n * Withdrawals unavailable (Statsig gate off, or Swapped returned no methods\n * for the user's region) \u2014 shows a terminal, non-retryable message.\n */\n isEmpty?: boolean\n /**\n * The balance can't meet Swapped's minimum sell \u2014 shows a distinct terminal\n * message instead of methods that would all reject.\n */\n isBelowMinimum?: boolean\n /** Why the cash rails are missing (web's `NoCashMethodsNote`). */\n note?: string\n}\n\n// Below-minimum wins over empty \u2014 a too-low balance is the more specific reason.\nfunction getTerminalError(\n t: TFunction,\n isBelowMinimum: boolean,\n isEmpty: boolean,\n) {\n if (isBelowMinimum) {\n return {\n title: t('withdraw.belowMinimumTitle'),\n message: t('withdraw.belowMinimumMessage'),\n }\n }\n if (isEmpty) {\n return {\n title: t('withdraw.unavailableTitle'),\n message: t('withdraw.unavailableMessage'),\n }\n }\n return null\n}\n\n/**\n * The withdrawal payout-method picker: the entry screen of `beginWithdrawal`,\n * listing the Swapped `CRYPTO_TO_FIAT` methods. A thin composition over\n * {@link SelectMethodScreen} (no receive-token dropdown \u2192 the bare-list layout),\n * so the list/loading/error visuals stay in lockstep with the deposit flow.\n */\nexport function WithdrawMethodScreen(props: WithdrawMethodScreenProps) {\n const { t } = useFunkitTranslation()\n const {\n methods,\n onSelectMethod,\n title,\n loading = false,\n hasError = false,\n onRetry,\n isEmpty = false,\n isBelowMinimum = false,\n note,\n } = props\n // Fetch errors and loading win over terminal states \u2014 a failed fetch says\n // nothing about availability or balance, and retrying may recover it.\n const terminalError = getTerminalError(t, isBelowMinimum, isEmpty)\n if (terminalError && !hasError && !loading) {\n return (\n <SelectMethodScreen\n title={title}\n methods={[]}\n onSelectMethod={onSelectMethod}\n error\n errorTitle={terminalError.title}\n errorMessage={terminalError.message}\n />\n )\n }\n return (\n <SelectMethodScreen\n title={title}\n methods={methods}\n onSelectMethod={onSelectMethod}\n loading={loading}\n error={hasError}\n onRetry={onRetry}\n errorTitle={t('selectMethod.errorTitle')}\n errorMessage={t('selectMethod.errorMessage')}\n note={note}\n />\n )\n}\n", "import {\n type SwappedInboundMessage,\n type SwappedSellOrderData,\n isValidOrderData,\n} from '@funkit/connect-core'\nimport { useCallback } from 'react'\n\nimport { logger } from '../logging/logger'\nimport {\n type SwappedScreenBaseProps,\n SwappedScreenShell,\n} from './SwappedScreenShell'\n\nexport interface SwappedWithdrawScreenProps extends SwappedScreenBaseProps {\n /** \"Make another withdrawal\" \u2014 back to the method list. */\n onNewWithdrawal?: () => void\n /** Swapped confirmed the fiat payout side. Payload is opaque. */\n onWithdrawalSuccess?: (data?: unknown) => void\n /** Sell order (deposit address + accepted-token amount). Only validated payloads forward. */\n onOrderData?: (order: SwappedSellOrderData) => void\n}\n\n/**\n * Withdrawal-mode host for the Swapped embed (mirroring web's\n * `WithdrawalSwappedIframeController`): back \u2192 {@link onBack},\n * close \u2192 {@link onClose}, new-withdrawal \u2192 {@link onNewWithdrawal},\n * withdrawal-successful \u2192 {@link onWithdrawalSuccess}, order-data \u2192\n * {@link onOrderData}. Deposit-only messages are ignored \u2014 see\n * `SwappedScreen`.\n */\nexport function SwappedWithdrawScreen({\n url,\n onClose,\n onBack,\n onNewWithdrawal,\n onWithdrawalSuccess,\n onOrderData,\n}: SwappedWithdrawScreenProps) {\n const handleMessage = useCallback(\n (msg: SwappedInboundMessage) => {\n switch (msg.type) {\n case 'SWAPPED_GO_BACK':\n logger.info('connect-rn:swapped:back')\n onBack()\n break\n case 'SWAPPED_CLOSE':\n logger.info('connect-rn:swapped:exit')\n onClose()\n break\n case 'SWAPPED_NEW_WITHDRAWAL':\n logger.info('connect-rn:swapped:new_withdrawal')\n onNewWithdrawal?.()\n break\n case 'SWAPPED_WITHDRAWAL_SUCCESSFUL':\n // No auto-close: the embed shows its own success screen with\n // new-withdrawal/close controls (web parity).\n logger.info('connect-rn:swapped:withdrawal_successful')\n onWithdrawalSuccess?.(msg.data)\n break\n case 'SWAPPED_ORDER_DATA':\n if (!isValidOrderData(msg.data)) {\n // Validation rejection, not an unrecoverable failure (WARN \u2014 the\n // embed keeps its own UI in control).\n logger.warn('connect-rn:swapped:order_data:invalid', {\n data: msg.data ?? {},\n })\n break\n }\n logger.info('connect-rn:swapped:order_data', {\n order_id: msg.data.order_id,\n })\n onOrderData?.(msg.data)\n break\n default:\n // READY / NAVIGATION / LOGOUT / ERROR handled in the shell or\n // tracked elsewhere; deposit-only messages (new-deposit,\n // transaction-successful) belong to SwappedScreen.\n break\n }\n },\n [onBack, onClose, onNewWithdrawal, onWithdrawalSuccess, onOrderData],\n )\n\n return <SwappedScreenShell url={url} onMessage={handleMessage} />\n}\n", "import {\n RailConfigType,\n type SwappedFormOfPayment,\n getFops,\n} from '@funkit/api-base'\nimport {\n DEFAULT_FIAT_CURRENCY,\n FOPS_STALE_TIME,\n type SwappedWithdrawalLegs,\n buildSwappedSellLimits,\n buildSwappedThirdPartyPaymentConfigs,\n findSwappedSourceOverride,\n getExchangeRate,\n getSwappedCashMinUsd,\n getSwappedSellCapEur,\n resolveSwappedWithdrawalLegs,\n sortFops,\n useSwappedDefaultCurrencyQuery,\n} from '@funkit/connect-core'\nimport { useDynamicConfig } from '../../statsig/useDynamicConfig'\nimport { useTheme } from '@shopify/restyle'\nimport { useStatsigClient } from '@statsig/react-bindings'\nimport { useQuery } from '@tanstack/react-query'\nimport { useMemo } from 'react'\n\nimport type {\n WithdrawalFlowConfig,\n WithdrawalToken,\n} from '../../flow/withdrawalFlowConfig'\nimport { useUserIpInfo } from '../../geo/useUserIpInfo'\nimport { useFunkitIdentity } from '../../identity/IdentityContext'\nimport { logger } from '../../logging/logger'\nimport { buildSwappedThemeQueryParamsRN } from '../../swapped/buildSwappedTheme'\nimport type { FunkitTheme } from '../../theme/toRestyleTheme'\nimport { useFiatExchangeRates } from './useFiatExchangeRates'\n\n/** Base react-query key for the withdrawal `/fops` query \u2014 shared with the\n * flow's invalidation so the two can't drift. */\nexport const WITHDRAW_FOPS_QUERY_KEY = 'withdrawFops'\n\nexport interface UseWithdrawalFopsParams {\n config: WithdrawalFlowConfig\n enabled?: boolean\n}\n\nexport interface UseWithdrawalFopsResult {\n /**\n * Generic cash payout methods (Card / Bank Transfer / \u2026). Saved FOPs are not\n * supported for withdrawals (web parity) and are never returned.\n */\n fops: SwappedFormOfPayment[]\n isLoading: boolean\n isError: boolean\n /**\n * True only once we KNOW there's nothing to show (gate off, or a settled\n * fetch returned zero) \u2014 never during a load, so the non-retryable\n * \"unavailable\" screen can't flash.\n */\n noPaymentMethodsAvailable: boolean\n /** Source balance can't clear Swapped's \u20AC7 minimum sell (cash impossible). */\n isBelowMinimumBalance: boolean\n refetch: () => void\n /** Whether the Statsig `enableswappedwithdrawal` gate is on for this apiKey. */\n isWithdrawalEnabled: boolean\n /** Resolved source\u2192accepted-token route, shared by the fops fetch and quote. */\n route: SwappedWithdrawalLegs\n}\n\n// \u2500\u2500 Step: resolve the withdrawal route \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Resolve the on-chain route legs (source the user sells \u2192 the token Swapped\n * accepts), applying the Statsig `swappedwithdrawalsourceoverrides` rule.\n * Memoized so the returned object stays referentially stable for the downstream\n * execution `useCallback`.\n */\nfunction useWithdrawalRoute(\n config: WithdrawalFlowConfig,\n): SwappedWithdrawalLegs {\n const sourceOverrides = useDynamicConfig('swappedwithdrawalsourceoverrides')\n return useMemo(\n () =>\n resolveSwappedWithdrawalLegs({\n source: config.sourceToken,\n target: config.swappedAcceptedToken,\n override: findSwappedSourceOverride(sourceOverrides, {\n chainId: config.sourceToken.chainId,\n tokenAddress: config.sourceToken.address,\n }),\n }),\n [config.sourceToken, config.swappedAcceptedToken, sourceOverrides],\n )\n}\n\n// \u2500\u2500 Step: source balance \u2192 EUR sell cap \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\ninterface WithdrawalSellCap {\n /** Host balance in USD (0 when none is configured or it hasn't resolved). */\n usdBalance: number\n /** Floored EUR cap forwarded to Swapped, or undefined when uncapped. */\n eurMax: number | undefined\n /** Balance can't clear Swapped's EUR minimum \u2192 cash methods are impossible. */\n isBelowMinimumBalance: boolean\n /** A cap is still resolving \u2014 hold /fops so its first request isn't uncapped. */\n isAwaitingCap: boolean\n}\n\n/**\n * Resolve the host's USD balance and derive the EUR sell cap (web parity:\n * `WithdrawalMethodSelect`). A callback balance (e.g. an on-chain `balanceOf`)\n * is fetched via query; a plain number is used as-is.\n */\nfunction useWithdrawalSellCap(\n config: WithdrawalFlowConfig,\n walletAddress: string,\n): WithdrawalSellCap {\n const { sourceUsdBalance } = config\n const isBalanceCallback = typeof sourceUsdBalance === 'function'\n const hasBalanceInfo = sourceUsdBalance != null\n\n const balanceQuery = useQuery({\n queryKey: [\n 'withdrawSourceUsdBalance',\n walletAddress,\n config.sourceToken.chainId,\n config.sourceToken.address,\n ] as const,\n queryFn: async () => {\n const value = isBalanceCallback ? await sourceUsdBalance() : 0\n return Number.isFinite(value) && value > 0 ? value : 0\n },\n enabled: isBalanceCallback && !!walletAddress && walletAddress !== '0x',\n staleTime: 30_000,\n refetchOnWindowFocus: false,\n })\n const isLoadingBalance = isBalanceCallback && balanceQuery.isLoading\n // Sanitize both paths \u2014 the callback result is already clamped in its queryFn,\n // but a host could also pass a negative / NaN plain number.\n const rawUsdBalance = isBalanceCallback\n ? (balanceQuery.data ?? 0)\n : (sourceUsdBalance ?? 0)\n const usdBalance =\n Number.isFinite(rawUsdBalance) && rawUsdBalance > 0 ? rawUsdBalance : 0\n\n // markup 0 so the cap reflects the true balance (not an inflated +5%); floor\n // it so the sell never exceeds what the user holds and the fops query key\n // stays stable against sub-unit balance jitter (web parity).\n //\n // Enabled on `hasBalanceInfo` (not `usdBalance > 0`) so the keyless rates\n // table fetches in parallel with the balance callback instead of waiting for\n // it \u2014 `isAwaitingCap` still holds /fops until both resolve.\n const { data: exchangeRates, isLoading: isLoadingRates } =\n useFiatExchangeRates(hasBalanceInfo)\n const eurRate = getExchangeRate('EUR', exchangeRates, 0)\n const eurMax = getSwappedSellCapEur(usdBalance, eurRate)\n\n const cashMinUsd = getSwappedCashMinUsd(eurRate)\n const isBelowMinimumBalance =\n hasBalanceInfo &&\n !isLoadingBalance &&\n cashMinUsd != null &&\n usdBalance < cashMinUsd\n\n const isAwaitingCap =\n hasBalanceInfo && (isLoadingBalance || (usdBalance > 0 && isLoadingRates))\n\n return { usdBalance, eurMax, isBelowMinimumBalance, isAwaitingCap }\n}\n\n// \u2500\u2500 Step: the /fops request \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\ninterface FetchWithdrawalFopsArgs {\n apiKey: string\n userId: string\n walletAddress: string\n countryCode: string\n swappedCurrencyCode: string\n fopPriority: Parameters<typeof sortFops>[1]\n themeConfig: ReturnType<typeof buildSwappedThemeQueryParamsRN>\n route: SwappedWithdrawalLegs\n eurMax: number | undefined\n usdBalance: number\n /** The user's raw source token \u2014 for the route-decision log only. */\n sourceToken: WithdrawalToken\n /** Host-supplied email prefilled into the Swapped payout widget, if any. */\n prefillFiatEmail: string | undefined\n}\n\n/**\n * Fetch + sort the Swapped `CRYPTO_TO_FIAT` payout methods for the accepted\n * token. The rail's `sourceToken` is the resolved ACCEPTED token (not the\n * user's raw source) \u2014 mirroring web, where the override/config target feeds\n * the `/fops` rail. `recipientAddress`/`destinationToken` are schema-required\n * but ignored for off-ramp; the wallet address fills the former.\n */\nasync function fetchWithdrawalFops({\n apiKey,\n userId,\n walletAddress,\n countryCode,\n swappedCurrencyCode,\n fopPriority,\n themeConfig,\n route,\n eurMax,\n usdBalance,\n sourceToken,\n prefillFiatEmail,\n}: FetchWithdrawalFopsArgs): Promise<SwappedFormOfPayment[]> {\n const acceptedToken = {\n chainId: route.targetChainId,\n address: route.targetTokenAddress,\n }\n\n // Decision point: which accepted-token rail we request the methods for, and\n // why (Statsig source override vs configured/source token). Logged at fetch\n // time so sessions that list methods but never place an order still record\n // how the route was chosen (web parity: `withdraw-fops`).\n logger.info('connect-rn:withdrawFops:source_override', {\n overrideApplied: route.overrideApplied,\n sourceChainId: sourceToken.chainId,\n sourceTokenAddress: sourceToken.address,\n acceptedChainId: route.targetChainId,\n acceptedTokenAddress: route.targetTokenAddress,\n acceptedTokenSymbol: route.targetTokenSymbol,\n })\n\n // Decision point: whether the balance-derived EUR cap is forwarded as the\n // sell limit or suppressed (at/below the minimum \u2014 a contradictory range).\n const sellLimits = buildSwappedSellLimits(eurMax)\n logger.info('connect-rn:withdrawFops:sellLimits', {\n defaultMinAmount: sellLimits.defaultMinAmount,\n usdBalance,\n eurMax,\n capForwarded: sellLimits.defaultMaxAmount != null,\n })\n\n const response = await getFops({\n apiKey,\n logger,\n params: {\n recipientAddress: walletAddress,\n userId,\n destinationToken: acceptedToken,\n fiatCurrencyCode: swappedCurrencyCode,\n countryCode,\n railConfigs: [\n {\n type: RailConfigType.CRYPTO_TO_FIAT,\n userId,\n countryCode,\n fiatCurrencyCode: swappedCurrencyCode,\n sourceToken: acceptedToken,\n thirdPartyPaymentConfigs: buildSwappedThirdPartyPaymentConfigs({\n prefillFiatEmail,\n themeConfig,\n logTag: 'connect-rn:withdrawFops',\n logger,\n }),\n checkoutLimitsCriteria: sellLimits,\n },\n ],\n },\n })\n\n const fops = sortFops(response.genericFormsOfPayments, fopPriority)\n if (fops.length === 0) {\n logger.info('connect-rn:withdrawFops:empty', {\n countryCode,\n targetChainId: route.targetChainId,\n targetTokenAddress: route.targetTokenAddress,\n })\n }\n return fops\n}\n\n// \u2500\u2500 Hook \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * RN port of web's `useWithdrawFops`. Orchestrates the steps: resolve the\n * accepted-token legs, the region country/currency, the balance-derived sell\n * cap, then run the gated `/fops` query.\n */\nexport function useWithdrawalFops({\n config,\n enabled = true,\n}: UseWithdrawalFopsParams): UseWithdrawalFopsResult {\n const { apiKey, userId, prefillFiatEmail } = useFunkitIdentity()\n // Statsig readiness: while it's loading, the gate reads its `false` fallback,\n // which is indistinguishable from a genuinely-off gate \u2014 treat init as\n // loading, not \"unavailable\".\n const { isLoading: isStatsigLoading } = useStatsigClient()\n const isWithdrawalEnabled = !!useDynamicConfig('enableswappedwithdrawal')\n const fopPriority = useDynamicConfig('foppriority')\n const walletAddress = config.withdrawalWallet.address()\n\n const route = useWithdrawalRoute(config)\n\n // Country from the user's IP; no default (web parity). How an unresolved or\n // empty country is handled lives downstream: the fetch holds on it (isEnabled)\n // and a settled-but-empty lookup surfaces as an error (isError).\n const { userIpInfo, isLoadingGeoCheck } = useUserIpInfo()\n const countryCode = userIpInfo?.alpha2\n\n // Region-default fiat currency (web parity); falls back to USD. Gating /fops\n // on its loading state avoids an initial USD fetch that refetches once the\n // region currency resolves.\n const {\n data: swappedCurrencyCode = DEFAULT_FIAT_CURRENCY,\n isLoading: isSwappedCurrencyCodeLoading,\n } = useSwappedDefaultCurrencyQuery({\n apiKey,\n countryCode: userIpInfo?.alpha2,\n logger,\n })\n\n // Loading-state theme baked into the returned embeddedFlowUrls (web parity).\n const theme = useTheme<FunkitTheme>()\n const themeConfig = useMemo(\n () => buildSwappedThemeQueryParamsRN(theme),\n [theme],\n )\n\n const { usdBalance, eurMax, isBelowMinimumBalance, isAwaitingCap } =\n useWithdrawalSellCap(config, walletAddress)\n\n const isEnabled =\n enabled &&\n isWithdrawalEnabled &&\n !!apiKey &&\n !!userId &&\n !!walletAddress &&\n walletAddress !== '0x' &&\n !!countryCode &&\n !isSwappedCurrencyCodeLoading &&\n !isAwaitingCap\n\n const query = useQuery({\n // `prefillFiatEmail` is intentionally NOT in the queryKey (web parity): it's\n // read at fetch time, so post-mount changes don't trigger a refetch.\n queryKey: [\n WITHDRAW_FOPS_QUERY_KEY,\n userId,\n walletAddress,\n apiKey,\n countryCode,\n swappedCurrencyCode,\n fopPriority,\n themeConfig,\n route.targetChainId,\n route.targetTokenAddress,\n eurMax,\n ] as const,\n // `countryCode` is guaranteed by `isEnabled` (query stays disabled until it\n // resolves); the guard just narrows the type \u2014 the empty fallback is unreachable.\n queryFn: () =>\n countryCode\n ? fetchWithdrawalFops({\n apiKey,\n userId,\n walletAddress,\n countryCode,\n swappedCurrencyCode,\n fopPriority,\n themeConfig,\n route,\n eurMax,\n usdBalance,\n sourceToken: config.sourceToken,\n prefillFiatEmail,\n })\n : Promise.resolve([]),\n enabled: isEnabled,\n staleTime: FOPS_STALE_TIME,\n refetchOnWindowFocus: false,\n })\n\n // Loading spans every window where the answer isn't knowable yet: Statsig\n // init, the geo lookup, the region-currency lookup, the balance/rate cap\n // resolution, and the enabled fops fetch.\n const isLoading =\n isStatsigLoading ||\n isLoadingGeoCheck ||\n isSwappedCurrencyCodeLoading ||\n isAwaitingCap ||\n (isEnabled && query.isLoading)\n\n // Known-empty only once we actually know: gate confirmed off (Statsig\n // settled) or a settled fetch that returned nothing. Never during a load.\n const noPaymentMethodsAvailable =\n !isLoading &&\n (!isWithdrawalEnabled ||\n (query.isSuccess && (query.data?.length ?? 0) === 0))\n\n return {\n fops: query.data ?? [],\n isLoading,\n noPaymentMethodsAvailable,\n isBelowMinimumBalance,\n // Tie the query error to isEnabled (\"gate off \u21D2 no error\"), plus web's\n // no-country case: geo settled without a country is unrecoverable here.\n isError:\n (isEnabled && query.isError) || (!isLoadingGeoCheck && !countryCode),\n // Respect the enabled gate \u2014 refetch() would otherwise force a fetch even\n // when disabled (e.g. no resolved country).\n refetch: () => {\n if (isEnabled) {\n void query.refetch()\n }\n },\n isWithdrawalEnabled,\n route,\n }\n}\n", "import {\n type SwappedSellOrderData,\n type SwappedWithdrawalLegs,\n ensureRelayClientInitialized,\n getPublicClientFor,\n isUserRejectedError,\n processFiatWithdrawalOrder,\n toFiatWithdrawalOrder,\n} from '@funkit/connect-core'\nimport { useCallback, useRef } from 'react'\n\nimport type {\n WithdrawalFlowCallbacks,\n WithdrawalFlowConfig,\n} from '../flow/withdrawalFlowConfig'\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\n\n// Module-scoped so a submitted order stays deduped across sheet close/reopen \u2014\n// the hook (and its refs) unmount on close, but the embed can re-emit\n// SWAPPED_ORDER_DATA for the same order_id after a reopen. Provider order ids\n// are globally unique, so a process-wide set is safe.\nconst submittedOrderIds = new Set<string>()\n\n/**\n * @internal Test-only: clear the process-wide submitted-order dedupe set so\n * suites that reuse order ids stay isolated. Not part of the public API.\n */\nexport function __resetSubmittedWithdrawalOrders(): void {\n submittedOrderIds.clear()\n}\n\nexport interface UseWithdrawalExecutionParams {\n config: WithdrawalFlowConfig\n /** The route resolved by `useWithdrawalFops` \u2014 one resolution for fetch + quote. */\n route: SwappedWithdrawalLegs\n callbacks: WithdrawalFlowCallbacks\n /** Unrecoverable failure \u2014 the flow shows its error state. */\n onError: () => void\n}\n\n/**\n * Thin React wrapper over connect-core's `processFiatWithdrawalOrder`: owns\n * the control-flow guards for the unreliable embed message stream and maps\n * outcomes onto host callbacks. The guards are intentionally refs, not state \u2014\n * both are read synchronously inside the async `executeOrder` (a re-entrancy\n * flag set before the first await, and a dedupe set) and must not re-render.\n */\nexport function useWithdrawalExecution({\n config,\n route,\n callbacks,\n onError,\n}: UseWithdrawalExecutionParams): {\n executeOrder: (data: SwappedSellOrderData) => Promise<void>\n} {\n const { apiKey, userId } = useFunkitIdentity()\n\n const isProcessingRef = useRef(false)\n\n const executeOrder = useCallback(\n async (data: SwappedSellOrderData) => {\n const order = toFiatWithdrawalOrder(data)\n if (isProcessingRef.current) {\n logger.warn('connect-rn:withdrawal:already_processing', {\n order_id: order.orderId,\n })\n return\n }\n if (submittedOrderIds.has(order.orderId)) {\n logger.warn('connect-rn:withdrawal:duplicate', {\n order_id: order.orderId,\n })\n return\n }\n isProcessingRef.current = true\n\n // Routing decision point: the requested target (config) vs the enforced\n // target (after the Statsig source override) alongside what the provider\n // reported it accepts, for off-ramp reconciliation (web parity).\n logger.info('connect-rn:withdrawal:route_decision', {\n order_id: order.orderId,\n overrideApplied: route.overrideApplied,\n requestedTargetChainId: config.swappedAcceptedToken?.chainId,\n requestedTargetTokenAddress: config.swappedAcceptedToken?.address,\n enforcedTargetChainId: route.targetChainId,\n enforcedTargetTokenAddress: route.targetTokenAddress,\n enforcedTargetTokenSymbol: route.targetTokenSymbol,\n providerCrypto: order.providerCrypto,\n providerNetwork: order.providerNetwork,\n })\n\n let txHash: string\n try {\n ensureRelayClientInitialized(logger, 'funkit-connect-rn')\n ;({ txHash } = await processFiatWithdrawalOrder({\n order,\n wallet: config.withdrawalWallet,\n legs: route,\n apiKey,\n userId,\n logger,\n // Read the target token's decimals on-chain (via publicClient) rather\n // than trusting host-config `decimals` \u2014 a stale/wrong value would\n // mis-scale the amount transferred to Swapped's deposit address.\n publicClient: getPublicClientFor(Number(route.targetChainId)),\n }))\n } catch (error) {\n if (isUserRejectedError(error)) {\n // The user declined the signature \u2014 the embed stays interactive.\n logger.warn('connect-rn:withdrawal:user_rejected', {\n order_id: order.orderId,\n })\n return\n }\n // Unrecoverable: funds did not move (or the record failed) and the\n // user sees the error state.\n logger.error('connect-rn:withdrawal:execution_failed', error as Error, {\n order_id: order.orderId,\n })\n callbacks.onWithdrawalError?.({\n message: error instanceof Error ? error.message : String(error),\n })\n onError()\n return\n } finally {\n isProcessingRef.current = false\n }\n\n // Funds moved \u2014 mark submitted and correlate the provider order id to the\n // on-chain hash. The host callback runs in its own guard: a throw here is\n // NOT an execution failure (money already moved), so it must not fall into\n // the error path above and fire `onWithdrawalError` for a success.\n submittedOrderIds.add(order.orderId)\n try {\n callbacks.onWithdrawalSubmitted?.(order.orderId, txHash)\n } catch (error) {\n logger.warn('connect-rn:withdrawal:submitted_callback_threw', {\n order_id: order.orderId,\n error: error instanceof Error ? error.message : String(error),\n })\n }\n },\n [apiKey, userId, config, route, callbacks, onError],\n )\n\n return { executeOrder }\n}\n", "// `__CONNECT_RN_VERSION__` is replaced at build time with the package version\n// via esbuild `define` (see build.js). The `typeof` guard keeps this safe under\n// vitest / tsc, where the define isn't applied and the identifier is undefined.\ndeclare const __CONNECT_RN_VERSION__: string\n\nexport const CONNECT_RN_VERSION: string =\n typeof __CONNECT_RN_VERSION__ === 'string'\n ? __CONNECT_RN_VERSION__\n : '0.0.0-dev'\n", "import {\n LogEventCompressionMode,\n LogLevel,\n StatsigProvider,\n type StatsigUser,\n} from '@statsig/react-bindings'\nimport { type ReactNode, useEffect, useMemo } from 'react'\n\nimport { logger } from '../logging/logger'\nimport { useClientAsyncInitRN } from '../statsig/useClientAsyncInitRN'\n\n// React Native counterpart of @funkit/connect's FunkitStatsigProvider. Same Fun\n// client key + custom proxy (the Statsig domain is usually blocked by adblockers\n// \u2014 https://docs.statsig.com/infrastructure/api_proxy/custom_proxy), but the\n// client is created with the RN bindings (AsyncStorage persistence, AppState\n// visibility) via `useClientAsyncInitRN`. The web-only Datadog `values_updated`\n// correlation is omitted (RN logging is wired separately).\nconst STATSIG_API = 'https://data-api.fun.xyz/v1'\nexport const STATSIG_CLIENT_KEY =\n 'client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM' as const\n\n// Hardcoded SDK marker (not UA/OS-parsed, so present on every eval). Lets a\n// config shared with the web SDK be scoped per-SDK via a targeting rule.\nexport const STATSIG_SDK_TYPE = 'react-native' as const\n\n/**\n * Statsig user for the RN SDK: `customIDs.apiKey` drives customer-gated configs;\n * `custom.sdkType` scopes shared configs to this SDK (see {@link STATSIG_SDK_TYPE}).\n */\nexport function buildFunkitStatsigUser(\n userId: string,\n apiKey: string,\n): StatsigUser {\n return {\n userID: userId,\n customIDs: { apiKey },\n custom: { sdkType: STATSIG_SDK_TYPE },\n }\n}\n\ninterface FunkitStatsigProviderProps {\n children: ReactNode\n /** Customer apiKey \u2014 gates customer-scoped configs (e.g. `enableswappeddeposit`). */\n apiKey: string\n /** Resolved funkit user id (apiKey|externalUserId, else wallet address). */\n userId: string\n isDevelopment?: boolean\n}\n\nexport function FunkitStatsigProvider({\n children,\n apiKey,\n userId,\n isDevelopment = false,\n}: FunkitStatsigProviderProps) {\n const user = useMemo<StatsigUser>(\n () => buildFunkitStatsigUser(userId, apiKey),\n [userId, apiKey],\n )\n\n const { client, isLoading } = useClientAsyncInitRN(STATSIG_CLIENT_KEY, user, {\n networkConfig: {\n api: STATSIG_API,\n // default timeout (10s) is too large; statsig usually responds <200ms\n networkTimeoutMs: 5_000,\n },\n // Our proxy supports compression; force it on to save bandwidth.\n logEventCompressionMode: LogEventCompressionMode.Forced,\n // Silence harmless warnings from hooks running before async init (we have\n // bootstrap fallbacks).\n logLevel: isDevelopment ? undefined : LogLevel.Error,\n environment: {\n tier: isDevelopment ? 'development' : 'production',\n },\n })\n\n useEffect(() => {\n // Statsig drops what it writes before its storage is ready; init awaits it.\n if (isLoading) {\n return\n }\n\n const { user: currentUser } = client.getContext()\n const apiKeyChanged = currentUser.customIDs?.apiKey !== apiKey\n const userIdChanged = currentUser.userID !== userId\n\n if (apiKeyChanged || userIdChanged) {\n logger.info('statsig:updateUser', { apiKey, userId })\n client\n .updateUserAsync(user)\n .catch((error) => logger.error('statsig:updateUser:error', error))\n }\n }, [client, isLoading, user, apiKey, userId])\n\n return <StatsigProvider client={client}>{children}</StatsigProvider>\n}\n", "import {\n type StatsigOptions,\n type StatsigUser,\n useStatsigInternalClientFactoryAsync,\n} from '@statsig/react-bindings'\n\nimport { StatsigClientRN } from './StatsigClientRN'\n\n// Vendored from @statsig/react-native-bindings. Creates an RN client and runs\n// `initializeAsync` (network fetch); `isLoading` flips false when ready.\nexport function useClientAsyncInitRN(\n sdkKey: string,\n initialUser: StatsigUser,\n statsigOptions: StatsigOptions | null = null,\n): { isLoading: boolean; client: StatsigClientRN } {\n return useStatsigInternalClientFactoryAsync(\n (args) =>\n new StatsigClientRN(args.sdkKey, args.initialUser, args.statsigOptions),\n {\n sdkKey,\n initialUser,\n statsigOptions,\n },\n )\n}\n", "import {\n StatsigClient,\n type StatsigOptions,\n type StatsigUser,\n} from '@statsig/react-bindings'\n\nimport { setupStatsigForReactNative } from './rnSetup'\nimport { getStatsigMetadataAdditions } from './statsigMetadata'\n\n// Vendored from @statsig/react-native-bindings' StatsigClientRN. A StatsigClient\n// pre-configured for React Native: AsyncStorage persistence, AppState-driven\n// visibility, and (device-info-free) metadata additions.\nexport class StatsigClientRN extends StatsigClient {\n readonly __isRnClient = true\n\n constructor(\n sdkKey: string,\n user: StatsigUser,\n options: StatsigOptions | null = null,\n ) {\n const opts = options ?? {}\n setupStatsigForReactNative(getStatsigMetadataAdditions(), opts)\n\n super(sdkKey, user, opts)\n }\n}\n", "import {\n type AnyStatsigOptions,\n type NetworkArgs,\n SDKType,\n StatsigMetadataProvider,\n} from '@statsig/react-bindings'\n\nimport { applyAppStateVisibilityShim } from './appVisibilityShim'\nimport { createPreloadedAsyncStorage } from './preloadedAsyncStorage'\n\n// Vendored from @statsig/react-native-core's RNSetup. Wires the RN platform\n// concerns into a StatsigOptions before the client is constructed: the AppState\n// visibility shim, the binding type, the AsyncStorage-backed storage provider\n// (unless the host supplied its own), and a fetch-based network override that\n// sets the JSON content-type header.\n\nexport function setupStatsigForReactNative(\n statsigMetadataAdditions: Record<string, string | undefined> | null,\n options: AnyStatsigOptions,\n): void {\n applyAppStateVisibilityShim()\n\n SDKType._setBindingType('rn')\n if (statsigMetadataAdditions) {\n StatsigMetadataProvider.add(statsigMetadataAdditions)\n }\n\n if (options.storageProvider == null) {\n options.storageProvider = createPreloadedAsyncStorage()\n }\n\n applyNetworkFix(options)\n}\n\nfunction applyNetworkFix(options: AnyStatsigOptions) {\n if (options.networkConfig?.networkOverrideFunc != null) {\n return\n }\n\n const networkOverrideFunc = (url: string, args: NetworkArgs) => {\n if (args.body != null && args.method === 'POST') {\n args.headers = {\n 'Content-Type': 'application/json',\n ...args.headers,\n }\n }\n return fetch(url, args)\n }\n\n options.networkConfig = {\n networkOverrideFunc,\n ...options.networkConfig,\n }\n}\n", "import { _notifyVisibilityChanged } from '@statsig/react-bindings'\nimport { AppState } from 'react-native'\n\n// Vendored from @statsig/react-native-core's AppVisiblityShim. statsig's event\n// logger flushes on visibility changes; on web that's driven by\n// `document`/`window` events, which don't exist in RN. Bridge RN's `AppState`\n// to statsig's `_notifyVisibilityChanged` so flush-on-background works.\n\nlet isApplied = false\n\nexport function applyAppStateVisibilityShim(): void {\n if (isApplied) {\n return\n }\n\n isApplied = true\n AppState.addEventListener('change', (nextAppState) =>\n _notifyVisibilityChanged(\n nextAppState === 'active' ? 'foreground' : 'background',\n ),\n )\n}\n", "import AsyncStorage from '@react-native-async-storage/async-storage'\nimport { Log, type StorageProvider } from '@statsig/react-bindings'\n\n// Vendored from @statsig/react-native-core's PreloadedAsyncStorage, unchanged\n// except for sourcing `Log`/`StorageProvider` from `@statsig/react-bindings`\n// (which re-exports `@statsig/client-core`) so there's a single statsig copy.\n//\n// Statsig's storage API is synchronous, but AsyncStorage is async. This bridges\n// them: prefetch all `statsig.*` keys into an in-memory mirror once, serve reads\n// synchronously from the mirror, and write through to AsyncStorage in the\n// background. Persistence (warm cache across launches) without any native\n// module beyond AsyncStorage.\n\nconst NOT_READY_ERROR =\n 'Attempting to alter AsyncStorage before it is ready. Values will not be persisted.'\n\nexport function createPreloadedAsyncStorage(): StorageProvider {\n const inMemoryStore: Record<string, string> = {}\n let isResolved = false\n let readyPromise: Promise<void> | null = null\n\n const enforceIsResolved = () => {\n if (!isResolved) {\n Log.error(NOT_READY_ERROR)\n }\n\n return isResolved\n }\n\n const provider: StorageProvider = {\n getProviderName: (): string => 'AsyncStorage',\n\n isReady: () => isResolved,\n\n isReadyResolver: () => {\n if (!readyPromise) {\n readyPromise = prefetchFromAsyncStorage(inMemoryStore).finally(() => {\n isResolved = true\n })\n }\n return readyPromise\n },\n\n getItem: (key: string): string | null => {\n if (!enforceIsResolved()) {\n return null\n }\n\n return inMemoryStore[key] ?? null\n },\n\n setItem: (key: string, value: string): void => {\n inMemoryStore[key] = value\n if (!enforceIsResolved()) {\n return\n }\n\n AsyncStorage.setItem(key, value).catch(Log.error)\n },\n\n removeItem: (key: string): void => {\n delete inMemoryStore[key]\n if (!enforceIsResolved()) {\n return\n }\n\n AsyncStorage.removeItem(key).catch(Log.error)\n },\n\n getAllKeys: (): readonly string[] => {\n if (!enforceIsResolved()) {\n return []\n }\n\n return Object.keys(inMemoryStore)\n },\n }\n\n return provider\n}\n\nasync function prefetchFromAsyncStorage(\n inMemoryStore: Record<string, string>,\n): Promise<void> {\n const keys = await AsyncStorage.getAllKeys()\n\n await Promise.all(\n keys.map(async (key) => {\n if (!key.startsWith('statsig.')) {\n return\n }\n\n const cache = await AsyncStorage.getItem(key)\n if (!cache) {\n return\n }\n\n inMemoryStore[key] = cache\n }),\n )\n}\n", "import { NativeModules, Platform } from 'react-native'\n\n// Vendored from @statsig/react-native-core's StatsigMetadataAdditions, with the\n// `react-native-device-info` dependency intentionally REMOVED \u2014 that package is\n// a native module (not in Expo Go, needs a dev build) and we don't want to\n// require it. The app-version / device-model fields it provided are simply left\n// `undefined`; we still surface `systemName` (free via `Platform.OS`) and the\n// `locale` (read from RN's built-in NativeModules, no extra dependency).\n\ntype I18nManagerModule = { localeIdentifier?: string }\ntype SettingsManagerModule = {\n settings?: { AppLocale?: string; AppleLanguages?: string[] }\n}\n\nfunction resolveLocale(): string | undefined {\n if (Platform.OS === 'android') {\n const i18nManager = NativeModules.I18nManager as\n | I18nManagerModule\n | undefined\n return i18nManager?.localeIdentifier ?? undefined\n }\n\n if (Platform.OS === 'ios') {\n const settings = (\n NativeModules.SettingsManager as SettingsManagerModule | undefined\n )?.settings\n return settings?.AppLocale ?? settings?.AppleLanguages?.[0] ?? undefined\n }\n\n return undefined\n}\n\nexport function getStatsigMetadataAdditions(): Record<\n string,\n string | undefined\n> {\n return {\n // Device-info-derived fields are dropped (no react-native-device-info).\n appVersion: undefined,\n systemVersion: undefined,\n deviceModelName: undefined,\n deviceModel: undefined,\n // Available without any native module:\n systemName: Platform.OS,\n locale: resolveLocale(),\n }\n}\n", "import { useCallback } from 'react'\n\nimport type {\n DepositFlowCallbacks,\n DepositFlowConfig,\n} from '../flow/depositFlowConfig'\nimport { useFunkitFlow } from '../flow/FunkitFlowProvider'\nimport type {\n WithdrawalFlowCallbacks,\n WithdrawalFlowConfig,\n} from '../flow/withdrawalFlowConfig'\n\n/** Lifecycle callbacks for both managed flows (overlapping keys are identical). */\nexport type FunkitCheckoutCallbacks = DepositFlowCallbacks &\n WithdrawalFlowCallbacks\n\n/**\n * The connect-rn entry hook, mirroring `@funkit/connect`'s `useFunkitCheckout`.\n * Returns imperative `begin*` calls that open the SDK's managed modal flow \u2014 the\n * host renders no screens itself.\n *\n * `beginDeposit(config)` opens the deposit flow (Add money \u2192 Transfer/UDA \u2192\n * Choose chain / Supported tokens / QR). `beginWithdrawal(config)` opens the\n * fiat-offramp withdrawal flow (payout methods \u2192 Swapped sell embed).\n * `beginCheckout` will be added here as that flow lands, matching the web\n * surface.\n */\nexport function useFunkitCheckout(callbacks: FunkitCheckoutCallbacks = {}) {\n const { beginDeposit: openDepositFlow, beginWithdrawal: openWithdrawalFlow } =\n useFunkitFlow()\n\n const beginDeposit = useCallback(\n (config: DepositFlowConfig) => openDepositFlow(config, callbacks),\n [openDepositFlow, callbacks],\n )\n\n const beginWithdrawal = useCallback(\n (config: WithdrawalFlowConfig) => openWithdrawalFlow(config, callbacks),\n [openWithdrawalFlow, callbacks],\n )\n\n return { beginDeposit, beginWithdrawal }\n}\n", "import type { DirectExecution } from '@funkit/api-base'\nimport {\n type PurifiedCheckoutHistoryItem,\n processRecentDepositsForNotifications,\n purifyCheckoutHistoryItem,\n useRecentDepositsApiQuery,\n} from '@funkit/connect-core'\nimport { useMemo } from 'react'\n\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\nimport { useDynamicConfig } from '../statsig/useDynamicConfig'\n\ninterface UseFunkitRecentDepositsParams {\n isVisible: boolean\n fetchSize?: number\n cutOffTimeMs?: number\n /**\n * Optional filter to refine which deposits are returned. Pass a stable\n * reference (`useCallback`) \u2014 an unstable one recomputes the merge each render.\n */\n memoizedFilterFunc?: (de: DirectExecution) => boolean\n}\n\ninterface UseFunkitRecentDepositsImplParams extends UseFunkitRecentDepositsParams {\n apiKey: string\n userId: string\n refreshIntervalMs: number\n}\n\n/**\n * Fetch the current user's recent deposits, polling the funkit server. Mirrors\n * `@funkit/connect`'s `useFunkitRecentDeposits`.\n *\n * **Requirements**: must be used inside `<FunkitProvider>` \u2014 it reads the\n * apiKey/userId configured there and the shared refresh interval. The `'0x'`\n * sentinel (no wallet / no externalUserId) disables polling.\n *\n * @returns `{ data }` \u2014 purified deposit rows, or `undefined` while loading.\n *\n * @example\n * ```tsx\n * const { data: recentDeposits } = useFunkitRecentDeposits({\n * isVisible: true,\n * fetchSize: 10,\n * cutOffTimeMs: 24 * 60 * 60 * 1000, // last 24h\n * })\n * ```\n */\nexport function useFunkitRecentDeposits(query: UseFunkitRecentDepositsParams): {\n data: PurifiedCheckoutHistoryItem[] | undefined\n} {\n const { apiKey, userId } = useFunkitIdentity()\n const { listRefresh } = useDynamicConfig(\n 'checkoutnotificationsrefreshinterval',\n )\n\n return useFunkitRecentDepositsImpl({\n ...query,\n apiKey,\n // The '0x' sentinel means no wallet / no externalUserId \u2014 disables polling.\n userId: userId === '0x' ? '' : userId,\n refreshIntervalMs: listRefresh,\n })\n}\n\n/**\n * Explicit-params variant of `useFunkitRecentDeposits`. Mirrors\n * `@funkit/connect`'s `useFunkitRecentDepositsImpl`.\n *\n * **Requirements**: does NOT require `<FunkitProvider>` \u2014 the host passes\n * identity and the refresh interval itself. Use it when polling outside the\n * provider hierarchy, or for a user other than the configured one.\n *\n * @returns `{ data }` \u2014 purified deposit rows, or `undefined` while loading.\n *\n * @example\n * ```tsx\n * const { data: recentDeposits } = useFunkitRecentDepositsImpl({\n * isVisible: true,\n * apiKey: 'your-api-key',\n * userId: 'funkit|external-user-42',\n * refreshIntervalMs: 5000,\n * fetchSize: 10,\n * })\n * ```\n */\nexport function useFunkitRecentDepositsImpl({\n isVisible,\n fetchSize = 5,\n cutOffTimeMs,\n memoizedFilterFunc,\n apiKey,\n userId,\n refreshIntervalMs,\n}: UseFunkitRecentDepositsImplParams): {\n data: PurifiedCheckoutHistoryItem[] | undefined\n} {\n const { data: directExecutions } = useRecentDepositsApiQuery({\n isVisible,\n apiKey,\n userId,\n refreshIntervalMs,\n fetchSize: fetchSize * 2, // over-fetch to account for merging\n logger,\n })\n\n const mergedDirectExecutions = useMemo(\n () =>\n processRecentDepositsForNotifications(\n memoizedFilterFunc\n ? directExecutions?.filter(memoizedFilterFunc)\n : directExecutions,\n { cutOffTimeMs },\n ),\n [directExecutions, cutOffTimeMs, memoizedFilterFunc],\n )\n\n return useMemo(\n () => ({\n data: mergedDirectExecutions\n ?.map((de) => purifyCheckoutHistoryItem(de))\n .slice(0, fetchSize),\n }),\n [mergedDirectExecutions, fetchSize],\n )\n}\n", "import {\n getCheckoutsByUserId,\n getDirectExecutionsByUserId,\n} from '@funkit/api-base'\nimport {\n type PurifiedCheckoutHistoryItem,\n purifyCheckoutHistoryItem,\n} from '@funkit/connect-core'\nimport { useQuery } from '@tanstack/react-query'\n\nimport { useFunkitIdentity } from '../identity/IdentityContext'\nimport { logger } from '../logging/logger'\nimport { useDynamicConfig } from '../statsig/useDynamicConfig'\n\nconst CHECKOUT_HISTORY_HOOK_LIMIT = 100\n\n/**\n * Poll the current user's checkout + deposit history, mirroring\n * `@funkit/connect`'s `useCheckoutsListenerByUserId`. Fetches both checkouts and\n * direct executions, purifies them, and returns a single list sorted\n * newest-first.\n *\n * **Requirements**: must be used inside `<FunkitProvider>`. `userId` is optional\n * and defaults to the identity configured there \u2014 RN's `userId` is a synthetic\n * internal id the host can't easily supply, so the common case is to omit it.\n * The `'0x'` sentinel (no wallet / no externalUserId) disables polling.\n *\n * @returns `{ data, isLoading }` \u2014 purified rows, or `undefined` while loading.\n */\nexport function useCheckoutsListenerByUserId(userId?: string): {\n data?: PurifiedCheckoutHistoryItem[]\n isLoading: boolean\n} {\n const { apiKey, userId: identityUserId } = useFunkitIdentity()\n const { listRefresh } = useDynamicConfig(\n 'checkoutnotificationsrefreshinterval',\n )\n\n const resolvedUserId = userId ?? identityUserId\n const effectiveUserId = resolvedUserId === '0x' ? '' : resolvedUserId\n\n const { data, isLoading } = useQuery({\n enabled: !!effectiveUserId,\n queryKey: ['getPurifiedCheckoutsByUserId', effectiveUserId],\n queryFn: async () => {\n const [checkouts, directExecutions] = await Promise.all([\n getCheckoutsByUserId({\n apiKey,\n logger,\n userId: effectiveUserId,\n limit: CHECKOUT_HISTORY_HOOK_LIMIT,\n }),\n getDirectExecutionsByUserId({\n apiKey,\n logger,\n userId: effectiveUserId,\n limit: CHECKOUT_HISTORY_HOOK_LIMIT,\n }),\n ])\n\n return [...checkouts, ...directExecutions]\n .map(purifyCheckoutHistoryItem)\n .sort((a, b) => b.createdTimeMs - a.createdTimeMs)\n .slice(0, CHECKOUT_HISTORY_HOOK_LIMIT)\n },\n refetchInterval: listRefresh,\n })\n\n return { data, isLoading }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAgKO,SAAS,oBACd,QACA,WACQ;AACR,SAAO,GAAG,MAAM,IAAI,SAAS;AAC/B;AAGO,IAAM,wBAGT;AAAA,EACF,SAAS;AAAA,EACT,QAAQ;AACV;AAEO,IAAM,cAA4B;AAAA,EACvC,YAAY;AAAA,IACV,OAAO;AAAA,IACP,WAAW;AAAA,IAC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;AAAA,IACX,UAAU,CAAC,gCAAgC,eAAe;AAAA,IAC1D,SAAS,YAAY;AACnB,YAAM,CAAC,WAAW,gBAAgB,IAAI,MAAM,QAAQ,IAAI;AAAA,QACtD,qBAAqB;AAAA,UACnB;AAAA,UACA;AAAA,UACA,QAAQ;AAAA,UACR,OAAO;AAAA,QACT,CAAC;AAAA,QACD,4BAA4B;AAAA,UAC1B;AAAA,UACA;AAAA,UACA,QAAQ;AAAA,UACR,OAAO;AAAA,QACT,CAAC;AAAA,MACH,CAAC;AAED,aAAO,CAAC,GAAG,WAAW,GAAG,gBAAgB,EACtC,IAAIC,0BAAyB,EAC7B,KAAK,CAAC,GAAG,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAChD,MAAM,GAAG,2BAA2B;AAAA,IACzC;AAAA,IACA,iBAAiB;AAAA,EACnB,CAAC;AAED,SAAO,EAAE,MAAM,UAAU;AAC3B;",
6
+ "names": ["Text", "useMemo", "useState", "useState", "useMemo", "useEffect", "useMemo", "useRef", "createContext", "useCallback", "useContext", "useMemo", "useState", "View", "BottomSheetModal", "BottomSheetView", "useCallback", "useEffect", "useState", "useSafeAreaInsets", "useEffect", "useMemo", "useMemo", "useEffect", "useCallback", "useEffect", "useState", "jsx", "jsx", "useEffect", "useState", "jsx", "useState", "useEffect", "SvgXml", "jsx", "jsx", "SvgXml", "jsx", "jsx", "SvgXml", "jsx", "SvgXml", "jsx", "toIconUri", "jsx", "jsxs", "StyleSheet", "jsx", "jsx", "jsxs", "styles", "StyleSheet", "useEffect", "useRef", "useState", "Pressable", "StyleSheet", "jsx", "styles", "StyleSheet", "SvgXml", "jsx", "SvgXml", "jsx", "jsxs", "useState", "useRef", "useEffect", "Pressable", "Pressable", "StyleSheet", "View", "useSafeAreaInsets", "useRef", "useState", "StyleSheet", "jsx", "jsxs", "styles", "useWindowDimensions", "StyleSheet", "jsx", "styles", "StyleSheet", "jsx", "jsxs", "useSafeAreaInsets", "styles", "Pressable", "loading", "View", "StyleSheet", "useEffect", "useState", "Animated", "Pressable", "useEffect", "useRef", "jsx", "jsxs", "Pressable", "loading", "t", "useState", "topBar", "useEffect", "Animated", "useEffect", "useRef", "useState", "Pressable", "StyleSheet", "useSafeAreaInsets", "Pressable", "StyleSheet", "jsx", "jsxs", "Pressable", "styles", "StyleSheet", "jsx", "jsxs", "useSafeAreaInsets", "useState", "useRef", "useEffect", "styles", "Pressable", "StyleSheet", "useCallback", "useCallback", "useTheme", "useEffect", "useMemo", "useRef", "useState", "View", "Animated", "content", "jsx", "jsxs", "useRef", "useMemo", "useTheme", "useState", "useEffect", "View", "Animated", "jsx", "useCallback", "sheet", "fill", "jsx", "useCallback", "chainIconUri", "chainIconUri", "useCallback", "useEffect", "useRef", "copyToClipboard", "useCallback", "useRef", "useEffect", "getConfiguredMinDepositUsd", "useTheme", "useQuery", "useMemo", "useQuery", "useEffect", "useMemo", "useEffect", "useQuery", "useTheme", "useMemo", "getConfiguredMinDepositUsd", "useQuery", "useQuery", "useMemo", "useQuery", "useMemo", "solanaChain", "getDepositAddressForChain", "solanaChain", "getDepositAddressForChain", "jsx", "useCallback", "useEffect", "useRef", "StyleSheet", "View", "BottomSheetBackdrop", "Easing", "useSafeAreaInsets", "useEffect", "useEffect", "useState", "jsx", "jsxs", "content", "useRef", "useCallback", "useSafeAreaInsets", "useEffect", "Easing", "BottomSheetBackdrop", "View", "StyleSheet", "scrim", "Fragment", "jsx", "jsxs", "copyToClipboard", "useSafeAreaInsets", "useState", "useEffect", "BottomSheetModal", "BottomSheetView", "fops", "row", "useCallback", "useCallback", "useEffect", "useRef", "useState", "StyleSheet", "View", "useSafeAreaInsets", "StyleSheet", "Animated", "Easing", "Keyframe", "jsx", "jsxs", "Keyframe", "Easing", "Animated", "styles", "StyleSheet", "jsx", "StyleSheet", "useSafeAreaInsets", "useState", "useRef", "useCallback", "useEffect", "View", "useCallback", "useState", "useEffect", "useRef", "useEffect", "useState", "useQuery", "useRef", "useRef", "useQuery", "query", "useState", "useEffect", "ActivityIndicator", "StyleSheet", "useWindowDimensions", "useSafeAreaInsets", "Pressable", "StyleSheet", "jsx", "jsxs", "PillButton", "Pressable", "styles", "StyleSheet", "Pressable", "StyleSheet", "Animated", "Easing", "Animated", "jsx", "Animated", "jsx", "jsxs", "Animated", "Easing", "styles", "Pressable", "StyleSheet", "bottomInset", "jsx", "jsxs", "useWindowDimensions", "useSafeAreaInsets", "styles", "PillButton", "ActivityIndicator", "StyleSheet", "jsx", "useRef", "useEffect", "BottomSheetModal", "BottomSheetView", "useFeatureGate", "useState", "useSafeAreaInsets", "deductFlatFee", "isWithdrawalAddressSupported", "useState", "useQuery", "useQuery", "useQuery", "toWithdrawalAmountBaseUnit", "useCallback", "useState", "getSupportedAssets", "resolveTokenTransferConfig", "useQuery", "useMemo", "useState", "useQuery", "getSupportedAssets", "useMemo", "resolveTokenTransferConfig", "useState", "isAddressCompatibleWithChain", "useQuery", "useQuery", "isAddressCompatibleWithChain", "useState", "deductFlatFee", "isWithdrawalAddressSupported", "useEffectEvent", "useEffect", "useRef", "useCallback", "useRef", "useState", "useRef", "useState", "useCallback", "useRef", "useEffectEvent", "useEffect", "BottomSheetModal", "BottomSheetScrollView", "BottomSheetView", "useMemo", "useState", "StyleSheet", "View", "useWindowDimensions", "useSafeAreaInsets", "Pressable", "StyleSheet", "Fragment", "jsx", "jsxs", "styles", "row", "Pressable", "StyleSheet", "Pressable", "StyleSheet", "jsx", "jsxs", "styles", "Pressable", "StyleSheet", "BottomSheetScrollView", "useState", "StyleSheet", "View", "useSafeAreaInsets", "useState", "StyleSheet", "jsx", "jsxs", "useState", "styles", "StyleSheet", "Pressable", "StyleSheet", "jsx", "jsxs", "Pressable", "styles", "StyleSheet", "jsx", "jsxs", "useSafeAreaInsets", "useState", "styles", "View", "BottomSheetScrollView", "StyleSheet", "jsx", "jsxs", "useWindowDimensions", "useSafeAreaInsets", "useState", "useMemo", "View", "styles", "BottomSheetScrollView", "chainIconUri", "PillButton", "BottomSheetModal", "BottomSheetView", "StyleSheet", "BottomSheetScrollView", "Pressable", "StyleSheet", "View", "useWindowDimensions", "useSafeAreaInsets", "jsx", "jsxs", "useWindowDimensions", "useSafeAreaInsets", "styles", "Pressable", "View", "BottomSheetScrollView", "LIST_BOTTOM_GAP", "StyleSheet", "StyleSheet", "useSafeAreaInsets", "jsx", "jsxs", "useSafeAreaInsets", "styles", "StyleSheet", "ActivityIndicator", "Keyboard", "StyleSheet", "useWindowDimensions", "Animated", "Easing", "Keyframe", "LinearTransition", "useSafeAreaInsets", "jsx", "chainIconUri", "BottomSheetTextInput", "StyleSheet", "jsx", "jsxs", "errorText", "styles", "BottomSheetTextInput", "PillButton", "StyleSheet", "jsx", "jsxs", "AnimatedBox", "Animated", "Easing", "Keyframe", "LinearTransition", "errorText", "useWindowDimensions", "useSafeAreaInsets", "styles", "PillButton", "ActivityIndicator", "Keyboard", "StyleSheet", "Pressable", "StyleSheet", "useWindowDimensions", "Animated", "Keyframe", "LinearTransition", "useSafeAreaInsets", "useMemo", "StyleSheet", "useWindowDimensions", "Animated", "Keyframe", "LinearTransition", "useAnimatedStyle", "withTiming", "Easing", "jsx", "AMOUNT_FONT_SIZE", "LINE_HEIGHT_RATIO", "LETTER_SPACING_RATIO", "CAP_BOX_RATIO", "AnimatedBox", "Animated", "LinearTransition", "useWindowDimensions", "useMemo", "useAnimatedStyle", "withTiming", "styles", "Keyframe", "StyleSheet", "Pressable", "StyleSheet", "createContext", "useCallback", "useContext", "jsx", "createContext", "useContext", "useCallback", "warn", "jsx", "row", "Pressable", "styles", "StyleSheet", "Pressable", "StyleSheet", "Animated", "LinearTransition", "jsx", "jsxs", "AnimatedBox", "Animated", "LinearTransition", "card", "styles", "Pressable", "StyleSheet", "jsx", "jsxs", "AnimatedBox", "Animated", "LinearTransition", "Keyframe", "errorText", "useWindowDimensions", "useSafeAreaInsets", "styles", "Pressable", "chainIconUri", "PillButton", "StyleSheet", "Fragment", "jsx", "jsxs", "pasteFromClipboard", "useSafeAreaInsets", "useFeatureGate", "useState", "BottomSheetModal", "BottomSheetView", "jsx", "loading", "useCallback", "jsx", "useCallback", "getFops", "DEFAULT_FIAT_CURRENCY", "FOPS_STALE_TIME", "buildSwappedThirdPartyPaymentConfigs", "sortFops", "useSwappedDefaultCurrencyQuery", "useTheme", "useStatsigClient", "useQuery", "useMemo", "useMemo", "useQuery", "getFops", "buildSwappedThirdPartyPaymentConfigs", "sortFops", "useStatsigClient", "DEFAULT_FIAT_CURRENCY", "useSwappedDefaultCurrencyQuery", "useTheme", "FOPS_STALE_TIME", "ensureRelayClientInitialized", "getPublicClientFor", "isUserRejectedError", "useCallback", "useRef", "useRef", "useCallback", "ensureRelayClientInitialized", "getPublicClientFor", "isUserRejectedError", "jsx", "pasteFromClipboard", "useState", "useCallback", "row", "jsx", "jsxs", "createContext", "copyToClipboard", "pasteFromClipboard", "useState", "useMemo", "useCallback", "View", "useContext", "useEffect", "useMemo", "AsyncStorage", "Platform", "jsx", "useMemo", "useEffect", "jsx", "copyToClipboard", "pasteFromClipboard", "useRef", "useMemo", "useEffect", "useCallback", "useCallback", "useMemo", "useMemo", "purifyCheckoutHistoryItem", "useQuery", "useQuery", "purifyCheckoutHistoryItem"]
7
7
  }