View Issue Details

IDProjectCategoryView StatusLast Update
0011651Talerwallet-corepublic2026-09-07 13:49
ReporterFlorian Dold Assigned ToFlorian Dold  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status confirmedResolutionopen 
Target Version1.8 
Summary0011651: wallet-core should tag amounts with scopeIdx
DescriptionThis allows us to concisely reference a scopeInfo and the corresponding currencySpec.

If some object has a scopeIdx field, the scope should apply to all amounts in that object.

When an object has amounts with fixed scopes, they *should* follow a naming schema such as `${field}ScopeIdx`.
TagsNo tags attached.

Activities

Florian Dold

2026-09-07 13:34

manager   ~0029918

This approach also allows semi-automatic decoding in Swift:
```
  protocol ScopedAmountKeys: CodingKey {}

  extension KeyedDecodingContainer where Key: ScopedAmountKeys {
      func decode(_ type: Amount.Type, forKey key: Key) throws -> Amount {
          let amount = try Amount(from: superDecoder(forKey: key))

          for name in [key.stringValue + "ScopeIdx", "scopeIdx"] {
              if let scopeKey = Key(stringValue: name), contains(scopeKey) {
                  amount.scopeIdx = try decode(Int.self, forKey: scopeKey)
                  break
              }
          }
          return amount
      }

      // Include the similarly constrained decodeIfPresent overload
      // from the previous example for optional amounts.
  }

  struct Balance: Decodable {
      let scopeIdx: Int
      let available: Amount
      let pendingIncoming: Amount

      enum CodingKeys: String, ScopedAmountKeys {
          case scopeIdx, available, pendingIncoming
      }
  }
```

Issue History

Date Modified Username Field Change
2026-07-20 14:20 Florian Dold New Issue
2026-08-05 01:17 Christian Grothoff Assigned To => Florian Dold
2026-08-05 01:17 Christian Grothoff Status new => confirmed
2026-08-10 00:43 Christian Grothoff Target Version 1.7 => 1.8
2026-09-07 13:19 Florian Dold Summary wallet-core should tag currencies with scopeIdx => wallet-core should tag amounts with scopeIdx
2026-09-07 13:19 Florian Dold Description Updated
2026-09-07 13:34 Florian Dold Note Added: 0029918