🔖Tagged

All users can tag any Ethereum based wallet address to tag them in a post, irregardless if they've every even been to the site.

The Tagged Smart Contract allows managing and querying tagged messages. Tagged messages are grouped by user or group addresses.

Table of Contents


Events

These are the events that are emitted by the contract functions.

logAddTag

This event is emitted when a new tag is added to a message.

Variable
Description

msgID

The ID of the message.

taggedAccount

The address of the tagged account.

logRemoveTag

This event is emitted when a tag is removed from a message.

Variable
Description

msgID

The ID of the message.

untaggedAccount

The address of the untagged account.

---

Public Functions

GetTaggedMessageIDs

This function can be used to get a list of all message IDs that a particular user or group is tagged in, starting from a specific message ID. It returns an array of message IDs. If the address does not exist or if there are no tagged messages, it returns an empty array.

Input
Description

usrAddress

The address of a user or group to retrieve the details for.

startFrom

The number to start getting records from.

Output
Description

uint256[]

An array of message IDs

Example:

const userAddress = "0x1234..."; // User's address
const startFrom = 10; // Start from message ID 10

const contract = new ethers.Contract(contractAddress, abi, signer);
const messageIDs = await contract.getTaggedMsgIDs(userAddress, startFrom);

console.log(messageIDs); // An array of message IDs

Last updated