@exodus/bitcoin-api 2.6.8-hiro.1 → 2.6.8-hiro.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/bitcoin-api",
3
- "version": "2.6.8-hiro.1",
3
+ "version": "2.6.8-hiro.2",
4
4
  "description": "Exodus bitcoin-api",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -452,7 +452,7 @@ export const createAndBroadcastTXFactory = ({
452
452
 
453
453
  const remainingOrdinalsUtxos = transferOrdinalsUtxos
454
454
  ? currentOrdinalsUtxos.difference(transferOrdinalsUtxos)
455
- : undefined
455
+ : currentOrdinalsUtxos
456
456
 
457
457
  await assetClientInterface.updateAccountState({
458
458
  assetName,
@@ -118,12 +118,20 @@ export function getConfirmedOrRfbDisabledUtxos({ utxos, allowUnconfirmedRbfEnabl
118
118
  return utxos.filter((utxo) => utxo.confirmations > 0 || !utxo.rbfEnabled)
119
119
  }
120
120
 
121
+ function filterDustUtxos({ utxos, feeData }) {
122
+ if (feeData.utxoDustValue) {
123
+ return utxos.filter((utxo) => utxo.value.toBaseNumber() > feeData.utxoDustValue)
124
+ }
125
+ return utxos
126
+ }
127
+
121
128
  export function getUsableUtxos({ asset, utxos, feeData, txSet }) {
122
129
  assert(asset, 'asset is required')
123
130
  assert(utxos, 'utxos is required')
124
131
  assert(feeData, 'feeData is required')
125
132
  assert(txSet, 'txSet is required')
126
- if (!['bitcoin', 'bitcointestnet', 'bitcoinregtest'].includes(asset.name)) return utxos
133
+ if (!['bitcoin', 'bitcointestnet', 'bitcoinregtest'].includes(asset.name))
134
+ return filterDustUtxos({ utxos, feeData })
127
135
  const { fastestFee } = feeData
128
136
  const feeRate = fastestFee.toBaseNumber()
129
137
  const maxFee = feeData.maxExtraCpfpFee
@@ -135,7 +143,9 @@ export function getUsableUtxos({ asset, utxos, feeData, txSet }) {
135
143
  feeRate,
136
144
  maxFee,
137
145
  })
138
- return largeUnconfirmedTxs.size === 0
139
- ? utxos
140
- : utxos.filter((utxo) => !largeUnconfirmedTxs.has(utxo.txId))
146
+ const confirmedAndSmallUtxos =
147
+ largeUnconfirmedTxs.size === 0
148
+ ? utxos
149
+ : utxos.filter((utxo) => !largeUnconfirmedTxs.has(utxo.txId))
150
+ return filterDustUtxos({ utxos: confirmedAndSmallUtxos, feeData })
141
151
  }