Get Asset Data
Retrieve comprehensive information about a loyalty pass including points, tier status, activity history, and program metadata.
Overview
The getAssetData
function fetches all data associated with a loyalty pass, providing a complete view of the user's status and history.
import { getAssetData } from '@verxioprotocol/core' const assetData = await getAssetData(context, publicKey('PASS_ADDRESS')) console.log('User XP:', assetData.xp) console.log('Current Tier:', assetData.currentTier) console.log('Owner:', assetData.owner)
Return Value
The function returns a comprehensive object with all loyalty pass data:
{ xp: number, // Current XP points lastAction: string | null, // Last action performed actionHistory: Array<{ // History of actions type: string, points: number, timestamp: number, newTotal: number }>, currentTier: string, // Current tier name tierUpdatedAt: number, // Timestamp of last tier update rewards: string[], // Available rewards name: string, // Asset name uri: string, // Asset metadata URI owner: string, // Asset owner address pass: string, // Pass public key metadata: { // Program metadata organizationName: string, brandColor?: string }, rewardTiers: Array<{ // All available reward tiers name: string, xpRequired: number, rewards: string[] }> }
Data Fields
📊 Points & Tier
xp
- Current pointscurrentTier
- Current tiertierUpdatedAt
- Last tier change
📈 Activity
lastAction
- Most recent actionactionHistory
- Complete historyrewards
- Available rewards