@ledgerhq/coin-bitcoin 0.28.0 → 0.29.0-nightly.20260115024415
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/.unimportedrc.json +4 -1
- package/CHANGELOG.md +19 -0
- package/jest.config.js +10 -2
- package/jest.integ.config.js +15 -4
- package/package.json +17 -16
- package/src/__tests__/unit/buildTransaction.fees.unit.test.ts +19 -18
- package/src/getTransactionStatus.test.ts +24 -5
package/.unimportedrc.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @ledgerhq/coin-bitcoin
|
|
2
2
|
|
|
3
|
+
## 0.29.0-nightly.20260115024415
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#13396](https://github.com/LedgerHQ/ledger-live/pull/13396) [`b9a3e43`](https://github.com/LedgerHQ/ledger-live/commit/b9a3e431be33943ab4feb4294d6a7f27b966e61b) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Update Jest to v30
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`537a975`](https://github.com/LedgerHQ/ledger-live/commit/537a975536ca3669d3b88371e1e1f651c4cb9a1b), [`cbcae7c`](https://github.com/LedgerHQ/ledger-live/commit/cbcae7c0ba9b54b1167d26e4227bd2b847207cb9), [`8754614`](https://github.com/LedgerHQ/ledger-live/commit/87546149a62b81f8a25bb6222626592ead629f62), [`50bae0f`](https://github.com/LedgerHQ/ledger-live/commit/50bae0f13a95ef166b2c5609ccbcf5ef01ba1579), [`cf08174`](https://github.com/LedgerHQ/ledger-live/commit/cf0817462e9f0210fceff29ec60b0699e4e69b71), [`b9a3e43`](https://github.com/LedgerHQ/ledger-live/commit/b9a3e431be33943ab4feb4294d6a7f27b966e61b), [`3ac5f26`](https://github.com/LedgerHQ/ledger-live/commit/3ac5f26111f8596327fa7e588e514509de3f8a59), [`7f05536`](https://github.com/LedgerHQ/ledger-live/commit/7f0553665e9c8721f263825cc79994bfc6729d9b)]:
|
|
12
|
+
- @ledgerhq/cryptoassets@13.37.0-nightly.20260115024415
|
|
13
|
+
- @ledgerhq/coin-framework@6.13.0-nightly.20260115024415
|
|
14
|
+
- @ledgerhq/types-live@6.93.0-nightly.20260115024415
|
|
15
|
+
- @ledgerhq/live-env@2.25.0-nightly.20260115024415
|
|
16
|
+
- @ledgerhq/types-cryptoassets@7.32.0-nightly.20260115024415
|
|
17
|
+
- @ledgerhq/devices@8.10.0-nightly.20260115024415
|
|
18
|
+
- @ledgerhq/errors@6.29.0-nightly.20260115024415
|
|
19
|
+
- @ledgerhq/logs@6.14.0-nightly.20260115024415
|
|
20
|
+
- @ledgerhq/live-network@2.2.0-nightly.20260115024415
|
|
21
|
+
|
|
3
22
|
## 0.28.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
package/jest.config.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
|
|
2
1
|
module.exports = {
|
|
3
2
|
passWithNoTests: true,
|
|
4
3
|
collectCoverageFrom: [
|
|
@@ -11,8 +10,17 @@ module.exports = {
|
|
|
11
10
|
"!src/wallet-btc/__tests__/**/*.ts",
|
|
12
11
|
],
|
|
13
12
|
coverageReporters: ["json", ["lcov", { file: "lcov.info", projectRoot: "../../../" }], "text"],
|
|
14
|
-
preset: "ts-jest",
|
|
15
13
|
testEnvironment: "node",
|
|
14
|
+
transform: {
|
|
15
|
+
"^.+\\.(ts|tsx)$": [
|
|
16
|
+
"@swc/jest",
|
|
17
|
+
{
|
|
18
|
+
jsc: {
|
|
19
|
+
target: "esnext",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
16
24
|
testPathIgnorePatterns: ["lib/", "lib-es/", ".integration.test.ts"],
|
|
17
25
|
modulePathIgnorePatterns: ["__tests__/fixtures"],
|
|
18
26
|
reporters: [
|
package/jest.integ.config.js
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
/** @type {import('
|
|
1
|
+
/** @type {import('jest').Config} */
|
|
2
2
|
module.exports = {
|
|
3
|
-
preset: "ts-jest",
|
|
4
3
|
testEnvironment: "node",
|
|
5
|
-
testRegex: ".
|
|
6
|
-
testPathIgnorePatterns: ["lib/", "lib-es/"
|
|
4
|
+
testRegex: ".integ.test.ts$",
|
|
5
|
+
testPathIgnorePatterns: ["lib/", "lib-es/"],
|
|
7
6
|
testTimeout: 60_000,
|
|
7
|
+
forceExit: true,
|
|
8
|
+
passWithNoTests: true,
|
|
9
|
+
transform: {
|
|
10
|
+
"^.+\\.(t|j)sx?$": [
|
|
11
|
+
"@swc/jest",
|
|
12
|
+
{
|
|
13
|
+
jsc: {
|
|
14
|
+
target: "esnext",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
},
|
|
8
19
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-bitcoin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0-nightly.20260115024415",
|
|
4
4
|
"description": "Ledger Bitcoin Coin integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -54,22 +54,22 @@
|
|
|
54
54
|
"cashaddrjs": "^0.4.4",
|
|
55
55
|
"coininfo": "^5.1.0",
|
|
56
56
|
"create-hmac": "^1.1.7",
|
|
57
|
-
"expect": "
|
|
57
|
+
"expect": "30.2.0",
|
|
58
58
|
"invariant": "^2.2.2",
|
|
59
59
|
"lodash": "^4.17.21",
|
|
60
60
|
"rxjs": "7.8.2",
|
|
61
61
|
"@noble/curves": "^1.9.7",
|
|
62
62
|
"utility-types": "^3.10.0",
|
|
63
63
|
"varuint-bitcoin": "1.1.2",
|
|
64
|
-
"@ledgerhq/coin-framework": "^6.
|
|
65
|
-
"@ledgerhq/cryptoassets": "^13.
|
|
66
|
-
"@ledgerhq/devices": "8.
|
|
67
|
-
"@ledgerhq/errors": "^6.
|
|
68
|
-
"@ledgerhq/live-env": "^2.
|
|
69
|
-
"@ledgerhq/live-network": "^2.
|
|
70
|
-
"@ledgerhq/logs": "^6.
|
|
71
|
-
"@ledgerhq/types-cryptoassets": "^7.
|
|
72
|
-
"@ledgerhq/types-live": "^6.
|
|
64
|
+
"@ledgerhq/coin-framework": "^6.13.0-nightly.20260115024415",
|
|
65
|
+
"@ledgerhq/cryptoassets": "^13.37.0-nightly.20260115024415",
|
|
66
|
+
"@ledgerhq/devices": "8.10.0-nightly.20260115024415",
|
|
67
|
+
"@ledgerhq/errors": "^6.29.0-nightly.20260115024415",
|
|
68
|
+
"@ledgerhq/live-env": "^2.25.0-nightly.20260115024415",
|
|
69
|
+
"@ledgerhq/live-network": "^2.2.0-nightly.20260115024415",
|
|
70
|
+
"@ledgerhq/logs": "^6.14.0-nightly.20260115024415",
|
|
71
|
+
"@ledgerhq/types-cryptoassets": "^7.32.0-nightly.20260115024415",
|
|
72
|
+
"@ledgerhq/types-live": "^6.93.0-nightly.20260115024415"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/bchaddrjs": "^0.4.3",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@types/cashaddrjs": "^0.3.3",
|
|
79
79
|
"@types/create-hmac": "^1.1.3",
|
|
80
80
|
"@types/invariant": "^2.2.2",
|
|
81
|
-
"@types/jest": "
|
|
81
|
+
"@types/jest": "30.0.0",
|
|
82
82
|
"@types/lodash": "^4.14.191",
|
|
83
83
|
"@types/object-hash": "^2.1.0",
|
|
84
84
|
"@types/ripemd160": "^2.0.3",
|
|
@@ -87,11 +87,12 @@
|
|
|
87
87
|
"axios": "1.13.2",
|
|
88
88
|
"bip32": "^2.0.6",
|
|
89
89
|
"bip39": "^3.0.4",
|
|
90
|
-
"jest": "
|
|
91
|
-
"jest-file-snapshot": "
|
|
90
|
+
"jest": "30.2.0",
|
|
91
|
+
"jest-file-snapshot": "0.7.0",
|
|
92
92
|
"object-hash": "^2.2.0",
|
|
93
|
-
"
|
|
94
|
-
"@
|
|
93
|
+
"@swc/jest": "0.2.39",
|
|
94
|
+
"@swc/core": "1.15.8",
|
|
95
|
+
"@ledgerhq/disable-network-setup": "^0.2.0-nightly.20260115024415"
|
|
95
96
|
},
|
|
96
97
|
"scripts": {
|
|
97
98
|
"clean": "rimraf lib lib-es",
|
|
@@ -10,24 +10,25 @@ let currentExplorer: any = {
|
|
|
10
10
|
getNetwork: jest.fn().mockResolvedValue({ relay_fee: "0.00001000" }), // 1 sat/vB
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
13
|
+
jest.mock("../../wallet-btc", () => {
|
|
14
|
+
class DummyStrategy {
|
|
15
|
+
constructor(..._args: any[]) {}
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
__esModule: true,
|
|
19
|
+
default: {
|
|
20
|
+
estimateAccountMaxSpendable: (...args: any[]) => estimateAccountMaxSpendable(...args),
|
|
21
|
+
buildAccountTx: (...args: any[]) => buildAccountTx(...args),
|
|
22
|
+
},
|
|
23
|
+
getWalletAccount: jest.fn((_account: any) => ({
|
|
24
|
+
xpub: { explorer: currentExplorer, crypto: {} },
|
|
25
|
+
derivationMode: "native_segwit",
|
|
26
|
+
})),
|
|
27
|
+
CoinSelect: DummyStrategy,
|
|
28
|
+
DeepFirst: DummyStrategy,
|
|
29
|
+
Merge: DummyStrategy,
|
|
30
|
+
};
|
|
31
|
+
});
|
|
31
32
|
|
|
32
33
|
import { buildTransaction } from "../../buildTransaction";
|
|
33
34
|
|
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
/* eslint @typescript-eslint/consistent-type-assertions: 0 */
|
|
2
2
|
|
|
3
3
|
import { Account } from "@ledgerhq/types-live";
|
|
4
|
-
import * as cache from "./cache";
|
|
5
4
|
import { BitcoinInput, Transaction } from "./types";
|
|
6
|
-
import getTransactionStatus, { MAX_BLOCK_HEIGHT_FOR_TAPROOT } from "./getTransactionStatus";
|
|
7
5
|
import { AddressesSanctionedError } from "@ledgerhq/coin-framework/sanction/errors";
|
|
8
6
|
import BigNumber from "bignumber.js";
|
|
7
|
+
|
|
8
|
+
// Mock modules before importing the module under test
|
|
9
|
+
jest.mock("./cache", () => {
|
|
10
|
+
const actual = jest.requireActual("./cache");
|
|
11
|
+
return {
|
|
12
|
+
...actual,
|
|
13
|
+
calculateFees: jest.fn(),
|
|
14
|
+
validateRecipient: jest.fn(),
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
jest.mock("@ledgerhq/coin-framework/sanction/index", () => {
|
|
19
|
+
const actual = jest.requireActual("@ledgerhq/coin-framework/sanction/index");
|
|
20
|
+
return {
|
|
21
|
+
...actual,
|
|
22
|
+
isAddressSanctioned: jest.fn(),
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
import * as cache from "./cache";
|
|
9
27
|
import * as sanction from "@ledgerhq/coin-framework/sanction/index";
|
|
28
|
+
import getTransactionStatus, { MAX_BLOCK_HEIGHT_FOR_TAPROOT } from "./getTransactionStatus";
|
|
10
29
|
|
|
11
|
-
const calculateFeesSpy = jest.
|
|
12
|
-
const validateRecipientSpy = jest.
|
|
13
|
-
const isAddressSanctionedSpy = jest.
|
|
30
|
+
const calculateFeesSpy = cache.calculateFees as jest.Mock;
|
|
31
|
+
const validateRecipientSpy = cache.validateRecipient as jest.Mock;
|
|
32
|
+
const isAddressSanctionedSpy = sanction.isAddressSanctioned as jest.Mock;
|
|
14
33
|
|
|
15
34
|
describe("getTransactionStatus on Bitcoin", () => {
|
|
16
35
|
it("should return as sender error only sanctioned utxo addresses", async () => {
|