@exodus/bitcoin-api 2.18.0 → 2.18.2
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,24 @@
|
|
|
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.18.2](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@2.18.1...@exodus/bitcoin-api@2.18.2) (2024-06-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* correctly sign psbts ([#2587](https://github.com/ExodusMovement/assets/issues/2587)) ([81e5cc5](https://github.com/ExodusMovement/assets/commit/81e5cc50773b392d5f126133c0f8a1ec8ebd7eb1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [2.18.1](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@2.18.0...@exodus/bitcoin-api@2.18.1) (2024-06-13)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* allow undefined/null addressIndex for xverse compat ([#2553](https://github.com/ExodusMovement/assets/issues/2553)) ([5ff013e](https://github.com/ExodusMovement/assets/commit/5ff013e1129f027dfff58cacebefc76dbcebb401))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
## [2.18.0](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@2.17.1...@exodus/bitcoin-api@2.18.0) (2024-06-13)
|
|
7
25
|
|
|
8
26
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bitcoin-api",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.2",
|
|
4
4
|
"description": "Exodus bitcoin-api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@exodus/basic-utils": "^2.1.0",
|
|
24
24
|
"@exodus/bip322-js": "^1.1.0-exodus.4",
|
|
25
25
|
"@exodus/bip44-constants": "^195.0.0",
|
|
26
|
-
"@exodus/bitcoin-lib": "^2.
|
|
26
|
+
"@exodus/bitcoin-lib": "^2.4.1",
|
|
27
27
|
"@exodus/bitcoinerlab-secp256k1": "^1.0.5-exodus.1",
|
|
28
28
|
"@exodus/bitcoinjs-lib": "^6.1.5-exodus.1",
|
|
29
29
|
"@exodus/currency": "^2.3.2",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"type": "git",
|
|
68
68
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "fb7b6fa3c13387a821628ce7577951571471b353"
|
|
71
71
|
}
|
|
@@ -84,15 +84,21 @@ export class Monitor extends BaseMonitor {
|
|
|
84
84
|
Object.create(null),
|
|
85
85
|
Object.fromEntries(
|
|
86
86
|
await Promise.all(
|
|
87
|
-
walletAccounts.map(async (walletAccount) =>
|
|
88
|
-
|
|
89
|
-
await this.aci.getReceiveAddresses({
|
|
90
|
-
multiAddressMode: true,
|
|
87
|
+
walletAccounts.map(async (walletAccount) => {
|
|
88
|
+
const config = await this.aci.getAssetConfig({
|
|
91
89
|
assetName: this.asset.name,
|
|
92
90
|
walletAccount,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
})
|
|
92
|
+
return [
|
|
93
|
+
walletAccount,
|
|
94
|
+
await this.aci.getReceiveAddresses({
|
|
95
|
+
multiAddressMode: config.multiAddressMode ?? true,
|
|
96
|
+
assetName: this.asset.name,
|
|
97
|
+
walletAccount,
|
|
98
|
+
useCache: true,
|
|
99
|
+
}),
|
|
100
|
+
]
|
|
101
|
+
})
|
|
96
102
|
)
|
|
97
103
|
)
|
|
98
104
|
)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Transaction, payments } from '@exodus/bitcoinjs-lib'
|
|
2
|
+
import * as bip371 from '@exodus/bitcoinjs-lib/src/psbt/bip371'
|
|
2
3
|
|
|
3
4
|
import { toXOnly } from '../bitcoinjs-lib/ecc-utils'
|
|
4
5
|
import { createGetKeyWithMetadata } from './create-get-key-and-purpose'
|
|
5
|
-
import { toAsyncSigner, toAsyncBufferSigner
|
|
6
|
+
import { toAsyncSigner, toAsyncBufferSigner } from './taproot'
|
|
6
7
|
|
|
7
8
|
export function createSignWithWallet({
|
|
8
9
|
signer,
|
|
@@ -44,11 +45,17 @@ export function createSignWithWallet({
|
|
|
44
45
|
: [sigHash, Transaction.SIGHASH_ALL]
|
|
45
46
|
const { key, purpose, keyId, publicKey } = await getKeyWithMetadata(address)
|
|
46
47
|
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const isTaprootKeySpend =
|
|
48
|
+
const isTaprootInput = bip371.isTaprootInput(input)
|
|
49
|
+
const isTapLeafScriptSpend = input.tapLeafScript && input.tapLeafScript.length > 0
|
|
50
|
+
const isTaprootKeySpend = isTaprootInput && !isTapLeafScriptSpend
|
|
50
51
|
|
|
51
|
-
if (
|
|
52
|
+
if (isTaprootInput) {
|
|
53
|
+
if (isTaprootKeySpend && !Buffer.isBuffer(input.tapInternalKey)) {
|
|
54
|
+
// tapInternalKey is metadata for signing and not part of the hash to sign.
|
|
55
|
+
// so modifying it here is fine.
|
|
56
|
+
psbt.updateInput(index, { tapInternalKey: toXOnly(publicKey) })
|
|
57
|
+
}
|
|
58
|
+
} else if (purpose === 49) {
|
|
52
59
|
// If spending from a P2SH address, we assume the address is P2SH wrapping
|
|
53
60
|
// P2WPKH. Exodus doesn't use P2SH addresses so we should only ever be
|
|
54
61
|
// signing a P2SH input if we are importing a private key
|
|
@@ -65,10 +72,6 @@ export function createSignWithWallet({
|
|
|
65
72
|
} else {
|
|
66
73
|
throw new Error('Expected P2SH script to be a nested segwit input')
|
|
67
74
|
}
|
|
68
|
-
} else if (isTaprootKeySpend && !Buffer.isBuffer(input.tapInternalKey)) {
|
|
69
|
-
// tapInternalKey is metadata for signing and not part of the hash to sign.
|
|
70
|
-
// so modifying it here is fine.
|
|
71
|
-
psbt.updateInput(index, { tapInternalKey: toXOnly(publicKey) })
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
const asyncSigner = signer
|
package/src/tx-sign/taproot.js
CHANGED
|
@@ -42,10 +42,6 @@ export const tapTweakHash = (publicKey, h) => {
|
|
|
42
42
|
return crypto.taggedHash('TapTweak', Buffer.concat(h ? [xOnlyPoint, h] : [xOnlyPoint]))
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export function isTaprootPurpose(purpose) {
|
|
46
|
-
return purpose === 86
|
|
47
|
-
}
|
|
48
|
-
|
|
49
45
|
/**
|
|
50
46
|
* Take a sync signer and make it async.
|
|
51
47
|
*/
|