Skip to content

Commit

Permalink
Update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
nessshon committed Jan 23, 2024
1 parent cb59e8a commit c4ad78f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 32 deletions.
1 change: 1 addition & 0 deletions docs/user-guide/connecting-wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ async def main_menu_handler(call: CallbackQuery, atc_manager: ATCManager) -> Non
with suppress(WalletNotConnectedError):
# Disconnect from the wallet with suppress
# to handle WalletNotConnectedError
await atc_manager.tonconnect.restore_connection()
await atc_manager.tonconnect.disconnect()

# Create ConnectWalletCallbacks object with before_callback
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def main():
redis=storage.redis,
manifest_url=MANIFEST_URL,
exclude_wallets=EXCLUDE_WALLETS,
qrcode_type="url", # or "bytes"
qrcode_type="url", # or "bytes" if you prefer to generate QR codes locally.
)
)

Expand Down
63 changes: 32 additions & 31 deletions docs/user-guide/sending-transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,38 +156,39 @@ The router is configured to filter messages and callback queries only from priva
```python title="handlers.py"
@router.callback_query(UserState.main_menu)
async def main_menu_handler(call: CallbackQuery, atc_manager: ATCManager) -> None:
"""
Handler for the main menu callback.
:param call: The CallbackQuery object representing the callback.
:param atc_manager: ATCManager instance for managing TON Connect integration.
:return: None
"""
# Check if the user clicked the "disconnect" button
if call.data == "disconnect":
# Check if wallet is connected before attempting to disconnect
if atc_manager.tonconnect.connected:
with suppress(WalletNotConnectedError):
# Disconnect from the wallet with suppress
# to handle WalletNotConnectedError
await atc_manager.tonconnect.disconnect()

# Create ConnectWalletCallbacks object with before_callback
# and after_callback functions
callbacks = ConnectWalletCallbacks(
before_callback=select_language_window,
after_callback=main_menu_window,
)

# Open the connect wallet window using the ATCManager instance
# and the specified callbacks
await atc_manager.connect_wallet(callbacks)

elif call.data == "send_amount_ton":
await send_amount_ton_window(atc_manager)
"""
Handler for the main menu callback.
:param call: The CallbackQuery object representing the callback.
:param atc_manager: ATCManager instance for managing TON Connect integration.
:return: None
"""
# Check if the user clicked the "disconnect" button
if call.data == "disconnect":
# Check if wallet is connected before attempting to disconnect
if atc_manager.tonconnect.connected:
with suppress(WalletNotConnectedError):
# Disconnect from the wallet with suppress
# to handle WalletNotConnectedError
await atc_manager.tonconnect.restore_connection()
await atc_manager.tonconnect.disconnect()

# Create ConnectWalletCallbacks object with before_callback
# and after_callback functions
callbacks = ConnectWalletCallbacks(
before_callback=select_language_window,
after_callback=main_menu_window,
)

# Open the connect wallet window using the ATCManager instance
# and the specified callbacks
await atc_manager.connect_wallet(callbacks)

elif call.data == "send_amount_ton":
await send_amount_ton_window(atc_manager)

# Acknowledge the callback query
await call.answer()
# Acknowledge the callback query
await call.answer()
```

This handler fires when the user interacts with the main menu. It now handles disconnecting from the wallet and go to
Expand Down

0 comments on commit c4ad78f

Please sign in to comment.