@exodus/bitcoin-plugin 2.8.1 → 2.9.0
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 +10 -0
- package/package.json +3 -3
- package/src/create-asset.js +64 -5
- package/src/index.js +3 -1
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
|
+
## [2.9.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-plugin@2.8.1...@exodus/bitcoin-plugin@2.9.0) (2026-03-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* feat: add mempool indexer support for btc (#7492)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
6
16
|
## [2.8.1](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-plugin@2.8.0...@exodus/bitcoin-plugin@2.8.1) (2026-02-10)
|
|
7
17
|
|
|
8
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bitcoin-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Bitcoin plugin for Exodus SDK powered wallets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@exodus/bitcoin-meta": "^2.0.1",
|
|
31
31
|
"@exodus/bitcoinjs": "^2.0.0",
|
|
32
32
|
"@exodus/fetch": "^1.3.0",
|
|
33
|
-
"@exodus/models": "^
|
|
33
|
+
"@exodus/models": "^13.0.0",
|
|
34
34
|
"@exodus/web3-bitcoin-utils": "^2.4.0",
|
|
35
35
|
"coininfo": "^5.1.0",
|
|
36
36
|
"lodash": "^4.17.21",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"type": "git",
|
|
60
60
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "f7c3c3541471b863d7b8cb66b8e7885df847821d"
|
|
63
63
|
}
|
package/src/create-asset.js
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
GetFeeResolver,
|
|
19
19
|
InsightAPIClient,
|
|
20
20
|
isValidInscription,
|
|
21
|
+
MempoolRestClient,
|
|
21
22
|
moveFundsFactory,
|
|
22
23
|
sendTxFactory,
|
|
23
24
|
sendValidations,
|
|
@@ -40,13 +41,49 @@ import { nftsApiFactory } from './ordinals/nfts.js'
|
|
|
40
41
|
import { DEFAULT_ORDINAL_CHAIN_INDEX } from './ordinals/ordinals-constants.js'
|
|
41
42
|
import { createWeb3API } from './web3/index.js'
|
|
42
43
|
|
|
44
|
+
const assertMonitorConfig = ({
|
|
45
|
+
monitorType,
|
|
46
|
+
apiUrl,
|
|
47
|
+
mempoolApiUrl,
|
|
48
|
+
configMinFeeRate,
|
|
49
|
+
maxTrackedAddresses,
|
|
50
|
+
}) => {
|
|
51
|
+
assert(
|
|
52
|
+
['insight', 'mempool'].includes(monitorType),
|
|
53
|
+
'monitorType must be either insight or mempool'
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
assert(apiUrl, 'apiUrl is required')
|
|
57
|
+
if (monitorType === 'mempool') {
|
|
58
|
+
assert(mempoolApiUrl, 'mempoolApiUrl is required when monitorType is mempool')
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
assert(
|
|
62
|
+
typeof configMinFeeRate === 'number' &&
|
|
63
|
+
Number.isFinite(configMinFeeRate) &&
|
|
64
|
+
configMinFeeRate >= 0,
|
|
65
|
+
'configMinFeeRate must be a finite number greater than or equal to 0'
|
|
66
|
+
)
|
|
67
|
+
assert(
|
|
68
|
+
Number.isInteger(maxTrackedAddresses) && maxTrackedAddresses > 0,
|
|
69
|
+
'maxTrackedAddresses must be a positive integer'
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
43
73
|
export const createBitcoinAssetFactory =
|
|
44
|
-
({
|
|
74
|
+
({
|
|
75
|
+
asset,
|
|
76
|
+
apiUrl: defaultApiUrl,
|
|
77
|
+
mempoolApiUrl: defaultMempoolApiUrl,
|
|
78
|
+
coinInfoNetwork,
|
|
79
|
+
isTestnet = false,
|
|
80
|
+
}) =>
|
|
45
81
|
({
|
|
46
82
|
assetClientInterface,
|
|
47
83
|
overrideCallback = ({ asset }) => asset,
|
|
48
84
|
config: {
|
|
49
85
|
apiUrl: customApiUrl,
|
|
86
|
+
mempoolApiUrl: customMempoolApiUrl,
|
|
50
87
|
allowUnconfirmedRbfEnabledUtxos = false,
|
|
51
88
|
ordinalChainIndex = DEFAULT_ORDINAL_CHAIN_INDEX,
|
|
52
89
|
ordinalsEnabled = false,
|
|
@@ -59,26 +96,41 @@ export const createBitcoinAssetFactory =
|
|
|
59
96
|
omitSupportedPurposes = [],
|
|
60
97
|
defaultOutputType = 'P2WSH',
|
|
61
98
|
changeAddressType = 'P2WPKH',
|
|
99
|
+
monitorType = 'insight',
|
|
100
|
+
configMinFeeRate = 10, // Minimum fee rate to use with mempool fee estimates.
|
|
101
|
+
maxTrackedAddresses = 20, // Maximum addresses to subscribe to on mempool WS.
|
|
62
102
|
} = Object.create(null),
|
|
63
103
|
}) => {
|
|
64
104
|
const apiUrl = customApiUrl || defaultApiUrl
|
|
105
|
+
const mempoolApiUrl = customMempoolApiUrl || defaultMempoolApiUrl
|
|
65
106
|
assert(assetClientInterface, 'assetClientInterface is required')
|
|
66
107
|
assert(asset, 'asset is required')
|
|
67
108
|
assert(typeof ordinalChainIndex === 'number', 'ordinalChainIndex must be a number')
|
|
68
|
-
assert(apiUrl, 'apiUrl is required')
|
|
69
109
|
assert(typeof extraChainIndexEnabled === 'boolean', 'extraChainIndexEnabled must be boolean')
|
|
70
110
|
assert(
|
|
71
111
|
typeof extraChainIndex === 'number' && extraChainIndex > 1,
|
|
72
112
|
'extraChainIndex must be a number greater than 1'
|
|
73
113
|
)
|
|
114
|
+
assertMonitorConfig({
|
|
115
|
+
monitorType,
|
|
116
|
+
apiUrl,
|
|
117
|
+
mempoolApiUrl,
|
|
118
|
+
configMinFeeRate,
|
|
119
|
+
maxTrackedAddresses,
|
|
120
|
+
})
|
|
74
121
|
|
|
75
122
|
const multipleAddresses = true // Indicates multiple addresses are supported. This is not configurable as it also affects address derivation.
|
|
76
123
|
|
|
77
124
|
const coinInfo = _coinInfo(coinInfoNetwork || asset.name)
|
|
78
125
|
|
|
79
|
-
const insightClient =
|
|
80
|
-
|
|
81
|
-
|
|
126
|
+
const insightClient =
|
|
127
|
+
monitorType === 'mempool'
|
|
128
|
+
? new MempoolRestClient({
|
|
129
|
+
baseURL: mempoolApiUrl,
|
|
130
|
+
insightBaseURL: apiUrl,
|
|
131
|
+
configMinFeeRate,
|
|
132
|
+
})
|
|
133
|
+
: new InsightAPIClient(apiUrl)
|
|
82
134
|
|
|
83
135
|
const useBip84 = true
|
|
84
136
|
const useBip86 = true
|
|
@@ -206,6 +258,9 @@ export const createBitcoinAssetFactory =
|
|
|
206
258
|
extraChainIndex,
|
|
207
259
|
extraChainIndexEnabled,
|
|
208
260
|
apiUrl,
|
|
261
|
+
mempoolApiUrl,
|
|
262
|
+
monitorType,
|
|
263
|
+
maxTrackedAddresses,
|
|
209
264
|
gapLimit,
|
|
210
265
|
refreshGapLimit,
|
|
211
266
|
...args,
|
|
@@ -320,6 +375,10 @@ export const createBitcoinAssetFactory =
|
|
|
320
375
|
asset: fullAsset,
|
|
321
376
|
config: {
|
|
322
377
|
apiUrl: customApiUrl || defaultApiUrl,
|
|
378
|
+
mempoolApiUrl: customMempoolApiUrl || defaultMempoolApiUrl,
|
|
379
|
+
monitorType,
|
|
380
|
+
configMinFeeRate,
|
|
381
|
+
maxTrackedAddresses,
|
|
323
382
|
allowUnconfirmedRbfEnabledUtxos,
|
|
324
383
|
ordinalChainIndex,
|
|
325
384
|
ordinalsEnabled,
|
package/src/index.js
CHANGED
|
@@ -5,6 +5,8 @@ import { createBitcoinAssetFactory } from './create-asset.js'
|
|
|
5
5
|
export * from './create-asset.js' // for bitcoinregtest and bitcointestnet
|
|
6
6
|
|
|
7
7
|
const apiUrl = 'https://bitcoin.a.exodus.io/insight/'
|
|
8
|
-
|
|
8
|
+
// TODO: replace this once we have a production mempool API URL
|
|
9
|
+
const mempoolApiUrl = 'https://btc-mempool-d.a.exodus.io/'
|
|
10
|
+
export const createAsset = createBitcoinAssetFactory({ asset, apiUrl, mempoolApiUrl })
|
|
9
11
|
const assetPlugin = { createAsset }
|
|
10
12
|
export default assetPlugin
|