[LWDM] feat(coin-concordium): add PLT errors and mapping (LIVE-36748) - #21429
[LWDM] feat(coin-concordium): add PLT errors and mapping (LIVE-36748)#21429amaslakov wants to merge 2 commits into
Conversation
|
There was a problem hiding this comment.
🟢 Approval recommended
Changes are self-contained, consistent with existing error patterns in the module, include focused tests, and add a correctly scoped changeset for the new exported API.
Pull request overview
Adds Protocol-Level Token (PLT) groundwork to the Concordium coin module by introducing dedicated error classes and a safe mapper from on-chain PLT reject reasons to typed errors, exposed via the module’s logic entrypoint.
Changes:
- Added 11 PLT-focused error classes (plus tests) ensuring stable
namecontracts across serialization boundaries. - Implemented
mapPltRejectReasonto narrow selected PLT reject reasons (and safely degrade unknown/malformed inputs). - Exported the mapper from
libs/coin-modules/coin-concordium/src/logic/index.tsand added a changeset for the API addition.
File summaries
| File | Description |
|---|---|
| libs/coin-modules/coin-concordium/src/types/errors.ts | Adds PLT-specific Error subclasses used by upcoming PLT send flows. |
| libs/coin-modules/coin-concordium/src/types/errors.test.ts | Verifies PLT error name/message defaults and field assignment behavior. |
| libs/coin-modules/coin-concordium/src/logic/transaction/pltRejectReason.ts | Adds mapping from validated PLT reject reasons to typed errors with safe fallback behavior. |
| libs/coin-modules/coin-concordium/src/logic/transaction/pltRejectReason.test.ts | Covers mapping outcomes, fallback behavior, and prototype-pollution-safe lookup. |
| libs/coin-modules/coin-concordium/src/logic/index.ts | Re-exports mapPltRejectReason as part of the logic public surface. |
| .changeset/quiet-lantern-drifts.md | Declares a minor bump for @ledgerhq/coin-concordium due to new exported API/errors. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Web Tools Build Status
|
Rsdoctor Bundle Diff Analysis
Found 7 projects in monorepo, 2 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 desktop-rendererPath:
📦 Download Diff Report: desktop-renderer Bundle Diff 📁 mobilePath:
📦 Download Diff Report: mobile Bundle Diff Generated by Rsdoctor GitHub Action |
Adds the token-state, broadcast and signer-surface errors a PLT transfer needs, so they land once instead of per-ticket. The three signer-surface classes are included even though the device status-word mapping is out of scope: LIVE-36748 was written assuming they already existed, but they were never implemented, and LIVE-28337 needs them to map anything in DmkSignerConcordium. ConcordiumInsufficientCcdForFee is deliberately separate from the generic NotEnoughBalanceInParentAccount: the failing balance is the parent account's, not the token sub-account's, and it wants its own copy.
Only addressNotFound and tokenBalanceInsufficient are narrowed. Of the remaining four CIS-7 types, mintWouldOverflow cannot arise from a transfer, and deserializationFailure and unsupportedOperation mean the wallet built a bad payload rather than describing a user-facing state. operationNotPermitted is the notable gap: the chain reports paused, allow-list and deny-list failures under that single type, and the only discriminator is a reason string inside details, which arrives as hex-encoded CBOR that concordium-core has no decoder for. Those conditions are therefore reachable only from the pre-send checks in LIVE-28334, never from this mapping. The lookup is a Map rather than an object literal because the key comes off the wire, where a Record would resolve constructor and toString off Object.prototype and return a non-Error.
9173b2f to
30619aa
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The changes are self-contained, follow existing error conventions in the module, and include thorough unit tests for both the new error classes and the reject-reason mapper.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
|



📝 Description
Groundwork for PLT send: adds the 8 error classes a PLT transfer needs and maps chain reject reasons onto them. Nothing calls it yet — the pre-send checks (LIVE-28334) and the signer (LIVE-28337) are the consumers.
🔗 Context