fix
This commit is contained in:
parent
e63e040692
commit
6405baf251
|
|
@ -67,7 +67,7 @@ async def t_callback_purchase_node_content(query: types.CallbackQuery, memory=No
|
||||||
)
|
)
|
||||||
db_session.add(new_action)
|
db_session.add(new_action)
|
||||||
db_session.commit()
|
db_session.commit()
|
||||||
await user.send_content(db_session, content, message_id=query.message.message_id)
|
await chat_wrap.send_content(db_session, content, message_id=query.message.message_id)
|
||||||
|
|
||||||
|
|
||||||
router.callback_query.register(t_callback_purchase_node_content, F.data.startswith('PC_'))
|
router.callback_query.register(t_callback_purchase_node_content, F.data.startswith('PC_'))
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ async def license_index_loop(memory, platform_found: bool, seqno: int) -> [bool,
|
||||||
chat_wrap = Wrapped_CBotChat(CLIENT_TELEGRAM_API_KEY, chat_id=user.telegram_id, db_session=session, user=user)
|
chat_wrap = Wrapped_CBotChat(CLIENT_TELEGRAM_API_KEY, chat_id=user.telegram_id, db_session=session, user=user)
|
||||||
content = session.query(StoredContent).filter_by(id=action.content_id).first()
|
content = session.query(StoredContent).filter_by(id=action.content_id).first()
|
||||||
|
|
||||||
if (datetime.now() - action.updated) > timedelta(minutes=5):
|
if (datetime.now() - action.created) > timedelta(minutes=5):
|
||||||
if action.telegram_message_id:
|
if action.telegram_message_id:
|
||||||
await chat_wrap.delete_message(action.telegram_message_id)
|
await chat_wrap.delete_message(action.telegram_message_id)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,40 +28,45 @@ class WalletMixin:
|
||||||
have_next_page = True
|
have_next_page = True
|
||||||
|
|
||||||
for nft_item in nfts_list:
|
for nft_item in nfts_list:
|
||||||
item_address = Address(nft_item['address']).to_string(1, 1, 1)
|
|
||||||
owner_address = Address(nft_item['owner_address']).to_string(1, 1, 1)
|
|
||||||
|
|
||||||
user_content = db_session.query(UserContent).filter(
|
|
||||||
UserContent.onchain_address == item_address
|
|
||||||
).first()
|
|
||||||
if user_content:
|
|
||||||
continue
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
nft_content = nft_item['content']['uri']
|
make_log(self, f"Scanning onchain NFT: {nft_item}", level='info')
|
||||||
except KeyError:
|
item_address = Address(nft_item['address']).to_string(1, 1, 1)
|
||||||
nft_content = None
|
owner_address = Address(nft_item['owner_address']).to_string(1, 1, 1)
|
||||||
|
|
||||||
user_content = UserContent(
|
user_content = db_session.query(UserContent).filter(
|
||||||
type='nft/unknown',
|
UserContent.onchain_address == item_address
|
||||||
onchain_address=item_address,
|
).first()
|
||||||
owner_address=owner_address,
|
if user_content:
|
||||||
code_hash=nft_item['code_hash'],
|
continue
|
||||||
data_hash=nft_item['data_hash'],
|
|
||||||
updated=datetime.fromtimestamp(0),
|
|
||||||
content_id=None, # not resolved yet
|
|
||||||
created=datetime.now(),
|
|
||||||
meta={
|
|
||||||
'metadata_uri': nft_content,
|
|
||||||
},
|
|
||||||
user_id=self.id,
|
|
||||||
wallet_connection_id=self.wallet_connection(db_session).id,
|
|
||||||
status="active"
|
|
||||||
)
|
|
||||||
db_session.add(user_content)
|
|
||||||
db_session.commit()
|
|
||||||
|
|
||||||
make_log(self, f"New onchain NFT found: {item_address}", level='info')
|
try:
|
||||||
|
nft_content = nft_item['content']['uri']
|
||||||
|
except KeyError:
|
||||||
|
nft_content = None
|
||||||
|
|
||||||
|
user_content = UserContent(
|
||||||
|
type='nft/unknown',
|
||||||
|
onchain_address=item_address,
|
||||||
|
owner_address=owner_address,
|
||||||
|
code_hash=nft_item['code_hash'],
|
||||||
|
data_hash=nft_item['data_hash'],
|
||||||
|
updated=datetime.fromtimestamp(0),
|
||||||
|
content_id=None, # not resolved yet
|
||||||
|
created=datetime.now(),
|
||||||
|
meta={
|
||||||
|
'metadata_uri': nft_content,
|
||||||
|
},
|
||||||
|
user_id=self.id,
|
||||||
|
wallet_connection_id=self.wallet_connection(db_session).id,
|
||||||
|
status="active"
|
||||||
|
)
|
||||||
|
db_session.add(user_content)
|
||||||
|
db_session.commit()
|
||||||
|
|
||||||
|
make_log(self, f"New onchain NFT found: {item_address}", level='info')
|
||||||
|
except BaseException as e:
|
||||||
|
make_log(self, f"Error while scanning onchain NFT: {e}", level='error')
|
||||||
|
continue
|
||||||
|
|
||||||
async def get_user_content(self, db_session, limit=100, offset=0):
|
async def get_user_content(self, db_session, limit=100, offset=0):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue