Asset Management Solution
Build powerful asset management applications with NUVA Labs' comprehensive asset APIs. This solution covers everything from asset registration to ownership tracking and compliance reporting.
Overview
The Asset Management solution provides APIs for:
- Asset Registration: Create and register digital assets
- Ownership Tracking: Monitor asset ownership and transfers
- Metadata Management: Store and update asset information
- Compliance Reporting: Generate regulatory reports
- Asset Discovery: Search and discover available assets
Key Features
🏷️ Asset Registration
- Create new digital assets with custom metadata
- Define asset properties and constraints
- Set ownership and transfer rules
- Register with regulatory authorities
👥 Ownership Management
- Track asset ownership changes
- Monitor transfer history
- Manage ownership permissions
- Handle fractional ownership
📊 Compliance & Reporting
- Generate regulatory reports
- Track compliance status
- Monitor audit trails
- Export data for analysis
Quick Start
1. Register a New Asset
import { NUClient } from '@nu/sdk';
const client = new NUClient({
clientId: process.env.NU_CLIENT_ID,
clientSecret: process.env.NU_CLIENT_SECRET,
environment: 'production',
});
await client.authenticate();
// Register a new asset
const asset = await client.createAsset({
name: 'Digital Gold Token',
symbol: 'DGT',
description: 'A digital representation of gold',
totalSupply: 1000000,
decimals: 18,
metadata: {
category: 'precious-metals',
compliance: 'regulated',
issuer: 'Gold Reserve Inc.',
},
});
console.log('Asset created:', asset.id);
2. Query Asset Information
// Get asset details
const assetDetails = await client.getAsset(asset.id);
console.log('Asset details:', assetDetails);
// Search assets
const searchResults = await client.searchAssets({
query: 'gold',
category: 'precious-metals',
limit: 10,
});
console.log('Found assets:', searchResults.length);
3. Track Ownership
// Get asset ownership
const ownership = await client.getAssetOwnership(asset.id);
console.log('Current owners:', ownership.owners);
// Get transfer history
const transfers = await client.getAssetTransfers(asset.id, {
limit: 50,
fromDate: '2024-01-01',
});
console.log('Transfer history:', transfers.length);
API Reference
Asset Management Endpoints
| Endpoint | Method | Description |
|---|---|---|
/assets | GET | List all assets |
/assets | POST | Create new asset |
/assets/{id} | GET | Get asset details |
/assets/{id} | PUT | Update asset |
/assets/{id}/ownership | GET | Get ownership info |
/assets/{id}/transfers | GET | Get transfer history |
/assets/search | GET | Search assets |
Core Operations
Create Asset
const asset = await client.createAsset({
name: 'Asset Name',
symbol: 'SYMBOL',
description: 'Asset description',
totalSupply: 1000000,
decimals: 18,
metadata: {
category: 'category',
compliance: 'status',
issuer: 'issuer-name',
},
});
Update Asset
const updatedAsset = await client.updateAsset(asset.id, {
description: 'Updated description',
metadata: {
...asset.metadata,
updatedAt: new Date().toISOString(),
},
});
Transfer Asset
const transfer = await client.transferAsset({
assetId: asset.id,
from: 'sender-account-id',
to: 'receiver-account-id',
amount: 100,
memo: 'Transfer memo',
});
Use Cases
1. Digital Collectibles
// Create a digital collectible
const collectible = await client.createAsset({
name: 'Rare Digital Art #1',
symbol: 'RDA1',
description: 'A unique digital artwork',
totalSupply: 1,
decimals: 0,
metadata: {
category: 'art',
artist: 'Digital Artist',
rarity: 'legendary',
attributes: {
color: 'blue',
style: 'abstract',
year: '2024',
},
},
});
2. Tokenized Real Estate
// Create a real estate token
const propertyToken = await client.createAsset({
name: 'Manhattan Office Building',
symbol: 'MOB',
description: 'Tokenized ownership of office building',
totalSupply: 1000,
decimals: 2,
metadata: {
category: 'real-estate',
propertyType: 'commercial',
location: 'Manhattan, NY',
value: 50000000,
compliance: 'SEC-regulated',
},
});
3. Supply Chain Tracking
// Create a supply chain asset
const productToken = await client.createAsset({
name: 'Organic Coffee Beans',
symbol: 'OCB',
description: 'Tracked coffee beans from farm to cup',
totalSupply: 10000,
decimals: 0,
metadata: {
category: 'agriculture',
origin: 'Colombia',
farm: 'Mountain Farm',
harvestDate: '2024-01-15',
certifications: ['organic', 'fair-trade'],
},
});
Advanced Features
Batch Operations
// Create multiple assets
const assets = await client.createAssets([
{
name: 'Asset 1',
symbol: 'A1',
totalSupply: 1000,
},
{
name: 'Asset 2',
symbol: 'A2',
totalSupply: 2000,
},
]);
Asset Analytics
// Get asset analytics
const analytics = await client.getAssetAnalytics(asset.id, {
period: '30d',
metrics: ['transfers', 'volume', 'holders'],
});
console.log('Analytics:', analytics);
Compliance Reporting
// Generate compliance report
const report = await client.generateComplianceReport({
assetId: asset.id,
reportType: 'ownership',
format: 'pdf',
includeHistory: true,
});
Best Practices
1. Asset Design
- Choose meaningful names and symbols
- Set appropriate decimal places
- Define clear metadata structure
- Consider compliance requirements
2. Ownership Management
- Implement proper access controls
- Track all ownership changes
- Maintain audit trails
- Handle edge cases
3. Performance Optimization
- Use pagination for large datasets
- Cache frequently accessed data
- Implement proper error handling
- Monitor API usage
4. Security
- Validate all inputs
- Implement proper authentication
- Use HTTPS for all requests
- Monitor for suspicious activity
Error Handling
Common Errors
try {
const asset = await client.createAsset(assetData);
} catch (error) {
switch (error.code) {
case 'INVALID_ASSET_DATA':
console.error('Invalid asset data provided');
break;
case 'DUPLICATE_SYMBOL':
console.error('Asset symbol already exists');
break;
case 'INSUFFICIENT_PERMISSIONS':
console.error('Insufficient permissions to create asset');
break;
default:
console.error('Unexpected error:', error.message);
}
}
Integration Examples
React Component
import React, { useState, useEffect } from 'react';
import { NUClient } from '@nu/sdk';
function AssetManager() {
const [assets, setAssets] = useState([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
const client = new NUClient({
clientId: process.env.REACT_APP_NU_CLIENT_ID,
clientSecret: process.env.REACT_APP_NU_CLIENT_SECRET,
environment: 'production',
});
const loadAssets = async () => {
try {
await client.authenticate();
const assetList = await client.getAssets();
setAssets(assetList);
} catch (error) {
console.error('Failed to load assets:', error);
} finally {
setLoading(false);
}
};
loadAssets();
}, []);
if (loading) return <div>Loading assets...</div>;
return (
<div>
<h2>Assets ({assets.length})</h2>
{assets.map((asset) => (
<div key={asset.id}>
<h3>
{asset.name} ({asset.symbol})
</h3>
<p>{asset.description}</p>
</div>
))}
</div>
);
}
Node.js Service
class AssetService {
constructor() {
this.client = new NUClient({
clientId: process.env.NU_CLIENT_ID,
clientSecret: process.env.NU_CLIENT_SECRET,
environment: 'production',
});
}
async initialize() {
await this.client.authenticate();
}
async createAsset(assetData) {
try {
return await this.client.createAsset(assetData);
} catch (error) {
console.error('Failed to create asset:', error);
throw error;
}
}
async getAsset(assetId) {
try {
return await this.client.getAsset(assetId);
} catch (error) {
console.error('Failed to get asset:', error);
throw error;
}
}
}
Next Steps
- Explore Trading & Transfers for asset trading functionality
- Learn about Data Querying for advanced data access
- Check out our API Reference for detailed endpoint documentation
- Review Best Practices for production deployment
Ready to start building? Let's explore Trading & Transfers to enable asset trading functionality!