utxostack / rgbpp-sdk

Utilities for Bitcoin and RGB++ asset integration
ISC License
53 stars 18 forks source link

feat(btc|service): add option to filter confirmed utxos and validate inputs #91

Closed ShookLyngs closed 7 months ago

ShookLyngs commented 7 months ago

Changes

  1. Support the "only_confirmed" param in the BtcAssetsApi.getUtxos() API (refer to btc-assets-api#40 and btc-assets-api#41)
  2. Support the "onlyConfirmedUtxos" option in the BTC APIs (sendBtc, sendUtxos, sendRgbppUtxos, and the BTC Builder APIs), and also validate inputs to check if each UTXO is confirmed

Details

Option onlyConfirmedUtxos in BTC APIs

This is a boolean option that tells the API to look for confirmed UTXOs when collecting inputs for construction and fee. If not enough confirmed UTXOs to construct the transaction, the API will throw an INSUFFICIENT_UTXO error.

sendBtc({
  // ...
  onlyConfirmedUtxos: true, // optional, default to false
});

Discussion

Related issues

Flouse commented 7 months ago
  • Do you prefer "transactionConfirmed" from the feature request as a better name for the option? Do you think "onlyConfirmedUtxos" is fine for now? Or do you have better naming suggestions? (validateInputs? filterConfirmedUtxos? requireConfirmedInputs? requireConfirmedUtxos? requireConfirmedInputs?)

onlyConfirmedUtxos is good.