@btc-vision/bitcoin 7.0.0-alpha.1 → 7.0.0-alpha.3

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 (180) hide show
  1. package/README.md +334 -161
  2. package/browser/address.d.ts +5 -1
  3. package/browser/address.d.ts.map +1 -1
  4. package/browser/branded.d.ts +3 -14
  5. package/browser/branded.d.ts.map +1 -1
  6. package/browser/ecc/context.d.ts +22 -21
  7. package/browser/ecc/context.d.ts.map +1 -1
  8. package/browser/ecc/index.d.ts +1 -1
  9. package/browser/ecc/index.d.ts.map +1 -1
  10. package/browser/ecc/types.d.ts +10 -123
  11. package/browser/ecc/types.d.ts.map +1 -1
  12. package/browser/index.d.ts +3 -2
  13. package/browser/index.d.ts.map +1 -1
  14. package/browser/index.js +6465 -4692
  15. package/browser/opcodes.d.ts +11 -0
  16. package/browser/opcodes.d.ts.map +1 -1
  17. package/browser/payments/p2tr.d.ts.map +1 -1
  18. package/browser/psbt/PsbtCache.d.ts +54 -0
  19. package/browser/psbt/PsbtCache.d.ts.map +1 -0
  20. package/browser/psbt/PsbtFinalizer.d.ts +21 -0
  21. package/browser/psbt/PsbtFinalizer.d.ts.map +1 -0
  22. package/browser/psbt/PsbtSigner.d.ts +32 -0
  23. package/browser/psbt/PsbtSigner.d.ts.map +1 -0
  24. package/browser/psbt/PsbtTransaction.d.ts +25 -0
  25. package/browser/psbt/PsbtTransaction.d.ts.map +1 -0
  26. package/browser/psbt/types.d.ts +4 -70
  27. package/browser/psbt/types.d.ts.map +1 -1
  28. package/browser/psbt/validation.d.ts +1 -1
  29. package/browser/psbt/validation.d.ts.map +1 -1
  30. package/browser/psbt.d.ts +26 -40
  31. package/browser/psbt.d.ts.map +1 -1
  32. package/browser/script.d.ts.map +1 -1
  33. package/browser/transaction.d.ts +4 -4
  34. package/browser/transaction.d.ts.map +1 -1
  35. package/browser/types.d.ts +5 -3
  36. package/browser/types.d.ts.map +1 -1
  37. package/browser/workers/index.d.ts +3 -50
  38. package/browser/workers/index.d.ts.map +1 -1
  39. package/browser/workers/index.node.d.ts +24 -0
  40. package/browser/workers/index.node.d.ts.map +1 -0
  41. package/build/address.d.ts +5 -1
  42. package/build/address.d.ts.map +1 -1
  43. package/build/address.js +29 -17
  44. package/build/address.js.map +1 -1
  45. package/build/branded.d.ts +3 -14
  46. package/build/branded.d.ts.map +1 -1
  47. package/build/branded.js +0 -5
  48. package/build/branded.js.map +1 -1
  49. package/build/ecc/context.d.ts +22 -21
  50. package/build/ecc/context.d.ts.map +1 -1
  51. package/build/ecc/context.js +23 -95
  52. package/build/ecc/context.js.map +1 -1
  53. package/build/ecc/index.d.ts +1 -1
  54. package/build/ecc/index.d.ts.map +1 -1
  55. package/build/ecc/types.d.ts +7 -126
  56. package/build/ecc/types.d.ts.map +1 -1
  57. package/build/ecc/types.js +4 -1
  58. package/build/ecc/types.js.map +1 -1
  59. package/build/index.d.ts +3 -2
  60. package/build/index.d.ts.map +1 -1
  61. package/build/index.js +1 -1
  62. package/build/index.js.map +1 -1
  63. package/build/opcodes.d.ts +11 -0
  64. package/build/opcodes.d.ts.map +1 -1
  65. package/build/opcodes.js +19 -4
  66. package/build/opcodes.js.map +1 -1
  67. package/build/payments/p2tr.d.ts.map +1 -1
  68. package/build/payments/p2tr.js +2 -3
  69. package/build/payments/p2tr.js.map +1 -1
  70. package/build/psbt/PsbtCache.d.ts +54 -0
  71. package/build/psbt/PsbtCache.d.ts.map +1 -0
  72. package/build/psbt/PsbtCache.js +249 -0
  73. package/build/psbt/PsbtCache.js.map +1 -0
  74. package/build/psbt/PsbtFinalizer.d.ts +21 -0
  75. package/build/psbt/PsbtFinalizer.d.ts.map +1 -0
  76. package/build/psbt/PsbtFinalizer.js +157 -0
  77. package/build/psbt/PsbtFinalizer.js.map +1 -0
  78. package/build/psbt/PsbtSigner.d.ts +32 -0
  79. package/build/psbt/PsbtSigner.d.ts.map +1 -0
  80. package/build/psbt/PsbtSigner.js +192 -0
  81. package/build/psbt/PsbtSigner.js.map +1 -0
  82. package/build/psbt/PsbtTransaction.d.ts +25 -0
  83. package/build/psbt/PsbtTransaction.d.ts.map +1 -0
  84. package/build/psbt/PsbtTransaction.js +61 -0
  85. package/build/psbt/PsbtTransaction.js.map +1 -0
  86. package/build/psbt/types.d.ts +4 -70
  87. package/build/psbt/types.d.ts.map +1 -1
  88. package/build/psbt/validation.d.ts +1 -1
  89. package/build/psbt/validation.d.ts.map +1 -1
  90. package/build/psbt.d.ts +26 -40
  91. package/build/psbt.d.ts.map +1 -1
  92. package/build/psbt.js +177 -799
  93. package/build/psbt.js.map +1 -1
  94. package/build/script.d.ts.map +1 -1
  95. package/build/script.js +2 -2
  96. package/build/script.js.map +1 -1
  97. package/build/transaction.d.ts +4 -4
  98. package/build/transaction.d.ts.map +1 -1
  99. package/build/transaction.js +5 -4
  100. package/build/transaction.js.map +1 -1
  101. package/build/tsconfig.build.tsbuildinfo +1 -1
  102. package/build/types.d.ts +5 -3
  103. package/build/types.d.ts.map +1 -1
  104. package/build/types.js +9 -0
  105. package/build/types.js.map +1 -1
  106. package/build/workers/WorkerSigningPool.js +1 -1
  107. package/build/workers/WorkerSigningPool.js.map +1 -1
  108. package/build/workers/index.d.ts +3 -3
  109. package/build/workers/index.d.ts.map +1 -1
  110. package/build/workers/index.js +0 -3
  111. package/build/workers/index.js.map +1 -1
  112. package/build/workers/index.node.d.ts +24 -0
  113. package/build/workers/index.node.d.ts.map +1 -0
  114. package/build/workers/index.node.js +26 -0
  115. package/build/workers/index.node.js.map +1 -0
  116. package/package.json +27 -8
  117. package/src/address.ts +41 -18
  118. package/src/branded.ts +15 -13
  119. package/src/ecc/context.ts +30 -133
  120. package/src/ecc/index.ts +2 -2
  121. package/src/ecc/types.ts +7 -138
  122. package/src/index.ts +36 -2
  123. package/src/opcodes.ts +21 -4
  124. package/src/payments/p2tr.ts +2 -2
  125. package/src/psbt/PsbtCache.ts +325 -0
  126. package/src/psbt/PsbtFinalizer.ts +213 -0
  127. package/src/psbt/PsbtSigner.ts +302 -0
  128. package/src/psbt/PsbtTransaction.ts +82 -0
  129. package/src/psbt/types.ts +4 -86
  130. package/src/psbt/validation.ts +1 -1
  131. package/src/psbt.ts +348 -1197
  132. package/src/script.ts +2 -2
  133. package/src/transaction.ts +9 -8
  134. package/src/types.ts +14 -1
  135. package/src/workers/WorkerSigningPool.ts +1 -1
  136. package/src/workers/index.node.ts +27 -0
  137. package/src/workers/index.ts +7 -9
  138. package/test/address.spec.ts +2 -2
  139. package/test/bitcoin.core.spec.ts +5 -2
  140. package/test/browser/payments.spec.ts +151 -0
  141. package/test/browser/psbt.spec.ts +1510 -0
  142. package/test/browser/script.spec.ts +223 -0
  143. package/test/browser/setup.ts +13 -0
  144. package/test/browser/workers-signing.spec.ts +537 -0
  145. package/test/crypto.spec.ts +2 -2
  146. package/test/fixtures/core/base58_encode_decode.json +12 -48
  147. package/test/fixtures/core/base58_keys_invalid.json +50 -150
  148. package/test/fixtures/core/sighash.json +1 -3
  149. package/test/fixtures/core/tx_valid.json +133 -501
  150. package/test/fixtures/embed.json +3 -11
  151. package/test/fixtures/p2ms.json +21 -91
  152. package/test/fixtures/p2pk.json +5 -24
  153. package/test/fixtures/p2pkh.json +7 -36
  154. package/test/fixtures/p2sh.json +8 -54
  155. package/test/fixtures/p2tr.json +2 -6
  156. package/test/fixtures/p2wpkh.json +7 -36
  157. package/test/fixtures/p2wsh.json +14 -59
  158. package/test/fixtures/psbt.json +2 -6
  159. package/test/fixtures/script.json +12 -48
  160. package/test/integration/addresses.spec.ts +11 -5
  161. package/test/integration/bip32.spec.ts +1 -1
  162. package/test/integration/cltv.spec.ts +10 -6
  163. package/test/integration/csv.spec.ts +10 -9
  164. package/test/integration/payments.spec.ts +8 -4
  165. package/test/integration/taproot.spec.ts +26 -6
  166. package/test/integration/transactions.spec.ts +22 -8
  167. package/test/payments.spec.ts +1 -1
  168. package/test/payments.utils.ts +1 -1
  169. package/test/psbt.spec.ts +250 -64
  170. package/test/script_signature.spec.ts +1 -1
  171. package/test/transaction.spec.ts +18 -5
  172. package/test/tsconfig.json +6 -20
  173. package/test/workers-pool.spec.ts +22 -23
  174. package/test/workers-signing.spec.ts +7 -3
  175. package/test/workers.spec.ts +6 -7
  176. package/typedoc.json +11 -1
  177. package/vitest.config.browser.ts +68 -0
  178. package/browser/ecpair.d.ts +0 -99
  179. package/src/ecpair.d.ts +0 -99
  180. package/test/taproot-cache.spec.ts +0 -694
