@reown/appkit-react-native 0.0.0-feat-multi-social-20250701185040 → 0.0.0-feat-multi-social-20250703185818
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/lib/commonjs/AppKit.js +13 -9
- package/lib/commonjs/AppKit.js.map +1 -1
- package/lib/commonjs/connectors/WalletConnectConnector.js +10 -4
- package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/commonjs/modal/w3m-router/index.js +0 -3
- package/lib/commonjs/modal/w3m-router/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-activity/index.js +4 -4
- package/lib/commonjs/partials/w3m-account-activity/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-tokens/index.js +11 -10
- package/lib/commonjs/partials/w3m-account-tokens/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-wallet-features/index.js +10 -10
- package/lib/commonjs/partials/w3m-account-wallet-features/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-header/index.js +0 -1
- package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-send-input-token/index.js +3 -3
- package/lib/commonjs/partials/w3m-send-input-token/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-send-input-token/utils.js +2 -2
- package/lib/commonjs/partials/w3m-send-input-token/utils.js.map +1 -1
- package/lib/commonjs/views/w3m-account-default-view/components/auth-buttons.js +4 -13
- package/lib/commonjs/views/w3m-account-default-view/components/auth-buttons.js.map +1 -1
- package/lib/commonjs/views/w3m-account-default-view/index.js +19 -32
- package/lib/commonjs/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-account-view/index.js +11 -22
- package/lib/commonjs/views/w3m-account-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-account-view/styles.js +0 -5
- package/lib/commonjs/views/w3m-account-view/styles.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-siwe-view/index.js +10 -8
- package/lib/commonjs/views/w3m-connecting-siwe-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-social-view/index.js +1 -1
- package/lib/commonjs/views/w3m-connecting-social-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/index.js +1 -1
- package/lib/commonjs/views/w3m-swap-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-compatible-networks-view/index.js +5 -4
- package/lib/commonjs/views/w3m-wallet-compatible-networks-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-receive-view/index.js +10 -12
- package/lib/commonjs/views/w3m-wallet-receive-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-send-preview-view/index.js +1 -1
- package/lib/commonjs/views/w3m-wallet-send-preview-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-send-select-token-view/index.js +7 -9
- package/lib/commonjs/views/w3m-wallet-send-select-token-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-send-view/index.js +5 -5
- package/lib/commonjs/views/w3m-wallet-send-view/index.js.map +1 -1
- package/lib/module/AppKit.js +13 -9
- package/lib/module/AppKit.js.map +1 -1
- package/lib/module/connectors/WalletConnectConnector.js +10 -4
- package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/module/modal/w3m-router/index.js +0 -3
- package/lib/module/modal/w3m-router/index.js.map +1 -1
- package/lib/module/partials/w3m-account-activity/index.js +5 -5
- package/lib/module/partials/w3m-account-activity/index.js.map +1 -1
- package/lib/module/partials/w3m-account-tokens/index.js +12 -11
- package/lib/module/partials/w3m-account-tokens/index.js.map +1 -1
- package/lib/module/partials/w3m-account-wallet-features/index.js +11 -11
- package/lib/module/partials/w3m-account-wallet-features/index.js.map +1 -1
- package/lib/module/partials/w3m-header/index.js +0 -1
- package/lib/module/partials/w3m-header/index.js.map +1 -1
- package/lib/module/partials/w3m-send-input-token/index.js +3 -3
- package/lib/module/partials/w3m-send-input-token/index.js.map +1 -1
- package/lib/module/partials/w3m-send-input-token/utils.js +2 -2
- package/lib/module/partials/w3m-send-input-token/utils.js.map +1 -1
- package/lib/module/views/w3m-account-default-view/components/auth-buttons.js +5 -14
- package/lib/module/views/w3m-account-default-view/components/auth-buttons.js.map +1 -1
- package/lib/module/views/w3m-account-default-view/index.js +20 -33
- package/lib/module/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/module/views/w3m-account-view/index.js +13 -24
- package/lib/module/views/w3m-account-view/index.js.map +1 -1
- package/lib/module/views/w3m-account-view/styles.js +0 -5
- package/lib/module/views/w3m-account-view/styles.js.map +1 -1
- package/lib/module/views/w3m-connecting-siwe-view/index.js +11 -9
- package/lib/module/views/w3m-connecting-siwe-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-social-view/index.js +1 -1
- package/lib/module/views/w3m-connecting-social-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-view/index.js +2 -2
- package/lib/module/views/w3m-swap-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-compatible-networks-view/index.js +6 -5
- package/lib/module/views/w3m-wallet-compatible-networks-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-receive-view/index.js +11 -13
- package/lib/module/views/w3m-wallet-receive-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-send-preview-view/index.js +1 -1
- package/lib/module/views/w3m-wallet-send-preview-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-send-select-token-view/index.js +8 -10
- package/lib/module/views/w3m-wallet-send-select-token-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-send-view/index.js +6 -6
- package/lib/module/views/w3m-wallet-send-view/index.js.map +1 -1
- package/lib/typescript/AppKit.d.ts.map +1 -1
- package/lib/typescript/connectors/WalletConnectConnector.d.ts +0 -1
- package/lib/typescript/connectors/WalletConnectConnector.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-router/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-account-activity/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-account-tokens/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-account-wallet-features/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-header/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-account-default-view/components/auth-buttons.d.ts.map +1 -1
- package/lib/typescript/views/w3m-account-default-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-account-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-account-view/styles.d.ts +0 -5
- package/lib/typescript/views/w3m-account-view/styles.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connecting-siwe-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-wallet-compatible-networks-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-wallet-receive-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-wallet-send-select-token-view/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/AppKit.ts +15 -8
- package/src/connectors/WalletConnectConnector.ts +15 -5
- package/src/modal/w3m-router/index.tsx +0 -3
- package/src/partials/w3m-account-activity/index.tsx +4 -5
- package/src/partials/w3m-account-tokens/index.tsx +10 -9
- package/src/partials/w3m-account-wallet-features/index.tsx +7 -15
- package/src/partials/w3m-header/index.tsx +0 -1
- package/src/partials/w3m-send-input-token/index.tsx +4 -4
- package/src/partials/w3m-send-input-token/utils.ts +2 -2
- package/src/views/w3m-account-default-view/components/auth-buttons.tsx +4 -15
- package/src/views/w3m-account-default-view/index.tsx +23 -36
- package/src/views/w3m-account-view/index.tsx +9 -26
- package/src/views/w3m-account-view/styles.ts +0 -5
- package/src/views/w3m-connecting-siwe-view/index.tsx +6 -17
- package/src/views/w3m-connecting-social-view/index.tsx +1 -1
- package/src/views/w3m-swap-view/index.tsx +1 -2
- package/src/views/w3m-wallet-compatible-networks-view/index.tsx +9 -11
- package/src/views/w3m-wallet-receive-view/index.tsx +16 -10
- package/src/views/w3m-wallet-send-preview-view/index.tsx +1 -1
- package/src/views/w3m-wallet-send-select-token-view/index.tsx +7 -9
- package/src/views/w3m-wallet-send-view/index.tsx +5 -5
- package/lib/commonjs/views/w3m-upgrade-to-smart-account-view/index.js +0 -103
- package/lib/commonjs/views/w3m-upgrade-to-smart-account-view/index.js.map +0 -1
- package/lib/commonjs/views/w3m-upgrade-to-smart-account-view/styles.js +0 -35
- package/lib/commonjs/views/w3m-upgrade-to-smart-account-view/styles.js.map +0 -1
- package/lib/module/views/w3m-upgrade-to-smart-account-view/index.js +0 -96
- package/lib/module/views/w3m-upgrade-to-smart-account-view/index.js.map +0 -1
- package/lib/module/views/w3m-upgrade-to-smart-account-view/styles.js +0 -29
- package/lib/module/views/w3m-upgrade-to-smart-account-view/styles.js.map +0 -1
- package/lib/typescript/views/w3m-upgrade-to-smart-account-view/index.d.ts +0 -2
- package/lib/typescript/views/w3m-upgrade-to-smart-account-view/index.d.ts.map +0 -1
- package/lib/typescript/views/w3m-upgrade-to-smart-account-view/styles.d.ts +0 -28
- package/lib/typescript/views/w3m-upgrade-to-smart-account-view/styles.d.ts.map +0 -1
- package/src/views/w3m-upgrade-to-smart-account-view/index.tsx +0 -106
- package/src/views/w3m-upgrade-to-smart-account-view/styles.ts +0 -29
|
@@ -7,16 +7,14 @@ import {
|
|
|
7
7
|
Icon,
|
|
8
8
|
IconLink,
|
|
9
9
|
NetworkButton,
|
|
10
|
-
useTheme
|
|
11
|
-
Promo
|
|
10
|
+
useTheme
|
|
12
11
|
} from '@reown/appkit-ui-react-native';
|
|
13
12
|
import {
|
|
14
|
-
AccountController,
|
|
15
13
|
ApiController,
|
|
16
14
|
AssetUtil,
|
|
17
15
|
ConnectionsController,
|
|
16
|
+
CoreHelperUtil,
|
|
18
17
|
ModalController,
|
|
19
|
-
NetworkController,
|
|
20
18
|
RouterController,
|
|
21
19
|
SendController
|
|
22
20
|
} from '@reown/appkit-core-react-native';
|
|
@@ -28,12 +26,8 @@ import styles from './styles';
|
|
|
28
26
|
export function AccountView() {
|
|
29
27
|
const Theme = useTheme();
|
|
30
28
|
const { padding } = useCustomDimensions();
|
|
31
|
-
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
32
|
-
const
|
|
33
|
-
AccountController.state
|
|
34
|
-
);
|
|
35
|
-
const showActivate =
|
|
36
|
-
preferredAccountType === 'eoa' && NetworkController.checkIfSmartAccountEnabled();
|
|
29
|
+
const { activeNetwork, activeAddress } = useSnapshot(ConnectionsController.state);
|
|
30
|
+
const address = CoreHelperUtil.getPlainAddress(activeAddress);
|
|
37
31
|
|
|
38
32
|
const onProfilePress = () => {
|
|
39
33
|
RouterController.push('AccountDefault');
|
|
@@ -43,20 +37,16 @@ export function AccountView() {
|
|
|
43
37
|
RouterController.push('Networks');
|
|
44
38
|
};
|
|
45
39
|
|
|
46
|
-
const onActivatePress = () => {
|
|
47
|
-
RouterController.push('UpgradeToSmartAccount');
|
|
48
|
-
};
|
|
49
|
-
|
|
50
40
|
useEffect(() => {
|
|
51
|
-
|
|
41
|
+
ConnectionsController.fetchBalance();
|
|
52
42
|
SendController.resetSend();
|
|
53
43
|
}, []);
|
|
54
44
|
|
|
55
45
|
useEffect(() => {
|
|
56
|
-
|
|
46
|
+
ConnectionsController.fetchBalance();
|
|
57
47
|
|
|
58
48
|
const balanceInterval = setInterval(() => {
|
|
59
|
-
|
|
49
|
+
ConnectionsController.fetchBalance();
|
|
60
50
|
}, 10000);
|
|
61
51
|
|
|
62
52
|
return () => {
|
|
@@ -85,17 +75,10 @@ export function AccountView() {
|
|
|
85
75
|
</NetworkButton>
|
|
86
76
|
<IconLink icon="close" style={styles.closeIcon} onPress={ModalController.close} />
|
|
87
77
|
<FlexView padding={['3xl', '0', '0', '0']} style={[{ backgroundColor: Theme['bg-100'] }]}>
|
|
88
|
-
{showActivate && (
|
|
89
|
-
<Promo
|
|
90
|
-
style={styles.promoPill}
|
|
91
|
-
text="Switch to your smart account"
|
|
92
|
-
onPress={onActivatePress}
|
|
93
|
-
/>
|
|
94
|
-
)}
|
|
95
78
|
<AccountPill
|
|
96
79
|
address={address}
|
|
97
|
-
profileName={profileName}
|
|
98
|
-
profileImage={profileImage}
|
|
80
|
+
// profileName={profileName}
|
|
81
|
+
// profileImage={profileImage}
|
|
99
82
|
onPress={onProfilePress}
|
|
100
83
|
style={styles.accountPill}
|
|
101
84
|
/>
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
Text
|
|
9
9
|
} from '@reown/appkit-ui-react-native';
|
|
10
10
|
import {
|
|
11
|
-
AccountController,
|
|
12
11
|
AssetUtil,
|
|
13
12
|
ConnectionController,
|
|
14
13
|
ConnectionsController,
|
|
@@ -35,16 +34,15 @@ export function ConnectingSiweView() {
|
|
|
35
34
|
const dappName = metadata?.name || 'Dapp';
|
|
36
35
|
const dappIcon = metadata?.icons[0] || '';
|
|
37
36
|
const walletIcon = AssetUtil.getWalletImage(pressedWallet) || connectedWalletImageUrl;
|
|
37
|
+
const isSmartAccount = ConnectionsController.state.accountType === 'smartAccount';
|
|
38
|
+
const network = ConnectionsController.state.activeNetwork?.caipNetworkId || '';
|
|
38
39
|
|
|
39
40
|
const onSign = async () => {
|
|
40
41
|
setIsSigning(true);
|
|
41
42
|
EventsController.sendEvent({
|
|
42
43
|
event: 'CLICK_SIGN_SIWE_MESSAGE',
|
|
43
44
|
type: 'track',
|
|
44
|
-
properties: {
|
|
45
|
-
network: ConnectionsController.state.activeNetwork?.caipNetworkId || '',
|
|
46
|
-
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount'
|
|
47
|
-
}
|
|
45
|
+
properties: { network, isSmartAccount }
|
|
48
46
|
});
|
|
49
47
|
try {
|
|
50
48
|
const session = await SIWEController.signIn();
|
|
@@ -52,10 +50,7 @@ export function ConnectingSiweView() {
|
|
|
52
50
|
EventsController.sendEvent({
|
|
53
51
|
event: 'SIWE_AUTH_SUCCESS',
|
|
54
52
|
type: 'track',
|
|
55
|
-
properties: {
|
|
56
|
-
network: ConnectionsController.state.activeNetwork?.caipNetworkId || '',
|
|
57
|
-
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount'
|
|
58
|
-
}
|
|
53
|
+
properties: { network, isSmartAccount }
|
|
59
54
|
});
|
|
60
55
|
|
|
61
56
|
return session;
|
|
@@ -67,10 +62,7 @@ export function ConnectingSiweView() {
|
|
|
67
62
|
return EventsController.sendEvent({
|
|
68
63
|
event: 'SIWE_AUTH_ERROR',
|
|
69
64
|
type: 'track',
|
|
70
|
-
properties: {
|
|
71
|
-
network: ConnectionsController.state.activeNetwork?.caipNetworkId || '',
|
|
72
|
-
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount'
|
|
73
|
-
}
|
|
65
|
+
properties: { network, isSmartAccount }
|
|
74
66
|
});
|
|
75
67
|
} finally {
|
|
76
68
|
setIsSigning(false);
|
|
@@ -89,10 +81,7 @@ export function ConnectingSiweView() {
|
|
|
89
81
|
EventsController.sendEvent({
|
|
90
82
|
event: 'CLICK_CANCEL_SIWE',
|
|
91
83
|
type: 'track',
|
|
92
|
-
properties: {
|
|
93
|
-
network: ConnectionsController.state.activeNetwork?.caipNetworkId || '',
|
|
94
|
-
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount'
|
|
95
|
-
}
|
|
84
|
+
properties: { network, isSmartAccount }
|
|
96
85
|
});
|
|
97
86
|
};
|
|
98
87
|
|
|
@@ -11,9 +11,9 @@ import { FlexView, LoadingThumbnail, IconBox, Logo, Text } from '@reown/appkit-u
|
|
|
11
11
|
import { ConstantsUtil, StringUtil } from '@reown/appkit-common-react-native';
|
|
12
12
|
|
|
13
13
|
import { useCustomDimensions } from '../../hooks/useCustomDimensions';
|
|
14
|
-
import styles from './styles';
|
|
15
14
|
import { useAppKit } from '../../AppKitContext';
|
|
16
15
|
import { UiUtil } from '../../utils/UiUtil';
|
|
16
|
+
import styles from './styles';
|
|
17
17
|
|
|
18
18
|
export function ConnectingSocialView() {
|
|
19
19
|
const { maxWidth: width } = useCustomDimensions();
|
|
@@ -2,7 +2,6 @@ import { useSnapshot } from 'valtio';
|
|
|
2
2
|
import { useCallback, useEffect } from 'react';
|
|
3
3
|
import { Platform, ScrollView } from 'react-native';
|
|
4
4
|
import {
|
|
5
|
-
AccountController,
|
|
6
5
|
ConnectionsController,
|
|
7
6
|
ConstantsUtil,
|
|
8
7
|
EventsController,
|
|
@@ -97,7 +96,7 @@ export function SwapView() {
|
|
|
97
96
|
swapToToken: SwapController.state.toToken?.symbol || '',
|
|
98
97
|
swapFromAmount: SwapController.state.sourceTokenAmount || '',
|
|
99
98
|
swapToAmount: SwapController.state.toTokenAmount || '',
|
|
100
|
-
isSmartAccount:
|
|
99
|
+
isSmartAccount: ConnectionsController.state.accountType === 'smartAccount'
|
|
101
100
|
}
|
|
102
101
|
});
|
|
103
102
|
RouterController.push('SwapPreview');
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import { ScrollView } from 'react-native';
|
|
2
2
|
import { useSnapshot } from 'valtio';
|
|
3
3
|
import { FlexView, Text, Banner, NetworkImage } from '@reown/appkit-ui-react-native';
|
|
4
|
-
import {
|
|
5
|
-
AccountController,
|
|
6
|
-
ApiController,
|
|
7
|
-
AssetUtil,
|
|
8
|
-
NetworkController
|
|
9
|
-
} from '@reown/appkit-core-react-native';
|
|
4
|
+
import { ApiController, AssetUtil, ConnectionsController } from '@reown/appkit-core-react-native';
|
|
10
5
|
import { useCustomDimensions } from '../../hooks/useCustomDimensions';
|
|
11
6
|
import styles from './styles';
|
|
12
7
|
|
|
13
8
|
export function WalletCompatibleNetworks() {
|
|
14
9
|
const { padding } = useCustomDimensions();
|
|
15
|
-
const {
|
|
16
|
-
const isSmartAccount =
|
|
17
|
-
|
|
10
|
+
const { networks, accountType } = useSnapshot(ConnectionsController.state);
|
|
11
|
+
const isSmartAccount = accountType === 'smartAccount';
|
|
12
|
+
|
|
18
13
|
const approvedNetworks = isSmartAccount
|
|
19
|
-
?
|
|
20
|
-
:
|
|
14
|
+
? ConnectionsController.getSmartAccountEnabledNetworks()
|
|
15
|
+
: networks.filter(
|
|
16
|
+
network => network?.chainNamespace === ConnectionsController.state.activeNamespace
|
|
17
|
+
);
|
|
18
|
+
|
|
21
19
|
const imageHeaders = ApiController._getApiHeaders();
|
|
22
20
|
|
|
23
21
|
return (
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
ApiController,
|
|
15
15
|
AssetUtil,
|
|
16
16
|
ConnectionsController,
|
|
17
|
+
CoreHelperUtil,
|
|
17
18
|
OptionsController,
|
|
18
19
|
RouterController,
|
|
19
20
|
SnackController
|
|
@@ -21,18 +22,23 @@ import {
|
|
|
21
22
|
import { useCustomDimensions } from '../../hooks/useCustomDimensions';
|
|
22
23
|
|
|
23
24
|
export function WalletReceiveView() {
|
|
24
|
-
const {
|
|
25
|
-
const { activeNetwork, networks } = useSnapshot(
|
|
25
|
+
const { profileName } = useSnapshot(AccountController.state);
|
|
26
|
+
const { activeNetwork, networks, activeAddress, accountType } = useSnapshot(
|
|
27
|
+
ConnectionsController.state
|
|
28
|
+
);
|
|
29
|
+
const address = CoreHelperUtil.getPlainAddress(activeAddress);
|
|
26
30
|
const networkImage = AssetUtil.getNetworkImage(activeNetwork?.id);
|
|
27
31
|
const { padding } = useCustomDimensions();
|
|
28
32
|
const canCopy = OptionsController.isClipboardAvailable();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
const isSmartAccount = accountType === 'smartAccount';
|
|
34
|
+
|
|
35
|
+
const approvedNetworks = isSmartAccount
|
|
36
|
+
? ConnectionsController.getSmartAccountEnabledNetworks()
|
|
37
|
+
: networks.filter(
|
|
38
|
+
network => network?.chainNamespace === ConnectionsController.state.activeNamespace
|
|
39
|
+
);
|
|
34
40
|
|
|
35
|
-
const imagesArray =
|
|
41
|
+
const imagesArray = approvedNetworks
|
|
36
42
|
.filter(network => network?.id)
|
|
37
43
|
.slice(0, 5)
|
|
38
44
|
.map(network => AssetUtil.getNetworkImage(network?.id))
|
|
@@ -50,8 +56,8 @@ export function WalletReceiveView() {
|
|
|
50
56
|
};
|
|
51
57
|
|
|
52
58
|
const onCopyAddress = () => {
|
|
53
|
-
if (canCopy &&
|
|
54
|
-
OptionsController.copyToClipboard(
|
|
59
|
+
if (canCopy && address) {
|
|
60
|
+
OptionsController.copyToClipboard(address);
|
|
55
61
|
SnackController.showSuccess('Address copied');
|
|
56
62
|
}
|
|
57
63
|
};
|
|
@@ -25,7 +25,7 @@ export function WalletSendPreviewView() {
|
|
|
25
25
|
} = useSnapshot(SendController.state);
|
|
26
26
|
|
|
27
27
|
const getSendValue = () => {
|
|
28
|
-
if (SendController.state.token && SendController.state.sendTokenAmount) {
|
|
28
|
+
if (SendController.state.token?.price && SendController.state.sendTokenAmount) {
|
|
29
29
|
const price = SendController.state.token.price;
|
|
30
30
|
const totalValue = price * SendController.state.sendTokenAmount;
|
|
31
31
|
|
|
@@ -3,7 +3,6 @@ import { useSnapshot } from 'valtio';
|
|
|
3
3
|
import { ScrollView } from 'react-native';
|
|
4
4
|
import { FlexView, InputText, ListToken, Text } from '@reown/appkit-ui-react-native';
|
|
5
5
|
import {
|
|
6
|
-
AccountController,
|
|
7
6
|
AssetUtil,
|
|
8
7
|
ConnectionsController,
|
|
9
8
|
RouterController,
|
|
@@ -17,17 +16,16 @@ import styles from './styles';
|
|
|
17
16
|
|
|
18
17
|
export function WalletSendSelectTokenView() {
|
|
19
18
|
const { padding } = useCustomDimensions();
|
|
20
|
-
const {
|
|
21
|
-
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
19
|
+
const { activeNetwork, balances } = useSnapshot(ConnectionsController.state);
|
|
22
20
|
const { token } = useSnapshot(SendController.state);
|
|
23
21
|
const networkImage = AssetUtil.getNetworkImage(activeNetwork?.id);
|
|
24
22
|
const [tokenSearch, setTokenSearch] = useState<string>('');
|
|
25
|
-
const [filteredTokens, setFilteredTokens] = useState(
|
|
23
|
+
const [filteredTokens, setFilteredTokens] = useState(balances ?? []);
|
|
26
24
|
|
|
27
25
|
const onSearchChange = (value: string) => {
|
|
28
26
|
setTokenSearch(value);
|
|
29
|
-
const filtered =
|
|
30
|
-
_token.name
|
|
27
|
+
const filtered = ConnectionsController.state.balances?.filter(
|
|
28
|
+
_token => _token.name?.toLowerCase().includes(value.toLowerCase())
|
|
31
29
|
);
|
|
32
30
|
setFilteredTokens(filtered ?? []);
|
|
33
31
|
};
|
|
@@ -60,14 +58,14 @@ export function WalletSendSelectTokenView() {
|
|
|
60
58
|
filteredTokens.map((_token, index) => (
|
|
61
59
|
<ListToken
|
|
62
60
|
key={`${_token.name}${index}`}
|
|
63
|
-
name={_token.name}
|
|
61
|
+
name={_token.name || ''}
|
|
64
62
|
imageSrc={_token.iconUrl}
|
|
65
63
|
networkSrc={networkImage}
|
|
66
64
|
value={_token.value}
|
|
67
|
-
amount={_token.quantity
|
|
65
|
+
amount={_token.quantity?.numeric || '0'}
|
|
68
66
|
currency={_token.symbol}
|
|
69
67
|
onPress={() => onTokenPress(_token)}
|
|
70
|
-
disabled={_token.
|
|
68
|
+
disabled={_token.contractAddress === token?.contractAddress}
|
|
71
69
|
/>
|
|
72
70
|
))
|
|
73
71
|
) : (
|
|
@@ -2,7 +2,7 @@ import { useCallback, useEffect } from 'react';
|
|
|
2
2
|
import { Platform, ScrollView } from 'react-native';
|
|
3
3
|
import { useSnapshot } from 'valtio';
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
ConnectionsController,
|
|
6
6
|
CoreHelperUtil,
|
|
7
7
|
RouterController,
|
|
8
8
|
SendController,
|
|
@@ -20,7 +20,7 @@ export function WalletSendView() {
|
|
|
20
20
|
const { keyboardShown, keyboardHeight } = useKeyboard();
|
|
21
21
|
const { token, sendTokenAmount, receiverAddress, receiverProfileName, loading, gasPrice } =
|
|
22
22
|
useSnapshot(SendController.state);
|
|
23
|
-
const {
|
|
23
|
+
const { balances } = useSnapshot(ConnectionsController.state);
|
|
24
24
|
|
|
25
25
|
const paddingBottom = Platform.select({
|
|
26
26
|
android: keyboardShown ? keyboardHeight + Spacing['2xl'] : Spacing['2xl'],
|
|
@@ -47,7 +47,7 @@ export function WalletSendView() {
|
|
|
47
47
|
|
|
48
48
|
if (
|
|
49
49
|
SendController.state.sendTokenAmount &&
|
|
50
|
-
SendController.state.token &&
|
|
50
|
+
SendController.state.token?.quantity &&
|
|
51
51
|
SendController.state.sendTokenAmount > Number(SendController.state.token.quantity.numeric)
|
|
52
52
|
) {
|
|
53
53
|
return 'Insufficient funds';
|
|
@@ -80,10 +80,10 @@ export function WalletSendView() {
|
|
|
80
80
|
|
|
81
81
|
useEffect(() => {
|
|
82
82
|
if (!token) {
|
|
83
|
-
SendController.setToken(
|
|
83
|
+
SendController.setToken(balances?.[0]);
|
|
84
84
|
}
|
|
85
85
|
fetchNetworkPrice();
|
|
86
|
-
}, [token,
|
|
86
|
+
}, [token, balances, fetchNetworkPrice]);
|
|
87
87
|
|
|
88
88
|
const actionText = getActionText();
|
|
89
89
|
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.UpgradeToSmartAccountView = UpgradeToSmartAccountView;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _valtio = require("valtio");
|
|
10
|
-
var _appkitUiReactNative = require("@reown/appkit-ui-react-native");
|
|
11
|
-
var _appkitCoreReactNative = require("@reown/appkit-core-react-native");
|
|
12
|
-
var _styles = _interopRequireDefault(require("./styles"));
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
function UpgradeToSmartAccountView() {
|
|
15
|
-
const {
|
|
16
|
-
address
|
|
17
|
-
} = (0, _valtio.useSnapshot)(_appkitCoreReactNative.AccountController.state);
|
|
18
|
-
const {
|
|
19
|
-
loading
|
|
20
|
-
} = (0, _valtio.useSnapshot)(_appkitCoreReactNative.ModalController.state);
|
|
21
|
-
const [initialAddress] = (0, _react.useState)(address);
|
|
22
|
-
const onSwitchAccountType = async () => {
|
|
23
|
-
try {
|
|
24
|
-
_appkitCoreReactNative.ModalController.setLoading(true);
|
|
25
|
-
const accountType = _appkitCoreReactNative.AccountController.state.preferredAccountType === 'eoa' ? 'smartAccount' : 'eoa';
|
|
26
|
-
const provider = _appkitCoreReactNative.ConnectorController.getAuthConnector()?.provider;
|
|
27
|
-
await provider?.setPreferredAccount(accountType);
|
|
28
|
-
_appkitCoreReactNative.EventsController.sendEvent({
|
|
29
|
-
type: 'track',
|
|
30
|
-
event: 'SET_PREFERRED_ACCOUNT_TYPE',
|
|
31
|
-
properties: {
|
|
32
|
-
accountType,
|
|
33
|
-
network: _appkitCoreReactNative.NetworkController.state.caipNetwork?.id || ''
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
} catch (error) {
|
|
37
|
-
_appkitCoreReactNative.ModalController.setLoading(false);
|
|
38
|
-
_appkitCoreReactNative.SnackController.showError('Error switching account type');
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const onClose = () => {
|
|
42
|
-
_appkitCoreReactNative.ModalController.close();
|
|
43
|
-
_appkitCoreReactNative.ModalController.setLoading(false);
|
|
44
|
-
};
|
|
45
|
-
const onGoBack = () => {
|
|
46
|
-
_appkitCoreReactNative.RouterController.goBack();
|
|
47
|
-
_appkitCoreReactNative.ModalController.setLoading(false);
|
|
48
|
-
};
|
|
49
|
-
const onLearnMorePress = () => {
|
|
50
|
-
_reactNative.Linking.openURL('https://reown.com/faq');
|
|
51
|
-
};
|
|
52
|
-
(0, _react.useEffect)(() => {
|
|
53
|
-
// Go back if the address has changed
|
|
54
|
-
if (address && initialAddress !== address) {
|
|
55
|
-
_appkitCoreReactNative.RouterController.goBack();
|
|
56
|
-
}
|
|
57
|
-
}, [initialAddress, address]);
|
|
58
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_appkitUiReactNative.IconLink, {
|
|
59
|
-
icon: "close",
|
|
60
|
-
size: "md",
|
|
61
|
-
onPress: onClose,
|
|
62
|
-
testID: "header-close",
|
|
63
|
-
style: _styles.default.closeButton
|
|
64
|
-
}), /*#__PURE__*/React.createElement(_appkitUiReactNative.FlexView, {
|
|
65
|
-
style: _styles.default.container,
|
|
66
|
-
padding: ['4xl', 'm', '2xl', 'm']
|
|
67
|
-
}, /*#__PURE__*/React.createElement(_appkitUiReactNative.FlexView, {
|
|
68
|
-
alignItems: "center",
|
|
69
|
-
justifyContent: "center",
|
|
70
|
-
flexDirection: "row"
|
|
71
|
-
}, /*#__PURE__*/React.createElement(_appkitUiReactNative.Visual, {
|
|
72
|
-
name: "google"
|
|
73
|
-
}), /*#__PURE__*/React.createElement(_appkitUiReactNative.Visual, {
|
|
74
|
-
style: _styles.default.middleIcon,
|
|
75
|
-
name: "pencil"
|
|
76
|
-
}), /*#__PURE__*/React.createElement(_appkitUiReactNative.Visual, {
|
|
77
|
-
name: "lightbulb"
|
|
78
|
-
})), /*#__PURE__*/React.createElement(_appkitUiReactNative.Text, {
|
|
79
|
-
variant: "medium-600",
|
|
80
|
-
color: "fg-100",
|
|
81
|
-
style: _styles.default.title
|
|
82
|
-
}, "Discover Smart Accounts"), /*#__PURE__*/React.createElement(_appkitUiReactNative.Text, {
|
|
83
|
-
variant: "paragraph-400",
|
|
84
|
-
color: "fg-100",
|
|
85
|
-
center: true
|
|
86
|
-
}, "Access advanced brand new features as username, improved security and a smoother user experience!"), /*#__PURE__*/React.createElement(_appkitUiReactNative.FlexView, {
|
|
87
|
-
flexDirection: "row",
|
|
88
|
-
margin: ['m', '4xl', 'm', '4xl']
|
|
89
|
-
}, /*#__PURE__*/React.createElement(_appkitUiReactNative.Button, {
|
|
90
|
-
variant: "accent",
|
|
91
|
-
onPress: onGoBack,
|
|
92
|
-
disabled: loading,
|
|
93
|
-
style: [_styles.default.button, _styles.default.cancelButton]
|
|
94
|
-
}, "Do it later"), /*#__PURE__*/React.createElement(_appkitUiReactNative.Button, {
|
|
95
|
-
onPress: onSwitchAccountType,
|
|
96
|
-
loading: loading,
|
|
97
|
-
style: _styles.default.button
|
|
98
|
-
}, "Continue")), /*#__PURE__*/React.createElement(_appkitUiReactNative.Link, {
|
|
99
|
-
onPress: onLearnMorePress,
|
|
100
|
-
iconRight: "externalLink"
|
|
101
|
-
}, "Learn more")));
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_react","_valtio","_appkitUiReactNative","_appkitCoreReactNative","_styles","_interopRequireDefault","e","__esModule","default","UpgradeToSmartAccountView","address","useSnapshot","AccountController","state","loading","ModalController","initialAddress","useState","onSwitchAccountType","setLoading","accountType","preferredAccountType","provider","ConnectorController","getAuthConnector","setPreferredAccount","EventsController","sendEvent","type","event","properties","network","NetworkController","caipNetwork","id","error","SnackController","showError","onClose","close","onGoBack","RouterController","goBack","onLearnMorePress","Linking","openURL","useEffect","React","createElement","Fragment","IconLink","icon","size","onPress","testID","style","styles","closeButton","FlexView","container","padding","alignItems","justifyContent","flexDirection","Visual","name","middleIcon","Text","variant","color","title","center","margin","Button","disabled","button","cancelButton","Link","iconRight"],"sourceRoot":"../../../../src","sources":["views/w3m-upgrade-to-smart-account-view/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAJ,OAAA;AAUA,IAAAK,OAAA,GAAAC,sBAAA,CAAAN,OAAA;AAA8B,SAAAM,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEvB,SAASG,yBAAyBA,CAAA,EAAG;EAC1C,MAAM;IAAEC;EAAQ,CAAC,GAAG,IAA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;IAACd,KAAK,EAAEC,eAAM,CAACc;EAAM,GAAC,yBAEzD,CAAC,eACPvB,KAAA,CAAAC,aAAA,CAAC9C,oBAAA,CAAAiE,IAAI;IAACC,OAAO,EAAC,eAAe;IAACC,KAAK,EAAC,QAAQ;IAACE,MAAM;EAAA,GAAC,mGAG9C,CAAC,eACPxB,KAAA,CAAAC,aAAA,CAAC9C,oBAAA,CAAAwD,QAAQ;IAACK,aAAa,EAAC,KAAK;IAACS,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK;EAAE,gBAC7DzB,KAAA,CAAAC,aAAA,CAAC9C,oBAAA,CAAAuE,MAAM;IACLL,OAAO,EAAC,QAAQ;IAChBf,OAAO,EAAEb,QAAS;IAClBkC,QAAQ,EAAE5D,OAAQ;IAClByC,KAAK,EAAE,CAACC,eAAM,CAACmB,MAAM,EAAEnB,eAAM,CAACoB,YAAY;EAAE,GAC7C,aAEO,CAAC,eACT7B,KAAA,CAAAC,aAAA,CAAC9C,oBAAA,CAAAuE,MAAM;IAACpB,OAAO,EAAEnC,mBAAoB;IAACJ,OAAO,EAAEA,OAAQ;IAACyC,KAAK,EAAEC,eAAM,CAACmB;EAAO,GAAC,UAEtE,CACA,CAAC,eACX5B,KAAA,CAAAC,aAAA,CAAC9C,oBAAA,CAAA2E,IAAI;IAACxB,OAAO,EAAEV,gBAAiB;IAACmC,SAAS,EAAC;EAAc,GAAC,YAEpD,CACE,CACV,CAAC;AAEP"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _appkitUiReactNative = require("@reown/appkit-ui-react-native");
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _default = exports.default = _reactNative.StyleSheet.create({
|
|
10
|
-
container: {
|
|
11
|
-
justifyContent: 'center',
|
|
12
|
-
alignItems: 'center'
|
|
13
|
-
},
|
|
14
|
-
title: {
|
|
15
|
-
marginTop: _appkitUiReactNative.Spacing.xl,
|
|
16
|
-
marginVertical: _appkitUiReactNative.Spacing.s
|
|
17
|
-
},
|
|
18
|
-
button: {
|
|
19
|
-
width: 110
|
|
20
|
-
},
|
|
21
|
-
cancelButton: {
|
|
22
|
-
marginRight: _appkitUiReactNative.Spacing.m
|
|
23
|
-
},
|
|
24
|
-
middleIcon: {
|
|
25
|
-
marginHorizontal: _appkitUiReactNative.Spacing.s
|
|
26
|
-
},
|
|
27
|
-
closeButton: {
|
|
28
|
-
alignSelf: 'flex-end',
|
|
29
|
-
right: _appkitUiReactNative.Spacing.xl,
|
|
30
|
-
top: _appkitUiReactNative.Spacing.l,
|
|
31
|
-
position: 'absolute',
|
|
32
|
-
zIndex: 2
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_appkitUiReactNative","require","_reactNative","_default","exports","default","StyleSheet","create","container","justifyContent","alignItems","title","marginTop","Spacing","xl","marginVertical","s","button","width","cancelButton","marginRight","m","middleIcon","marginHorizontal","closeButton","alignSelf","right","top","l","position","zIndex"],"sourceRoot":"../../../../src","sources":["views/w3m-upgrade-to-smart-account-view/styles.ts"],"mappings":";;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAA0C,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE3BC,uBAAU,CAACC,MAAM,CAAC;EAC/BC,SAAS,EAAE;IACTC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDC,KAAK,EAAE;IACLC,SAAS,EAAEC,4BAAO,CAACC,EAAE;IACrBC,cAAc,EAAEF,4BAAO,CAACG;EAC1B,CAAC;EACDC,MAAM,EAAE;IACNC,KAAK,EAAE;EACT,CAAC;EACDC,YAAY,EAAE;IACZC,WAAW,EAAEP,4BAAO,CAACQ;EACvB,CAAC;EACDC,UAAU,EAAE;IACVC,gBAAgB,EAAEV,4BAAO,CAACG;EAC5B,CAAC;EACDQ,WAAW,EAAE;IACXC,SAAS,EAAE,UAAU;IACrBC,KAAK,EAAEb,4BAAO,CAACC,EAAE;IACjBa,GAAG,EAAEd,4BAAO,CAACe,CAAC;IACdC,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE;EACV;AACF,CAAC,CAAC"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { Linking } from 'react-native';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { useSnapshot } from 'valtio';
|
|
4
|
-
import { Button, FlexView, IconLink, Link, Text, Visual } from '@reown/appkit-ui-react-native';
|
|
5
|
-
import { AccountController, ConnectorController, EventsController, ModalController, NetworkController, RouterController, SnackController } from '@reown/appkit-core-react-native';
|
|
6
|
-
import styles from './styles';
|
|
7
|
-
export function UpgradeToSmartAccountView() {
|
|
8
|
-
const {
|
|
9
|
-
address
|
|
10
|
-
} = useSnapshot(AccountController.state);
|
|
11
|
-
const {
|
|
12
|
-
loading
|
|
13
|
-
} = useSnapshot(ModalController.state);
|
|
14
|
-
const [initialAddress] = useState(address);
|
|
15
|
-
const onSwitchAccountType = async () => {
|
|
16
|
-
try {
|
|
17
|
-
ModalController.setLoading(true);
|
|
18
|
-
const accountType = AccountController.state.preferredAccountType === 'eoa' ? 'smartAccount' : 'eoa';
|
|
19
|
-
const provider = ConnectorController.getAuthConnector()?.provider;
|
|
20
|
-
await provider?.setPreferredAccount(accountType);
|
|
21
|
-
EventsController.sendEvent({
|
|
22
|
-
type: 'track',
|
|
23
|
-
event: 'SET_PREFERRED_ACCOUNT_TYPE',
|
|
24
|
-
properties: {
|
|
25
|
-
accountType,
|
|
26
|
-
network: NetworkController.state.caipNetwork?.id || ''
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
} catch (error) {
|
|
30
|
-
ModalController.setLoading(false);
|
|
31
|
-
SnackController.showError('Error switching account type');
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const onClose = () => {
|
|
35
|
-
ModalController.close();
|
|
36
|
-
ModalController.setLoading(false);
|
|
37
|
-
};
|
|
38
|
-
const onGoBack = () => {
|
|
39
|
-
RouterController.goBack();
|
|
40
|
-
ModalController.setLoading(false);
|
|
41
|
-
};
|
|
42
|
-
const onLearnMorePress = () => {
|
|
43
|
-
Linking.openURL('https://reown.com/faq');
|
|
44
|
-
};
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
// Go back if the address has changed
|
|
47
|
-
if (address && initialAddress !== address) {
|
|
48
|
-
RouterController.goBack();
|
|
49
|
-
}
|
|
50
|
-
}, [initialAddress, address]);
|
|
51
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconLink, {
|
|
52
|
-
icon: "close",
|
|
53
|
-
size: "md",
|
|
54
|
-
onPress: onClose,
|
|
55
|
-
testID: "header-close",
|
|
56
|
-
style: styles.closeButton
|
|
57
|
-
}), /*#__PURE__*/React.createElement(FlexView, {
|
|
58
|
-
style: styles.container,
|
|
59
|
-
padding: ['4xl', 'm', '2xl', 'm']
|
|
60
|
-
}, /*#__PURE__*/React.createElement(FlexView, {
|
|
61
|
-
alignItems: "center",
|
|
62
|
-
justifyContent: "center",
|
|
63
|
-
flexDirection: "row"
|
|
64
|
-
}, /*#__PURE__*/React.createElement(Visual, {
|
|
65
|
-
name: "google"
|
|
66
|
-
}), /*#__PURE__*/React.createElement(Visual, {
|
|
67
|
-
style: styles.middleIcon,
|
|
68
|
-
name: "pencil"
|
|
69
|
-
}), /*#__PURE__*/React.createElement(Visual, {
|
|
70
|
-
name: "lightbulb"
|
|
71
|
-
})), /*#__PURE__*/React.createElement(Text, {
|
|
72
|
-
variant: "medium-600",
|
|
73
|
-
color: "fg-100",
|
|
74
|
-
style: styles.title
|
|
75
|
-
}, "Discover Smart Accounts"), /*#__PURE__*/React.createElement(Text, {
|
|
76
|
-
variant: "paragraph-400",
|
|
77
|
-
color: "fg-100",
|
|
78
|
-
center: true
|
|
79
|
-
}, "Access advanced brand new features as username, improved security and a smoother user experience!"), /*#__PURE__*/React.createElement(FlexView, {
|
|
80
|
-
flexDirection: "row",
|
|
81
|
-
margin: ['m', '4xl', 'm', '4xl']
|
|
82
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
83
|
-
variant: "accent",
|
|
84
|
-
onPress: onGoBack,
|
|
85
|
-
disabled: loading,
|
|
86
|
-
style: [styles.button, styles.cancelButton]
|
|
87
|
-
}, "Do it later"), /*#__PURE__*/React.createElement(Button, {
|
|
88
|
-
onPress: onSwitchAccountType,
|
|
89
|
-
loading: loading,
|
|
90
|
-
style: styles.button
|
|
91
|
-
}, "Continue")), /*#__PURE__*/React.createElement(Link, {
|
|
92
|
-
onPress: onLearnMorePress,
|
|
93
|
-
iconRight: "externalLink"
|
|
94
|
-
}, "Learn more")));
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Linking","useEffect","useState","useSnapshot","Button","FlexView","IconLink","Link","Text","Visual","AccountController","ConnectorController","EventsController","ModalController","NetworkController","RouterController","SnackController","styles","UpgradeToSmartAccountView","address","state","loading","initialAddress","onSwitchAccountType","setLoading","accountType","preferredAccountType","provider","getAuthConnector","setPreferredAccount","sendEvent","type","event","properties","network","caipNetwork","id","error","showError","onClose","close","onGoBack","goBack","onLearnMorePress","openURL","React","createElement","Fragment","icon","size","onPress","testID","style","closeButton","container","padding","alignItems","justifyContent","flexDirection","name","middleIcon","variant","color","title","center","margin","disabled","button","cancelButton","iconRight"],"sourceRoot":"../../../../src","sources":["views/w3m-upgrade-to-smart-account-view/index.tsx"],"mappings":"AAAA,SAASA,OAAO,QAAQ,cAAc;AACtC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C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AAK,EAAEnC,MAAM,CAAC2C,UAAW;IAACD,IAAI,EAAC;EAAQ,CAAE,CAAC,eAClDd,KAAA,CAAAC,aAAA,CAACrC,MAAM;IAACkD,IAAI,EAAC;EAAW,CAAE,CAClB,CAAC,eACXd,KAAA,CAAAC,aAAA,CAACtC,IAAI;IAACqD,OAAO,EAAC,YAAY;IAACC,KAAK,EAAC,QAAQ;IAACV,KAAK,EAAEnC,MAAM,CAAC8C;EAAM,GAAC,yBAEzD,CAAC,eACPlB,KAAA,CAAAC,aAAA,CAACtC,IAAI;IAACqD,OAAO,EAAC,eAAe;IAACC,KAAK,EAAC,QAAQ;IAACE,MAAM;EAAA,GAAC,mGAG9C,CAAC,eACPnB,KAAA,CAAAC,aAAA,CAACzC,QAAQ;IAACqD,aAAa,EAAC,KAAK;IAACO,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK;EAAE,gBAC7DpB,KAAA,CAAAC,aAAA,CAAC1C,MAAM;IACLyD,OAAO,EAAC,QAAQ;IAChBX,OAAO,EAAET,QAAS;IAClByB,QAAQ,EAAE7C,OAAQ;IAClB+B,KAAK,EAAE,CAACnC,MAAM,CAACkD,MAAM,EAAElD,MAAM,CAACmD,YAAY;EAAE,GAC7C,aAEO,CAAC,eACTvB,KAAA,CAAAC,aAAA,CAAC1C,MAAM;IAAC8C,OAAO,EAAE3B,mBAAoB;IAACF,OAAO,EAAEA,OAAQ;IAAC+B,KAAK,EAAEnC,MAAM,CAACkD;EAAO,GAAC,UAEtE,CACA,CAAC,eACXtB,KAAA,CAAAC,aAAA,CAACvC,IAAI;IAAC2C,OAAO,EAAEP,gBAAiB;IAAC0B,SAAS,EAAC;EAAc,GAAC,YAEpD,CACE,CACV,CAAC;AAEP"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Spacing } from '@reown/appkit-ui-react-native';
|
|
2
|
-
import { StyleSheet } from 'react-native';
|
|
3
|
-
export default StyleSheet.create({
|
|
4
|
-
container: {
|
|
5
|
-
justifyContent: 'center',
|
|
6
|
-
alignItems: 'center'
|
|
7
|
-
},
|
|
8
|
-
title: {
|
|
9
|
-
marginTop: Spacing.xl,
|
|
10
|
-
marginVertical: Spacing.s
|
|
11
|
-
},
|
|
12
|
-
button: {
|
|
13
|
-
width: 110
|
|
14
|
-
},
|
|
15
|
-
cancelButton: {
|
|
16
|
-
marginRight: Spacing.m
|
|
17
|
-
},
|
|
18
|
-
middleIcon: {
|
|
19
|
-
marginHorizontal: Spacing.s
|
|
20
|
-
},
|
|
21
|
-
closeButton: {
|
|
22
|
-
alignSelf: 'flex-end',
|
|
23
|
-
right: Spacing.xl,
|
|
24
|
-
top: Spacing.l,
|
|
25
|
-
position: 'absolute',
|
|
26
|
-
zIndex: 2
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
//# sourceMappingURL=styles.js.map
|