@exodus/bitcoin-api 2.33.1 → 2.34.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
+ ## [2.34.1](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@2.34.0...@exodus/bitcoin-api@2.34.1) (2025-07-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix: use fee data from balances (#6018)
13
+
14
+
15
+
16
+ ## [2.34.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@2.33.1...@exodus/bitcoin-api@2.34.0) (2025-07-03)
17
+
18
+
19
+ ### Features
20
+
21
+
22
+ * feat: add getActivityTxs (#6003)
23
+
24
+
25
+
6
26
  ## [2.33.1](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@2.33.0...@exodus/bitcoin-api@2.33.1) (2025-07-02)
7
27
 
8
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/bitcoin-api",
3
- "version": "2.33.1",
3
+ "version": "2.34.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",
@@ -56,5 +56,5 @@
56
56
  "type": "git",
57
57
  "url": "git+https://github.com/ExodusMovement/assets.git"
58
58
  },
59
- "gitHead": "e20e071e8602e9032cb37dd65dad27ba6859bf7e"
59
+ "gitHead": "5257fdf0f08e1c8f22849ed6c190f083f4393efb"
60
60
  }
package/src/balances.js CHANGED
@@ -3,18 +3,14 @@ import assert from 'minimalistic-assert'
3
3
 
4
4
  import { getUnconfirmedUtxos, getUtxos } from './utxos-utils.js'
5
5
 
6
- // known issue!! fee data is static here!
7
- // Hydra's balances's module does not provide it when calling asset.api.getBalances
8
- // https://github.com/ExodusMovement/exodus-hydra/blob/f9110f8e9e76b8b199bc4d40461cb1bed3a5be1e/modules/balances/module/index.js#L130
9
- // feeData is required to know if an unconfirmed tx can or cannot be RBFed?
10
- // This could be fixed once we allow all unconfirmed utxos to be RBFed or if we change the balance module to provide the feeData when calling asset.api.getBalances
11
- export const getBalancesFactory = ({ feeData, getSpendableBalance, ordinalsEnabled }) => {
12
- assert(feeData, 'feeData is required')
6
+ export const getBalancesFactory = ({ feeData: defaultFeeData, getSpendableBalance }) => {
7
+ assert(defaultFeeData, 'default feeData is required')
13
8
  assert(getSpendableBalance, 'getSpendableBalance is required')
14
- return ({ asset, accountState, txLog }) => {
9
+ return ({ asset, accountState, txLog, feeData = defaultFeeData }) => {
15
10
  assert(asset, 'asset is required')
16
11
  assert(accountState, 'accountState is required')
17
12
  assert(txLog, 'txLog is required')
13
+ assert(feeData, 'feeData is required')
18
14
 
19
15
  const utxos = getUtxos({ asset, accountState })
20
16
  const balance = utxos.value
@@ -0,0 +1,33 @@
1
+ import { Tx } from '@exodus/models'
2
+
3
+ import { parseCurrency } from './fee/fee-utils.js'
4
+
5
+ export const getActivityTxs = ({ txs, asset }) => {
6
+ return txs.flatMap((tx) => {
7
+ if (tx.sent && Array.isArray(tx.data.sent) && tx.data.sent.length > 0) {
8
+ const feeAmount = tx.feeAmount.div(tx.data.sent.length)
9
+ return tx.data.sent
10
+ .map((to, i) => {
11
+ // Avoids using tx.update(...) because it uses lodash _.merge
12
+ // which can be pretty slow on mobile.
13
+ const current = tx.toJSON()
14
+ return Tx.fromJSON({
15
+ ...current,
16
+ to: to.address,
17
+ data: {
18
+ ...current.data,
19
+ sentIndex: i,
20
+ activityIndex: i,
21
+ },
22
+ coinAmount: to.amount
23
+ ? parseCurrency(to.amount, asset.currency).negate()
24
+ : asset.currency.ZERO,
25
+ feeAmount,
26
+ })
27
+ })
28
+ .reverse()
29
+ }
30
+
31
+ return tx
32
+ })
33
+ }
package/src/index.js CHANGED
@@ -25,6 +25,7 @@ export { toAsyncSigner } from './tx-sign/taproot.js'
25
25
  export * from './ordinals-utils.js'
26
26
  export { signMessage, signMessageWithSigner } from './sign-message.js'
27
27
  export { writePsbtBlockHeight, readPsbtBlockHeight } from './psbt-proprietary-types.js'
28
+ export { getActivityTxs } from './get-activity-txs.js'
28
29
 
29
30
  // TODO: remove these, kept for compat
30
31
  export { scriptClassify } from '@exodus/bitcoinjs'