@unifold/connect-react-native 0.1.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.
- package/README.md +130 -0
- package/dist/index.d.mts +50 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +2 -0
- package/dist/index.mjs +2 -0
- package/package.json +73 -0
package/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# @unifold/connect-react-native
|
|
2
|
+
|
|
3
|
+
Complete React Native/Expo SDK for crypto deposits and onramp with Unifold.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @unifold/connect-react-native react-native-svg
|
|
9
|
+
# or
|
|
10
|
+
yarn add @unifold/connect-react-native react-native-svg
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @unifold/connect-react-native react-native-svg
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Expo (managed workflow)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx expo install @unifold/connect-react-native react-native-svg
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### 1. Wrap your app with UnifoldProvider
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { UnifoldProvider } from '@unifold/connect-react-native';
|
|
27
|
+
|
|
28
|
+
export default function App() {
|
|
29
|
+
return (
|
|
30
|
+
<UnifoldProvider
|
|
31
|
+
publishableKey="pk_test_your_key"
|
|
32
|
+
config={{
|
|
33
|
+
appearance: 'dark',
|
|
34
|
+
modalTitle: 'Deposit Crypto',
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
<YourApp />
|
|
38
|
+
</UnifoldProvider>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Use the deposit hook
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { useUnifold } from '@unifold/connect-react-native';
|
|
47
|
+
import { Button, View } from 'react-native';
|
|
48
|
+
|
|
49
|
+
function DepositScreen() {
|
|
50
|
+
const { beginDeposit, isLoading } = useUnifold();
|
|
51
|
+
|
|
52
|
+
const handleDeposit = async () => {
|
|
53
|
+
const result = await beginDeposit({
|
|
54
|
+
walletAddress: '0x...',
|
|
55
|
+
destinationCurrency: 'usdc.eth',
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (result.success) {
|
|
59
|
+
console.log('Deposit completed:', result.execution);
|
|
60
|
+
} else {
|
|
61
|
+
console.log('Deposit failed or cancelled:', result.error);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<View>
|
|
67
|
+
<Button
|
|
68
|
+
title={isLoading ? 'Loading...' : 'Deposit Crypto'}
|
|
69
|
+
onPress={handleDeposit}
|
|
70
|
+
disabled={isLoading}
|
|
71
|
+
/>
|
|
72
|
+
</View>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Configuration Options
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
<UnifoldProvider
|
|
81
|
+
publishableKey="pk_test_your_key"
|
|
82
|
+
config={{
|
|
83
|
+
// Theme: 'light' | 'dark' | 'system'
|
|
84
|
+
appearance: 'dark',
|
|
85
|
+
|
|
86
|
+
// Custom modal title
|
|
87
|
+
modalTitle: 'Deposit Crypto',
|
|
88
|
+
|
|
89
|
+
// API URL (for development)
|
|
90
|
+
apiBaseUrl: 'http://localhost:3002',
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Exports
|
|
96
|
+
|
|
97
|
+
### Components
|
|
98
|
+
|
|
99
|
+
- `UnifoldProvider` - Root provider
|
|
100
|
+
- `DepositModal` - Full deposit modal
|
|
101
|
+
- `TransferCrypto` - Crypto transfer component
|
|
102
|
+
- `BuyWithCard` - Fiat onramp component
|
|
103
|
+
- `QRCode` - QR code display
|
|
104
|
+
- `BottomSheet` - Reusable bottom sheet
|
|
105
|
+
|
|
106
|
+
### Hooks
|
|
107
|
+
|
|
108
|
+
- `useUnifold` - Main deposit hook
|
|
109
|
+
- `useTheme` - Theme access
|
|
110
|
+
|
|
111
|
+
### API Functions
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import {
|
|
115
|
+
getSupportedDepositTokens,
|
|
116
|
+
getFiatCurrencies,
|
|
117
|
+
getProjectConfig,
|
|
118
|
+
queryExecutions,
|
|
119
|
+
} from '@unifold/connect-react-native';
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Requirements
|
|
123
|
+
|
|
124
|
+
- React Native >= 0.72.0
|
|
125
|
+
- Expo >= 49.0.0 (optional)
|
|
126
|
+
- react-native-svg >= 13.0.0
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { ThemeMode } from '@unifold/ui-react-native';
|
|
4
|
+
export { AutoSwapResponse, BottomSheet, BuyWithCard, CreateDepositAddressRequest, CurrencyListItem, CurrencyListSection, CurrencyModal, CurrencySelector, DepositAddressResponse, DepositExecutionItem, DepositHeader, DepositModal, DepositModalProps, DepositStatusSheet, DepositTrackerButton, DepositWithCardButton, DepositsModal, ExecutionStatus, FeaturedToken, FiatCurrency, Icon, IconUrl, MeldQuote, PaymentNetwork, ProjectConfigResponse, QRCode, RemoteIcon, SOLANA_USDC_ADDRESS, SupportedChain, SupportedToken, ThemeColors, ThemeMode, ThemeProvider, TokenChain, TokenChainsResponse, TransferCrypto, TransferCryptoButton, Wallet, createDepositAddress, createEOA, createMeldSession, getApiBaseUrl, getChainName, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getMeldQuotes, getPreferredIcon, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getTokenChains, getWalletByChainType, normalizeIconUrl, queryExecutions, setApiConfig, useTheme } from '@unifold/ui-react-native';
|
|
5
|
+
|
|
6
|
+
interface UnifoldConnectProviderConfig {
|
|
7
|
+
publishableKey: string;
|
|
8
|
+
config?: {
|
|
9
|
+
modalTitle?: string;
|
|
10
|
+
hideDepositTracker?: boolean;
|
|
11
|
+
/** Theme appearance: 'light', 'dark', or 'auto' (system preference). Defaults to 'dark' */
|
|
12
|
+
appearance?: ThemeMode | "auto";
|
|
13
|
+
/** Custom API base URL (optional) */
|
|
14
|
+
apiBaseUrl?: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
interface DepositResult {
|
|
18
|
+
message: string;
|
|
19
|
+
transaction?: unknown;
|
|
20
|
+
executionId?: string;
|
|
21
|
+
}
|
|
22
|
+
interface DepositError {
|
|
23
|
+
message: string;
|
|
24
|
+
error?: unknown;
|
|
25
|
+
code?: string;
|
|
26
|
+
}
|
|
27
|
+
interface DepositConfig {
|
|
28
|
+
userId: string;
|
|
29
|
+
destinationChainType?: "ethereum" | "solana" | "bitcoin";
|
|
30
|
+
destinationChainId?: string;
|
|
31
|
+
destinationTokenAddress?: string;
|
|
32
|
+
destinationTokenSymbol?: string;
|
|
33
|
+
recipientAddress?: string;
|
|
34
|
+
onSuccess?: (data: DepositResult) => void;
|
|
35
|
+
onError?: (error: DepositError) => void;
|
|
36
|
+
}
|
|
37
|
+
interface ConnectContextValue {
|
|
38
|
+
publishableKey: string;
|
|
39
|
+
beginDeposit: (config: DepositConfig) => Promise<DepositResult>;
|
|
40
|
+
closeDeposit: () => void;
|
|
41
|
+
}
|
|
42
|
+
interface UnifoldProviderProps {
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
publishableKey: string;
|
|
45
|
+
config?: UnifoldConnectProviderConfig["config"];
|
|
46
|
+
}
|
|
47
|
+
declare function UnifoldProvider({ children, publishableKey, config, }: UnifoldProviderProps): react_jsx_runtime.JSX.Element;
|
|
48
|
+
declare function useUnifold(): ConnectContextValue;
|
|
49
|
+
|
|
50
|
+
export { type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, type UnifoldProviderProps, useUnifold };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { ThemeMode } from '@unifold/ui-react-native';
|
|
4
|
+
export { AutoSwapResponse, BottomSheet, BuyWithCard, CreateDepositAddressRequest, CurrencyListItem, CurrencyListSection, CurrencyModal, CurrencySelector, DepositAddressResponse, DepositExecutionItem, DepositHeader, DepositModal, DepositModalProps, DepositStatusSheet, DepositTrackerButton, DepositWithCardButton, DepositsModal, ExecutionStatus, FeaturedToken, FiatCurrency, Icon, IconUrl, MeldQuote, PaymentNetwork, ProjectConfigResponse, QRCode, RemoteIcon, SOLANA_USDC_ADDRESS, SupportedChain, SupportedToken, ThemeColors, ThemeMode, ThemeProvider, TokenChain, TokenChainsResponse, TransferCrypto, TransferCryptoButton, Wallet, createDepositAddress, createEOA, createMeldSession, getApiBaseUrl, getChainName, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getMeldQuotes, getPreferredIcon, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getTokenChains, getWalletByChainType, normalizeIconUrl, queryExecutions, setApiConfig, useTheme } from '@unifold/ui-react-native';
|
|
5
|
+
|
|
6
|
+
interface UnifoldConnectProviderConfig {
|
|
7
|
+
publishableKey: string;
|
|
8
|
+
config?: {
|
|
9
|
+
modalTitle?: string;
|
|
10
|
+
hideDepositTracker?: boolean;
|
|
11
|
+
/** Theme appearance: 'light', 'dark', or 'auto' (system preference). Defaults to 'dark' */
|
|
12
|
+
appearance?: ThemeMode | "auto";
|
|
13
|
+
/** Custom API base URL (optional) */
|
|
14
|
+
apiBaseUrl?: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
interface DepositResult {
|
|
18
|
+
message: string;
|
|
19
|
+
transaction?: unknown;
|
|
20
|
+
executionId?: string;
|
|
21
|
+
}
|
|
22
|
+
interface DepositError {
|
|
23
|
+
message: string;
|
|
24
|
+
error?: unknown;
|
|
25
|
+
code?: string;
|
|
26
|
+
}
|
|
27
|
+
interface DepositConfig {
|
|
28
|
+
userId: string;
|
|
29
|
+
destinationChainType?: "ethereum" | "solana" | "bitcoin";
|
|
30
|
+
destinationChainId?: string;
|
|
31
|
+
destinationTokenAddress?: string;
|
|
32
|
+
destinationTokenSymbol?: string;
|
|
33
|
+
recipientAddress?: string;
|
|
34
|
+
onSuccess?: (data: DepositResult) => void;
|
|
35
|
+
onError?: (error: DepositError) => void;
|
|
36
|
+
}
|
|
37
|
+
interface ConnectContextValue {
|
|
38
|
+
publishableKey: string;
|
|
39
|
+
beginDeposit: (config: DepositConfig) => Promise<DepositResult>;
|
|
40
|
+
closeDeposit: () => void;
|
|
41
|
+
}
|
|
42
|
+
interface UnifoldProviderProps {
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
publishableKey: string;
|
|
45
|
+
config?: UnifoldConnectProviderConfig["config"];
|
|
46
|
+
}
|
|
47
|
+
declare function UnifoldProvider({ children, publishableKey, config, }: UnifoldProviderProps): react_jsx_runtime.JSX.Element;
|
|
48
|
+
declare function useUnifold(): ConnectContextValue;
|
|
49
|
+
|
|
50
|
+
export { type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, type UnifoldProviderProps, useUnifold };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var react=require('react'),reactNative=require('react-native'),reactQuery=require('@tanstack/react-query'),jsxRuntime=require('react/jsx-runtime'),te=require('react-native-svg'),Qr=require('react-native-qrcode-svg');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var te__default=/*#__PURE__*/_interopDefault(te);var Qr__default=/*#__PURE__*/_interopDefault(Qr);var Ao={background:"#ffffff",foreground:"#0f0f0f",foregroundMuted:"#737373",card:"#f5f5f5",cardHover:"#e5e5e5",border:"#e5e5e5",overlay:"rgba(0, 0, 0, 0.5)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},vr={background:"#0f0f0f",foreground:"#fafafa",foregroundMuted:"#a3a3a3",card:"#262626",cardHover:"#404040",border:"#333333",overlay:"rgba(0, 0, 0, 0.7)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},zo=react.createContext({colors:Ao,isDark:false,mode:"auto"});function Ze({children:e,mode:t="auto"}){let o=reactNative.useColorScheme(),r=react.useMemo(()=>{let l;return t==="auto"?l=o==="dark":l=t==="dark",{colors:l?vr:Ao,isDark:l,mode:t}},[t,o]);return jsxRuntime.jsx(zo.Provider,{value:r,children:e})}function _(){let e=react.useContext(zo);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}var ee="https://api.unifold.io",_e="pk_test_123",Ht={};function xt(e){if(e.publishableKey!==void 0){if(!e.publishableKey||e.publishableKey.trim()==="")throw new Error("Unifold SDK: publishableKey cannot be empty. Please provide a valid publishable key.");!e.publishableKey.startsWith("pk_test_")&&!e.publishableKey.startsWith("pk_live_")&&console.warn('Unifold SDK: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),_e=e.publishableKey;}e.baseUrl&&(ee=e.baseUrl),e.defaultConfig&&(Ht=e.defaultConfig);}function Fo(){return ee}function Me(e){if(!e||e.trim()==="")throw new Error("Unifold SDK: No publishable key configured. Please provide a valid publishable key via setApiConfig() or pass it directly to the API function.");e==="pk_test_123"&&console.warn('Unifold SDK: Using default test key "pk_test_123". This should only be used for local development. Please use a real publishable key in production.');}function le(e){let t=e.startsWith("/")?e:`/${e}`;return `${ee}/api/public${t}`}function Uo(e,t){if(!t)return le(e);let o=e.startsWith("/")?e:`/${e}`;return `${t.endsWith("/")?t.slice(0,-1):t}/api/public${o}`}function L(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,ee):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${ee}${e}`:`${ee}/api/public${e}`:""}async function go(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||Ht.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Ht.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e?.recipient_address||Ht.recipientAddress||"0x309a4154a2CD4153Da886E780890C9cb5161553C",client_metadata:e?.client_metadata||{}},r=t||_e;Me(r);let l=await fetch(`${ee}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!l.ok)throw new Error(`Failed to create deposit address: ${l.statusText}`);return l.json()}async function Je(e,t){return go(e?{...e,external_user_id:e.user_id}:void 0,t)}function Xe(e,t){return e.find(o=>o.chain_type===t)}var Ae=(a=>(a.DELAYED="delayed",a.FAILED="failed",a.PENDING="pending",a.REFUNDED="refunded",a.SUCCEEDED="succeeded",a.WAITING="waiting",a))(Ae||{}),Oo="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";async function et(e,t){let o=t||_e;Me(o);let r=await fetch(`${ee}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e})});if(!r.ok)throw new Error(`Failed to query executions: ${r.statusText}`);return r.json()}function K(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let o=e.icon_urls.find(r=>r.format===t);return o?o.url:e.icon_url}async function Nt(e){let t=e||_e;Me(t);let o=await fetch(`${ee}/v1/public/tokens/supported_deposit_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch supported deposit tokens: ${o.statusText}`);return o.json()}async function qt(e,t){let o=t||_e;Me(o);let r=await fetch(`${ee}/v1/public/onramps/meld/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to fetch Meld quotes: ${r.statusText}`);return r.json()}async function $t(e,t){let o=t||_e;Me(o);let r=await fetch(`${ee}/v1/public/onramps/meld/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to create Meld session: ${r.statusText}`);return r.json()}async function Qt(e){let t=e||_e;Me(t);let o=await fetch(`${ee}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch fiat currencies: ${o.statusText}`);return o.json()}function jo(e,t="png"){if(!e||e.length===0)return;let o=e.find(r=>r.format===t);return o?o.url:e[0]?.url}async function Gt(e){let t=e||_e;Me(t);let o=await fetch(`${ee}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch project config: ${o.statusText}`);return o.json()}async function Ho(){let e=await fetch(`${ee}/v1/public/tokens/chains`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch token chains: ${e.statusText}`);return e.json()}function No(e,t,o){let r=e.find(i=>i.chain_id===o);if(r)return r.chain_name;let l=e.find(i=>i.chain_type===t);return l?l.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}var{height:wt}=reactNative.Dimensions.get("window");function Y({visible:e,onClose:t,children:o,closeOnBackdropPress:r=true,showHandle:l=true,heightPercent:i}){let{colors:a}=_(),m=react.useRef(new reactNative.Animated.Value(wt)).current,h=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{e?(m.setValue(wt),h.setValue(0),reactNative.Animated.parallel([reactNative.Animated.spring(m,{toValue:0,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(h,{toValue:.5,duration:200,useNativeDriver:true})]).start()):reactNative.Animated.parallel([reactNative.Animated.spring(m,{toValue:wt,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(h,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,m,h]);let n=()=>{r&&t();};return jsxRuntime.jsx(reactNative.Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":"height",style:ze.container,children:[jsxRuntime.jsx(reactNative.TouchableWithoutFeedback,{onPress:n,children:jsxRuntime.jsx(reactNative.Animated.View,{style:[ze.backdrop,{backgroundColor:"#000000",opacity:h}]})}),jsxRuntime.jsxs(reactNative.Animated.View,{style:[ze.sheet,{backgroundColor:a.background,borderTopLeftRadius:24,borderTopRightRadius:24,transform:[{translateY:m}],...i&&{height:wt*i}}],children:[l&&jsxRuntime.jsx(reactNative.View,{style:ze.handleContainer,children:jsxRuntime.jsx(reactNative.View,{style:[ze.handle,{backgroundColor:a.border}]})}),jsxRuntime.jsx(reactNative.View,{style:[ze.content,i&&ze.contentFlex],children:o})]})]})})}var ze=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"flex-end"},backdrop:{...reactNative.StyleSheet.absoluteFillObject},sheet:{maxHeight:wt*.9,paddingBottom:reactNative.Platform.OS==="ios"?34:24,shadowColor:"#000",shadowOffset:{width:0,height:-4},shadowOpacity:.1,shadowRadius:12,elevation:16},handleContainer:{alignItems:"center",paddingVertical:12},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});function ho({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(te__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(te.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function yo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(te__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(te.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(te.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function kt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(te__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(te.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(te.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Co({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(te__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(te.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(te.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function rt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(te__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(te.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(te.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function nt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(te__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(te.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function me({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(te__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(te.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function ie({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(te__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(te.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Yt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(te__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(te.Path,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(te.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(te.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Yo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(te__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(te.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(te.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ko({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(te__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(te.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Zo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(te__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(te.Path,{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(te.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(te.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(te.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(te.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Kt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(te__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(te.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Zt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(te__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(te.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(te.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(te.Path,{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function se({title:e,showBack:t=false,showClose:o=true,onBack:r,onClose:l,badge:i}){let{colors:a}=_();return jsxRuntime.jsxs(reactNative.View,{style:ue.header,children:[jsxRuntime.jsx(reactNative.View,{style:ue.leftContainer,children:t&&r?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:r,style:[ue.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Co,{size:20,color:a.foreground,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:ue.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:ue.titleContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ue.title,{color:a.foreground}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[ue.titleBadge,{backgroundColor:a.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[ue.titleBadgeText,{color:a.foregroundMuted}],children:i.count})})]}),jsxRuntime.jsx(reactNative.View,{style:ue.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:l,style:[ue.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(rt,{size:20,color:a.foreground,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:ue.spacer})})]})}var ue=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},leftContainer:{width:40,alignItems:"flex-start"},rightContainer:{width:40,alignItems:"flex-end"},titleContainer:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,fontWeight:"500",textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function ae({uri:e,width:t,height:o,borderRadius:r=0,borderWidth:l=0,borderColor:i="transparent",backgroundColor:a="transparent",style:m}){let[h,n]=react.useState(false),V=e?.toLowerCase().endsWith(".svg");if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:o,borderRadius:r,backgroundColor:"#374151"},m]});let w={width:t,height:o,borderRadius:r,borderWidth:l,borderColor:i,backgroundColor:a,overflow:"hidden",alignItems:"center",justifyContent:"center",...m},c=t-l*2,T=o-l*2;return h?jsxRuntime.jsx(reactNative.View,{style:[w,{backgroundColor:a||"#374151"}]}):V?jsxRuntime.jsx(reactNative.View,{style:w,children:jsxRuntime.jsx(te.SvgUri,{uri:e,width:c,height:T,onError:N=>{console.log(`[RemoteIcon] SVG load error for ${e}:`,N),n(true);}})}):jsxRuntime.jsx(reactNative.View,{style:w,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:{width:c,height:T},resizeMode:"contain",onError:N=>{console.log(`[RemoteIcon] Image load error for ${e}:`,N.nativeEvent.error),n(true);}})})}function at({onPress:e,title:t,subtitle:o,featuredTokens:r}){let{colors:l}=_(),i=r?[...r].sort((a,m)=>a.position-m.position):[];return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[ye.container,{backgroundColor:l.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:ye.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[ye.iconContainer,{backgroundColor:l.cardHover}],children:jsxRuntime.jsx(ho,{size:20,color:l.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:ye.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ye.title,{color:l.foreground}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[ye.subtitle,{color:l.foregroundMuted}],children:o})]})]}),jsxRuntime.jsx(reactNative.View,{style:ye.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:ye.networkIcons,children:i.map((a,m)=>{let h=a.icon_urls.find(n=>n.format==="png")?.url||a.icon_urls.find(n=>n.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[ye.networkIconWrapper,{marginLeft:m===0?0:-6,zIndex:i.length-m}],children:jsxRuntime.jsx(ae,{uri:L(h),width:20,height:20,borderRadius:10,borderWidth:2,borderColor:l.card})},a.name)})})})]})}var ye=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},networkIcons:{flexDirection:"row",alignItems:"center"},networkIconWrapper:{}});function ct({onPress:e,title:t,subtitle:o,paymentNetworks:r}){let{colors:l}=_();return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Re.container,{backgroundColor:l.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:Re.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Re.iconContainer,{backgroundColor:l.cardHover}],children:jsxRuntime.jsx(yo,{size:20,color:l.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Re.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Re.title,{color:l.foreground}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Re.subtitle,{color:l.foregroundMuted}],children:o})]})]}),jsxRuntime.jsx(reactNative.View,{style:Re.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Re.paymentIcons,children:r?.map(i=>{let a=i.icon_urls.find(m=>m.format==="png")?.url||i.icon_urls.find(m=>m.format==="svg")?.url;return jsxRuntime.jsx(ae,{uri:L(a),width:32,height:20,borderRadius:4},i.name)})})})]})}var Re=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},paymentIcons:{flexDirection:"row",alignItems:"center",gap:6}});function dt({onPress:e,title:t,subtitle:o,badge:r}){let{colors:l}=_();return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Pe.container,{backgroundColor:l.card}],children:jsxRuntime.jsxs(reactNative.View,{style:Pe.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Pe.iconContainer,{backgroundColor:l.cardHover}],children:[jsxRuntime.jsx(kt,{size:20,color:l.foreground,strokeWidth:2}),r!==void 0&&r>0&&jsxRuntime.jsx(reactNative.View,{style:[Pe.badge,{backgroundColor:l.primary}],children:jsxRuntime.jsx(reactNative.Text,{style:Pe.badgeText,children:r>99?"99+":r})})]}),jsxRuntime.jsxs(reactNative.View,{style:Pe.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pe.title,{color:l.foreground}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Pe.subtitle,{color:l.foregroundMuted}],children:o})]})]})})}var Pe=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,borderRadius:9,alignItems:"center",justifyContent:"center",paddingHorizontal:4},badgeText:{color:"#FFFFFF",fontSize:10,fontWeight:"600"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function Tt({value:e,size:t=180,logoUri:o,logoSize:r=40,logoBackgroundColor:l}){let{colors:i,isDark:a}=_(),m=a?"#1a1a1a":"#ffffff",h=a?"#ffffff":"#000000",n=l||m;return jsxRuntime.jsxs(reactNative.View,{style:[nr.container,{width:t,height:t}],children:[jsxRuntime.jsx(Qr__default.default,{value:e||"placeholder",size:t,backgroundColor:m,color:h,ecl:"H",quietZone:4}),o&&jsxRuntime.jsx(reactNative.View,{style:[nr.logoContainer,{width:r+12,height:r+12,backgroundColor:n,borderRadius:(r+12)/2}],children:jsxRuntime.jsx(ae,{uri:o,width:r,height:r,borderRadius:r/2})})]})}var nr=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function _t({visible:e,status:t,tokenIconUrl:o,explorerUrl:r,completionExplorerUrl:l,onClose:i}){let{colors:a}=_(),m=react.useRef(new reactNative.Animated.Value(0)).current,h=t==="pending"||t==="waiting"||t==="delayed",n=t==="succeeded";react.useEffect(()=>{if(h&&e){let T=reactNative.Animated.loop(reactNative.Animated.timing(m,{toValue:1,duration:1e3,easing:reactNative.Easing.linear,useNativeDriver:true}));return T.start(),()=>T.stop()}else m.setValue(0);},[h,e,m]);let V=m.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]}),w=()=>{r&&reactNative.Linking.openURL(r);},c=()=>{l&&reactNative.Linking.openURL(l);};return jsxRuntime.jsx(Y,{visible:e,onClose:i,closeOnBackdropPress:true,showHandle:false,children:jsxRuntime.jsxs(reactNative.View,{style:j.container,children:[jsxRuntime.jsxs(reactNative.View,{style:j.iconContainer,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:L(o)},style:j.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[j.tokenIcon,{backgroundColor:a.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[j.statusBadge,{backgroundColor:h?"#F97316":"#22C55E"}],children:h?jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:V}]},children:jsxRuntime.jsx(Zt,{size:16,color:"#fff",strokeWidth:2.5})}):jsxRuntime.jsx(ie,{size:16,color:"#fff",strokeWidth:3})})]}),jsxRuntime.jsx(reactNative.Text,{style:[j.title,{color:a.foreground}],children:h?"Deposit Processing":"Deposit Complete"}),jsxRuntime.jsx(reactNative.Text,{style:[j.subtitle,{color:a.foregroundMuted}],children:h?`Your deposit is being processed.
|
|
2
|
+
This usually takes less than a minute.`:"Your account has been credited successfully!"}),h?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,style:[j.button,j.dismissButton],children:jsxRuntime.jsx(reactNative.Text,{style:j.buttonText,children:"Dismiss"})}):jsxRuntime.jsxs(reactNative.View,{style:j.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:w,style:[j.button,j.successButton,j.halfButton],children:jsxRuntime.jsx(reactNative.Text,{style:j.buttonText,children:"View deposit tx"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:c,style:[j.button,j.successButton,j.halfButton],children:jsxRuntime.jsx(reactNative.Text,{style:j.buttonText,children:"View completion tx"})})]}),n&&jsxRuntime.jsx(reactNative.Text,{style:[j.hint,{color:a.foregroundMuted}],children:"Opens in external browser"})]})})}var j=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:24,paddingBottom:20},iconContainer:{position:"relative",marginBottom:20},tokenIcon:{width:64,height:64,borderRadius:32},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},subtitle:{fontSize:14,textAlign:"center",marginBottom:24,lineHeight:20},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},dismissButton:{backgroundColor:"#F97316",width:"100%"},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});var It=(e,t)=>`${t}:${e}`,on=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function vt({userId:e,publishableKey:t,recipientAddress:o,destinationChainType:r,destinationChainId:l,destinationTokenAddress:i,onExecutionsChange:a,onDepositSuccess:m,onDepositError:h}){let{colors:n}=_(),[V,w]=react.useState("USDC"),[c,T]=react.useState("solana:mainnet"),[N,q]=react.useState([]),[B,E]=react.useState(true),[b,p]=react.useState([]),[$,U]=react.useState(true),[G,oe]=react.useState(false),[re,W]=react.useState(false),[Ne,Le]=react.useState(false),[ft,fe]=react.useState(false),[qe,gt]=react.useState([]),[Be,$e]=react.useState(new Map),[We]=react.useState(()=>new Date),[zt,Qe]=react.useState(null),[Ee,Ft]=react.useState(false),[ke,Ut]=react.useState(null),mt=new Map;b.forEach(y=>{y.chains.forEach(P=>{let A=`${P.chain_type}:${P.chain_id}`;mt.has(A)||mt.set(A,P);});});let Ge=Array.from(mt.values()),ht=on(c),po=Ge.find(y=>y.chain_type===ht.chainType&&y.chain_id===ht.chainId)?.chain_type||"ethereum",be=Xe(N,po)?.address||"";react.useEffect(()=>{async function y(){try{U(!0),Qe(null);let P=await Nt(t);if(p(P.data),P.data.length>0){let A=P.data[0];if(w(A.symbol),A.chains.length>0){let O=A.chains[0];T(It(O.chain_id,O.chain_type));}}}catch(P){console.error("Error fetching supported tokens:",P),Qe("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:P});}finally{U(false);}}y();},[t,h]),react.useEffect(()=>{async function y(){try{E(!0),Qe(null);let P=await Je({user_id:e,recipient_address:o,destination_chain_type:r,destination_chain_id:l,destination_token_address:i},t);q(P.data);}catch(P){console.error("Error fetching wallets:",P),Qe("Failed to load wallets"),h?.({message:"Failed to load wallets",error:P});}finally{E(false);}}y();},[e,o,r,l,i,t,h]),react.useEffect(()=>{if(!e||!We)return;let y=setInterval(async()=>{try{let P=await et(e,t),A=null;for(let O of P.data){let Te=O.created_at?new Date(O.created_at):null;if(!Te||Te<=We)continue;let Se=Be.get(O.id);if(!Se){A=O;break}if(["pending","waiting","delayed"].includes(Se)&&O.status==="succeeded"){A=O;break}}if(A){let O=A;gt(Te=>{let Se=Te.findIndex(Ct=>Ct.id===O.id);if(Se>=0){let Ct=[...Te];return Ct[Se]=O,Ct}else return [...Te,O]}),$e(Te=>{let Se=new Map(Te);return Se.set(O.id,O.status),Se}),Ut(O),Ft(!0),O.status==="succeeded"&&m?.({message:"Deposit completed successfully",executionId:O.id}),a?.([...qe,O]);}}catch(P){console.error("Error polling executions:",P),h?.({message:"Failed to check deposit status",error:P});}},5e3);return ()=>clearInterval(y)},[e,t,We,Be,qe,a,m,h]),react.useEffect(()=>{if(!b.length)return;let y=b.find(A=>A.symbol===V);if(!y||y.chains.length===0)return;if(!y.chains.some(A=>It(A.chain_id,A.chain_type)===c)){let A=y.chains[0];T(It(A.chain_id,A.chain_type));}},[V,b,c]);let Ye=b.find(y=>y.symbol===V),Ot=Ye?.chains||[],he=Ot.find(y=>It(y.chain_id,y.chain_type)===c),Ke=async()=>{if(be)try{reactNative.Clipboard.setString(be),oe(!0),setTimeout(()=>oe(!1),2e3);}catch(y){console.error("Failed to copy:",y);}},f=he?.estimated_price_impact_percent??0,R=he?.max_slippage_percent??.25,ne=he?.minimum_deposit_amount_usd??3;if($)return jsxRuntime.jsxs(reactNative.View,{style:s.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary}),jsxRuntime.jsx(reactNative.Text,{style:[s.loadingText,{color:n.foregroundMuted}],children:"Loading currencies..."})]});if(zt&&b.length===0)return jsxRuntime.jsxs(reactNative.View,{style:s.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.errorText,{color:n.error}],children:zt}),jsxRuntime.jsx(reactNative.Text,{style:[s.errorHint,{color:n.foregroundMuted}],children:"Please check your network connection and try again."})]});let yt=()=>jsxRuntime.jsxs(Y,{visible:Ne,onClose:()=>Le(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[s.sheetHeader,{borderBottomColor:n.border}],children:[jsxRuntime.jsx(reactNative.View,{style:s.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[s.sheetTitle,{color:n.foreground}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Le(false),style:s.sheetCloseButton,children:jsxRuntime.jsx(rt,{size:20,color:n.foreground,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:s.sheetList,showsVerticalScrollIndicator:false,children:b.map(y=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{w(y.symbol),Le(false);},style:[s.sheetItem,{backgroundColor:V===y.symbol?n.card:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:L(K(y,"png"))},style:s.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:s.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.sheetItemTitle,{color:n.foreground}],children:y.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[s.sheetItemSubtitle,{color:n.foregroundMuted}],children:[y.chains.length," network",y.chains.length!==1?"s":""," available"]})]}),V===y.symbol&&jsxRuntime.jsx(ie,{size:20,color:n.primary,strokeWidth:2})]},y.symbol))})]}),jt=()=>jsxRuntime.jsxs(Y,{visible:ft,onClose:()=>fe(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[s.sheetHeader,{borderBottomColor:n.border}],children:[jsxRuntime.jsx(reactNative.View,{style:s.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[s.sheetTitle,{color:n.foreground}],children:"Select Network"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>fe(false),style:s.sheetCloseButton,children:jsxRuntime.jsx(rt,{size:20,color:n.foreground,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:s.sheetList,showsVerticalScrollIndicator:false,children:Ot.map(y=>{let P=It(y.chain_id,y.chain_type),A=c===P;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{T(P),fe(false);},style:[s.sheetItem,{backgroundColor:A?n.card:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:L(K(y,"png"))},style:s.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:s.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.sheetItemTitle,{color:n.foreground}],children:y.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[s.sheetItemSubtitle,{color:n.foregroundMuted}],children:["Min deposit: $",y.minimum_deposit_amount_usd]})]}),A&&jsxRuntime.jsx(ie,{size:20,color:n.primary,strokeWidth:2})]},P)})})]});return jsxRuntime.jsxs(reactNative.View,{style:s.container,children:[jsxRuntime.jsxs(reactNative.View,{style:s.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.selectorLabel,{color:n.foregroundMuted}],children:"Token"}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Le(true),style:[s.selector,{backgroundColor:n.card}],children:[Ye&&jsxRuntime.jsx(reactNative.Image,{source:{uri:L(K(Ye,"png"))},style:s.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[s.selectorText,{color:n.foreground}],children:V}),jsxRuntime.jsx(me,{size:16,color:n.foregroundMuted,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:s.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[s.selectorLabel,{color:n.foregroundMuted}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:s.minDeposit,children:["($",ne," min)"]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>fe(true),style:[s.selector,{backgroundColor:n.card}],children:[he&&jsxRuntime.jsx(reactNative.Image,{source:{uri:L(K(he,"png"))},style:s.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[s.selectorText,{color:n.foreground}],numberOfLines:1,children:he?.chain_name||"Select network"}),jsxRuntime.jsx(me,{size:16,color:n.foregroundMuted,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:s.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[s.qrWrapper,{backgroundColor:n.background,borderColor:n.border}],children:B?jsxRuntime.jsxs(reactNative.View,{style:s.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:n.primary}),jsxRuntime.jsx(reactNative.Text,{style:[s.loadingText,{color:n.foregroundMuted}],children:"Loading..."})]}):be?jsxRuntime.jsx(Tt,{value:be,size:160,logoUri:L(K(he,"png")||le("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:s.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[s.errorText,{color:n.error}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:s.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:s.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.addressLabel,{color:n.foregroundMuted}],children:"Deposit Address"}),G&&jsxRuntime.jsxs(reactNative.View,{style:s.copiedIndicator,children:[jsxRuntime.jsx(ie,{size:14,color:n.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[s.copiedText,{color:n.success}],children:"Copied"})]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Ke,disabled:!be||B,activeOpacity:.7,style:[s.addressBox,{backgroundColor:n.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[s.addressText,{color:n.foreground}],numberOfLines:2,children:B?"Loading...":be||"No address available"})})]}),jsxRuntime.jsxs(reactNative.View,{style:[s.detailsCard,{backgroundColor:n.card}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>W(!re),style:s.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:s.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[s.detailIcon,{backgroundColor:n.cardHover}],children:jsxRuntime.jsx(Yo,{size:12,color:n.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[s.detailsLabel,{color:n.foregroundMuted}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:n.foreground},children:[f.toFixed(2),"%"]})]})]}),jsxRuntime.jsx(reactNative.View,{style:s.chevronContainer,children:re?jsxRuntime.jsx(Kt,{size:16,color:n.foregroundMuted,strokeWidth:2}):jsxRuntime.jsx(me,{size:16,color:n.foregroundMuted,strokeWidth:2})})]}),re&&jsxRuntime.jsxs(reactNative.View,{style:s.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:s.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[s.detailIcon,{backgroundColor:n.cardHover}],children:jsxRuntime.jsx(Ko,{size:12,color:n.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[s.detailsLabel,{color:n.foregroundMuted}],children:["Max slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:n.foreground},children:["Auto \u2022 ",R.toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:s.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[s.detailIcon,{backgroundColor:n.cardHover}],children:jsxRuntime.jsx(kt,{size:12,color:n.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[s.detailsLabel,{color:n.foregroundMuted}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{color:n.foreground},children:"< 1 min"})]})]}),jsxRuntime.jsxs(reactNative.View,{style:s.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[s.detailIcon,{backgroundColor:n.cardHover}],children:jsxRuntime.jsx(Zo,{size:12,color:n.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[s.detailsLabel,{color:n.foregroundMuted}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{color:n.foreground,textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(reactNative.View,{style:s.spacer}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:s.termsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[s.termsText,{color:n.foregroundMuted}],children:"Terms apply"})}),yt(),jt(),ke&&jsxRuntime.jsx(_t,{visible:Ee,status:ke.status,tokenIconUrl:ke.destination_token_metadata?.icon_urls?.find(y=>y.format==="png")?.url||ke.destination_token_metadata?.icon_url||K(Ye,"png"),explorerUrl:ke.explorer_url,completionExplorerUrl:ke.destination_explorer_url,onClose:()=>Ft(false)})]})}var s=reactNative.StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16,borderRadius:16,borderWidth:1},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{paddingHorizontal:12,paddingVertical:16,borderRadius:8},addressText:{fontSize:12,fontFamily:"monospace"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,paddingLeft:8,paddingRight:24},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13,flex:1},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center",paddingVertical:16},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingBottom:12},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"600",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{maxHeight:400,paddingTop:8},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2}});function Rt({currency:e,isSelected:t,onSelect:o}){let{colors:r}=_();return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>o(e.currency_code),activeOpacity:.7,style:[Oe.container,{backgroundColor:r.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:Oe.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Oe.iconContainer,{backgroundColor:r.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:L(K(e,"png"))},style:Oe.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Oe.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Oe.name,{color:r.foreground}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Oe.code,{color:r.foregroundMuted}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(ie,{size:16,color:r.foreground,strokeWidth:2})]})}var Oe=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,borderRadius:12,marginHorizontal:8,marginVertical:4},leftContent:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:40,height:40,borderRadius:20,overflow:"hidden",alignItems:"center",justifyContent:"center"},icon:{width:40,height:40,borderRadius:20},textContainer:{gap:2},name:{fontSize:14,fontWeight:"400"},code:{fontSize:12,fontWeight:"300"}});function pt({title:e,currencies:t,selectedCurrency:o,onSelect:r}){let{colors:l}=_();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:dr.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[dr.title,{color:l.foregroundMuted}],children:e})}),t.map(i=>jsxRuntime.jsx(Rt,{currency:i,isSelected:o.toLowerCase()===i.currency_code.toLowerCase(),onSelect:r},i.currency_code))]})}var dr=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Pt({open:e,onOpenChange:t,currencies:o,preferredCurrencyCodes:r,selectedCurrency:l,onSelectCurrency:i}){let{colors:a}=_(),[m,h]=react.useState(""),n=r.map(B=>o.find(E=>E.currency_code.toLowerCase()===B.toLowerCase())).filter(B=>B!==void 0),V=o.filter(B=>!r.includes(B.currency_code.toLowerCase())),w=B=>{if(!m)return B;let E=m.toLowerCase();return B.filter(b=>b.name.toLowerCase().includes(E)||b.currency_code.toLowerCase().includes(E))},c=w(n),T=w(V),N=B=>{i(B),t(false),h("");},q=()=>{t(false),h("");};return jsxRuntime.jsxs(Y,{visible:e,onClose:q,closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsx(se,{title:"Currency",showBack:false,onClose:q}),jsxRuntime.jsx(reactNative.View,{style:je.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[je.searchInput,{backgroundColor:a.card,color:a.foreground}],value:m,onChangeText:h,placeholder:"Search",placeholderTextColor:a.foregroundMuted})}),jsxRuntime.jsx(reactNative.ScrollView,{style:je.listContainer,showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{style:je.listContent,children:[jsxRuntime.jsx(pt,{title:"Popular currencies",currencies:c,selectedCurrency:l,onSelect:N}),c.length>0&&T.length>0&&jsxRuntime.jsx(reactNative.View,{style:je.sectionSpacer}),jsxRuntime.jsx(pt,{title:"All currencies",currencies:T,selectedCurrency:l,onSelect:N}),c.length===0&&T.length===0&&jsxRuntime.jsx(reactNative.View,{style:je.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[je.noResultsText,{color:a.foregroundMuted}],children:"No currencies found"})})]})})]})}var je=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:16,paddingBottom:12},searchInput:{padding:16,borderRadius:12,fontSize:14},listContainer:{height:400,paddingHorizontal:12},listContent:{paddingBottom:24,minHeight:400},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});var wn=[100,500,1e3];function fr(e){try{return new Intl.NumberFormat("en",{style:"currency",currency:e.toUpperCase(),minimumFractionDigits:0,maximumFractionDigits:0}).format(0).replace(/\d/g,"").trim()}catch{return e.toUpperCase()}}function Lt({userId:e,publishableKey:t,view:o,onViewChange:r,maxAmountUsd:l=5e4,destinationTokenSymbol:i="USDC",recipientAddress:a,destinationChainType:m,destinationChainId:h,destinationTokenAddress:n,onDepositSuccess:V,onDepositError:w}){let{colors:c}=_(),[T,N]=react.useState("500.00"),[q,B]=react.useState("usd"),[E,b]=react.useState([]),[p,$]=react.useState(false),[U,G]=react.useState(null),[oe,re]=react.useState("amount"),[W,Ne]=react.useState(null),[Le,ft]=react.useState([]),[fe,qe]=react.useState(true),[gt,Be]=react.useState(60),[$e,We]=react.useState([]),[zt,Qe]=react.useState([]),[Ee,Ft]=react.useState(null),[ke,Ut]=react.useState(false),[mt,Ge]=react.useState(false),ht=o??oe,uo=$e.find(f=>f.currency_code.toLowerCase()===q.toLowerCase()),po=react.useCallback(f=>{re(f),f==="quotes"?r?.(f,E.length):r?.(f);},[E.length,r]);react.useEffect(()=>{async function f(){try{let R=await Je({user_id:e,recipient_address:a,destination_chain_type:m,destination_chain_id:h,destination_token_address:n},t);ft(R.data);}catch(R){console.error("Error fetching wallets:",R),G("Failed to load wallet addresses");}finally{qe(false);}}f();},[e,a,m,h,n,t]),react.useEffect(()=>{async function f(){try{let R=await Qt(t);We(R.data),Qe(R.preferred||[]);}catch(R){console.error("Error fetching fiat currencies:",R);}}f();},[t]),react.useEffect(()=>{let f=parseFloat(T);if(isNaN(f)||f<=0){b([]);return}if(q.toLowerCase()==="usd"&&f>l){b([]),G(`Maximum amount is ${fr("usd")}${l.toLocaleString()}`);return}let R=setTimeout(()=>{fo(f);},500);return ()=>clearTimeout(R)},[T,q,l,t]);let fo=async f=>{$(true),G(null);try{let R={country_code:"US",destination_currency_code:"usdc_polygon",source_amount:f.toString(),source_currency_code:q.toLowerCase()},ne=await qt(R,t);if(b(ne.data),ne.data.length>0){let yt=ne.data.reduce((jt,y)=>y.destination_amount>jt.destination_amount?y:jt);Ne(yt);}Be(60);}catch(R){console.error("Failed to fetch quotes:",R),G("Failed to fetch quotes. Please try again."),b([]);}finally{$(false);}};react.useEffect(()=>{if(E.length===0)return;let f=setInterval(()=>{Be(R=>{if(R<=1){let ne=parseFloat(T);return !isNaN(ne)&&ne>0&&fo(ne),60}return R-1});},1e3);return ()=>clearInterval(f)},[E.length,T]);let be=f=>{(/^\d*\.?\d{0,2}$/.test(f)||f==="")&&N(f);},Ye=f=>{N(f.toFixed(2));},Ot=()=>W?W.destination_amount.toFixed(2):"0.00",he=async()=>{if(W)try{let f=Xe(Le,"ethereum");if(!f?.address){G("Wallet address not available");return}let R={service_provider:W.service_provider,country_code:W.country_code.toUpperCase(),destination_currency_code:W.destination_currency_code,source_currency_code:W.source_currency_code,wallet_address:f.address,source_amount:T},ne=await $t(R,t);Ft({provider:W,sourceCurrency:q,sourceAmount:T}),reactNative.Linking.openURL(ne.widget_url),po("onramp");}catch(f){console.error("Failed to create session:",f),G("Failed to start payment flow"),w?.({message:"Failed to start payment flow",error:f});}},Ke=fr(q);return ht==="amount"?jsxRuntime.jsxs(reactNative.View,{style:u.container,children:[jsxRuntime.jsx(reactNative.View,{style:u.currencySelector,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Ut(true),style:[u.currencyButton,{backgroundColor:c.card}],children:[uo&&jsxRuntime.jsx(reactNative.Image,{source:{uri:L(K(uo,"png"))},style:u.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[u.currencyText,{color:c.foreground}],children:q.toUpperCase()}),jsxRuntime.jsx(me,{size:16,color:c.foregroundMuted,strokeWidth:2})]})}),jsxRuntime.jsx(Pt,{open:ke,onOpenChange:Ut,currencies:$e,preferredCurrencyCodes:zt,selectedCurrency:q,onSelectCurrency:f=>{B(f.toLowerCase());}}),jsxRuntime.jsxs(reactNative.View,{style:u.amountContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:u.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[u.currencySymbol,{color:c.foreground}],children:Ke}),jsxRuntime.jsx(reactNative.TextInput,{style:[u.amountInput,{color:c.foreground}],value:T,onChangeText:be,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:c.foregroundMuted})]}),p?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:c.primary}):jsxRuntime.jsxs(reactNative.Text,{style:[u.usdcPreview,{color:c.foregroundMuted}],children:["\u2248 ",Ot()," ",i]})]}),jsxRuntime.jsx(reactNative.View,{style:u.quickAmounts,children:wn.map(f=>jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Ye(f),style:[u.quickAmountButton,{backgroundColor:c.card},parseFloat(T)===f&&{borderColor:c.primary,borderWidth:2}],children:jsxRuntime.jsxs(reactNative.Text,{style:[u.quickAmountText,{color:c.foreground}],children:[Ke,f.toLocaleString()]})},f))}),jsxRuntime.jsxs(reactNative.View,{style:u.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:u.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[u.providerLabel,{color:c.foreground}],children:"Provider"}),E.length>0&&!p&&jsxRuntime.jsxs(reactNative.Text,{style:[u.refreshText,{color:c.foregroundMuted}],children:["Refreshing in ",gt,"s"]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Ge(true),disabled:p||E.length===0,style:[u.providerButton,{backgroundColor:c.card},(p||E.length===0)&&u.disabled],children:p?jsxRuntime.jsxs(reactNative.View,{style:u.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:c.foregroundMuted}),jsxRuntime.jsx(reactNative.Text,{style:[u.loadingText,{color:c.foregroundMuted}],children:"Finding best rates..."})]}):W?jsxRuntime.jsxs(reactNative.View,{style:u.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:u.providerInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[u.autoPickedText,{color:c.foregroundMuted}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:u.providerRow,children:[jsxRuntime.jsx(ae,{uri:L(W.icon_url),width:32,height:32,borderRadius:8}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[u.providerName,{color:c.foreground}],children:W.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[u.bestPriceText,{color:c.success}],children:["Best price \u2022 ",W.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsxRuntime.jsx(nt,{size:20,color:c.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[u.noProviderText,{color:c.foregroundMuted}],children:parseFloat(T)>0?"No providers available":"Enter an amount to see providers"})}),U&&jsxRuntime.jsx(reactNative.Text,{style:[u.errorText,{color:c.error}],children:U})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:he,disabled:p||fe||!W||parseFloat(T)<=0,style:[u.continueButton,{backgroundColor:c.primary},(p||fe||!W)&&u.disabledButton],children:jsxRuntime.jsx(reactNative.Text,{style:u.continueButtonText,children:fe?"Loading...":`Buy ${i}`})}),jsxRuntime.jsxs(Y,{visible:mt,onClose:()=>Ge(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsx(se,{title:"Select Provider",showBack:false,onClose:()=>Ge(false),badge:E.length>0?{count:E.length}:void 0}),jsxRuntime.jsx(reactNative.ScrollView,{style:u.providerModalList,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:u.quotesList,children:[...E].sort((f,R)=>R.destination_amount-f.destination_amount).map((f,R)=>{let ne=W?.service_provider===f.service_provider,yt=R===0;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{Ne(f),Ge(false);},style:[u.quoteItem,{backgroundColor:c.card},ne&&{borderColor:c.primary,borderWidth:2}],children:[jsxRuntime.jsxs(reactNative.View,{style:u.quoteLeft,children:[jsxRuntime.jsx(ae,{uri:L(f.icon_url),width:32,height:32,borderRadius:8}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[u.quoteName,{color:c.foreground}],children:f.service_provider_display_name}),yt&&jsxRuntime.jsx(reactNative.Text,{style:[u.bestPriceLabel,{color:c.success}],children:"\u2713 Best price"})]})]}),jsxRuntime.jsxs(reactNative.View,{style:u.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[u.quoteAmount,{color:c.foreground}],children:[f.destination_amount.toFixed(2)," USDC"]}),jsxRuntime.jsxs(reactNative.Text,{style:[u.quoteSource,{color:c.foregroundMuted}],children:["Fee: ",Ke,f.total_fee.toFixed(2)]})]})]},f.service_provider)})})})]})]}):ht==="onramp"&&Ee?jsxRuntime.jsxs(reactNative.View,{style:[u.container,u.onrampContainer],children:[jsxRuntime.jsx(ae,{uri:L(Ee.provider.icon_url),width:48,height:48,borderRadius:12}),jsxRuntime.jsxs(reactNative.Text,{style:[u.onrampTitle,{color:c.foreground}],children:["Complete on ",Ee.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[u.onrampSubtitle,{color:c.foregroundMuted}],children:"You can close this modal. Your deposit will be processed automatically."}),jsxRuntime.jsxs(reactNative.View,{style:[u.flowDiagram,{backgroundColor:c.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:u.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(`/icons/currencies/png/${Ee.sourceCurrency.toLowerCase()}.png`)},style:u.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[u.flowLabel,{color:c.foregroundMuted}],children:"You pay"}),jsxRuntime.jsxs(reactNative.Text,{style:[u.flowValue,{color:c.foreground}],children:[Ke,Ee.sourceAmount]})]}),jsxRuntime.jsx(nt,{size:20,color:c.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:u.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le("/icons/tokens/png/usdc.png")},style:u.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[u.flowLabel,{color:c.foregroundMuted}],children:"You get"}),jsxRuntime.jsx(reactNative.Text,{style:[u.flowValue,{color:c.foreground}],children:i})]})]})]}):null}var u=reactNative.StyleSheet.create({container:{padding:16},currencySelector:{alignItems:"center",marginBottom:16},currencyButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8,borderRadius:8},currencyText:{fontSize:14,fontWeight:"500"},currencyIcon:{width:24,height:24,borderRadius:12},amountContainer:{alignItems:"center",marginBottom:24},amountInputRow:{flexDirection:"row",alignItems:"center",marginBottom:8},currencySymbol:{fontSize:48,fontWeight:"300"},amountInput:{fontSize:48,fontWeight:"300",minWidth:50},usdcPreview:{fontSize:14},quickAmounts:{flexDirection:"row",justifyContent:"center",gap:12,marginBottom:24},quickAmountButton:{paddingHorizontal:20,paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14,fontWeight:"500"},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16,borderRadius:12},disabled:{opacity:.5},providerLoading:{flexDirection:"row",alignItems:"center",gap:12},loadingText:{fontSize:14},providerContent:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},providerInfo:{flex:1},autoPickedText:{fontSize:12,marginBottom:8},providerRow:{flexDirection:"row",alignItems:"center",gap:12},providerIcon:{width:32,height:32,borderRadius:16},providerName:{fontSize:14,fontWeight:"500"},bestPriceText:{fontSize:11,marginTop:2},noProviderText:{fontSize:14,textAlign:"center"},errorText:{fontSize:12,marginTop:8},continueButton:{paddingVertical:16,borderRadius:12,alignItems:"center"},disabledButton:{opacity:.5},continueButtonText:{color:"#FFFFFF",fontSize:16,fontWeight:"600"},providerModalList:{height:468,paddingHorizontal:12,marginTop:8},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:16,borderRadius:12},quoteLeft:{flexDirection:"row",alignItems:"center",gap:12},quoteIcon:{width:40,height:40,borderRadius:20},quoteName:{fontSize:14,fontWeight:"500"},bestPriceLabel:{fontSize:11,marginTop:2},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{alignItems:"center",paddingTop:24},onrampIcon:{width:64,height:64,borderRadius:16,marginBottom:16},onrampTitle:{fontSize:20,fontWeight:"500",textAlign:"center",marginBottom:8},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-around",padding:16,borderRadius:12,width:"100%"},flowStep:{alignItems:"center"},flowIcon:{width:28,height:28,borderRadius:14,marginBottom:4},flowIconImage:{width:24,height:24,borderRadius:12,marginBottom:4},flowLabel:{fontSize:10},flowValue:{fontSize:14,fontWeight:"500"}});function Sn(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function _n(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Bt({execution:e,onPress:t}){let {colors:o}=_(),r=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let i=L(K(e.destination_token_metadata,"png")||le("/icons/tokens/png/usdc.png")),a=r?"Deposit Processing":"Deposit Completed",m=Sn(e.created_at||new Date().toISOString()),h=_n(e.source_amount_usd);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:t,activeOpacity:.7,style:[we.container,{backgroundColor:o.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:we.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:i},style:we.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[we.statusBadge,{backgroundColor:r?"#EAB308":"#22C55E"}],children:r?jsxRuntime.jsx(Zt,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(ie,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:we.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[we.title,{color:o.foreground}],children:a}),jsxRuntime.jsx(reactNative.Text,{style:[we.dateTime,{color:o.foregroundMuted}],children:m})]}),jsxRuntime.jsxs(reactNative.View,{style:we.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[we.amount,{color:o.foreground}],children:h}),jsxRuntime.jsx(nt,{size:20,color:o.foregroundMuted,strokeWidth:2})]})]})}var we=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12,borderRadius:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2,borderColor:"#1C1C1E"},textContainer:{flex:1,gap:2},title:{fontSize:16,fontWeight:"500"},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16,fontWeight:"500"}});var{height:Rn}=reactNative.Dimensions.get("window");function hr(e,t){let o={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||o[e]||e:o[e]||e}function yr(e,t=6){try{return e?(Number(e)/Math.pow(10,t)).toFixed(2):"0.00"}catch{return "0.00"}}function Pn(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Cr=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function xr(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Vn(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function Wt({visible:e,onClose:t,executions:o,userId:r,publishableKey:l}){let{colors:i}=_(),[a,m]=react.useState(o),[h,n]=react.useState(false),[V,w]=react.useState(null),[c,T]=react.useState(false);react.useEffect(()=>{if(!e||!r)return;let p=async()=>{n(true);try{let G=[...(await et(r,l)).data].sort((oe,re)=>{let W=oe.created_at?new Date(oe.created_at).getTime():0;return (re.created_at?new Date(re.created_at).getTime():0)-W});m(G);}catch(U){console.error("Failed to fetch executions:",U),m(o);}finally{n(false);}};p();let $=setInterval(p,1e4);return ()=>clearInterval($)},[e,r,l,o]),react.useEffect(()=>{o.length>0&&m(p=>{let $=new Set(p.map(G=>G.id)),U=o.filter(G=>!$.has(G.id));return U.length>0?[...U,...p]:p});},[o]),react.useEffect(()=>{e||w(null);},[e]);let N=p=>{w(p);},q=()=>{w(null),T(false);},B=()=>{w(null),t();};return jsxRuntime.jsxs(Y,{visible:e,onClose:B,closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsx(se,{title:V?"Deposit Details":"Deposit Tracker",onClose:B,showClose:!V,showBack:!!V,onBack:q}),V?(()=>{if(!V)return null;let p=V,$=p.status==="pending"||p.status==="waiting"||p.status==="delayed",U=p.status==="succeeded",G=L(K(p.destination_token_metadata,"png")||le("/icons/tokens/png/usdc.png")),oe=p.provider_metadata?.details,re=oe?.currencyIn,W=oe?.currencyOut;re?.currency?.symbol||"USDC";W?.currency?.symbol||"USDC";let ft=yr(p.source_amount_base_unit),fe=yr(p.destination_amount_base_unit),qe=Pn(p.source_amount_usd),gt=hr(p.source_chain_type,p.source_chain_id),Be=hr(p.destination_chain_type,p.destination_chain_id),$e=()=>{p.explorer_url&&reactNative.Linking.openURL(p.explorer_url);},We=()=>{p.destination_explorer_url&&reactNative.Linking.openURL(p.destination_explorer_url);};return jsxRuntime.jsxs(reactNative.ScrollView,{style:g.scrollContainer,contentContainerStyle:g.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:g.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:g.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:G},style:g.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[g.statusBadge,{backgroundColor:$?"#EAB308":"#22C55E"}],children:$?jsxRuntime.jsx(me,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(ie,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:g.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[g.statusDot,{backgroundColor:$?"#EAB308":"#22C55E"}]}),jsxRuntime.jsx(reactNative.Text,{style:[g.statusText,{color:i.foreground}],children:$?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[g.dateText,{color:i.foregroundMuted}],children:Vn(p.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[g.card,{backgroundColor:i.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:g.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.cardLabel,{color:i.foregroundMuted}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[g.cardValue,{color:i.foreground}],children:[ft," ",xr(p.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[g.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:g.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.cardLabel,{color:i.foregroundMuted}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[g.cardValue,{color:i.foreground}],children:[fe," ",xr(p.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[g.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:g.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.cardLabel,{color:i.foregroundMuted}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[g.cardValue,{color:i.foreground}],children:qe})]}),jsxRuntime.jsx(reactNative.View,{style:[g.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:g.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.cardLabel,{color:i.foregroundMuted}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[g.cardValue,{color:i.foreground}],children:gt})]}),jsxRuntime.jsx(reactNative.View,{style:[g.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:g.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.cardLabel,{color:i.foregroundMuted}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[g.cardValue,{color:i.foreground}],children:Be})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>T(!c),style:g.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.toggleText,{color:i.foregroundMuted}],children:c?"See less":"See more details"}),c?jsxRuntime.jsx(Kt,{size:14,color:i.foregroundMuted,strokeWidth:2}):jsxRuntime.jsx(me,{size:14,color:i.foregroundMuted,strokeWidth:2})]}),c&&jsxRuntime.jsxs(reactNative.View,{style:[g.card,{backgroundColor:i.card}],children:[p.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:$e,style:g.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.cardLabel,{color:i.foregroundMuted}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:g.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.cardValue,{color:i.foreground}],children:Cr(p.transaction_hash)}),jsxRuntime.jsx(Yt,{size:14,color:i.foregroundMuted,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[g.cardDivider,{backgroundColor:i.border}]})]}),p.destination_explorer_url&&U&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:We,style:g.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.cardLabel,{color:i.foregroundMuted}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:g.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.cardValue,{color:i.foreground}],children:Cr(p.destination_transaction_hashes[0])}),jsxRuntime.jsx(Yt,{size:14,color:i.foregroundMuted,strokeWidth:2})]})]})]})]})})():jsxRuntime.jsx(reactNative.ScrollView,{style:g.scrollContainer,contentContainerStyle:g.scrollContent,showsVerticalScrollIndicator:false,children:a.length===0?jsxRuntime.jsxs(reactNative.View,{style:g.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[g.emptyText,{color:i.foregroundMuted}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[g.emptySubtext,{color:i.foregroundMuted}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:g.executionsList,children:a.map(p=>jsxRuntime.jsx(Bt,{execution:p,onPress:()=>N(p)},p.id))})})]})}var g=reactNative.StyleSheet.create({scrollContainer:{maxHeight:Rn*.7,paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:16},emptyContainer:{paddingVertical:40,paddingHorizontal:16,alignItems:"center"},emptyText:{fontSize:14,marginBottom:4},emptySubtext:{fontSize:12},executionsList:{paddingTop:8,gap:12},detailsContent:{paddingHorizontal:16,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},iconWrapper:{position:"relative",marginBottom:12},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",bottom:0,right:0,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center",borderWidth:3,borderColor:"#1C1C1E"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardRowRight:{flexDirection:"row",alignItems:"center",gap:8},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"},toggleButton:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12,paddingHorizontal:4},toggleText:{fontSize:14},buttonSection:{marginTop:12,gap:10},actionButton:{flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:16,borderRadius:12},buttonIconLeft:{marginRight:12},buttonIconRight:{marginLeft:12},buttonText:{color:"#FFFFFF",fontSize:14,fontWeight:"600",flex:1,textAlign:"left"},hintText:{fontSize:12,textAlign:"center",marginTop:8}});var He={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function En({visible:e,onClose:t,userId:o,publishableKey:r,modalTitle:l="Deposit",destinationTokenSymbol:i,recipientAddress:a,destinationChainType:m,destinationChainId:h,destinationTokenAddress:n,hideDepositTracker:V=false,onDepositSuccess:w,onDepositError:c}){let[T,N]=react.useState([]),[q,B]=react.useState(false),[E,b]=react.useState(false),[p,$]=react.useState(false),[U,G]=react.useState(null);react.useEffect(()=>{e&&!U&&Gt(r).then(G).catch(console.error);},[e,U,r]);let oe=()=>{t();},re=T.filter(W=>W.status==="pending"||W.status==="waiting").length;return jsxRuntime.jsxs(Y,{visible:e,onClose:oe,closeOnBackdropPress:false,showHandle:false,children:[jsxRuntime.jsx(se,{title:l,showBack:false,onClose:oe}),jsxRuntime.jsxs(reactNative.View,{style:Mt.optionsContainer,children:[jsxRuntime.jsx(at,{onPress:()=>b(true),title:He.transferCrypto.title,subtitle:He.transferCrypto.subtitle,featuredTokens:U?.transfer_crypto?.networks}),jsxRuntime.jsx(ct,{onPress:()=>$(true),title:He.depositWithCard.title,subtitle:He.depositWithCard.subtitle,paymentNetworks:U?.payment_networks?.networks}),!V&&jsxRuntime.jsx(dt,{onPress:()=>B(true),title:He.depositTracker.title,subtitle:He.depositTracker.subtitle,badge:re>0?re:void 0})]}),jsxRuntime.jsx(Wt,{visible:q,onClose:()=>B(false),executions:T,userId:o,publishableKey:r}),jsxRuntime.jsxs(Y,{visible:E,onClose:()=>b(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.95,children:[jsxRuntime.jsx(se,{title:He.transferCrypto.title,showBack:false,onClose:()=>b(false)}),jsxRuntime.jsx(reactNative.ScrollView,{style:Mt.transferScrollContainer,contentContainerStyle:Mt.scrollContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(vt,{userId:o,publishableKey:r,recipientAddress:a,destinationChainType:m,destinationChainId:h,destinationTokenAddress:n,onExecutionsChange:N,onDepositSuccess:w,onDepositError:c})})]}),jsxRuntime.jsxs(Y,{visible:p,onClose:()=>$(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.95,children:[jsxRuntime.jsx(se,{title:"Add Funds",showBack:false,onClose:()=>$(false)}),jsxRuntime.jsx(reactNative.ScrollView,{style:Mt.transferScrollContainer,contentContainerStyle:Mt.scrollContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(Lt,{userId:o,publishableKey:r,destinationTokenSymbol:i,recipientAddress:a,destinationChainType:m,destinationChainId:h,destinationTokenAddress:n,onDepositSuccess:w,onDepositError:c})})]})]})}function At({theme:e="auto",...t}){return jsxRuntime.jsx(Ze,{mode:e,children:jsxRuntime.jsx(En,{...t})})}var Mt=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24}});reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:12,gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});function Bo({uri:e,size:t=24,style:o,borderRadius:r}){return jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:[Fn.icon,{width:t,height:t,borderRadius:r??t/2},o],resizeMode:"contain"})}var Fn=reactNative.StyleSheet.create({icon:{backgroundColor:"transparent"}});var Qn=()=>new reactQuery.QueryClient({defaultOptions:{queries:{staleTime:6e4,retry:1}}}),br=react.createContext(null);function Gn({children:e,publishableKey:t,config:o}){let[r]=react.useState(()=>Qn()),[l,i]=react.useState(false),[a,m]=react.useState(null),h=reactNative.useColorScheme(),n=react.useRef(false);!n.current&&o?.apiBaseUrl&&(console.log(`[UnifoldProvider] Setting API config SYNC - baseUrl: ${o.apiBaseUrl}`),xt({baseUrl:o.apiBaseUrl,publishableKey:t}),n.current=true);let V=react.useMemo(()=>{let b=o?.appearance||"dark";return b==="auto"?h==="dark"?"dark":"light":b},[o?.appearance,h]);react.useEffect(()=>{if(!t||t.trim()===""){console.error("Unifold: publishableKey is required. Please provide a valid publishable key.");return}!t.startsWith("pk_test_")&&!t.startsWith("pk_live_")&&console.warn('Unifold: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),console.log(`[UnifoldProvider] Setting API config in useEffect - baseUrl: ${o?.apiBaseUrl}`),xt({baseUrl:o?.apiBaseUrl,publishableKey:t});},[t,o?.apiBaseUrl]);let w=react.useRef(null),c=react.useRef(null),T=react.useCallback(b=>{console.log("[UnifoldProvider] beginDeposit called with:",b),c.current&&(clearTimeout(c.current),c.current=null),w.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),w.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),w.current=null);let p=new Promise(($,U)=>{w.current={resolve:$,reject:U};});return m(b),i(true),p},[]),N=react.useCallback(()=>{w.current&&(w.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),w.current=null),i(false),c.current=setTimeout(()=>{m(null),c.current=null;},200);},[]),q=react.useCallback(b=>{console.log("[UnifoldProvider] Deposit success:",b),a?.onSuccess&&a.onSuccess(b),w.current&&(w.current.resolve(b),w.current=null);},[a]),B=react.useCallback(b=>{console.error("[UnifoldProvider] Deposit error:",b),a?.onError&&a.onError(b),w.current&&(w.current.reject(b),w.current=null);},[a]),E=react.useMemo(()=>({publishableKey:t,beginDeposit:T,closeDeposit:N}),[t,T,N]);return jsxRuntime.jsx(reactQuery.QueryClientProvider,{client:r,children:jsxRuntime.jsx(br.Provider,{value:E,children:jsxRuntime.jsxs(Ze,{mode:V,children:[e,a&&jsxRuntime.jsx(At,{visible:l,onClose:N,userId:a.userId,publishableKey:t,modalTitle:o?.modalTitle,destinationTokenSymbol:a.destinationTokenSymbol,recipientAddress:a.recipientAddress,destinationChainId:a.destinationChainId,destinationTokenAddress:a.destinationTokenAddress,hideDepositTracker:o?.hideDepositTracker,onDepositSuccess:q,onDepositError:B,theme:V})]})})})}function Yn(){let e=react.useContext(br);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}exports.BottomSheet=Y;exports.BuyWithCard=Lt;exports.CurrencyListItem=Rt;exports.CurrencyListSection=pt;exports.CurrencyModal=Pt;exports.DepositExecutionItem=Bt;exports.DepositHeader=se;exports.DepositModal=At;exports.DepositStatusSheet=_t;exports.DepositTrackerButton=dt;exports.DepositWithCardButton=ct;exports.DepositsModal=Wt;exports.ExecutionStatus=Ae;exports.Icon=Bo;exports.QRCode=Tt;exports.RemoteIcon=ae;exports.SOLANA_USDC_ADDRESS=Oo;exports.ThemeProvider=Ze;exports.TransferCrypto=vt;exports.TransferCryptoButton=at;exports.UnifoldProvider=Gn;exports.createDepositAddress=go;exports.createEOA=Je;exports.createMeldSession=$t;exports.getApiBaseUrl=Fo;exports.getChainName=No;exports.getFiatCurrencies=Qt;exports.getIconUrl=le;exports.getIconUrlWithCdn=Uo;exports.getMeldQuotes=qt;exports.getPreferredIcon=K;exports.getPreferredIconUrl=jo;exports.getProjectConfig=Gt;exports.getSupportedDepositTokens=Nt;exports.getTokenChains=Ho;exports.getWalletByChainType=Xe;exports.normalizeIconUrl=L;exports.queryExecutions=et;exports.setApiConfig=xt;exports.useTheme=_;exports.useUnifold=Yn;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {createContext,useMemo,useContext,useRef,useEffect,useState,useCallback}from'react';import {Dimensions,StyleSheet,Platform,useColorScheme,Animated,Modal,KeyboardAvoidingView,TouchableWithoutFeedback,View,TouchableOpacity,Text,Image,Easing,ActivityIndicator,TextInput,ScrollView,Linking,Clipboard}from'react-native';import {QueryClient,QueryClientProvider}from'@tanstack/react-query';import {jsx,jsxs}from'react/jsx-runtime';import te,{SvgUri,Line,Polyline,Path,Rect,Circle}from'react-native-svg';import Qr from'react-native-qrcode-svg';var Ao={background:"#ffffff",foreground:"#0f0f0f",foregroundMuted:"#737373",card:"#f5f5f5",cardHover:"#e5e5e5",border:"#e5e5e5",overlay:"rgba(0, 0, 0, 0.5)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},vr={background:"#0f0f0f",foreground:"#fafafa",foregroundMuted:"#a3a3a3",card:"#262626",cardHover:"#404040",border:"#333333",overlay:"rgba(0, 0, 0, 0.7)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},zo=createContext({colors:Ao,isDark:false,mode:"auto"});function Ze({children:e,mode:t="auto"}){let o=useColorScheme(),r=useMemo(()=>{let l;return t==="auto"?l=o==="dark":l=t==="dark",{colors:l?vr:Ao,isDark:l,mode:t}},[t,o]);return jsx(zo.Provider,{value:r,children:e})}function _(){let e=useContext(zo);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}var ee="https://api.unifold.io",_e="pk_test_123",Ht={};function xt(e){if(e.publishableKey!==void 0){if(!e.publishableKey||e.publishableKey.trim()==="")throw new Error("Unifold SDK: publishableKey cannot be empty. Please provide a valid publishable key.");!e.publishableKey.startsWith("pk_test_")&&!e.publishableKey.startsWith("pk_live_")&&console.warn('Unifold SDK: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),_e=e.publishableKey;}e.baseUrl&&(ee=e.baseUrl),e.defaultConfig&&(Ht=e.defaultConfig);}function Fo(){return ee}function Me(e){if(!e||e.trim()==="")throw new Error("Unifold SDK: No publishable key configured. Please provide a valid publishable key via setApiConfig() or pass it directly to the API function.");e==="pk_test_123"&&console.warn('Unifold SDK: Using default test key "pk_test_123". This should only be used for local development. Please use a real publishable key in production.');}function le(e){let t=e.startsWith("/")?e:`/${e}`;return `${ee}/api/public${t}`}function Uo(e,t){if(!t)return le(e);let o=e.startsWith("/")?e:`/${e}`;return `${t.endsWith("/")?t.slice(0,-1):t}/api/public${o}`}function L(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,ee):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${ee}${e}`:`${ee}/api/public${e}`:""}async function go(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||Ht.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Ht.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e?.recipient_address||Ht.recipientAddress||"0x309a4154a2CD4153Da886E780890C9cb5161553C",client_metadata:e?.client_metadata||{}},r=t||_e;Me(r);let l=await fetch(`${ee}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!l.ok)throw new Error(`Failed to create deposit address: ${l.statusText}`);return l.json()}async function Je(e,t){return go(e?{...e,external_user_id:e.user_id}:void 0,t)}function Xe(e,t){return e.find(o=>o.chain_type===t)}var Ae=(a=>(a.DELAYED="delayed",a.FAILED="failed",a.PENDING="pending",a.REFUNDED="refunded",a.SUCCEEDED="succeeded",a.WAITING="waiting",a))(Ae||{}),Oo="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";async function et(e,t){let o=t||_e;Me(o);let r=await fetch(`${ee}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e})});if(!r.ok)throw new Error(`Failed to query executions: ${r.statusText}`);return r.json()}function K(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let o=e.icon_urls.find(r=>r.format===t);return o?o.url:e.icon_url}async function Nt(e){let t=e||_e;Me(t);let o=await fetch(`${ee}/v1/public/tokens/supported_deposit_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch supported deposit tokens: ${o.statusText}`);return o.json()}async function qt(e,t){let o=t||_e;Me(o);let r=await fetch(`${ee}/v1/public/onramps/meld/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to fetch Meld quotes: ${r.statusText}`);return r.json()}async function $t(e,t){let o=t||_e;Me(o);let r=await fetch(`${ee}/v1/public/onramps/meld/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to create Meld session: ${r.statusText}`);return r.json()}async function Qt(e){let t=e||_e;Me(t);let o=await fetch(`${ee}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch fiat currencies: ${o.statusText}`);return o.json()}function jo(e,t="png"){if(!e||e.length===0)return;let o=e.find(r=>r.format===t);return o?o.url:e[0]?.url}async function Gt(e){let t=e||_e;Me(t);let o=await fetch(`${ee}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch project config: ${o.statusText}`);return o.json()}async function Ho(){let e=await fetch(`${ee}/v1/public/tokens/chains`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch token chains: ${e.statusText}`);return e.json()}function No(e,t,o){let r=e.find(i=>i.chain_id===o);if(r)return r.chain_name;let l=e.find(i=>i.chain_type===t);return l?l.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}var{height:wt}=Dimensions.get("window");function Y({visible:e,onClose:t,children:o,closeOnBackdropPress:r=true,showHandle:l=true,heightPercent:i}){let{colors:a}=_(),m=useRef(new Animated.Value(wt)).current,h=useRef(new Animated.Value(0)).current;useEffect(()=>{e?(m.setValue(wt),h.setValue(0),Animated.parallel([Animated.spring(m,{toValue:0,useNativeDriver:true,tension:65,friction:11}),Animated.timing(h,{toValue:.5,duration:200,useNativeDriver:true})]).start()):Animated.parallel([Animated.spring(m,{toValue:wt,useNativeDriver:true,tension:65,friction:11}),Animated.timing(h,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,m,h]);let n=()=>{r&&t();};return jsx(Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxs(KeyboardAvoidingView,{behavior:Platform.OS==="ios"?"padding":"height",style:ze.container,children:[jsx(TouchableWithoutFeedback,{onPress:n,children:jsx(Animated.View,{style:[ze.backdrop,{backgroundColor:"#000000",opacity:h}]})}),jsxs(Animated.View,{style:[ze.sheet,{backgroundColor:a.background,borderTopLeftRadius:24,borderTopRightRadius:24,transform:[{translateY:m}],...i&&{height:wt*i}}],children:[l&&jsx(View,{style:ze.handleContainer,children:jsx(View,{style:[ze.handle,{backgroundColor:a.border}]})}),jsx(View,{style:[ze.content,i&&ze.contentFlex],children:o})]})]})})}var ze=StyleSheet.create({container:{flex:1,justifyContent:"flex-end"},backdrop:{...StyleSheet.absoluteFillObject},sheet:{maxHeight:wt*.9,paddingBottom:Platform.OS==="ios"?34:24,shadowColor:"#000",shadowOffset:{width:0,height:-4},shadowOpacity:.1,shadowRadius:12,elevation:16},handleContainer:{alignItems:"center",paddingVertical:12},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});function ho({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(te,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function yo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(te,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function kt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(te,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Co({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(te,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function rt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(te,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function nt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(te,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function me({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(te,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function ie({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(te,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Yt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(te,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Yo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(te,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ko({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(te,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Zo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(te,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Kt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(te,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Zt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(te,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function se({title:e,showBack:t=false,showClose:o=true,onBack:r,onClose:l,badge:i}){let{colors:a}=_();return jsxs(View,{style:ue.header,children:[jsx(View,{style:ue.leftContainer,children:t&&r?jsx(TouchableOpacity,{onPress:r,style:[ue.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Co,{size:20,color:a.foreground,strokeWidth:2})}):jsx(View,{style:ue.spacer})}),jsxs(View,{style:ue.titleContainer,children:[jsx(Text,{style:[ue.title,{color:a.foreground}],children:e}),i&&i.count>0&&jsx(View,{style:[ue.titleBadge,{backgroundColor:a.card}],children:jsx(Text,{style:[ue.titleBadgeText,{color:a.foregroundMuted}],children:i.count})})]}),jsx(View,{style:ue.rightContainer,children:o?jsx(TouchableOpacity,{onPress:l,style:[ue.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(rt,{size:20,color:a.foreground,strokeWidth:2})}):jsx(View,{style:ue.spacer})})]})}var ue=StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},leftContainer:{width:40,alignItems:"flex-start"},rightContainer:{width:40,alignItems:"flex-end"},titleContainer:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,fontWeight:"500",textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function ae({uri:e,width:t,height:o,borderRadius:r=0,borderWidth:l=0,borderColor:i="transparent",backgroundColor:a="transparent",style:m}){let[h,n]=useState(false),V=e?.toLowerCase().endsWith(".svg");if(!e)return jsx(View,{style:[{width:t,height:o,borderRadius:r,backgroundColor:"#374151"},m]});let w={width:t,height:o,borderRadius:r,borderWidth:l,borderColor:i,backgroundColor:a,overflow:"hidden",alignItems:"center",justifyContent:"center",...m},c=t-l*2,T=o-l*2;return h?jsx(View,{style:[w,{backgroundColor:a||"#374151"}]}):V?jsx(View,{style:w,children:jsx(SvgUri,{uri:e,width:c,height:T,onError:N=>{console.log(`[RemoteIcon] SVG load error for ${e}:`,N),n(true);}})}):jsx(View,{style:w,children:jsx(Image,{source:{uri:e},style:{width:c,height:T},resizeMode:"contain",onError:N=>{console.log(`[RemoteIcon] Image load error for ${e}:`,N.nativeEvent.error),n(true);}})})}function at({onPress:e,title:t,subtitle:o,featuredTokens:r}){let{colors:l}=_(),i=r?[...r].sort((a,m)=>a.position-m.position):[];return jsxs(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[ye.container,{backgroundColor:l.card}],children:[jsxs(View,{style:ye.leftContent,children:[jsx(View,{style:[ye.iconContainer,{backgroundColor:l.cardHover}],children:jsx(ho,{size:20,color:l.foreground,strokeWidth:2})}),jsxs(View,{style:ye.textContainer,children:[jsx(Text,{style:[ye.title,{color:l.foreground}],children:t}),jsx(Text,{style:[ye.subtitle,{color:l.foregroundMuted}],children:o})]})]}),jsx(View,{style:ye.rightContent,children:jsx(View,{style:ye.networkIcons,children:i.map((a,m)=>{let h=a.icon_urls.find(n=>n.format==="png")?.url||a.icon_urls.find(n=>n.format==="svg")?.url;return jsx(View,{style:[ye.networkIconWrapper,{marginLeft:m===0?0:-6,zIndex:i.length-m}],children:jsx(ae,{uri:L(h),width:20,height:20,borderRadius:10,borderWidth:2,borderColor:l.card})},a.name)})})})]})}var ye=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},networkIcons:{flexDirection:"row",alignItems:"center"},networkIconWrapper:{}});function ct({onPress:e,title:t,subtitle:o,paymentNetworks:r}){let{colors:l}=_();return jsxs(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Re.container,{backgroundColor:l.card}],children:[jsxs(View,{style:Re.leftContent,children:[jsx(View,{style:[Re.iconContainer,{backgroundColor:l.cardHover}],children:jsx(yo,{size:20,color:l.foreground,strokeWidth:2})}),jsxs(View,{style:Re.textContainer,children:[jsx(Text,{style:[Re.title,{color:l.foreground}],children:t}),jsx(Text,{style:[Re.subtitle,{color:l.foregroundMuted}],children:o})]})]}),jsx(View,{style:Re.rightContent,children:jsx(View,{style:Re.paymentIcons,children:r?.map(i=>{let a=i.icon_urls.find(m=>m.format==="png")?.url||i.icon_urls.find(m=>m.format==="svg")?.url;return jsx(ae,{uri:L(a),width:32,height:20,borderRadius:4},i.name)})})})]})}var Re=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},paymentIcons:{flexDirection:"row",alignItems:"center",gap:6}});function dt({onPress:e,title:t,subtitle:o,badge:r}){let{colors:l}=_();return jsx(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Pe.container,{backgroundColor:l.card}],children:jsxs(View,{style:Pe.leftContent,children:[jsxs(View,{style:[Pe.iconContainer,{backgroundColor:l.cardHover}],children:[jsx(kt,{size:20,color:l.foreground,strokeWidth:2}),r!==void 0&&r>0&&jsx(View,{style:[Pe.badge,{backgroundColor:l.primary}],children:jsx(Text,{style:Pe.badgeText,children:r>99?"99+":r})})]}),jsxs(View,{style:Pe.textContainer,children:[jsx(Text,{style:[Pe.title,{color:l.foreground}],children:t}),jsx(Text,{style:[Pe.subtitle,{color:l.foregroundMuted}],children:o})]})]})})}var Pe=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,borderRadius:9,alignItems:"center",justifyContent:"center",paddingHorizontal:4},badgeText:{color:"#FFFFFF",fontSize:10,fontWeight:"600"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function Tt({value:e,size:t=180,logoUri:o,logoSize:r=40,logoBackgroundColor:l}){let{colors:i,isDark:a}=_(),m=a?"#1a1a1a":"#ffffff",h=a?"#ffffff":"#000000",n=l||m;return jsxs(View,{style:[nr.container,{width:t,height:t}],children:[jsx(Qr,{value:e||"placeholder",size:t,backgroundColor:m,color:h,ecl:"H",quietZone:4}),o&&jsx(View,{style:[nr.logoContainer,{width:r+12,height:r+12,backgroundColor:n,borderRadius:(r+12)/2}],children:jsx(ae,{uri:o,width:r,height:r,borderRadius:r/2})})]})}var nr=StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function _t({visible:e,status:t,tokenIconUrl:o,explorerUrl:r,completionExplorerUrl:l,onClose:i}){let{colors:a}=_(),m=useRef(new Animated.Value(0)).current,h=t==="pending"||t==="waiting"||t==="delayed",n=t==="succeeded";useEffect(()=>{if(h&&e){let T=Animated.loop(Animated.timing(m,{toValue:1,duration:1e3,easing:Easing.linear,useNativeDriver:true}));return T.start(),()=>T.stop()}else m.setValue(0);},[h,e,m]);let V=m.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]}),w=()=>{r&&Linking.openURL(r);},c=()=>{l&&Linking.openURL(l);};return jsx(Y,{visible:e,onClose:i,closeOnBackdropPress:true,showHandle:false,children:jsxs(View,{style:j.container,children:[jsxs(View,{style:j.iconContainer,children:[o?jsx(Image,{source:{uri:L(o)},style:j.tokenIcon}):jsx(View,{style:[j.tokenIcon,{backgroundColor:a.cardHover}]}),jsx(View,{style:[j.statusBadge,{backgroundColor:h?"#F97316":"#22C55E"}],children:h?jsx(Animated.View,{style:{transform:[{rotate:V}]},children:jsx(Zt,{size:16,color:"#fff",strokeWidth:2.5})}):jsx(ie,{size:16,color:"#fff",strokeWidth:3})})]}),jsx(Text,{style:[j.title,{color:a.foreground}],children:h?"Deposit Processing":"Deposit Complete"}),jsx(Text,{style:[j.subtitle,{color:a.foregroundMuted}],children:h?`Your deposit is being processed.
|
|
2
|
+
This usually takes less than a minute.`:"Your account has been credited successfully!"}),h?jsx(TouchableOpacity,{onPress:i,style:[j.button,j.dismissButton],children:jsx(Text,{style:j.buttonText,children:"Dismiss"})}):jsxs(View,{style:j.buttonRow,children:[jsx(TouchableOpacity,{onPress:w,style:[j.button,j.successButton,j.halfButton],children:jsx(Text,{style:j.buttonText,children:"View deposit tx"})}),jsx(TouchableOpacity,{onPress:c,style:[j.button,j.successButton,j.halfButton],children:jsx(Text,{style:j.buttonText,children:"View completion tx"})})]}),n&&jsx(Text,{style:[j.hint,{color:a.foregroundMuted}],children:"Opens in external browser"})]})})}var j=StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:24,paddingBottom:20},iconContainer:{position:"relative",marginBottom:20},tokenIcon:{width:64,height:64,borderRadius:32},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},subtitle:{fontSize:14,textAlign:"center",marginBottom:24,lineHeight:20},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},dismissButton:{backgroundColor:"#F97316",width:"100%"},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});var It=(e,t)=>`${t}:${e}`,on=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function vt({userId:e,publishableKey:t,recipientAddress:o,destinationChainType:r,destinationChainId:l,destinationTokenAddress:i,onExecutionsChange:a,onDepositSuccess:m,onDepositError:h}){let{colors:n}=_(),[V,w]=useState("USDC"),[c,T]=useState("solana:mainnet"),[N,q]=useState([]),[B,E]=useState(true),[b,p]=useState([]),[$,U]=useState(true),[G,oe]=useState(false),[re,W]=useState(false),[Ne,Le]=useState(false),[ft,fe]=useState(false),[qe,gt]=useState([]),[Be,$e]=useState(new Map),[We]=useState(()=>new Date),[zt,Qe]=useState(null),[Ee,Ft]=useState(false),[ke,Ut]=useState(null),mt=new Map;b.forEach(y=>{y.chains.forEach(P=>{let A=`${P.chain_type}:${P.chain_id}`;mt.has(A)||mt.set(A,P);});});let Ge=Array.from(mt.values()),ht=on(c),po=Ge.find(y=>y.chain_type===ht.chainType&&y.chain_id===ht.chainId)?.chain_type||"ethereum",be=Xe(N,po)?.address||"";useEffect(()=>{async function y(){try{U(!0),Qe(null);let P=await Nt(t);if(p(P.data),P.data.length>0){let A=P.data[0];if(w(A.symbol),A.chains.length>0){let O=A.chains[0];T(It(O.chain_id,O.chain_type));}}}catch(P){console.error("Error fetching supported tokens:",P),Qe("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:P});}finally{U(false);}}y();},[t,h]),useEffect(()=>{async function y(){try{E(!0),Qe(null);let P=await Je({user_id:e,recipient_address:o,destination_chain_type:r,destination_chain_id:l,destination_token_address:i},t);q(P.data);}catch(P){console.error("Error fetching wallets:",P),Qe("Failed to load wallets"),h?.({message:"Failed to load wallets",error:P});}finally{E(false);}}y();},[e,o,r,l,i,t,h]),useEffect(()=>{if(!e||!We)return;let y=setInterval(async()=>{try{let P=await et(e,t),A=null;for(let O of P.data){let Te=O.created_at?new Date(O.created_at):null;if(!Te||Te<=We)continue;let Se=Be.get(O.id);if(!Se){A=O;break}if(["pending","waiting","delayed"].includes(Se)&&O.status==="succeeded"){A=O;break}}if(A){let O=A;gt(Te=>{let Se=Te.findIndex(Ct=>Ct.id===O.id);if(Se>=0){let Ct=[...Te];return Ct[Se]=O,Ct}else return [...Te,O]}),$e(Te=>{let Se=new Map(Te);return Se.set(O.id,O.status),Se}),Ut(O),Ft(!0),O.status==="succeeded"&&m?.({message:"Deposit completed successfully",executionId:O.id}),a?.([...qe,O]);}}catch(P){console.error("Error polling executions:",P),h?.({message:"Failed to check deposit status",error:P});}},5e3);return ()=>clearInterval(y)},[e,t,We,Be,qe,a,m,h]),useEffect(()=>{if(!b.length)return;let y=b.find(A=>A.symbol===V);if(!y||y.chains.length===0)return;if(!y.chains.some(A=>It(A.chain_id,A.chain_type)===c)){let A=y.chains[0];T(It(A.chain_id,A.chain_type));}},[V,b,c]);let Ye=b.find(y=>y.symbol===V),Ot=Ye?.chains||[],he=Ot.find(y=>It(y.chain_id,y.chain_type)===c),Ke=async()=>{if(be)try{Clipboard.setString(be),oe(!0),setTimeout(()=>oe(!1),2e3);}catch(y){console.error("Failed to copy:",y);}},f=he?.estimated_price_impact_percent??0,R=he?.max_slippage_percent??.25,ne=he?.minimum_deposit_amount_usd??3;if($)return jsxs(View,{style:s.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:n.primary}),jsx(Text,{style:[s.loadingText,{color:n.foregroundMuted}],children:"Loading currencies..."})]});if(zt&&b.length===0)return jsxs(View,{style:s.errorContainer,children:[jsx(Text,{style:[s.errorText,{color:n.error}],children:zt}),jsx(Text,{style:[s.errorHint,{color:n.foregroundMuted}],children:"Please check your network connection and try again."})]});let yt=()=>jsxs(Y,{visible:Ne,onClose:()=>Le(false),closeOnBackdropPress:true,showHandle:false,children:[jsxs(View,{style:[s.sheetHeader,{borderBottomColor:n.border}],children:[jsx(View,{style:s.sheetHeaderSpacer}),jsx(Text,{style:[s.sheetTitle,{color:n.foreground}],children:"Select Token"}),jsx(TouchableOpacity,{onPress:()=>Le(false),style:s.sheetCloseButton,children:jsx(rt,{size:20,color:n.foreground,strokeWidth:2})})]}),jsx(ScrollView,{style:s.sheetList,showsVerticalScrollIndicator:false,children:b.map(y=>jsxs(TouchableOpacity,{onPress:()=>{w(y.symbol),Le(false);},style:[s.sheetItem,{backgroundColor:V===y.symbol?n.card:"transparent"}],children:[jsx(Image,{source:{uri:L(K(y,"png"))},style:s.sheetItemIcon}),jsxs(View,{style:s.sheetItemText,children:[jsx(Text,{style:[s.sheetItemTitle,{color:n.foreground}],children:y.symbol}),jsxs(Text,{style:[s.sheetItemSubtitle,{color:n.foregroundMuted}],children:[y.chains.length," network",y.chains.length!==1?"s":""," available"]})]}),V===y.symbol&&jsx(ie,{size:20,color:n.primary,strokeWidth:2})]},y.symbol))})]}),jt=()=>jsxs(Y,{visible:ft,onClose:()=>fe(false),closeOnBackdropPress:true,showHandle:false,children:[jsxs(View,{style:[s.sheetHeader,{borderBottomColor:n.border}],children:[jsx(View,{style:s.sheetHeaderSpacer}),jsx(Text,{style:[s.sheetTitle,{color:n.foreground}],children:"Select Network"}),jsx(TouchableOpacity,{onPress:()=>fe(false),style:s.sheetCloseButton,children:jsx(rt,{size:20,color:n.foreground,strokeWidth:2})})]}),jsx(ScrollView,{style:s.sheetList,showsVerticalScrollIndicator:false,children:Ot.map(y=>{let P=It(y.chain_id,y.chain_type),A=c===P;return jsxs(TouchableOpacity,{onPress:()=>{T(P),fe(false);},style:[s.sheetItem,{backgroundColor:A?n.card:"transparent"}],children:[jsx(Image,{source:{uri:L(K(y,"png"))},style:s.sheetItemIcon}),jsxs(View,{style:s.sheetItemText,children:[jsx(Text,{style:[s.sheetItemTitle,{color:n.foreground}],children:y.chain_name}),jsxs(Text,{style:[s.sheetItemSubtitle,{color:n.foregroundMuted}],children:["Min deposit: $",y.minimum_deposit_amount_usd]})]}),A&&jsx(ie,{size:20,color:n.primary,strokeWidth:2})]},P)})})]});return jsxs(View,{style:s.container,children:[jsxs(View,{style:s.selectorSection,children:[jsx(Text,{style:[s.selectorLabel,{color:n.foregroundMuted}],children:"Token"}),jsxs(TouchableOpacity,{onPress:()=>Le(true),style:[s.selector,{backgroundColor:n.card}],children:[Ye&&jsx(Image,{source:{uri:L(K(Ye,"png"))},style:s.selectorIcon}),jsx(Text,{style:[s.selectorText,{color:n.foreground}],children:V}),jsx(me,{size:16,color:n.foregroundMuted,strokeWidth:2})]})]}),jsxs(View,{style:s.selectorSection,children:[jsxs(Text,{style:[s.selectorLabel,{color:n.foregroundMuted}],children:["Network"," ",jsxs(Text,{style:s.minDeposit,children:["($",ne," min)"]})]}),jsxs(TouchableOpacity,{onPress:()=>fe(true),style:[s.selector,{backgroundColor:n.card}],children:[he&&jsx(Image,{source:{uri:L(K(he,"png"))},style:s.selectorIcon}),jsx(Text,{style:[s.selectorText,{color:n.foreground}],numberOfLines:1,children:he?.chain_name||"Select network"}),jsx(me,{size:16,color:n.foregroundMuted,strokeWidth:2})]})]}),jsx(View,{style:s.qrContainer,children:jsx(View,{style:[s.qrWrapper,{backgroundColor:n.background,borderColor:n.border}],children:B?jsxs(View,{style:s.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:n.primary}),jsx(Text,{style:[s.loadingText,{color:n.foregroundMuted}],children:"Loading..."})]}):be?jsx(Tt,{value:be,size:160,logoUri:L(K(he,"png")||le("/icons/networks/png/ethereum.png")),logoSize:40}):jsx(View,{style:s.qrLoading,children:jsx(Text,{style:[s.errorText,{color:n.error}],children:"No address available"})})})}),jsxs(View,{style:s.addressSection,children:[jsxs(View,{style:s.addressHeader,children:[jsx(Text,{style:[s.addressLabel,{color:n.foregroundMuted}],children:"Deposit Address"}),G&&jsxs(View,{style:s.copiedIndicator,children:[jsx(ie,{size:14,color:n.success,strokeWidth:2}),jsx(Text,{style:[s.copiedText,{color:n.success}],children:"Copied"})]})]}),jsx(TouchableOpacity,{onPress:Ke,disabled:!be||B,activeOpacity:.7,style:[s.addressBox,{backgroundColor:n.card}],children:jsx(Text,{style:[s.addressText,{color:n.foreground}],numberOfLines:2,children:B?"Loading...":be||"No address available"})})]}),jsxs(View,{style:[s.detailsCard,{backgroundColor:n.card}],children:[jsxs(TouchableOpacity,{onPress:()=>W(!re),style:s.detailsHeader,children:[jsxs(View,{style:s.detailsRow,children:[jsx(View,{style:[s.detailIcon,{backgroundColor:n.cardHover}],children:jsx(Yo,{size:12,color:n.foreground,strokeWidth:2})}),jsxs(Text,{style:[s.detailsLabel,{color:n.foregroundMuted}],children:["Price impact:"," ",jsxs(Text,{style:{color:n.foreground},children:[f.toFixed(2),"%"]})]})]}),jsx(View,{style:s.chevronContainer,children:re?jsx(Kt,{size:16,color:n.foregroundMuted,strokeWidth:2}):jsx(me,{size:16,color:n.foregroundMuted,strokeWidth:2})})]}),re&&jsxs(View,{style:s.detailsContent,children:[jsxs(View,{style:s.detailsRow,children:[jsx(View,{style:[s.detailIcon,{backgroundColor:n.cardHover}],children:jsx(Ko,{size:12,color:n.foreground,strokeWidth:2})}),jsxs(Text,{style:[s.detailsLabel,{color:n.foregroundMuted}],children:["Max slippage:"," ",jsxs(Text,{style:{color:n.foreground},children:["Auto \u2022 ",R.toFixed(2),"%"]})]})]}),jsxs(View,{style:s.detailsRow,children:[jsx(View,{style:[s.detailIcon,{backgroundColor:n.cardHover}],children:jsx(kt,{size:12,color:n.foreground,strokeWidth:2})}),jsxs(Text,{style:[s.detailsLabel,{color:n.foregroundMuted}],children:["Processing time:"," ",jsx(Text,{style:{color:n.foreground},children:"< 1 min"})]})]}),jsxs(View,{style:s.detailsRow,children:[jsx(View,{style:[s.detailIcon,{backgroundColor:n.cardHover}],children:jsx(Zo,{size:12,color:n.foreground,strokeWidth:2})}),jsxs(Text,{style:[s.detailsLabel,{color:n.foregroundMuted}],children:["Need help?"," ",jsx(Text,{style:{color:n.foreground,textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsx(View,{style:s.spacer}),jsx(TouchableOpacity,{style:s.termsContainer,children:jsx(Text,{style:[s.termsText,{color:n.foregroundMuted}],children:"Terms apply"})}),yt(),jt(),ke&&jsx(_t,{visible:Ee,status:ke.status,tokenIconUrl:ke.destination_token_metadata?.icon_urls?.find(y=>y.format==="png")?.url||ke.destination_token_metadata?.icon_url||K(Ye,"png"),explorerUrl:ke.explorer_url,completionExplorerUrl:ke.destination_explorer_url,onClose:()=>Ft(false)})]})}var s=StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16,borderRadius:16,borderWidth:1},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{paddingHorizontal:12,paddingVertical:16,borderRadius:8},addressText:{fontSize:12,fontFamily:"monospace"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,paddingLeft:8,paddingRight:24},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13,flex:1},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center",paddingVertical:16},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingBottom:12},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"600",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{maxHeight:400,paddingTop:8},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2}});function Rt({currency:e,isSelected:t,onSelect:o}){let{colors:r}=_();return jsxs(TouchableOpacity,{onPress:()=>o(e.currency_code),activeOpacity:.7,style:[Oe.container,{backgroundColor:r.card}],children:[jsxs(View,{style:Oe.leftContent,children:[jsx(View,{style:[Oe.iconContainer,{backgroundColor:r.background}],children:jsx(Image,{source:{uri:L(K(e,"png"))},style:Oe.icon})}),jsxs(View,{style:Oe.textContainer,children:[jsx(Text,{style:[Oe.name,{color:r.foreground}],children:e.name}),jsx(Text,{style:[Oe.code,{color:r.foregroundMuted}],children:e.currency_code.toUpperCase()})]})]}),t&&jsx(ie,{size:16,color:r.foreground,strokeWidth:2})]})}var Oe=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,borderRadius:12,marginHorizontal:8,marginVertical:4},leftContent:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:40,height:40,borderRadius:20,overflow:"hidden",alignItems:"center",justifyContent:"center"},icon:{width:40,height:40,borderRadius:20},textContainer:{gap:2},name:{fontSize:14,fontWeight:"400"},code:{fontSize:12,fontWeight:"300"}});function pt({title:e,currencies:t,selectedCurrency:o,onSelect:r}){let{colors:l}=_();return t.length===0?null:jsxs(View,{children:[jsx(View,{style:dr.headerContainer,children:jsx(Text,{style:[dr.title,{color:l.foregroundMuted}],children:e})}),t.map(i=>jsx(Rt,{currency:i,isSelected:o.toLowerCase()===i.currency_code.toLowerCase(),onSelect:r},i.currency_code))]})}var dr=StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Pt({open:e,onOpenChange:t,currencies:o,preferredCurrencyCodes:r,selectedCurrency:l,onSelectCurrency:i}){let{colors:a}=_(),[m,h]=useState(""),n=r.map(B=>o.find(E=>E.currency_code.toLowerCase()===B.toLowerCase())).filter(B=>B!==void 0),V=o.filter(B=>!r.includes(B.currency_code.toLowerCase())),w=B=>{if(!m)return B;let E=m.toLowerCase();return B.filter(b=>b.name.toLowerCase().includes(E)||b.currency_code.toLowerCase().includes(E))},c=w(n),T=w(V),N=B=>{i(B),t(false),h("");},q=()=>{t(false),h("");};return jsxs(Y,{visible:e,onClose:q,closeOnBackdropPress:true,showHandle:false,children:[jsx(se,{title:"Currency",showBack:false,onClose:q}),jsx(View,{style:je.searchContainer,children:jsx(TextInput,{style:[je.searchInput,{backgroundColor:a.card,color:a.foreground}],value:m,onChangeText:h,placeholder:"Search",placeholderTextColor:a.foregroundMuted})}),jsx(ScrollView,{style:je.listContainer,showsVerticalScrollIndicator:false,children:jsxs(View,{style:je.listContent,children:[jsx(pt,{title:"Popular currencies",currencies:c,selectedCurrency:l,onSelect:N}),c.length>0&&T.length>0&&jsx(View,{style:je.sectionSpacer}),jsx(pt,{title:"All currencies",currencies:T,selectedCurrency:l,onSelect:N}),c.length===0&&T.length===0&&jsx(View,{style:je.noResultsContainer,children:jsx(Text,{style:[je.noResultsText,{color:a.foregroundMuted}],children:"No currencies found"})})]})})]})}var je=StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:16,paddingBottom:12},searchInput:{padding:16,borderRadius:12,fontSize:14},listContainer:{height:400,paddingHorizontal:12},listContent:{paddingBottom:24,minHeight:400},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});var wn=[100,500,1e3];function fr(e){try{return new Intl.NumberFormat("en",{style:"currency",currency:e.toUpperCase(),minimumFractionDigits:0,maximumFractionDigits:0}).format(0).replace(/\d/g,"").trim()}catch{return e.toUpperCase()}}function Lt({userId:e,publishableKey:t,view:o,onViewChange:r,maxAmountUsd:l=5e4,destinationTokenSymbol:i="USDC",recipientAddress:a,destinationChainType:m,destinationChainId:h,destinationTokenAddress:n,onDepositSuccess:V,onDepositError:w}){let{colors:c}=_(),[T,N]=useState("500.00"),[q,B]=useState("usd"),[E,b]=useState([]),[p,$]=useState(false),[U,G]=useState(null),[oe,re]=useState("amount"),[W,Ne]=useState(null),[Le,ft]=useState([]),[fe,qe]=useState(true),[gt,Be]=useState(60),[$e,We]=useState([]),[zt,Qe]=useState([]),[Ee,Ft]=useState(null),[ke,Ut]=useState(false),[mt,Ge]=useState(false),ht=o??oe,uo=$e.find(f=>f.currency_code.toLowerCase()===q.toLowerCase()),po=useCallback(f=>{re(f),f==="quotes"?r?.(f,E.length):r?.(f);},[E.length,r]);useEffect(()=>{async function f(){try{let R=await Je({user_id:e,recipient_address:a,destination_chain_type:m,destination_chain_id:h,destination_token_address:n},t);ft(R.data);}catch(R){console.error("Error fetching wallets:",R),G("Failed to load wallet addresses");}finally{qe(false);}}f();},[e,a,m,h,n,t]),useEffect(()=>{async function f(){try{let R=await Qt(t);We(R.data),Qe(R.preferred||[]);}catch(R){console.error("Error fetching fiat currencies:",R);}}f();},[t]),useEffect(()=>{let f=parseFloat(T);if(isNaN(f)||f<=0){b([]);return}if(q.toLowerCase()==="usd"&&f>l){b([]),G(`Maximum amount is ${fr("usd")}${l.toLocaleString()}`);return}let R=setTimeout(()=>{fo(f);},500);return ()=>clearTimeout(R)},[T,q,l,t]);let fo=async f=>{$(true),G(null);try{let R={country_code:"US",destination_currency_code:"usdc_polygon",source_amount:f.toString(),source_currency_code:q.toLowerCase()},ne=await qt(R,t);if(b(ne.data),ne.data.length>0){let yt=ne.data.reduce((jt,y)=>y.destination_amount>jt.destination_amount?y:jt);Ne(yt);}Be(60);}catch(R){console.error("Failed to fetch quotes:",R),G("Failed to fetch quotes. Please try again."),b([]);}finally{$(false);}};useEffect(()=>{if(E.length===0)return;let f=setInterval(()=>{Be(R=>{if(R<=1){let ne=parseFloat(T);return !isNaN(ne)&&ne>0&&fo(ne),60}return R-1});},1e3);return ()=>clearInterval(f)},[E.length,T]);let be=f=>{(/^\d*\.?\d{0,2}$/.test(f)||f==="")&&N(f);},Ye=f=>{N(f.toFixed(2));},Ot=()=>W?W.destination_amount.toFixed(2):"0.00",he=async()=>{if(W)try{let f=Xe(Le,"ethereum");if(!f?.address){G("Wallet address not available");return}let R={service_provider:W.service_provider,country_code:W.country_code.toUpperCase(),destination_currency_code:W.destination_currency_code,source_currency_code:W.source_currency_code,wallet_address:f.address,source_amount:T},ne=await $t(R,t);Ft({provider:W,sourceCurrency:q,sourceAmount:T}),Linking.openURL(ne.widget_url),po("onramp");}catch(f){console.error("Failed to create session:",f),G("Failed to start payment flow"),w?.({message:"Failed to start payment flow",error:f});}},Ke=fr(q);return ht==="amount"?jsxs(View,{style:u.container,children:[jsx(View,{style:u.currencySelector,children:jsxs(TouchableOpacity,{onPress:()=>Ut(true),style:[u.currencyButton,{backgroundColor:c.card}],children:[uo&&jsx(Image,{source:{uri:L(K(uo,"png"))},style:u.currencyIcon}),jsx(Text,{style:[u.currencyText,{color:c.foreground}],children:q.toUpperCase()}),jsx(me,{size:16,color:c.foregroundMuted,strokeWidth:2})]})}),jsx(Pt,{open:ke,onOpenChange:Ut,currencies:$e,preferredCurrencyCodes:zt,selectedCurrency:q,onSelectCurrency:f=>{B(f.toLowerCase());}}),jsxs(View,{style:u.amountContainer,children:[jsxs(View,{style:u.amountInputRow,children:[jsx(Text,{style:[u.currencySymbol,{color:c.foreground}],children:Ke}),jsx(TextInput,{style:[u.amountInput,{color:c.foreground}],value:T,onChangeText:be,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:c.foregroundMuted})]}),p?jsx(ActivityIndicator,{size:"small",color:c.primary}):jsxs(Text,{style:[u.usdcPreview,{color:c.foregroundMuted}],children:["\u2248 ",Ot()," ",i]})]}),jsx(View,{style:u.quickAmounts,children:wn.map(f=>jsx(TouchableOpacity,{onPress:()=>Ye(f),style:[u.quickAmountButton,{backgroundColor:c.card},parseFloat(T)===f&&{borderColor:c.primary,borderWidth:2}],children:jsxs(Text,{style:[u.quickAmountText,{color:c.foreground}],children:[Ke,f.toLocaleString()]})},f))}),jsxs(View,{style:u.providerSection,children:[jsxs(View,{style:u.providerHeader,children:[jsx(Text,{style:[u.providerLabel,{color:c.foreground}],children:"Provider"}),E.length>0&&!p&&jsxs(Text,{style:[u.refreshText,{color:c.foregroundMuted}],children:["Refreshing in ",gt,"s"]})]}),jsx(TouchableOpacity,{onPress:()=>Ge(true),disabled:p||E.length===0,style:[u.providerButton,{backgroundColor:c.card},(p||E.length===0)&&u.disabled],children:p?jsxs(View,{style:u.providerLoading,children:[jsx(ActivityIndicator,{size:"small",color:c.foregroundMuted}),jsx(Text,{style:[u.loadingText,{color:c.foregroundMuted}],children:"Finding best rates..."})]}):W?jsxs(View,{style:u.providerContent,children:[jsxs(View,{style:u.providerInfo,children:[jsx(Text,{style:[u.autoPickedText,{color:c.foregroundMuted}],children:"Auto-picked for you"}),jsxs(View,{style:u.providerRow,children:[jsx(ae,{uri:L(W.icon_url),width:32,height:32,borderRadius:8}),jsxs(View,{children:[jsx(Text,{style:[u.providerName,{color:c.foreground}],children:W.service_provider_display_name}),jsxs(Text,{style:[u.bestPriceText,{color:c.success}],children:["Best price \u2022 ",W.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsx(nt,{size:20,color:c.foregroundMuted,strokeWidth:2})]}):jsx(Text,{style:[u.noProviderText,{color:c.foregroundMuted}],children:parseFloat(T)>0?"No providers available":"Enter an amount to see providers"})}),U&&jsx(Text,{style:[u.errorText,{color:c.error}],children:U})]}),jsx(TouchableOpacity,{onPress:he,disabled:p||fe||!W||parseFloat(T)<=0,style:[u.continueButton,{backgroundColor:c.primary},(p||fe||!W)&&u.disabledButton],children:jsx(Text,{style:u.continueButtonText,children:fe?"Loading...":`Buy ${i}`})}),jsxs(Y,{visible:mt,onClose:()=>Ge(false),closeOnBackdropPress:true,showHandle:false,children:[jsx(se,{title:"Select Provider",showBack:false,onClose:()=>Ge(false),badge:E.length>0?{count:E.length}:void 0}),jsx(ScrollView,{style:u.providerModalList,showsVerticalScrollIndicator:false,children:jsx(View,{style:u.quotesList,children:[...E].sort((f,R)=>R.destination_amount-f.destination_amount).map((f,R)=>{let ne=W?.service_provider===f.service_provider,yt=R===0;return jsxs(TouchableOpacity,{onPress:()=>{Ne(f),Ge(false);},style:[u.quoteItem,{backgroundColor:c.card},ne&&{borderColor:c.primary,borderWidth:2}],children:[jsxs(View,{style:u.quoteLeft,children:[jsx(ae,{uri:L(f.icon_url),width:32,height:32,borderRadius:8}),jsxs(View,{children:[jsx(Text,{style:[u.quoteName,{color:c.foreground}],children:f.service_provider_display_name}),yt&&jsx(Text,{style:[u.bestPriceLabel,{color:c.success}],children:"\u2713 Best price"})]})]}),jsxs(View,{style:u.quoteRight,children:[jsxs(Text,{style:[u.quoteAmount,{color:c.foreground}],children:[f.destination_amount.toFixed(2)," USDC"]}),jsxs(Text,{style:[u.quoteSource,{color:c.foregroundMuted}],children:["Fee: ",Ke,f.total_fee.toFixed(2)]})]})]},f.service_provider)})})})]})]}):ht==="onramp"&&Ee?jsxs(View,{style:[u.container,u.onrampContainer],children:[jsx(ae,{uri:L(Ee.provider.icon_url),width:48,height:48,borderRadius:12}),jsxs(Text,{style:[u.onrampTitle,{color:c.foreground}],children:["Complete on ",Ee.provider.service_provider_display_name]}),jsx(Text,{style:[u.onrampSubtitle,{color:c.foregroundMuted}],children:"You can close this modal. Your deposit will be processed automatically."}),jsxs(View,{style:[u.flowDiagram,{backgroundColor:c.card}],children:[jsxs(View,{style:u.flowStep,children:[jsx(Image,{source:{uri:le(`/icons/currencies/png/${Ee.sourceCurrency.toLowerCase()}.png`)},style:u.flowIconImage}),jsx(Text,{style:[u.flowLabel,{color:c.foregroundMuted}],children:"You pay"}),jsxs(Text,{style:[u.flowValue,{color:c.foreground}],children:[Ke,Ee.sourceAmount]})]}),jsx(nt,{size:20,color:c.foregroundMuted,strokeWidth:2}),jsxs(View,{style:u.flowStep,children:[jsx(Image,{source:{uri:le("/icons/tokens/png/usdc.png")},style:u.flowIconImage}),jsx(Text,{style:[u.flowLabel,{color:c.foregroundMuted}],children:"You get"}),jsx(Text,{style:[u.flowValue,{color:c.foreground}],children:i})]})]})]}):null}var u=StyleSheet.create({container:{padding:16},currencySelector:{alignItems:"center",marginBottom:16},currencyButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8,borderRadius:8},currencyText:{fontSize:14,fontWeight:"500"},currencyIcon:{width:24,height:24,borderRadius:12},amountContainer:{alignItems:"center",marginBottom:24},amountInputRow:{flexDirection:"row",alignItems:"center",marginBottom:8},currencySymbol:{fontSize:48,fontWeight:"300"},amountInput:{fontSize:48,fontWeight:"300",minWidth:50},usdcPreview:{fontSize:14},quickAmounts:{flexDirection:"row",justifyContent:"center",gap:12,marginBottom:24},quickAmountButton:{paddingHorizontal:20,paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14,fontWeight:"500"},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16,borderRadius:12},disabled:{opacity:.5},providerLoading:{flexDirection:"row",alignItems:"center",gap:12},loadingText:{fontSize:14},providerContent:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},providerInfo:{flex:1},autoPickedText:{fontSize:12,marginBottom:8},providerRow:{flexDirection:"row",alignItems:"center",gap:12},providerIcon:{width:32,height:32,borderRadius:16},providerName:{fontSize:14,fontWeight:"500"},bestPriceText:{fontSize:11,marginTop:2},noProviderText:{fontSize:14,textAlign:"center"},errorText:{fontSize:12,marginTop:8},continueButton:{paddingVertical:16,borderRadius:12,alignItems:"center"},disabledButton:{opacity:.5},continueButtonText:{color:"#FFFFFF",fontSize:16,fontWeight:"600"},providerModalList:{height:468,paddingHorizontal:12,marginTop:8},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:16,borderRadius:12},quoteLeft:{flexDirection:"row",alignItems:"center",gap:12},quoteIcon:{width:40,height:40,borderRadius:20},quoteName:{fontSize:14,fontWeight:"500"},bestPriceLabel:{fontSize:11,marginTop:2},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{alignItems:"center",paddingTop:24},onrampIcon:{width:64,height:64,borderRadius:16,marginBottom:16},onrampTitle:{fontSize:20,fontWeight:"500",textAlign:"center",marginBottom:8},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-around",padding:16,borderRadius:12,width:"100%"},flowStep:{alignItems:"center"},flowIcon:{width:28,height:28,borderRadius:14,marginBottom:4},flowIconImage:{width:24,height:24,borderRadius:12,marginBottom:4},flowLabel:{fontSize:10},flowValue:{fontSize:14,fontWeight:"500"}});function Sn(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function _n(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Bt({execution:e,onPress:t}){let {colors:o}=_(),r=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let i=L(K(e.destination_token_metadata,"png")||le("/icons/tokens/png/usdc.png")),a=r?"Deposit Processing":"Deposit Completed",m=Sn(e.created_at||new Date().toISOString()),h=_n(e.source_amount_usd);return jsxs(TouchableOpacity,{onPress:t,activeOpacity:.7,style:[we.container,{backgroundColor:o.card}],children:[jsxs(View,{style:we.iconContainer,children:[jsx(Image,{source:{uri:i},style:we.tokenIcon}),jsx(View,{style:[we.statusBadge,{backgroundColor:r?"#EAB308":"#22C55E"}],children:r?jsx(Zt,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsx(ie,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:we.textContainer,children:[jsx(Text,{style:[we.title,{color:o.foreground}],children:a}),jsx(Text,{style:[we.dateTime,{color:o.foregroundMuted}],children:m})]}),jsxs(View,{style:we.rightContainer,children:[jsx(Text,{style:[we.amount,{color:o.foreground}],children:h}),jsx(nt,{size:20,color:o.foregroundMuted,strokeWidth:2})]})]})}var we=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12,borderRadius:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2,borderColor:"#1C1C1E"},textContainer:{flex:1,gap:2},title:{fontSize:16,fontWeight:"500"},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16,fontWeight:"500"}});var{height:Rn}=Dimensions.get("window");function hr(e,t){let o={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||o[e]||e:o[e]||e}function yr(e,t=6){try{return e?(Number(e)/Math.pow(10,t)).toFixed(2):"0.00"}catch{return "0.00"}}function Pn(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Cr=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function xr(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Vn(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function Wt({visible:e,onClose:t,executions:o,userId:r,publishableKey:l}){let{colors:i}=_(),[a,m]=useState(o),[h,n]=useState(false),[V,w]=useState(null),[c,T]=useState(false);useEffect(()=>{if(!e||!r)return;let p=async()=>{n(true);try{let G=[...(await et(r,l)).data].sort((oe,re)=>{let W=oe.created_at?new Date(oe.created_at).getTime():0;return (re.created_at?new Date(re.created_at).getTime():0)-W});m(G);}catch(U){console.error("Failed to fetch executions:",U),m(o);}finally{n(false);}};p();let $=setInterval(p,1e4);return ()=>clearInterval($)},[e,r,l,o]),useEffect(()=>{o.length>0&&m(p=>{let $=new Set(p.map(G=>G.id)),U=o.filter(G=>!$.has(G.id));return U.length>0?[...U,...p]:p});},[o]),useEffect(()=>{e||w(null);},[e]);let N=p=>{w(p);},q=()=>{w(null),T(false);},B=()=>{w(null),t();};return jsxs(Y,{visible:e,onClose:B,closeOnBackdropPress:true,showHandle:false,children:[jsx(se,{title:V?"Deposit Details":"Deposit Tracker",onClose:B,showClose:!V,showBack:!!V,onBack:q}),V?(()=>{if(!V)return null;let p=V,$=p.status==="pending"||p.status==="waiting"||p.status==="delayed",U=p.status==="succeeded",G=L(K(p.destination_token_metadata,"png")||le("/icons/tokens/png/usdc.png")),oe=p.provider_metadata?.details,re=oe?.currencyIn,W=oe?.currencyOut;re?.currency?.symbol||"USDC";W?.currency?.symbol||"USDC";let ft=yr(p.source_amount_base_unit),fe=yr(p.destination_amount_base_unit),qe=Pn(p.source_amount_usd),gt=hr(p.source_chain_type,p.source_chain_id),Be=hr(p.destination_chain_type,p.destination_chain_id),$e=()=>{p.explorer_url&&Linking.openURL(p.explorer_url);},We=()=>{p.destination_explorer_url&&Linking.openURL(p.destination_explorer_url);};return jsxs(ScrollView,{style:g.scrollContainer,contentContainerStyle:g.detailsContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:g.iconSection,children:[jsxs(View,{style:g.iconWrapper,children:[jsx(Image,{source:{uri:G},style:g.tokenIcon}),jsx(View,{style:[g.statusBadge,{backgroundColor:$?"#EAB308":"#22C55E"}],children:$?jsx(me,{size:14,color:"#FFFFFF",strokeWidth:2}):jsx(ie,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxs(View,{style:g.statusRow,children:[jsx(View,{style:[g.statusDot,{backgroundColor:$?"#EAB308":"#22C55E"}]}),jsx(Text,{style:[g.statusText,{color:i.foreground}],children:$?"Processing":"Completed"})]}),jsx(Text,{style:[g.dateText,{color:i.foregroundMuted}],children:Vn(p.created_at||new Date().toISOString())})]}),jsxs(View,{style:[g.card,{backgroundColor:i.card}],children:[jsxs(View,{style:g.cardRow,children:[jsx(Text,{style:[g.cardLabel,{color:i.foregroundMuted}],children:"Amount Sent"}),jsxs(Text,{style:[g.cardValue,{color:i.foreground}],children:[ft," ",xr(p.source_currency)]})]}),jsx(View,{style:[g.cardDivider,{backgroundColor:i.border}]}),jsxs(View,{style:g.cardRow,children:[jsx(Text,{style:[g.cardLabel,{color:i.foregroundMuted}],children:"Amount Received"}),jsxs(Text,{style:[g.cardValue,{color:i.foreground}],children:[fe," ",xr(p.destination_currency)]})]}),jsx(View,{style:[g.cardDivider,{backgroundColor:i.border}]}),jsxs(View,{style:g.cardRow,children:[jsx(Text,{style:[g.cardLabel,{color:i.foregroundMuted}],children:"USD Value"}),jsx(Text,{style:[g.cardValue,{color:i.foreground}],children:qe})]}),jsx(View,{style:[g.cardDivider,{backgroundColor:i.border}]}),jsxs(View,{style:g.cardRow,children:[jsx(Text,{style:[g.cardLabel,{color:i.foregroundMuted}],children:"Source Network"}),jsx(Text,{style:[g.cardValue,{color:i.foreground}],children:gt})]}),jsx(View,{style:[g.cardDivider,{backgroundColor:i.border}]}),jsxs(View,{style:g.cardRow,children:[jsx(Text,{style:[g.cardLabel,{color:i.foregroundMuted}],children:"Destination Network"}),jsx(Text,{style:[g.cardValue,{color:i.foreground}],children:Be})]})]}),jsxs(TouchableOpacity,{onPress:()=>T(!c),style:g.toggleButton,activeOpacity:.7,children:[jsx(Text,{style:[g.toggleText,{color:i.foregroundMuted}],children:c?"See less":"See more details"}),c?jsx(Kt,{size:14,color:i.foregroundMuted,strokeWidth:2}):jsx(me,{size:14,color:i.foregroundMuted,strokeWidth:2})]}),c&&jsxs(View,{style:[g.card,{backgroundColor:i.card}],children:[p.explorer_url&&jsxs(View,{children:[jsxs(TouchableOpacity,{onPress:$e,style:g.cardRow,children:[jsx(Text,{style:[g.cardLabel,{color:i.foregroundMuted}],children:"Deposit Tx"}),jsxs(View,{style:g.cardRowRight,children:[jsx(Text,{style:[g.cardValue,{color:i.foreground}],children:Cr(p.transaction_hash)}),jsx(Yt,{size:14,color:i.foregroundMuted,strokeWidth:2})]})]}),jsx(View,{style:[g.cardDivider,{backgroundColor:i.border}]})]}),p.destination_explorer_url&&U&&jsxs(TouchableOpacity,{onPress:We,style:g.cardRow,children:[jsx(Text,{style:[g.cardLabel,{color:i.foregroundMuted}],children:"Completion Tx"}),jsxs(View,{style:g.cardRowRight,children:[jsx(Text,{style:[g.cardValue,{color:i.foreground}],children:Cr(p.destination_transaction_hashes[0])}),jsx(Yt,{size:14,color:i.foregroundMuted,strokeWidth:2})]})]})]})]})})():jsx(ScrollView,{style:g.scrollContainer,contentContainerStyle:g.scrollContent,showsVerticalScrollIndicator:false,children:a.length===0?jsxs(View,{style:g.emptyContainer,children:[jsx(Text,{style:[g.emptyText,{color:i.foregroundMuted}],children:"No deposits yet"}),jsx(Text,{style:[g.emptySubtext,{color:i.foregroundMuted}],children:"Your deposit history will appear here"})]}):jsx(View,{style:g.executionsList,children:a.map(p=>jsx(Bt,{execution:p,onPress:()=>N(p)},p.id))})})]})}var g=StyleSheet.create({scrollContainer:{maxHeight:Rn*.7,paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:16},emptyContainer:{paddingVertical:40,paddingHorizontal:16,alignItems:"center"},emptyText:{fontSize:14,marginBottom:4},emptySubtext:{fontSize:12},executionsList:{paddingTop:8,gap:12},detailsContent:{paddingHorizontal:16,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},iconWrapper:{position:"relative",marginBottom:12},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",bottom:0,right:0,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center",borderWidth:3,borderColor:"#1C1C1E"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardRowRight:{flexDirection:"row",alignItems:"center",gap:8},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"},toggleButton:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12,paddingHorizontal:4},toggleText:{fontSize:14},buttonSection:{marginTop:12,gap:10},actionButton:{flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:16,borderRadius:12},buttonIconLeft:{marginRight:12},buttonIconRight:{marginLeft:12},buttonText:{color:"#FFFFFF",fontSize:14,fontWeight:"600",flex:1,textAlign:"left"},hintText:{fontSize:12,textAlign:"center",marginTop:8}});var He={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function En({visible:e,onClose:t,userId:o,publishableKey:r,modalTitle:l="Deposit",destinationTokenSymbol:i,recipientAddress:a,destinationChainType:m,destinationChainId:h,destinationTokenAddress:n,hideDepositTracker:V=false,onDepositSuccess:w,onDepositError:c}){let[T,N]=useState([]),[q,B]=useState(false),[E,b]=useState(false),[p,$]=useState(false),[U,G]=useState(null);useEffect(()=>{e&&!U&&Gt(r).then(G).catch(console.error);},[e,U,r]);let oe=()=>{t();},re=T.filter(W=>W.status==="pending"||W.status==="waiting").length;return jsxs(Y,{visible:e,onClose:oe,closeOnBackdropPress:false,showHandle:false,children:[jsx(se,{title:l,showBack:false,onClose:oe}),jsxs(View,{style:Mt.optionsContainer,children:[jsx(at,{onPress:()=>b(true),title:He.transferCrypto.title,subtitle:He.transferCrypto.subtitle,featuredTokens:U?.transfer_crypto?.networks}),jsx(ct,{onPress:()=>$(true),title:He.depositWithCard.title,subtitle:He.depositWithCard.subtitle,paymentNetworks:U?.payment_networks?.networks}),!V&&jsx(dt,{onPress:()=>B(true),title:He.depositTracker.title,subtitle:He.depositTracker.subtitle,badge:re>0?re:void 0})]}),jsx(Wt,{visible:q,onClose:()=>B(false),executions:T,userId:o,publishableKey:r}),jsxs(Y,{visible:E,onClose:()=>b(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.95,children:[jsx(se,{title:He.transferCrypto.title,showBack:false,onClose:()=>b(false)}),jsx(ScrollView,{style:Mt.transferScrollContainer,contentContainerStyle:Mt.scrollContent,showsVerticalScrollIndicator:false,children:jsx(vt,{userId:o,publishableKey:r,recipientAddress:a,destinationChainType:m,destinationChainId:h,destinationTokenAddress:n,onExecutionsChange:N,onDepositSuccess:w,onDepositError:c})})]}),jsxs(Y,{visible:p,onClose:()=>$(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.95,children:[jsx(se,{title:"Add Funds",showBack:false,onClose:()=>$(false)}),jsx(ScrollView,{style:Mt.transferScrollContainer,contentContainerStyle:Mt.scrollContent,showsVerticalScrollIndicator:false,children:jsx(Lt,{userId:o,publishableKey:r,destinationTokenSymbol:i,recipientAddress:a,destinationChainType:m,destinationChainId:h,destinationTokenAddress:n,onDepositSuccess:w,onDepositError:c})})]})]})}function At({theme:e="auto",...t}){return jsx(Ze,{mode:e,children:jsx(En,{...t})})}var Mt=StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24}});StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:12,gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});function Bo({uri:e,size:t=24,style:o,borderRadius:r}){return jsx(Image,{source:{uri:e},style:[Fn.icon,{width:t,height:t,borderRadius:r??t/2},o],resizeMode:"contain"})}var Fn=StyleSheet.create({icon:{backgroundColor:"transparent"}});var Qn=()=>new QueryClient({defaultOptions:{queries:{staleTime:6e4,retry:1}}}),br=createContext(null);function Gn({children:e,publishableKey:t,config:o}){let[r]=useState(()=>Qn()),[l,i]=useState(false),[a,m]=useState(null),h=useColorScheme(),n=useRef(false);!n.current&&o?.apiBaseUrl&&(console.log(`[UnifoldProvider] Setting API config SYNC - baseUrl: ${o.apiBaseUrl}`),xt({baseUrl:o.apiBaseUrl,publishableKey:t}),n.current=true);let V=useMemo(()=>{let b=o?.appearance||"dark";return b==="auto"?h==="dark"?"dark":"light":b},[o?.appearance,h]);useEffect(()=>{if(!t||t.trim()===""){console.error("Unifold: publishableKey is required. Please provide a valid publishable key.");return}!t.startsWith("pk_test_")&&!t.startsWith("pk_live_")&&console.warn('Unifold: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),console.log(`[UnifoldProvider] Setting API config in useEffect - baseUrl: ${o?.apiBaseUrl}`),xt({baseUrl:o?.apiBaseUrl,publishableKey:t});},[t,o?.apiBaseUrl]);let w=useRef(null),c=useRef(null),T=useCallback(b=>{console.log("[UnifoldProvider] beginDeposit called with:",b),c.current&&(clearTimeout(c.current),c.current=null),w.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),w.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),w.current=null);let p=new Promise(($,U)=>{w.current={resolve:$,reject:U};});return m(b),i(true),p},[]),N=useCallback(()=>{w.current&&(w.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),w.current=null),i(false),c.current=setTimeout(()=>{m(null),c.current=null;},200);},[]),q=useCallback(b=>{console.log("[UnifoldProvider] Deposit success:",b),a?.onSuccess&&a.onSuccess(b),w.current&&(w.current.resolve(b),w.current=null);},[a]),B=useCallback(b=>{console.error("[UnifoldProvider] Deposit error:",b),a?.onError&&a.onError(b),w.current&&(w.current.reject(b),w.current=null);},[a]),E=useMemo(()=>({publishableKey:t,beginDeposit:T,closeDeposit:N}),[t,T,N]);return jsx(QueryClientProvider,{client:r,children:jsx(br.Provider,{value:E,children:jsxs(Ze,{mode:V,children:[e,a&&jsx(At,{visible:l,onClose:N,userId:a.userId,publishableKey:t,modalTitle:o?.modalTitle,destinationTokenSymbol:a.destinationTokenSymbol,recipientAddress:a.recipientAddress,destinationChainId:a.destinationChainId,destinationTokenAddress:a.destinationTokenAddress,hideDepositTracker:o?.hideDepositTracker,onDepositSuccess:q,onDepositError:B,theme:V})]})})})}function Yn(){let e=useContext(br);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}export{Y as BottomSheet,Lt as BuyWithCard,Rt as CurrencyListItem,pt as CurrencyListSection,Pt as CurrencyModal,Bt as DepositExecutionItem,se as DepositHeader,At as DepositModal,_t as DepositStatusSheet,dt as DepositTrackerButton,ct as DepositWithCardButton,Wt as DepositsModal,Ae as ExecutionStatus,Bo as Icon,Tt as QRCode,ae as RemoteIcon,Oo as SOLANA_USDC_ADDRESS,Ze as ThemeProvider,vt as TransferCrypto,at as TransferCryptoButton,Gn as UnifoldProvider,go as createDepositAddress,Je as createEOA,$t as createMeldSession,Fo as getApiBaseUrl,No as getChainName,Qt as getFiatCurrencies,le as getIconUrl,Uo as getIconUrlWithCdn,qt as getMeldQuotes,K as getPreferredIcon,jo as getPreferredIconUrl,Gt as getProjectConfig,Nt as getSupportedDepositTokens,Ho as getTokenChains,Xe as getWalletByChainType,L as normalizeIconUrl,et as queryExecutions,xt as setApiConfig,_ as useTheme,Yn as useUnifold};
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@unifold/connect-react-native",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Unifold Connect React Native SDK - Crypto deposit and onramp for React Native/Expo",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"expo": ">=49.0.0",
|
|
22
|
+
"react": "^18.2.0",
|
|
23
|
+
"react-native": ">=0.72.0",
|
|
24
|
+
"react-native-svg": ">=13.0.0"
|
|
25
|
+
},
|
|
26
|
+
"peerDependenciesMeta": {
|
|
27
|
+
"expo": {
|
|
28
|
+
"optional": true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@tanstack/react-query": "^5.90.11",
|
|
33
|
+
"react-native-qrcode-svg": "^6.3.2",
|
|
34
|
+
"@unifold/ui-react-native": "0.1.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/react": "^18.2.0",
|
|
38
|
+
"@types/react-native": "^0.72.0",
|
|
39
|
+
"tsup": "^8.0.0",
|
|
40
|
+
"typescript": "^5.0.0"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"unifold",
|
|
44
|
+
"sdk",
|
|
45
|
+
"crypto",
|
|
46
|
+
"deposit",
|
|
47
|
+
"onramp",
|
|
48
|
+
"react-native",
|
|
49
|
+
"expo",
|
|
50
|
+
"wallet",
|
|
51
|
+
"web3",
|
|
52
|
+
"ethereum",
|
|
53
|
+
"solana",
|
|
54
|
+
"bitcoin"
|
|
55
|
+
],
|
|
56
|
+
"author": "Unifold",
|
|
57
|
+
"license": "MIT",
|
|
58
|
+
"repository": {
|
|
59
|
+
"type": "git",
|
|
60
|
+
"url": "git+https://github.com/unifold/connect-react-native.git"
|
|
61
|
+
},
|
|
62
|
+
"bugs": {
|
|
63
|
+
"url": "https://github.com/unifold/connect-react-native/issues"
|
|
64
|
+
},
|
|
65
|
+
"homepage": "https://unifold.io",
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "tsup",
|
|
68
|
+
"dev": "tsup --watch",
|
|
69
|
+
"clean": "rm -rf dist",
|
|
70
|
+
"lint": "eslint \"src/**/*.ts*\"",
|
|
71
|
+
"type-check": "tsc --noEmit"
|
|
72
|
+
}
|
|
73
|
+
}
|