@reown/appkit-react-native 0.0.0-feat-coinbase-20250722184953 → 0.0.0-feat-coinbase-20250723173858

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/lib/commonjs/utils/UiUtil.js +7 -4
  2. package/lib/commonjs/utils/UiUtil.js.map +1 -1
  3. package/lib/commonjs/views/w3m-all-wallets-view/index.js +11 -10
  4. package/lib/commonjs/views/w3m-all-wallets-view/index.js.map +1 -1
  5. package/lib/commonjs/views/w3m-connect-view/components/all-wallet-list.js +2 -3
  6. package/lib/commonjs/views/w3m-connect-view/components/all-wallet-list.js.map +1 -1
  7. package/lib/commonjs/views/w3m-connect-view/components/all-wallets-button.js +1 -5
  8. package/lib/commonjs/views/w3m-connect-view/components/all-wallets-button.js.map +1 -1
  9. package/lib/commonjs/views/w3m-connect-view/components/custom-wallet-list.js +2 -3
  10. package/lib/commonjs/views/w3m-connect-view/components/custom-wallet-list.js.map +1 -1
  11. package/lib/commonjs/views/w3m-connect-view/components/recent-wallet-list.js +2 -3
  12. package/lib/commonjs/views/w3m-connect-view/components/recent-wallet-list.js.map +1 -1
  13. package/lib/commonjs/views/w3m-connect-view/index.js +19 -26
  14. package/lib/commonjs/views/w3m-connect-view/index.js.map +1 -1
  15. package/lib/commonjs/views/w3m-connecting-external-view/index.js +22 -29
  16. package/lib/commonjs/views/w3m-connecting-external-view/index.js.map +1 -1
  17. package/lib/commonjs/views/w3m-connecting-view/index.js +3 -11
  18. package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
  19. package/lib/module/utils/UiUtil.js +7 -4
  20. package/lib/module/utils/UiUtil.js.map +1 -1
  21. package/lib/module/views/w3m-all-wallets-view/index.js +11 -10
  22. package/lib/module/views/w3m-all-wallets-view/index.js.map +1 -1
  23. package/lib/module/views/w3m-connect-view/components/all-wallet-list.js +2 -3
  24. package/lib/module/views/w3m-connect-view/components/all-wallet-list.js.map +1 -1
  25. package/lib/module/views/w3m-connect-view/components/all-wallets-button.js +1 -5
  26. package/lib/module/views/w3m-connect-view/components/all-wallets-button.js.map +1 -1
  27. package/lib/module/views/w3m-connect-view/components/custom-wallet-list.js +2 -3
  28. package/lib/module/views/w3m-connect-view/components/custom-wallet-list.js.map +1 -1
  29. package/lib/module/views/w3m-connect-view/components/recent-wallet-list.js +2 -3
  30. package/lib/module/views/w3m-connect-view/components/recent-wallet-list.js.map +1 -1
  31. package/lib/module/views/w3m-connect-view/index.js +19 -26
  32. package/lib/module/views/w3m-connect-view/index.js.map +1 -1
  33. package/lib/module/views/w3m-connecting-external-view/index.js +23 -31
  34. package/lib/module/views/w3m-connecting-external-view/index.js.map +1 -1
  35. package/lib/module/views/w3m-connecting-view/index.js +3 -11
  36. package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
  37. package/lib/typescript/utils/UiUtil.d.ts +1 -0
  38. package/lib/typescript/utils/UiUtil.d.ts.map +1 -1
  39. package/lib/typescript/views/w3m-all-wallets-view/index.d.ts.map +1 -1
  40. package/lib/typescript/views/w3m-connect-view/components/all-wallet-list.d.ts +1 -2
  41. package/lib/typescript/views/w3m-connect-view/components/all-wallet-list.d.ts.map +1 -1
  42. package/lib/typescript/views/w3m-connect-view/components/all-wallets-button.d.ts +1 -2
  43. package/lib/typescript/views/w3m-connect-view/components/all-wallets-button.d.ts.map +1 -1
  44. package/lib/typescript/views/w3m-connect-view/components/custom-wallet-list.d.ts +1 -2
  45. package/lib/typescript/views/w3m-connect-view/components/custom-wallet-list.d.ts.map +1 -1
  46. package/lib/typescript/views/w3m-connect-view/components/recent-wallet-list.d.ts +1 -2
  47. package/lib/typescript/views/w3m-connect-view/components/recent-wallet-list.d.ts.map +1 -1
  48. package/lib/typescript/views/w3m-connect-view/index.d.ts.map +1 -1
  49. package/lib/typescript/views/w3m-connecting-external-view/index.d.ts.map +1 -1
  50. package/lib/typescript/views/w3m-connecting-view/index.d.ts.map +1 -1
  51. package/package.json +5 -5
  52. package/src/utils/UiUtil.ts +8 -4
  53. package/src/views/w3m-all-wallets-view/index.tsx +9 -7
  54. package/src/views/w3m-connect-view/components/all-wallet-list.tsx +2 -3
  55. package/src/views/w3m-connect-view/components/all-wallets-button.tsx +1 -6
  56. package/src/views/w3m-connect-view/components/custom-wallet-list.tsx +2 -3
  57. package/src/views/w3m-connect-view/components/recent-wallet-list.tsx +2 -3
  58. package/src/views/w3m-connect-view/index.tsx +20 -34
  59. package/src/views/w3m-connecting-external-view/index.tsx +21 -32
  60. package/src/views/w3m-connecting-view/index.tsx +3 -11
