@exodus/bitcoin-api 2.33.0 → 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 +20 -0
- package/package.json +2 -2
- package/src/get-activity-txs.js +33 -0
- package/src/index.js +1 -0
- package/src/tx-sign/default-prepare-for-signing.js +1 -1
- package/src/tx-sign/taproot.js +1 -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.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
|
+
|
|
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)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
* fix: fix zcash buffer signing audit findings (#5997)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [2.33.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@2.32.0...@exodus/bitcoin-api@2.33.0) (2025-06-30)
|
|
7
27
|
|
|
8
28
|
|
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'
|
|
@@ -80,7 +80,7 @@ function createPsbtFromTxData({
|
|
|
80
80
|
const psbt = new Psbt({ maximumFeeRate, network: networkInfo })
|
|
81
81
|
|
|
82
82
|
// If present, add blockHeight as a proprietary field
|
|
83
|
-
if (blockHeight) {
|
|
83
|
+
if (blockHeight !== undefined) {
|
|
84
84
|
writePsbtBlockHeight(psbt, blockHeight)
|
|
85
85
|
}
|
|
86
86
|
|
package/src/tx-sign/taproot.js
CHANGED
|
@@ -50,7 +50,7 @@ export function toAsyncSigner({ privateKey, publicKey, isTaprootKeySpend }) {
|
|
|
50
50
|
signEncoded: async ({ data, enc = 'sig' }) => {
|
|
51
51
|
assert(
|
|
52
52
|
['der', 'sig'].includes(enc),
|
|
53
|
-
'
|
|
53
|
+
'signEncoded: invalid encoding type. Expected "der" or "sig".'
|
|
54
54
|
)
|
|
55
55
|
return secp256k1.ecdsaSignHash({
|
|
56
56
|
hash: data,
|