This commit is contained in:
user 2024-04-05 22:46:58 +03:00
parent 7dba36f8d8
commit c595123a65
1 changed files with 2 additions and 2 deletions

View File

@ -28,14 +28,14 @@ class WalletMixin:
# TODO: support more than 1000 items # TODO: support more than 1000 items
async with AsyncClient() as client: async with AsyncClient() as client:
response = await client.get(f"https://tonapi.io/v2/accounts/{user_wallet_address}/nfts?limit=1000&offset=0&indirect_ownership=false") response = await client.get(f"https://tonapi.io/v2/accounts/{user_wallet_address}/nfts?limit=1000&offset=0&indirect_ownership=false")
response = response.json() return response.json()['nft_items']
assert 'nft_items' in response
except BaseException as e: except BaseException as e:
make_log(self, f"Error while fetching NFTs: {e}", level='error') make_log(self, f"Error while fetching NFTs: {e}", level='error')
await asyncio.sleep(2) await asyncio.sleep(2)
return await get_nft_items_list() return await get_nft_items_list()
nfts_list = await get_nft_items_list() nfts_list = await get_nft_items_list()
make_log(self, f"Found {len(nfts_list)} NFTs", level='info')
for nft_item in nfts_list: for nft_item in nfts_list:
item_address = Address(nft_item['address']).to_string(1, 1, 1) item_address = Address(nft_item['address']).to_string(1, 1, 1)
owner_address = Address(nft_item['owner']['address']).to_string(1, 1, 1) owner_address = Address(nft_item['owner']['address']).to_string(1, 1, 1)