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
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
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
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
- Use pagination for addresses with many objects to avoid timeouts
- Filter by type when you only need specific object categories
- Request minimal data by configuring options appropriately
- Cache results for frequently accessed data to improve performance
- Handle empty results gracefully for addresses with no objects
- Monitor changes for real-time applications using periodic polling
Related Methods
- sui_getObject - Get detailed object information
- suix_getBalance - Query coin balances
- suix_getCoins - Get coin objects with balances
Need help? Contact our support team or check the Sui documentation.
suix_getLatestSuiSystemState - Get Complete Sui Network State
Get the complete Sui system state including validators, staking pools, system parameters, and network governance data with Dwellir's high-performance Sui RPC infrastructure.
suix_getReferenceGasPrice - Get Current...
Get the current reference gas price on Sui blockchain. Essential for transaction cost estimation and gas optimization with Dwellir's high-performance Sui RPC infrastructure.