@reown/appkit-react-native 0.0.0-feat-multi-social-20250715153550 → 0.0.0-feat-coinbase-20250722173213
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 +45 -14
- package/lib/commonjs/AppKit.js.map +1 -1
- package/lib/commonjs/modal/w3m-account-button/index.js +4 -1
- package/lib/commonjs/modal/w3m-account-button/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-button/index.js +1 -1
- package/lib/commonjs/modal/w3m-button/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-modal/index.js +2 -1
- package/lib/commonjs/modal/w3m-modal/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-network-button/index.js +11 -5
- package/lib/commonjs/modal/w3m-network-button/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-activity/index.js +13 -4
- package/lib/commonjs/partials/w3m-account-activity/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-tokens/index.js +4 -1
- package/lib/commonjs/partials/w3m-account-tokens/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-wallet-features/index.js +4 -2
- package/lib/commonjs/partials/w3m-account-wallet-features/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-selector-modal/index.js +4 -1
- package/lib/commonjs/partials/w3m-selector-modal/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-send-input-token/index.js +10 -7
- package/lib/commonjs/partials/w3m-send-input-token/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-send-input-token/styles.js +3 -0
- package/lib/commonjs/partials/w3m-send-input-token/styles.js.map +1 -1
- package/lib/commonjs/utils/NetworkUtil.js +6 -8
- package/lib/commonjs/utils/NetworkUtil.js.map +1 -1
- package/lib/commonjs/views/w3m-account-default-view/index.js +30 -3
- package/lib/commonjs/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-account-view/index.js +6 -2
- package/lib/commonjs/views/w3m-account-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connect-view/components/custom-wallet-list.js +3 -1
- package/lib/commonjs/views/w3m-connect-view/components/custom-wallet-list.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-view/index.js +3 -1
- package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-network-switch-view/index.js +5 -1
- package/lib/commonjs/views/w3m-network-switch-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-networks-view/index.js +20 -12
- package/lib/commonjs/views/w3m-networks-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-checkout-view/index.js +4 -1
- package/lib/commonjs/views/w3m-onramp-checkout-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/index.js +4 -1
- package/lib/commonjs/views/w3m-onramp-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js +4 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-unsupported-chain-view/index.js +4 -1
- package/lib/commonjs/views/w3m-unsupported-chain-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-compatible-networks-view/index.js +4 -1
- package/lib/commonjs/views/w3m-wallet-compatible-networks-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-receive-view/index.js +5 -2
- package/lib/commonjs/views/w3m-wallet-receive-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-send-preview-view/components/preview-send-details.js +5 -12
- package/lib/commonjs/views/w3m-wallet-send-preview-view/components/preview-send-details.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-send-preview-view/index.js +0 -2
- 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 +4 -5
- 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 +12 -21
- package/lib/commonjs/views/w3m-wallet-send-view/index.js.map +1 -1
- package/lib/module/AppKit.js +46 -15
- package/lib/module/AppKit.js.map +1 -1
- package/lib/module/modal/w3m-account-button/index.js +5 -2
- package/lib/module/modal/w3m-account-button/index.js.map +1 -1
- package/lib/module/modal/w3m-button/index.js +2 -2
- package/lib/module/modal/w3m-button/index.js.map +1 -1
- package/lib/module/modal/w3m-modal/index.js +2 -1
- package/lib/module/modal/w3m-modal/index.js.map +1 -1
- package/lib/module/modal/w3m-network-button/index.js +12 -6
- package/lib/module/modal/w3m-network-button/index.js.map +1 -1
- package/lib/module/partials/w3m-account-activity/index.js +14 -5
- package/lib/module/partials/w3m-account-activity/index.js.map +1 -1
- package/lib/module/partials/w3m-account-tokens/index.js +5 -2
- package/lib/module/partials/w3m-account-tokens/index.js.map +1 -1
- package/lib/module/partials/w3m-account-wallet-features/index.js +4 -2
- package/lib/module/partials/w3m-account-wallet-features/index.js.map +1 -1
- package/lib/module/partials/w3m-selector-modal/index.js +5 -2
- package/lib/module/partials/w3m-selector-modal/index.js.map +1 -1
- package/lib/module/partials/w3m-send-input-token/index.js +12 -9
- package/lib/module/partials/w3m-send-input-token/index.js.map +1 -1
- package/lib/module/partials/w3m-send-input-token/styles.js +3 -0
- package/lib/module/partials/w3m-send-input-token/styles.js.map +1 -1
- package/lib/module/utils/NetworkUtil.js +6 -8
- package/lib/module/utils/NetworkUtil.js.map +1 -1
- package/lib/module/views/w3m-account-default-view/index.js +31 -4
- package/lib/module/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/module/views/w3m-account-view/index.js +7 -3
- package/lib/module/views/w3m-account-view/index.js.map +1 -1
- package/lib/module/views/w3m-connect-view/components/custom-wallet-list.js +4 -2
- package/lib/module/views/w3m-connect-view/components/custom-wallet-list.js.map +1 -1
- package/lib/module/views/w3m-connecting-view/index.js +3 -1
- package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/module/views/w3m-network-switch-view/index.js +6 -2
- package/lib/module/views/w3m-network-switch-view/index.js.map +1 -1
- package/lib/module/views/w3m-networks-view/index.js +21 -13
- package/lib/module/views/w3m-networks-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-checkout-view/index.js +5 -2
- package/lib/module/views/w3m-onramp-checkout-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/index.js +5 -2
- package/lib/module/views/w3m-onramp-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-view/components/select-token-view/index.js +5 -2
- package/lib/module/views/w3m-swap-view/components/select-token-view/index.js.map +1 -1
- package/lib/module/views/w3m-unsupported-chain-view/index.js +5 -2
- package/lib/module/views/w3m-unsupported-chain-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-compatible-networks-view/index.js +5 -2
- package/lib/module/views/w3m-wallet-compatible-networks-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-receive-view/index.js +6 -3
- package/lib/module/views/w3m-wallet-receive-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-send-preview-view/components/preview-send-details.js +6 -13
- package/lib/module/views/w3m-wallet-send-preview-view/components/preview-send-details.js.map +1 -1
- package/lib/module/views/w3m-wallet-send-preview-view/index.js +0 -2
- 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 +5 -6
- 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 +14 -23
- 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/modal/w3m-account-button/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-modal/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-network-button/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-selector-modal/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-send-input-token/index.d.ts +2 -2
- package/lib/typescript/partials/w3m-send-input-token/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-send-input-token/styles.d.ts +3 -0
- package/lib/typescript/partials/w3m-send-input-token/styles.d.ts.map +1 -1
- package/lib/typescript/utils/NetworkUtil.d.ts +2 -1
- package/lib/typescript/utils/NetworkUtil.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-connect-view/components/custom-wallet-list.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connecting-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-network-switch-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-networks-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-checkout-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-unsupported-chain-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-preview-view/components/preview-send-details.d.ts +1 -1
- package/lib/typescript/views/w3m-wallet-send-preview-view/components/preview-send-details.d.ts.map +1 -1
- package/lib/typescript/views/w3m-wallet-send-preview-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-wallet-send-select-token-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-wallet-send-view/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/AppKit.ts +69 -21
- package/src/modal/w3m-account-button/index.tsx +4 -3
- package/src/modal/w3m-button/index.tsx +2 -2
- package/src/modal/w3m-modal/index.tsx +2 -0
- package/src/modal/w3m-network-button/index.tsx +10 -6
- package/src/partials/w3m-account-activity/index.tsx +16 -5
- package/src/partials/w3m-account-tokens/index.tsx +3 -2
- package/src/partials/w3m-account-wallet-features/index.tsx +15 -11
- package/src/partials/w3m-selector-modal/index.tsx +3 -2
- package/src/partials/w3m-send-input-token/index.tsx +17 -19
- package/src/partials/w3m-send-input-token/styles.ts +3 -0
- package/src/utils/NetworkUtil.ts +13 -10
- package/src/views/w3m-account-default-view/index.tsx +34 -4
- package/src/views/w3m-account-view/index.tsx +5 -3
- package/src/views/w3m-connect-view/components/custom-wallet-list.tsx +5 -2
- package/src/views/w3m-connecting-view/index.tsx +3 -1
- package/src/views/w3m-network-switch-view/index.tsx +4 -2
- package/src/views/w3m-networks-view/index.tsx +23 -12
- package/src/views/w3m-onramp-checkout-view/index.tsx +3 -2
- package/src/views/w3m-onramp-view/index.tsx +4 -3
- package/src/views/w3m-swap-view/components/select-token-view/index.tsx +3 -2
- package/src/views/w3m-unsupported-chain-view/index.tsx +7 -2
- package/src/views/w3m-wallet-compatible-networks-view/index.tsx +7 -2
- package/src/views/w3m-wallet-receive-view/index.tsx +4 -3
- package/src/views/w3m-wallet-send-preview-view/components/preview-send-details.tsx +4 -11
- package/src/views/w3m-wallet-send-preview-view/index.tsx +2 -9
- package/src/views/w3m-wallet-send-select-token-view/index.tsx +3 -4
- package/src/views/w3m-wallet-send-view/index.tsx +19 -22
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@reown/appkit-ui-react-native';
|
|
12
12
|
import {
|
|
13
13
|
ApiController,
|
|
14
|
-
|
|
14
|
+
AssetController,
|
|
15
15
|
ConnectionsController,
|
|
16
16
|
CoreHelperUtil,
|
|
17
17
|
ModalController,
|
|
@@ -28,7 +28,9 @@ export function AccountView() {
|
|
|
28
28
|
const [isLoading, setIsLoading] = useState(false);
|
|
29
29
|
const { padding } = useCustomDimensions();
|
|
30
30
|
const { activeNetwork, activeAddress } = useSnapshot(ConnectionsController.state);
|
|
31
|
+
const { networkImages } = useSnapshot(AssetController.state);
|
|
31
32
|
const address = CoreHelperUtil.getPlainAddress(activeAddress);
|
|
33
|
+
const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
|
|
32
34
|
|
|
33
35
|
const onProfilePress = () => {
|
|
34
36
|
RouterController.push('AccountDefault');
|
|
@@ -46,7 +48,7 @@ export function AccountView() {
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
fetchBalance();
|
|
49
|
-
SendController.
|
|
51
|
+
SendController.resetState();
|
|
50
52
|
|
|
51
53
|
const balanceInterval = setInterval(() => {
|
|
52
54
|
fetchBalance();
|
|
@@ -68,7 +70,7 @@ export function AccountView() {
|
|
|
68
70
|
]}
|
|
69
71
|
>
|
|
70
72
|
<NetworkButton
|
|
71
|
-
imageSrc={
|
|
73
|
+
imageSrc={networkImage}
|
|
72
74
|
imageHeaders={ApiController._getApiHeaders()}
|
|
73
75
|
onPress={onNetworkPress}
|
|
74
76
|
style={styles.networkIcon}
|
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
type OptionsControllerState,
|
|
7
7
|
ApiController,
|
|
8
8
|
ConnectionController,
|
|
9
|
-
type ConnectionControllerState
|
|
9
|
+
type ConnectionControllerState,
|
|
10
|
+
AssetUtil
|
|
10
11
|
} from '@reown/appkit-core-react-native';
|
|
11
12
|
import { ListWallet } from '@reown/appkit-ui-react-native';
|
|
12
13
|
import { filterOutRecentWallets } from '../utils';
|
|
@@ -19,6 +20,7 @@ interface Props {
|
|
|
19
20
|
|
|
20
21
|
export function CustomWalletList({ itemStyle, onWalletPress, isWalletConnectEnabled }: Props) {
|
|
21
22
|
const { installed } = useSnapshot(ApiController.state);
|
|
23
|
+
const imageHeaders = ApiController._getApiHeaders();
|
|
22
24
|
const { recentWallets } = useSnapshot(ConnectionController.state) as ConnectionControllerState;
|
|
23
25
|
const { customWallets } = useSnapshot(OptionsController.state) as OptionsControllerState;
|
|
24
26
|
const RECENT_COUNT = recentWallets?.length && installed.length ? 1 : recentWallets?.length ?? 0;
|
|
@@ -32,7 +34,8 @@ export function CustomWalletList({ itemStyle, onWalletPress, isWalletConnectEnab
|
|
|
32
34
|
return list.map(wallet => (
|
|
33
35
|
<ListWallet
|
|
34
36
|
key={wallet.id}
|
|
35
|
-
imageSrc={wallet
|
|
37
|
+
imageSrc={AssetUtil.getWalletImage(wallet)}
|
|
38
|
+
imageHeaders={imageHeaders}
|
|
36
39
|
name={wallet.name}
|
|
37
40
|
onPress={() => onWalletPress(wallet)}
|
|
38
41
|
style={itemStyle}
|
|
@@ -11,6 +11,7 @@ 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';
|
|
14
15
|
import { useAppKit } from '../../AppKitContext';
|
|
15
16
|
import { ConnectingQrCode } from '../../partials/w3m-connecting-qrcode';
|
|
16
17
|
import { ConnectingMobile } from '../../partials/w3m-connecting-mobile';
|
|
@@ -47,9 +48,10 @@ export function ConnectingView() {
|
|
|
47
48
|
ConnectionController.setWcError(false);
|
|
48
49
|
|
|
49
50
|
let connectPromise: Promise<void>;
|
|
50
|
-
// TODO: check phantom wallet id from cloud
|
|
51
51
|
if (data?.wallet?.id === 'phantom-wallet') {
|
|
52
52
|
connectPromise = connect('phantom');
|
|
53
|
+
} else if (data?.wallet?.id === CommonConstantsUtil.COINBASE_EXPLORER_ID) {
|
|
54
|
+
connectPromise = connect('coinbase');
|
|
53
55
|
} else {
|
|
54
56
|
connectPromise = connect('walletconnect', {
|
|
55
57
|
universalLink: routeData?.wallet?.link_mode ?? undefined
|
|
@@ -2,7 +2,7 @@ import { useSnapshot } from 'valtio';
|
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import {
|
|
4
4
|
ApiController,
|
|
5
|
-
|
|
5
|
+
AssetController,
|
|
6
6
|
ConnectionController,
|
|
7
7
|
ConnectionsController,
|
|
8
8
|
RouterController,
|
|
@@ -24,10 +24,12 @@ export function NetworkSwitchView() {
|
|
|
24
24
|
const { data } = useSnapshot(RouterController.state);
|
|
25
25
|
const { recentWallets } = useSnapshot(ConnectionController.state);
|
|
26
26
|
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
27
|
+
const { networkImages } = useSnapshot(AssetController.state);
|
|
27
28
|
const [error, setError] = useState<boolean>(false);
|
|
28
29
|
const [showRetry, setShowRetry] = useState<boolean>(false);
|
|
29
30
|
const network = data?.network;
|
|
30
31
|
const wallet = recentWallets?.[0];
|
|
32
|
+
const networkImage = network ? networkImages[network.id] : undefined;
|
|
31
33
|
|
|
32
34
|
const onSwitchNetwork = async () => {
|
|
33
35
|
try {
|
|
@@ -105,7 +107,7 @@ export function NetworkSwitchView() {
|
|
|
105
107
|
<FlexView alignItems="center" padding={['2xl', 's', '4xl', 's']}>
|
|
106
108
|
<LoadingHexagon paused={error}>
|
|
107
109
|
<NetworkImage
|
|
108
|
-
imageSrc={
|
|
110
|
+
imageSrc={networkImage}
|
|
109
111
|
imageHeaders={ApiController._getApiHeaders()}
|
|
110
112
|
size="lg"
|
|
111
113
|
/>
|
|
@@ -10,19 +10,22 @@ import {
|
|
|
10
10
|
} from '@reown/appkit-ui-react-native';
|
|
11
11
|
import {
|
|
12
12
|
ApiController,
|
|
13
|
-
NetworkController,
|
|
14
13
|
RouterController,
|
|
15
14
|
EventsController,
|
|
16
15
|
ConnectionsController,
|
|
17
|
-
|
|
16
|
+
ModalController,
|
|
17
|
+
OptionsController,
|
|
18
|
+
AssetController
|
|
18
19
|
} from '@reown/appkit-core-react-native';
|
|
19
20
|
import type { AppKitNetwork } from '@reown/appkit-common-react-native';
|
|
20
21
|
import { useCustomDimensions } from '../../hooks/useCustomDimensions';
|
|
21
22
|
import styles from './styles';
|
|
22
23
|
import { useAppKit } from '../../AppKitContext';
|
|
24
|
+
import { useSnapshot } from 'valtio';
|
|
23
25
|
|
|
24
26
|
export function NetworksView() {
|
|
25
|
-
const {
|
|
27
|
+
const { networks, isConnected } = useSnapshot(ConnectionsController.state);
|
|
28
|
+
const { networkImages } = useSnapshot(AssetController.state);
|
|
26
29
|
const imageHeaders = ApiController._getApiHeaders();
|
|
27
30
|
const { maxWidth: width, padding } = useCustomDimensions();
|
|
28
31
|
const numColumns = 4;
|
|
@@ -33,22 +36,31 @@ export function NetworksView() {
|
|
|
33
36
|
);
|
|
34
37
|
const { switchNetwork } = useAppKit();
|
|
35
38
|
|
|
39
|
+
const networkList = isConnected ? ConnectionsController.getConnectedNetworks() : networks;
|
|
40
|
+
|
|
36
41
|
const onHelpPress = () => {
|
|
37
42
|
RouterController.push('WhatIsANetwork');
|
|
38
43
|
EventsController.sendEvent({ type: 'track', event: 'CLICK_NETWORK_HELP' });
|
|
39
44
|
};
|
|
40
45
|
|
|
41
46
|
const networksTemplate = () => {
|
|
42
|
-
//TODO: should show requested networks disabled
|
|
43
|
-
// const networks = CoreHelperUtil.sortNetworks(approvedCaipNetworkIds, requestedCaipNetworks);
|
|
44
|
-
const networks = ConnectionsController.getConnectedNetworks();
|
|
45
|
-
|
|
46
47
|
const onNetworkPress = async (network: AppKitNetwork) => {
|
|
47
48
|
await switchNetwork(network);
|
|
48
|
-
|
|
49
|
+
|
|
50
|
+
if (RouterController.state.history.length > 1) {
|
|
51
|
+
RouterController.goBack();
|
|
52
|
+
} else {
|
|
53
|
+
ModalController.close();
|
|
54
|
+
}
|
|
49
55
|
};
|
|
50
56
|
|
|
51
|
-
return
|
|
57
|
+
return networkList.map(network => {
|
|
58
|
+
const isSelected = ConnectionsController.state.isConnected
|
|
59
|
+
? ConnectionsController.state.activeCaipNetworkId === network.caipNetworkId
|
|
60
|
+
: OptionsController.state.defaultNetwork?.caipNetworkId === network.caipNetworkId;
|
|
61
|
+
// eslint-disable-next-line valtio/state-snapshot-rule
|
|
62
|
+
const networkImage = network ? networkImages[network.id] : undefined;
|
|
63
|
+
|
|
52
64
|
return (
|
|
53
65
|
<View
|
|
54
66
|
key={network.id}
|
|
@@ -64,10 +76,9 @@ export function NetworksView() {
|
|
|
64
76
|
testID={`w3m-network-switch-${network.name ?? network.id}`}
|
|
65
77
|
name={network.name ?? 'Unknown'}
|
|
66
78
|
type="network"
|
|
67
|
-
imageSrc={
|
|
79
|
+
imageSrc={networkImage}
|
|
68
80
|
imageHeaders={imageHeaders}
|
|
69
|
-
|
|
70
|
-
selected={caipNetwork?.id === network.id}
|
|
81
|
+
selected={isSelected}
|
|
71
82
|
onPress={() => onNetworkPress(network)}
|
|
72
83
|
/>
|
|
73
84
|
</View>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
AssetController,
|
|
3
3
|
ConnectionsController,
|
|
4
4
|
OnRampController,
|
|
5
5
|
RouterController,
|
|
@@ -23,12 +23,13 @@ import { NumberUtil, StringUtil } from '@reown/appkit-common-react-native';
|
|
|
23
23
|
export function OnRampCheckoutView() {
|
|
24
24
|
const Theme = useTheme();
|
|
25
25
|
const { themeMode } = useSnapshot(ThemeController.state);
|
|
26
|
+
const { networkImages } = useSnapshot(AssetController.state);
|
|
26
27
|
const { selectedQuote, selectedPaymentMethod, purchaseCurrency } = useSnapshot(
|
|
27
28
|
OnRampController.state
|
|
28
29
|
);
|
|
29
30
|
|
|
30
31
|
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
31
|
-
const networkImage =
|
|
32
|
+
const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
|
|
32
33
|
|
|
33
34
|
const value = NumberUtil.roundNumber(selectedQuote?.destinationAmount ?? 0, 6, 5);
|
|
34
35
|
const symbol = selectedQuote?.destinationCurrencyCode;
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
ThemeController,
|
|
8
8
|
RouterController,
|
|
9
9
|
type OnRampControllerState,
|
|
10
|
-
AssetUtil,
|
|
11
10
|
SnackController,
|
|
12
11
|
ConstantsUtil,
|
|
13
|
-
ConnectionsController
|
|
12
|
+
ConnectionsController,
|
|
13
|
+
AssetController
|
|
14
14
|
} from '@reown/appkit-core-react-native';
|
|
15
15
|
import {
|
|
16
16
|
Button,
|
|
@@ -52,6 +52,7 @@ export function OnRampView() {
|
|
|
52
52
|
initialLoading
|
|
53
53
|
} = useSnapshot(OnRampController.state) as OnRampControllerState;
|
|
54
54
|
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
55
|
+
const { networkImages } = useSnapshot(AssetController.state);
|
|
55
56
|
const [searchValue, setSearchValue] = useState('');
|
|
56
57
|
const [isCurrencyModalVisible, setIsCurrencyModalVisible] = useState(false);
|
|
57
58
|
const [isPaymentMethodModalVisible, setIsPaymentMethodModalVisible] = useState(false);
|
|
@@ -59,7 +60,7 @@ export function OnRampView() {
|
|
|
59
60
|
const suggestedValues = getCurrencySuggestedValues(paymentCurrency);
|
|
60
61
|
const purchaseCurrencyCode =
|
|
61
62
|
purchaseCurrency?.currencyCode?.split('_')[0] ?? purchaseCurrency?.currencyCode;
|
|
62
|
-
const networkImage =
|
|
63
|
+
const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
|
|
63
64
|
|
|
64
65
|
const getQuotes = useCallback(() => {
|
|
65
66
|
if (OnRampController.canGenerateQuote()) {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from '@reown/appkit-ui-react-native';
|
|
15
15
|
|
|
16
16
|
import {
|
|
17
|
-
|
|
17
|
+
AssetController,
|
|
18
18
|
ConnectionsController,
|
|
19
19
|
SwapController,
|
|
20
20
|
type SwapControllerState,
|
|
@@ -36,11 +36,12 @@ export function SwapSelectTokenView({ onClose, type }: Props) {
|
|
|
36
36
|
const { padding } = useCustomDimensions();
|
|
37
37
|
const Theme = useTheme();
|
|
38
38
|
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
39
|
+
const { networkImages } = useSnapshot(AssetController.state);
|
|
39
40
|
const { sourceToken, suggestedTokens, myTokensWithBalance } = useSnapshot(
|
|
40
41
|
SwapController.state
|
|
41
42
|
) as SwapControllerState;
|
|
42
43
|
|
|
43
|
-
const networkImage =
|
|
44
|
+
const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
|
|
44
45
|
const [tokenSearch, setTokenSearch] = useState<string>('');
|
|
45
46
|
const isSourceToken = type === 'sourceToken';
|
|
46
47
|
|
|
@@ -2,13 +2,18 @@ import { useSnapshot } from 'valtio';
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { FlatList } from 'react-native';
|
|
4
4
|
import { Icon, ListItem, Separator, Text } from '@reown/appkit-ui-react-native';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
ApiController,
|
|
7
|
+
AssetController,
|
|
8
|
+
ConnectionsController
|
|
9
|
+
} from '@reown/appkit-core-react-native';
|
|
6
10
|
import type { AppKitNetwork } from '@reown/appkit-common-react-native';
|
|
7
11
|
import { useAppKit } from '../../AppKitContext';
|
|
8
12
|
import styles from './styles';
|
|
9
13
|
|
|
10
14
|
export function UnsupportedChainView() {
|
|
11
15
|
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
16
|
+
const { networkImages } = useSnapshot(AssetController.state);
|
|
12
17
|
const [disconnecting, setDisconnecting] = useState(false);
|
|
13
18
|
//TODO: should show requested networks disabled
|
|
14
19
|
// const networks = CoreHelperUtil.sortNetworks(approvedCaipNetworkIds, requestedCaipNetworks);
|
|
@@ -43,7 +48,7 @@ export function UnsupportedChainView() {
|
|
|
43
48
|
key={item.id}
|
|
44
49
|
icon="networkPlaceholder"
|
|
45
50
|
iconBackgroundColor="gray-glass-010"
|
|
46
|
-
imageSrc={
|
|
51
|
+
imageSrc={networkImages[item.id]}
|
|
47
52
|
imageHeaders={imageHeaders}
|
|
48
53
|
onPress={() => onNetworkPress(item)}
|
|
49
54
|
testID="button-network"
|
|
@@ -1,13 +1,18 @@
|
|
|
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 {
|
|
4
|
+
import {
|
|
5
|
+
ApiController,
|
|
6
|
+
AssetController,
|
|
7
|
+
ConnectionsController
|
|
8
|
+
} from '@reown/appkit-core-react-native';
|
|
5
9
|
import { useCustomDimensions } from '../../hooks/useCustomDimensions';
|
|
6
10
|
import styles from './styles';
|
|
7
11
|
|
|
8
12
|
export function WalletCompatibleNetworks() {
|
|
9
13
|
const { padding } = useCustomDimensions();
|
|
10
14
|
const { networks, accountType } = useSnapshot(ConnectionsController.state);
|
|
15
|
+
const { networkImages } = useSnapshot(AssetController.state);
|
|
11
16
|
const isSmartAccount = accountType === 'smartAccount';
|
|
12
17
|
|
|
13
18
|
const approvedNetworks = isSmartAccount
|
|
@@ -30,7 +35,7 @@ export function WalletCompatibleNetworks() {
|
|
|
30
35
|
padding={['s', 's', 's', 's']}
|
|
31
36
|
>
|
|
32
37
|
<NetworkImage
|
|
33
|
-
imageSrc={
|
|
38
|
+
imageSrc={networkImages[network.id]}
|
|
34
39
|
imageHeaders={imageHeaders}
|
|
35
40
|
size="sm"
|
|
36
41
|
style={styles.image}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
AccountController,
|
|
14
14
|
ApiController,
|
|
15
|
-
|
|
15
|
+
AssetController,
|
|
16
16
|
ConnectionsController,
|
|
17
17
|
CoreHelperUtil,
|
|
18
18
|
OptionsController,
|
|
@@ -23,11 +23,12 @@ import { useCustomDimensions } from '../../hooks/useCustomDimensions';
|
|
|
23
23
|
|
|
24
24
|
export function WalletReceiveView() {
|
|
25
25
|
const { profileName } = useSnapshot(AccountController.state);
|
|
26
|
+
const { networkImages } = useSnapshot(AssetController.state);
|
|
26
27
|
const { activeNetwork, networks, activeAddress, accountType } = useSnapshot(
|
|
27
28
|
ConnectionsController.state
|
|
28
29
|
);
|
|
29
30
|
const address = CoreHelperUtil.getPlainAddress(activeAddress);
|
|
30
|
-
const networkImage =
|
|
31
|
+
const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
|
|
31
32
|
const { padding } = useCustomDimensions();
|
|
32
33
|
const canCopy = OptionsController.isClipboardAvailable();
|
|
33
34
|
const isSmartAccount = accountType === 'smartAccount';
|
|
@@ -41,7 +42,7 @@ export function WalletReceiveView() {
|
|
|
41
42
|
const imagesArray = approvedNetworks
|
|
42
43
|
.filter(network => network?.id)
|
|
43
44
|
.slice(0, 5)
|
|
44
|
-
.map(network =>
|
|
45
|
+
.map(network => AssetController.state.networkImages[network.id])
|
|
45
46
|
.filter(Boolean) as string[];
|
|
46
47
|
|
|
47
48
|
const label = UiUtil.getTruncateString({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AssetController } from '@reown/appkit-core-react-native';
|
|
2
2
|
import type { AppKitNetwork } from '@reown/appkit-common-react-native';
|
|
3
3
|
import {
|
|
4
4
|
BorderRadius,
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
useTheme
|
|
11
11
|
} from '@reown/appkit-ui-react-native';
|
|
12
12
|
import { StyleSheet, type StyleProp, type ViewStyle } from 'react-native';
|
|
13
|
+
import { useSnapshot } from 'valtio';
|
|
13
14
|
|
|
14
15
|
export interface PreviewSendDetailsProps {
|
|
15
16
|
address?: string;
|
|
@@ -23,10 +24,10 @@ export function PreviewSendDetails({
|
|
|
23
24
|
address,
|
|
24
25
|
name,
|
|
25
26
|
activeNetwork,
|
|
26
|
-
networkFee,
|
|
27
27
|
style
|
|
28
28
|
}: PreviewSendDetailsProps) {
|
|
29
29
|
const Theme = useTheme();
|
|
30
|
+
const { networkImages } = useSnapshot(AssetController.state);
|
|
30
31
|
|
|
31
32
|
const formattedName = UiUtil.getTruncateString({
|
|
32
33
|
string: name ?? '',
|
|
@@ -42,7 +43,7 @@ export function PreviewSendDetails({
|
|
|
42
43
|
truncate: 'middle'
|
|
43
44
|
});
|
|
44
45
|
|
|
45
|
-
const networkImage =
|
|
46
|
+
const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
|
|
46
47
|
|
|
47
48
|
return (
|
|
48
49
|
<FlexView
|
|
@@ -52,14 +53,6 @@ export function PreviewSendDetails({
|
|
|
52
53
|
<Text variant="small-400" color="fg-200" style={styles.title}>
|
|
53
54
|
Details
|
|
54
55
|
</Text>
|
|
55
|
-
<FlexView style={[styles.item, { backgroundColor: Theme['gray-glass-002'] }]}>
|
|
56
|
-
<Text variant="small-400" color="fg-150">
|
|
57
|
-
Network cost
|
|
58
|
-
</Text>
|
|
59
|
-
<Text variant="small-400" color="fg-100">
|
|
60
|
-
${UiUtil.formatNumberToLocalString(networkFee, 2)}
|
|
61
|
-
</Text>
|
|
62
|
-
</FlexView>
|
|
63
56
|
<FlexView style={[styles.item, { backgroundColor: Theme['gray-glass-002'] }]}>
|
|
64
57
|
<Text variant="small-400" color="fg-150">
|
|
65
58
|
{formattedName || 'Address'}
|
|
@@ -15,14 +15,8 @@ import { PreviewSendDetails } from './components/preview-send-details';
|
|
|
15
15
|
export function WalletSendPreviewView() {
|
|
16
16
|
const { padding } = useCustomDimensions();
|
|
17
17
|
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
receiverAddress,
|
|
21
|
-
receiverProfileName,
|
|
22
|
-
receiverProfileImageUrl,
|
|
23
|
-
gasPriceInUSD,
|
|
24
|
-
loading
|
|
25
|
-
} = useSnapshot(SendController.state);
|
|
18
|
+
const { token, receiverAddress, receiverProfileName, receiverProfileImageUrl, loading } =
|
|
19
|
+
useSnapshot(SendController.state);
|
|
26
20
|
|
|
27
21
|
const getSendValue = () => {
|
|
28
22
|
if (SendController.state.token?.price && SendController.state.sendTokenAmount) {
|
|
@@ -109,7 +103,6 @@ export function WalletSendPreviewView() {
|
|
|
109
103
|
</FlexView>
|
|
110
104
|
<PreviewSendDetails
|
|
111
105
|
style={styles.details}
|
|
112
|
-
networkFee={gasPriceInUSD}
|
|
113
106
|
address={receiverAddress}
|
|
114
107
|
name={receiverProfileName}
|
|
115
108
|
activeNetwork={activeNetwork}
|
|
@@ -3,7 +3,7 @@ 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
|
-
|
|
6
|
+
AssetController,
|
|
7
7
|
ConnectionsController,
|
|
8
8
|
RouterController,
|
|
9
9
|
SendController
|
|
@@ -17,8 +17,8 @@ import styles from './styles';
|
|
|
17
17
|
export function WalletSendSelectTokenView() {
|
|
18
18
|
const { padding } = useCustomDimensions();
|
|
19
19
|
const { activeNetwork, balances } = useSnapshot(ConnectionsController.state);
|
|
20
|
-
const {
|
|
21
|
-
const networkImage =
|
|
20
|
+
const { networkImages } = useSnapshot(AssetController.state);
|
|
21
|
+
const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
|
|
22
22
|
const [tokenSearch, setTokenSearch] = useState<string>('');
|
|
23
23
|
const [filteredTokens, setFilteredTokens] = useState(balances ?? []);
|
|
24
24
|
|
|
@@ -65,7 +65,6 @@ export function WalletSendSelectTokenView() {
|
|
|
65
65
|
amount={_token.quantity?.numeric || '0'}
|
|
66
66
|
currency={_token.symbol}
|
|
67
67
|
onPress={() => onTokenPress(_token)}
|
|
68
|
-
disabled={_token.address === token?.address}
|
|
69
68
|
/>
|
|
70
69
|
))
|
|
71
70
|
) : (
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect, useState } 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
|
-
SendController
|
|
9
|
-
SwapController
|
|
8
|
+
SendController
|
|
10
9
|
} from '@reown/appkit-core-react-native';
|
|
11
10
|
import { Button, FlexView, IconBox, Spacing } from '@reown/appkit-ui-react-native';
|
|
12
11
|
import { SendInputToken } from '../../partials/w3m-send-input-token';
|
|
@@ -18,24 +17,16 @@ import styles from './styles';
|
|
|
18
17
|
export function WalletSendView() {
|
|
19
18
|
const { padding } = useCustomDimensions();
|
|
20
19
|
const { keyboardShown, keyboardHeight } = useKeyboard();
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const [isBalanceLoading, setBalanceLoading] = useState(false);
|
|
21
|
+
const { token, sendTokenAmount, receiverAddress, receiverProfileName, loading } = useSnapshot(
|
|
22
|
+
SendController.state
|
|
23
|
+
);
|
|
24
24
|
|
|
25
25
|
const paddingBottom = Platform.select({
|
|
26
26
|
android: keyboardShown ? keyboardHeight + Spacing['2xl'] : Spacing['2xl'],
|
|
27
27
|
default: Spacing['2xl']
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
const fetchNetworkPrice = useCallback(async () => {
|
|
31
|
-
await SwapController.getNetworkTokenPrice();
|
|
32
|
-
const gas = await SwapController.getInitialGasPrice();
|
|
33
|
-
if (gas?.gasPrice && gas?.gasPriceInUSD) {
|
|
34
|
-
SendController.setGasPrice(gas.gasPrice);
|
|
35
|
-
SendController.setGasPriceInUsd(gas.gasPriceInUSD);
|
|
36
|
-
}
|
|
37
|
-
}, []);
|
|
38
|
-
|
|
39
30
|
const onSendPress = () => {
|
|
40
31
|
RouterController.push('WalletSendPreview');
|
|
41
32
|
};
|
|
@@ -66,7 +57,10 @@ export function WalletSendView() {
|
|
|
66
57
|
|
|
67
58
|
if (
|
|
68
59
|
SendController.state.receiverAddress &&
|
|
69
|
-
!CoreHelperUtil.isAddress(
|
|
60
|
+
!CoreHelperUtil.isAddress(
|
|
61
|
+
SendController.state.receiverAddress,
|
|
62
|
+
ConnectionsController.state.activeNamespace
|
|
63
|
+
)
|
|
70
64
|
) {
|
|
71
65
|
return 'Invalid address';
|
|
72
66
|
}
|
|
@@ -79,11 +73,14 @@ export function WalletSendView() {
|
|
|
79
73
|
};
|
|
80
74
|
|
|
81
75
|
useEffect(() => {
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
async function fetchBalance() {
|
|
77
|
+
setBalanceLoading(true);
|
|
78
|
+
await ConnectionsController.fetchBalance();
|
|
79
|
+
setBalanceLoading(false);
|
|
84
80
|
}
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
|
|
82
|
+
fetchBalance();
|
|
83
|
+
}, []);
|
|
87
84
|
|
|
88
85
|
const actionText = getActionText();
|
|
89
86
|
|
|
@@ -97,9 +94,9 @@ export function WalletSendView() {
|
|
|
97
94
|
<SendInputToken
|
|
98
95
|
token={token}
|
|
99
96
|
sendTokenAmount={sendTokenAmount}
|
|
100
|
-
gasPrice={Number(gasPrice)}
|
|
101
97
|
style={styles.tokenInput}
|
|
102
98
|
onTokenPress={() => RouterController.push('WalletSendSelectToken')}
|
|
99
|
+
loading={isBalanceLoading}
|
|
103
100
|
/>
|
|
104
101
|
<FlexView alignItems="center" justifyContent="center" style={styles.addressContainer}>
|
|
105
102
|
<SendInputAddress value={receiverProfileName || receiverAddress} />
|
|
@@ -119,7 +116,7 @@ export function WalletSendView() {
|
|
|
119
116
|
style={styles.sendButton}
|
|
120
117
|
onPress={onSendPress}
|
|
121
118
|
disabled={!actionText.includes('Preview send')}
|
|
122
|
-
loading={loading}
|
|
119
|
+
loading={loading || isBalanceLoading}
|
|
123
120
|
>
|
|
124
121
|
{actionText}
|
|
125
122
|
</Button>
|