🕶️Followers

KUTHULU has the ability to keep track of individual users follow list for both Users and Spaces / Groups

Table of Contents


Events

logAddFollower

Emitted when a follower is added.

Parameter
Type
Description

requester

address

The address of the requester

target

address

The address of the target

logRemoveFollower

Emitted when a follower is removed.

Parameter
Type
Description

requester

address

The address of the requester

target

address

The address of the target


Public Functions

getFollowers

Returns a list of users who are following a given address.

Parameters

Parameter
Type
Description

usrAddress

address

The address of the user to retrieve followers for.

startFrom

uint256

The number to start getting records from.

Return

Parameter
Type
Description

address[]

address array

An array of addresses of accounts that are following usrAddress.

const usrAddress = "0x123...";  // Replace with the address of the user
const startFrom = 0;  // Define the start point

const contract = new ethers.Contract(contractAddress, contractABI, provider);
const followers = await contract.getFollowers(usrAddress, startFrom);

getFollowing

Returns a list addresses that a given user is following

Parameters

Parameter
Type
Description

usrAddress

address

The address of the user to get their following list

startFrom

uint256

The number to start getting records from.

Return

Parameter
Type
Description

address[]

address array

An array of addresses of accounts that usrAddress is following.

const usrAddress = "0x123...";  // Replace with the address of the user
const startFrom = 0;  // Define the start point

const contract = new ethers.Contract(contractAddress, contractABI, provider);
const followings = await contract.getFollowing(usrAddress, startFrom);

isUserFollowing

Checks if a user is following certain address.

Is addressRequester following addressTarget?

Parameters

Parameter
Type
Description

addressRequester

address

The address of the requester (follower).

addressTarget

address

The address of the target (user being followed).

Return

Parameter
Type
Description

bool

bool

A boolean value indicating whether the requester is following the target or not.

const addressRequester = "0x123...";  // Replace with the address of the requester
const addressTarget = "0x456...";  // Replace with the address of the target

const contract = new ethers.Contract(contractAddress, contractABI, provider);
const isFollowing = await contract.isUserFollowing(addressRequester, addressTarget);

Last updated