user139795: How to prevent selection of unspent transaction from UTXO's which is already used in another unconfirmed transaction ?
I am fetching list of UTXO's from here -
https://mempool.space/testnet/docs/api/rest#get-address-utxo
Trying to send bitcoins from native segwit address to all other types of addresses using bitcoinjs-lib in node js.
From list of UTXO's I am selecting the inputs as required.
If the first input is already selected for a transaction which is unconfirmed how can I prevent the selection of that first input in next transaction ?

user13866: When writing a wallet it is probably a bad idea to rely on a trusted third party to provide a list of UTXOs. I would expect any wallet application to keep a local list of UTXO's for which it has the corresponding private keys.
Then you mark UTXO's as provisionally committed when you transmit a transaction consuming them. When creating transactions you avoid selecting local UTXOs you have previously marked as provisionally committed.
If a transaction doesn't get confirmed in a reasonable time (days, weeks?) you could unmark the appropriate UTXOs in your local list.

139795: <p>How to prevent selection of unspent transaction from UTXO's which is already used in another unconfirmed transaction ?</p>
<p>I am fetching list of UTXO's from here -
<a href="https://mempool.space/testnet/docs/api/rest#get-address-utxo" rel="nofollow noreferrer">https://mempool.space/testnet/docs/api/rest#get-address-utxo</a></p>
<p>Trying to send bitcoins from native segwit address to all other types of addresses using bitcoinjs-lib in node js.</p>
<p>From list of UTXO's I am selecting the inputs as required.
If the first input is already selected for a transaction which is unconfirmed how can I prevent the selection of that first input in next transaction ?</p>
 13866: <p>When writing a wallet it is probably a bad idea to rely on a trusted third party to provide a list of UTXOs. I would expect any wallet application to keep a local list of UTXO's for which it has the corresponding private keys.</p>
<p>Then you mark UTXO's as provisionally committed when you transmit a transaction consuming them. When creating transactions you avoid selecting local UTXOs you have previously marked as provisionally committed.</p>
<p>If a transaction doesn't get confirmed in a reasonable time (days, weeks?) you could unmark the appropriate UTXOs in your local list.</p>
