Skip to content

fix(wallet): support TON transfer URI send flow#6477

Open
SeniorZhai wants to merge 3 commits into
masterfrom
fix/support-ton-transfer-uri
Open

fix(wallet): support TON transfer URI send flow#6477
SeniorZhai wants to merge 3 commits into
masterfrom
fix/support-ton-transfer-uri

Conversation

@SeniorZhai

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 parseExternalTransferUri to handle ton://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")
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