Enumerate Mythos player assets
Mythos inventories live in pallet_nfts::Account and pallet_nfts::Item. Although legacy guides referenced a gaming_getPlayerAssets RPC, the recommended approach is to page through the on-chain storage keys, then hydrate each item. The examples below use Dwellir’s managed endpoint https://api-mythos-archive.n.dwellir.com/YOUR_API_KEY.
Step 1 – List owned collections#
Use state_getKeysPaged with the prefix returned by api.query.nfts.account.keyPrefix(<accountId>). The prefix encodes the player address, letting you iterate collections in batches.
ACCOUNT=0x6f5e2dee7182143c809c6606f5c50ffb0cc7f4dd
PREFIX=$(npx ts-node -e "const { ApiPromise, WsProvider } = require('@polkadot/api');(async () => { const api = await ApiPromise.create({ provider: new WsProvider('wss://api-mythos-archive.n.dwellir.com/YOUR_API_KEY') }); console.log(api.query.nfts.account.keyPrefix('$ACCOUNT').toHex()); process.exit(0); })();")
curl https://api-mythos-archive.n.dwellir.com/YOUR_API_KEY -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"method": "state_getKeysPaged",
"params": ["'"${PREFIX}"'", 64, null],
"id": 21
}'
Sample response (shortened)
{
"result": [
"0xeab5cb3142f74ec1…0000000000000000000000000000000000000000000000000000000000000afb",
"0xeab5cb3142f74ec1…0000000000000000000000000000000000000000000000000000000000000b11"
]
}
Each key encodes (accountId, collectionId). For the account above, the first entry corresponds to collection 2783.
Step 2 – Hydrate individual items#
With the collection ID in hand, iterate item IDs using api.query.nfts.item.keys(collectionId) or another state_getKeysPaged call. Then read each item via api.query.nfts.item(collectionId, itemId).
import { ApiPromise, WsProvider } from '@polkadot/api';
const ACCOUNT = '0x6f5e2dee7182143c809c6606f5c50ffb0cc7f4dd';
const provider = new WsProvider('wss://api-mythos-archive.n.dwellir.com/YOUR_API_KEY');
const api = await ApiPromise.create({ provider });
for (const [collectionId, itemList] of await api.query.nfts.account.entries(ACCOUNT)) {
const collection = collectionId.args[1].toNumber();
for (const itemKey of await api.query.nfts.item.keys(collection)) {
const itemId = itemKey.args[1].toNumber();
const details = await api.query.nfts.item(collection, itemId);
if (details.isSome) {
console.log({ collection, itemId, owner: details.unwrap().owner.toHex() });
}
}
}
Sample console output (3 Oct 2025):
{ collection: 2783, itemId: 21, owner: '0x6f5e2dee7182143c809c6606f5c50ffb0cc7f4dd' }
{ collection: 2783, itemId: 22, owner: '0x6f5e2dee7182143c809c6606f5c50ffb0cc7f4dd' }
Step 3 – Attach marketplace listings#
For each (collectionId, itemId) pair, read Marketplace::Asks(collectionId, itemId) to attach live pricing data (see nft_getAsset). Items not listed will return None.
Pagination tips#
- Tune the
state_getKeysPagedpageSize(128–256) to balance throughput and latency. - Persist cursors in your backend so clients can resume from the last key without rescanning.
- When serving real-time UIs, subscribe to
state_subscribeStorageonNfts::Itemto push updates as ownership changes.