@btc-vision/bitcoin 6.4.0 → 6.4.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.
Files changed (45) hide show
  1. package/browser/address.d.ts +1 -0
  2. package/browser/index.js +1 -1
  3. package/browser/payments/index.d.ts +4 -0
  4. package/browser/payments/p2op.d.ts +2 -0
  5. package/browser/psbt/psbtutils.d.ts +1 -0
  6. package/build/address.d.ts +1 -0
  7. package/build/address.js +56 -8
  8. package/build/networks.js +6 -6
  9. package/build/payments/index.d.ts +4 -0
  10. package/build/payments/index.js +1 -0
  11. package/build/payments/p2op.d.ts +2 -0
  12. package/build/payments/p2op.js +108 -0
  13. package/build/psbt/psbtutils.d.ts +1 -0
  14. package/build/psbt/psbtutils.js +2 -0
  15. package/package.json +1 -1
  16. package/src/address.ts +68 -9
  17. package/src/block.ts +233 -233
  18. package/src/bufferutils.ts +188 -188
  19. package/src/networks.ts +6 -6
  20. package/src/payments/index.ts +68 -62
  21. package/src/payments/p2op.ts +136 -0
  22. package/src/psbt/psbtutils.ts +2 -0
  23. package/src/psbt.ts +2187 -2187
  24. package/test/address.spec.ts +155 -155
  25. package/test/bitcoin.core.spec.ts +212 -212
  26. package/test/block.spec.ts +171 -171
  27. package/test/bufferutils.spec.ts +450 -450
  28. package/test/crypto.spec.ts +49 -49
  29. package/test/integration/addresses.spec.ts +142 -142
  30. package/test/integration/bip32.spec.ts +130 -130
  31. package/test/integration/blocks.spec.ts +28 -28
  32. package/test/integration/cltv.spec.ts +241 -241
  33. package/test/integration/csv.spec.ts +452 -452
  34. package/test/integration/payments.spec.ts +110 -110
  35. package/test/integration/taproot.spec.ts +663 -663
  36. package/test/integration/transactions.spec.ts +668 -668
  37. package/test/payments.spec.ts +114 -114
  38. package/test/payments.utils.ts +165 -165
  39. package/test/psbt.spec.ts +1285 -1285
  40. package/test/script.spec.ts +186 -186
  41. package/test/script_number.spec.ts +26 -26
  42. package/test/script_signature.spec.ts +66 -66
  43. package/test/transaction.spec.ts +337 -337
  44. package/test/ts-node-register.js +7 -7
  45. package/test/types.spec.ts +53 -53
@@ -1,7 +1,7 @@
1
- // This file is required to run mocha tests on the TS files directly
2
-
3
- import { register } from 'ts-node';
4
-
5
- register({
6
- project: 'test/tsconfig.json',
7
- });
1
+ // This file is required to run mocha tests on the TS files directly
2
+
3
+ import { register } from 'ts-node';
4
+
5
+ register({
6
+ project: 'test/tsconfig.json',
7
+ });
@@ -1,53 +1,53 @@
1
- import assert from 'assert';
2
- import { describe, it } from 'mocha';
3
- import * as types from '../src/types.js';
4
-
5
- // @ts-ignore
6
- import typeforce from 'typeforce';
7
-
8
- describe('types', () => {
9
- describe('Buffer Hash160/Hash256', () => {
10
- const buffer20byte = Buffer.alloc(20);
11
- const buffer32byte = Buffer.alloc(32);
12
-
13
- it('return true for valid size', () => {
14
- assert(types.Hash160bit(buffer20byte));
15
- assert(types.Hash256bit(buffer32byte));
16
- });
17
-
18
- it('return true for oneOf', () => {
19
- assert.doesNotThrow(() => {
20
- typeforce(types.oneOf(types.Hash160bit, types.Hash256bit), buffer32byte);
21
- });
22
-
23
- assert.doesNotThrow(() => {
24
- typeforce(types.oneOf(types.Hash256bit, types.Hash160bit), buffer32byte);
25
- });
26
- });
27
-
28
- it('throws for invalid size', () => {
29
- assert.throws(() => {
30
- types.Hash160bit(buffer32byte);
31
- }, /Expected Buffer\(Length: 20\), got Buffer\(Length: 32\)/);
32
-
33
- assert.throws(() => {
34
- types.Hash256bit(buffer20byte);
35
- }, /Expected Buffer\(Length: 32\), got Buffer\(Length: 20\)/);
36
- });
37
- });
38
-
39
- describe('Satoshi', () => {
40
- [
41
- { value: -1, result: false },
42
- { value: 0, result: true },
43
- { value: 1, result: true },
44
- { value: 20999999 * 1e8, result: true },
45
- { value: 21000000 * 1e8, result: true },
46
- { value: 21000001 * 1e8, result: false },
47
- ].forEach((f) => {
48
- it('returns ' + f.result + ' for valid for ' + f.value, () => {
49
- assert.strictEqual(types.Satoshi(f.value), f.result);
50
- });
51
- });
52
- });
53
- });
1
+ import assert from 'assert';
2
+ import { describe, it } from 'mocha';
3
+ import * as types from '../src/types.js';
4
+
5
+ // @ts-ignore
6
+ import typeforce from 'typeforce';
7
+
8
+ describe('types', () => {
9
+ describe('Buffer Hash160/Hash256', () => {
10
+ const buffer20byte = Buffer.alloc(20);
11
+ const buffer32byte = Buffer.alloc(32);
12
+
13
+ it('return true for valid size', () => {
14
+ assert(types.Hash160bit(buffer20byte));
15
+ assert(types.Hash256bit(buffer32byte));
16
+ });
17
+
18
+ it('return true for oneOf', () => {
19
+ assert.doesNotThrow(() => {
20
+ typeforce(types.oneOf(types.Hash160bit, types.Hash256bit), buffer32byte);
21
+ });
22
+
23
+ assert.doesNotThrow(() => {
24
+ typeforce(types.oneOf(types.Hash256bit, types.Hash160bit), buffer32byte);
25
+ });
26
+ });
27
+
28
+ it('throws for invalid size', () => {
29
+ assert.throws(() => {
30
+ types.Hash160bit(buffer32byte);
31
+ }, /Expected Buffer\(Length: 20\), got Buffer\(Length: 32\)/);
32
+
33
+ assert.throws(() => {
34
+ types.Hash256bit(buffer20byte);
35
+ }, /Expected Buffer\(Length: 32\), got Buffer\(Length: 20\)/);
36
+ });
37
+ });
38
+
39
+ describe('Satoshi', () => {
40
+ [
41
+ { value: -1, result: false },
42
+ { value: 0, result: true },
43
+ { value: 1, result: true },
44
+ { value: 20999999 * 1e8, result: true },
45
+ { value: 21000000 * 1e8, result: true },
46
+ { value: 21000001 * 1e8, result: false },
47
+ ].forEach((f) => {
48
+ it('returns ' + f.result + ' for valid for ' + f.value, () => {
49
+ assert.strictEqual(types.Satoshi(f.value), f.result);
50
+ });
51
+ });
52
+ });
53
+ });