As observed in recent attempts to develop a simple tx building demo for new devs looking to build on eCash, there are a number of chronik specific nuances that the app dev needs to handle in their app.
One such nuance is where chronik-client's .script().utxos() api returns a mixture of both XEC and SLP UTXOs, which meant the app developer would have to explicitly filter in their app.
This diff:
- Keeps the existing .script().utxos() function to maintain backwards compatibility
- Refactors the existing .script().utxos() function to return all UTXOs however neatly separated into two separate XEC and SLP UTXO arrays. eToken compatible wallets can use this to refresh its XEC and SLP utxo sets without additional parsing logic.
- Adds new .script().xecUtxos() and .script().slpUtxos() functions to only return XEC or SLP UTXOs. Wallets which don't support eTokens can use this to easily retrieve UTXOs to spend without worrying about accidentally burning SLP UTXOs.
Note: The XEC/SLP UTXO separation logic is essentially a filter applied on the utxos map array based on whether the slpToken param exists or not. This slpToken param determines whether the utxo is a token utxo or not, however worth noting that this only applies to the Chronik indexer, hence why it's worth abstracting this indexer specific knowledge from app devs.