@exodus/bitcoin-api 3.0.0 → 3.1.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 -2
- package/src/insight-api-client/ws.js +1 -1
- package/src/tx-sign/create-get-key-and-purpose.js +2 -1
- package/src/tx-sign/create-sign-with-wallet.js +2 -0
- package/src/tx-sign/default-create-tx.js +2 -0
- package/src/tx-sign/default-prepare-for-signing.js +4 -3
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
|
+
## [3.1.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@3.0.0...@exodus/bitcoin-api@3.1.0) (2025-07-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* feat: enable buffer signing in decred (#5881)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
6
16
|
## [3.0.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@2.34.1...@exodus/bitcoin-api@3.0.0) (2025-07-11)
|
|
7
17
|
|
|
8
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bitcoin-api",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.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",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"bip32-path": "^0.4.2",
|
|
37
37
|
"bs58check": "^3.0.1",
|
|
38
38
|
"delay": "^4.0.1",
|
|
39
|
+
"events": "^3.3.0",
|
|
39
40
|
"lodash": "^4.17.21",
|
|
40
41
|
"minimalistic-assert": "^1.0.1",
|
|
41
42
|
"ms": "^2.1.1",
|
|
@@ -56,5 +57,5 @@
|
|
|
56
57
|
"type": "git",
|
|
57
58
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
58
59
|
},
|
|
59
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "229692f08cdae6009bb5bb2abbe9d708f6b2ab11"
|
|
60
61
|
}
|
|
@@ -13,6 +13,7 @@ export const createGetKeyWithMetadata = ({
|
|
|
13
13
|
privateKeysAddressMap,
|
|
14
14
|
coinInfo,
|
|
15
15
|
getKeyIdentifier,
|
|
16
|
+
getPrivateKeyFromMap = standardGetPrivateKeyFromMap,
|
|
16
17
|
}) =>
|
|
17
18
|
memoize(
|
|
18
19
|
({ address, derivationPath }) => {
|
|
@@ -36,7 +37,7 @@ export const createGetKeyWithMetadata = ({
|
|
|
36
37
|
({ address, derivationPath }) => address + '_' + derivationPath
|
|
37
38
|
)
|
|
38
39
|
|
|
39
|
-
function
|
|
40
|
+
function standardGetPrivateKeyFromMap(privateKeysAddressMap, networkInfo, purpose, address) {
|
|
40
41
|
const privateWif = getOwnProperty(privateKeysAddressMap, address, 'string')
|
|
41
42
|
assert(privateWif, `there is no private key for address ${address}`)
|
|
42
43
|
|
|
@@ -12,6 +12,7 @@ export function createSignWithWallet({
|
|
|
12
12
|
addressPathsMap,
|
|
13
13
|
coinInfo,
|
|
14
14
|
getKeyIdentifier,
|
|
15
|
+
getPrivateKeyFromMap,
|
|
15
16
|
}) {
|
|
16
17
|
const getKeyWithMetadata = createGetKeyWithMetadata({
|
|
17
18
|
signer,
|
|
@@ -21,6 +22,7 @@ export function createSignWithWallet({
|
|
|
21
22
|
addressPathsMap,
|
|
22
23
|
coinInfo,
|
|
23
24
|
getKeyIdentifier,
|
|
25
|
+
getPrivateKeyFromMap,
|
|
24
26
|
})
|
|
25
27
|
|
|
26
28
|
return async (psbt, inputsToSign, skipFinalize) => {
|
|
@@ -11,6 +11,7 @@ export const signTxFactory = ({
|
|
|
11
11
|
coinInfo,
|
|
12
12
|
network,
|
|
13
13
|
getKeyIdentifier,
|
|
14
|
+
getPrivateKeyFromMap,
|
|
14
15
|
Psbt = DefaultPsbt,
|
|
15
16
|
Transaction = DefaultTransaction,
|
|
16
17
|
}) => {
|
|
@@ -43,6 +44,7 @@ export const signTxFactory = ({
|
|
|
43
44
|
hdkeys,
|
|
44
45
|
resolvePurpose,
|
|
45
46
|
privateKeysAddressMap,
|
|
47
|
+
getPrivateKeyFromMap,
|
|
46
48
|
addressPathsMap,
|
|
47
49
|
coinInfo,
|
|
48
50
|
network,
|
|
@@ -84,6 +84,8 @@ function createPsbtFromTxData({
|
|
|
84
84
|
writePsbtBlockHeight(psbt, blockHeight)
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
const assetRequiresUtxoInInput = !['zcash', 'decred'].includes(assetName)
|
|
88
|
+
|
|
87
89
|
// Fill tx
|
|
88
90
|
for (const { txId, vout, address, value, script, sequence, tapLeafScript } of inputs) {
|
|
89
91
|
// TODO: don't use the purpose as intermediate variable
|
|
@@ -92,11 +94,10 @@ function createPsbtFromTxData({
|
|
|
92
94
|
|
|
93
95
|
const isSegwitAddress = purpose === 84
|
|
94
96
|
const isTaprootAddress = purpose === 86
|
|
95
|
-
const isZcashAsset = assetName === 'zcash'
|
|
96
97
|
|
|
97
98
|
const txIn = { hash: txId, index: vout, sequence }
|
|
98
99
|
|
|
99
|
-
if (
|
|
100
|
+
if (!assetRequiresUtxoInInput) {
|
|
100
101
|
txIn.script = script
|
|
101
102
|
txIn.value = value
|
|
102
103
|
}
|
|
@@ -112,7 +113,7 @@ function createPsbtFromTxData({
|
|
|
112
113
|
|
|
113
114
|
const rawTx = (rawTxs || []).find((t) => t.txId === txId)
|
|
114
115
|
|
|
115
|
-
if (!isTaprootAddress &&
|
|
116
|
+
if (!isTaprootAddress && assetRequiresUtxoInInput) {
|
|
116
117
|
assert(!!rawTx?.rawData, `Non-taproot outputs require the full previous transaction.`)
|
|
117
118
|
|
|
118
119
|
const rawTxBuffer = Buffer.from(rawTx.rawData, 'hex')
|