@@ -25,12 +25,16 @@ export const UiUtil = {
25
25
  StorageUtil.setWalletConnectDeepLink(wcLinking);
26
26
 
27
27
  if (pressedWallet) {
28
- const recentWallets = await StorageUtil.addRecentWallet(pressedWallet);
29
- if (recentWallets) {
30
- ConnectionController.setRecentWallets(recentWallets);
31
- }
28
+ UiUtil.storeRecentWallet(pressedWallet);
32
29
  const url = AssetUtil.getWalletImage(pressedWallet);
33
30
  ConnectionController.setConnectedWalletImageUrl(url);
34
31
  }
32
+ },
33
+
34
+ storeRecentWallet: async (wallet: WcWallet) => {
35
+ const recentWallets = await StorageUtil.addRecentWallet(wallet);
36
+ if (recentWallets) {
37
+ ConnectionController.setRecentWallets(recentWallets);
38
+ }
35
39
  }
36
40
  };
@@ -6,6 +6,7 @@ import {
6
6
  type WcWallet
7
7
  } from '@reown/appkit-core-react-native';
8
8
  import { FlexView, IconLink, SearchBar, Spacing, useTheme } from '@reown/appkit-ui-react-native';
9
+ import { ConstantsUtil } from '@reown/appkit-common-react-native';
9
10
 
10
11
  import styles from './styles';
11
12
  import { useDebounceCallback } from '../../hooks/useDebounceCallback';
