@exodus/bitcoin-plugin 2.8.1 → 2.10.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 +20 -0
- package/package.json +4 -4
- package/src/create-asset.js +68 -5
- package/src/index.js +3 -1
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
|
+
## [2.10.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-plugin@2.9.0...@exodus/bitcoin-plugin@2.10.0) (2026-03-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* feat: add getFeeAsync to bitcoin and bitcoin-like assets (#7616)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [2.9.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-plugin@2.8.1...@exodus/bitcoin-plugin@2.9.0) (2026-03-26)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
* feat: add mempool indexer support for btc (#7492)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [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
27
|
|
|
8
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bitcoin-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "Bitcoin plugin for Exodus SDK powered wallets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"@exodus/asset-lib": "^5.0.0",
|
|
26
26
|
"@exodus/assets": "^11.6.0",
|
|
27
27
|
"@exodus/bip44-constants": "^195.0.0",
|
|
28
|
-
"@exodus/bitcoin-api": "^4.
|
|
28
|
+
"@exodus/bitcoin-api": "^4.14.0",
|
|
29
29
|
"@exodus/bitcoin-lib": "^2.4.2",
|
|
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": "959153b1ea9f3fc33398dd5a167c2c29c8af2df1"
|
|
63
63
|
}
|
package/src/create-asset.js
CHANGED
|
@@ -14,10 +14,12 @@ import {
|
|
|
14
14
|
getBalancesFactory,
|
|
15
15
|
getBtcVersions,
|
|
16
16
|
getCreateBatchTransaction,
|
|
17
|
+
getFeeAsyncFactory,
|
|
17
18
|
getFeeEstimatorFactory,
|
|
18
19
|
GetFeeResolver,
|
|
19
20
|
InsightAPIClient,
|
|
20
21
|
isValidInscription,
|
|
22
|
+
MempoolRestClient,
|
|
21
23
|
moveFundsFactory,
|
|
22
24
|
sendTxFactory,
|
|
23
25
|
sendValidations,
|
|
@@ -40,13 +42,49 @@ import { nftsApiFactory } from './ordinals/nfts.js'
|
|
|
40
42
|
import { DEFAULT_ORDINAL_CHAIN_INDEX } from './ordinals/ordinals-constants.js'
|
|
41
43
|
import { createWeb3API } from './web3/index.js'
|
|
42
44
|
|
|
45
|
+
const assertMonitorConfig = ({
|
|
46
|
+
monitorType,
|
|
47
|
+
apiUrl,
|
|
48
|
+
mempoolApiUrl,
|
|
49
|
+
configMinFeeRate,
|
|
50
|
+
maxTrackedAddresses,
|
|
51
|
+
}) => {
|
|
52
|
+
assert(
|
|
53
|
+
['insight', 'mempool'].includes(monitorType),
|
|
54
|
+
'monitorType must be either insight or mempool'
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
assert(apiUrl, 'apiUrl is required')
|
|
58
|
+
if (monitorType === 'mempool') {
|
|
59
|
+
assert(mempoolApiUrl, 'mempoolApiUrl is required when monitorType is mempool')
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
assert(
|
|
63
|
+
typeof configMinFeeRate === 'number' &&
|
|
64
|
+
Number.isFinite(configMinFeeRate) &&
|
|
65
|
+
configMinFeeRate >= 0,
|
|
66
|
+
'configMinFeeRate must be a finite number greater than or equal to 0'
|
|
67
|
+
)
|
|
68
|
+
assert(
|
|
69
|
+
Number.isInteger(maxTrackedAddresses) && maxTrackedAddresses > 0,
|
|
70
|
+
'maxTrackedAddresses must be a positive integer'
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
43
74
|
export const createBitcoinAssetFactory =
|
|
44
|
-
({
|
|
75
|
+
({
|
|
76
|
+
asset,
|
|
77
|
+
apiUrl: defaultApiUrl,
|
|
78
|
+
mempoolApiUrl: defaultMempoolApiUrl,
|
|
79
|
+
coinInfoNetwork,
|
|
80
|
+
isTestnet = false,
|
|
81
|
+
}) =>
|
|
45
82
|
({
|
|
46
83
|
assetClientInterface,
|
|
47
84
|
overrideCallback = ({ asset }) => asset,
|
|
48
85
|
config: {
|
|
49
86
|
apiUrl: customApiUrl,
|
|
87
|
+
mempoolApiUrl: customMempoolApiUrl,
|
|
50
88
|
allowUnconfirmedRbfEnabledUtxos = false,
|
|
51
89
|
ordinalChainIndex = DEFAULT_ORDINAL_CHAIN_INDEX,
|
|
52
90
|
ordinalsEnabled = false,
|
|
@@ -59,26 +97,41 @@ export const createBitcoinAssetFactory =
|
|
|
59
97
|
omitSupportedPurposes = [],
|
|
60
98
|
defaultOutputType = 'P2WSH',
|
|
61
99
|
changeAddressType = 'P2WPKH',
|
|
100
|
+
monitorType = 'insight',
|
|
101
|
+
configMinFeeRate = 10, // Minimum fee rate to use with mempool fee estimates.
|
|
102
|
+
maxTrackedAddresses = 20, // Maximum addresses to subscribe to on mempool WS.
|
|
62
103
|
} = Object.create(null),
|
|
63
104
|
}) => {
|
|
64
105
|
const apiUrl = customApiUrl || defaultApiUrl
|
|
106
|
+
const mempoolApiUrl = customMempoolApiUrl || defaultMempoolApiUrl
|
|
65
107
|
assert(assetClientInterface, 'assetClientInterface is required')
|
|
66
108
|
assert(asset, 'asset is required')
|
|
67
109
|
assert(typeof ordinalChainIndex === 'number', 'ordinalChainIndex must be a number')
|
|
68
|
-
assert(apiUrl, 'apiUrl is required')
|
|
69
110
|
assert(typeof extraChainIndexEnabled === 'boolean', 'extraChainIndexEnabled must be boolean')
|
|
70
111
|
assert(
|
|
71
112
|
typeof extraChainIndex === 'number' && extraChainIndex > 1,
|
|
72
113
|
'extraChainIndex must be a number greater than 1'
|
|
73
114
|
)
|
|
115
|
+
assertMonitorConfig({
|
|
116
|
+
monitorType,
|
|
117
|
+
apiUrl,
|
|
118
|
+
mempoolApiUrl,
|
|
119
|
+
configMinFeeRate,
|
|
120
|
+
maxTrackedAddresses,
|
|
121
|
+
})
|
|
74
122
|
|
|
75
123
|
const multipleAddresses = true // Indicates multiple addresses are supported. This is not configurable as it also affects address derivation.
|
|
76
124
|
|
|
77
125
|
const coinInfo = _coinInfo(coinInfoNetwork || asset.name)
|
|
78
126
|
|
|
79
|
-
const insightClient =
|
|
80
|
-
|
|
81
|
-
|
|
127
|
+
const insightClient =
|
|
128
|
+
monitorType === 'mempool'
|
|
129
|
+
? new MempoolRestClient({
|
|
130
|
+
baseURL: mempoolApiUrl,
|
|
131
|
+
insightBaseURL: apiUrl,
|
|
132
|
+
configMinFeeRate,
|
|
133
|
+
})
|
|
134
|
+
: new InsightAPIClient(apiUrl)
|
|
82
135
|
|
|
83
136
|
const useBip84 = true
|
|
84
137
|
const useBip86 = true
|
|
@@ -142,6 +195,8 @@ export const createBitcoinAssetFactory =
|
|
|
142
195
|
Transaction,
|
|
143
196
|
})
|
|
144
197
|
|
|
198
|
+
const getFeeAsync = getFeeAsyncFactory({ createTx, assetClientInterface })
|
|
199
|
+
|
|
145
200
|
const sendTx = sendTxFactory({
|
|
146
201
|
createTx,
|
|
147
202
|
assetClientInterface,
|
|
@@ -206,6 +261,9 @@ export const createBitcoinAssetFactory =
|
|
|
206
261
|
extraChainIndex,
|
|
207
262
|
extraChainIndexEnabled,
|
|
208
263
|
apiUrl,
|
|
264
|
+
mempoolApiUrl,
|
|
265
|
+
monitorType,
|
|
266
|
+
maxTrackedAddresses,
|
|
209
267
|
gapLimit,
|
|
210
268
|
refreshGapLimit,
|
|
211
269
|
...args,
|
|
@@ -284,6 +342,7 @@ export const createBitcoinAssetFactory =
|
|
|
284
342
|
getBalances,
|
|
285
343
|
getDefaultAddressPath,
|
|
286
344
|
getFee,
|
|
345
|
+
getFeeAsync,
|
|
287
346
|
getFeeData: () => feeData,
|
|
288
347
|
getKeyIdentifier,
|
|
289
348
|
getSendValidations: () => sendValidations,
|
|
@@ -320,6 +379,10 @@ export const createBitcoinAssetFactory =
|
|
|
320
379
|
asset: fullAsset,
|
|
321
380
|
config: {
|
|
322
381
|
apiUrl: customApiUrl || defaultApiUrl,
|
|
382
|
+
mempoolApiUrl: customMempoolApiUrl || defaultMempoolApiUrl,
|
|
383
|
+
monitorType,
|
|
384
|
+
configMinFeeRate,
|
|
385
|
+
maxTrackedAddresses,
|
|
323
386
|
allowUnconfirmedRbfEnabledUtxos,
|
|
324
387
|
ordinalChainIndex,
|
|
325
388
|
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
|