🤝Contacts

Rather than manipulating directly the contacts in the user profile, we recommend using the functions from our SDK.

Contacts interface

enum ConnectionType {
  CONNECT = "add-friend",
  BLOCK = "block",
}

interface Contact {
  target: string;
  namespace: string; //namespece will always be protico when using our services
  connectionType: ConnectionType;
  alias?: string;
}

Getting user contacts

const contacts: Contact[] = await ceramicClient.contact.get(address?:string);

Parameters description

ParameterDescriptionOptional

address

Wallet address associated with the user

Yes Default: Own address

Upserting a user contact

type ContactInfo = {
  connectionType?: ConnectionType;
  target: string;
  alias?: string;
};

const contacts: Contact[] = await ceramicClient.contact.upsert(contact:ContactInfo);

Parameters description

ParameterDescriptionOptional

contact

Contact information. Passing an existing target will update the contact, while passing a new one will create a new contact

No

Deleting a user contact

const contacts: Contact[] = await ceramicClient.contact.delete(address:string);

Parameters description

ParameterDescriptionOptional

address

Address of the contact to be deleted

No

To notify users when their friendship status with other users is updated, remember to make use of Protico's API after successfully saving the changes on Ceramic.

Last updated