Skip to content

feat: add transaction failure handling and timeout configuration for …#116

Open
nikdim03 wants to merge 4 commits into
mainfrom
feature/ton-1684-emulation-retries
Open

feat: add transaction failure handling and timeout configuration for …#116
nikdim03 wants to merge 4 commits into
mainfrom
feature/ton-1684-emulation-retries

Conversation

@nikdim03

@nikdim03 nikdim03 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

…API client

Summary by CodeRabbit

  • New Features

    • Added configurable timeout option for API requests to customize request duration handling.
    • Enhanced error handling with callback support for transaction request failures.
  • Bug Fixes

    • Improved transaction failure messaging with formatted error details displayed to users.
  • Chores

    • Simplified transaction request processing logic and removed unused code.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@nikdim03, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 16 minutes and 2 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 164d8263-c842-4f80-800f-bfd7eec03e67

📥 Commits

Reviewing files that changed from the base of the PR and between c0a1cfb and 1ae37c4.

⛔ Files ignored due to path filters (31)
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONConnectionApprovalProof.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONDefiProviderType.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONEmulationMessageContent.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONGaslessConfig.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONGaslessProviderMetadata.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONGaslessProviderMetadataOverride.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONGaslessQuote.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONGaslessQuoteParams.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONGaslessSendParams.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONGaslessSendResponse.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONGaslessSupportedAsset.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONJettonTransferItem.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONJettonsTransferRequest.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONNFTRawTransferRequestMessage.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONNftTransferItem.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONProofMessage.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONSendTransactionApprovalResponse.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONSendTransactionResponse.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONSignDataBinary.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONSignDataCell.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONSignDataPreviewBinary.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONSignDataPreviewCell.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONSignMessageApprovalResponse.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONSwapParams.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONSwapQuoteParams.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONTonApiGaslessChainConfig.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONTonApiGaslessProviderConfig.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONTonTransferItem.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONTransactionMessageContent.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONTransactionRequestMessage.kt is excluded by !**/generated/**
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/api/generated/TONTransferRequest.kt is excluded by !**/generated/**
📒 Files selected for processing (4)
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/config/TONWalletKitConfiguration.kt
  • TONWalletKit-Android/gradle.properties
  • TONWalletKit-Android/impl/src/main/assets/walletkit/walletkit-android-bridge.mjs
  • TONWalletKit-Android/impl/src/main/java/io/ton/walletkit/engine/infrastructure/InitializationManager.kt
📝 Walkthrough

Walkthrough

PR adds TonConnect request failure callbacks to demo app for transaction error handling, simplifies transaction request flow by removing preflight balance checks, and introduces configurable per-request timeout support for API clients across ViewModel wiring, transaction processing, and configuration serialization.

Changes

TonConnect Failure Handling & SDK Configuration

Layer / File(s) Summary
TonConnect failure callback contract
AndroidDemo/app/src/main/java/io/ton/walletkit/demo/presentation/viewmodel/TonConnectViewModel.kt
TonConnectViewModel constructor accepts optional onRequestFailed callback and invokes it in approveTransaction failure path with the computed error message.
Failure callback wiring and UI integration
AndroidDemo/app/src/main/java/io/ton/walletkit/demo/presentation/viewmodel/WalletKitViewModel.kt, AndroidDemo/app/src/main/res/values/strings.xml
WalletKitViewModel wires the failure callback to TonConnectViewModel, implements onTonConnectRequestFailed handler to clear pending action, dismiss sheet, and show temporary failure status message; failure message string resource wallet_status_transaction_failed added.
Transaction request simplification
AndroidDemo/app/src/main/java/io/ton/walletkit/demo/presentation/viewmodel/WalletKitViewModel.kt
onTransactionRequest removes preflight balance check and conditional auto-reject, forces message comment to null, cleans up unused BigInteger import, and continues mapping to, amount, payload, stateInit fields.
API timeout configuration
TONWalletKit-Android/api/src/main/java/io/ton/walletkit/config/TONWalletKitConfiguration.kt, TONWalletKit-Android/impl/src/main/assets/walletkit/walletkit-android-bridge.mjs, TONWalletKit-Android/impl/src/main/java/io/ton/walletkit/engine/infrastructure/InitializationManager.kt
APIClientConfiguration adds optional timeout field; bridge passes timeout and network to ApiClientToncenter constructor; InitializationManager serializes timeout in per-network API configuration JSON payload.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🐰 A callback hops in, failures now found,
Balance checks gone, timeouts wrap 'round,
Transaction flows cleaner, no brittle holds,
Errors speak loud—the demo app grows bold! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is incomplete ('for …') and vague about specific changes, making it unclear what the main focus is without reading the full description. Complete the title and be more specific about the primary change. For example: 'feat: add transaction failure callbacks and API timeout configuration' or similar to clearly indicate both features.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/ton-1684-emulation-retries

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@TONWalletKit-Android/api/src/main/java/io/ton/walletkit/config/TONWalletKitConfiguration.kt`:
- Around line 153-157: The APIClientConfiguration data class currently allows
timeout values <= 0; add a constructor guard in APIClientConfiguration (e.g., an
init block) that checks if timeout != null and timeout <= 0 and throws an
IllegalArgumentException with a clear message so invalid timeouts fail fast;
keep the validation local to APIClientConfiguration and do not change the public
signature.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b0b56090-cd24-430d-8406-38d696664a4f

📥 Commits

Reviewing files that changed from the base of the PR and between 3ecd2bd and c0a1cfb.

📒 Files selected for processing (6)
  • AndroidDemo/app/src/main/java/io/ton/walletkit/demo/presentation/viewmodel/TonConnectViewModel.kt
  • AndroidDemo/app/src/main/java/io/ton/walletkit/demo/presentation/viewmodel/WalletKitViewModel.kt
  • AndroidDemo/app/src/main/res/values/strings.xml
  • TONWalletKit-Android/api/src/main/java/io/ton/walletkit/config/TONWalletKitConfiguration.kt
  • TONWalletKit-Android/impl/src/main/assets/walletkit/walletkit-android-bridge.mjs
  • TONWalletKit-Android/impl/src/main/java/io/ton/walletkit/engine/infrastructure/InitializationManager.kt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants