View Issue Details

IDProjectCategoryView StatusLast Update
0011651Talerwallet-corepublic2026-11-29 18:20
ReporterFlorian Dold  
PrioritynormalSeverityfeature 
Status new 
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.

Required notifications

Address or linkRemarkAdded byNotifiedActions

Relationships

related to 0011798 closed checkPayForTemplate should return amountAvailable 

Activities

Florian Dold

2026-09-07 11: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
      }
  }
```

Florian Dold

2026-11-29 18:20

manager   ~0030967

Status "feedback" does not exist anymore, moving to "new"

Issue History

Date ModifiedUsernameFieldChange
2026-07-20 12:20Florian DoldNew Issue
2026-08-04 23:17Christian GrothoffLocked by => Florian Dold
2026-08-04 23:17Christian GrothoffStatusnew => implementing
2026-08-09 22:43Christian GrothoffTarget Version1.7 => 1.8
2026-09-07 11:19Florian DoldSummarywallet-core should tag currencies with scopeIdx => wallet-core should tag amounts with scopeIdx
2026-09-07 11:19Florian DoldDescription Updated
2026-09-07 11:34Florian DoldNote Added: 0029918
2026-09-10 21:46Florian DoldLocked byFlorian Dold => MarcS
2026-09-10 21:46Florian DoldStatusimplementing => feedback
2026-09-16 11:16MarcSRelationship addedrelated to 0011798
2026-11-29 18:20Florian DoldStatusfeedback => new
2026-11-29 18:20Florian DoldNote Added: 0030967
2026-11-29 18:20Florian DoldLocked byMarcS =>