View Issue Details

IDProjectCategoryView StatusLast Update
0011984Talerwallet (iOS App)public2026-11-19 08:47
Reporterbot-cg [agent]  
ImplementerMarcS  
PrioritynormalSeverityminor 
Status implementing 
Summary0011984: Deposit offers an amount the destination cannot receive: getMaxDepositAmount is sent without depositPaytoUri, so the maximum ignores the exchange's wire methods
DescriptionThe deposit amount screen tells the user how much they can deposit without
ever asking where to. The number it shows is the most the wallet could
deposit *somewhere*, and it is presented as the most they can deposit to the
account they just picked -- which for an account the exchange cannot settle
to is zero.

**The missing argument.** `GetMaxDepositAmount.Args`
(TalerWallet1/Model/Model+Deposit.swift) sends two fields, and the one that
would answer the question is commented out in the source:

        struct Args: Encodable {
            var currency: String
            var restrictScope: ScopeInfo
    // var depositPaytoUri: String
        }

wallet-core uses `req.depositPaytoUri` to derive `restrictWireMethod` and to
filter the eligible exchanges (`getMaxDepositAmount` ->
`getDepositExchangeEligibilityInTx`, taler-wallet-core/src/coinSelection.ts).
Without it, nothing in the request names the destination, so nothing in the
answer accounts for it.

**What the user sees.** Measured 2026-11-09, iOS 27.2 simulator, with a
KUDOS 25 wallet funded from the demo exchange and an IBAN account added
through Settings -> Bank Accounts:

    staticText "Available: KUDOS 25.00"
    button "Deposit KUDOS 5.00" enabled
    button "Shortcut KUDOS 5.00" enabled
    button "Shortcut KUDOS 10.00" enabled
    button "Shortcut KUDOS 25.00" enabled

Every one of those is impossible. Pressing Deposit produces:

    createDepositGroup{"amount":"KUDOS:5",
                       "depositPaytoUri":"payto://iban/CH9300762011623852957…"}
    -> code 7026 WALLET_DEPOSIT_GROUP_INSUFFICIENT_BALANCE
       causeHint: "merchant-deposit-insufficient"
       balance: { material: "KUDOS:25", pendingRefresh: "KUDOS:0",
                  available: "KUDOS:25" }
       maximumPayableAmount: "KUDOS:0"
       reasons: [ { "type": "wire-method-unsupported",
                    "wireMethod": "iban" } ]

The wallet holds 25 by both measures. The exchange settles over
x-taler-bank, the account is an IBAN, and the payable maximum is zero --
which `getMaxDepositAmount` would have said if it had been told where the
money was going.

**Two defects, one cause.** The offer is wrong, and the refusal is
unreadable: the error reaches the user as "Internal core error" over a
"Copy the error JSON" button (noted on 11934), and the one hint wallet-core
does supply for this code -- `merchantDepositInsufficient`, "Balance
insufficient!" -- would be wrong in its own way here, since the balance is
not the problem.

**Not the same as 11964**, which was the decode of this call's reply and is
fixed; this is what the call asks in the first place. The decode fix is what
made this visible: before it, `getMaxDepositAmount` threw and the flow died
at the amount screen, so nobody had ever pressed Deposit.
Steps To Reproduce1. Fund a wallet with demo cash (KUDOS 25) from the empty-wallet screen.
2. Settings -> Bank Accounts -> + -> IBAN, with a label, an account holder
   and any valid IBAN (e.g. CH9300762011623852957).
3. Actions -> Deposit -> that account.

Observed: the heading reads "Available: KUDOS 25.00" and the KUDOS 5, 10
and 25 shortcuts are all enabled. Entering any amount and pressing
"Deposit <amount>" fails with "Internal core error"; the os_log carries the
7026 above with `wire-method-unsupported`.

Expected: the maximum reflects the selected account -- KUDOS 0.00 for this
pair, with the shortcuts disabled and a sentence saying that this account
cannot receive KUDOS from this payment service. wallet-core supplies both
the number and the reason once it is told the destination.

The same wallet CAN deposit to an x-taler-bank account at that exchange,
which is what makes this a wrong offer rather than a missing feature.
Additional InformationFix: pass the payto URI the screen already holds.
`DepositAmountAction` has `paytoUri` (it is what the account row selected and
what `createDepositGroup` is given), so the request becomes

    GetMaxDepositAmount(scope: scope, depositPaytoUri: paytoUri)

with the field uncommented in `Args`. The reply's
`exchangeDiagnostics[<exchange>].reasons` then carries the eligibility
failures in deterministic order, which is the material for the sentence the
screen is missing.

Worth checking at the same time: the Send/Request screens take their
maximum from `getMaxPeerPushDebitAmount`, which has no destination to
restrict by, so they are not affected. The *withdrawal* screen's maximum
comes from the bank's own limits and is likewise unrelated.

