@exodus/bitcoin-api 4.14.3 → 4.14.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 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.14.4](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@4.14.3...@exodus/bitcoin-api@4.14.4) (2026-04-23)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix: append valid path for btc mempool websocket url (#7851)
13
+
14
+
15
+
6
16
  ## [4.14.3](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@4.14.2...@exodus/bitcoin-api@4.14.3) (2026-04-15)
7
17
 
8
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/bitcoin-api",
3
- "version": "4.14.3",
3
+ "version": "4.14.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": "166b906440f92ef09d2f2563fec9d9a365a81015"
66
+ "gitHead": "b71dc8274c76060519eb7b2cebdccbc7919cd144"
67
67
  }
@@ -80,12 +80,12 @@ export function orderTxs(txs) {
80
80
  }
81
81
 
82
82
  /**
83
- * It concerts an api URL to a WS service URL.
83
+ * Strips a service URL down to its origin while preserving the scheme.
84
84
  *
85
85
  * https://somebtc.a.exodus.io/insight/ => https://somebtc.a.exodus.io
86
86
  *
87
87
  * @param {string} apiUrl the original apiUrl
88
- * @returns {string} a WS url without the paths.
88
+ * @returns {string} a service origin URL.
89
89
  */
90
90
  export function toWSUrl(apiUrl) {
91
91
  if (!apiUrl) {
@@ -106,12 +106,21 @@ export function toWSUrl(apiUrl) {
106
106
  }
107
107
  }
108
108
 
109
+ export function toMempoolWebSocketUrl(apiUrl) {
110
+ const wsUrl = toWSUrl(apiUrl)
111
+ if (typeof wsUrl !== 'string') {
112
+ return wsUrl
113
+ }
114
+
115
+ return `${wsUrl}/api/v1/ws`
116
+ }
117
+
109
118
  export function normalizeInsightConfig(config, monitorType) {
110
119
  const apiUrl = config?.insightServers?.[0]
111
120
  const mempoolApiUrl = config?.mempoolServer
112
121
  const wsUrl =
113
122
  monitorType === 'mempool'
114
- ? config?.mempoolServerWS || toWSUrl(mempoolApiUrl)
123
+ ? config?.mempoolServerWS || toMempoolWebSocketUrl(mempoolApiUrl)
115
124
  : config?.insightServersWS?.[0] || toWSUrl(apiUrl)
116
125
  return { apiUrl, mempoolApiUrl, wsUrl }
117
126
  }
@@ -5,7 +5,11 @@ import assert from 'minimalistic-assert'
5
5
  import ms from 'ms'
6
6
 
7
7
  import MempoolWSClient from '../insight-api-client/mempool-ws-client.js'
8
- import { normalizeInsightConfig, toWSUrl } from '../insight-api-client/util.js'
8
+ import {
9
+ normalizeInsightConfig,
10
+ toMempoolWebSocketUrl,
11
+ toWSUrl,
12
+ } from '../insight-api-client/util.js'
9
13
  import InsightWSClient from '../insight-api-client/ws.js'
10
14
  import { resolveUnconfirmedAncestorData } from '../unconfirmed-ancestor-data.js'
11
15
  import { BitcoinMonitorScanner } from './bitcoin-monitor-scanner.js'
@@ -103,7 +107,9 @@ export class Monitor extends BaseMonitor {
103
107
  this.#connectWS(
104
108
  wsUrl ||
105
109
  this.#wsUrl ||
106
- toWSUrl(this.#monitorType === 'mempool' ? this.#mempoolApiUrl : this.#apiUrl)
110
+ (this.#monitorType === 'mempool'
111
+ ? toMempoolWebSocketUrl(this.#mempoolApiUrl)
112
+ : toWSUrl(this.#apiUrl))
107
113
  )
108
114
  }
109
115
  }