Skip to main content

NFTs

This method allows you to get all the NFTs of an specific user.

Example

import Facenote from '@facenote/webapp-sdk'

const CLIENT_ID = <YOUR_CLIENT_ID>
const CLIENT_SECRET = <YOUR_CLIENT_SECRET>
const DEVICE_ID = <YOUR_DEVICE_ID>

const facenote = new Facenote()
await facenote.initialize(CLIENT_ID, CLIENT_SECRET, DEVICE_ID)

const userId = <ID_USED_TO_ENROLL_USER>

const userTokens = await facenote.getUserTokens(userId)
/* userTokens example:
[
{
"tokenId": "4f78d661-a3eb-4c5c-bd71-7d88e5b6a5b2",
"metadata": "{\"name\":\"FaceToken\",\"image\":\"ipfs://Qma2d16E8Z8B3pGHLo5jBZd5ACeoWjwhCUKzmQJXx3BJq7/\",\"attributes\":[],\"description\":\"Facenote FaceToken\"}",
"cidIpfs": "Qma2d16E8Z8B3pGHLo5jBZd5ACeoWjwhCUKzmQJXx3BJq7",
"blockchainTransaction": "0x994ea8f5a1d8972f9b0b642f43c1142da89a04607c5cd657a7ee9d695025b0ab",
"blockchain": "polygon",
"status": "completed",
"faceTokenId": "32",
"blockchainNetwork": "mainnet",
"tokenType": "FaceToken",
"createdDate": "Wed Feb 01 2023 14:29:54 GMT+0000 (Coordinated Universal Time)",
"imageUrl": "https://facenote.infura-ipfs.io/ipfs/Qma2d16E8Z8B3pGHLo5jBZd5ACeoWjwhCUKzmQJXx3BJq7"
}
]
*/

// Get user FaceToken:
const userFaceToken = userTokens.find(token => {
return token.tokenType === 'FaceToken'
})

// Get user FaceToken image url:
const userFaceTokenImageUrl = userFaceToken.imageUrl