@exodus/bitcoin-api 4.0.0 → 4.0.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/CHANGELOG.md +18 -0
- package/package.json +2 -2
- package/src/fee/can-bump-tx.js +5 -2
- package/src/insight-api-client/index.js +3 -1
- package/src/tx-log/bitcoin-monitor.js +5 -24
- package/src/tx-send/index.js +13 -11
- package/src/utxos-utils.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.0.2](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@4.0.1...@exodus/bitcoin-api@4.0.2) (2025-09-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* fix: use buffers to represent digibyte tx values (#6375)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [4.0.1](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@4.0.0...@exodus/bitcoin-api@4.0.1) (2025-08-28)
|
|
17
|
+
|
|
18
|
+
**Note:** Version bump only for package @exodus/bitcoin-api
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
## [4.0.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@3.3.0...@exodus/bitcoin-api@4.0.0) (2025-08-03)
|
|
7
25
|
|
|
8
26
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bitcoin-api",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Bitcoin transaction and fee monitors, RPC with the blockchain node, other networking code.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"type": "git",
|
|
60
60
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "afae6f33fd023d0acd33ee536c4bbad98147312d"
|
|
63
63
|
}
|
package/src/fee/can-bump-tx.js
CHANGED
|
@@ -76,13 +76,16 @@ const _canBumpTx = ({
|
|
|
76
76
|
// Can't bump a non-rbf tx with no change
|
|
77
77
|
if (!bumpTx && changeUtxos.size === 0) return { errorMessage: 'no change' }
|
|
78
78
|
// Can't bump a confirmed tx
|
|
79
|
-
if (!bumpTx && changeUtxos.toArray().every(isUtxoConfirmed))
|
|
79
|
+
if (!bumpTx && changeUtxos.toArray().every(isUtxoConfirmed)) {
|
|
80
80
|
return { errorMessage: 'already confirmed' }
|
|
81
|
+
}
|
|
82
|
+
|
|
81
83
|
// Can't bump an rbf tx if change is already spent
|
|
82
|
-
if (bumpTx && bumpTx.data.changeAddress && changeUtxos.size === 0)
|
|
84
|
+
if (bumpTx && bumpTx.data.changeAddress && changeUtxos.size === 0) {
|
|
83
85
|
return {
|
|
84
86
|
errorMessage: 'already spent',
|
|
85
87
|
}
|
|
88
|
+
}
|
|
86
89
|
|
|
87
90
|
if (bumpTx) {
|
|
88
91
|
const { replaceTx, fee } = selectUtxos({
|
|
@@ -21,12 +21,14 @@ const fetchJson = async (url, fetchOptions, nullWhen404) => {
|
|
|
21
21
|
return null
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
if (!response.ok)
|
|
24
|
+
if (!response.ok) {
|
|
25
25
|
throw new Error(
|
|
26
26
|
`${url} returned ${response.status}: ${
|
|
27
27
|
response.statusText || 'Unknown Status Text'
|
|
28
28
|
}. Body: ${await getTextFromResponse(response)}`
|
|
29
29
|
)
|
|
30
|
+
}
|
|
31
|
+
|
|
30
32
|
return response.json()
|
|
31
33
|
}
|
|
32
34
|
|
|
@@ -9,7 +9,7 @@ import InsightWSClient from '../insight-api-client/ws.js'
|
|
|
9
9
|
import { resolveUnconfirmedAncestorData } from '../unconfirmed-ancestor-data.js'
|
|
10
10
|
import { BitcoinMonitorScanner } from './bitcoin-monitor-scanner.js'
|
|
11
11
|
|
|
12
|
-
const { isEmpty, isEqual
|
|
12
|
+
const { isEmpty, isEqual } = lodash
|
|
13
13
|
|
|
14
14
|
// NOTE: this is a frankenstein mashup of Exodus desktop
|
|
15
15
|
// assets-refresh/insight action + Neo monitor
|
|
@@ -171,18 +171,8 @@ export class Monitor extends BaseMonitor {
|
|
|
171
171
|
})
|
|
172
172
|
|
|
173
173
|
const newData = {}
|
|
174
|
-
if (utxos
|
|
175
|
-
|
|
176
|
-
newData,
|
|
177
|
-
pickBy(
|
|
178
|
-
{
|
|
179
|
-
utxos,
|
|
180
|
-
ordinalsUtxos,
|
|
181
|
-
},
|
|
182
|
-
Boolean
|
|
183
|
-
)
|
|
184
|
-
)
|
|
185
|
-
}
|
|
174
|
+
if (utxos) newData.utxos = utxos
|
|
175
|
+
if (ordinalsUtxos) newData.ordinalsUtxos = ordinalsUtxos
|
|
186
176
|
|
|
187
177
|
if (txsToUpdate.length > 0) {
|
|
188
178
|
await this.updateTxLog({ assetName, walletAccount, logItems: txsToUpdate })
|
|
@@ -254,17 +244,8 @@ export class Monitor extends BaseMonitor {
|
|
|
254
244
|
})
|
|
255
245
|
|
|
256
246
|
const newData = {}
|
|
257
|
-
if (utxos
|
|
258
|
-
|
|
259
|
-
newData,
|
|
260
|
-
pickBy(
|
|
261
|
-
{
|
|
262
|
-
utxos,
|
|
263
|
-
ordinalsUtxos,
|
|
264
|
-
},
|
|
265
|
-
Boolean
|
|
266
|
-
)
|
|
267
|
-
)
|
|
247
|
+
if (utxos) newData.utxos = utxos
|
|
248
|
+
if (ordinalsUtxos) newData.ordinalsUtxos = ordinalsUtxos
|
|
268
249
|
|
|
269
250
|
if (!isEmpty(changedUnusedAddressIndexes)) {
|
|
270
251
|
// Only for mobile atm, browser and hydra calculates from the latest txLogs
|
package/src/tx-send/index.js
CHANGED
|
@@ -35,6 +35,8 @@ const ASSETS_SUPPORTED_BIP_174 = new Set([
|
|
|
35
35
|
'vertcoin', // is not available on mobile!
|
|
36
36
|
])
|
|
37
37
|
|
|
38
|
+
const ASSETS_USING_BUFFER_VALUES = new Set(['dogecoin', 'digibyte'])
|
|
39
|
+
|
|
38
40
|
export async function getNonWitnessTxs(asset, utxos, insightClient) {
|
|
39
41
|
const rawTxs = []
|
|
40
42
|
|
|
@@ -521,8 +523,10 @@ export const createAndBroadcastTXFactory =
|
|
|
521
523
|
/txn-mempool-conflict/.test(e.message) ||
|
|
522
524
|
/tx-size/.test(e.message) ||
|
|
523
525
|
/txn-already-in-mempool/.test(e.message)
|
|
524
|
-
)
|
|
526
|
+
) {
|
|
525
527
|
e.finalError = true
|
|
528
|
+
}
|
|
529
|
+
|
|
526
530
|
throw e
|
|
527
531
|
}
|
|
528
532
|
},
|
|
@@ -702,12 +706,11 @@ export const createAndBroadcastTXFactory =
|
|
|
702
706
|
}
|
|
703
707
|
|
|
704
708
|
export function createInputs(assetName, ...rest) {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
return dogecoinCreateInputs(...rest)
|
|
708
|
-
default:
|
|
709
|
-
return defaultCreateInputs(...rest)
|
|
709
|
+
if (ASSETS_USING_BUFFER_VALUES.has(assetName)) {
|
|
710
|
+
return dogecoinCreateInputs(...rest)
|
|
710
711
|
}
|
|
712
|
+
|
|
713
|
+
return defaultCreateInputs(...rest)
|
|
711
714
|
}
|
|
712
715
|
|
|
713
716
|
function defaultCreateInputs(utxos, rbfEnabled) {
|
|
@@ -724,12 +727,11 @@ function defaultCreateInputs(utxos, rbfEnabled) {
|
|
|
724
727
|
}
|
|
725
728
|
|
|
726
729
|
export function createOutput(assetName, ...rest) {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
return dogecoinCreateOutput(...rest)
|
|
730
|
-
default:
|
|
731
|
-
return defaultCreateOutput(...rest)
|
|
730
|
+
if (ASSETS_USING_BUFFER_VALUES.has(assetName)) {
|
|
731
|
+
return dogecoinCreateOutput(...rest)
|
|
732
732
|
}
|
|
733
|
+
|
|
734
|
+
return defaultCreateOutput(...rest)
|
|
733
735
|
}
|
|
734
736
|
|
|
735
737
|
function defaultCreateOutput(address, sendAmount) {
|
package/src/utxos-utils.js
CHANGED
|
@@ -252,8 +252,9 @@ export function getUsableUtxos({
|
|
|
252
252
|
(utxo) => !utxo.isCoinbase || utxo.confirmations >= COINBASE_MATURITY_HEIGHT
|
|
253
253
|
)
|
|
254
254
|
|
|
255
|
-
if (!['bitcoin', 'bitcointestnet', 'bitcoinregtest'].includes(asset.name))
|
|
255
|
+
if (!['bitcoin', 'bitcointestnet', 'bitcoinregtest'].includes(asset.name)) {
|
|
256
256
|
return filterDustUtxos({ utxos, feeData })
|
|
257
|
+
}
|
|
257
258
|
|
|
258
259
|
assert(feeData.fastestFee, 'feeData.fastestFee is required')
|
|
259
260
|
assert(
|