fix(wallet): support TON transfer URI send flow#6477
Open
SeniorZhai wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for TON ton://transfer/... URIs in the wallet send flow by recognizing TON transfer links, parsing destination/amount/memo (including jetton transfers), and ensuring the UI routes these links into the link send flow. Includes Robolectric coverage for TON parsing.
Changes:
- Add TON-specific parsing path in
parseExternalTransferUrito handleton://transfer/<address>?amount=...&jetton=...&text=.... - Treat external transfer URLs (including TON) as link sends even when no token is currently selected.
- Add tests covering TON native and jetton transfer URI parsing.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| app/src/main/java/one/mixin/android/pay/ExternalTransferUriParser.kt | Adds TON URI detection and a dedicated parser for ton://transfer format, plus TON scheme mapping. |
| app/src/main/java/one/mixin/android/ui/address/TransferDestinationInputFragment.kt | Routes external transfer / lightning URLs into the link bottom sheet without requiring a selected token. |
| app/src/test/java/one/mixin/android/pay/ExternalTransferUriParserTonTest.kt | Adds Robolectric tests validating TON native + jetton URI parsing behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (amount.isNullOrEmpty() || amount == "0") { | ||
| return ExternalTransfer(addressResponse.destination, null, assetId, null, null, memo) | ||
| } | ||
| if (amount.amountWithE()) return null |
Comment on lines
+138
to
+144
| val baseAmount = amount.toBigDecimalOrNull() ?: return null | ||
| if (baseAmount == BigDecimal.ZERO) { | ||
| return ExternalTransfer(addressResponse.destination, null, assetId, null, null, memo) | ||
| } | ||
| if (amount != baseAmount.toPlainString()) { | ||
| return null | ||
| } |
Comment on lines
+130
to
+132
| val memo = uri.getQueryParameter("text")?.normalizeTonText() | ||
| ?: uri.getQueryParameter("memo")?.normalizeTonText() | ||
| val amount = uri.getQueryParameter("amount") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.