Replies: 1 comment 2 replies
-
|
Great spike @NeOMakinG 🐐! Wall of text incoming - touching on the main points, disambiguating things and bringing a few more qs in. Replies to open qs.
As we've discussed, there is potentially more to that than just Txs (things like new features, app updated, etc), but indeed, swaps are the guts of this. Also, push notifications for things like new features would be amazing to have! Just to disambiguate things here, a swap is not a Tx, and may not even contain an inbound one for observability purposes, e.g a CoW swap is a message signing. We should ensure that we don't store things by Txid but rather by swapId as far as swaps are concerned.
Definitely in favour of the latter, from a user perspective an updated notification is effectively akin to a new notification (just represented as a single one with updated state)
Not sure what we mean with this one, can you add more deets? 🙏🏽
Ideally not - we should be able to reuse existing logic for most things, and most of swaps status logic is actually happening with swapper APIs themselves, though there is a fair share of introspecting Txs themselves (
See first point, think that would be amazing to have for mobile users as discussed 🙏🏽 re: we should be able to reuse existing logic for most thingsAdding a bit more details on this one, at the end of the day we already have the logic for all that we're going to do here, but we're going to have new callsites and pollers. If things get spewy and rate-limited/affected by perf, we could potentially think about making the notification a source of truth for things, meaning instead of polling/fetching from current callsites, we would rely on the notification center. re: If we want to handle ShapeShift actions only:
re: the point above, do we want the current callsites to have full responsbility for the notification polling, or do we want to rather go in a service direction, which would be responsible for long-polling (or ws) notifications? Think the latter makes a lot more sense, precisely because of the fact that users may close whichever modal/tab/change route and lose polling, but also as mentioned above to avoid duplicating callsites if we were to use this as a source of truth (e.g for swapper, for swap statuses) re: Streaming handling:
I think the app close is the main thing product-wise, though I agree, for simplicity purposes, may not make sense at first. Though if we go with push notifications, that would be a requirement. That also echoes the service idea I mentioned above, which you seem to be aligned on. If we don't leverage existing callsites to push (which assume you keep the thing open and negates the benefits of notifications) but rather let a polling service handle this, then navigating somewhere isn't an issue. re: Storage growing over time
Think the perf killer would be if we got that wrong and kept polling things we shouldn't, so instead of polling active, we'd poll all the historical notifications, so we'll have to ensure the logic is solid and really polls what's relevant - if we do so, I don't think storage is a concern, though I'm not opposed to the idea of pruning either, if we find good heuristics! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Open questions:
If we want to handle every actions:
We could handle them using the transactions websocket, the same way we push TX to the historySlice, we could create or update notifications at this point. Thought it would mean we would need to be extra careful at parsing absolutely every TXs or we might end up with TXs we don't really know
If we want to handle ShapeShift actions only:
We could push the notifications in a granular way, where every actions are executed, push or update any notifications:
Example: inside
useTradeExecution, inside any execution events, create or update notifications. Inside any claiming methods, create the notifications, when claim is successful or fail, update it Inside any deposit actions, create the notification, update the status on execution updateStreaming handling:
Those could be looking like easy, but they are effectively hard to manage:
useStreamingProgresswould give the data to update the notificationsuseTransactionSubscriberone, having a service worker?For simplicity, I would probably go without the service worker, to avoid pushing an extra layer of complexity to the app regarding the current workforce of the engineering team, and I don't see any downside for a global service polling for streamings and pulling pending txs as long as current polling tx queue shouldn't be so big. Also it fixes a known problem where pending TXs that users didn't see and has gone out of the last tx history page are not updated, this system would update them naturally with the poller.
Storage growing over time
We will end up with tons of notifications as local storage, and those will end up filling the memory as hell, making the store super big
As a decentralized interface, we probably want to avoid adding a new backend layer specially for the purpose of notifications (looking at the pita of the tx history slice), but having a backend for both could add great benefits:
I think our role is not to store them for years, we could probably introduce a pruning system, removing old TXs after a certains amount of time + tx number
Architecture proposal schema
Beta Was this translation helpful? Give feedback.
All reactions