-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Freighter has had some sort of subscription-based workflow possibility since v5.23.0. Today, apps themselves all need to individually implement polling logic. In Scaffold Stellar, we do this polling every single second.
There's a lot to get right, and a lot one could get wrong, with this sort of polling logic. If you click on the above link, you'll see that we put this logic in a Provider, which means it only happens once app-wide, rather than in a simpler hook that could cause the same every-second check to be fired from multiple parts of the app at once. We also took care with our await logic, using a while (true) rather than setInterval so that one run of the loop finishes before the next starts. Finally, we return a function from our useEffect that stops awaiting completion of the next loop run.
It would be much nicer to follow Freighter's lead and allow a subscription-based workflow.
I realize that this exceeds the interface specified in SEP-43. SWK can be a powerful voice in the ecosystem for evolving SEP-43, and subscriptions are a good reason to do so.