vulpemventures / ocean

:ocean: Elements/Liquid wallet daemon
MIT License
5 stars 7 forks source link

Support watching custom scripts #71

Closed altafan closed 5 months ago

altafan commented 6 months ago

This adds 2 new unary rpcs to the notification service to start/stop watching output scripts. The rpcs can be used without having to create and unlock the wallet. Notifications about txs and utxos can be received through the already existing server-side stream rpcs.

To add the above feature, this adds a new domain ExternalScript represented by the already existing AddressInfo and the relative repository. Every script is identified by its scripthash as defined by electrumx to prevent any possible collision between different scripts. The user can also pass the blinding private key so that ocean can unblind any confidential output, if any is going to be locked by the given script.

BONUS: This fixes unsubscribing for scripts/account. Before this, ocean would crash if it received a notification from electrum about a deleted script/account.

Please @louisinger review.