User πŸ€–
Accessing the current users information
The User feature allows you to access information about the currently connected user.
To access the current user, you must implement a Network Enable element first.

Static User Features

Most user features are static features, meaning they are loaded as soon as the user clicks the network enable element. Additionally, some User Features have formatting and display options that allow you to customize how the returned data is displayed to the user.

Current User Address Feature

Display the current user's full Ethereum address:
1
<div
2
data-dh-feature="user"
3
data-dh-property-address="true">
4
*User Address*
5
</div>
6
​
Copied!
Tag
Accepted Values
Required
data-dh-feature
user
Yes
data-dh-property-address
true false
Yes
data-dh-modifier-display
short
optional

Displaying Shortened Addresses

To show a truncated address, you can also add data-dh-modifier-display="short" to the element like the example below:
1
<h2
2
data-dh-feature="user"
3
data-dh-property-address="true"
4
data-dh-modifier-display="short">
5
*User Address Truncated*
6
</h2>
Copied!
This will display the address in the following format 0x5...EaEA

​

User Balance

Display the current user's balance:
1
<div
2
data-dh-feature="user"
3
data-dh-property-balance>
4
*User Balance*
5
</div>
Copied!
Example Return Value: 7511222555444777333

Define the units and precision of the balance

To show the user's balance in ether add data-dh-modifier-display-units="ether"
To define the number of decimal places add data-dh-modifier-units=3
1
<div
2
data-dh-feature="user"
3
data-dh-property-balance
4
data-dh-modifier-units="ether"
5
data-dh-modifier-decimals="3">
6
*User Balance*
7
</div>
Copied!
Tag
Accepted Values
Required
data-dh-feature
user
Yes
data-dh-property-balance
none
Yes
data-dh-modifier-units
ether wei
optional
data-dh-modifier-decimals
integer
optional
Last modified 1yr ago