[lightapi] feat: Keep NEM transfer message semantics in lightapi by exposing the original message type#2382
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #2382 +/- ##
==========================================
+ Coverage 95.38% 97.01% +1.62%
==========================================
Files 631 276 -355
Lines 49344 21314 -28030
Branches 1362 206 -1156
==========================================
- Hits 47068 20678 -26390
+ Misses 2226 630 -1596
+ Partials 50 6 -44
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Wayonb
left a comment
There was a problem hiding this comment.
The fix looks fine 👍🏾
Is there a reason not to fix this on the Explorer side?
I think api is correct and should just return the information from the node. 🤔
@Wayonb, there’s a fix on the Explorer side as well -> #2383 The variable in lightapi is called If you’d prefer lightapi to return a numeric type, I can change it (and rename the property). But if the current approach is fine, I’d leave it as it is. |
Yea, ideally it should return the type but I see your point its already broken. The issue is that if we ever add a new message type, this will not work, and we will need to update all downstream products. |
ecb4755 to
b080e48
Compare
|
@Wayonb updated 👍 |
Map NEM message type to a strict boolean when building transfer Message objects. Use MessageType.PLAIN instead of persisting the raw type integer (1/2).
Map NEM message type to a strict boolean when building transfer Message objects. Use MessageType.PLAIN instead of persisting the raw type integer (1/2).
Map NEM message type to a strict boolean when building transfer Message objects. Use MessageType.PLAIN instead of persisting the raw type integer (1/2).
…aw NEM message type Map transfer message metadata to `Message(payload, type)` instead of a derived boolean flag, so lightapi exposes the original node message type for forward compatibility with future message variants. Update TransactionHandler and connector/model tests accordingly.
813f1fb to
5425b82
Compare
Summary
MessageType.PLAINinstead of forwarding the raw NEM message type integer (1/2).Motivation
A boolean is_plain loses message-type information and makes downstream handling brittle if new NEM message types appear in the future. Keeping the raw type in lightapi preserves protocol semantics and centralizes interpretation in Explorer/UI logic while maintaining a clear migration path for already persisted data.
Issue: #2352