UNPKG

p-sdk-wallet

Version:

A comprehensive wallet SDK for React Native (pwc), supporting multi-chain and multi-account features.

266 lines (265 loc) 6.63 kB
/** * NFT Types and Interfaces for PWC Wallet SDK * Defines the structure of NFT detail responses */ /** * Creator/Artist information */ export interface NFTCreator { /** Creator's address */ address: string; /** Creator's name/username */ name?: string; /** Creator's profile image */ avatar?: string; /** Creator's bio/description */ bio?: string; /** Creator's website */ website?: string; /** Creator's social media links */ social?: { twitter?: string; instagram?: string; discord?: string; telegram?: string; youtube?: string; }; /** Royalty percentage for this creator */ royaltyPercentage?: number; /** Whether creator is verified */ verified?: boolean; /** Creator's total works count */ totalWorks?: number; /** Creator's total sales volume */ totalVolume?: { amount: string; currency: string; }; } /** * Basic NFT attribute (trait) information */ export interface NFTAttribute { trait_type: string; value: string | number; display_type?: 'number' | 'boost_number' | 'boost_percentage' | 'date'; max_value?: number; } /** * NFT metadata from IPFS or HTTP */ export interface NFTMetadata { name: string; description?: string; image?: string; external_url?: string; animation_url?: string; attributes?: NFTAttribute[]; background_color?: string; youtube_url?: string; image_data?: string; /** Creator information in metadata */ creator?: string; artist?: string; } /** * Collection information */ export interface CollectionInfo { name: string; description?: string; image?: string; external_url?: string; royalty_percentage?: number; verified?: boolean; floor_price?: { amount: string; currency: string; timestamp: number; }; total_supply?: number; owners_count?: number; /** Collection creator */ creator?: NFTCreator; /** Collection artists */ artists?: NFTCreator[]; } /** * Transaction history for an NFT */ export interface NFTTransaction { hash: string; from: string; to: string; blockNumber: number; timestamp: number; type: 'mint' | 'transfer' | 'sale' | 'bid' | 'list' | 'cancel'; price?: { amount: string; currency: string; }; gas_used?: bigint; gas_price?: bigint; /** Creator address for mint transactions */ creator?: string; } /** * Market data for an NFT */ export interface NFTMarketData { floor_price?: { amount: string; currency: string; timestamp: number; }; last_sale?: { amount: string; currency: string; timestamp: number; hash: string; }; offers?: Array<{ amount: string; currency: string; from: string; expires_at: number; }>; listings?: Array<{ amount: string; currency: string; from: string; expires_at: number; }>; rarity_rank?: number; rarity_score?: number; /** Creator royalties */ creatorRoyalties?: { percentage: number; address: string; }; } /** * Basic NFT detail interface containing essential on-chain data */ export interface NFTDetail { /** NFT contract address */ contractAddress: string; /** Token ID */ tokenId: string; /** NFT name (from metadata or fallback) */ name: string; /** NFT description (from metadata) */ description?: string; /** NFT image URL (from metadata) */ image?: string; /** NFT attributes/traits (from metadata) */ attributes?: NFTAttribute[]; /** Current owner address */ owner: string; /** Token type (ERC-721, ERC-1155, SPL-NFT) */ tokenType: 'ERC-721' | 'ERC-1155' | 'SPL-NFT'; /** Chain ID where NFT exists */ chainId: string; /** Token URI for metadata */ tokenUri?: string; /** When NFT was minted (timestamp) */ createdAt?: number; /** Last transfer timestamp */ lastTransferAt?: number; } /** * Extended NFT detail with additional blockchain data */ export interface NFTDetailExtended extends NFTDetail { /** Resolved metadata from tokenURI */ metadata?: NFTMetadata; /** Collection information */ collection?: NFTCollection; /** Transaction history from blockchain events */ transactionHistory: NFTTransaction[]; /** Source of metadata (ipfs, http) */ metadataSource?: 'ipfs' | 'http'; /** Last time data was updated */ lastUpdated: number; } /** * NFT collection information from blockchain */ export interface NFTCollection { /** Collection contract address */ contractAddress: string; /** Collection name */ name: string; /** Collection symbol */ symbol?: string; /** Token type */ tokenType: 'ERC-721' | 'ERC-1155' | 'SPL-NFT'; /** Chain ID */ chainId: string; /** Total supply */ totalSupply?: number; /** Collection description */ description?: string; /** Collection image */ image?: string; /** Collection external URL */ externalUrl?: string; } /** * NFT balance for an address */ export interface NFTBalance { /** Contract address */ contractAddress: string; /** Token IDs owned by address */ tokenIds: string[]; /** Number of tokens owned */ count: number; /** Token type */ tokenType: 'ERC-721' | 'ERC-1155' | 'SPL-NFT'; /** Chain ID */ chainId: string; } /** * NFT query options */ export interface NFTOptions { /** Include resolved metadata */ includeMetadata?: boolean; /** Include collection information */ includeCollection?: boolean; /** Include transaction history */ includeHistory?: boolean; /** Include market data (not available in pure blockchain) */ includeMarketData?: boolean; /** Include rarity data (not available in pure blockchain) */ includeRarity?: boolean; } /** * NFT search filters */ export interface NFTSearchFilters { /** Contract address */ contractAddress?: string; /** Token ID */ tokenId?: string; /** Owner address */ owner?: string; /** Token type */ tokenType?: 'ERC-721' | 'ERC-1155' | 'SPL-NFT'; /** Chain ID */ chainId?: string; } /** * NFT search result */ export interface NFTSearchResult { /** Array of NFT details */ nfts: NFTDetail[]; /** Total count */ total: number; /** Has more results */ hasMore: boolean; /** Next page token */ nextPageToken?: string; }