Skip to content

Commit 367df08

Browse files
chore(clerk-js): Display shortened web3 wallet address on user profile (clerk#4074)
1 parent 0ab7c73 commit 367df08

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

.changeset/sixty-drinks-drum.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/clerk-js": patch
3+
---
4+
5+
chore(clerk-js): Display shortened web3 wallet address on user profile

packages/clerk-js/src/ui/components/UserProfile/Web3Section.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ const RemoveWeb3WalletScreen = (props: RemoveWeb3WalletScreenProps) => {
2121
);
2222
};
2323

24+
const shortenWeb3Address = (address: string) => {
25+
if (address.length <= 10) {
26+
return address;
27+
}
28+
return address.slice(0, 6) + '...' + address.slice(-4);
29+
};
30+
2431
export const Web3Section = withCardStateProvider(() => {
2532
const { user } = useUser();
2633
const card = useCardState();
@@ -60,7 +67,7 @@ export const Web3Section = withCardStateProvider(() => {
6067
justify='start'
6168
>
6269
<Text>
63-
{strategyToDisplayData[strategy].name} ({wallet.web3Wallet})
70+
{strategyToDisplayData[strategy].name} ({shortenWeb3Address(wallet.web3Wallet)})
6471
</Text>
6572
</Flex>
6673
</Box>

0 commit comments

Comments
 (0)