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
.
React Node.js GraphQL
Copy 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>' ,
handle : 'john-doe-123'
})
console .log ( 'profile' , profile)
}
return (
<>
< button onClick = {onClick}>Submit</ button >
</>
)
}
Copy import { ProfilesClient } from '@futureverse/asset-register/profiles'
const pc = new ProfilesClient ({
...
})
const setProfileAvatar = async () => {
const profile = await pc .setProfileAvatar ({
collectionId : '7672:root:123456' ,
tokenId : '1' ,
owner : '<FUTUREPASS_ADDRESS>' ,
handle : 'john-doe-123'
})
return profile
}
setProfileAvatar ()
Mutation
Copy mutation SetProfileAvatar ($input: SetProfileAvatarInput ! ) {
setProfileAvatar(input: $input) {
profile {
displayName
handle
owner
avatar {
asset {
tokenId
collectionId
}
}
}
}
}
Variables
Copy {
"input" : {
"collectionId" : "7672:root:123456" ,
"tokenId: " 1 ",
" owner ": " <FUTUREPASS_ADDRESS> ",
" handle ": " john-doe-123 "
}
}
Auth header
Copy authorization: <FUTUREPASS_ID_TOKEN>