@reown/appkit-react-native 0.0.0-feat-multi-social-20250701154123 → 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 +18 -11
- package/lib/commonjs/AppKit.js.map +1 -1
- package/lib/commonjs/connectors/WalletConnectConnector.js +15 -3
- package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/commonjs/modal/w3m-router/index.js +0 -9
- 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 -3
- 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-connect-view/components/social-login-list.js +14 -7
- package/lib/commonjs/views/w3m-connect-view/components/social-login-list.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 +18 -11
- package/lib/module/AppKit.js.map +1 -1
- package/lib/module/connectors/WalletConnectConnector.js +15 -3
- package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/module/modal/w3m-router/index.js +0 -9
- 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 -3
- 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-connect-view/components/social-login-list.js +14 -7
- package/lib/module/views/w3m-connect-view/components/social-login-list.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 +1 -1
- package/lib/typescript/AppKit.d.ts.map +1 -1
- package/lib/typescript/connectors/WalletConnectConnector.d.ts +2 -2
- package/lib/typescript/connectors/WalletConnectConnector.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKitEvents.d.ts +0 -9
- package/lib/typescript/hooks/useAppKitEvents.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-connect-view/components/social-login-list.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 +24 -12
- package/src/connectors/WalletConnectConnector.ts +25 -6
- package/src/modal/w3m-router/index.tsx +0 -9
- 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 -3
- 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-connect-view/components/social-login-list.tsx +13 -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-email-verify-device-view/index.js +0 -106
- package/lib/commonjs/views/w3m-email-verify-device-view/index.js.map +0 -1
- package/lib/commonjs/views/w3m-email-verify-device-view/styles.js +0 -25
- package/lib/commonjs/views/w3m-email-verify-device-view/styles.js.map +0 -1
- package/lib/commonjs/views/w3m-email-verify-otp-view/index.js +0 -86
- package/lib/commonjs/views/w3m-email-verify-otp-view/index.js.map +0 -1
- 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-email-verify-device-view/index.js +0 -99
- package/lib/module/views/w3m-email-verify-device-view/index.js.map +0 -1
- package/lib/module/views/w3m-email-verify-device-view/styles.js +0 -19
- package/lib/module/views/w3m-email-verify-device-view/styles.js.map +0 -1
- package/lib/module/views/w3m-email-verify-otp-view/index.js +0 -79
- package/lib/module/views/w3m-email-verify-otp-view/index.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-email-verify-device-view/index.d.ts +0 -2
- package/lib/typescript/views/w3m-email-verify-device-view/index.d.ts.map +0 -1
- package/lib/typescript/views/w3m-email-verify-device-view/styles.d.ts +0 -18
- package/lib/typescript/views/w3m-email-verify-device-view/styles.d.ts.map +0 -1
- package/lib/typescript/views/w3m-email-verify-otp-view/index.d.ts +0 -2
- package/lib/typescript/views/w3m-email-verify-otp-view/index.d.ts.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-email-verify-device-view/index.tsx +0 -80
- package/src/views/w3m-email-verify-device-view/styles.ts +0 -19
- package/src/views/w3m-email-verify-otp-view/index.tsx +0 -75
- 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
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
type CaipNetworkId,
|
|
11
11
|
type ConnectOptions,
|
|
12
12
|
type ConnectorInitOptions,
|
|
13
|
-
type Metadata
|
|
13
|
+
type Metadata,
|
|
14
|
+
type ConnectionProperties
|
|
14
15
|
} from '@reown/appkit-common-react-native';
|
|
15
16
|
import { getDidAddress, getDidChainId, SIWEController } from '@reown/appkit-siwe-react-native';
|
|
16
17
|
|
|
@@ -49,6 +50,15 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
49
50
|
this.namespaces = provider.session.namespaces as Namespaces;
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
if (provider.session?.sessionProperties) {
|
|
54
|
+
this.properties = {
|
|
55
|
+
...provider.session.sessionProperties,
|
|
56
|
+
smartAccounts: provider.session.sessionProperties['smartAccounts']
|
|
57
|
+
? JSON.parse(provider.session.sessionProperties['smartAccounts'])
|
|
58
|
+
: []
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
52
62
|
if (provider.session?.peer?.metadata) {
|
|
53
63
|
const metadata = provider.session?.peer.metadata;
|
|
54
64
|
if (metadata) {
|
|
@@ -81,10 +91,6 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
81
91
|
return this.provider as IUniversalProvider;
|
|
82
92
|
}
|
|
83
93
|
|
|
84
|
-
override disconnect(): Promise<void> {
|
|
85
|
-
return this.getProvider().disconnect();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
94
|
override async connect(opts: ConnectOptions) {
|
|
89
95
|
const { siweConfig, namespaces, defaultChain, universalLink } = opts;
|
|
90
96
|
function onUri(uri: string) {
|
|
@@ -96,7 +102,7 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
96
102
|
// @ts-ignore
|
|
97
103
|
provider.on('display_uri', onUri);
|
|
98
104
|
|
|
99
|
-
let session;
|
|
105
|
+
let session: IUniversalProvider['session'];
|
|
100
106
|
|
|
101
107
|
// SIWE
|
|
102
108
|
const isEVMOnly = Object.keys(namespaces ?? {}).length === 1 && namespaces?.['eip155'];
|
|
@@ -177,6 +183,15 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
177
183
|
(this.provider as IUniversalProvider).setDefaultChain(defaultChain);
|
|
178
184
|
}
|
|
179
185
|
|
|
186
|
+
if (session?.sessionProperties) {
|
|
187
|
+
this.properties = {
|
|
188
|
+
...session.sessionProperties,
|
|
189
|
+
smartAccounts: session.sessionProperties['smartAccounts']
|
|
190
|
+
? JSON.parse(session.sessionProperties['smartAccounts'])
|
|
191
|
+
: []
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
180
195
|
this.namespaces = session?.namespaces as Namespaces;
|
|
181
196
|
|
|
182
197
|
provider.off('display_uri', onUri);
|
|
@@ -196,6 +211,10 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
196
211
|
return this.namespaces ?? {};
|
|
197
212
|
}
|
|
198
213
|
|
|
214
|
+
override getProperties(): ConnectionProperties | undefined {
|
|
215
|
+
return this.properties;
|
|
216
|
+
}
|
|
217
|
+
|
|
199
218
|
override switchNetwork(network: AppKitNetwork): Promise<void> {
|
|
200
219
|
if (!network) throw new Error('No network provided');
|
|
201
220
|
|
|
@@ -11,8 +11,6 @@ import { ConnectingView } from '../../views/w3m-connecting-view';
|
|
|
11
11
|
import { ConnectingExternalView } from '../../views/w3m-connecting-external-view';
|
|
12
12
|
import { ConnectingSocialView } from '../../views/w3m-connecting-social-view';
|
|
13
13
|
import { ConnectingSiweView } from '../../views/w3m-connecting-siwe-view';
|
|
14
|
-
import { EmailVerifyOtpView } from '../../views/w3m-email-verify-otp-view';
|
|
15
|
-
import { EmailVerifyDeviceView } from '../../views/w3m-email-verify-device-view';
|
|
16
14
|
import { GetWalletView } from '../../views/w3m-get-wallet-view';
|
|
17
15
|
import { NetworksView } from '../../views/w3m-networks-view';
|
|
18
16
|
import { NetworkSwitchView } from '../../views/w3m-network-switch-view';
|
|
@@ -30,7 +28,6 @@ import { UpdateEmailWalletView } from '../../views/w3m-update-email-wallet-view'
|
|
|
30
28
|
import { UpdateEmailPrimaryOtpView } from '../../views/w3m-update-email-primary-otp-view';
|
|
31
29
|
import { UpdateEmailSecondaryOtpView } from '../../views/w3m-update-email-secondary-otp-view';
|
|
32
30
|
import { UpgradeEmailWalletView } from '../../views/w3m-upgrade-email-wallet-view';
|
|
33
|
-
import { UpgradeToSmartAccountView } from '../../views/w3m-upgrade-to-smart-account-view';
|
|
34
31
|
import { WalletCompatibleNetworks } from '../../views/w3m-wallet-compatible-networks-view';
|
|
35
32
|
import { WalletReceiveView } from '../../views/w3m-wallet-receive-view';
|
|
36
33
|
import { WalletSendView } from '../../views/w3m-wallet-send-view';
|
|
@@ -67,10 +64,6 @@ export function AppKitRouter() {
|
|
|
67
64
|
return ConnectingSocialView;
|
|
68
65
|
case 'ConnectingWalletConnect':
|
|
69
66
|
return ConnectingView;
|
|
70
|
-
case 'EmailVerifyDevice':
|
|
71
|
-
return EmailVerifyDeviceView;
|
|
72
|
-
case 'EmailVerifyOtp':
|
|
73
|
-
return EmailVerifyOtpView;
|
|
74
67
|
case 'GetWallet':
|
|
75
68
|
return GetWalletView;
|
|
76
69
|
case 'Networks':
|
|
@@ -105,8 +98,6 @@ export function AppKitRouter() {
|
|
|
105
98
|
return UpdateEmailWalletView;
|
|
106
99
|
case 'UpgradeEmailWallet':
|
|
107
100
|
return UpgradeEmailWalletView;
|
|
108
|
-
case 'UpgradeToSmartAccount':
|
|
109
|
-
return UpgradeToSmartAccountView;
|
|
110
101
|
case 'WalletCompatibleNetworks':
|
|
111
102
|
return WalletCompatibleNetworks;
|
|
112
103
|
case 'WalletReceive':
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
} from '@reown/appkit-ui-react-native';
|
|
13
13
|
import { type Transaction, type TransactionImage } from '@reown/appkit-common-react-native';
|
|
14
14
|
import {
|
|
15
|
-
AccountController,
|
|
16
15
|
AssetUtil,
|
|
17
16
|
ConnectionsController,
|
|
18
17
|
ConstantsUtil,
|
|
@@ -40,7 +39,7 @@ export function AccountActivity({ style }: Props) {
|
|
|
40
39
|
ConstantsUtil.ACTIVITY_SUPPORTED_CHAINS.includes(activeNetwork.caipNetworkId);
|
|
41
40
|
|
|
42
41
|
const handleLoadMore = () => {
|
|
43
|
-
const address = ConnectionsController.state.activeAddress
|
|
42
|
+
const address = ConnectionsController.state.activeAddress;
|
|
44
43
|
TransactionsController.fetchTransactions(address);
|
|
45
44
|
EventsController.sendEvent({
|
|
46
45
|
type: 'track',
|
|
@@ -49,14 +48,14 @@ export function AccountActivity({ style }: Props) {
|
|
|
49
48
|
address,
|
|
50
49
|
projectId: OptionsController.state.projectId,
|
|
51
50
|
cursor: TransactionsController.state.next,
|
|
52
|
-
isSmartAccount:
|
|
51
|
+
isSmartAccount: ConnectionsController.state.accountType === 'smartAccount'
|
|
53
52
|
}
|
|
54
53
|
});
|
|
55
54
|
};
|
|
56
55
|
|
|
57
56
|
const onRefresh = useCallback(async () => {
|
|
58
57
|
setRefreshing(true);
|
|
59
|
-
const address = ConnectionsController.state.activeAddress
|
|
58
|
+
const address = ConnectionsController.state.activeAddress;
|
|
60
59
|
await TransactionsController.fetchTransactions(address, true);
|
|
61
60
|
setRefreshing(false);
|
|
62
61
|
}, []);
|
|
@@ -67,7 +66,7 @@ export function AccountActivity({ style }: Props) {
|
|
|
67
66
|
|
|
68
67
|
useEffect(() => {
|
|
69
68
|
if (!TransactionsController.state.transactions.length) {
|
|
70
|
-
const address = ConnectionsController.state.activeAddress
|
|
69
|
+
const address = ConnectionsController.state.activeAddress;
|
|
71
70
|
TransactionsController.fetchTransactions(address, true);
|
|
72
71
|
}
|
|
73
72
|
// Set initial load to false after first fetch
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import { useSnapshot } from 'valtio';
|
|
10
10
|
import {
|
|
11
|
-
AccountController,
|
|
12
11
|
AssetUtil,
|
|
13
12
|
ConnectionsController,
|
|
14
13
|
RouterController
|
|
@@ -29,13 +28,15 @@ interface Props {
|
|
|
29
28
|
export function AccountTokens({ style }: Props) {
|
|
30
29
|
const Theme = useTheme();
|
|
31
30
|
const [refreshing, setRefreshing] = useState(false);
|
|
32
|
-
const {
|
|
33
|
-
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
31
|
+
const { activeNetwork, balances } = useSnapshot(ConnectionsController.state);
|
|
34
32
|
const networkImage = AssetUtil.getNetworkImage(activeNetwork?.id);
|
|
35
33
|
|
|
34
|
+
// Show all tokens that come from the API
|
|
35
|
+
const filteredBalances = balances?.filter(balance => balance.quantity);
|
|
36
|
+
|
|
36
37
|
const onRefresh = useCallback(async () => {
|
|
37
38
|
setRefreshing(true);
|
|
38
|
-
|
|
39
|
+
await ConnectionsController.fetchBalance();
|
|
39
40
|
setRefreshing(false);
|
|
40
41
|
}, []);
|
|
41
42
|
|
|
@@ -43,7 +44,7 @@ export function AccountTokens({ style }: Props) {
|
|
|
43
44
|
RouterController.push('WalletReceive');
|
|
44
45
|
};
|
|
45
46
|
|
|
46
|
-
if (!
|
|
47
|
+
if (!filteredBalances?.length) {
|
|
47
48
|
return (
|
|
48
49
|
<ListItem
|
|
49
50
|
icon="arrowBottomCircle"
|
|
@@ -76,14 +77,14 @@ export function AccountTokens({ style }: Props) {
|
|
|
76
77
|
/>
|
|
77
78
|
}
|
|
78
79
|
>
|
|
79
|
-
{
|
|
80
|
+
{filteredBalances.map(token => (
|
|
80
81
|
<ListToken
|
|
81
|
-
key={token.
|
|
82
|
-
name={token.name}
|
|
82
|
+
key={token.symbol}
|
|
83
|
+
name={token.name || 'Unknown'}
|
|
83
84
|
imageSrc={token.iconUrl}
|
|
84
85
|
networkSrc={networkImage}
|
|
85
86
|
value={token.value}
|
|
86
|
-
amount={token.quantity
|
|
87
|
+
amount={token.quantity?.numeric}
|
|
87
88
|
currency={token.symbol}
|
|
88
89
|
pressable={false}
|
|
89
90
|
/>
|
|
@@ -2,7 +2,6 @@ import { useState } from 'react';
|
|
|
2
2
|
import { useSnapshot } from 'valtio';
|
|
3
3
|
import { Balance, FlexView, IconLink, Tabs } from '@reown/appkit-ui-react-native';
|
|
4
4
|
import {
|
|
5
|
-
AccountController,
|
|
6
5
|
ConnectionsController,
|
|
7
6
|
ConstantsUtil,
|
|
8
7
|
CoreHelperUtil,
|
|
@@ -23,10 +22,11 @@ export interface AccountWalletFeaturesProps {
|
|
|
23
22
|
|
|
24
23
|
export function AccountWalletFeatures() {
|
|
25
24
|
const [activeTab, setActiveTab] = useState(0);
|
|
26
|
-
const { tokenBalance } = useSnapshot(AccountController.state);
|
|
27
25
|
const { features, isOnRampEnabled } = useSnapshot(OptionsController.state);
|
|
28
|
-
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
29
|
-
const balance = CoreHelperUtil.calculateAndFormatBalance(
|
|
26
|
+
const { activeNetwork, balances } = useSnapshot(ConnectionsController.state);
|
|
27
|
+
const balance = CoreHelperUtil.calculateAndFormatBalance(balances as BalanceType[]);
|
|
28
|
+
const network = ConnectionsController.state.activeNetwork?.caipNetworkId || '';
|
|
29
|
+
const isSmartAccount = ConnectionsController.state.accountType === 'smartAccount';
|
|
30
30
|
const isSwapsEnabled =
|
|
31
31
|
features?.swaps &&
|
|
32
32
|
activeNetwork?.caipNetworkId &&
|
|
@@ -43,9 +43,7 @@ export function AccountWalletFeatures() {
|
|
|
43
43
|
EventsController.sendEvent({
|
|
44
44
|
type: 'track',
|
|
45
45
|
event: 'CLICK_TRANSACTIONS',
|
|
46
|
-
properties: {
|
|
47
|
-
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount'
|
|
48
|
-
}
|
|
46
|
+
properties: { isSmartAccount }
|
|
49
47
|
});
|
|
50
48
|
};
|
|
51
49
|
|
|
@@ -54,10 +52,7 @@ export function AccountWalletFeatures() {
|
|
|
54
52
|
EventsController.sendEvent({
|
|
55
53
|
type: 'track',
|
|
56
54
|
event: 'OPEN_SWAP',
|
|
57
|
-
properties: {
|
|
58
|
-
network: ConnectionsController.state.activeNetwork?.caipNetworkId || '',
|
|
59
|
-
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount'
|
|
60
|
-
}
|
|
55
|
+
properties: { network, isSmartAccount }
|
|
61
56
|
});
|
|
62
57
|
RouterController.push('Swap');
|
|
63
58
|
};
|
|
@@ -66,10 +61,7 @@ export function AccountWalletFeatures() {
|
|
|
66
61
|
EventsController.sendEvent({
|
|
67
62
|
type: 'track',
|
|
68
63
|
event: 'OPEN_SEND',
|
|
69
|
-
properties: {
|
|
70
|
-
network: ConnectionsController.state.activeNetwork?.caipNetworkId || '',
|
|
71
|
-
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount'
|
|
72
|
-
}
|
|
64
|
+
properties: { network, isSmartAccount }
|
|
73
65
|
});
|
|
74
66
|
RouterController.push('WalletSend');
|
|
75
67
|
};
|
|
@@ -35,8 +35,6 @@ export function Header() {
|
|
|
35
35
|
ConnectingSiwe: undefined,
|
|
36
36
|
ConnectingSocial: socialName ?? 'Connecting Social',
|
|
37
37
|
ConnectingWalletConnect: walletName ?? 'WalletConnect',
|
|
38
|
-
EmailVerifyDevice: ' ',
|
|
39
|
-
EmailVerifyOtp: 'Confirm email',
|
|
40
38
|
GetWallet: 'Get a wallet',
|
|
41
39
|
Networks: 'Select network',
|
|
42
40
|
OnRamp: undefined,
|
|
@@ -54,7 +52,6 @@ export function Header() {
|
|
|
54
52
|
UpdateEmailSecondaryOtp: 'Confirm new email',
|
|
55
53
|
UpdateEmailWallet: 'Edit email',
|
|
56
54
|
UpgradeEmailWallet: 'Upgrade wallet',
|
|
57
|
-
UpgradeToSmartAccount: undefined,
|
|
58
55
|
WalletCompatibleNetworks: 'Compatible networks',
|
|
59
56
|
WalletReceive: 'Receive',
|
|
60
57
|
WalletSend: 'Send',
|
|
@@ -27,7 +27,7 @@ export function SendInputToken({
|
|
|
27
27
|
const [inputValue, setInputValue] = useState<string | undefined>(sendTokenAmount?.toString());
|
|
28
28
|
const sendValue = getSendValue(token, sendTokenAmount);
|
|
29
29
|
const maxAmount = getMaxAmount(token);
|
|
30
|
-
const maxError = token && sendTokenAmount && sendTokenAmount > Number(token
|
|
30
|
+
const maxError = token && sendTokenAmount && sendTokenAmount > Number(token?.quantity?.numeric);
|
|
31
31
|
|
|
32
32
|
const onInputChange = (value: string) => {
|
|
33
33
|
const formattedValue = value.replace(/,/g, '.');
|
|
@@ -39,11 +39,11 @@ export function SendInputToken({
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
const onMaxPress = () => {
|
|
42
|
-
if (token && gasPrice) {
|
|
42
|
+
if (token?.quantity && gasPrice) {
|
|
43
43
|
const isNetworkToken =
|
|
44
|
-
token.
|
|
44
|
+
token.contractAddress === undefined ||
|
|
45
45
|
Object.values(ConstantsUtil.NATIVE_TOKEN_ADDRESS).some(
|
|
46
|
-
nativeAddress => token?.
|
|
46
|
+
nativeAddress => token?.contractAddress?.split(':')[2] === nativeAddress
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
const numericGas = NumberUtil.bigNumber(gasPrice).shiftedBy(-token.quantity.decimals);
|
|
@@ -2,7 +2,7 @@ import { type Balance, NumberUtil } from '@reown/appkit-common-react-native';
|
|
|
2
2
|
import { UiUtil } from '@reown/appkit-ui-react-native';
|
|
3
3
|
|
|
4
4
|
export function getSendValue(token?: Balance, sendTokenAmount?: number) {
|
|
5
|
-
if (token && sendTokenAmount) {
|
|
5
|
+
if (token?.price && sendTokenAmount) {
|
|
6
6
|
const price = token.price;
|
|
7
7
|
const totalValue = price * sendTokenAmount;
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ export function getSendValue(token?: Balance, sendTokenAmount?: number) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function getMaxAmount(token?: Balance) {
|
|
16
|
-
if (token) {
|
|
16
|
+
if (token?.quantity) {
|
|
17
17
|
return NumberUtil.roundNumber(Number(token.quantity.numeric), 6, 5);
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet, type StyleProp, type ViewStyle } from 'react-native';
|
|
2
2
|
import { UpgradeWalletButton } from './upgrade-wallet-button';
|
|
3
|
-
import {
|
|
3
|
+
import { ListSocial, Spacing, Text } from '@reown/appkit-ui-react-native';
|
|
4
4
|
import type { SocialProvider } from '@reown/appkit-common-react-native';
|
|
5
5
|
|
|
6
6
|
export interface AuthButtonsProps {
|
|
@@ -21,30 +21,19 @@ export function AuthButtons({
|
|
|
21
21
|
return (
|
|
22
22
|
<>
|
|
23
23
|
<UpgradeWalletButton onPress={onUpgradePress} style={styles.upgradeButton} />
|
|
24
|
-
{socialProvider
|
|
24
|
+
{socialProvider && (
|
|
25
25
|
<ListSocial
|
|
26
26
|
logo={socialProvider}
|
|
27
27
|
logoHeight={32}
|
|
28
28
|
logoWidth={32}
|
|
29
29
|
style={[styles.socialContainer, style]}
|
|
30
|
+
onPress={onPress}
|
|
31
|
+
chevron={socialProvider === 'email'}
|
|
30
32
|
>
|
|
31
33
|
<Text color="fg-100" numberOfLines={1} ellipsizeMode="tail" style={styles.socialText}>
|
|
32
34
|
{text}
|
|
33
35
|
</Text>
|
|
34
36
|
</ListSocial>
|
|
35
|
-
) : (
|
|
36
|
-
<ListItem
|
|
37
|
-
icon="email"
|
|
38
|
-
onPress={onPress}
|
|
39
|
-
chevron
|
|
40
|
-
testID="button-email"
|
|
41
|
-
iconColor="fg-100"
|
|
42
|
-
style={style}
|
|
43
|
-
>
|
|
44
|
-
<Text color="fg-100" numberOfLines={1} ellipsizeMode="tail">
|
|
45
|
-
{text}
|
|
46
|
-
</Text>
|
|
47
|
-
</ListItem>
|
|
48
37
|
)}
|
|
49
38
|
</>
|
|
50
39
|
);
|
|
@@ -5,16 +5,12 @@ import {
|
|
|
5
5
|
AccountController,
|
|
6
6
|
ApiController,
|
|
7
7
|
AssetUtil,
|
|
8
|
-
ConnectionController,
|
|
9
|
-
ConnectorController,
|
|
10
8
|
CoreHelperUtil,
|
|
11
9
|
EventsController,
|
|
12
10
|
ModalController,
|
|
13
|
-
NetworkController,
|
|
14
11
|
OptionsController,
|
|
15
12
|
RouterController,
|
|
16
13
|
SnackController,
|
|
17
|
-
type AppKitFrameProvider,
|
|
18
14
|
ConstantsUtil,
|
|
19
15
|
SwapController,
|
|
20
16
|
OnRampController,
|
|
@@ -38,27 +34,27 @@ import { AuthButtons } from './components/auth-buttons';
|
|
|
38
34
|
import styles from './styles';
|
|
39
35
|
|
|
40
36
|
export function AccountDefaultView() {
|
|
41
|
-
const { profileName, profileImage
|
|
37
|
+
const { profileName, profileImage } = useSnapshot(AccountController.state);
|
|
42
38
|
const { loading } = useSnapshot(ModalController.state);
|
|
43
39
|
const {
|
|
44
40
|
activeAddress: address,
|
|
45
41
|
activeBalance: balance,
|
|
46
42
|
activeNetwork,
|
|
47
|
-
activeNamespace
|
|
43
|
+
activeNamespace,
|
|
44
|
+
connection,
|
|
45
|
+
accountType
|
|
48
46
|
} = useSnapshot(ConnectionsController.state);
|
|
49
47
|
const account = address?.split(':')[2];
|
|
50
48
|
const [disconnecting, setDisconnecting] = useState(false);
|
|
51
|
-
const { connectedConnector } = useSnapshot(ConnectorController.state);
|
|
52
|
-
const { connectedSocialProvider } = useSnapshot(ConnectionController.state);
|
|
53
49
|
const { features, isOnRampEnabled } = useSnapshot(OptionsController.state);
|
|
54
50
|
const { history } = useSnapshot(RouterController.state);
|
|
55
51
|
const networkImage = AssetUtil.getNetworkImage(activeNetwork?.id);
|
|
56
52
|
const showCopy = OptionsController.isClipboardAvailable();
|
|
57
|
-
const isAuth =
|
|
53
|
+
const isAuth = connection?.properties?.email || connection?.properties?.username;
|
|
58
54
|
const showBalance = balance && !isAuth;
|
|
59
55
|
const showExplorer = Object.keys(activeNetwork?.blockExplorers ?? {}).length > 0 && !isAuth;
|
|
60
56
|
const showBack = history.length > 1;
|
|
61
|
-
const showSwitchAccountType = isAuth
|
|
57
|
+
const showSwitchAccountType = isAuth;
|
|
62
58
|
const showActivity =
|
|
63
59
|
!isAuth &&
|
|
64
60
|
activeNamespace &&
|
|
@@ -80,17 +76,20 @@ export function AccountDefaultView() {
|
|
|
80
76
|
|
|
81
77
|
const onSwitchAccountType = async () => {
|
|
82
78
|
try {
|
|
83
|
-
if (isAuth) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
if (isAuth && ConnectionsController.state.activeNamespace) {
|
|
80
|
+
const newType = ConnectionsController.state.accountType === 'eoa' ? 'smartAccount' : 'eoa';
|
|
81
|
+
ConnectionsController.setAccountType(
|
|
82
|
+
ConnectionsController.state.activeNamespace,
|
|
83
|
+
ConnectionsController.state.accountType === 'eoa' ? 'smartAccount' : 'eoa'
|
|
84
|
+
);
|
|
85
|
+
ConnectionsController.fetchBalance();
|
|
86
|
+
|
|
89
87
|
EventsController.sendEvent({
|
|
90
88
|
type: 'track',
|
|
91
89
|
event: 'SET_PREFERRED_ACCOUNT_TYPE',
|
|
92
90
|
properties: {
|
|
93
|
-
|
|
91
|
+
// eslint-disable-next-line valtio/state-snapshot-rule
|
|
92
|
+
accountType: newType,
|
|
94
93
|
network: ConnectionsController.state.activeNetwork?.caipNetworkId || ''
|
|
95
94
|
}
|
|
96
95
|
});
|
|
@@ -101,20 +100,6 @@ export function AccountDefaultView() {
|
|
|
101
100
|
}
|
|
102
101
|
};
|
|
103
102
|
|
|
104
|
-
const getUserEmail = () => {
|
|
105
|
-
const provider = ConnectorController.getAuthConnector()?.provider as AppKitFrameProvider;
|
|
106
|
-
if (!provider) return '';
|
|
107
|
-
|
|
108
|
-
return provider.getEmail();
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const getUsername = () => {
|
|
112
|
-
const provider = ConnectorController.getAuthConnector()?.provider as AppKitFrameProvider;
|
|
113
|
-
if (!provider) return '';
|
|
114
|
-
|
|
115
|
-
return provider.getUsername();
|
|
116
|
-
};
|
|
117
|
-
|
|
118
103
|
const onExplorerPress = () => {
|
|
119
104
|
if (showExplorer && ConnectionsController.state.activeNetwork?.blockExplorers?.default?.url) {
|
|
120
105
|
Linking.openURL(ConnectionsController.state.activeNetwork?.blockExplorers?.default?.url);
|
|
@@ -174,8 +159,10 @@ export function AccountDefaultView() {
|
|
|
174
159
|
};
|
|
175
160
|
|
|
176
161
|
const onEmailPress = () => {
|
|
177
|
-
|
|
178
|
-
|
|
162
|
+
const email = ConnectionsController.state.connection?.properties?.email;
|
|
163
|
+
const provider = ConnectionsController.state.connection?.properties?.provider;
|
|
164
|
+
if (provider !== 'email' || !email) return;
|
|
165
|
+
RouterController.push('UpdateEmailWallet', { email });
|
|
179
166
|
};
|
|
180
167
|
|
|
181
168
|
return (
|
|
@@ -239,11 +226,11 @@ export function AccountDefaultView() {
|
|
|
239
226
|
{isAuth && (
|
|
240
227
|
<AuthButtons
|
|
241
228
|
onUpgradePress={onUpgradePress}
|
|
242
|
-
socialProvider={
|
|
229
|
+
socialProvider={connection?.properties?.provider}
|
|
243
230
|
onPress={onEmailPress}
|
|
244
231
|
style={styles.actionButton}
|
|
245
232
|
text={UiUtil.getTruncateString({
|
|
246
|
-
string:
|
|
233
|
+
string: connection?.properties?.username || connection?.properties?.email || '',
|
|
247
234
|
charsStart: 30,
|
|
248
235
|
charsEnd: 0,
|
|
249
236
|
truncate: 'end'
|
|
@@ -316,7 +303,7 @@ export function AccountDefaultView() {
|
|
|
316
303
|
loading={loading}
|
|
317
304
|
>
|
|
318
305
|
<Text color="fg-100">{`Switch to your ${
|
|
319
|
-
|
|
306
|
+
accountType === 'eoa' ? 'smart account' : 'EOA'
|
|
320
307
|
}`}</Text>
|
|
321
308
|
</ListItem>
|
|
322
309
|
)}
|
|
@@ -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
|
/>
|
|
@@ -18,11 +18,19 @@ export function SocialLoginList({ options, disabled }: SocialLoginListProps) {
|
|
|
18
18
|
bottomSocials = showMoreButton ? bottomSocials.slice(0, MAX_OPTIONS - 2) : bottomSocials;
|
|
19
19
|
|
|
20
20
|
const onItemPress = (provider: SocialProvider) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
if (provider === 'email') {
|
|
22
|
+
EventsController.sendEvent({
|
|
23
|
+
type: 'track',
|
|
24
|
+
event: 'EMAIL_LOGIN_SELECTED'
|
|
25
|
+
});
|
|
26
|
+
} else {
|
|
27
|
+
EventsController.sendEvent({
|
|
28
|
+
type: 'track',
|
|
29
|
+
event: 'SOCIAL_LOGIN_STARTED',
|
|
30
|
+
properties: { provider }
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
26
34
|
RouterController.push('ConnectingSocial', { socialProvider: provider });
|
|
27
35
|
};
|
|
28
36
|
|