@@ -24,13 +25,14 @@ export function AllWalletsView() {
24
25
  const { debouncedCallback: onInputChange } = useDebounceCallback({ callback: setSearchQuery });
25
26
 
26
27
  const onWalletPress = (wallet: WcWallet) => {
27
- //TODO: check this
28
- // const connector = ConnectorController.state.connectors.find(c => c.explorerId === wallet.id);
29
- // if (connector) {
30
- // RouterController.push('ConnectingExternal', { connector, wallet });
31
- // } else {
32
- RouterController.push('ConnectingWalletConnect', { wallet });
33
- // }
28
+ const isExternal =
29
+ wallet.id === ConstantsUtil.PHANTOM_EXPLORER_ID ||
30
+ wallet.id === ConstantsUtil.COINBASE_EXPLORER_ID;
31
+ if (isExternal) {
32
+ RouterController.push('ConnectingExternal', { wallet });
33
+ } else {
34
+ RouterController.push('ConnectingWalletConnect', { wallet });
35
+ }
34
36
 
35
37
  EventsController.sendEvent({
36
38
  type: 'track',
@@ -14,10 +14,9 @@ import { filterOutRecentWallets } from '../utils';
14
14
  interface Props {
15
15
  itemStyle: StyleProp<ViewStyle>;
16
16
  onWalletPress: (wallet: WcWallet) => void;
17
- isWalletConnectEnabled: boolean;
18
17
  }
19
18
 
20
- export function AllWalletList({ itemStyle, onWalletPress, isWalletConnectEnabled }: Props) {
19
+ export function AllWalletList({ itemStyle, onWalletPress }: Props) {
21
20
  const { installed, featured, recommended, prefetchLoading } = useSnapshot(ApiController.state);
22
21
  const { recentWallets } = useSnapshot(ConnectionController.state) as ConnectionControllerState;
23
22
  const imageHeaders = ApiController._getApiHeaders();
@@ -35,7 +34,7 @@ export function AllWalletList({ itemStyle, onWalletPress, isWalletConnectEnabled
35
34
  UiUtil.TOTAL_VISIBLE_WALLETS - RECENT_COUNT
36
35
  );
37
36
 
38
- if (!isWalletConnectEnabled || !list?.length) {
37
+ if (!list?.length) {
39
38
  return null;
40
39
  }
41
40
 
@@ -6,16 +6,11 @@ import type { StyleProp, ViewStyle } from 'react-native';
6
6
  interface Props {
7
7
  itemStyle: StyleProp<ViewStyle>;
8
8
  onPress: () => void;
9
- isWalletConnectEnabled: boolean;
10
9
  }
11
10
 
12
- export function AllWalletsButton({ itemStyle, onPress, isWalletConnectEnabled }: Props) {
11
+ export function AllWalletsButton({ itemStyle, onPress }: Props) {
13
12
  const { installed, count } = useSnapshot(ApiController.state);
14
13
 
15
- if (!isWalletConnectEnabled) {
16
- return null;
17
- }
18
-
19
14
  const total = installed.length + count;
20
15
  const label = total > 10 ? `${Math.floor(total / 10) * 10}+` : total;
21
16
 
@@ -15,17 +15,16 @@ import { filterOutRecentWallets } from '../utils';
15
15
  interface Props {
16
16
  itemStyle: StyleProp<ViewStyle>;
17
17
  onWalletPress: (wallet: CustomWallet) => void;
18
- isWalletConnectEnabled: boolean;
19
18
  }
20
19
 
21
- export function CustomWalletList({ itemStyle, onWalletPress, isWalletConnectEnabled }: Props) {
20
+ export function CustomWalletList({ itemStyle, onWalletPress }: Props) {
22
21
  const { installed } = useSnapshot(ApiController.state);
23
22
  const imageHeaders = ApiController._getApiHeaders();
24
23
  const { recentWallets } = useSnapshot(ConnectionController.state) as ConnectionControllerState;
25
24
  const { customWallets } = useSnapshot(OptionsController.state) as OptionsControllerState;
26
25
  const RECENT_COUNT = recentWallets?.length && installed.length ? 1 : recentWallets?.length ?? 0;
27
26
 
28
- if (!isWalletConnectEnabled || !customWallets?.length) {
27
+ if (!customWallets?.length) {
29
28
  return null;
30
29
  }
31
30
 
@@ -11,16 +11,15 @@ import type { StyleProp, ViewStyle } from 'react-native';
11
11
  interface Props {
12
12
  itemStyle: StyleProp<ViewStyle>;
13
13
  onWalletPress: (wallet: WcWallet, installed: boolean) => void;
14
- isWalletConnectEnabled: boolean;
15
14
  }
16
15
 
17
- export function RecentWalletList({ itemStyle, onWalletPress, isWalletConnectEnabled }: Props) {
16
+ export function RecentWalletList({ itemStyle, onWalletPress }: Props) {
18
17
  const installed = ApiController.state.installed;
19
18
  const { recentWallets } = useSnapshot(ConnectionController.state);
20
19
  const imageHeaders = ApiController._getApiHeaders();
21
20
  const RECENT_COUNT = recentWallets?.length && installed.length ? 1 : recentWallets?.length ?? 0;
22
21
 
23
- if (!isWalletConnectEnabled || !recentWallets?.length) {
22
+ if (!recentWallets?.length) {
24
23
  return null;
25
24
  }
26
25
 
@@ -9,6 +9,7 @@ import {
9
9
  type WcWallet
10
10
  } from '@reown/appkit-core-react-native';
11
11
  import { FlexView, Icon, ListItem, Separator, Text } from '@reown/appkit-ui-react-native';
12
+ import { ConstantsUtil } from '@reown/appkit-common-react-native';
12
13
  import { useCustomDimensions } from '../../hooks/useCustomDimensions';
13
14
  import { Placeholder } from '../../partials/w3m-placeholder';
14
15
  import { CustomWalletList } from './components/custom-wallet-list';
@@ -23,23 +24,20 @@ export function ConnectView() {
23
24
  const { features } = useSnapshot(OptionsController.state);
24
25
  const { padding } = useCustomDimensions();
25
26
 
26
- //TODO: check this with Coinbase
27
- const isWalletConnectEnabled = true;
28
- const isCoinbaseEnabled = false;
29
27
  const isSocialEnabled = features?.socials && features?.socials.length > 0;
30
- const showConnectWalletsButton =
31
- isWalletConnectEnabled && isSocialEnabled && !features?.showWallets;
32
- const showSeparator = isSocialEnabled && (isWalletConnectEnabled || isCoinbaseEnabled);
28
+ const showConnectWalletsButton = isSocialEnabled && !features?.showWallets;
33
29
  const showLoadingError = !showConnectWalletsButton && prefetchError;
34
30
  const showList = !showConnectWalletsButton && !showLoadingError;
35
31
 
36
32
  const onWalletPress = (wallet: WcWallet, isInstalled?: boolean) => {
37
- // const connector = connectors.find(c => c.explorerId === wallet.id);
38
- // if (connector) {
39
- // RouterController.push('ConnectingExternal', { connector, wallet });
40
- // } else {
41
- RouterController.push('ConnectingWalletConnect', { wallet });
42
- // }
33
+ const isExternal =
34
+ wallet.id === ConstantsUtil.PHANTOM_EXPLORER_ID ||
35
+ wallet.id === ConstantsUtil.COINBASE_EXPLORER_ID;
36
+ if (isExternal) {
37
+ RouterController.push('ConnectingExternal', { wallet });
38
+ } else {
39
+ RouterController.push('ConnectingWalletConnect', { wallet });
40
+ }
43
41
 
44
42
  const platform = EventUtil.getWalletPlatform(wallet, isInstalled);
45
43
  EventsController.sendEvent({
@@ -61,8 +59,12 @@ export function ConnectView() {
61
59
  return (
62
60
  <ScrollView style={{ paddingHorizontal: padding }} bounces={false}>
63
61
  <FlexView padding={['xs', '0', '2xl', '0']}>
64
- {isSocialEnabled && <SocialLoginList options={features?.socials} />}
65
- {showSeparator && <Separator text="or" style={styles.socialSeparator} />}
62
+ {isSocialEnabled && (
63
+ <>
64
+ <SocialLoginList options={features?.socials} />
65
+ <Separator text="or" style={styles.socialSeparator} />
66
+ </>
67
+ )}
66
68
 
67
69
  <FlexView padding={['0', 's', 'xs', 's']}>
68
70
  {showConnectWalletsButton && (
@@ -88,26 +90,10 @@ export function ConnectView() {
88
90
  )}
89
91
  {showList && (
90
92
  <>
91
- <RecentWalletList
92
- itemStyle={styles.item}
93
- onWalletPress={onWalletPress}
94
- isWalletConnectEnabled={isWalletConnectEnabled}
95
- />
96
- <AllWalletList
97
- itemStyle={styles.item}
98
- onWalletPress={onWalletPress}
99
- isWalletConnectEnabled={isWalletConnectEnabled}
100
- />
101
- <CustomWalletList
102
- itemStyle={styles.item}
103
- onWalletPress={onWalletPress}
104
- isWalletConnectEnabled={isWalletConnectEnabled}
105
- />
106
- <AllWalletsButton
107
- itemStyle={styles.item}
108
- onPress={onViewAllPress}
109
- isWalletConnectEnabled={isWalletConnectEnabled}
110
- />
93
+ <RecentWalletList itemStyle={styles.item} onWalletPress={onWalletPress} />
94
+ <AllWalletList itemStyle={styles.item} onWalletPress={onWalletPress} />
95
+ <CustomWalletList itemStyle={styles.item} onWalletPress={onWalletPress} />
96
+ <AllWalletsButton itemStyle={styles.item} onPress={onViewAllPress} />
111
97
  </>
112
98
  )}
113
99
  </FlexView>
@@ -1,11 +1,12 @@
1
+ import { useSnapshot } from 'valtio';
1
2
  import { useCallback, useEffect, useState } from 'react';
2
3
  import { ScrollView } from 'react-native';
3
4
  import {
4
5
  RouterController,
5
6
  ApiController,
6
- ModalController,
7
7
  EventsController,
8
- type WcWallet
8
+ ConnectionController,
9
+ AssetUtil
9
10
  } from '@reown/appkit-core-react-native';
10
11
  import {
11
12
  Button,
@@ -18,12 +19,13 @@ import {
18
19
  import { useCustomDimensions } from '../../hooks/useCustomDimensions';
19
20
  import { ConnectingBody, getMessage, type BodyErrorType } from '../../partials/w3m-connecting-body';
20
21
  import styles from './styles';
22
+ import { useAppKit } from '../../AppKitContext';
23
+ import { ConstantsUtil } from '@reown/appkit-common-react-native';
24
+ import { UiUtil } from '../../utils/UiUtil';
21
25
 
22
- //TODO: check if this view is needed with Coinbase
23
26
  export function ConnectingExternalView() {
24
- const { data } = RouterController.state;
25
- // const connector = data?.connector;
26
- const connector = undefined;
27
+ const { data } = useSnapshot(RouterController.state);
28
+ const { connect } = useAppKit();
27
29
  const { maxWidth: width } = useCustomDimensions();
28
30
  const [errorType, setErrorType] = useState<BodyErrorType>();
29
31
  const bodyMessage = getMessage({ walletName: data?.wallet?.name, errorType });
@@ -33,37 +35,24 @@ export function ConnectingExternalView() {
33
35
  onConnect();
34
36
  };
35
37
 
36
- const storeConnectedWallet = useCallback(
37
- // @ts-ignore
38
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
39
- async (wallet?: WcWallet) => {
40
- // if (wallet) {
41
- // const recentWallets = await StorageUtil.addRecentWallet(wallet);
42
- // if (recentWallets) {
43
- // ConnectionController.setRecentWallets(recentWallets);
44
- // }
45
- // }
46
- // if (connector) {
47
- // const url = AssetUtil.getConnectorImage(connector);
48
- // ConnectionController.setConnectedWalletImageUrl(url);
49
- // }
50
- },
51
- []
52
- );
53
-
54
38
  const onConnect = useCallback(async () => {
55
39
  try {
56
- if (connector) {
57
- // await ConnectionController.connectExternal(connector);
58
- storeConnectedWallet(data?.wallet);
59
- ModalController.close();
40
+ const wallet = RouterController.state.data?.wallet;
41
+ if (wallet) {
42
+ if (wallet.id === ConstantsUtil.PHANTOM_EXPLORER_ID) {
43
+ await connect('phantom');
44
+ } else if (wallet.id === ConstantsUtil.COINBASE_EXPLORER_ID) {
45
+ await connect('coinbase');
46
+ }
47
+ UiUtil.storeRecentWallet(wallet);
48
+ ConnectionController.setPressedWallet(wallet);
60
49
  EventsController.sendEvent({
61
50
  type: 'track',
62
51
  event: 'CONNECT_SUCCESS',
63
52
  properties: {
64
- name: data?.wallet?.name ?? 'Unknown',
53
+ name: wallet?.name ?? 'Unknown',
65
54
  method: 'mobile',
66
- explorer_id: data?.wallet?.id
55
+ explorer_id: wallet?.id
67
56
  }
68
57
  });
69
58
  }
@@ -81,7 +70,7 @@ export function ConnectingExternalView() {
81
70
  properties: { message: (error as Error)?.message ?? 'Unknown' }
82
71
  });
83
72
  }
84
- }, [connector, storeConnectedWallet, data?.wallet]);
73
+ }, [connect]);
85
74
 
86
75
  useEffect(() => {
87
76
  onConnect();
@@ -98,7 +87,7 @@ export function ConnectingExternalView() {
98
87
  <LoadingThumbnail paused={!!errorType}>
99
88
  <WalletImage
100
89
  size="xl"
101
- // imageSrc={AssetUtil.getConnectorImage(connector)}
90
+ imageSrc={AssetUtil.getWalletImage(data?.wallet)}
102
91
  imageHeaders={ApiController._getApiHeaders()}
103
92
  />
104
93
  {errorType && (
@@ -11,7 +11,6 @@ import {
11
11
  ApiController,
12
12
  EventsController
13
13
  } from '@reown/appkit-core-react-native';
14
- import { ConstantsUtil as CommonConstantsUtil } from '@reown/appkit-common-react-native';
15
14
  import { useAppKit } from '../../AppKitContext';
16
15
  import { ConnectingQrCode } from '../../partials/w3m-connecting-qrcode';
17
16
  import { ConnectingMobile } from '../../partials/w3m-connecting-mobile';
@@ -47,16 +46,9 @@ export function ConnectingView() {
47
46
  if (retry || CoreHelperUtil.isPairingExpired(wcPairingExpiry)) {
48
47
  ConnectionController.setWcError(false);
49
48
 
50
- let connectPromise: Promise<void>;
51
- if (data?.wallet?.id === 'phantom-wallet') {
52
- connectPromise = connect('phantom');
53
- } else if (data?.wallet?.id === CommonConstantsUtil.COINBASE_EXPLORER_ID) {
54
- connectPromise = connect('coinbase');
55
- } else {
56
- connectPromise = connect('walletconnect', {
57
- universalLink: routeData?.wallet?.link_mode ?? undefined
58
- });
59
- }
49
+ const connectPromise = connect('walletconnect', {
50
+ universalLink: routeData?.wallet?.link_mode ?? undefined
51
+ });
60
52
  ConnectionController.setWcPromise(connectPromise);
61
53
  }
62
54
  } catch (error) {