from app.core.models.wallet_connection import WalletConnection from app.core._blockchain.ton.toncenter import toncenter from tonsdk.boc import Cell from base64 import b64decode def unpack_item_indexator_data(item_get_data_result): result = {} assert item_get_data_result['stack'][0][0] == 'num', "Type is not a number" result['type'] = int(item_get_data_result['stack'][0][1], 16) result['address'] = Cell.one_from_boc( b64decode(item_get_data_result['stack'][1][1]['bytes'])).begin_parse().read_msg_addr().to_string(1, 1, 1) assert item_get_data_result['stack'][2][0] == 'num', "Index is not a number" result['index'] = int(item_get_data_result['stack'][2][1], 16) result['platform_address'] = Cell.one_from_boc( b64decode(item_get_data_result['stack'][3][1]['bytes'])).begin_parse().read_msg_addr().to_string(1, 1, 1) assert item_get_data_result['stack'][4][0] == 'num', "License type is not a number" result['license_type'] = int(item_get_data_result['stack'][4][1], 16) result['owner_address'] = Cell.one_from_boc( b64decode(item_get_data_result['stack'][5][1]["bytes"])).begin_parse().read_msg_addr().to_string(1, 1, 1) result['values'] = Cell.one_from_boc(b64decode(item_get_data_result['stack'][6][1]['bytes'])) result['derivates'] = Cell.one_from_boc(b64decode(item_get_data_result['stack'][7][1]['bytes'])) result['platform_variables'] = Cell.one_from_boc(b64decode(item_get_data_result['stack'][8][1]['bytes'])) result['distribution'] = Cell.one_from_boc(b64decode(item_get_data_result['stack'][9][1]['bytes'])) return result class NodeStorageIndexationMixin: pass # async def fetch_onchain_metadata(self): class UserContentIndexationMixin: pass