We want a powerful and user-friendly API that exposes commonly used steps in tx processing. For example, getting utxos to send a tx (/checking if we have the utxos we need to send a tx), getting a tx fee, and checking a tx size are all things that are commonly done without broadcasting a tx. We keep methods that do not need to be `async` as, well, not async. Only `broadcast() is (of necessity) async.
Note we will need to have a websocket that keeps the utxo set in syncHere we initialize such an API with a method that supports non-token XEC txs.
- We can get the utxos required to build an arbitary tx without actually building the tx by calling `wallet.tx(<instructions>).utxos()`
- We can build a tx (and get info about it) without broadcasting it, by calling `wallet.tx(<instructions>).build().fee()` or `wallet.tx(<instructions>).build().size()`; or the actual TxBuilder with `wallet.tx(<instructions>).build().tx`
- We can build and broadcast a tx with one call with `await wallet.tx(<instructions>).build().broadcast()`
From here,
[] We should add a websocket so the user does not need to remember to call `await wallet.sync()` before sending every tx
[] Add support for token methods
[] Add support for chained txs, as a dev it is annoying to always have to remember to call `await wallet.sync()` before sending a txi.e. However`await wallet.tx(<instructions>).build().broadcast()` should "just work" even if the instructions are asking to send more token outputs than a single tx can hold, I think we need to getor more XEC outputs than the tx API worked out first so we know what exactly the websocket should do and managebroadcast limit of 100kb will tolerate.