diff --git a/sdk/src/wallet/utxo.ts b/sdk/src/wallet/utxo.ts index ef86263d..cc4f9f73 100644 --- a/sdk/src/wallet/utxo.ts +++ b/sdk/src/wallet/utxo.ts @@ -93,20 +93,12 @@ export async function createBitcoinPsbt( let confirmedUtxos: UTXO[] = []; let outputsFromAddress: OutputJson[] = []; - if (feeRate) { - [confirmedUtxos, outputsFromAddress] = await Promise.all([ - esploraClient.getAddressUtxos(fromAddress), - // cardinal = return UTXOs not containing inscriptions or runes - addressInfo.type === AddressType.p2tr ? ordinalsClient.getOutputsFromAddress(fromAddress, 'cardinal') : [], - ]); - } else { - [confirmedUtxos, feeRate, outputsFromAddress] = await Promise.all([ - esploraClient.getAddressUtxos(fromAddress), - esploraClient.getFeeEstimate(confirmationTarget), - // cardinal = return UTXOs not containing inscriptions or runes - addressInfo.type === AddressType.p2tr ? ordinalsClient.getOutputsFromAddress(fromAddress, 'cardinal') : [], - ]); - } + [confirmedUtxos, feeRate, outputsFromAddress] = await Promise.all([ + esploraClient.getAddressUtxos(fromAddress), + feeRate === undefined ? esploraClient.getFeeEstimate(confirmationTarget) : feeRate, + // cardinal = return UTXOs not containing inscriptions or runes + addressInfo.type === AddressType.p2tr ? ordinalsClient.getOutputsFromAddress(fromAddress, 'cardinal') : [], + ]); if (confirmedUtxos.length === 0) { throw new Error('No confirmed UTXOs');