Skip to content

Commit f34b9a5

Browse files
chore: show metadata (#191)
* chore: show wallet info in wagmi dapp * chore: show deeplinks in wallet session details * chore: changed build number * chore: changed build number
1 parent 56fd94c commit f34b9a5

File tree

10 files changed

+164
-34
lines changed

10 files changed

+164
-34
lines changed

dapps/W3MWagmi/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ android {
102102
applicationId "com.walletconnect.web3modal.rnsample"
103103
minSdkVersion rootProject.ext.minSdkVersion
104104
targetSdkVersion rootProject.ext.targetSdkVersion
105-
versionCode 99
105+
versionCode 101
106106
versionName "1.1"
107107
resValue "string", "build_config_package", "com.w3mwagmi"
108108
}

dapps/W3MWagmi/ios/Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ PODS:
4848
- hermes-engine (0.74.3):
4949
- hermes-engine/Pre-built (= 0.74.3)
5050
- hermes-engine/Pre-built (0.74.3)
51-
- MMKV (2.0.0):
52-
- MMKVCore (~> 2.0.0)
53-
- MMKVCore (2.0.0)
51+
- MMKV (2.0.2):
52+
- MMKVCore (~> 2.0.2)
53+
- MMKVCore (2.0.2)
5454
- RCT-Folly (2024.01.01.00):
5555
- boost
5656
- DoubleConversion
@@ -1692,8 +1692,8 @@ SPEC CHECKSUMS:
16921692
fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120
16931693
glog: fdfdfe5479092de0c4bdbebedd9056951f092c4f
16941694
hermes-engine: 1f547997900dd0752dc0cc0ae6dd16173c49e09b
1695-
MMKV: f7d1d5945c8765f97f39c3d121f353d46735d801
1696-
MMKVCore: c04b296010fcb1d1638f2c69405096aac12f6390
1695+
MMKV: 3eacda84cd1c4fc95cf848d3ecb69d85ed56006c
1696+
MMKVCore: 508b4d3a8ce031f1b5c8bd235f0517fb3f4c73a9
16971697
RCT-Folly: 02617c592a293bd6d418e0a88ff4ee1f88329b47
16981698
RCTDeprecation: 4c7eeb42be0b2e95195563c49be08d0b839d22b4
16991699
RCTRequired: d530a0f489699c8500e944fde963102c42dcd0c2

dapps/W3MWagmi/src/App.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ createAppKit({
7777
siweConfig,
7878
clipboardClient,
7979
customWallets,
80+
connectorImages: {
81+
coinbaseWallet:
82+
'https://play-lh.googleusercontent.com/wrgUujbq5kbn4Wd4tzyhQnxOXkjiGqq39N4zBvCHmxpIiKcZw_Pb065KTWWlnoejsg',
83+
appKitAuth: 'https://avatars.githubusercontent.com/u/179229932',
84+
},
8085
features: {
8186
email: true,
8287
socials: ['x', 'discord', 'apple'],
Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
import React from 'react';
2-
import {
3-
Text,
4-
StyleSheet,
5-
TouchableOpacity,
6-
StyleProp,
7-
ViewStyle,
8-
View,
9-
} from 'react-native';
10-
import {Icon, IconProps} from '@reown/appkit-ui-react-native';
2+
import {StyleSheet, StyleProp, ViewStyle, View} from 'react-native';
3+
import {Icon, IconProps, Pressable, Text} from '@reown/appkit-ui-react-native';
114

125
import {useTheme} from '@/hooks/useTheme';
136

@@ -21,21 +14,26 @@ export interface CardProps {
2114

2215
export function Card({title, value, onPress, icon, style}: CardProps) {
2316
const Theme = useTheme();
24-
const backgroundColor = Theme['bg-175'];
17+
const backgroundColor = Theme['gray-glass-005'];
2518

2619
return (
27-
<TouchableOpacity
20+
<Pressable
2821
disabled={!onPress}
2922
style={[styles.container, {backgroundColor}, style]}
23+
bounceScale={0.98}
3024
onPress={onPress}>
3125
<View>
32-
<Text style={[styles.title, {color: Theme['fg-100']}]}>{title}</Text>
26+
<Text variant="small-600" style={{color: Theme['fg-100']}}>
27+
{title}
28+
</Text>
3329
{value && (
34-
<Text style={[styles.value, {color: Theme['fg-150']}]}>{value}</Text>
30+
<Text variant="small-500" style={{color: Theme['fg-150']}}>
31+
{value}
32+
</Text>
3533
)}
3634
</View>
3735
{icon && <Icon name={icon} size="sm" color={'fg-100'} />}
38-
</TouchableOpacity>
36+
</Pressable>
3937
);
4038
}
4139

@@ -49,12 +47,4 @@ const styles = StyleSheet.create({
4947
alignItems: 'center',
5048
justifyContent: 'space-between',
5149
},
52-
title: {
53-
fontSize: 14,
54-
fontWeight: 'bold',
55-
},
56-
value: {
57-
fontSize: 14,
58-
fontWeight: '500',
59-
},
6050
});
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import React from 'react';
2+
import {useWalletInfo} from '@reown/appkit-wagmi-react-native';
3+
import {
4+
BorderRadius,
5+
FlexView,
6+
IconBox,
7+
Image,
8+
Spacing,
9+
Text,
10+
} from '@reown/appkit-ui-react-native';
11+
import {useTheme} from '@reown/appkit-ui-react-native';
12+
import {StyleSheet} from 'react-native';
13+
export function WalletInfo() {
14+
const {walletInfo = {}} = useWalletInfo();
15+
const Theme = useTheme();
16+
17+
return (
18+
<FlexView
19+
style={[
20+
styles.container,
21+
{
22+
backgroundColor: Theme['gray-glass-005'],
23+
},
24+
]}>
25+
<FlexView
26+
flexDirection="row"
27+
alignItems="center"
28+
margin={['xs', '0', 's', '0']}>
29+
{walletInfo.icon ? (
30+
<Image style={styles.image} source={walletInfo?.icon} />
31+
) : (
32+
<IconBox
33+
background
34+
icon="walletPlaceholder"
35+
size="sm"
36+
style={styles.image}
37+
/>
38+
)}
39+
<Text variant="paragraph-600">{walletInfo?.name}</Text>
40+
</FlexView>
41+
<FlexView>
42+
{/* @ts-ignore */}
43+
{walletInfo?.redirect?.native && (
44+
<>
45+
<Text variant="small-600">Deep link:</Text>
46+
{/* @ts-ignore */}
47+
<Text variant="small-400">{walletInfo?.redirect?.native}</Text>
48+
</>
49+
)}
50+
{/* @ts-ignore */}
51+
{walletInfo?.redirect?.universal && (
52+
<>
53+
<Text style={styles.text} variant="small-600">
54+
Universal link:
55+
</Text>
56+
{/* @ts-ignore */}
57+
<Text variant="small-400">{walletInfo?.redirect?.universal}</Text>
58+
</>
59+
)}
60+
</FlexView>
61+
</FlexView>
62+
);
63+
}
64+
65+
const styles = StyleSheet.create({
66+
container: {
67+
padding: Spacing.m,
68+
borderRadius: BorderRadius.s,
69+
},
70+
image: {
71+
height: 25,
72+
width: 25,
73+
marginRight: 4,
74+
borderRadius: BorderRadius.full,
75+
},
76+
text: {
77+
marginTop: Spacing.xs,
78+
},
79+
});

dapps/W3MWagmi/src/screens/Settings/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {Card} from '@/components/Card';
1111
import {useTheme} from '@/hooks/useTheme';
1212
import {HomeTabScreenProps} from '@/utils/TypesUtil';
1313
import styles from './styles';
14+
import {WalletInfo} from './components/WalletInfo';
1415

1516
type Props = HomeTabScreenProps<'SettingsScreen'>;
1617

@@ -70,6 +71,7 @@ function SettingsScreen({navigation}: Props) {
7071
onPress={() => navigation.navigate('Logs')}
7172
icon="chevronRight"
7273
/>
74+
<WalletInfo />
7375
</View>
7476
</ScrollView>
7577
);

wallets/rn_cli_wallet/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ android {
8989
applicationId "com.walletconnect.web3wallet.rnsample"
9090
minSdkVersion rootProject.ext.minSdkVersion
9191
targetSdkVersion rootProject.ext.targetSdkVersion
92-
versionCode 47
92+
versionCode 54
9393
versionName "1.0"
9494
resValue "string", "build_config_package", "com.walletconnect.web3wallet.rnsample"
9595
}

wallets/rn_cli_wallet/src/components/Modal/ModalHeader.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ export function ModalHeader({
4141
</Text>
4242
</View>
4343
)}
44-
<Image
45-
source={{uri: metadata?.icons[0] ?? ''}}
46-
style={[styles.logo, {borderColor: Theme['gray-glass-010']}]}
47-
/>
48-
44+
{metadata?.icons[0] && (
45+
<Image
46+
source={{uri: metadata?.icons[0] ?? ''}}
47+
style={[styles.logo, {borderColor: Theme['gray-glass-010']}]}
48+
/>
49+
)}
4950
<Text style={[styles.title, {color}]}>{metadata?.name || 'Unknown'}</Text>
5051
{intention && <Text style={[styles.desc, {color}]}>{intention}</Text>}
5152
<View style={styles.domainContainer}>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import React from 'react';
2+
import {StyleSheet, Text} from 'react-native';
3+
4+
interface Props {
5+
session?: any;
6+
}
7+
8+
export function DappInfo({session}: Props) {
9+
const metadata = session?.peer?.metadata;
10+
11+
return (
12+
<>
13+
{metadata.redirect?.native && (
14+
<>
15+
<Text style={[styles.boldText]}>Deep link:</Text>
16+
<Text>{metadata.redirect?.native}</Text>
17+
</>
18+
)}
19+
{metadata.redirect?.universal && (
20+
<>
21+
<Text style={[styles.boldText, styles.subtitle]}>
22+
Universal link:
23+
</Text>
24+
<Text>{metadata.redirect?.universal}</Text>
25+
</>
26+
)}
27+
</>
28+
);
29+
}
30+
31+
const styles = StyleSheet.create({
32+
image: {
33+
height: 25,
34+
width: 25,
35+
marginRight: 4,
36+
borderRadius: 100,
37+
},
38+
dappContainer: {
39+
flexDirection: 'row',
40+
alignItems: 'center',
41+
marginTop: 4,
42+
marginBottom: 8,
43+
},
44+
boldText: {
45+
fontWeight: '500',
46+
},
47+
subtitle: {
48+
marginTop: 8,
49+
},
50+
});

wallets/rn_cli_wallet/src/screens/SessionDetail/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {Methods} from '@/components/Modal/Methods';
1111
import {Events} from '@/components/Modal/Events';
1212
import SettingsStore from '@/store/SettingsStore';
1313
import {RootStackScreenProps} from '@/utils/TypesUtil';
14+
import {DappInfo} from './components/DappInfo';
1415
import styles from './styles';
1516

1617
type Props = RootStackScreenProps<'SessionDetail'>;
@@ -139,6 +140,8 @@ export default function SessionDetail({route}: Props) {
139140
</View>
140141
);
141142
})}
143+
<DappInfo session={session} />
144+
<View style={[styles.divider, {backgroundColor: Theme['bg-300']}]} />
142145
<View style={styles.datesContainer}>
143146
<Text style={[styles.dateText, {color: Theme['fg-100']}]}>Expiry</Text>
144147
<Text style={{color: Theme['fg-175']}}>

0 commit comments

Comments
 (0)