@exodus/bitcoin-api 3.0.0 → 3.1.1

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,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
+ ## [3.1.1](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@3.1.0...@exodus/bitcoin-api@3.1.1) (2025-07-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix: fetchUTXOs now search input script in response script and scriptPubKey fields (#6097)
13
+
14
+
15
+
16
+ ## [3.1.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@3.0.0...@exodus/bitcoin-api@3.1.0) (2025-07-15)
17
+
18
+
19
+ ### Features
20
+
21
+
22
+ * feat: enable buffer signing in decred (#5881)
23
+
24
+
25
+
6
26
  ## [3.0.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@2.34.1...@exodus/bitcoin-api@3.0.0) (2025-07-11)
7
27
 
8
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/bitcoin-api",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
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",
@@ -36,6 +36,7 @@
36
36
  "bip32-path": "^0.4.2",
37
37
  "bs58check": "^3.0.1",
38
38
  "delay": "^4.0.1",
39
+ "events": "^3.3.0",
39
40
  "lodash": "^4.17.21",
40
41
  "minimalistic-assert": "^1.0.1",
41
42
  "ms": "^2.1.1",
@@ -56,5 +57,5 @@
56
57
  "type": "git",
57
58
  "url": "git+https://github.com/ExodusMovement/assets.git"
58
59
  },
59
- "gitHead": "00006973d63f0ea79d60c2f2023805e5b412c321"
60
+ "gitHead": "a6b7f1349f8af1fdf341509bfd52578b53d11053"
60
61
  }
@@ -90,7 +90,7 @@ export default class InsightAPIClient {
90
90
  value: utxo.amount,
91
91
  vout: utxo.vout,
92
92
  height: utxo.height,
93
- script: utxo.script,
93
+ script: utxo.script ?? utxo.scriptPubKey,
94
94
  asset: utxo.asset,
95
95
  }))
96
96
  }
@@ -1,4 +1,4 @@
1
- import { EventEmitter } from 'events'
1
+ import EventEmitter from 'events/events.js'
2
2
  import io from 'socket.io-client'
3
3
 
4
4
  export default class InsightWSClient extends EventEmitter {
@@ -13,6 +13,7 @@ export const createGetKeyWithMetadata = ({
13
13
  privateKeysAddressMap,
14
14
  coinInfo,
15
15
  getKeyIdentifier,
16
+ getPrivateKeyFromMap = standardGetPrivateKeyFromMap,
16
17
  }) =>
17
18
  memoize(
18
19
  ({ address, derivationPath }) => {
@@ -36,7 +37,7 @@ export const createGetKeyWithMetadata = ({
36
37
  ({ address, derivationPath }) => address + '_' + derivationPath
37
38
  )
38
39
 
39
- function getPrivateKeyFromMap(privateKeysAddressMap, networkInfo, purpose, address) {
40
+ function standardGetPrivateKeyFromMap(privateKeysAddressMap, networkInfo, purpose, address) {
40
41
  const privateWif = getOwnProperty(privateKeysAddressMap, address, 'string')
41
42
  assert(privateWif, `there is no private key for address ${address}`)
42
43
 
@@ -12,6 +12,7 @@ export function createSignWithWallet({
12
12
  addressPathsMap,
13
13
  coinInfo,
14
14
  getKeyIdentifier,
15
+ getPrivateKeyFromMap,
15
16
  }) {
16
17
  const getKeyWithMetadata = createGetKeyWithMetadata({
17
18
  signer,
@@ -21,6 +22,7 @@ export function createSignWithWallet({
21
22
  addressPathsMap,
22
23
  coinInfo,
23
24
  getKeyIdentifier,
25
+ getPrivateKeyFromMap,
24
26
  })
25
27
 
26
28
  return async (psbt, inputsToSign, skipFinalize) => {
@@ -11,6 +11,7 @@ export const signTxFactory = ({
11
11
  coinInfo,
12
12
  network,
13
13
  getKeyIdentifier,
14
+ getPrivateKeyFromMap,
14
15
  Psbt = DefaultPsbt,
15
16
  Transaction = DefaultTransaction,
16
17
  }) => {
@@ -43,6 +44,7 @@ export const signTxFactory = ({
43
44
  hdkeys,
44
45
  resolvePurpose,
45
46
  privateKeysAddressMap,
47
+ getPrivateKeyFromMap,
46
48
  addressPathsMap,
47
49
  coinInfo,
48
50
  network,
@@ -84,6 +84,8 @@ function createPsbtFromTxData({
84
84
  writePsbtBlockHeight(psbt, blockHeight)
85
85
  }
86
86
 
87
+ const assetRequiresUtxoInInput = !['zcash', 'decred'].includes(assetName)
88
+
87
89
  // Fill tx
88
90
  for (const { txId, vout, address, value, script, sequence, tapLeafScript } of inputs) {
89
91
  // TODO: don't use the purpose as intermediate variable
@@ -92,11 +94,10 @@ function createPsbtFromTxData({
92
94
 
93
95
  const isSegwitAddress = purpose === 84
94
96
  const isTaprootAddress = purpose === 86
95
- const isZcashAsset = assetName === 'zcash'
96
97
 
97
98
  const txIn = { hash: txId, index: vout, sequence }
98
99
 
99
- if (isZcashAsset) {
100
+ if (!assetRequiresUtxoInInput) {
100
101
  txIn.script = script
101
102
  txIn.value = value
102
103
  }
@@ -112,7 +113,7 @@ function createPsbtFromTxData({
112
113
 
113
114
  const rawTx = (rawTxs || []).find((t) => t.txId === txId)
114
115
 
115
- if (!isTaprootAddress && !isZcashAsset) {
116
+ if (!isTaprootAddress && assetRequiresUtxoInInput) {
116
117
  assert(!!rawTx?.rawData, `Non-taproot outputs require the full previous transaction.`)
117
118
 
118
119
  const rawTxBuffer = Buffer.from(rawTx.rawData, 'hex')