Set Avatar
An on chain asset can be used as the profile avatar. The user must own the asset on the wallet provided in the owner
field. The access token will be used to verify whether the user has access to the given owner
.
import {
useSetProfileAvatar,
} from '@futureverse/asset-register-react/profiles'
const Page = () => {
const { setAsync } = useSetProfileAvatar()
const onClick = async () => {
const profile = await setAsync({
collectionId: '7672:root:123456',
tokenId: '1',
owner: '<FUTUREPASS ADDRESS OR EOA ADDRESS>',
profileId: 'f9da67a9-db13-49e2-927d-0920110eb4a4',
})
console.log('profile', profile)
}
return (
<>
<button onClick={onClick}>Submit</button>
</>
)
}
import { ProfilesClient } from '@futureverse/asset-register/profiles'
import { ProfileModel } from '@futureverse/asset-register'
const pc = new ProfilesClient({
...
})
const setProfileAvatar = async () => {
const results = await pc.setProfileAvatar({
collectionId: '7672:root:123456',
tokenId: '1',
owner: '<FUTUREPASS_ADDRESS or EOA_ADDRESS>',
profileId: 'f9da67a9-db13-49e2-927d-0920110eb4a4',
}).execute()
const profile = results[0] as ProfileModel
return profile
}
setProfileAvatar()
Mutation
mutation SetProfileAvatar($input: SetProfileAvatarInput!) {
setProfileAvatar(input: $input) {
profile {
displayName
profileId
owner
avatar {
asset {
tokenId
collectionId
}
}
}
}
}
Variables
{
"input": {
"collectionId": "7672:root:123456",
"tokenId: "1",
"owner": "<FUTUREPASS_ADDRESS or EOA_ADDRESS>",
"profileId": "f9da67a9-db13-49e2-927d-0920110eb4a4"
}
}
Auth header
authorization: <FUTUREPASS_ACCESS_TOKEN>
Last updated