dev@locazia: fix Tonhub tonhub

This commit is contained in:
user 2024-03-08 23:45:04 +03:00
parent 1a167a7090
commit b8251a456b
3 changed files with 11 additions and 3 deletions

View File

@ -6,7 +6,7 @@ from sanic import response
from tonsdk.boc import begin_cell, begin_dict from tonsdk.boc import begin_cell, begin_dict
from tonsdk.utils import Address from tonsdk.utils import Address
from app.core._blockchain.ton.connect import TonConnect, TON_CONNECT_WALLETS_LIST from app.core._blockchain.ton.connect import TonConnect, wallet_obj_by_name
from app.core._blockchain.ton.platform import platform from app.core._blockchain.ton.platform import platform
from app.core._config import PROJECT_HOST from app.core._config import PROJECT_HOST
from app.core.logger import make_log from app.core.logger import make_log
@ -144,7 +144,7 @@ async def s_api_v1_blockchain_send_new_content_message(request):
reply_markup=get_inline_keyboard([ reply_markup=get_inline_keyboard([
[{ [{
'text': request.ctx.user.translated('gotoWallet_button'), 'text': request.ctx.user.translated('gotoWallet_button'),
'url': next(x['universal_url'] for x in TON_CONNECT_WALLETS_LIST if x['app_name'] == ton_connection.wallet_key.split('==')[0]) 'url': wallet_obj_by_name(ton_connection.wallet_key.split('==')[0])['universal_url']
}], }],
[{ [{
'text': request.ctx.user.translated('home_button'), 'text': request.ctx.user.translated('home_button'),

View File

@ -48,6 +48,14 @@ TON_CONNECT_WALLETS_LIST = [
] ]
def wallet_obj_by_name(wallet_name: str) -> dict:
wallet_name = wallet_name.lower()
for wallet in TON_CONNECT_WALLETS_LIST:
if wallet["app_name"].lower() == wallet_name:
return wallet
raise StopIteration(f"Wallet {wallet_name} not found")
def unpack_wallet_info(wallet_info) -> dict: def unpack_wallet_info(wallet_info) -> dict:
return { return {
'provider': wallet_info.provider, 'provider': wallet_info.provider,

View File

@ -38,7 +38,7 @@ msgstr "🔌 Disconnect wallet"
#: app/bot/routers/home.py:35 app/client_bot/routers/home.py:35 #: app/bot/routers/home.py:35 app/client_bot/routers/home.py:35
msgid "connectWalletsList_menu" msgid "connectWalletsList_menu"
msgstr "" msgstr ""
"/ Welcome to MY [🔴]\n" "<b>/</b> Welcome to MY [🔴]\n"
"\n" "\n"
"Please select the wallet you want to connect to the bot:" "Please select the wallet you want to connect to the bot:"