@exodus/bitcoin-api 2.33.1 → 2.34.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 +2 -2
- package/src/get-activity-txs.js +33 -0
- package/src/index.js +1 -0
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.34.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@2.33.1...@exodus/bitcoin-api@2.34.0) (2025-07-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* feat: add getActivityTxs (#6003)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
6
16
|
## [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
17
|
|
|
8
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bitcoin-api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.34.0",
|
|
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": "
|
|
59
|
+
"gitHead": "cc7653acda9d1e9d6223536fd2bca6d164d96faa"
|
|
60
60
|
}
|
|
@@ -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'
|