Circles Documentation
  • Welcome to Circles
  • Overview
    • Understanding Personal and Group Currencies
      • Personal Currencies
      • Group Currencies
    • Why Build on Circles?
    • Circles Architecture
  • Developer Docs
    • The Circles Stack
    • Circles SDK Overview
    • Quickstart Guide for Circles SDK
    • Setting Circles Profiles
    • Building with different Circles Avatars
      • Personal / Human Avatars
        • Inviting and accepting human avatars
        • Mint personal tokens
        • Fetching profile of an human avatar
        • Manage trust connections
        • Get token balances of an avatar
        • Transfer personal Circles tokens to different avatar
      • Group Avatars
        • Create Base Groups for your community.
          • Vanilla groups with V2 hub
        • Mint group tokens
        • Managing group invites
        • Find groups and memberships
        • Getting total supply of group tokens available
      • Organization Avatars
        • Creation of Organizations
        • Managing trust connections via Org avatar account
  • Tutorials and Examples
    • Setting up Circles SDK with React
  • Querying Circles profiles and data
    • Query Circles Data
    • Subscribing to Avatar events
    • Utilising CirclesQuery Class
    • Query Circles profiles
  • Circles SDK Reference
    • Circles SDK interface
    • SDK Methods
    • Circles Data Methods
    • Circles Events Types
  • Developer Support
    • Glossary
    • Past Hackathon Projects on Circles
Powered by GitBook
On this page
  • Get a profile for the avatar
  • Update metadata of the profile
  • Update profile of the avatar
  • Creating profile without an Avatar instance

Was this helpful?

Export as PDF
  1. Developer Docs
  2. Building with different Circles Avatars
  3. Personal / Human Avatars

Fetching profile of an human avatar

This section is dedicated to handling the profiles of an avatar

Get a profile for the avatar

This function fetches the current profile associated with the avatar. If no profile exists, it will return undefined.

  const profile = await avatar.getProfile();
  console.log("Avatar Profile:", profile);

Update metadata of the profile

This function updates the avatar's metadata by uploading a new content identifier (CID) to IPFS. The CID represents the new metadata for the avatar.

// IPFS CID for the new metadata
const cid = "QmYourIPFSCIDHere";

try {
  const receipt = await avatar.updateMetadata(cid);
  console.log("Metadata updated successfully:", receipt);
} catch (error) {
  console.error("Error updating metadata:", error);
}

Update profile of the avatar

This function updates the avatar’s profile and returns the IPFS CID of the newly updated profile.

const newProfile: Profile = {
  name: "Avatar Name",
  description: "Updated description for the avatar.",
  image: "ipfs://QmYourImageCIDHere", // Example IPFS image CID
};

try {
  const newCid = await avatar.updateProfile(newProfile);
  console.log("Profile updated successfully. New CID:", newCid);
} catch (error) {
  console.error("Error updating profile:", error);
}

Creating profile without an Avatar instance

const newProfile: Profile = {  
  name: "Avatar Name",  
  description: "Updated description for the avatar.",  
  imageUrl: "ipfs://QmYourImageCIDHere", // Note: changed from image to imageUrl  
};  
  
try {  
  const receipt = await sdk.createOrUpdateProfile(newProfile);  
  console.log("Profile created/updated successfully");  
} catch (error) {  
  console.error("Failed to create/update profile:", error);  
}

PreviousMint personal tokensNextManage trust connections

Last updated 16 hours ago

Was this helpful?