👤UserProfiles
Users can give as little or as much information about themselves as they wish
Table of Contents
Events
logProfileUpdated
This event is emitted when a user or group profile is updated.
logNewUser
This event is emitted when a new user joins the platform.
hashtagToVerify
This event is emitted when a user address needs verification.
logSaveNFTAvatar
This event is emitted when an NFT avatar is saved for a user.
Public Functions
updateProfile
Updates a user or group profile details. If it's a group profile, only the owner has access to make updates. For new users, it sets up their initial profile.
Parameters
location
string calldata
The user or group's location
avatar
string calldata
A URI for the user or group's avatar picture
_uri
string calldata
A URI to publicly share for the user or group's profile
_bio
string calldata
A bio of the user or group
groupID
uint256
The Group ID to update the profile for. 0 for user profile.
Returns
This function doesn't return a value.
Example
let location = "New York";
let avatar = "https://example.com/avatar.jpg";
let uri = "https://example.com/profile";
let bio = "Bio of the user";
let groupID = 0; // for user profile
await contractInstance.updateProfile(location, avatar, uri, bio, groupID);
setNFTAsAvatar
Sets an NFT as the profile photo for a user or group. Only the owner of the NFT can set it as an avatar. The function will connect to the contract of the NFT provided and verify ownership of NFT by the wallet of the user calling the function.
Parameters
_nftContract
address
The contract address of the NFT
tokenId
uint256
The token ID of the NFT owned by the caller
groupID
uint256
The Group ID to update the avatar for. 0 for user profile.
Returns
This function doesn't return a value.
Example
let nftContract = "0x1234..."; // contract address
let tokenId = 123456; // token ID
let groupID = 0; // for user profile
await contractInstance.setNFTAsAvatar(nftContract, tokenId, groupID);
follow
Allows a user to follow another user. Users can't follow themselves, and they can't follow more than a maximum number of users (maxFollow).
Parameters
toFollow
address
The address of the user to follow
Returns
This function doesn't return a value.
Example
let toFollow = "0x1234..."; // address of the user to follow
await contractInstance.follow(toFollow);
unfollow
Allows a user to unfollow another user. Users can't unfollow themselves.
Parameters
toUnfollow
address
The address of the user to unfollow
Returns
This function doesn't return a value.
Example
let toUnfollow = "0x1234..."; // address of the user to unfollow
await contractInstance.unfollow(toUnfollow);
getProfile
Fetches the profile details of a user.
Parameters
_user
address
The address of the user
Returns
This function returns a string for each: URI, Avatar, Location, and Bio of the user.
Example
let userAddress = "0x1234..."; // address of the user
let userProfile = await contractInstance.getProfile(userAddress);
console.log(userProfile);
Last updated