This SDK provides a set of functions to interact with profile processes on AO. Profiles are a digital representation of entities, such as users, organizations, or channels. These processes include specific metadata that describes the entity and can be associated with various digital assets and collections. Profiles are created, updated, and fetched using the following functions.
node >= v18.0
npm
oryarn
@permaweb/aoconnect
npm install @permaweb/aoprofile
or
yarn add @permaweb/aoprofile
import { connect, createDataItemSigner } from '@permaweb/aoconnect';
import { initAOProfile } from '@permaweb/aoprofile';
const ao = connect();
const signer = createDataItemSigner(window.arweaveWallet);
const { createProfile, updateProfile, getProfileById, getProfileByWalletAddress, getRegistryProfiles } = init({
ao,
signer,
logging: true,
});
Creates a profile, initializing a zone with specific profile relevant metadata. Note: using data urls for images will not work in NodeJS they will only work in a browser.
const profileId = await createProfile({
userName: 'Sample username',
displayName: 'Sample display name',
description: 'Sample description',
thumbnail: 'Profile image data (can be a browser data url like data: or an Arweave txid)',
banner: 'Cover image data (can be a browser data url like data: or an Arweave txid)',
});
Parameters
args
: Object containing profile details, includingusername
,displayName
,description
,thumbnail
, andbanner
Response
string | null; // Profile ID or null if creation fails
Updates a profile by modifying its metadata, such as username
, displayName
, description
, and optional image fields like thumbnail
and banner
.
const profileUpdateId = await updateProfile({
profileId: profileId,
userName: 'Sample Zone',
displayName: 'Sample Zone',
description: 'Sample description (can be a browser data url like data: or an Arweave txid)',
thumbnail: 'Profile image data (can be a browser data url like data: or an Arweave txid)',
banner: 'Cover image data',
});
Parameters
args
: The correspending Profile ID, as well as the details to update, structured similarly tocreateProfile
Response
string | null; // Profile update ID or null if update fails
Fetches a profile based on its ID. Returns a structured profile object containing the profile’s metadata, assets, and other properties associated with the profile.
const profile = await getProfileById({ profileId });
Parameters
args
: Object containing the ID to fetch specified byprofileId
Response
{
id: "ProfileProcessId",
walletAddress: "WalletAddress",
displayName: "Sample display name",
username: "Sample username",
description: "Sample description",
thumbnail: "ThumbnailTxId",
banner: "BannerTxId",
assets: [
"AssetProcessId1",
"AssetProcessId2",
"AssetProcessId3",
]
}
Fetches a profile using the wallet address associated with it. This function is useful for retrieving a profile when only the wallet address is known.
const profile = await getProfileByWalletAddress({ address: walletAddress });
Parameters
args
: Object containing the wallet address to fetch specified byaddress
Response
{
id: "ProfileProcessId",
walletAddress: "WalletAddress",
displayName: "Sample display name",
username: "Sample username",
description: "Sample description",
thumbnail: "ThumbnailTxId",
banner: "BannerTxId",
assets: [
"AssetProcessId1",
"AssetProcessId2",
"AssetProcessId3",
]
}
This function queries a profile registry process that contains information on all spawned AO profiles.
const profiles = await getRegistryProfiles({ profileIds: [ids] });
Parameters
args
: Object containing the ids to fetch specified byprofileIds
Response
[
{
id: 'ProfileProcessId',
username: 'Sample username',
thumbnail: 'ThumbnailTxId',
description: 'Sample description',
lastUpdate: '1736293783295'
}
]