@exodus/bitcoin-api 2.18.2 → 2.18.4
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 +18 -0
- package/package.json +3 -4
- package/src/bitcoinjs-lib/ec-pair.js +2 -2
- package/src/bitcoinjs-lib/ecc/index.js +2 -7
- package/src/btc-like-keys.js +1 -2
- package/src/multisig-address.js +2 -2
- package/src/tx-sign/create-sign-with-wallet.js +2 -2
- package/src/tx-sign/default-create-tx.js +1 -2
- package/src/tx-sign/taproot.js +1 -2
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.4](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@2.18.3...@exodus/bitcoin-api@2.18.4) (2024-06-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* bitcoinjs-lib bump, ecc cleanup ([#2634](https://github.com/ExodusMovement/assets/issues/2634)) ([96d47a5](https://github.com/ExodusMovement/assets/commit/96d47a508657389ba766bfd44feef7365eb0de9b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [2.18.3](https://github.com/ExodusMovement/assets/compare/@exodus/bitcoin-api@2.18.2...@exodus/bitcoin-api@2.18.3) (2024-06-20)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **bitcoin:** skip adding redeem script ([#2630](https://github.com/ExodusMovement/assets/issues/2630)) ([bc92eb5](https://github.com/ExodusMovement/assets/commit/bc92eb596aebab78a796eb2b76b3bc5cbad05b87))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
## [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
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.4",
|
|
4
4
|
"description": "Exodus bitcoin-api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
"@exodus/bip322-js": "^1.1.0-exodus.4",
|
|
25
25
|
"@exodus/bip44-constants": "^195.0.0",
|
|
26
26
|
"@exodus/bitcoin-lib": "^2.4.1",
|
|
27
|
-
"@exodus/
|
|
28
|
-
"@exodus/bitcoinjs-lib": "^6.1.5-exodus.1",
|
|
27
|
+
"@exodus/bitcoinjs-lib": "^6.1.5-exodus.2",
|
|
29
28
|
"@exodus/currency": "^2.3.2",
|
|
30
29
|
"@exodus/fetch": "^1.3.0",
|
|
31
30
|
"@exodus/key-identifier": "^1.1.1",
|
|
@@ -67,5 +66,5 @@
|
|
|
67
66
|
"type": "git",
|
|
68
67
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
69
68
|
},
|
|
70
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "b7cc185dce729a04f48833e29c606eeb7b24407b"
|
|
71
70
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import ECPairFactory from 'ecpair'
|
|
2
|
-
import {
|
|
2
|
+
import { ecc } from './ecc'
|
|
3
3
|
|
|
4
4
|
let ECPair
|
|
5
5
|
|
|
6
6
|
export const getECPair = () => {
|
|
7
|
-
ECPair = ECPair || ECPairFactory(
|
|
7
|
+
ECPair = ECPair || ECPairFactory(ecc)
|
|
8
8
|
return ECPair
|
|
9
9
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import bitcoinerlab from '@exodus/bitcoinerlab-secp256k1'
|
|
4
|
-
|
|
5
|
-
export const ecc = bitcoinerlab
|
|
6
|
-
|
|
7
|
-
initEccLib(ecc)
|
|
1
|
+
import { eccLib } from '@exodus/bitcoinjs-lib'
|
|
8
2
|
|
|
3
|
+
export const ecc = eccLib
|
|
9
4
|
export const eccFactory = () => ecc
|
package/src/btc-like-keys.js
CHANGED
|
@@ -7,7 +7,7 @@ import * as defaultBitcoinjsLib from '@exodus/bitcoinjs-lib'
|
|
|
7
7
|
import * as secp256k1 from 'secp256k1'
|
|
8
8
|
import { hash160 } from './hash-utils'
|
|
9
9
|
import { toXOnly } from './bitcoinjs-lib/ecc-utils'
|
|
10
|
-
import {
|
|
10
|
+
import { ecc } from './bitcoinjs-lib/ecc'
|
|
11
11
|
|
|
12
12
|
export const publicKeyToHashFactory = (p2pkh) => (publicKey) => {
|
|
13
13
|
const payload = Buffer.concat([Buffer.from([p2pkh]), hash160(publicKey)])
|
|
@@ -23,7 +23,6 @@ export const createBtcLikeKeys = ({
|
|
|
23
23
|
}) => {
|
|
24
24
|
assert(coinInfo, 'coinInfo is required')
|
|
25
25
|
assert(versions, 'versions is required')
|
|
26
|
-
const ecc = eccFactory()
|
|
27
26
|
const {
|
|
28
27
|
encodePrivate: encodePrivateCustom,
|
|
29
28
|
encodePublic: encodePublicCustom,
|
package/src/multisig-address.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as defaultBitcoinjsLib from '@exodus/bitcoinjs-lib'
|
|
2
2
|
import { toXOnly } from './bitcoinjs-lib/ecc-utils'
|
|
3
|
-
import {
|
|
3
|
+
import { ecc as defaultEcc } from './bitcoinjs-lib/ecc'
|
|
4
4
|
|
|
5
5
|
// Key to use when key path spending is disabled https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#constructing-and-spending-taproot-outputs
|
|
6
6
|
const DUMMY_TAPROOT_PUBKEY = Buffer.from(
|
|
@@ -18,7 +18,7 @@ export const createEncodeMultisigContract =
|
|
|
18
18
|
({
|
|
19
19
|
bitcoinjsLib = defaultBitcoinjsLib,
|
|
20
20
|
network = bitcoinjsLib.Network.bitcoin,
|
|
21
|
-
ecc =
|
|
21
|
+
ecc = defaultEcc,
|
|
22
22
|
}) =>
|
|
23
23
|
(publicKeys, { threshold = publicKeys.length, version = 0 } = Object.create(null)) => {
|
|
24
24
|
if (
|
|
@@ -25,7 +25,7 @@ export function createSignWithWallet({
|
|
|
25
25
|
getKeyIdentifier,
|
|
26
26
|
})
|
|
27
27
|
|
|
28
|
-
return async (psbt, inputsToSign) => {
|
|
28
|
+
return async (psbt, inputsToSign, skipFinalize) => {
|
|
29
29
|
// The Taproot SIGHASH flag includes all previous outputs,
|
|
30
30
|
// so signing is only done AFTER all inputs have been updated
|
|
31
31
|
const signingPromises = []
|
|
@@ -55,7 +55,7 @@ export function createSignWithWallet({
|
|
|
55
55
|
// so modifying it here is fine.
|
|
56
56
|
psbt.updateInput(index, { tapInternalKey: toXOnly(publicKey) })
|
|
57
57
|
}
|
|
58
|
-
} else if (purpose === 49) {
|
|
58
|
+
} else if (purpose === 49 && !skipFinalize) {
|
|
59
59
|
// If spending from a P2SH address, we assume the address is P2SH wrapping
|
|
60
60
|
// P2WPKH. Exodus doesn't use P2SH addresses so we should only ever be
|
|
61
61
|
// signing a P2SH input if we are importing a private key
|
|
@@ -50,9 +50,8 @@ export const signTxFactory = ({
|
|
|
50
50
|
},
|
|
51
51
|
})
|
|
52
52
|
|
|
53
|
-
await signWithWallet(psbt, inputsToSign)
|
|
54
|
-
|
|
55
53
|
const skipFinalize = !!unsignedTx.txData.psbtBuffer || unsignedTx.txMeta.returnPsbt
|
|
54
|
+
await signWithWallet(psbt, inputsToSign, skipFinalize)
|
|
56
55
|
return extractTransaction({ psbt, skipFinalize })
|
|
57
56
|
}
|
|
58
57
|
}
|
package/src/tx-sign/taproot.js
CHANGED
|
@@ -2,10 +2,9 @@ import { crypto } from '@exodus/bitcoinjs-lib'
|
|
|
2
2
|
import assert from 'minimalistic-assert'
|
|
3
3
|
|
|
4
4
|
import { getSchnorrEntropy } from './default-entropy'
|
|
5
|
-
import {
|
|
5
|
+
import { ecc } from '../bitcoinjs-lib/ecc'
|
|
6
6
|
import { getECPair } from '../bitcoinjs-lib'
|
|
7
7
|
|
|
8
|
-
const ecc = eccFactory()
|
|
9
8
|
const ECPair = getECPair()
|
|
10
9
|
|
|
11
10
|
function tweakSigner({ signer, tweakHash, network }) {
|