Docs

suix_getOwnedObjects - List Objects Owne...

List all objects owned by a specific address on Sui blockchain. Filter by object type, paginate through results with Dwellir's high-performance Sui RPC infrastructure.

Returns a paginated list of all objects owned by a specific address on the Sui network, with support for filtering by object type.

Overview

The suix_getOwnedObjects method is essential for querying all objects owned by an address. In Sui's object-centric model, everything is represented as objects - coins, NFTs, smart contracts, and custom data structures. This method allows you to discover and enumerate all objects belonging to a specific address, making it crucial for wallet implementations, portfolio trackers, and analytics tools.

Code Examples

Common Use Cases

1. Wallet Asset Discovery

JavaScript
async function buildWalletAssets(address) {
  const portfolio = await analyzePortfolio(address);
  
  return {
    balances: portfolio.coinBalances.map(coin => ({
      symbol: coin.symbol,
      balance: coin.formattedBalance,
      usdValue: 0, // Would need price feed integration
      objectCount: coin.objectCount
    })),
    collectibles: portfolio.nftCollection.map(nft => ({
      name: nft.name,
      image: nft.imageUrl,
      collection: nft.type.split('::')[0] // Extract package ID
    })),
    totalAssets: portfolio.summary.totalObjects
  };
}

2. Object Type Analytics

JavaScript
async function analyzeObjectTypes(addresses) {
  const typeDistribution = {};
  
  for (const address of addresses) {
    const objects = await getAllObjectsPaginated(address);
    
    objects.forEach(obj => {
      const type = obj.data?.type || 'Unknown';
      typeDistribution[type] = (typeDistribution[type] || 0) + 1;
    });
  }
  
  return Object.entries(typeDistribution)
    .sort(([,a], [,b]) => b - a)
    .slice(0, 20); // Top 20 types
}

3. NFT Collection Management

JavaScript
async function manageNFTCollection(address) {
  const categorized = await categorizeOwnedObjects(address);
  const nfts = categorized.categories.nfts;
  
  // Group by collection (package)
  const collections = {};
  nfts.forEach(nft => {
    const collection = nft.type.split('::')[0];
    if (!collections[collection]) {
      collections[collection] = [];
    }
    collections[collection].push(nft);
  });
  
  return Object.entries(collections).map(([packageId, nfts]) => ({
    packageId: packageId,
    name: nfts[0]?.type.split('::')[1] || 'Unknown Collection',
    count: nfts.length,
    items: nfts.map(nft => ({
      objectId: nft.objectId,
      name: nft.name,
      image: nft.imageUrl
    }))
  }));
}

Best Practices

  1. Use pagination for addresses with many objects to avoid timeouts
  2. Filter by type when you only need specific object categories
  3. Request minimal data by configuring options appropriately
  4. Cache results for frequently accessed data to improve performance
  5. Handle empty results gracefully for addresses with no objects
  6. Monitor changes for real-time applications using periodic polling

Need help? Contact our support team or check the Sui documentation.