@exodus/bitcoin-api 4.15.2 → 4.15.4
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 +20 -0
- package/package.json +2 -2
- package/src/multisig-address.js +11 -9
- package/src/psbt-parser.js +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
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.15.4](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@4.15.3...@exodus/bitcoin-api@4.15.4) (2026-05-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* fix: fail fast on mismatched PSBT non-witness UTXOs (#8148)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [4.15.3](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@4.15.2...@exodus/bitcoin-api@4.15.3) (2026-05-27)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
* fix: reject duplicate keys with swapped polarity for P2TR multisig (#8124)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [4.15.2](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@4.15.1...@exodus/bitcoin-api@4.15.2) (2026-05-27)
|
|
7
27
|
|
|
8
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bitcoin-api",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.4",
|
|
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",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"type": "git",
|
|
64
64
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "a2a294de9468382e1c3bbdebf6db6eea2bea4b1c"
|
|
67
67
|
}
|
package/src/multisig-address.js
CHANGED
|
@@ -39,10 +39,6 @@ export const createEncodeMultisigContract =
|
|
|
39
39
|
throw new Error(`asset.encodeMultisigContract supports from 1 to ${MAX_PUBKEYS} pubKeys`)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
if (new Set(publicKeys.map((k) => k.toString('hex'))).size !== publicKeys.length) {
|
|
43
|
-
throw new Error('publicKeys must not contain any duplicates')
|
|
44
|
-
}
|
|
45
|
-
|
|
46
42
|
if (!Number.isSafeInteger(version)) {
|
|
47
43
|
throw new TypeError('asset.encodeMultisigContract requires meta.version to be an integer')
|
|
48
44
|
}
|
|
@@ -62,17 +58,23 @@ export const createEncodeMultisigContract =
|
|
|
62
58
|
throw new Error('threshold must be <= publicKeys.length')
|
|
63
59
|
}
|
|
64
60
|
|
|
61
|
+
const publicKeysXOnly = publicKeys.map(toXOnly)
|
|
62
|
+
|
|
63
|
+
if (new Set(publicKeysXOnly.map((k) => k.toString('hex'))).size !== publicKeysXOnly.length) {
|
|
64
|
+
throw new Error('publicKeys must not contain any duplicates')
|
|
65
|
+
}
|
|
66
|
+
|
|
65
67
|
// Sort according to BIP67 https://github.com/bitcoin/bips/blob/master/bip-0067.mediawiki
|
|
66
|
-
|
|
68
|
+
publicKeysXOnly.sort((a, b) => Buffer.compare(a, b))
|
|
67
69
|
|
|
68
70
|
// Create multisig redeem script https://github.com/bitcoin/bips/blob/master/bip-0342.mediawiki#cite_note-5
|
|
69
71
|
const OPS = bitcoinjsLib.script.OPS
|
|
70
72
|
const chunks = []
|
|
71
|
-
const
|
|
73
|
+
const keysXOnlyIter = publicKeysXOnly[Symbol.iterator]()
|
|
72
74
|
|
|
73
|
-
chunks.push(
|
|
74
|
-
for (const key of
|
|
75
|
-
chunks.push(
|
|
75
|
+
chunks.push(keysXOnlyIter.next().value, OPS.OP_CHECKSIG)
|
|
76
|
+
for (const key of keysXOnlyIter) {
|
|
77
|
+
chunks.push(key, OPS.OP_CHECKSIGADD)
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
chunks.push(Buffer.from([threshold]), OPS.OP_NUMEQUAL)
|
package/src/psbt-parser.js
CHANGED
|
@@ -14,6 +14,14 @@ import { getUsableUtxos, getUtxos } from './utxos-utils.js'
|
|
|
14
14
|
function extractInputUtxoData(psbtInput, txInput, index, Transaction) {
|
|
15
15
|
if (psbtInput.nonWitnessUtxo) {
|
|
16
16
|
const prevTx = Transaction.fromBuffer(psbtInput.nonWitnessUtxo)
|
|
17
|
+
const prevoutHash = txInput.hash
|
|
18
|
+
const utxoHash = prevTx.getHash()
|
|
19
|
+
if (!prevoutHash.equals(utxoHash)) {
|
|
20
|
+
throw new Error(
|
|
21
|
+
`Non-witness UTXO hash for input #${index} doesn't match the hash specified in the prevout`
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
17
25
|
const prevOutput = prevTx.outs[txInput.index]
|
|
18
26
|
|
|
19
27
|
return {
|