Skip to content

Commit

Permalink
chore: fix review remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
slavastartsev committed Nov 18, 2024
1 parent 1aaa8a4 commit bc51614
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions sdk/src/wallet/utxo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit bc51614

Please sign in to comment.