@exodus/bitcoin-api 4.15.2 → 4.15.3

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 CHANGED
@@ -3,6 +3,16 @@
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.3](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@4.15.2...@exodus/bitcoin-api@4.15.3) (2026-05-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix: reject duplicate keys with swapped polarity for P2TR multisig (#8124)
13
+
14
+
15
+
6
16
  ## [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
17
 
8
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/bitcoin-api",
3
- "version": "4.15.2",
3
+ "version": "4.15.3",
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": "c5d3a519f291e17f6b95cb0804e6d86d71be1dd8"
66
+ "gitHead": "3971c2a60d201b078249fe7653e7ccc21b38c371"
67
67
  }
@@ -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
- publicKeys.sort((a, b) => Buffer.compare(toXOnly(a), toXOnly(b)))
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 keysIter = publicKeys[Symbol.iterator]()
73
+ const keysXOnlyIter = publicKeysXOnly[Symbol.iterator]()
72
74
 
73
- chunks.push(toXOnly(keysIter.next().value), OPS.OP_CHECKSIG)
74
- for (const key of keysIter) {
75
- chunks.push(toXOnly(key), OPS.OP_CHECKSIGADD)
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)