big update

This commit is contained in:
user committed 2024-04-05 02:35:15 +03:00
1 parent 7d05a3f2c0
commit f45d593a84
32 files changed
+726 -320

No files matched your search

@@ -0,0 +1,44 @@
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
+6 -2
View File
@@ -2,14 +2,18 @@
from sqlalchemy import Column, BigInteger, Integer, String, ForeignKey, DateTime, JSON, Boolean
from sqlalchemy.orm import relationship
from app.core.models.base import AlchemyBase
from app.core.models.content.indexation_mixins import UserContentIndexationMixin
class UserContent(AlchemyBase):
class UserContent(AlchemyBase, UserContentIndexationMixin):
__tablename__ = 'users_content'
id = Column(Integer, autoincrement=True, primary_key=True)
type = Column(String(128), nullable=False) # 'license_issuer', 'license_listen'
type = Column(String(128), nullable=False) # 'license/issuer', 'license/listen', 'nft/unknown'
onchain_address = Column(String(1024), nullable=True) # bind by this
owner_address = Column(String(1024), nullable=True)
code_hash = Column(String(128), nullable=True)
data_hash = Column(String(128), nullable=True)
updated = Column(DateTime, nullable=False, default=0)
content_id = Column(Integer, ForeignKey('node_storage.id'), nullable=True)