@funkit/connect-rn 0.2.0-next.0 → 0.2.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/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +515 -2043
- package/dist/index.js.map +4 -4
- package/dist/src/icons/CopyIcon.d.ts +3 -0
- package/dist/src/icons/CopyIcon.d.ts.map +1 -0
- package/dist/src/icons/NetworkIconFallback.d.ts +3 -0
- package/dist/src/icons/NetworkIconFallback.d.ts.map +1 -0
- package/dist/src/icons/QrCodeIcon.d.ts +3 -0
- package/dist/src/icons/QrCodeIcon.d.ts.map +1 -0
- package/dist/src/identity/IdentityContext.d.ts +0 -29
- package/dist/src/identity/IdentityContext.d.ts.map +1 -1
- package/dist/src/logging/datadogHttpLogTransport.d.ts +7 -0
- package/dist/src/logging/datadogHttpLogTransport.d.ts.map +1 -1
- package/dist/src/providers/FunkitProvider.d.ts +6 -27
- package/dist/src/providers/FunkitProvider.d.ts.map +1 -1
- package/dist/src/providers/FunkitStatsigProvider.d.ts +2 -6
- package/dist/src/providers/FunkitStatsigProvider.d.ts.map +1 -1
- package/dist/src/screens/AddMoneyScreen.d.ts.map +1 -1
- package/dist/src/screens/QrCodeScreen.d.ts.map +1 -1
- package/dist/src/screens/TransferCryptoScreen.d.ts +1 -3
- package/dist/src/screens/TransferCryptoScreen.d.ts.map +1 -1
- package/dist/src/statsig/statsigMetadata.d.ts.map +1 -1
- package/dist/src/theme/FunkitThemeProvider.d.ts +1 -13
- package/dist/src/theme/FunkitThemeProvider.d.ts.map +1 -1
- package/dist/src/theme/colorSchemeContext.d.ts +22 -0
- package/dist/src/theme/colorSchemeContext.d.ts.map +1 -0
- package/dist/src/theme/restyle.d.ts +0 -146
- package/dist/src/theme/restyle.d.ts.map +1 -1
- package/dist/src/theme/toRestyleTheme.d.ts.map +1 -1
- package/dist/src/theme/useFunkitTheme.d.ts +10 -4
- package/dist/src/theme/useFunkitTheme.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useTokenTransfer.d.ts +2 -4
- package/dist/src/transfer/hooks/useTokenTransfer.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useTransferInit.d.ts +1 -1
- package/dist/src/transfer/hooks/useTransferInit.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useUDAParams.d.ts +1 -1
- package/dist/src/transfer/hooks/useUDAParams.d.ts.map +1 -1
- package/package.json +3 -11
- package/dist/src/flow/FunkitFlowProvider.d.ts +0 -20
- package/dist/src/flow/FunkitFlowProvider.d.ts.map +0 -1
- package/dist/src/flow/depositFlowConfig.d.ts +0 -70
- package/dist/src/flow/depositFlowConfig.d.ts.map +0 -1
- package/dist/src/geo/useUserIpInfo.d.ts +0 -22
- package/dist/src/geo/useUserIpInfo.d.ts.map +0 -1
- package/dist/src/icons/ChainClusterIcon.d.ts +0 -12
- package/dist/src/icons/ChainClusterIcon.d.ts.map +0 -1
- package/dist/src/icons/FunIcon.d.ts +0 -18
- package/dist/src/icons/FunIcon.d.ts.map +0 -1
- package/dist/src/icons/assetLogos.d.ts +0 -12
- package/dist/src/icons/assetLogos.d.ts.map +0 -1
- package/dist/src/icons/funIconUri.d.ts +0 -16
- package/dist/src/icons/funIconUri.d.ts.map +0 -1
- package/dist/src/providers/index.d.ts +0 -2
- package/dist/src/providers/index.d.ts.map +0 -1
- package/dist/src/providers/useFunkitCheckout.d.ts +0 -14
- package/dist/src/providers/useFunkitCheckout.d.ts.map +0 -1
- package/dist/src/screens/ChooseChainScreen.d.ts +0 -35
- package/dist/src/screens/ChooseChainScreen.d.ts.map +0 -1
- package/dist/src/screens/CryptoCashToggle.d.ts +0 -17
- package/dist/src/screens/CryptoCashToggle.d.ts.map +0 -1
- package/dist/src/screens/SupportedTokensScreen.d.ts +0 -44
- package/dist/src/screens/SupportedTokensScreen.d.ts.map +0 -1
- package/dist/src/swapped/SwappedScreen.d.ts +0 -21
- package/dist/src/swapped/SwappedScreen.d.ts.map +0 -1
- package/dist/src/swapped/SwappedWebView.d.ts +0 -18
- package/dist/src/swapped/SwappedWebView.d.ts.map +0 -1
- package/dist/src/swapped/webViewSwappedTransport.d.ts +0 -47
- package/dist/src/swapped/webViewSwappedTransport.d.ts.map +0 -1
- package/dist/src/theme/FunkitProvider.d.ts +0 -45
- package/dist/src/theme/FunkitProvider.d.ts.map +0 -1
- package/dist/src/theme/index.d.ts +0 -7
- package/dist/src/theme/index.d.ts.map +0 -1
- package/dist/src/transfer/QrCode.d.ts +0 -15
- package/dist/src/transfer/QrCode.d.ts.map +0 -1
- package/dist/src/transfer/clipboard.d.ts +0 -15
- package/dist/src/transfer/clipboard.d.ts.map +0 -1
- package/dist/src/transfer/fops.d.ts +0 -26
- package/dist/src/transfer/fops.d.ts.map +0 -1
- package/dist/src/transfer/formatDepositAddress.d.ts +0 -9
- package/dist/src/transfer/formatDepositAddress.d.ts.map +0 -1
- package/dist/src/transfer/hooks/useFops.d.ts +0 -38
- package/dist/src/transfer/hooks/useFops.d.ts.map +0 -1
- package/dist/src/transfer/hooks/useSupportedTokens.d.ts +0 -26
- package/dist/src/transfer/hooks/useSupportedTokens.d.ts.map +0 -1
- package/dist/src/transfer/supportedTokens.d.ts +0 -23
- package/dist/src/transfer/supportedTokens.d.ts.map +0 -1
- package/dist/src/version.d.ts +0 -2
- package/dist/src/version.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -310,7 +310,13 @@ function useColorScheme() {
|
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
// src/theme/useFunkitTheme.ts
|
|
313
|
-
import { useMemo } from "react";
|
|
313
|
+
import { useContext, useMemo } from "react";
|
|
314
|
+
|
|
315
|
+
// src/theme/colorSchemeContext.ts
|
|
316
|
+
import { createContext } from "react";
|
|
317
|
+
var FunkitColorSchemeContext = createContext(null);
|
|
318
|
+
|
|
319
|
+
// src/theme/useFunkitTheme.ts
|
|
314
320
|
var DEFAULT_THEME_SET = {
|
|
315
321
|
light: defaultLightTheme,
|
|
316
322
|
dark: defaultDarkTheme
|
|
@@ -329,7 +335,9 @@ function selectTheme(themeSet, scheme) {
|
|
|
329
335
|
);
|
|
330
336
|
}
|
|
331
337
|
function useFunkitTheme(themeSet = DEFAULT_THEME_SET) {
|
|
332
|
-
const
|
|
338
|
+
const providerScheme = useContext(FunkitColorSchemeContext)?.colorScheme;
|
|
339
|
+
const systemScheme = useColorScheme();
|
|
340
|
+
const scheme = providerScheme ?? systemScheme;
|
|
333
341
|
return useMemo(
|
|
334
342
|
() => selectTheme(themeSet, scheme),
|
|
335
343
|
[scheme, themeSet.light, themeSet.dark]
|
|
@@ -337,21 +345,15 @@ function useFunkitTheme(themeSet = DEFAULT_THEME_SET) {
|
|
|
337
345
|
}
|
|
338
346
|
|
|
339
347
|
// src/theme/restyle.ts
|
|
340
|
-
import {
|
|
341
|
-
createBox,
|
|
342
|
-
createText,
|
|
343
|
-
useTheme as useRestyleTheme
|
|
344
|
-
} from "@shopify/restyle";
|
|
348
|
+
import { createBox, createText } from "@shopify/restyle";
|
|
345
349
|
var Box = createBox();
|
|
346
350
|
var Text = createText();
|
|
347
|
-
var useTheme = () => useRestyleTheme();
|
|
348
351
|
|
|
349
352
|
// src/theme/FunkitThemeProvider.tsx
|
|
350
353
|
import { ThemeProvider } from "@shopify/restyle";
|
|
351
354
|
import {
|
|
352
|
-
createContext,
|
|
353
355
|
useCallback,
|
|
354
|
-
useContext,
|
|
356
|
+
useContext as useContext2,
|
|
355
357
|
useMemo as useMemo2,
|
|
356
358
|
useState as useState2
|
|
357
359
|
} from "react";
|
|
@@ -360,9 +362,6 @@ var DEFAULT_THEMES = {
|
|
|
360
362
|
light: defaultLightTheme,
|
|
361
363
|
dark: defaultDarkTheme
|
|
362
364
|
};
|
|
363
|
-
var FunkitColorSchemeContext = createContext(
|
|
364
|
-
null
|
|
365
|
-
);
|
|
366
365
|
function FunkitThemeProvider({
|
|
367
366
|
children,
|
|
368
367
|
themes = DEFAULT_THEMES,
|
|
@@ -395,255 +394,253 @@ function FunkitThemeProvider({
|
|
|
395
394
|
return /* @__PURE__ */ jsx(FunkitColorSchemeContext.Provider, { value, children: /* @__PURE__ */ jsx(ThemeProvider, { theme, children }) });
|
|
396
395
|
}
|
|
397
396
|
function useFunkitColorScheme() {
|
|
398
|
-
const value =
|
|
397
|
+
const value = useContext2(FunkitColorSchemeContext);
|
|
399
398
|
if (value == null) {
|
|
400
399
|
throw new Error("useFunkitColorScheme must be used within <FunkitProvider>");
|
|
401
400
|
}
|
|
402
401
|
return value;
|
|
403
402
|
}
|
|
404
403
|
|
|
405
|
-
// src/providers/
|
|
406
|
-
import {
|
|
407
|
-
|
|
404
|
+
// src/providers/FunkitStatsigProvider.tsx
|
|
405
|
+
import {
|
|
406
|
+
LogEventCompressionMode,
|
|
407
|
+
LogLevel,
|
|
408
|
+
StatsigProvider
|
|
409
|
+
} from "@statsig/react-bindings";
|
|
408
410
|
|
|
409
|
-
// src/
|
|
411
|
+
// src/statsig/useClientAsyncInitRN.ts
|
|
410
412
|
import {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
useContext as useContext3,
|
|
414
|
-
useMemo as useMemo6,
|
|
415
|
-
useState as useState5
|
|
416
|
-
} from "react";
|
|
417
|
-
import { Modal, Pressable as Pressable6, Share } from "react-native";
|
|
413
|
+
useStatsigInternalClientFactoryAsync
|
|
414
|
+
} from "@statsig/react-bindings";
|
|
418
415
|
|
|
419
|
-
// src/
|
|
420
|
-
import {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
416
|
+
// src/statsig/StatsigClientRN.ts
|
|
417
|
+
import {
|
|
418
|
+
StatsigClient
|
|
419
|
+
} from "@statsig/react-bindings";
|
|
420
|
+
|
|
421
|
+
// src/statsig/rnSetup.ts
|
|
422
|
+
import {
|
|
423
|
+
SDKType,
|
|
424
|
+
StatsigMetadataProvider
|
|
425
|
+
} from "@statsig/react-bindings";
|
|
426
|
+
|
|
427
|
+
// src/statsig/appVisibilityShim.ts
|
|
428
|
+
import { _notifyVisibilityChanged } from "@statsig/react-bindings";
|
|
429
|
+
import { AppState } from "react-native";
|
|
430
|
+
var isApplied = false;
|
|
431
|
+
function applyAppStateVisibilityShim() {
|
|
432
|
+
if (isApplied) {
|
|
433
|
+
return;
|
|
433
434
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
() => svgCache.get(currentUri) ?? null
|
|
435
|
+
isApplied = true;
|
|
436
|
+
AppState.addEventListener(
|
|
437
|
+
"change",
|
|
438
|
+
(nextAppState) => _notifyVisibilityChanged(
|
|
439
|
+
nextAppState === "active" ? "foreground" : "background"
|
|
440
|
+
)
|
|
441
441
|
);
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// src/statsig/preloadedAsyncStorage.ts
|
|
445
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
446
|
+
import { Log } from "@statsig/react-bindings";
|
|
447
|
+
var NOT_READY_ERROR = "Attempting to alter AsyncStorage before it is ready. Values will not be persisted.";
|
|
448
|
+
function createPreloadedAsyncStorage() {
|
|
449
|
+
const inMemoryStore = {};
|
|
450
|
+
let isResolved = false;
|
|
451
|
+
let readyPromise = null;
|
|
452
|
+
const enforceIsResolved = () => {
|
|
453
|
+
if (!isResolved) {
|
|
454
|
+
Log.error(NOT_READY_ERROR);
|
|
453
455
|
}
|
|
456
|
+
return isResolved;
|
|
454
457
|
};
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
let active = true;
|
|
465
|
-
fetch(currentUri).then((res) => res.text()).then((text) => {
|
|
466
|
-
const normalized = ensureViewBox(text);
|
|
467
|
-
svgCache.set(currentUri, normalized);
|
|
468
|
-
if (active) {
|
|
469
|
-
setXml(normalized);
|
|
458
|
+
const provider = {
|
|
459
|
+
getProviderName: () => "AsyncStorage",
|
|
460
|
+
isReady: () => isResolved,
|
|
461
|
+
isReadyResolver: () => {
|
|
462
|
+
if (!readyPromise) {
|
|
463
|
+
readyPromise = prefetchFromAsyncStorage(inMemoryStore).finally(() => {
|
|
464
|
+
isResolved = true;
|
|
465
|
+
});
|
|
470
466
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
467
|
+
return readyPromise;
|
|
468
|
+
},
|
|
469
|
+
getItem: (key) => {
|
|
470
|
+
if (!enforceIsResolved()) {
|
|
471
|
+
return null;
|
|
474
472
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
{
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
onError: onFailure
|
|
497
|
-
}
|
|
498
|
-
)
|
|
473
|
+
return inMemoryStore[key] ?? null;
|
|
474
|
+
},
|
|
475
|
+
setItem: (key, value) => {
|
|
476
|
+
inMemoryStore[key] = value;
|
|
477
|
+
if (!enforceIsResolved()) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
AsyncStorage.setItem(key, value).catch(Log.error);
|
|
481
|
+
},
|
|
482
|
+
removeItem: (key) => {
|
|
483
|
+
delete inMemoryStore[key];
|
|
484
|
+
if (!enforceIsResolved()) {
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
AsyncStorage.removeItem(key).catch(Log.error);
|
|
488
|
+
},
|
|
489
|
+
getAllKeys: () => {
|
|
490
|
+
if (!enforceIsResolved()) {
|
|
491
|
+
return [];
|
|
492
|
+
}
|
|
493
|
+
return Object.keys(inMemoryStore);
|
|
499
494
|
}
|
|
495
|
+
};
|
|
496
|
+
return provider;
|
|
497
|
+
}
|
|
498
|
+
async function prefetchFromAsyncStorage(inMemoryStore) {
|
|
499
|
+
const keys = await AsyncStorage.getAllKeys();
|
|
500
|
+
await Promise.all(
|
|
501
|
+
keys.map(async (key) => {
|
|
502
|
+
if (!key.startsWith("statsig.")) {
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
const cache = await AsyncStorage.getItem(key);
|
|
506
|
+
if (!cache) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
inMemoryStore[key] = cache;
|
|
510
|
+
})
|
|
500
511
|
);
|
|
501
512
|
}
|
|
502
513
|
|
|
503
|
-
// src/
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
MATIC: "https://sdk-cdn.fun.xyz/images/matic.svg",
|
|
534
|
-
MFER: "https://sdk-cdn.fun.xyz/images/mfer.png",
|
|
535
|
-
MKR: "https://sdk-cdn.fun.xyz/images/mkr.svg",
|
|
536
|
-
MNT: "https://sdk-cdn.fun.xyz/images/mnt.svg",
|
|
537
|
-
OP: "https://sdk-cdn.fun.xyz/images/optimism.svg",
|
|
538
|
-
PENDLE: "https://sdk-cdn.fun.xyz/images/pendle.svg",
|
|
539
|
-
POL: "https://sdk-cdn.fun.xyz/images/matic.svg",
|
|
540
|
-
PYUSD: "https://sdk-cdn.fun.xyz/images/pyusd.svg",
|
|
541
|
-
QNT: "https://sdk-cdn.fun.xyz/images/qnt.svg",
|
|
542
|
-
RNDR: "https://sdk-cdn.fun.xyz/images/rndr.svg",
|
|
543
|
-
ROOST: "https://sdk-cdn.fun.xyz/images/roost.png",
|
|
544
|
-
SAND: "https://sdk-cdn.fun.xyz/images/sand.svg",
|
|
545
|
-
SHIB: "https://sdk-cdn.fun.xyz/images/shib.svg",
|
|
546
|
-
SNX: "https://sdk-cdn.fun.xyz/images/snx.svg",
|
|
547
|
-
SOL: "https://sdk-cdn.fun.xyz/images/sol.svg",
|
|
548
|
-
SUSDS: "https://sdk-cdn.fun.xyz/images/susds.svg",
|
|
549
|
-
TYBG: "https://sdk-cdn.fun.xyz/images/tybg.png",
|
|
550
|
-
UNI: "https://sdk-cdn.fun.xyz/images/uni.png",
|
|
551
|
-
USDC: "https://sdk-cdn.fun.xyz/images/usdc.svg",
|
|
552
|
-
"USDC.E": "https://sdk-cdn.fun.xyz/images/usdc.svg",
|
|
553
|
-
USDBC: "https://sdk-cdn.fun.xyz/images/usdc.svg",
|
|
554
|
-
USDE: "https://sdk-cdn.fun.xyz/images/usde.svg",
|
|
555
|
-
WUSDE: "https://sdk-cdn.fun.xyz/images/usde.svg",
|
|
556
|
-
EUSDE: "https://sdk-cdn.fun.xyz/images/eusde.svg",
|
|
557
|
-
USDT: "https://sdk-cdn.fun.xyz/images/usdt.svg",
|
|
558
|
-
"USD\u20AE0": "https://sdk-cdn.fun.xyz/images/usdt0.svg",
|
|
559
|
-
USDT0: "https://sdk-cdn.fun.xyz/images/usdt0.svg",
|
|
560
|
-
USDS: "https://sdk-cdn.fun.xyz/images/usds.svg",
|
|
561
|
-
USDH: "https://sdk-cdn.fun.xyz/images/usdh.svg",
|
|
562
|
-
VRTX: "https://sdk-cdn.fun.xyz/images/vrtx.svg",
|
|
563
|
-
WBTC: "https://sdk-cdn.fun.xyz/images/wbtc.svg",
|
|
564
|
-
WEETH: "https://sdk-cdn.fun.xyz/images/weeth.png",
|
|
565
|
-
WETH: "https://sdk-cdn.fun.xyz/images/weth.svg",
|
|
566
|
-
WHYPE: "https://sdk-cdn.fun.xyz/images/whype.png",
|
|
567
|
-
WSTETH: "https://sdk-cdn.fun.xyz/images/wsteth.png",
|
|
568
|
-
TRUMP: "https://sdk-cdn.fun.xyz/images/trump.png",
|
|
569
|
-
BNB: "https://sdk-cdn.fun.xyz/images/bsc.svg",
|
|
570
|
-
WBNB: "https://sdk-cdn.fun.xyz/images/bsc.svg",
|
|
571
|
-
BTCB: "https://sdk-cdn.fun.xyz/images/btc.svg",
|
|
572
|
-
UBTC: "https://sdk-cdn.fun.xyz/images/btc.svg",
|
|
573
|
-
BUSD: "https://sdk-cdn.fun.xyz/images/busd.svg",
|
|
574
|
-
XAUT: "https://sdk-cdn.fun.xyz/images/xaut.png",
|
|
575
|
-
ADA: "https://sdk-cdn.fun.xyz/images/ada.svg",
|
|
576
|
-
XRP: "https://sdk-cdn.fun.xyz/images/xrp.svg",
|
|
577
|
-
UDOGE: "https://sdk-cdn.fun.xyz/images/doge.svg",
|
|
578
|
-
DOGE: "https://sdk-cdn.fun.xyz/images/doge.svg",
|
|
579
|
-
LTC: "https://sdk-cdn.fun.xyz/images/ltc.svg",
|
|
580
|
-
HNT: "https://sdk-cdn.fun.xyz/images/hnt.svg",
|
|
581
|
-
COMP: "https://sdk-cdn.fun.xyz/images/comp.svg",
|
|
582
|
-
PEPE: "https://sdk-cdn.fun.xyz/images/pepe.svg",
|
|
583
|
-
LSTHYPE: "https://sdk-cdn.fun.xyz/images/lsthype.svg",
|
|
584
|
-
HBUSDT: "https://sdk-cdn.fun.xyz/images/hbusdt.svg",
|
|
585
|
-
WVLP: "https://sdk-cdn.fun.xyz/images/wvlp.svg",
|
|
586
|
-
LIQUIDHYPE: "https://sdk-cdn.fun.xyz/images/liquidhype.svg",
|
|
587
|
-
VHYPE: "https://sdk-cdn.fun.xyz/images/vhype.png",
|
|
588
|
-
HBHYPE: "https://sdk-cdn.fun.xyz/images/hbhype.svg",
|
|
589
|
-
MON: "https://sdk-cdn.fun.xyz/images/monad.svg",
|
|
590
|
-
WMON: "https://sdk-cdn.fun.xyz/images/wmon.svg",
|
|
591
|
-
AUSD: "https://sdk-cdn.fun.xyz/images/ausd.svg",
|
|
592
|
-
SUSHI: "https://sdk-cdn.fun.xyz/images/sushi.svg",
|
|
593
|
-
SKY: "https://sdk-cdn.fun.xyz/images/sky.svg",
|
|
594
|
-
LIT: "https://sdk-cdn.fun.xyz/images/lit.svg",
|
|
595
|
-
AZTEC: "https://sdk-cdn.fun.xyz/images/aztec.svg",
|
|
596
|
-
U: "https://sdk-cdn.fun.xyz/images/u.png",
|
|
597
|
-
PUSD: "https://sdk-cdn.fun.xyz/images/pusd.svg"
|
|
598
|
-
};
|
|
599
|
-
var FALLBACK_ASSET_LOGO = "https://sdk-cdn.fun.xyz/images/dollar_circle.png";
|
|
600
|
-
|
|
601
|
-
// src/icons/funIconUri.ts
|
|
602
|
-
var CDN_BASE = "https://sdk-cdn.fun.xyz/images";
|
|
603
|
-
var chainIconUri = (chainKey) => `${CDN_BASE}/${chainKey}.svg`;
|
|
604
|
-
var tokenLogoUri = (symbol) => ASSET_LOGO_SRCS[symbol.toUpperCase()] ?? `${CDN_BASE}/${symbol.toLowerCase()}.svg`;
|
|
514
|
+
// src/statsig/rnSetup.ts
|
|
515
|
+
function setupStatsigForReactNative(statsigMetadataAdditions, options) {
|
|
516
|
+
applyAppStateVisibilityShim();
|
|
517
|
+
SDKType._setBindingType("rn");
|
|
518
|
+
if (statsigMetadataAdditions) {
|
|
519
|
+
StatsigMetadataProvider.add(statsigMetadataAdditions);
|
|
520
|
+
}
|
|
521
|
+
if (options.storageProvider == null) {
|
|
522
|
+
options.storageProvider = createPreloadedAsyncStorage();
|
|
523
|
+
}
|
|
524
|
+
applyNetworkFix(options);
|
|
525
|
+
}
|
|
526
|
+
function applyNetworkFix(options) {
|
|
527
|
+
if (options.networkConfig?.networkOverrideFunc != null) {
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
const networkOverrideFunc = (url, args) => {
|
|
531
|
+
if (args.body != null && args.method === "POST") {
|
|
532
|
+
args.headers = {
|
|
533
|
+
"Content-Type": "application/json",
|
|
534
|
+
...args.headers
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
return fetch(url, args);
|
|
538
|
+
};
|
|
539
|
+
options.networkConfig = {
|
|
540
|
+
networkOverrideFunc,
|
|
541
|
+
...options.networkConfig
|
|
542
|
+
};
|
|
543
|
+
}
|
|
605
544
|
|
|
606
|
-
// src/
|
|
607
|
-
import {
|
|
608
|
-
function
|
|
609
|
-
if (
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
backgroundColor: "pillPressed"
|
|
617
|
-
}
|
|
618
|
-
);
|
|
545
|
+
// src/statsig/statsigMetadata.ts
|
|
546
|
+
import { NativeModules, Platform } from "react-native";
|
|
547
|
+
function resolveLocale() {
|
|
548
|
+
if (Platform.OS === "android") {
|
|
549
|
+
const i18nManager = NativeModules.I18nManager;
|
|
550
|
+
return i18nManager?.localeIdentifier ?? void 0;
|
|
551
|
+
}
|
|
552
|
+
if (Platform.OS === "ios") {
|
|
553
|
+
const settings = NativeModules.SettingsManager?.settings;
|
|
554
|
+
return settings?.AppLocale ?? settings?.AppleLanguages?.[0] ?? void 0;
|
|
619
555
|
}
|
|
620
|
-
|
|
621
|
-
|
|
556
|
+
return void 0;
|
|
557
|
+
}
|
|
558
|
+
function getStatsigMetadataAdditions() {
|
|
559
|
+
return {
|
|
560
|
+
// Device-info-derived fields are dropped (no react-native-device-info).
|
|
561
|
+
appVersion: void 0,
|
|
562
|
+
systemVersion: void 0,
|
|
563
|
+
deviceModelName: void 0,
|
|
564
|
+
deviceModel: void 0,
|
|
565
|
+
// Available without any native module:
|
|
566
|
+
systemName: Platform.OS,
|
|
567
|
+
locale: resolveLocale()
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// src/statsig/StatsigClientRN.ts
|
|
572
|
+
var StatsigClientRN = class extends StatsigClient {
|
|
573
|
+
constructor(sdkKey, user, options = null) {
|
|
574
|
+
const opts = options ?? {};
|
|
575
|
+
setupStatsigForReactNative(getStatsigMetadataAdditions(), opts);
|
|
576
|
+
super(sdkKey, user, opts);
|
|
577
|
+
this.__isRnClient = true;
|
|
622
578
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
// src/statsig/useClientAsyncInitRN.ts
|
|
582
|
+
function useClientAsyncInitRN(sdkKey, initialUser, statsigOptions = null) {
|
|
583
|
+
return useStatsigInternalClientFactoryAsync(
|
|
584
|
+
(args) => new StatsigClientRN(args.sdkKey, args.initialUser, args.statsigOptions),
|
|
626
585
|
{
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
586
|
+
sdkKey,
|
|
587
|
+
initialUser,
|
|
588
|
+
statsigOptions
|
|
589
|
+
}
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
// src/providers/FunkitStatsigProvider.tsx
|
|
594
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
595
|
+
var STATSIG_API = "https://data-api.fun.xyz/v1";
|
|
596
|
+
var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
|
|
597
|
+
function FunkitStatsigProvider({
|
|
598
|
+
children,
|
|
599
|
+
isDevelopment = false
|
|
600
|
+
}) {
|
|
601
|
+
const { client } = useClientAsyncInitRN(
|
|
602
|
+
STATSIG_CLIENT_KEY,
|
|
603
|
+
{},
|
|
604
|
+
{
|
|
605
|
+
networkConfig: {
|
|
606
|
+
api: STATSIG_API,
|
|
607
|
+
// default timeout (10s) is too large; statsig usually responds <200ms
|
|
608
|
+
networkTimeoutMs: 5e3
|
|
609
|
+
},
|
|
610
|
+
// Our proxy supports compression; force it on to save bandwidth.
|
|
611
|
+
logEventCompressionMode: LogEventCompressionMode.Forced,
|
|
612
|
+
// Silence harmless warnings from hooks running before async init (we have
|
|
613
|
+
// bootstrap fallbacks).
|
|
614
|
+
logLevel: isDevelopment ? void 0 : LogLevel.Error,
|
|
615
|
+
environment: {
|
|
616
|
+
tier: isDevelopment ? "development" : "production"
|
|
617
|
+
}
|
|
634
618
|
}
|
|
635
619
|
);
|
|
620
|
+
return /* @__PURE__ */ jsx2(StatsigProvider, { client, children });
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// src/providers/FunkitProvider.tsx
|
|
624
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
625
|
+
function FunkitProvider({
|
|
626
|
+
children,
|
|
627
|
+
themes,
|
|
628
|
+
colorScheme,
|
|
629
|
+
debug = false
|
|
630
|
+
}) {
|
|
631
|
+
return /* @__PURE__ */ jsx3(FunkitStatsigProvider, { isDevelopment: debug, children: /* @__PURE__ */ jsx3(FunkitThemeProvider, { themes, colorScheme, children }) });
|
|
636
632
|
}
|
|
637
|
-
var grid = (mini) => ({ width: mini * 2 + 1, gap: 1 });
|
|
638
633
|
|
|
639
634
|
// src/screens/AddMoneyScreen.tsx
|
|
640
|
-
import {
|
|
635
|
+
import { useTheme } from "@shopify/restyle";
|
|
636
|
+
import { Pressable, ScrollView, StyleSheet } from "react-native";
|
|
641
637
|
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
642
638
|
function AddMoneyScreen({
|
|
643
639
|
methods,
|
|
644
640
|
onSelectMethod,
|
|
645
641
|
title = "Add money"
|
|
646
642
|
}) {
|
|
643
|
+
const theme = useTheme();
|
|
647
644
|
return /* @__PURE__ */ jsxs(
|
|
648
645
|
Box,
|
|
649
646
|
{
|
|
@@ -651,14 +648,19 @@ function AddMoneyScreen({
|
|
|
651
648
|
borderTopLeftRadius: "modal",
|
|
652
649
|
borderTopRightRadius: "modal",
|
|
653
650
|
children: [
|
|
654
|
-
/* @__PURE__ */ jsxs(Box, { alignItems: "center", style: topBar, children: [
|
|
655
|
-
/* @__PURE__ */ jsx4(Box, { backgroundColor: "borderFocused", style: grabber }),
|
|
651
|
+
/* @__PURE__ */ jsxs(Box, { alignItems: "center", style: styles.topBar, children: [
|
|
652
|
+
/* @__PURE__ */ jsx4(Box, { backgroundColor: "borderFocused", style: styles.grabber }),
|
|
656
653
|
/* @__PURE__ */ jsx4(Text, { variant: "bodyMedium", color: "textPrimary", children: title })
|
|
657
654
|
] }),
|
|
658
655
|
/* @__PURE__ */ jsx4(
|
|
659
656
|
ScrollView,
|
|
660
657
|
{
|
|
661
|
-
contentContainerStyle:
|
|
658
|
+
contentContainerStyle: [
|
|
659
|
+
styles.listContent,
|
|
660
|
+
// Bind the horizontal padding to the spacing token (ScrollView can't
|
|
661
|
+
// take Restyle props) so it tracks the theme instead of a raw 16.
|
|
662
|
+
{ paddingHorizontal: theme.spacing.modalHorizontal }
|
|
663
|
+
],
|
|
662
664
|
showsVerticalScrollIndicator: false,
|
|
663
665
|
children: methods.map((method) => /* @__PURE__ */ jsx4(
|
|
664
666
|
Pressable,
|
|
@@ -683,8 +685,7 @@ function PaymentMethodRow({ method }) {
|
|
|
683
685
|
flexDirection: "row",
|
|
684
686
|
alignItems: "center",
|
|
685
687
|
gap: "elementsHorizontal",
|
|
686
|
-
|
|
687
|
-
style: row,
|
|
688
|
+
style: styles.row,
|
|
688
689
|
children: [
|
|
689
690
|
/* @__PURE__ */ jsx4(
|
|
690
691
|
Box,
|
|
@@ -698,7 +699,7 @@ function PaymentMethodRow({ method }) {
|
|
|
698
699
|
children: method.icon
|
|
699
700
|
}
|
|
700
701
|
),
|
|
701
|
-
/* @__PURE__ */ jsxs(Box, { flex: 1, style: details, children: [
|
|
702
|
+
/* @__PURE__ */ jsxs(Box, { flex: 1, style: styles.details, children: [
|
|
702
703
|
/* @__PURE__ */ jsx4(Text, { variant: "bodyMedium", color: "textPrimary", children: method.title }),
|
|
703
704
|
method.subtitle ? /* @__PURE__ */ jsx4(Text, { variant: "detail", color: "textSecondary", children: method.subtitle }) : null
|
|
704
705
|
] }),
|
|
@@ -707,30 +708,32 @@ function PaymentMethodRow({ method }) {
|
|
|
707
708
|
}
|
|
708
709
|
);
|
|
709
710
|
}
|
|
710
|
-
var
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
|
|
711
|
+
var styles = StyleSheet.create({
|
|
712
|
+
topBar: { paddingTop: 20, paddingBottom: 12 },
|
|
713
|
+
grabber: {
|
|
714
|
+
position: "absolute",
|
|
715
|
+
top: 8,
|
|
716
|
+
width: 36,
|
|
717
|
+
height: 5,
|
|
718
|
+
borderRadius: 999
|
|
719
|
+
},
|
|
720
|
+
listContent: {
|
|
721
|
+
paddingBottom: 16,
|
|
722
|
+
gap: 6
|
|
723
|
+
},
|
|
724
|
+
row: { paddingVertical: 10 },
|
|
725
|
+
details: { gap: 2 }
|
|
726
|
+
});
|
|
725
727
|
|
|
726
|
-
// src/screens/
|
|
727
|
-
import { Pressable as Pressable2 } from "react-native";
|
|
728
|
+
// src/screens/QrCodeScreen.tsx
|
|
729
|
+
import { Pressable as Pressable2, StyleSheet as StyleSheet2 } from "react-native";
|
|
728
730
|
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
729
|
-
function
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
731
|
+
function QrCodeScreen({
|
|
732
|
+
qrCode,
|
|
733
|
+
accountName,
|
|
734
|
+
onClose,
|
|
735
|
+
onShare,
|
|
736
|
+
onSupportedChainsPress
|
|
734
737
|
}) {
|
|
735
738
|
return /* @__PURE__ */ jsxs2(
|
|
736
739
|
Box,
|
|
@@ -738,137 +741,47 @@ function ChooseChainScreen({
|
|
|
738
741
|
backgroundColor: "bgModal",
|
|
739
742
|
borderTopLeftRadius: "modal",
|
|
740
743
|
borderTopRightRadius: "modal",
|
|
744
|
+
style: styles2.sheet,
|
|
741
745
|
children: [
|
|
742
|
-
/* @__PURE__ */ jsxs2(Box, { flexDirection: "row", alignItems: "center",
|
|
743
|
-
/* @__PURE__ */ jsx5(
|
|
746
|
+
/* @__PURE__ */ jsxs2(Box, { flexDirection: "row", alignItems: "center", style: styles2.topBar, children: [
|
|
747
|
+
/* @__PURE__ */ jsx5(
|
|
748
|
+
Box,
|
|
749
|
+
{
|
|
750
|
+
backgroundColor: "borderFocused",
|
|
751
|
+
borderRadius: "rounded",
|
|
752
|
+
style: styles2.grabber
|
|
753
|
+
}
|
|
754
|
+
),
|
|
744
755
|
/* @__PURE__ */ jsx5(
|
|
745
756
|
Pressable2,
|
|
746
757
|
{
|
|
747
|
-
onPress:
|
|
758
|
+
onPress: onClose,
|
|
748
759
|
hitSlop: 12,
|
|
749
760
|
accessibilityRole: "button",
|
|
750
|
-
accessibilityLabel: "
|
|
751
|
-
children: /* @__PURE__ */ jsx5(Text, { color: "textPrimary", style:
|
|
761
|
+
accessibilityLabel: "Close",
|
|
762
|
+
children: /* @__PURE__ */ jsx5(Text, { color: "textPrimary", style: styles2.closeGlyph, children: "\u2715" })
|
|
752
763
|
}
|
|
753
|
-
)
|
|
754
|
-
/* @__PURE__ */ jsx5(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx5(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
|
|
755
|
-
/* @__PURE__ */ jsx5(Box, { style: topBarSpacer })
|
|
764
|
+
)
|
|
756
765
|
] }),
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
766
|
+
/* @__PURE__ */ jsxs2(Box, { alignItems: "center", style: styles2.content, children: [
|
|
767
|
+
/* @__PURE__ */ jsxs2(Text, { variant: "body", color: "textSecondary", style: styles2.caption, children: [
|
|
768
|
+
`Scan to deposit to this ${accountName ? `${accountName} ` : ""}account.
|
|
769
|
+
`,
|
|
770
|
+
"Use it only for",
|
|
771
|
+
" ",
|
|
772
|
+
/* @__PURE__ */ jsx5(
|
|
773
|
+
Text,
|
|
765
774
|
{
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
children:
|
|
772
|
-
chain.icon ?? /* @__PURE__ */ jsx5(ChainIconFallback, {}),
|
|
773
|
-
/* @__PURE__ */ jsx5(Text, { variant: "bodyMedium", color: "textPrimary", children: chain.label })
|
|
774
|
-
]
|
|
775
|
-
}
|
|
776
|
-
)
|
|
777
|
-
},
|
|
778
|
-
chain.id
|
|
779
|
-
)) })
|
|
780
|
-
]
|
|
781
|
-
}
|
|
782
|
-
);
|
|
783
|
-
}
|
|
784
|
-
function ChainIconFallback() {
|
|
785
|
-
return /* @__PURE__ */ jsx5(
|
|
786
|
-
Box,
|
|
787
|
-
{
|
|
788
|
-
width: 32,
|
|
789
|
-
height: 32,
|
|
790
|
-
borderRadius: "rounded",
|
|
791
|
-
backgroundColor: "pillPressed"
|
|
792
|
-
}
|
|
793
|
-
);
|
|
794
|
-
}
|
|
795
|
-
var topBar2 = {
|
|
796
|
-
paddingTop: 20,
|
|
797
|
-
paddingBottom: 12,
|
|
798
|
-
paddingHorizontal: 12
|
|
799
|
-
};
|
|
800
|
-
var topBarSpacer = { width: 32, height: 32 };
|
|
801
|
-
var grabber2 = {
|
|
802
|
-
position: "absolute",
|
|
803
|
-
top: 8,
|
|
804
|
-
left: "50%",
|
|
805
|
-
marginLeft: -18,
|
|
806
|
-
width: 36,
|
|
807
|
-
height: 5,
|
|
808
|
-
borderRadius: 999
|
|
809
|
-
};
|
|
810
|
-
var chevron = {
|
|
811
|
-
fontSize: 26,
|
|
812
|
-
lineHeight: 28,
|
|
813
|
-
width: 24,
|
|
814
|
-
textAlign: "center"
|
|
815
|
-
};
|
|
816
|
-
var content = { paddingHorizontal: 16, paddingBottom: 16 };
|
|
817
|
-
var row2 = { paddingHorizontal: 16, paddingVertical: 10 };
|
|
818
|
-
|
|
819
|
-
// src/screens/QrCodeScreen.tsx
|
|
820
|
-
import { Pressable as Pressable3 } from "react-native";
|
|
821
|
-
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
822
|
-
function QrCodeScreen({
|
|
823
|
-
qrCode,
|
|
824
|
-
accountName,
|
|
825
|
-
onClose,
|
|
826
|
-
onShare,
|
|
827
|
-
onSupportedChainsPress
|
|
828
|
-
}) {
|
|
829
|
-
return /* @__PURE__ */ jsxs3(
|
|
830
|
-
Box,
|
|
831
|
-
{
|
|
832
|
-
backgroundColor: "bgModal",
|
|
833
|
-
borderTopLeftRadius: "modal",
|
|
834
|
-
borderTopRightRadius: "modal",
|
|
835
|
-
style: sheet,
|
|
836
|
-
children: [
|
|
837
|
-
/* @__PURE__ */ jsxs3(Box, { flexDirection: "row", alignItems: "center", style: topBar3, children: [
|
|
838
|
-
/* @__PURE__ */ jsx6(Box, { backgroundColor: "borderFocused", style: grabber3 }),
|
|
839
|
-
/* @__PURE__ */ jsx6(
|
|
840
|
-
Pressable3,
|
|
841
|
-
{
|
|
842
|
-
onPress: onClose,
|
|
843
|
-
hitSlop: 12,
|
|
844
|
-
accessibilityRole: "button",
|
|
845
|
-
accessibilityLabel: "Close",
|
|
846
|
-
children: /* @__PURE__ */ jsx6(Text, { color: "textPrimary", style: closeGlyph, children: "\u2715" })
|
|
847
|
-
}
|
|
848
|
-
),
|
|
849
|
-
/* @__PURE__ */ jsx6(Box, { flex: 1 }),
|
|
850
|
-
/* @__PURE__ */ jsx6(Box, { style: topBarSpacer2 })
|
|
851
|
-
] }),
|
|
852
|
-
/* @__PURE__ */ jsxs3(Box, { alignItems: "center", style: content2, children: [
|
|
853
|
-
/* @__PURE__ */ jsxs3(Text, { variant: "body", color: "textSecondary", style: caption, children: [
|
|
854
|
-
`Scan to deposit to this ${accountName ? `${accountName} ` : ""}account.
|
|
855
|
-
`,
|
|
856
|
-
"Use it only for",
|
|
857
|
-
" ",
|
|
858
|
-
/* @__PURE__ */ jsx6(
|
|
859
|
-
Text,
|
|
860
|
-
{
|
|
861
|
-
variant: "body",
|
|
862
|
-
color: "textSecondary",
|
|
863
|
-
style: link,
|
|
864
|
-
onPress: onSupportedChainsPress,
|
|
865
|
-
accessibilityRole: "link",
|
|
866
|
-
accessibilityLabel: "supported chains",
|
|
867
|
-
children: "supported chains"
|
|
775
|
+
variant: "body",
|
|
776
|
+
color: "textSecondary",
|
|
777
|
+
style: onSupportedChainsPress ? styles2.link : void 0,
|
|
778
|
+
onPress: onSupportedChainsPress,
|
|
779
|
+
accessibilityRole: onSupportedChainsPress ? "link" : void 0,
|
|
780
|
+
children: "supported chains"
|
|
868
781
|
}
|
|
869
782
|
)
|
|
870
783
|
] }),
|
|
871
|
-
/* @__PURE__ */
|
|
784
|
+
/* @__PURE__ */ jsx5(
|
|
872
785
|
Box,
|
|
873
786
|
{
|
|
874
787
|
backgroundColor: "bgModal",
|
|
@@ -876,17 +789,17 @@ function QrCodeScreen({
|
|
|
876
789
|
borderWidth: 2,
|
|
877
790
|
alignItems: "center",
|
|
878
791
|
justifyContent: "center",
|
|
879
|
-
style: qrFrame,
|
|
792
|
+
style: styles2.qrFrame,
|
|
880
793
|
children: qrCode
|
|
881
794
|
}
|
|
882
795
|
),
|
|
883
|
-
/* @__PURE__ */
|
|
884
|
-
|
|
796
|
+
/* @__PURE__ */ jsx5(
|
|
797
|
+
Pressable2,
|
|
885
798
|
{
|
|
886
799
|
onPress: onShare,
|
|
887
800
|
accessibilityRole: "button",
|
|
888
801
|
accessibilityLabel: "Share",
|
|
889
|
-
children: /* @__PURE__ */
|
|
802
|
+
children: /* @__PURE__ */ jsx5(
|
|
890
803
|
Box,
|
|
891
804
|
{
|
|
892
805
|
width: 68,
|
|
@@ -895,7 +808,7 @@ function QrCodeScreen({
|
|
|
895
808
|
backgroundColor: "bgSecondary",
|
|
896
809
|
alignItems: "center",
|
|
897
810
|
justifyContent: "center",
|
|
898
|
-
children: /* @__PURE__ */
|
|
811
|
+
children: /* @__PURE__ */ jsx5(Text, { color: "textPrimary", style: styles2.shareGlyph, children: "\u2191" })
|
|
899
812
|
}
|
|
900
813
|
)
|
|
901
814
|
}
|
|
@@ -905,167 +818,77 @@ function QrCodeScreen({
|
|
|
905
818
|
}
|
|
906
819
|
);
|
|
907
820
|
}
|
|
908
|
-
var
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
|
|
821
|
+
var styles2 = StyleSheet2.create({
|
|
822
|
+
sheet: { paddingBottom: 32 },
|
|
823
|
+
topBar: {
|
|
824
|
+
paddingTop: 20,
|
|
825
|
+
paddingBottom: 8,
|
|
826
|
+
paddingHorizontal: 12
|
|
827
|
+
},
|
|
828
|
+
grabber: {
|
|
829
|
+
position: "absolute",
|
|
830
|
+
top: 8,
|
|
831
|
+
left: "50%",
|
|
832
|
+
marginLeft: -18,
|
|
833
|
+
width: 36,
|
|
834
|
+
height: 5
|
|
835
|
+
},
|
|
836
|
+
content: { paddingHorizontal: 20, paddingTop: 16, gap: 32 },
|
|
837
|
+
caption: { textAlign: "center" },
|
|
838
|
+
link: { textDecorationLine: "underline" },
|
|
839
|
+
qrFrame: {
|
|
840
|
+
width: 275,
|
|
841
|
+
height: 275,
|
|
842
|
+
borderRadius: 20,
|
|
843
|
+
padding: 16
|
|
844
|
+
},
|
|
845
|
+
closeGlyph: { fontSize: 18, lineHeight: 22 },
|
|
846
|
+
shareGlyph: { fontSize: 28, lineHeight: 32, fontWeight: "500" }
|
|
847
|
+
});
|
|
935
848
|
|
|
936
|
-
// src/screens/
|
|
937
|
-
import {
|
|
938
|
-
import { Pressable as
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
backgroundColor: "bgModal",
|
|
957
|
-
borderTopLeftRadius: "modal",
|
|
958
|
-
borderTopRightRadius: "modal",
|
|
959
|
-
children: [
|
|
960
|
-
/* @__PURE__ */ jsxs4(Box, { flexDirection: "row", alignItems: "center", gap: "none", style: topBar4, children: [
|
|
961
|
-
/* @__PURE__ */ jsx7(Box, { backgroundColor: "borderFocused", style: grabber4 }),
|
|
962
|
-
/* @__PURE__ */ jsx7(
|
|
963
|
-
Pressable4,
|
|
964
|
-
{
|
|
965
|
-
onPress: onBack,
|
|
966
|
-
hitSlop: 12,
|
|
967
|
-
accessibilityRole: "button",
|
|
968
|
-
accessibilityLabel: "Back",
|
|
969
|
-
children: /* @__PURE__ */ jsx7(Text, { color: "textPrimary", style: chevron2, children: "\u2039" })
|
|
970
|
-
}
|
|
971
|
-
),
|
|
972
|
-
/* @__PURE__ */ jsx7(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx7(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
|
|
973
|
-
/* @__PURE__ */ jsx7(Box, { style: topBarSpacer3 })
|
|
974
|
-
] }),
|
|
975
|
-
/* @__PURE__ */ jsxs4(Box, { style: content3, children: [
|
|
976
|
-
/* @__PURE__ */ jsxs4(
|
|
977
|
-
Box,
|
|
978
|
-
{
|
|
979
|
-
flexDirection: "row",
|
|
980
|
-
alignItems: "center",
|
|
981
|
-
gap: "elementsHorizontal",
|
|
982
|
-
backgroundColor: "bgModal",
|
|
983
|
-
borderColor: "borderDefault",
|
|
984
|
-
borderWidth: 1,
|
|
985
|
-
borderRadius: "element",
|
|
986
|
-
style: searchBox,
|
|
987
|
-
children: [
|
|
988
|
-
/* @__PURE__ */ jsx7(SearchGlyph, {}),
|
|
989
|
-
/* @__PURE__ */ jsx7(
|
|
990
|
-
TextInput,
|
|
991
|
-
{
|
|
992
|
-
value: searchValue,
|
|
993
|
-
onChangeText: onSearchChange,
|
|
994
|
-
placeholder: searchPlaceholder,
|
|
995
|
-
placeholderTextColor: theme.colors.textSecondary,
|
|
996
|
-
style: [searchInput, { color: theme.colors.textPrimary }]
|
|
997
|
-
}
|
|
998
|
-
)
|
|
999
|
-
]
|
|
1000
|
-
}
|
|
1001
|
-
),
|
|
1002
|
-
chainFilters.length > 0 ? /* @__PURE__ */ jsx7(
|
|
1003
|
-
ScrollView2,
|
|
1004
|
-
{
|
|
1005
|
-
horizontal: true,
|
|
1006
|
-
showsHorizontalScrollIndicator: false,
|
|
1007
|
-
contentContainerStyle: chipRow,
|
|
1008
|
-
children: chainFilters.map((filter) => {
|
|
1009
|
-
const selected = filter.id === selectedChainFilterId;
|
|
1010
|
-
return /* @__PURE__ */ jsx7(
|
|
1011
|
-
Pressable4,
|
|
1012
|
-
{
|
|
1013
|
-
onPress: () => onSelectChainFilter?.(filter.id),
|
|
1014
|
-
accessibilityRole: "button",
|
|
1015
|
-
accessibilityLabel: filter.label,
|
|
1016
|
-
accessibilityState: { selected },
|
|
1017
|
-
children: /* @__PURE__ */ jsx7(
|
|
1018
|
-
Box,
|
|
1019
|
-
{
|
|
1020
|
-
backgroundColor: selected ? "btnPrimary" : "bgSecondary",
|
|
1021
|
-
borderRadius: "rounded",
|
|
1022
|
-
style: chip,
|
|
1023
|
-
children: /* @__PURE__ */ jsx7(
|
|
1024
|
-
Text,
|
|
1025
|
-
{
|
|
1026
|
-
variant: "bodyMedium",
|
|
1027
|
-
color: selected ? "onBtnPrimary" : "textPrimary",
|
|
1028
|
-
children: filter.label
|
|
1029
|
-
}
|
|
1030
|
-
)
|
|
1031
|
-
}
|
|
1032
|
-
)
|
|
1033
|
-
},
|
|
1034
|
-
filter.id
|
|
1035
|
-
);
|
|
1036
|
-
})
|
|
1037
|
-
}
|
|
1038
|
-
) : null,
|
|
1039
|
-
/* @__PURE__ */ jsx7(ScrollView2, { style: list, showsVerticalScrollIndicator: false, children: tokens.map((token) => /* @__PURE__ */ jsx7(
|
|
1040
|
-
Pressable4,
|
|
1041
|
-
{
|
|
1042
|
-
onPress: () => onSelectToken?.(token.id),
|
|
1043
|
-
accessibilityRole: "button",
|
|
1044
|
-
accessibilityLabel: `${token.symbol} on ${token.chainLabel}`,
|
|
1045
|
-
children: /* @__PURE__ */ jsxs4(
|
|
1046
|
-
Box,
|
|
1047
|
-
{
|
|
1048
|
-
flexDirection: "row",
|
|
1049
|
-
alignItems: "center",
|
|
1050
|
-
gap: "elementsHorizontal",
|
|
1051
|
-
borderRadius: "element",
|
|
1052
|
-
style: row3,
|
|
1053
|
-
children: [
|
|
1054
|
-
token.icon ?? /* @__PURE__ */ jsx7(TokenIconFallback, {}),
|
|
1055
|
-
/* @__PURE__ */ jsx7(Box, { flex: 1, children: /* @__PURE__ */ jsx7(Text, { variant: "bodyMedium", color: "textPrimary", children: token.symbol }) }),
|
|
1056
|
-
/* @__PURE__ */ jsx7(Text, { variant: "detail", color: "textSecondary", children: token.chainLabel })
|
|
1057
|
-
]
|
|
1058
|
-
}
|
|
1059
|
-
)
|
|
1060
|
-
},
|
|
1061
|
-
token.id
|
|
1062
|
-
)) })
|
|
1063
|
-
] })
|
|
1064
|
-
]
|
|
1065
|
-
}
|
|
1066
|
-
);
|
|
849
|
+
// src/screens/TransferCryptoScreen.tsx
|
|
850
|
+
import { useEffect as useEffect2, useRef, useState as useState3 } from "react";
|
|
851
|
+
import { Pressable as Pressable3, StyleSheet as StyleSheet5 } from "react-native";
|
|
852
|
+
|
|
853
|
+
// src/icons/CopyIcon.tsx
|
|
854
|
+
import { StyleSheet as StyleSheet3 } from "react-native";
|
|
855
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
856
|
+
function CopyIcon() {
|
|
857
|
+
return /* @__PURE__ */ jsxs3(Box, { width: 18, height: 18, children: [
|
|
858
|
+
/* @__PURE__ */ jsx6(Box, { borderWidth: 1.5, borderColor: "textPrimary", style: styles3.back }),
|
|
859
|
+
/* @__PURE__ */ jsx6(
|
|
860
|
+
Box,
|
|
861
|
+
{
|
|
862
|
+
borderWidth: 1.5,
|
|
863
|
+
borderColor: "textPrimary",
|
|
864
|
+
backgroundColor: "bgSecondary",
|
|
865
|
+
style: styles3.front
|
|
866
|
+
}
|
|
867
|
+
)
|
|
868
|
+
] });
|
|
1067
869
|
}
|
|
1068
|
-
|
|
870
|
+
var styles3 = StyleSheet3.create({
|
|
871
|
+
back: {
|
|
872
|
+
position: "absolute",
|
|
873
|
+
right: 0,
|
|
874
|
+
top: 0,
|
|
875
|
+
width: 13,
|
|
876
|
+
height: 13,
|
|
877
|
+
borderRadius: 3
|
|
878
|
+
},
|
|
879
|
+
front: {
|
|
880
|
+
position: "absolute",
|
|
881
|
+
left: 0,
|
|
882
|
+
bottom: 0,
|
|
883
|
+
width: 13,
|
|
884
|
+
height: 13,
|
|
885
|
+
borderRadius: 3
|
|
886
|
+
}
|
|
887
|
+
});
|
|
888
|
+
|
|
889
|
+
// src/icons/NetworkIconFallback.tsx
|
|
890
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
891
|
+
function NetworkIconFallback() {
|
|
1069
892
|
return /* @__PURE__ */ jsx7(
|
|
1070
893
|
Box,
|
|
1071
894
|
{
|
|
@@ -1076,66 +899,38 @@ function TokenIconFallback() {
|
|
|
1076
899
|
}
|
|
1077
900
|
);
|
|
1078
901
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
902
|
+
|
|
903
|
+
// src/icons/QrCodeIcon.tsx
|
|
904
|
+
import { StyleSheet as StyleSheet4 } from "react-native";
|
|
905
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
906
|
+
function QrCodeIcon() {
|
|
907
|
+
return /* @__PURE__ */ jsx8(
|
|
908
|
+
Box,
|
|
909
|
+
{
|
|
910
|
+
width: 20,
|
|
911
|
+
height: 20,
|
|
912
|
+
flexDirection: "row",
|
|
913
|
+
flexWrap: "wrap",
|
|
914
|
+
style: styles4.grid,
|
|
915
|
+
children: [0, 1, 2, 3].map((i) => /* @__PURE__ */ jsx8(
|
|
916
|
+
Box,
|
|
917
|
+
{
|
|
918
|
+
width: 8,
|
|
919
|
+
height: 8,
|
|
920
|
+
backgroundColor: "textPrimary",
|
|
921
|
+
borderRadius: "elementInner"
|
|
922
|
+
},
|
|
923
|
+
i
|
|
924
|
+
))
|
|
925
|
+
}
|
|
926
|
+
);
|
|
1084
927
|
}
|
|
1085
|
-
var
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
paddingHorizontal: 12
|
|
1089
|
-
};
|
|
1090
|
-
var topBarSpacer3 = { width: 32, height: 32 };
|
|
1091
|
-
var grabber4 = {
|
|
1092
|
-
position: "absolute",
|
|
1093
|
-
top: 8,
|
|
1094
|
-
left: "50%",
|
|
1095
|
-
marginLeft: -18,
|
|
1096
|
-
width: 36,
|
|
1097
|
-
height: 5,
|
|
1098
|
-
borderRadius: 999
|
|
1099
|
-
};
|
|
1100
|
-
var chevron2 = {
|
|
1101
|
-
fontSize: 26,
|
|
1102
|
-
lineHeight: 28,
|
|
1103
|
-
width: 24,
|
|
1104
|
-
textAlign: "center"
|
|
1105
|
-
};
|
|
1106
|
-
var content3 = { paddingHorizontal: 16, paddingBottom: 16, gap: 12 };
|
|
1107
|
-
var searchBox = {
|
|
1108
|
-
height: 44,
|
|
1109
|
-
paddingHorizontal: 12
|
|
1110
|
-
};
|
|
1111
|
-
var searchInput = {
|
|
1112
|
-
flex: 1,
|
|
1113
|
-
fontFamily: "Inter",
|
|
1114
|
-
fontSize: 16,
|
|
1115
|
-
padding: 0
|
|
1116
|
-
};
|
|
1117
|
-
var chipRow = { gap: 8 };
|
|
1118
|
-
var chip = { paddingHorizontal: 16, paddingVertical: 10 };
|
|
1119
|
-
var list = { maxHeight: 360 };
|
|
1120
|
-
var row3 = { padding: 16 };
|
|
1121
|
-
var searchLens = {
|
|
1122
|
-
width: 11,
|
|
1123
|
-
height: 11,
|
|
1124
|
-
borderRadius: 999
|
|
1125
|
-
};
|
|
1126
|
-
var searchHandle = {
|
|
1127
|
-
position: "absolute",
|
|
1128
|
-
right: 0,
|
|
1129
|
-
bottom: 1,
|
|
1130
|
-
width: 5,
|
|
1131
|
-
height: 1.5,
|
|
1132
|
-
transform: [{ rotate: "45deg" }]
|
|
1133
|
-
};
|
|
928
|
+
var styles4 = StyleSheet4.create({
|
|
929
|
+
grid: { gap: 2 }
|
|
930
|
+
});
|
|
1134
931
|
|
|
1135
932
|
// src/screens/TransferCryptoScreen.tsx
|
|
1136
|
-
import {
|
|
1137
|
-
import { Pressable as Pressable5 } from "react-native";
|
|
1138
|
-
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
933
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1139
934
|
function TransferCryptoScreen({
|
|
1140
935
|
depositAddress,
|
|
1141
936
|
networkLabel,
|
|
@@ -1146,101 +941,104 @@ function TransferCryptoScreen({
|
|
|
1146
941
|
onBack,
|
|
1147
942
|
onShowQrCode,
|
|
1148
943
|
onChangeNetwork,
|
|
1149
|
-
onShowSupportedTokens,
|
|
1150
944
|
onCopyAddress,
|
|
1151
945
|
onShareAddress
|
|
1152
946
|
}) {
|
|
1153
|
-
const [copied, setCopied] =
|
|
947
|
+
const [copied, setCopied] = useState3(false);
|
|
1154
948
|
const copyTimer = useRef(void 0);
|
|
1155
|
-
|
|
949
|
+
useEffect2(() => () => clearTimeout(copyTimer.current), []);
|
|
1156
950
|
const handleCopy = () => {
|
|
1157
951
|
onCopyAddress?.();
|
|
1158
952
|
setCopied(true);
|
|
1159
953
|
clearTimeout(copyTimer.current);
|
|
1160
954
|
copyTimer.current = setTimeout(() => setCopied(false), copiedFeedbackMs);
|
|
1161
955
|
};
|
|
1162
|
-
return /* @__PURE__ */
|
|
956
|
+
return /* @__PURE__ */ jsxs4(
|
|
1163
957
|
Box,
|
|
1164
958
|
{
|
|
1165
959
|
backgroundColor: "bgModal",
|
|
1166
960
|
borderTopLeftRadius: "modal",
|
|
1167
961
|
borderTopRightRadius: "modal",
|
|
1168
962
|
children: [
|
|
1169
|
-
/* @__PURE__ */
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
963
|
+
/* @__PURE__ */ jsxs4(
|
|
964
|
+
Box,
|
|
965
|
+
{
|
|
966
|
+
flexDirection: "row",
|
|
967
|
+
alignItems: "center",
|
|
968
|
+
gap: "none",
|
|
969
|
+
style: styles5.topBar,
|
|
970
|
+
children: [
|
|
971
|
+
/* @__PURE__ */ jsx9(
|
|
972
|
+
Box,
|
|
973
|
+
{
|
|
974
|
+
backgroundColor: "borderFocused",
|
|
975
|
+
borderRadius: "rounded",
|
|
976
|
+
style: styles5.grabber
|
|
977
|
+
}
|
|
978
|
+
),
|
|
979
|
+
/* @__PURE__ */ jsx9(
|
|
980
|
+
Pressable3,
|
|
981
|
+
{
|
|
982
|
+
onPress: onBack,
|
|
983
|
+
hitSlop: 12,
|
|
984
|
+
accessibilityRole: "button",
|
|
985
|
+
accessibilityLabel: "Back",
|
|
986
|
+
children: /* @__PURE__ */ jsx9(Text, { color: "textPrimary", style: styles5.chevron, children: "\u2039" })
|
|
987
|
+
}
|
|
988
|
+
),
|
|
989
|
+
/* @__PURE__ */ jsx9(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx9(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
|
|
990
|
+
/* @__PURE__ */ jsx9(
|
|
991
|
+
Pressable3,
|
|
992
|
+
{
|
|
993
|
+
onPress: onShowQrCode,
|
|
994
|
+
hitSlop: 12,
|
|
995
|
+
accessibilityRole: "button",
|
|
996
|
+
accessibilityLabel: "Show QR code",
|
|
997
|
+
style: styles5.qrButton,
|
|
998
|
+
children: /* @__PURE__ */ jsx9(QrCodeIcon, {})
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
]
|
|
1002
|
+
}
|
|
1003
|
+
),
|
|
1004
|
+
/* @__PURE__ */ jsxs4(Box, { style: styles5.content, children: [
|
|
1005
|
+
/* @__PURE__ */ jsx9(
|
|
1006
|
+
Pressable3,
|
|
1184
1007
|
{
|
|
1185
|
-
onPress:
|
|
1186
|
-
hitSlop: 12,
|
|
1008
|
+
onPress: onChangeNetwork,
|
|
1187
1009
|
accessibilityRole: "button",
|
|
1188
|
-
accessibilityLabel: "
|
|
1189
|
-
children: /* @__PURE__ */
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
borderWidth: 1,
|
|
1203
|
-
borderRadius: "button",
|
|
1204
|
-
style: networkRow,
|
|
1205
|
-
children: [
|
|
1206
|
-
/* @__PURE__ */ jsx8(
|
|
1207
|
-
Pressable5,
|
|
1208
|
-
{
|
|
1209
|
-
onPress: onShowSupportedTokens,
|
|
1210
|
-
accessibilityRole: "button",
|
|
1211
|
-
accessibilityLabel: "Supported tokens",
|
|
1212
|
-
style: networkInfoPress,
|
|
1213
|
-
children: /* @__PURE__ */ jsxs5(
|
|
1010
|
+
accessibilityLabel: "Change network",
|
|
1011
|
+
children: /* @__PURE__ */ jsxs4(
|
|
1012
|
+
Box,
|
|
1013
|
+
{
|
|
1014
|
+
flexDirection: "row",
|
|
1015
|
+
alignItems: "center",
|
|
1016
|
+
justifyContent: "space-between",
|
|
1017
|
+
backgroundColor: "bgSecondary",
|
|
1018
|
+
borderColor: "borderDefault",
|
|
1019
|
+
borderWidth: 1,
|
|
1020
|
+
borderRadius: "button",
|
|
1021
|
+
style: styles5.networkRow,
|
|
1022
|
+
children: [
|
|
1023
|
+
/* @__PURE__ */ jsxs4(
|
|
1214
1024
|
Box,
|
|
1215
1025
|
{
|
|
1216
1026
|
flexDirection: "row",
|
|
1217
1027
|
alignItems: "center",
|
|
1218
1028
|
gap: "elementsHorizontal",
|
|
1219
1029
|
children: [
|
|
1220
|
-
networkIcon ?? /* @__PURE__ */
|
|
1221
|
-
/* @__PURE__ */
|
|
1222
|
-
/* @__PURE__ */ jsx8(Text, { variant: "bodyMedium", color: "textPrimary", children: networkLabel }),
|
|
1223
|
-
/* @__PURE__ */ jsx8(InfoGlyph, {})
|
|
1224
|
-
] })
|
|
1030
|
+
networkIcon ?? /* @__PURE__ */ jsx9(NetworkIconFallback, {}),
|
|
1031
|
+
/* @__PURE__ */ jsx9(Text, { variant: "bodyMedium", color: "textPrimary", children: networkLabel })
|
|
1225
1032
|
]
|
|
1226
1033
|
}
|
|
1227
|
-
)
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
{
|
|
1233
|
-
onPress: onChangeNetwork,
|
|
1234
|
-
accessibilityRole: "button",
|
|
1235
|
-
accessibilityLabel: "Change network",
|
|
1236
|
-
hitSlop: 8,
|
|
1237
|
-
children: /* @__PURE__ */ jsx8(Text, { variant: "bodyMedium", color: "textSecondary", children: "Change" })
|
|
1238
|
-
}
|
|
1239
|
-
)
|
|
1240
|
-
]
|
|
1034
|
+
),
|
|
1035
|
+
/* @__PURE__ */ jsx9(Text, { variant: "bodyMedium", color: "textSecondary", children: "Change" })
|
|
1036
|
+
]
|
|
1037
|
+
}
|
|
1038
|
+
)
|
|
1241
1039
|
}
|
|
1242
1040
|
),
|
|
1243
|
-
/* @__PURE__ */
|
|
1041
|
+
/* @__PURE__ */ jsxs4(
|
|
1244
1042
|
Box,
|
|
1245
1043
|
{
|
|
1246
1044
|
flexDirection: "row",
|
|
@@ -1249,10 +1047,10 @@ function TransferCryptoScreen({
|
|
|
1249
1047
|
borderColor: "borderDefault",
|
|
1250
1048
|
borderWidth: 1,
|
|
1251
1049
|
borderRadius: "button",
|
|
1252
|
-
style: addressCard,
|
|
1050
|
+
style: styles5.addressCard,
|
|
1253
1051
|
children: [
|
|
1254
|
-
/* @__PURE__ */
|
|
1255
|
-
/* @__PURE__ */
|
|
1052
|
+
/* @__PURE__ */ jsxs4(Box, { flex: 1, style: styles5.addressDetails, children: [
|
|
1053
|
+
/* @__PURE__ */ jsx9(
|
|
1256
1054
|
Text,
|
|
1257
1055
|
{
|
|
1258
1056
|
variant: "detail",
|
|
@@ -1260,17 +1058,26 @@ function TransferCryptoScreen({
|
|
|
1260
1058
|
children: copied ? "Copied!" : depositAddressLabel
|
|
1261
1059
|
}
|
|
1262
1060
|
),
|
|
1263
|
-
/* @__PURE__ */
|
|
1061
|
+
/* @__PURE__ */ jsx9(
|
|
1062
|
+
Text,
|
|
1063
|
+
{
|
|
1064
|
+
variant: "bodyMedium",
|
|
1065
|
+
color: "textPrimary",
|
|
1066
|
+
numberOfLines: 1,
|
|
1067
|
+
ellipsizeMode: "middle",
|
|
1068
|
+
children: depositAddress
|
|
1069
|
+
}
|
|
1070
|
+
)
|
|
1264
1071
|
] }),
|
|
1265
|
-
/* @__PURE__ */
|
|
1072
|
+
/* @__PURE__ */ jsx9(
|
|
1266
1073
|
CircleIconButton,
|
|
1267
1074
|
{
|
|
1268
1075
|
label: copied ? "Address copied" : "Copy address",
|
|
1269
1076
|
onPress: handleCopy,
|
|
1270
|
-
children: copied ? /* @__PURE__ */
|
|
1077
|
+
children: copied ? /* @__PURE__ */ jsx9(Text, { color: "textSuccess", style: styles5.actionGlyph, children: "\u2713" }) : /* @__PURE__ */ jsx9(CopyIcon, {})
|
|
1271
1078
|
}
|
|
1272
1079
|
),
|
|
1273
|
-
/* @__PURE__ */
|
|
1080
|
+
/* @__PURE__ */ jsx9(CircleIconButton, { label: "Share address", onPress: onShareAddress, children: /* @__PURE__ */ jsx9(Text, { color: "textPrimary", style: styles5.actionGlyph, children: "\u2191" }) })
|
|
1274
1081
|
]
|
|
1275
1082
|
}
|
|
1276
1083
|
)
|
|
@@ -1284,13 +1091,13 @@ function CircleIconButton({
|
|
|
1284
1091
|
label,
|
|
1285
1092
|
onPress
|
|
1286
1093
|
}) {
|
|
1287
|
-
return /* @__PURE__ */
|
|
1288
|
-
|
|
1094
|
+
return /* @__PURE__ */ jsx9(
|
|
1095
|
+
Pressable3,
|
|
1289
1096
|
{
|
|
1290
1097
|
onPress,
|
|
1291
1098
|
accessibilityRole: "button",
|
|
1292
1099
|
accessibilityLabel: label,
|
|
1293
|
-
children: /* @__PURE__ */
|
|
1100
|
+
children: /* @__PURE__ */ jsx9(
|
|
1294
1101
|
Box,
|
|
1295
1102
|
{
|
|
1296
1103
|
width: 48,
|
|
@@ -1305,1380 +1112,46 @@ function CircleIconButton({
|
|
|
1305
1112
|
}
|
|
1306
1113
|
);
|
|
1307
1114
|
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
flexDirection: "row",
|
|
1341
|
-
flexWrap: "wrap",
|
|
1342
|
-
style: qrGrid,
|
|
1343
|
-
children: [0, 1, 2, 3].map((i) => /* @__PURE__ */ jsx8(
|
|
1344
|
-
Box,
|
|
1345
|
-
{
|
|
1346
|
-
width: 8,
|
|
1347
|
-
height: 8,
|
|
1348
|
-
backgroundColor: "textPrimary",
|
|
1349
|
-
borderRadius: "elementInner"
|
|
1350
|
-
},
|
|
1351
|
-
i
|
|
1352
|
-
))
|
|
1353
|
-
}
|
|
1354
|
-
);
|
|
1355
|
-
}
|
|
1356
|
-
function CopyGlyph() {
|
|
1357
|
-
return /* @__PURE__ */ jsxs5(Box, { width: 18, height: 18, children: [
|
|
1358
|
-
/* @__PURE__ */ jsx8(Box, { borderWidth: 1.5, borderColor: "textPrimary", style: copyBack }),
|
|
1359
|
-
/* @__PURE__ */ jsx8(
|
|
1360
|
-
Box,
|
|
1361
|
-
{
|
|
1362
|
-
borderWidth: 1.5,
|
|
1363
|
-
borderColor: "textPrimary",
|
|
1364
|
-
backgroundColor: "bgSecondary",
|
|
1365
|
-
style: copyFront
|
|
1366
|
-
}
|
|
1367
|
-
)
|
|
1368
|
-
] });
|
|
1369
|
-
}
|
|
1370
|
-
var topBar5 = {
|
|
1371
|
-
paddingTop: 20,
|
|
1372
|
-
paddingBottom: 12,
|
|
1373
|
-
paddingHorizontal: 12
|
|
1374
|
-
};
|
|
1375
|
-
var grabber5 = {
|
|
1376
|
-
position: "absolute",
|
|
1377
|
-
top: 8,
|
|
1378
|
-
left: "50%",
|
|
1379
|
-
marginLeft: -18,
|
|
1380
|
-
width: 36,
|
|
1381
|
-
height: 5,
|
|
1382
|
-
borderRadius: 999
|
|
1383
|
-
};
|
|
1384
|
-
var chevron3 = {
|
|
1385
|
-
fontSize: 26,
|
|
1386
|
-
lineHeight: 28,
|
|
1387
|
-
width: 24,
|
|
1388
|
-
textAlign: "center"
|
|
1389
|
-
};
|
|
1390
|
-
var content4 = {
|
|
1391
|
-
paddingHorizontal: 20,
|
|
1392
|
-
paddingBottom: 16,
|
|
1393
|
-
paddingTop: 8,
|
|
1394
|
-
gap: 8
|
|
1395
|
-
};
|
|
1396
|
-
var networkRow = { paddingHorizontal: 16, paddingVertical: 10 };
|
|
1397
|
-
var networkInfoPress = { flexShrink: 1 };
|
|
1398
|
-
var labelInfo = { gap: 6 };
|
|
1399
|
-
var infoChar = { fontSize: 11, lineHeight: 13, fontWeight: "600" };
|
|
1400
|
-
var addressCard = { padding: 16 };
|
|
1401
|
-
var addressDetails = { gap: 4 };
|
|
1402
|
-
var shareGlyph2 = { fontSize: 18, lineHeight: 20, fontWeight: "500" };
|
|
1403
|
-
var qrGrid = { gap: 2 };
|
|
1404
|
-
var copyBack = {
|
|
1405
|
-
position: "absolute",
|
|
1406
|
-
right: 0,
|
|
1407
|
-
top: 0,
|
|
1408
|
-
width: 13,
|
|
1409
|
-
height: 13,
|
|
1410
|
-
borderRadius: 3
|
|
1411
|
-
};
|
|
1412
|
-
var copyFront = {
|
|
1413
|
-
position: "absolute",
|
|
1414
|
-
left: 0,
|
|
1415
|
-
bottom: 0,
|
|
1416
|
-
width: 13,
|
|
1417
|
-
height: 13,
|
|
1418
|
-
borderRadius: 3
|
|
1419
|
-
};
|
|
1420
|
-
|
|
1421
|
-
// src/swapped/SwappedScreen.tsx
|
|
1422
|
-
import { useCallback as useCallback2 } from "react";
|
|
1423
|
-
|
|
1424
|
-
// src/logging/logger.ts
|
|
1425
|
-
import { FunLogger } from "@funkit/connect-core";
|
|
1426
|
-
|
|
1427
|
-
// src/logging/datadogHttpLogTransport.ts
|
|
1428
|
-
var DEFAULT_SERVICE = "connect-rn";
|
|
1429
|
-
var DEFAULT_SITE = "datadoghq.com";
|
|
1430
|
-
var DEFAULT_FLUSH_INTERVAL_MS = 5e3;
|
|
1431
|
-
var DEFAULT_MAX_BATCH_SIZE = 50;
|
|
1432
|
-
var DatadogHttpLogTransport = class {
|
|
1433
|
-
constructor(options) {
|
|
1434
|
-
this.consent = "granted";
|
|
1435
|
-
this.queue = [];
|
|
1436
|
-
this.flushTimer = null;
|
|
1437
|
-
const site = options.site ?? DEFAULT_SITE;
|
|
1438
|
-
this.service = options.service ?? DEFAULT_SERVICE;
|
|
1439
|
-
this.env = options.env;
|
|
1440
|
-
this.flushIntervalMs = options.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS;
|
|
1441
|
-
this.maxBatchSize = options.maxBatchSize ?? DEFAULT_MAX_BATCH_SIZE;
|
|
1442
|
-
this.intakeUrl = `https://browser-intake-${site}/api/v2/logs?dd-api-key=${encodeURIComponent(options.clientToken)}&ddsource=react-native&dd-evp-origin=react-native`;
|
|
1443
|
-
}
|
|
1444
|
-
setEnv(environment) {
|
|
1445
|
-
this.env = environment;
|
|
1446
|
-
}
|
|
1447
|
-
setTrackingConsent(consent) {
|
|
1448
|
-
this.consent = consent;
|
|
1449
|
-
if (consent !== "granted") {
|
|
1450
|
-
this.queue = [];
|
|
1451
|
-
this.clearTimer();
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
log({ level, title, context, error }) {
|
|
1455
|
-
if (this.consent !== "granted") {
|
|
1456
|
-
return;
|
|
1457
|
-
}
|
|
1458
|
-
const entry = {
|
|
1459
|
-
ddsource: "react-native",
|
|
1460
|
-
service: this.service,
|
|
1461
|
-
status: level,
|
|
1462
|
-
message: title,
|
|
1463
|
-
...this.env ? { ddtags: `env:${this.env}` } : {},
|
|
1464
|
-
...context,
|
|
1465
|
-
...error ? {
|
|
1466
|
-
error: {
|
|
1467
|
-
message: error.message,
|
|
1468
|
-
stack: error.stack,
|
|
1469
|
-
kind: error.name
|
|
1470
|
-
}
|
|
1471
|
-
} : {}
|
|
1472
|
-
};
|
|
1473
|
-
this.queue.push(entry);
|
|
1474
|
-
if (this.queue.length >= this.maxBatchSize) {
|
|
1475
|
-
this.flush();
|
|
1476
|
-
} else {
|
|
1477
|
-
this.scheduleFlush();
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
/** Send the buffered batch. Fire-and-forget; network errors are swallowed. */
|
|
1481
|
-
flush() {
|
|
1482
|
-
this.clearTimer();
|
|
1483
|
-
if (this.queue.length === 0) {
|
|
1484
|
-
return;
|
|
1485
|
-
}
|
|
1486
|
-
if (typeof fetch !== "function") {
|
|
1487
|
-
this.queue = [];
|
|
1488
|
-
return;
|
|
1489
|
-
}
|
|
1490
|
-
const batch = this.queue;
|
|
1491
|
-
this.queue = [];
|
|
1492
|
-
fetch(this.intakeUrl, {
|
|
1493
|
-
method: "POST",
|
|
1494
|
-
headers: { "Content-Type": "application/json" },
|
|
1495
|
-
body: JSON.stringify(batch)
|
|
1496
|
-
}).catch(() => {
|
|
1497
|
-
});
|
|
1498
|
-
}
|
|
1499
|
-
scheduleFlush() {
|
|
1500
|
-
if (this.flushTimer != null) {
|
|
1501
|
-
return;
|
|
1502
|
-
}
|
|
1503
|
-
this.flushTimer = setTimeout(() => {
|
|
1504
|
-
this.flushTimer = null;
|
|
1505
|
-
this.flush();
|
|
1506
|
-
}, this.flushIntervalMs);
|
|
1507
|
-
}
|
|
1508
|
-
clearTimer() {
|
|
1509
|
-
if (this.flushTimer != null) {
|
|
1510
|
-
clearTimeout(this.flushTimer);
|
|
1511
|
-
this.flushTimer = null;
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
};
|
|
1515
|
-
|
|
1516
|
-
// src/logging/logger.ts
|
|
1517
|
-
var DDOG_CLIENT_TOKEN = "pub4f86c6be8c792cb48dc156a8c17d9a47";
|
|
1518
|
-
var logger = new FunLogger(
|
|
1519
|
-
new DatadogHttpLogTransport({
|
|
1520
|
-
clientToken: DDOG_CLIENT_TOKEN
|
|
1521
|
-
// service defaults to 'connect-rn' (see DatadogHttpLogTransport).
|
|
1522
|
-
})
|
|
1523
|
-
);
|
|
1524
|
-
|
|
1525
|
-
// src/swapped/SwappedWebView.tsx
|
|
1526
|
-
import { useEffect as useEffect4, useMemo as useMemo3, useRef as useRef2 } from "react";
|
|
1527
|
-
import { WebView } from "react-native-webview";
|
|
1528
|
-
|
|
1529
|
-
// src/swapped/webViewSwappedTransport.ts
|
|
1530
|
-
import {
|
|
1531
|
-
getSwappedOrigin
|
|
1532
|
-
} from "@funkit/connect-core";
|
|
1533
|
-
var SWAPPED_WEBVIEW_INJECTED_JS = `(function () {
|
|
1534
|
-
function forwardToNative(message) {
|
|
1535
|
-
try {
|
|
1536
|
-
var data = typeof message === 'string' ? message : JSON.stringify(message);
|
|
1537
|
-
window.ReactNativeWebView && window.ReactNativeWebView.postMessage(data);
|
|
1538
|
-
} catch (e) {}
|
|
1539
|
-
}
|
|
1540
|
-
// The embed posts to window.parent (and sometimes window) \u2014 redirect both.
|
|
1541
|
-
try { if (window.parent) { window.parent.postMessage = forwardToNative; } } catch (e) {}
|
|
1542
|
-
try { window.postMessage = forwardToNative; } catch (e) {}
|
|
1543
|
-
true;
|
|
1544
|
-
})();
|
|
1545
|
-
true;`;
|
|
1546
|
-
function handleWebViewMessage(rawData, url) {
|
|
1547
|
-
if (url != null && getSwappedOrigin(url) == null) {
|
|
1548
|
-
return null;
|
|
1549
|
-
}
|
|
1550
|
-
let parsed;
|
|
1551
|
-
if (typeof rawData === "string") {
|
|
1552
|
-
try {
|
|
1553
|
-
parsed = JSON.parse(rawData);
|
|
1554
|
-
} catch {
|
|
1555
|
-
return null;
|
|
1556
|
-
}
|
|
1557
|
-
} else {
|
|
1558
|
-
parsed = rawData;
|
|
1559
|
-
}
|
|
1560
|
-
const data = parsed;
|
|
1561
|
-
if (!data || typeof data.type !== "string") {
|
|
1562
|
-
return null;
|
|
1563
|
-
}
|
|
1564
|
-
return data;
|
|
1565
|
-
}
|
|
1566
|
-
function createWebViewSwappedTransport({
|
|
1567
|
-
getWebView
|
|
1568
|
-
}) {
|
|
1569
|
-
const handlers = /* @__PURE__ */ new Set();
|
|
1570
|
-
const transport = {
|
|
1571
|
-
send(msg) {
|
|
1572
|
-
const webView = getWebView();
|
|
1573
|
-
if (!webView) {
|
|
1574
|
-
return false;
|
|
1575
|
-
}
|
|
1576
|
-
webView.postMessage(JSON.stringify(msg));
|
|
1577
|
-
return true;
|
|
1578
|
-
},
|
|
1579
|
-
onMessage(handler) {
|
|
1580
|
-
handlers.add(handler);
|
|
1581
|
-
return () => {
|
|
1582
|
-
handlers.delete(handler);
|
|
1583
|
-
};
|
|
1584
|
-
}
|
|
1585
|
-
};
|
|
1586
|
-
function dispatch(rawData, url) {
|
|
1587
|
-
const msg = handleWebViewMessage(rawData, url);
|
|
1588
|
-
if (msg) {
|
|
1589
|
-
for (const handler of handlers) {
|
|
1590
|
-
handler(msg);
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
return { transport, dispatch };
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
// src/swapped/SwappedWebView.tsx
|
|
1598
|
-
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1599
|
-
function SwappedWebView({ url, onMessage, style }) {
|
|
1600
|
-
const webViewRef = useRef2(null);
|
|
1601
|
-
const { transport, dispatch } = useMemo3(
|
|
1602
|
-
() => createWebViewSwappedTransport({
|
|
1603
|
-
getWebView: () => webViewRef.current
|
|
1604
|
-
}),
|
|
1605
|
-
[]
|
|
1606
|
-
);
|
|
1607
|
-
const handlerRef = useRef2(onMessage);
|
|
1608
|
-
handlerRef.current = onMessage;
|
|
1609
|
-
useEffect4(
|
|
1610
|
-
() => transport.onMessage((msg) => handlerRef.current(msg)),
|
|
1611
|
-
[transport]
|
|
1612
|
-
);
|
|
1613
|
-
const handleMessage = (event) => {
|
|
1614
|
-
dispatch(event.nativeEvent.data, event.nativeEvent.url);
|
|
1615
|
-
};
|
|
1616
|
-
const handleError = (event) => {
|
|
1617
|
-
logger.warn("connect-rn:swapped:webview:error", {
|
|
1618
|
-
code: String(event.nativeEvent.code),
|
|
1619
|
-
description: event.nativeEvent.description,
|
|
1620
|
-
url: event.nativeEvent.url
|
|
1621
|
-
});
|
|
1622
|
-
};
|
|
1623
|
-
const handleHttpError = (event) => {
|
|
1624
|
-
logger.warn("connect-rn:swapped:webview:httpError", {
|
|
1625
|
-
status: String(event.nativeEvent.statusCode),
|
|
1626
|
-
url: event.nativeEvent.url
|
|
1627
|
-
});
|
|
1628
|
-
};
|
|
1629
|
-
return /* @__PURE__ */ jsx9(
|
|
1630
|
-
WebView,
|
|
1631
|
-
{
|
|
1632
|
-
ref: webViewRef,
|
|
1633
|
-
source: { uri: url },
|
|
1634
|
-
onMessage: handleMessage,
|
|
1635
|
-
onError: handleError,
|
|
1636
|
-
onHttpError: handleHttpError,
|
|
1637
|
-
injectedJavaScriptBeforeContentLoaded: SWAPPED_WEBVIEW_INJECTED_JS,
|
|
1638
|
-
startInLoadingState: true,
|
|
1639
|
-
javaScriptEnabled: true,
|
|
1640
|
-
domStorageEnabled: true,
|
|
1641
|
-
sharedCookiesEnabled: true,
|
|
1642
|
-
thirdPartyCookiesEnabled: true,
|
|
1643
|
-
allowsInlineMediaPlayback: true,
|
|
1644
|
-
setSupportMultipleWindows: false,
|
|
1645
|
-
originWhitelist: ["https://*"],
|
|
1646
|
-
style
|
|
1647
|
-
}
|
|
1648
|
-
);
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
|
-
// src/swapped/SwappedScreen.tsx
|
|
1652
|
-
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1653
|
-
function SwappedScreen({
|
|
1654
|
-
url,
|
|
1655
|
-
onClose,
|
|
1656
|
-
onBack,
|
|
1657
|
-
onSuccess
|
|
1658
|
-
}) {
|
|
1659
|
-
const handleMessage = useCallback2(
|
|
1660
|
-
(msg) => {
|
|
1661
|
-
switch (msg.type) {
|
|
1662
|
-
case "SWAPPED_GO_BACK":
|
|
1663
|
-
case "SWAPPED_NEW_DEPOSIT":
|
|
1664
|
-
onBack();
|
|
1665
|
-
break;
|
|
1666
|
-
case "SWAPPED_CLOSE":
|
|
1667
|
-
onClose();
|
|
1668
|
-
break;
|
|
1669
|
-
case "SWAPPED_TRANSACTION_SUCCESSFUL":
|
|
1670
|
-
logger.info("connect-rn:swapped:transaction_successful");
|
|
1671
|
-
onSuccess?.();
|
|
1672
|
-
break;
|
|
1673
|
-
case "SWAPPED_ERROR":
|
|
1674
|
-
logger.warn("connect-rn:swapped:error", {
|
|
1675
|
-
data: JSON.stringify(msg.data ?? {})
|
|
1676
|
-
});
|
|
1677
|
-
break;
|
|
1678
|
-
default:
|
|
1679
|
-
break;
|
|
1680
|
-
}
|
|
1681
|
-
},
|
|
1682
|
-
[onBack, onClose, onSuccess]
|
|
1683
|
-
);
|
|
1684
|
-
return /* @__PURE__ */ jsx10(
|
|
1685
|
-
Box,
|
|
1686
|
-
{
|
|
1687
|
-
backgroundColor: "bgModal",
|
|
1688
|
-
borderTopLeftRadius: "modal",
|
|
1689
|
-
borderTopRightRadius: "modal",
|
|
1690
|
-
style: sheet2,
|
|
1691
|
-
children: /* @__PURE__ */ jsx10(SwappedWebView, { url, onMessage: handleMessage, style: fill })
|
|
1692
|
-
}
|
|
1693
|
-
);
|
|
1694
|
-
}
|
|
1695
|
-
var SHEET_HEIGHT = 550;
|
|
1696
|
-
var sheet2 = { height: SHEET_HEIGHT, overflow: "hidden" };
|
|
1697
|
-
var fill = { flex: 1 };
|
|
1698
|
-
|
|
1699
|
-
// src/transfer/QrCode.tsx
|
|
1700
|
-
import QRCode from "react-native-qrcode-svg";
|
|
1701
|
-
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1702
|
-
function QrCode({ value, size = 220 }) {
|
|
1703
|
-
const theme = useTheme();
|
|
1704
|
-
return /* @__PURE__ */ jsx11(
|
|
1705
|
-
QRCode,
|
|
1706
|
-
{
|
|
1707
|
-
value,
|
|
1708
|
-
size,
|
|
1709
|
-
color: theme.colors.textPrimary,
|
|
1710
|
-
backgroundColor: "#FFFFFF"
|
|
1711
|
-
}
|
|
1712
|
-
);
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
// src/transfer/clipboard.ts
|
|
1716
|
-
async function copyToClipboard(value) {
|
|
1717
|
-
try {
|
|
1718
|
-
const { default: Clipboard } = await import("@react-native-clipboard/clipboard");
|
|
1719
|
-
Clipboard.setString(value);
|
|
1720
|
-
return true;
|
|
1721
|
-
} catch (error) {
|
|
1722
|
-
logger.warn(
|
|
1723
|
-
"connect-rn: clipboard unavailable (is @react-native-clipboard/clipboard linked?); address not copied",
|
|
1724
|
-
{ error: error instanceof Error ? error.message : String(error) }
|
|
1725
|
-
);
|
|
1726
|
-
return false;
|
|
1727
|
-
}
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
// src/transfer/fops.ts
|
|
1731
|
-
import {
|
|
1732
|
-
FormOfPaymentType
|
|
1733
|
-
} from "@funkit/api-base";
|
|
1734
|
-
import { getFopsLimit } from "@funkit/connect-core";
|
|
1735
|
-
var BANK_TRANSFER_TIME = "1-2 days";
|
|
1736
|
-
function toFopRows(fops, exchangeRates) {
|
|
1737
|
-
return fops.map((fop) => {
|
|
1738
|
-
const limit = `${getFopsLimit(fop, exchangeRates)} limit`;
|
|
1739
|
-
const subtitle = fop.fopType === FormOfPaymentType.BANK_TRANSFER ? `${limit} \xB7 ${BANK_TRANSFER_TIME}` : limit;
|
|
1740
|
-
return {
|
|
1741
|
-
id: `${fop.fopType}:${fop.name}`,
|
|
1742
|
-
name: fop.name,
|
|
1743
|
-
iconUri: fop.iconImageUrl,
|
|
1744
|
-
subtitle,
|
|
1745
|
-
disabled: !fop.embeddedFlowUrl
|
|
1746
|
-
};
|
|
1747
|
-
});
|
|
1748
|
-
}
|
|
1749
|
-
|
|
1750
|
-
// src/transfer/formatDepositAddress.ts
|
|
1751
|
-
function formatDepositAddress(address, leading = 6, trailing = 6) {
|
|
1752
|
-
if (!address) {
|
|
1753
|
-
return "";
|
|
1754
|
-
}
|
|
1755
|
-
if (address.length <= leading + trailing) {
|
|
1756
|
-
return address;
|
|
1757
|
-
}
|
|
1758
|
-
return `${address.slice(0, leading)}\u2026${address.slice(-trailing)}`;
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
|
-
// src/transfer/hooks/useFops.ts
|
|
1762
|
-
import {
|
|
1763
|
-
getFops
|
|
1764
|
-
} from "@funkit/api-base";
|
|
1765
|
-
import {
|
|
1766
|
-
FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS,
|
|
1767
|
-
solanaChain
|
|
1768
|
-
} from "@funkit/chains";
|
|
1769
|
-
import {
|
|
1770
|
-
FOPS_STALE_TIME,
|
|
1771
|
-
getDepositAddressForChain,
|
|
1772
|
-
sortFops,
|
|
1773
|
-
useDynamicConfig as useDynamicConfig2
|
|
1774
|
-
} from "@funkit/connect-core";
|
|
1775
|
-
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
1776
|
-
|
|
1777
|
-
// src/geo/useUserIpInfo.ts
|
|
1778
|
-
import { useQuery } from "@tanstack/react-query";
|
|
1779
|
-
var MOONPAY_LIVE_API_KEY = "pk_live_IxayBRQuBC3RzpPZkbGPrwUsRWAaeO";
|
|
1780
|
-
function errData(error) {
|
|
1781
|
-
return { error: error instanceof Error ? error.message : String(error) };
|
|
1782
|
-
}
|
|
1783
|
-
async function getIpViaMoonpay() {
|
|
1784
|
-
const res = await fetch(
|
|
1785
|
-
`https://api.moonpay.com/v3/ip_address?apiKey=${MOONPAY_LIVE_API_KEY}`
|
|
1786
|
-
);
|
|
1787
|
-
if (!res.ok) {
|
|
1788
|
-
throw new Error(res.statusText);
|
|
1789
|
-
}
|
|
1790
|
-
const data = await res.json();
|
|
1791
|
-
return { alpha2: data.alpha2, state: data.state };
|
|
1792
|
-
}
|
|
1793
|
-
async function getIpViaIpApi() {
|
|
1794
|
-
const res = await fetch("https://ipapi.co/json");
|
|
1795
|
-
if (!res.ok) {
|
|
1796
|
-
throw new Error(res.statusText);
|
|
1797
|
-
}
|
|
1798
|
-
const data = await res.json();
|
|
1799
|
-
return { alpha2: data.country_code, state: data.region_code };
|
|
1800
|
-
}
|
|
1801
|
-
function useUserIpInfo() {
|
|
1802
|
-
const { data: userIpInfo, isLoading: isLoadingGeoCheck } = useQuery({
|
|
1803
|
-
queryKey: ["getUserIpInfo"],
|
|
1804
|
-
queryFn: async () => {
|
|
1805
|
-
try {
|
|
1806
|
-
return await getIpViaMoonpay();
|
|
1807
|
-
} catch (moonpayError) {
|
|
1808
|
-
logger.warn(
|
|
1809
|
-
"connect-rn:getUserIpViaMoonpay:error",
|
|
1810
|
-
errData(moonpayError)
|
|
1811
|
-
);
|
|
1812
|
-
try {
|
|
1813
|
-
return await getIpViaIpApi();
|
|
1814
|
-
} catch (ipApiError) {
|
|
1815
|
-
logger.warn("connect-rn:getUserIpViaIpApi:error", errData(ipApiError));
|
|
1816
|
-
throw ipApiError;
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
},
|
|
1820
|
-
// Location is stable within a session; don't refetch aggressively.
|
|
1821
|
-
staleTime: Number.POSITIVE_INFINITY,
|
|
1822
|
-
refetchOnMount: false,
|
|
1823
|
-
refetchOnReconnect: true,
|
|
1824
|
-
refetchOnWindowFocus: false
|
|
1825
|
-
});
|
|
1826
|
-
return { userIpInfo, isLoadingGeoCheck };
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
|
-
// src/identity/IdentityContext.tsx
|
|
1830
|
-
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
1831
|
-
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1832
|
-
function generateSyntheticUserId(apiKey, externalUserId) {
|
|
1833
|
-
return `${apiKey}|${externalUserId}`;
|
|
1834
|
-
}
|
|
1835
|
-
function resolveFunkitIdentity(config, walletAddress) {
|
|
1836
|
-
const address = walletAddress || "0x";
|
|
1837
|
-
const userId = config.externalUserId ? generateSyntheticUserId(config.apiKey, config.externalUserId) : address;
|
|
1838
|
-
return {
|
|
1839
|
-
apiKey: config.apiKey,
|
|
1840
|
-
userId,
|
|
1841
|
-
walletAddress: address,
|
|
1842
|
-
loginType: config.loginType
|
|
1843
|
-
};
|
|
1844
|
-
}
|
|
1845
|
-
var FunkitIdentityContext = createContext2(null);
|
|
1846
|
-
function FunkitIdentityProvider({
|
|
1847
|
-
identity,
|
|
1848
|
-
children
|
|
1849
|
-
}) {
|
|
1850
|
-
return /* @__PURE__ */ jsx12(FunkitIdentityContext.Provider, { value: identity, children });
|
|
1851
|
-
}
|
|
1852
|
-
function useFunkitIdentity() {
|
|
1853
|
-
const identity = useContext2(FunkitIdentityContext);
|
|
1854
|
-
if (identity == null) {
|
|
1855
|
-
throw new Error(
|
|
1856
|
-
"useFunkitIdentity must be used within a <FunkitIdentityProvider> (mounted by <FunkitProvider>)"
|
|
1857
|
-
);
|
|
1858
|
-
}
|
|
1859
|
-
return identity;
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
// src/transfer/hooks/useTransferInit.ts
|
|
1863
|
-
import {
|
|
1864
|
-
initializeCheckoutTokenTransferAddress
|
|
1865
|
-
} from "@funkit/api-base";
|
|
1866
|
-
import {
|
|
1867
|
-
getCheckoutTokenTransferParams
|
|
1868
|
-
} from "@funkit/connect-core";
|
|
1869
|
-
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
1870
|
-
|
|
1871
|
-
// src/transfer/hooks/useUDAParams.ts
|
|
1872
|
-
import { useDynamicConfig } from "@funkit/connect-core";
|
|
1873
|
-
import { useMemo as useMemo4 } from "react";
|
|
1874
|
-
function useUDAParams(dynamicRoutingId) {
|
|
1875
|
-
const udaParams = useDynamicConfig("uda_params");
|
|
1876
|
-
return useMemo4(
|
|
1877
|
-
() => udaParams.find((param) => param.dynamicRoutingId === dynamicRoutingId)?.params,
|
|
1878
|
-
[udaParams, dynamicRoutingId]
|
|
1879
|
-
);
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
// src/transfer/hooks/useTransferInit.ts
|
|
1883
|
-
var TRANSFER_CLIENT_METADATA = {};
|
|
1884
|
-
function useTransferInit({
|
|
1885
|
-
checkoutConfig,
|
|
1886
|
-
recipientAddr,
|
|
1887
|
-
dynamicRoutingId,
|
|
1888
|
-
enabled = true
|
|
1889
|
-
}) {
|
|
1890
|
-
const { apiKey, userId, walletAddress } = useFunkitIdentity();
|
|
1891
|
-
const udaParams = useUDAParams(dynamicRoutingId);
|
|
1892
|
-
const resolvedRecipient = recipientAddr || walletAddress || "0x";
|
|
1893
|
-
const params = getCheckoutTokenTransferParams({
|
|
1894
|
-
checkoutConfig,
|
|
1895
|
-
userId,
|
|
1896
|
-
apiKey,
|
|
1897
|
-
recipientAddr: resolvedRecipient,
|
|
1898
|
-
udaParams
|
|
1899
|
-
});
|
|
1900
|
-
const { data, isLoading, isFetching } = useQuery2({
|
|
1901
|
-
queryKey: ["initializeCheckoutTokenTransferAddress", params],
|
|
1902
|
-
queryFn: ({ queryKey: [, queryParams] }) => queryParams ? initializeCheckoutTokenTransferAddress({
|
|
1903
|
-
...queryParams,
|
|
1904
|
-
logger,
|
|
1905
|
-
clientMetadata: TRANSFER_CLIENT_METADATA
|
|
1906
|
-
}) : void 0,
|
|
1907
|
-
enabled: enabled && !!params,
|
|
1908
|
-
refetchOnWindowFocus: false,
|
|
1909
|
-
refetchOnMount: false
|
|
1910
|
-
});
|
|
1911
|
-
return {
|
|
1912
|
-
transferInit: isFetching ? void 0 : data,
|
|
1913
|
-
recipientAddr: resolvedRecipient,
|
|
1914
|
-
isLoading,
|
|
1915
|
-
isFetching
|
|
1916
|
-
};
|
|
1917
|
-
}
|
|
1918
|
-
|
|
1919
|
-
// src/transfer/hooks/useFops.ts
|
|
1920
|
-
var DEFAULT_FIAT_CURRENCY = "USD";
|
|
1921
|
-
var DEFAULT_COUNTRY_CODE = "US";
|
|
1922
|
-
function useFops({
|
|
1923
|
-
checkoutConfig,
|
|
1924
|
-
dynamicRoutingId,
|
|
1925
|
-
enabled = true
|
|
1926
|
-
}) {
|
|
1927
|
-
const { apiKey, userId } = useFunkitIdentity();
|
|
1928
|
-
const isSwappedEnabled = !!useDynamicConfig2("enableswappeddeposit");
|
|
1929
|
-
const fopPriority = useDynamicConfig2("foppriority");
|
|
1930
|
-
const { userIpInfo } = useUserIpInfo();
|
|
1931
|
-
const countryCode = userIpInfo?.alpha2 || DEFAULT_COUNTRY_CODE;
|
|
1932
|
-
const {
|
|
1933
|
-
transferInit,
|
|
1934
|
-
isLoading: isTransferInitLoading,
|
|
1935
|
-
isFetching: isTransferInitFetching
|
|
1936
|
-
} = useTransferInit({
|
|
1937
|
-
checkoutConfig,
|
|
1938
|
-
dynamicRoutingId,
|
|
1939
|
-
enabled: enabled && isSwappedEnabled
|
|
1940
|
-
});
|
|
1941
|
-
const targetAsset = checkoutConfig?.targetAsset;
|
|
1942
|
-
const targetChain = checkoutConfig?.targetChain;
|
|
1943
|
-
const recipientAddress = targetChain ? getDepositAddressForChain(Number(targetChain), transferInit) : void 0;
|
|
1944
|
-
const isEnabled = enabled && isSwappedEnabled && !!apiKey && !!targetAsset && !!targetChain && !!recipientAddress && !!transferInit;
|
|
1945
|
-
const query = useQuery3({
|
|
1946
|
-
queryKey: [
|
|
1947
|
-
"fops",
|
|
1948
|
-
userId,
|
|
1949
|
-
recipientAddress,
|
|
1950
|
-
targetAsset,
|
|
1951
|
-
targetChain,
|
|
1952
|
-
apiKey,
|
|
1953
|
-
countryCode,
|
|
1954
|
-
fopPriority
|
|
1955
|
-
],
|
|
1956
|
-
queryFn: async () => {
|
|
1957
|
-
if (!recipientAddress || !targetChain || !targetAsset) {
|
|
1958
|
-
return { genericFormsOfPayments: [], savedFormsOfPayments: [] };
|
|
1959
|
-
}
|
|
1960
|
-
const destinationToken = { chainId: targetChain, address: targetAsset };
|
|
1961
|
-
const recipientTargets = [
|
|
1962
|
-
{ recipientAddress, destinationToken },
|
|
1963
|
-
...transferInit?.solanaAddr ? [
|
|
1964
|
-
{
|
|
1965
|
-
recipientAddress: transferInit.solanaAddr,
|
|
1966
|
-
destinationToken: {
|
|
1967
|
-
chainId: solanaChain.id.toString(),
|
|
1968
|
-
address: FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS
|
|
1969
|
-
}
|
|
1970
|
-
}
|
|
1971
|
-
] : []
|
|
1972
|
-
];
|
|
1973
|
-
const response = await getFops({
|
|
1974
|
-
apiKey,
|
|
1975
|
-
logger,
|
|
1976
|
-
params: {
|
|
1977
|
-
recipientAddress,
|
|
1978
|
-
userId,
|
|
1979
|
-
destinationToken,
|
|
1980
|
-
fiatCurrencyCode: DEFAULT_FIAT_CURRENCY,
|
|
1981
|
-
countryCode,
|
|
1982
|
-
recipientTargets
|
|
1983
|
-
}
|
|
1984
|
-
});
|
|
1985
|
-
return {
|
|
1986
|
-
genericFormsOfPayments: sortFops(
|
|
1987
|
-
response.genericFormsOfPayments,
|
|
1988
|
-
fopPriority
|
|
1989
|
-
),
|
|
1990
|
-
savedFormsOfPayments: sortFops(
|
|
1991
|
-
response.savedFormsOfPayments,
|
|
1992
|
-
fopPriority
|
|
1993
|
-
)
|
|
1994
|
-
};
|
|
1995
|
-
},
|
|
1996
|
-
enabled: isEnabled,
|
|
1997
|
-
staleTime: FOPS_STALE_TIME,
|
|
1998
|
-
refetchOnWindowFocus: false
|
|
1999
|
-
});
|
|
2000
|
-
return {
|
|
2001
|
-
savedFops: query.data?.savedFormsOfPayments ?? [],
|
|
2002
|
-
genericFops: query.data?.genericFormsOfPayments ?? [],
|
|
2003
|
-
isLoading: query.isLoading || isTransferInitLoading,
|
|
2004
|
-
isFetching: isTransferInitFetching,
|
|
2005
|
-
isSwappedEnabled
|
|
2006
|
-
};
|
|
2007
|
-
}
|
|
2008
|
-
|
|
2009
|
-
// src/transfer/hooks/useSupportedTokens.ts
|
|
2010
|
-
import { getSupportedAssets } from "@funkit/api-base";
|
|
2011
|
-
import {
|
|
2012
|
-
isTransferChainEnabled,
|
|
2013
|
-
resolveTokenTransferConfig,
|
|
2014
|
-
useDynamicConfig as useDynamicConfig3
|
|
2015
|
-
} from "@funkit/connect-core";
|
|
2016
|
-
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
2017
|
-
import { useMemo as useMemo5 } from "react";
|
|
2018
|
-
|
|
2019
|
-
// src/transfer/supportedTokens.ts
|
|
2020
|
-
function buildSupportedTokenList(resolved) {
|
|
2021
|
-
const priorityIndex = new Map(
|
|
2022
|
-
resolved.priorityTokenSymbols.map((symbol, i) => [symbol, i])
|
|
2023
|
-
);
|
|
2024
|
-
const tokens = [];
|
|
2025
|
-
const chainFilters = [{ id: "all", label: "All" }];
|
|
2026
|
-
for (const chainId of resolved.chainIdSortOrder) {
|
|
2027
|
-
const assets = Object.values(resolved.supportedAssets[chainId] ?? {});
|
|
2028
|
-
if (assets.length === 0) {
|
|
2029
|
-
continue;
|
|
2030
|
-
}
|
|
2031
|
-
chainFilters.push({ id: String(chainId), label: assets[0].chainName });
|
|
2032
|
-
for (const asset of assets) {
|
|
2033
|
-
tokens.push({
|
|
2034
|
-
id: `${asset.chainId}:${asset.address}`,
|
|
2035
|
-
symbol: asset.symbol,
|
|
2036
|
-
chainLabel: asset.chainName,
|
|
2037
|
-
chainId: Number(asset.chainId),
|
|
2038
|
-
address: asset.address
|
|
2039
|
-
});
|
|
2040
|
-
}
|
|
2041
|
-
}
|
|
2042
|
-
const rank = (symbol) => priorityIndex.get(symbol) ?? Number.POSITIVE_INFINITY;
|
|
2043
|
-
tokens.sort((a, b) => rank(a.symbol) - rank(b.symbol));
|
|
2044
|
-
return { tokens, chainFilters };
|
|
2045
|
-
}
|
|
2046
|
-
function filterSupportedTokens(tokens, {
|
|
2047
|
-
search = "",
|
|
2048
|
-
chainFilterId = "all"
|
|
2049
|
-
}) {
|
|
2050
|
-
const query = search.trim().toLowerCase();
|
|
2051
|
-
return tokens.filter((token) => {
|
|
2052
|
-
if (chainFilterId !== "all" && String(token.chainId) !== chainFilterId) {
|
|
2053
|
-
return false;
|
|
2054
|
-
}
|
|
2055
|
-
if (!query) {
|
|
2056
|
-
return true;
|
|
2057
|
-
}
|
|
2058
|
-
return token.symbol.toLowerCase().includes(query) || token.chainLabel.toLowerCase().includes(query);
|
|
2059
|
-
});
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2062
|
-
// src/transfer/hooks/useSupportedTokens.ts
|
|
2063
|
-
function useSupportedTokens({
|
|
2064
|
-
enabled = true,
|
|
2065
|
-
transferInit
|
|
2066
|
-
} = {}) {
|
|
2067
|
-
const { apiKey } = useFunkitIdentity();
|
|
2068
|
-
const tokenTransferConfig = useDynamicConfig3("tokentransferconfig");
|
|
2069
|
-
const disabledChainAssets = useDynamicConfig3(
|
|
2070
|
-
"disabletokentransferchainsandassets"
|
|
2071
|
-
);
|
|
2072
|
-
const { data, isLoading } = useQuery4({
|
|
2073
|
-
queryKey: ["getSupportedAssets", apiKey],
|
|
2074
|
-
queryFn: ({ queryKey: [, key] }) => getSupportedAssets({ apiKey: key, logger }),
|
|
2075
|
-
enabled: enabled && !!apiKey,
|
|
2076
|
-
staleTime: 5 * 6e4,
|
|
2077
|
-
refetchOnWindowFocus: false
|
|
2078
|
-
});
|
|
2079
|
-
const { tokens, chainFilters } = useMemo5(() => {
|
|
2080
|
-
if (!data) {
|
|
2081
|
-
return { tokens: [], chainFilters: [{ id: "all", label: "All" }] };
|
|
2082
|
-
}
|
|
2083
|
-
const resolved = resolveTokenTransferConfig({
|
|
2084
|
-
chainConfigs: tokenTransferConfig.chains ?? [],
|
|
2085
|
-
priorityTokens: tokenTransferConfig.priorityTokens ?? [],
|
|
2086
|
-
disabledChainAssets,
|
|
2087
|
-
supportedAssets: data,
|
|
2088
|
-
logger
|
|
2089
|
-
});
|
|
2090
|
-
const built = buildSupportedTokenList(resolved);
|
|
2091
|
-
const isEnabled = (chainId) => chainId == null || isTransferChainEnabled(chainId, transferInit);
|
|
2092
|
-
return {
|
|
2093
|
-
tokens: built.tokens.filter((t) => isEnabled(t.chainId)),
|
|
2094
|
-
chainFilters: built.chainFilters.filter(
|
|
2095
|
-
(c) => c.id === "all" || isEnabled(Number(c.id))
|
|
2096
|
-
)
|
|
2097
|
-
};
|
|
2098
|
-
}, [data, tokenTransferConfig, disabledChainAssets, transferInit]);
|
|
2099
|
-
return { tokens, chainFilters, isLoading };
|
|
2100
|
-
}
|
|
2101
|
-
|
|
2102
|
-
// src/transfer/hooks/useTokenTransfer.ts
|
|
2103
|
-
import { bitcoinChain, solanaChain as solanaChain2, tronChain } from "@funkit/chains";
|
|
2104
|
-
import {
|
|
2105
|
-
getDepositAddressForChain as getDepositAddressForChain2,
|
|
2106
|
-
getMinTransferValueForChain,
|
|
2107
|
-
getTransferTokenQrCodeUri,
|
|
2108
|
-
useDynamicConfig as useDynamicConfig4
|
|
2109
|
-
} from "@funkit/connect-core";
|
|
2110
|
-
var DEFAULT_MAX_SLIPPAGE_PERCENT = 0.25;
|
|
2111
|
-
function resolveBlockchain(chainId) {
|
|
2112
|
-
if (chainId === solanaChain2.id) {
|
|
2113
|
-
return "solana";
|
|
2114
|
-
}
|
|
2115
|
-
if (chainId === bitcoinChain.id) {
|
|
2116
|
-
return "bitcoin";
|
|
2117
|
-
}
|
|
2118
|
-
if (chainId === tronChain.id) {
|
|
2119
|
-
return "tron";
|
|
2120
|
-
}
|
|
2121
|
-
return "ethereum";
|
|
2122
|
-
}
|
|
2123
|
-
function useTokenTransfer({
|
|
2124
|
-
checkoutConfig,
|
|
2125
|
-
selectedChainId,
|
|
2126
|
-
dynamicRoutingId,
|
|
2127
|
-
enabled
|
|
2128
|
-
}) {
|
|
2129
|
-
const { transferInit, recipientAddr, isLoading } = useTransferInit({
|
|
2130
|
-
checkoutConfig,
|
|
2131
|
-
dynamicRoutingId,
|
|
2132
|
-
enabled
|
|
2133
|
-
});
|
|
2134
|
-
const minTransferLimits = useDynamicConfig4("mintokentransfervalue");
|
|
2135
|
-
const minTransferUsd = selectedChainId !== void 0 ? Math.ceil(
|
|
2136
|
-
getMinTransferValueForChain(selectedChainId, minTransferLimits)
|
|
2137
|
-
) : 0;
|
|
2138
|
-
const depositAddress = selectedChainId !== void 0 ? getDepositAddressForChain2(selectedChainId, transferInit) : void 0;
|
|
2139
|
-
const blockchain = resolveBlockchain(selectedChainId);
|
|
2140
|
-
const qrCodeUri = depositAddress ? getTransferTokenQrCodeUri({ depositAddress, type: blockchain }) : void 0;
|
|
2141
|
-
return {
|
|
2142
|
-
depositAddress,
|
|
2143
|
-
transferInit,
|
|
2144
|
-
recipientAddr,
|
|
2145
|
-
minTransferUsd,
|
|
2146
|
-
maxSlippagePercent: DEFAULT_MAX_SLIPPAGE_PERCENT,
|
|
2147
|
-
qrCodeUri,
|
|
2148
|
-
blockchain,
|
|
2149
|
-
isLoading
|
|
2150
|
-
};
|
|
2151
|
-
}
|
|
2152
|
-
|
|
2153
|
-
// src/flow/FunkitFlowProvider.tsx
|
|
2154
|
-
import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2155
|
-
var CLOSED = {
|
|
2156
|
-
isOpen: false,
|
|
2157
|
-
stack: [],
|
|
2158
|
-
config: null,
|
|
2159
|
-
callbacks: {}
|
|
2160
|
-
};
|
|
2161
|
-
var FunkitFlowContext = createContext3(null);
|
|
2162
|
-
function FunkitFlowProvider({ children }) {
|
|
2163
|
-
const [state, setState] = useState5(CLOSED);
|
|
2164
|
-
const beginDeposit = useCallback3(
|
|
2165
|
-
(config, callbacks = {}) => {
|
|
2166
|
-
callbacks.onOpen?.();
|
|
2167
|
-
setState({ isOpen: true, stack: ["addMoney"], config, callbacks });
|
|
2168
|
-
},
|
|
2169
|
-
[]
|
|
2170
|
-
);
|
|
2171
|
-
const closeFlow = useCallback3(() => {
|
|
2172
|
-
setState((prev) => {
|
|
2173
|
-
prev.callbacks.onClose?.();
|
|
2174
|
-
return CLOSED;
|
|
2175
|
-
});
|
|
2176
|
-
}, []);
|
|
2177
|
-
const navigate = useCallback3((screen) => {
|
|
2178
|
-
setState((prev) => ({ ...prev, stack: [...prev.stack, screen] }));
|
|
2179
|
-
}, []);
|
|
2180
|
-
const back = useCallback3(() => {
|
|
2181
|
-
setState((prev) => {
|
|
2182
|
-
if (prev.stack.length <= 1) {
|
|
2183
|
-
prev.callbacks.onClose?.();
|
|
2184
|
-
return CLOSED;
|
|
2185
|
-
}
|
|
2186
|
-
return { ...prev, stack: prev.stack.slice(0, -1) };
|
|
2187
|
-
});
|
|
2188
|
-
}, []);
|
|
2189
|
-
const value = useMemo6(
|
|
2190
|
-
() => ({ beginDeposit, closeFlow }),
|
|
2191
|
-
[beginDeposit, closeFlow]
|
|
2192
|
-
);
|
|
2193
|
-
const current = state.stack[state.stack.length - 1];
|
|
2194
|
-
const nav = useMemo6(
|
|
2195
|
-
() => ({ navigate, back, closeFlow }),
|
|
2196
|
-
[navigate, back, closeFlow]
|
|
2197
|
-
);
|
|
2198
|
-
return /* @__PURE__ */ jsxs6(FunkitFlowContext.Provider, { value, children: [
|
|
2199
|
-
children,
|
|
2200
|
-
/* @__PURE__ */ jsx13(
|
|
2201
|
-
Modal,
|
|
2202
|
-
{
|
|
2203
|
-
visible: state.isOpen,
|
|
2204
|
-
transparent: true,
|
|
2205
|
-
animationType: "slide",
|
|
2206
|
-
onRequestClose: closeFlow,
|
|
2207
|
-
children: /* @__PURE__ */ jsx13(Pressable6, { style: backdrop, onPress: closeFlow, children: /* @__PURE__ */ jsx13(Pressable6, { onPress: () => void 0, children: state.isOpen && state.config ? /* @__PURE__ */ jsx13(FlowContent, { config: state.config, current, nav }) : null }) })
|
|
2208
|
-
}
|
|
2209
|
-
)
|
|
2210
|
-
] });
|
|
2211
|
-
}
|
|
2212
|
-
function FlowContent({
|
|
2213
|
-
config,
|
|
2214
|
-
current,
|
|
2215
|
-
nav
|
|
2216
|
-
}) {
|
|
2217
|
-
const [selectedChain, setSelectedChain] = useState5(
|
|
2218
|
-
() => config.depositChains.find((c) => c.chainId === config.selectedChainId)
|
|
2219
|
-
);
|
|
2220
|
-
const selectedChainId = selectedChain?.chainId ?? config.selectedChainId;
|
|
2221
|
-
const networkLabel = selectedChain?.label ?? config.networkLabel;
|
|
2222
|
-
const networkIconKeys = selectedChain?.iconKeys ?? config.networkIconChains ?? [];
|
|
2223
|
-
const {
|
|
2224
|
-
depositAddress: generatedAddress,
|
|
2225
|
-
qrCodeUri,
|
|
2226
|
-
transferInit
|
|
2227
|
-
} = useTokenTransfer({
|
|
2228
|
-
checkoutConfig: config.checkoutConfig,
|
|
2229
|
-
selectedChainId,
|
|
2230
|
-
dynamicRoutingId: config.dynamicRoutingId,
|
|
2231
|
-
enabled: true
|
|
2232
|
-
});
|
|
2233
|
-
const fetched = useSupportedTokens({ transferInit });
|
|
2234
|
-
const supportedTokens = config.supportedTokens ?? fetched.tokens;
|
|
2235
|
-
const tokenChainFilters = config.tokenChainFilters ?? fetched.chainFilters;
|
|
2236
|
-
const { savedFops, genericFops, isSwappedEnabled } = useFops({
|
|
2237
|
-
checkoutConfig: config.checkoutConfig,
|
|
2238
|
-
dynamicRoutingId: config.dynamicRoutingId
|
|
2239
|
-
});
|
|
2240
|
-
const [selectedSwappedUrl, setSelectedSwappedUrl] = useState5();
|
|
2241
|
-
const [tokenSearch, setTokenSearch] = useState5("");
|
|
2242
|
-
const [chainFilterId, setChainFilterId] = useState5("all");
|
|
2243
|
-
const filteredTokens = filterSupportedTokens(supportedTokens, {
|
|
2244
|
-
search: tokenSearch,
|
|
2245
|
-
chainFilterId
|
|
2246
|
-
});
|
|
2247
|
-
const selectToken = (id) => {
|
|
2248
|
-
const token = supportedTokens.find((t) => t.id === id);
|
|
2249
|
-
if (token?.chainId != null) {
|
|
2250
|
-
const match = config.depositChains.find(
|
|
2251
|
-
(c) => c.chainId === token.chainId
|
|
2252
|
-
);
|
|
2253
|
-
setSelectedChain(
|
|
2254
|
-
match ?? {
|
|
2255
|
-
id: `chain-${token.chainId}`,
|
|
2256
|
-
label: token.chainLabel,
|
|
2257
|
-
chainId: token.chainId
|
|
2258
|
-
}
|
|
2259
|
-
);
|
|
2260
|
-
}
|
|
2261
|
-
nav.back();
|
|
2262
|
-
};
|
|
2263
|
-
const rawAddress = generatedAddress ?? config.depositAddress;
|
|
2264
|
-
const displayAddress = rawAddress ? formatDepositAddress(rawAddress) : "Generating\u2026";
|
|
2265
|
-
const networkChains = config.networkIconChains ?? [];
|
|
2266
|
-
switch (current) {
|
|
2267
|
-
case "addMoney": {
|
|
2268
|
-
const cryptoMethod = config.paymentMethods.map(
|
|
2269
|
-
(method) => method.id === config.cryptoMethodId && method.icon == null ? { ...method, icon: /* @__PURE__ */ jsx13(ChainClusterIcon, { chains: networkChains }) } : method
|
|
2270
|
-
);
|
|
2271
|
-
const toCashRows = (fops) => toFopRows(fops).map((row4) => ({
|
|
2272
|
-
id: row4.id,
|
|
2273
|
-
title: row4.name,
|
|
2274
|
-
subtitle: row4.subtitle,
|
|
2275
|
-
icon: /* @__PURE__ */ jsx13(FunIcon, { uri: row4.iconUri, fallbackUri: FALLBACK_ASSET_LOGO })
|
|
2276
|
-
}));
|
|
2277
|
-
const methods = isSwappedEnabled ? [
|
|
2278
|
-
...toCashRows(savedFops),
|
|
2279
|
-
...cryptoMethod,
|
|
2280
|
-
...toCashRows(genericFops)
|
|
2281
|
-
] : cryptoMethod;
|
|
2282
|
-
return /* @__PURE__ */ jsx13(
|
|
2283
|
-
AddMoneyScreen,
|
|
2284
|
-
{
|
|
2285
|
-
methods,
|
|
2286
|
-
onSelectMethod: (id) => {
|
|
2287
|
-
if (id === config.cryptoMethodId) {
|
|
2288
|
-
nav.navigate("transfer");
|
|
2289
|
-
return;
|
|
2290
|
-
}
|
|
2291
|
-
if (id.includes(":")) {
|
|
2292
|
-
const fop = [...savedFops, ...genericFops].find(
|
|
2293
|
-
(f) => `${f.fopType}:${f.name}` === id
|
|
2294
|
-
);
|
|
2295
|
-
if (fop?.embeddedFlowUrl) {
|
|
2296
|
-
setSelectedSwappedUrl(fop.embeddedFlowUrl);
|
|
2297
|
-
nav.navigate("swapped");
|
|
2298
|
-
}
|
|
2299
|
-
return;
|
|
2300
|
-
}
|
|
2301
|
-
}
|
|
2302
|
-
}
|
|
2303
|
-
);
|
|
2304
|
-
}
|
|
2305
|
-
case "transfer":
|
|
2306
|
-
return /* @__PURE__ */ jsx13(
|
|
2307
|
-
TransferCryptoScreen,
|
|
2308
|
-
{
|
|
2309
|
-
depositAddress: displayAddress,
|
|
2310
|
-
networkLabel,
|
|
2311
|
-
networkIcon: /* @__PURE__ */ jsx13(ChainClusterIcon, { chains: networkIconKeys }),
|
|
2312
|
-
onBack: nav.back,
|
|
2313
|
-
onChangeNetwork: () => nav.navigate("chooseChain"),
|
|
2314
|
-
onShowSupportedTokens: () => nav.navigate("supportedTokens"),
|
|
2315
|
-
onShowQrCode: () => nav.navigate("qrCode"),
|
|
2316
|
-
onCopyAddress: rawAddress ? () => void copyToClipboard(rawAddress) : void 0,
|
|
2317
|
-
onShareAddress: rawAddress ? () => void Share.share({ message: rawAddress }) : void 0
|
|
2318
|
-
}
|
|
2319
|
-
);
|
|
2320
|
-
case "chooseChain":
|
|
2321
|
-
return /* @__PURE__ */ jsx13(
|
|
2322
|
-
ChooseChainScreen,
|
|
2323
|
-
{
|
|
2324
|
-
chains: config.depositChains.map(
|
|
2325
|
-
(chain) => chain.icon == null && chain.iconKeys != null ? { ...chain, icon: /* @__PURE__ */ jsx13(ChainClusterIcon, { chains: chain.iconKeys }) } : chain
|
|
2326
|
-
),
|
|
2327
|
-
onBack: nav.back,
|
|
2328
|
-
onSelectChain: (id) => {
|
|
2329
|
-
const picked = config.depositChains.find((c) => c.id === id);
|
|
2330
|
-
if (picked) {
|
|
2331
|
-
setSelectedChain(picked);
|
|
2332
|
-
}
|
|
2333
|
-
nav.back();
|
|
2334
|
-
}
|
|
2335
|
-
}
|
|
2336
|
-
);
|
|
2337
|
-
case "supportedTokens":
|
|
2338
|
-
return /* @__PURE__ */ jsx13(
|
|
2339
|
-
SupportedTokensScreen,
|
|
2340
|
-
{
|
|
2341
|
-
tokens: filteredTokens.map(
|
|
2342
|
-
(token) => token.icon == null ? {
|
|
2343
|
-
...token,
|
|
2344
|
-
icon: /* @__PURE__ */ jsx13(
|
|
2345
|
-
FunIcon,
|
|
2346
|
-
{
|
|
2347
|
-
uri: tokenLogoUri(token.symbol),
|
|
2348
|
-
fallbackUri: FALLBACK_ASSET_LOGO
|
|
2349
|
-
}
|
|
2350
|
-
)
|
|
2351
|
-
} : token
|
|
2352
|
-
),
|
|
2353
|
-
searchValue: tokenSearch,
|
|
2354
|
-
onSearchChange: setTokenSearch,
|
|
2355
|
-
chainFilters: tokenChainFilters,
|
|
2356
|
-
selectedChainFilterId: chainFilterId,
|
|
2357
|
-
onSelectChainFilter: setChainFilterId,
|
|
2358
|
-
onSelectToken: selectToken,
|
|
2359
|
-
onBack: nav.back
|
|
2360
|
-
}
|
|
2361
|
-
);
|
|
2362
|
-
case "qrCode":
|
|
2363
|
-
return /* @__PURE__ */ jsx13(
|
|
2364
|
-
QrCodeScreen,
|
|
2365
|
-
{
|
|
2366
|
-
qrCode: config.qrCode ?? (qrCodeUri ? /* @__PURE__ */ jsx13(QrCode, { value: qrCodeUri }) : null),
|
|
2367
|
-
onClose: nav.back,
|
|
2368
|
-
onSupportedChainsPress: () => nav.navigate("supportedTokens")
|
|
2369
|
-
}
|
|
2370
|
-
);
|
|
2371
|
-
case "swapped":
|
|
2372
|
-
return selectedSwappedUrl ? /* @__PURE__ */ jsx13(
|
|
2373
|
-
SwappedScreen,
|
|
2374
|
-
{
|
|
2375
|
-
url: selectedSwappedUrl,
|
|
2376
|
-
onBack: nav.back,
|
|
2377
|
-
onClose: nav.closeFlow
|
|
2378
|
-
}
|
|
2379
|
-
) : null;
|
|
2380
|
-
default:
|
|
2381
|
-
return null;
|
|
2382
|
-
}
|
|
2383
|
-
}
|
|
2384
|
-
function useFunkitFlow() {
|
|
2385
|
-
const value = useContext3(FunkitFlowContext);
|
|
2386
|
-
if (value == null) {
|
|
2387
|
-
throw new Error("useFunkitFlow must be used within <FunkitProvider>");
|
|
2388
|
-
}
|
|
2389
|
-
return value;
|
|
2390
|
-
}
|
|
2391
|
-
var backdrop = {
|
|
2392
|
-
flex: 1,
|
|
2393
|
-
backgroundColor: "rgba(0,0,0,0.45)",
|
|
2394
|
-
justifyContent: "flex-end"
|
|
2395
|
-
};
|
|
2396
|
-
|
|
2397
|
-
// src/version.ts
|
|
2398
|
-
var CONNECT_RN_VERSION = true ? "0.2.0-next.0" : "0.0.0-dev";
|
|
2399
|
-
|
|
2400
|
-
// src/providers/FunkitStatsigProvider.tsx
|
|
2401
|
-
import {
|
|
2402
|
-
LogEventCompressionMode,
|
|
2403
|
-
LogLevel,
|
|
2404
|
-
StatsigProvider
|
|
2405
|
-
} from "@statsig/react-bindings";
|
|
2406
|
-
import { useMemo as useMemo7 } from "react";
|
|
2407
|
-
|
|
2408
|
-
// src/statsig/useClientAsyncInitRN.ts
|
|
2409
|
-
import {
|
|
2410
|
-
useStatsigInternalClientFactoryAsync
|
|
2411
|
-
} from "@statsig/react-bindings";
|
|
2412
|
-
|
|
2413
|
-
// src/statsig/StatsigClientRN.ts
|
|
2414
|
-
import {
|
|
2415
|
-
StatsigClient
|
|
2416
|
-
} from "@statsig/react-bindings";
|
|
2417
|
-
|
|
2418
|
-
// src/statsig/rnSetup.ts
|
|
2419
|
-
import {
|
|
2420
|
-
SDKType,
|
|
2421
|
-
StatsigMetadataProvider
|
|
2422
|
-
} from "@statsig/react-bindings";
|
|
2423
|
-
|
|
2424
|
-
// src/statsig/appVisibilityShim.ts
|
|
2425
|
-
import { _notifyVisibilityChanged } from "@statsig/react-bindings";
|
|
2426
|
-
import { AppState } from "react-native";
|
|
2427
|
-
var isApplied = false;
|
|
2428
|
-
function applyAppStateVisibilityShim() {
|
|
2429
|
-
if (isApplied) {
|
|
2430
|
-
return;
|
|
2431
|
-
}
|
|
2432
|
-
isApplied = true;
|
|
2433
|
-
AppState.addEventListener(
|
|
2434
|
-
"change",
|
|
2435
|
-
(nextAppState) => _notifyVisibilityChanged(
|
|
2436
|
-
nextAppState === "active" ? "foreground" : "background"
|
|
2437
|
-
)
|
|
2438
|
-
);
|
|
2439
|
-
}
|
|
2440
|
-
|
|
2441
|
-
// src/statsig/preloadedAsyncStorage.ts
|
|
2442
|
-
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
2443
|
-
import { Log } from "@statsig/react-bindings";
|
|
2444
|
-
var NOT_READY_ERROR = "Attempting to alter AsyncStorage before it is ready. Values will not be persisted.";
|
|
2445
|
-
function createPreloadedAsyncStorage() {
|
|
2446
|
-
const inMemoryStore = {};
|
|
2447
|
-
let isResolved = false;
|
|
2448
|
-
let readyPromise = null;
|
|
2449
|
-
const enforceIsResolved = () => {
|
|
2450
|
-
if (!isResolved) {
|
|
2451
|
-
Log.error(NOT_READY_ERROR);
|
|
2452
|
-
}
|
|
2453
|
-
return isResolved;
|
|
2454
|
-
};
|
|
2455
|
-
const provider = {
|
|
2456
|
-
getProviderName: () => "AsyncStorage",
|
|
2457
|
-
isReady: () => isResolved,
|
|
2458
|
-
isReadyResolver: () => {
|
|
2459
|
-
if (!readyPromise) {
|
|
2460
|
-
readyPromise = prefetchFromAsyncStorage(inMemoryStore).finally(() => {
|
|
2461
|
-
isResolved = true;
|
|
2462
|
-
});
|
|
2463
|
-
}
|
|
2464
|
-
return readyPromise;
|
|
2465
|
-
},
|
|
2466
|
-
getItem: (key) => {
|
|
2467
|
-
if (!enforceIsResolved()) {
|
|
2468
|
-
return null;
|
|
2469
|
-
}
|
|
2470
|
-
return inMemoryStore[key] ?? null;
|
|
2471
|
-
},
|
|
2472
|
-
setItem: (key, value) => {
|
|
2473
|
-
inMemoryStore[key] = value;
|
|
2474
|
-
if (!enforceIsResolved()) {
|
|
2475
|
-
return;
|
|
2476
|
-
}
|
|
2477
|
-
AsyncStorage.setItem(key, value).catch(Log.error);
|
|
2478
|
-
},
|
|
2479
|
-
removeItem: (key) => {
|
|
2480
|
-
delete inMemoryStore[key];
|
|
2481
|
-
if (!enforceIsResolved()) {
|
|
2482
|
-
return;
|
|
2483
|
-
}
|
|
2484
|
-
AsyncStorage.removeItem(key).catch(Log.error);
|
|
2485
|
-
},
|
|
2486
|
-
getAllKeys: () => {
|
|
2487
|
-
if (!enforceIsResolved()) {
|
|
2488
|
-
return [];
|
|
2489
|
-
}
|
|
2490
|
-
return Object.keys(inMemoryStore);
|
|
2491
|
-
}
|
|
2492
|
-
};
|
|
2493
|
-
return provider;
|
|
2494
|
-
}
|
|
2495
|
-
async function prefetchFromAsyncStorage(inMemoryStore) {
|
|
2496
|
-
const keys = await AsyncStorage.getAllKeys();
|
|
2497
|
-
await Promise.all(
|
|
2498
|
-
keys.map(async (key) => {
|
|
2499
|
-
if (!key.startsWith("statsig.")) {
|
|
2500
|
-
return;
|
|
2501
|
-
}
|
|
2502
|
-
const cache = await AsyncStorage.getItem(key);
|
|
2503
|
-
if (!cache) {
|
|
2504
|
-
return;
|
|
2505
|
-
}
|
|
2506
|
-
inMemoryStore[key] = cache;
|
|
2507
|
-
})
|
|
2508
|
-
);
|
|
2509
|
-
}
|
|
2510
|
-
|
|
2511
|
-
// src/statsig/rnSetup.ts
|
|
2512
|
-
function setupStatsigForReactNative(statsigMetadataAdditions, options) {
|
|
2513
|
-
applyAppStateVisibilityShim();
|
|
2514
|
-
SDKType._setBindingType("rn");
|
|
2515
|
-
if (statsigMetadataAdditions) {
|
|
2516
|
-
StatsigMetadataProvider.add(statsigMetadataAdditions);
|
|
2517
|
-
}
|
|
2518
|
-
if (options.storageProvider == null) {
|
|
2519
|
-
options.storageProvider = createPreloadedAsyncStorage();
|
|
2520
|
-
}
|
|
2521
|
-
applyNetworkFix(options);
|
|
2522
|
-
}
|
|
2523
|
-
function applyNetworkFix(options) {
|
|
2524
|
-
if (options.networkConfig?.networkOverrideFunc != null) {
|
|
2525
|
-
return;
|
|
2526
|
-
}
|
|
2527
|
-
const networkOverrideFunc = (url, args) => {
|
|
2528
|
-
if (args.body != null && args.method === "POST") {
|
|
2529
|
-
args.headers = {
|
|
2530
|
-
"Content-Type": "application/json",
|
|
2531
|
-
...args.headers
|
|
2532
|
-
};
|
|
2533
|
-
}
|
|
2534
|
-
return fetch(url, args);
|
|
2535
|
-
};
|
|
2536
|
-
options.networkConfig = {
|
|
2537
|
-
networkOverrideFunc,
|
|
2538
|
-
...options.networkConfig
|
|
2539
|
-
};
|
|
2540
|
-
}
|
|
2541
|
-
|
|
2542
|
-
// src/statsig/statsigMetadata.ts
|
|
2543
|
-
import { NativeModules, Platform } from "react-native";
|
|
2544
|
-
function resolveLocale() {
|
|
2545
|
-
if (Platform.OS === "android") {
|
|
2546
|
-
const i18nManager = NativeModules.I18nManager;
|
|
2547
|
-
return i18nManager?.localIdentifer ?? void 0;
|
|
2548
|
-
}
|
|
2549
|
-
if (Platform.OS === "ios") {
|
|
2550
|
-
const settings = NativeModules.SettingsManager?.settings;
|
|
2551
|
-
return settings?.AppLocale ?? settings?.AppleLanguages?.[0] ?? void 0;
|
|
2552
|
-
}
|
|
2553
|
-
return void 0;
|
|
2554
|
-
}
|
|
2555
|
-
function getStatsigMetadataAdditions() {
|
|
2556
|
-
return {
|
|
2557
|
-
// Device-info-derived fields are dropped (no react-native-device-info).
|
|
2558
|
-
appVersion: void 0,
|
|
2559
|
-
systemVersion: void 0,
|
|
2560
|
-
deviceModelName: void 0,
|
|
2561
|
-
deviceModel: void 0,
|
|
2562
|
-
// Available without any native module:
|
|
2563
|
-
systemName: Platform.OS,
|
|
2564
|
-
locale: resolveLocale()
|
|
2565
|
-
};
|
|
2566
|
-
}
|
|
2567
|
-
|
|
2568
|
-
// src/statsig/StatsigClientRN.ts
|
|
2569
|
-
var StatsigClientRN = class extends StatsigClient {
|
|
2570
|
-
constructor(sdkKey, user, options = null) {
|
|
2571
|
-
const opts = options ?? {};
|
|
2572
|
-
setupStatsigForReactNative(getStatsigMetadataAdditions(), opts);
|
|
2573
|
-
super(sdkKey, user, opts);
|
|
2574
|
-
this.__isRnClient = true;
|
|
2575
|
-
}
|
|
2576
|
-
};
|
|
2577
|
-
|
|
2578
|
-
// src/statsig/useClientAsyncInitRN.ts
|
|
2579
|
-
function useClientAsyncInitRN(sdkKey, initialUser, statsigOptions = null) {
|
|
2580
|
-
return useStatsigInternalClientFactoryAsync(
|
|
2581
|
-
(args) => new StatsigClientRN(args.sdkKey, args.initialUser, args.statsigOptions),
|
|
2582
|
-
{
|
|
2583
|
-
sdkKey,
|
|
2584
|
-
initialUser,
|
|
2585
|
-
statsigOptions
|
|
2586
|
-
}
|
|
2587
|
-
);
|
|
2588
|
-
}
|
|
2589
|
-
|
|
2590
|
-
// src/providers/FunkitStatsigProvider.tsx
|
|
2591
|
-
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2592
|
-
var STATSIG_API = "https://data-api.fun.xyz/v1";
|
|
2593
|
-
var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
|
|
2594
|
-
function FunkitStatsigProvider({
|
|
2595
|
-
children,
|
|
2596
|
-
apiKey,
|
|
2597
|
-
userId,
|
|
2598
|
-
isDevelopment = false
|
|
2599
|
-
}) {
|
|
2600
|
-
const user = useMemo7(
|
|
2601
|
-
() => ({ userID: userId, customIDs: { apiKey } }),
|
|
2602
|
-
[userId, apiKey]
|
|
2603
|
-
);
|
|
2604
|
-
const { client } = useClientAsyncInitRN(STATSIG_CLIENT_KEY, user, {
|
|
2605
|
-
networkConfig: {
|
|
2606
|
-
api: STATSIG_API,
|
|
2607
|
-
// default timeout (10s) is too large; statsig usually responds <200ms
|
|
2608
|
-
networkTimeoutMs: 5e3
|
|
2609
|
-
},
|
|
2610
|
-
// Our proxy supports compression; force it on to save bandwidth.
|
|
2611
|
-
logEventCompressionMode: LogEventCompressionMode.Forced,
|
|
2612
|
-
// Silence harmless warnings from hooks running before async init (we have
|
|
2613
|
-
// bootstrap fallbacks).
|
|
2614
|
-
logLevel: isDevelopment ? void 0 : LogLevel.Error,
|
|
2615
|
-
environment: {
|
|
2616
|
-
tier: isDevelopment ? "development" : "production"
|
|
2617
|
-
}
|
|
2618
|
-
});
|
|
2619
|
-
return /* @__PURE__ */ jsx14(StatsigProvider, { client, children });
|
|
2620
|
-
}
|
|
2621
|
-
|
|
2622
|
-
// src/providers/FunkitProvider.tsx
|
|
2623
|
-
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2624
|
-
var ANONYMOUS_CONFIG = { apiKey: "" };
|
|
2625
|
-
function FunkitProvider({
|
|
2626
|
-
children,
|
|
2627
|
-
config,
|
|
2628
|
-
walletAddress,
|
|
2629
|
-
queryClient,
|
|
2630
|
-
themes,
|
|
2631
|
-
colorScheme,
|
|
2632
|
-
debug = false
|
|
2633
|
-
}) {
|
|
2634
|
-
const fallbackClient = useRef3(void 0);
|
|
2635
|
-
fallbackClient.current ??= new QueryClient();
|
|
2636
|
-
const client = queryClient ?? fallbackClient.current;
|
|
2637
|
-
const identity = useMemo8(
|
|
2638
|
-
() => resolveFunkitIdentity(config ?? ANONYMOUS_CONFIG, walletAddress),
|
|
2639
|
-
[config, walletAddress]
|
|
2640
|
-
);
|
|
2641
|
-
useEffect5(() => {
|
|
2642
|
-
if (!config?.apiKey) {
|
|
2643
|
-
return;
|
|
2644
|
-
}
|
|
2645
|
-
logger.configure(config.apiKey, debug, CONNECT_RN_VERSION);
|
|
2646
|
-
}, [config?.apiKey, debug]);
|
|
2647
|
-
useEffect5(() => {
|
|
2648
|
-
logger.setUserInfo(
|
|
2649
|
-
identity.userId,
|
|
2650
|
-
identity.walletAddress,
|
|
2651
|
-
"",
|
|
2652
|
-
identity.loginType ?? "",
|
|
2653
|
-
""
|
|
2654
|
-
);
|
|
2655
|
-
}, [identity]);
|
|
2656
|
-
return /* @__PURE__ */ jsx15(
|
|
2657
|
-
FunkitStatsigProvider,
|
|
2658
|
-
{
|
|
2659
|
-
apiKey: identity.apiKey,
|
|
2660
|
-
userId: identity.userId,
|
|
2661
|
-
isDevelopment: debug,
|
|
2662
|
-
children: /* @__PURE__ */ jsx15(QueryClientProvider, { client, children: /* @__PURE__ */ jsx15(FunkitIdentityProvider, { identity, children: /* @__PURE__ */ jsx15(FunkitThemeProvider, { themes, colorScheme, children: /* @__PURE__ */ jsx15(FunkitFlowProvider, { children }) }) }) })
|
|
2663
|
-
}
|
|
2664
|
-
);
|
|
2665
|
-
}
|
|
2666
|
-
|
|
2667
|
-
// src/providers/useFunkitCheckout.ts
|
|
2668
|
-
import { useCallback as useCallback4 } from "react";
|
|
2669
|
-
function useFunkitCheckout(callbacks = {}) {
|
|
2670
|
-
const { beginDeposit: begin } = useFunkitFlow();
|
|
2671
|
-
const beginDeposit = useCallback4(
|
|
2672
|
-
(config) => begin(config, callbacks),
|
|
2673
|
-
[begin, callbacks]
|
|
2674
|
-
);
|
|
2675
|
-
return { beginDeposit };
|
|
2676
|
-
}
|
|
1115
|
+
var styles5 = StyleSheet5.create({
|
|
1116
|
+
topBar: {
|
|
1117
|
+
paddingTop: 20,
|
|
1118
|
+
paddingBottom: 12,
|
|
1119
|
+
paddingHorizontal: 12
|
|
1120
|
+
},
|
|
1121
|
+
grabber: {
|
|
1122
|
+
position: "absolute",
|
|
1123
|
+
top: 8,
|
|
1124
|
+
left: "50%",
|
|
1125
|
+
marginLeft: -18,
|
|
1126
|
+
width: 36,
|
|
1127
|
+
height: 5
|
|
1128
|
+
},
|
|
1129
|
+
chevron: {
|
|
1130
|
+
fontSize: 26,
|
|
1131
|
+
lineHeight: 28,
|
|
1132
|
+
width: 24,
|
|
1133
|
+
textAlign: "center"
|
|
1134
|
+
},
|
|
1135
|
+
qrButton: { width: 24, alignItems: "center" },
|
|
1136
|
+
content: {
|
|
1137
|
+
paddingHorizontal: 20,
|
|
1138
|
+
paddingBottom: 16,
|
|
1139
|
+
paddingTop: 8,
|
|
1140
|
+
gap: 8
|
|
1141
|
+
},
|
|
1142
|
+
networkRow: { paddingHorizontal: 16, paddingVertical: 10 },
|
|
1143
|
+
addressCard: { padding: 16 },
|
|
1144
|
+
addressDetails: { gap: 4 },
|
|
1145
|
+
actionGlyph: { fontSize: 18, lineHeight: 20, fontWeight: "500" }
|
|
1146
|
+
});
|
|
2677
1147
|
export {
|
|
1148
|
+
AddMoneyScreen,
|
|
2678
1149
|
Box,
|
|
2679
1150
|
FunkitProvider,
|
|
2680
1151
|
FunkitThemeProvider,
|
|
1152
|
+
QrCodeScreen,
|
|
2681
1153
|
Text,
|
|
1154
|
+
TransferCryptoScreen,
|
|
2682
1155
|
darkTokens,
|
|
2683
1156
|
defaultDarkTheme,
|
|
2684
1157
|
defaultLightTheme,
|
|
@@ -2687,7 +1160,6 @@ export {
|
|
|
2687
1160
|
resolveColorScheme,
|
|
2688
1161
|
toRestyleTheme,
|
|
2689
1162
|
useColorScheme,
|
|
2690
|
-
useFunkitCheckout,
|
|
2691
1163
|
useFunkitColorScheme,
|
|
2692
1164
|
useFunkitTheme
|
|
2693
1165
|
};
|