@@ -1,13 +1,10 @@
1
- import { describe, it, expect, beforeEach, afterEach, vi, type Mock } from 'vitest';
1
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
2
2
  import {
3
- SignatureType,
4
- WorkerState,
5
3
  type BatchSigningTaskResult,
6
- type SigningTask,
7
4
  type ParallelSignerKeyPair,
5
+ SignatureType,
6
+ type SigningTask,
8
7
  type WorkerResponse,
9
- type SigningResultMessage,
10
- type WorkerPoolConfig,
11
8
  } from '../src/workers/types.js';
12
9
 
13
10
  // Mock Worker class for browser pool testing
@@ -60,14 +57,16 @@ class MockWorker {
60
57
  }
61
58
 
62
59
  // Generate results for all tasks
63
- const results = batchMsg.tasks.map((task): BatchSigningTaskResult => ({
64
- taskId: task.taskId,
65
- signature: new Uint8Array(64).fill(0xab),
66
- inputIndex: task.inputIndex,
67
- publicKey: task.publicKey,
68
- signatureType: task.signatureType,
69
- ...(task.leafHash ? { leafHash: task.leafHash } : {}),
70
- }));
60
+ const results = batchMsg.tasks.map(
61
+ (task): BatchSigningTaskResult => ({
62
+ taskId: task.taskId,
63
+ signature: new Uint8Array(64).fill(0xab),
64
+ inputIndex: task.inputIndex,
65
+ publicKey: task.publicKey,
66
+ signatureType: task.signatureType,
67
+ ...(task.leafHash ? { leafHash: task.leafHash } : {}),
68
+ }),
69
+ );
71
70
 
