Circles Data Methods
Circles Data class provides various methods to query and interact with Circles' data, such as balances, transaction history, trust relations, group memberships, and avatar information. It is built around the Circles RPC to facilitate communication with the blockchain and retrieve relevant data. The CirclesData
class exposes methods for both CRCv1 and CRCv2 tokens, trust events, and group information, as well as subscriptions to events.
1. getTotalBalance
getTotalBalance
Gets the total CRC V1 balance of an address.
Parameters:
avatar
: The address to get the CRC balance for.asTimeCircles
(optional): Return the balance as TimeCircles or not (default istrue
).
Returns:
A Promise<string>
representing the total balance.
Usage Example:
2. getTotalBalanceV2
getTotalBalanceV2
Gets the total CRC V2 balance of an address.
Parameters:
avatar
: The address to get the CRC balance for.asTimeCircles
(optional): Return the balance as TimeCircles or not (default istrue
).
Returns:
A Promise<string>
representing the total balance.
Usage Example:
3. getTokenBalances
getTokenBalances
Gets the detailed token balances of an address.
Parameters:
avatar
: The address to get the token balances for.
Returns:
A Promise<TokenBalanceRow[]>
containing the token balances.
Usage Example:
4. getTransactionHistory
getTransactionHistory
Gets the transaction history of an address (incoming/outgoing transactions and CRC minting).
Parameters:
avatar
: The address to get the transaction history for.pageSize
: The maximum number of transactions per page.
Returns:
A CirclesQuery<TransactionHistoryRow>
object.
Usage Example:
5. getTrustRelations
getTrustRelations
Gets the current incoming and outgoing trust relations of an address.
Parameters:
avatar
: The address to get the trust list for.pageSize
: The maximum number of trust relations per page.
Returns:
A CirclesQuery<TrustListRow>
object.
Usage Example:
6. getAggregatedTrustRelations
getAggregatedTrustRelations
Gets all trust relations of an avatar and groups mutual trust relations together.
Parameters:
avatarAddress
: The address to get the trust relations for.
Returns:
A Promise<TrustRelationRow[]>
representing the trust relations.
Usage Example:
7. getAvatarInfo
getAvatarInfo
Gets basic information about an avatar.
Parameters:
avatar
: The address to check.
Returns:
A Promise<AvatarRow | undefined>
with the avatar info or undefined
if not found.
Usage Example:
8. getAvatarInfos
getAvatarInfos
Gets basic information about multiple avatars.
Parameters:
avatars
: The addresses to check.
Returns:
A Promise<AvatarRow[]>
containing avatar information.
Usage Example:
9. getTokenInfo
getTokenInfo
Gets the token info for a given token address.
Parameters:
address
: The address of the token.
Returns:
A Promise<TokenInfoRow | undefined>
with the token info or undefined
if not found.
Usage Example:
10. subscribeToEvents
subscribeToEvents
Subscribes to Circles events.
Parameters:
avatar
(optional): The avatar to subscribe to. If not provided, all events are subscribed to.
Returns:
A Promise<Observable<CirclesEvent>>
representing the event stream.
Usage Example:
11. getEvents
getEvents
Gets the events for a given avatar in a block range.
Parameters:
avatar
(optional): The avatar to get the events for.fromBlock
(optional): The starting block number.toBlock
(optional): The ending block number.eventTypes
(optional): Types of events to filter.filters
(optional): Additional filter criteria.sortAscending
(optional): Whether to sort events in ascending order.
Returns:
A Promise<CirclesEvent[]>
representing the events.
Usage Example:
12. getInvitations
getInvitations
Gets the invitations sent by an avatar.
Parameters:
avatar
: The avatar to get the invitations for.pageSize
: The maximum number of invitations per page.
Returns:
A CirclesQuery<InvitationRow>
object.
Usage Example:
13. getInvitedBy
getInvitedBy
Gets the avatar that invited the given avatar.
Parameters:
avatar
: The address of the invited avatar.
Returns:
A Promise<string | undefined>
with the address of the inviting avatar or undefined
if not found.
Usage Example:
14. findGroups
findGroups
Gets the list of groups.
Parameters:
pageSize
: The maximum number of groups per page.params
(optional): Query parameters to filter groups.
Returns:
A CirclesQuery<GroupRow>
object.
Usage Example:
15. getGroupMemberships
getGroupMemberships
Gets the group memberships of an avatar.
Parameters:
avatar
: The avatar to get the group memberships for.pageSize
: The maximum number of group memberships per page.
Returns:
A CirclesQuery<GroupMembershipRow>
object.
Usage Example:
16. getMetadataCidForAddress
getMetadataCidForAddress
Gets the metadata CID for an address.
Parameters:
address
: The address to get the metadata CID for.
Returns:
A Promise<string | undefined>
with the CID or undefined
if not found.
Usage Example:
Last updated