diba-io / bitmask-core

Core functionality for the BitMask wallet
https://bitmask.app
Other
95 stars 21 forks source link

Getting current utxo #340

Closed josediegorobles closed 1 year ago

josediegorobles commented 1 year ago

I have this in the extension:

const { utxo } = await backend.rgb.watcherNextUtxo(
    vault.private.nostrPrv,
    "default",
    iface
  );
  let { utxos } = await backend.rgb.watcherUnspentUtxos(
    vault.private.nostrPrv,
    "default",
    iface
  );
if (utxo) utxos = utxos.filter((u) => u.outpoint === utxo.outpoint);
  const seal = `${sealPrefix}:${utxos[0].outpoint}`;

I want to get the utxo that is currently using for store assets. I'm calling two methods that is going to be too much (and too much calls to the mempool). I need a single method, watcher_current_utxo with same parameters and returns as watcher_next_utxo