View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0011651 | Taler | wallet-core | public | 2026-07-20 14:20 | 2026-09-07 13:49 |
| Reporter | Florian Dold | Assigned To | Florian Dold | ||
| Priority | normal | Severity | feature | Reproducibility | have not tried |
| Status | confirmed | Resolution | open | ||
| Target Version | 1.8 | ||||
| Summary | 0011651: wallet-core should tag amounts with scopeIdx | ||||
| Description | This 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`. | ||||
| Tags | No tags attached. | ||||
|
|
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 } } ``` |
| 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 |