From b26b081e07fcdbeb58fd2f27564b4069e0b60aa6 Mon Sep 17 00:00:00 2001 From: xein Date: Sun, 24 Mar 2024 16:15:00 +0700 Subject: [PATCH] FIX in case no refs data is found --- TonTools/Providers/TonCenterClient.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/TonTools/Providers/TonCenterClient.py b/TonTools/Providers/TonCenterClient.py index 97849ec..685695a 100644 --- a/TonTools/Providers/TonCenterClient.py +++ b/TonTools/Providers/TonCenterClient.py @@ -127,7 +127,10 @@ async def _get_nft_item(self, nft_address: str): collection_content_url = Cell.one_from_boc(base64.b64decode(content_data[0][1]['bytes'])).bits.get_top_upped_array().decode().split('\x01')[-1] # if '\x01' in collection_content_url: # collection_content_url = collection_content_url.split('\x01')[1] - nft_content_url = collection_content_url + Cell.one_from_boc(base64.b64decode(content_data[0][1]['bytes'])).refs[0].bits.get_top_upped_array().decode() + if not refs: + nft_content_url = collection_content_url + else: + nft_content_url = collection_content_url + refs[0].bits.get_top_upped_array().decode() result['metadata'] = await get(nft_content_url)