Found by the deterministic `deposit` scenario in the fuzzing harness. It is
also why that scenario cannot be green as written, and the harness's own
bank-add prelude will be changed to add an x-taler-bank account for the
demo exchange instead of an IBAN one -- a change to the test, not evidence
about the app.
TagsNo tags attached.
Attached Files
11984-deposit-payto-uri.diff (3,633 bytes)   
diff --git a/TalerWallet1/Model/Model+Deposit.swift b/TalerWallet1/Model/Model+Deposit.swift
index fd35b932..4a246b24 100644
--- a/TalerWallet1/Model/Model+Deposit.swift
+++ b/TalerWallet1/Model/Model+Deposit.swift
@@ -175,19 +175,41 @@ fileprivate struct AmountResponse: Codable {
 fileprivate struct GetMaxDepositAmount: WalletBackendFormattedRequest {
     typealias Response = AmountResponse
     var operation: String { "getMaxDepositAmount" }
-    func args() -> Args { Args(currency: scope.currency, restrictScope: scope) }
+    func args() -> Args { Args(currency: scope.currency, restrictScope: scope,
+                               depositPaytoUri: depositPaytoUri) }
 
     var scope: ScopeInfo
+    /// The account the money is going to, when one has been chosen.
+    ///
+    /// wallet-core derives `restrictWireMethod` from it and filters the
+    /// eligible exchanges by it (`getMaxDepositAmount` ->
+    /// `getDepositExchangeEligibilityInTx`).  Without it the answer is the
+    /// most that could be deposited *somewhere*, which the amount screen
+    /// then presents as the most that can be deposited *here*.
+    ///
+    /// Measured 2026-11-09 on a KUDOS 25 wallet with an IBAN account: the
+    /// screen offered "Available: KUDOS 25.00" and an enabled
+    /// "Deposit KUDOS 5.00", and `createDepositGroup` refused with 7026,
+    /// `maximumPayableAmount: KUDOS:0`,
+    /// `reasons: [{wire-method-unsupported, iban}]` -- the demo exchange
+    /// settles over x-taler-bank.  Issue 11984.
+    ///
+    /// Optional, and the synthesized encoder omits a nil one, so a caller
+    /// that has no account yet sends exactly the request it sent before.
+    var depositPaytoUri: String?
     struct Args: Encodable {
         var currency: String
         var restrictScope: ScopeInfo
-//        var depositPaytoUri: String
+        var depositPaytoUri: String?
     }
 }
 extension WalletModel {
-    nonisolated func getMaxDepositAmount(_ scope: ScopeInfo, viewHandles: Bool = false)
+    nonisolated func getMaxDepositAmount(_ scope: ScopeInfo,
+                                         depositPaytoUri: String? = nil,
+                                         viewHandles: Bool = false)
       async throws -> Amount {
-        let request = GetMaxDepositAmount(scope: scope)
+        let request = GetMaxDepositAmount(scope: scope,
+                                          depositPaytoUri: depositPaytoUri)
         let (response, _) = try await sendRequest(request, viewHandles: viewHandles)
         return response.available.rawAmount
     }
diff --git a/TalerWallet1/Views/Actions/Banking/DepositAmountAction.swift b/TalerWallet1/Views/Actions/Banking/DepositAmountAction.swift
index a10d7759..05cfdd76 100644
--- a/TalerWallet1/Views/Actions/Banking/DepositAmountAction.swift
+++ b/TalerWallet1/Views/Actions/Banking/DepositAmountAction.swift
@@ -67,7 +67,11 @@ struct DepositAmountAction: View {
             amountToTransfer.setCurrency(scope.currency)
             currencyInfo = controller.info(for: scope, controller.currencyTicker)
             do {
-                amountAvailable = try await model.getMaxDepositAmount(scope)
+                // The destination, so the maximum is the one the user is
+                // actually held to rather than the most this wallet could
+                // deposit anywhere (11984).
+                amountAvailable = try await model.getMaxDepositAmount(
+                                        scope, depositPaytoUri: paytoUri)
             } catch {
                 // TODO: Error
                 amountAvailable = balance.available
11984-deposit-payto-uri.diff (3,633 bytes)   

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

bot-cg [agent]

2026-11-09 22:32

updater   ~0030356

Patch attached: `11984-deposit-payto-uri.diff`.

Two hunks. `GetMaxDepositAmount` grows an optional `depositPaytoUri` and
passes it in `Args`; `DepositAmountAction.newBalance()` supplies the
`paytoUri` the screen already holds. The field is optional and Swift's
synthesized encoder omits a nil one, so a caller without an account yet
sends exactly the request it sends today.

Applies on top of the decode fix from 11964 (`available.rawAmount`), which
is what made this reachable at all. For
`TalerWallet1/Views/Actions/Banking/DepositAmountAction.swift` the order of
today's three patches is **11984, then 11982, then 11983** -- each diff is
one commit and applies to its predecessor, not to a tree with the others
already in it.

Built against iOS 27.2, Xcode 27.2: compiles, and the deposit flow then
sends

    getMaxDepositAmount{"currency":"KUDOS",
                        "restrictScope":{...},
                        "depositPaytoUri":"payto://iban/..."}

What is NOT in the patch, deliberately: the sentence the screen should
show when the maximum is zero. `exchangeDiagnostics[<exchange>].reasons`
carries `wire-method-unsupported` and the other eligibility failures in
deterministic order, so the material is there -- but what to say, and
whether to say it per exchange, is a decision for whoever owns the deposit
flow rather than something to slip into a bug fix.

Issue History

Date ModifiedUsernameFieldChange
2026-11-09 21:07bot-cgNew Issue
2026-11-09 22:21Christian GrothoffImplementer => MarcS
2026-11-09 22:21Christian GrothoffReviewer => avalos
2026-11-09 22:21Christian GrothoffRelease signed by => MarcS
2026-11-09 22:21Christian GrothoffDeployed by => MarcS
2026-11-09 22:21Christian GrothoffVerifier => Florian Dold
2026-11-09 22:21Christian GrothoffStatusnew => planning
2026-11-09 22:32bot-cgFile Added: 11984-deposit-payto-uri.diff
2026-11-09 22:32bot-cgNote Added: 0030356
2026-11-19 08:47Christian GrothoffStatusplanning => implementing