72
71
  this.simulateMessage({
73
72
  type: 'batchResult',
@@ -104,6 +103,15 @@ class MockWorker {
104
103
  this.errorHandlers = [];
105
104
  }
106
105
 
106
+ simulateError(error: Error): void {
107
+ if (this.onerror) {
108
+ this.onerror(error);
109
+ }
110
+ for (const handler of this.errorHandlers) {
111
+ handler(error);
112
+ }
113
+ }
114
+
107
115
  private simulateMessage(data: WorkerResponse): void {
108
116
  const event = { data };
109
117
  if (this.onmessage) {
@@ -113,15 +121,6 @@ class MockWorker {
113
121
  handler(event);
114
122
  }
115
123
  }
116
-
117
- simulateError(error: Error): void {
118
- if (this.onerror) {
119
- this.onerror(error);
120
- }
121
- for (const handler of this.errorHandlers) {
122
- handler(error);
123
- }
124
- }
125
124
  }
126
125
 
127
126
  // Mock Worker that fails signing
@@ -5,9 +5,8 @@
5
5
  * infrastructure are cryptographically valid.
6
6
  */
7
7
 
8
- import { describe, it, expect, beforeAll } from 'vitest';
8
+ import { beforeAll, describe, expect, it } from 'vitest';
9
9
  import * as ecc from 'tiny-secp256k1';
10
- import { ECPairFactory } from 'ecpair';
11
10
  import { randomBytes } from 'crypto';
12
11
 
13
12
  import { SignatureType, type WorkerEccLib } from '../src/workers/types.js';
@@ -15,8 +14,13 @@ import { generateWorkerCode } from '../src/workers/signing-worker.js';
15
14
  import { toXOnly } from '../src/pubkey.js';
16
15
  import { initEccLib } from '../src/ecc/context.js';
17
16
  import type { EccLib } from '../src/types.js';
17
+ import { ECPairSigner, createNobleBackend } from '@btc-vision/ecpair';
18
+ import { bitcoin } from '../src/networks.js';
18
19
 
19
- const ECPair = ECPairFactory(ecc);
20
+ const backend = createNobleBackend();
21
+ const ECPair = {
22
+ makeRandom: () => ECPairSigner.makeRandom(backend, bitcoin),
23
+ };
20
24
 
21
25
  describe('Worker Signing - Signature Verification', () => {
22
26
  beforeAll(() => {
@@ -1,16 +1,15 @@
1
- import { describe, it, expect, beforeEach, afterEach, vi, type Mock } from 'vitest';
1
+ import { beforeEach, describe, expect, it } from 'vitest';
2
2
  import {
3
- SignatureType,
4
- WorkerState,
5
3
  isSigningError,
6
4
  isSigningResult,
7
5
  isWorkerReady,
8
- type WorkerResponse,
9
- type SigningResultMessage,
6
+ type ParallelSignerKeyPair,
7
+ SignatureType,
10
8
  type SigningErrorMessage,
11
- type WorkerReadyMessage,
9
+ type SigningResultMessage,
12
10
  type SigningTask,
13
- type ParallelSignerKeyPair,
11
+ type WorkerReadyMessage,
12
+ WorkerState,
14
13
  } from '../src/workers/types.js';
15
14
  import { generateWorkerCode } from '../src/workers/signing-worker.js';
16
15
 
package/typedoc.json CHANGED
@@ -25,5 +25,15 @@
25
25
  "plugin": [
26
26
  "typedoc-material-theme"
27
27
  ],
28
- "themeColor": "#F7931A"
28
+ "themeColor": "#F7931A",
29
+ "intentionallyNotExported": [
30
+ "Brand",
31
+ "HashLeaf",
32
+ "HashBranch",
33
+ "TaggedHashPrefixes",
34
+ "__module",
35
+ "PrevOut",
36
+ "TxInCacheMap",
37
+ "NodeEccLibrary"
38
+ ]
29
39
  }
@@ -0,0 +1,68 @@
1
+ import { resolve } from 'path';
2
+ import { defineConfig } from 'vitest/config';
3
+ import { nodePolyfills } from 'vite-plugin-node-polyfills';
4
+ import wasm from 'vite-plugin-wasm';
5
+ import topLevelAwait from 'vite-plugin-top-level-await';
6
+ import { playwright } from '@vitest/browser-playwright';
7
+
8
+ export default defineConfig({
9
+ resolve: {
10
+ alias: {
11
+ crypto: resolve(__dirname, 'src/crypto/crypto-browser.js'),
12
+ stream: 'stream-browserify',
13
+ buffer: 'buffer',
14
+ zlib: 'browserify-zlib',
15
+ },
16
+ },
17
+ plugins: [
18
+ wasm(),
19
+ topLevelAwait(),
20
+ nodePolyfills({
21
+ globals: {
22
+ Buffer: true,
23
+ global: true,
24
+ process: true,
25
+ },
26
+ }),
27
+ ],
28
+ optimizeDeps: {
29
+ exclude: ['tiny-secp256k1'],
30
+ },
31
+ test: {
32
+ globals: true,
33
+ include: [
34
+ // Browser-compatible existing tests (no Node.js deps)
35
+ 'test/address.spec.ts',
36
+ 'test/block.spec.ts',
37
+ 'test/bufferutils.spec.ts',
38
+ 'test/crypto.spec.ts',
39
+ 'test/bitcoin.core.spec.ts',
40
+ 'test/transaction.spec.ts',
41
+ 'test/types.spec.ts',
42
+ 'test/script_number.spec.ts',
43
+ 'test/script_signature.spec.ts',
44
+ 'test/workers.spec.ts',
45
+ 'test/workers-pool.spec.ts',
46
+ // Browser-adapted versions
47
+ 'test/browser/payments.spec.ts',
48
+ 'test/browser/psbt.spec.ts',
49
+ 'test/browser/workers-signing.spec.ts',
50
+ 'test/browser/script.spec.ts',
51
+ ],
52
+ exclude: [
53
+ 'test/integration/**/*.ts',
54
+ // Originals that need Node.js APIs
55
+ 'test/payments.spec.ts',
56
+ 'test/psbt.spec.ts',
57
+ 'test/workers-signing.spec.ts',
58
+ 'test/script.spec.ts',
59
+ ],
60
+ testTimeout: 30000,
61
+ browser: {
62
+ enabled: true,
63
+ provider: playwright(),
64
+ instances: [{ browser: 'chromium' }],
65
+ headless: true,
66
+ },
67
+ },
68
+ });
@@ -1,99 +0,0 @@
1
- /**
2
- * Ambient module declaration for ecpair.
3
- *
4
- * The upstream ecpair@3 .d.ts files depend on valibot@^0.37 type-level APIs.
5
- * When a different valibot major is hoisted (e.g. v1.x required by bip32),
6
- * @typescript-eslint resolves valibot from the project root instead of
7
- * ecpair's nested node_modules, turning every ecpair type into an error type.
8
- *
9
- * This local declaration re-exports the subset of ecpair's public API that
10
- * this project actually uses, without any valibot dependency.
11
- */
12
- declare module 'ecpair' {
13
- interface Network {
14
- messagePrefix: string | Uint8Array;
15
- bech32: string;
16
- bip32: {
17
- public: number;
18
- private: number;
19
- };
20
- pubKeyHash: number;
21
- scriptHash: number;
22
- wif: number;
23
- }
24
-
25
- interface Signer {
26
- publicKey: Uint8Array;
27
- network?: unknown;
28
- sign(hash: Uint8Array, lowR?: boolean): Uint8Array;
29
- }
30
-
31
- interface SignerAsync {
32
- publicKey: Uint8Array;
33
- network?: unknown;
34
- sign(hash: Uint8Array, lowR?: boolean): Promise<Uint8Array>;
35
- }
36
-
37
- interface ECPairInterface extends Signer {
38
- compressed: boolean;
39
- network: Network;
40
- lowR: boolean;
41
- privateKey?: Uint8Array;
42
- toWIF(): string;
43
- tweak(t: Uint8Array): ECPairInterface;
44
- verify(hash: Uint8Array, signature: Uint8Array): boolean;
45
- verifySchnorr(hash: Uint8Array, signature: Uint8Array): boolean;
46
- signSchnorr(hash: Uint8Array): Uint8Array;
47
- }
48
-
49
- interface ECPairOptions {
50
- compressed?: boolean;
51
- network?: Network;
52
- rng?: (arg?: number) => Uint8Array;
53
- }
54
-
55
- interface ECPairAPI {
56
- isPoint(maybePoint: unknown): boolean;
57
- fromPrivateKey(buffer: Uint8Array, options?: ECPairOptions): ECPairInterface;
58
- fromPublicKey(buffer: Uint8Array, options?: ECPairOptions): ECPairInterface;
59
- fromWIF(wifString: string, network?: Network | Network[]): ECPairInterface;
60
- makeRandom(options?: ECPairOptions): ECPairInterface;
61
- }
62
-
63
- interface TinySecp256k1Interface {
64
- isPoint(p: Uint8Array): boolean;
65
- pointCompress(p: Uint8Array, compressed?: boolean): Uint8Array;
66
- isPrivate(d: Uint8Array): boolean;
67
- pointFromScalar(d: Uint8Array, compressed?: boolean): Uint8Array | null;
68
- xOnlyPointAddTweak(
69
- p: Uint8Array,
70
- tweak: Uint8Array,
71
- ): { parity: 1 | 0; xOnlyPubkey: Uint8Array } | null;
72
- privateAdd(d: Uint8Array, tweak: Uint8Array): Uint8Array | null;
73
- privateNegate(d: Uint8Array): Uint8Array;
74
- sign(h: Uint8Array, d: Uint8Array, e?: Uint8Array): Uint8Array;
75
- signSchnorr?(h: Uint8Array, d: Uint8Array, e?: Uint8Array): Uint8Array;
76
- verify(h: Uint8Array, Q: Uint8Array, signature: Uint8Array, strict?: boolean): boolean;
77
- verifySchnorr?(h: Uint8Array, Q: Uint8Array, signature: Uint8Array): boolean;
78
- }
79
-
80
- const networks: {
81
- bitcoin: Network;
82
- testnet: Network;
83
- };
84
-
85
- function ECPairFactory(ecc: TinySecp256k1Interface): ECPairAPI;
86
- export default ECPairFactory;
87
-
88
- export {
89
- ECPairFactory,
90
- Signer,
91
- SignerAsync,
92
- ECPairAPI,
93
- ECPairInterface,
94
- ECPairOptions,
95
- TinySecp256k1Interface,
96
- Network,
97
- networks,
98
- };
99
- }
package/src/ecpair.d.ts DELETED
@@ -1,99 +0,0 @@
1
- /**
2
- * Ambient module declaration for ecpair.
3
- *
4
- * The upstream ecpair@3 .d.ts files depend on valibot@^0.37 type-level APIs.
5
- * When a different valibot major is hoisted (e.g. v1.x required by bip32),
6
- * @typescript-eslint resolves valibot from the project root instead of
7
- * ecpair's nested node_modules, turning every ecpair type into an error type.
8
- *
9
- * This local declaration re-exports the subset of ecpair's public API that
10
- * this project actually uses, without any valibot dependency.
11
- */
12
- declare module 'ecpair' {
13
- interface Network {
14
- messagePrefix: string | Uint8Array;
15
- bech32: string;
16
- bip32: {
17
- public: number;
18
- private: number;
19
- };
20
- pubKeyHash: number;
21
- scriptHash: number;
22
- wif: number;
23
- }
24
-
25
- interface Signer {
26
- publicKey: Uint8Array;
27
- network?: unknown;
28
- sign(hash: Uint8Array, lowR?: boolean): Uint8Array;
29
- }
30
-
31
- interface SignerAsync {
32
- publicKey: Uint8Array;
33
- network?: unknown;
34
- sign(hash: Uint8Array, lowR?: boolean): Promise<Uint8Array>;
35
- }
36
-
37
- interface ECPairInterface extends Signer {
38
- compressed: boolean;
39
- network: Network;
40
- lowR: boolean;
41
- privateKey?: Uint8Array;
42
- toWIF(): string;
43
- tweak(t: Uint8Array): ECPairInterface;
44
- verify(hash: Uint8Array, signature: Uint8Array): boolean;
45
- verifySchnorr(hash: Uint8Array, signature: Uint8Array): boolean;
46
- signSchnorr(hash: Uint8Array): Uint8Array;
47
- }
48
-
49
- interface ECPairOptions {
50
- compressed?: boolean;
51
- network?: Network;
52
- rng?: (arg?: number) => Uint8Array;
53
- }
54
-
55
- interface ECPairAPI {
56
- isPoint(maybePoint: unknown): boolean;
57
- fromPrivateKey(buffer: Uint8Array, options?: ECPairOptions): ECPairInterface;
58
- fromPublicKey(buffer: Uint8Array, options?: ECPairOptions): ECPairInterface;
59
- fromWIF(wifString: string, network?: Network | Network[]): ECPairInterface;
60
- makeRandom(options?: ECPairOptions): ECPairInterface;
61
- }
62
-
63
- interface TinySecp256k1Interface {
64
- isPoint(p: Uint8Array): boolean;
65
- pointCompress(p: Uint8Array, compressed?: boolean): Uint8Array;
66
- isPrivate(d: Uint8Array): boolean;
67
- pointFromScalar(d: Uint8Array, compressed?: boolean): Uint8Array | null;
68
- xOnlyPointAddTweak(
69
- p: Uint8Array,
70
- tweak: Uint8Array,
71
- ): { parity: 1 | 0; xOnlyPubkey: Uint8Array } | null;
72
- privateAdd(d: Uint8Array, tweak: Uint8Array): Uint8Array | null;
73
- privateNegate(d: Uint8Array): Uint8Array;
74
- sign(h: Uint8Array, d: Uint8Array, e?: Uint8Array): Uint8Array;
75
- signSchnorr?(h: Uint8Array, d: Uint8Array, e?: Uint8Array): Uint8Array;
76
- verify(h: Uint8Array, Q: Uint8Array, signature: Uint8Array, strict?: boolean): boolean;
77
- verifySchnorr?(h: Uint8Array, Q: Uint8Array, signature: Uint8Array): boolean;
78
- }
79
-
80
- const networks: {
81
- bitcoin: Network;
82
- testnet: Network;
83
- };
84
-
85
- function ECPairFactory(ecc: TinySecp256k1Interface): ECPairAPI;
86
- export default ECPairFactory;
87
-
88
- export {
89
- ECPairFactory,
90
- Signer,
91
- SignerAsync,
92
- ECPairAPI,
93
- ECPairInterface,
94
- ECPairOptions,
95
- TinySecp256k1Interface,
96
- Network,
97
- networks,
98
- };
99
- }