@btc-vision/wallet-sdk 1.0.7 → 2.0.0

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 (82) hide show
  1. package/LICENSE +15 -15
  2. package/README.md +24 -24
  3. package/dist/index.cjs.js +2 -0
  4. package/dist/index.cjs.js.map +1 -0
  5. package/dist/index.d.ts +841 -0
  6. package/dist/index.esm.js +2 -0
  7. package/dist/index.esm.js.map +1 -0
  8. package/package.json +53 -75
  9. package/es/bundle.js +0 -2
  10. package/es/bundle.js.LICENSE.txt +0 -48
  11. package/lib/address/index.d.ts +0 -36
  12. package/lib/address/index.js +0 -200
  13. package/lib/bitcoin-core.d.ts +0 -5
  14. package/lib/bitcoin-core.js +0 -7
  15. package/lib/constants.d.ts +0 -1
  16. package/lib/constants.js +0 -2
  17. package/lib/error.d.ts +0 -20
  18. package/lib/error.js +0 -25
  19. package/lib/index.d.ts +0 -14
  20. package/lib/index.js +0 -21
  21. package/lib/keyring/hd-keyring.d.ts +0 -50
  22. package/lib/keyring/hd-keyring.js +0 -199
  23. package/lib/keyring/index.d.ts +0 -4
  24. package/lib/keyring/index.js +0 -4
  25. package/lib/keyring/interfaces/SimpleKeyringOptions.d.ts +0 -52
  26. package/lib/keyring/interfaces/SimpleKeyringOptions.js +0 -70
  27. package/lib/keyring/keystone-keyring.d.ts +0 -82
  28. package/lib/keyring/keystone-keyring.js +0 -318
  29. package/lib/keyring/simple-keyring.d.ts +0 -11
  30. package/lib/keyring/simple-keyring.js +0 -61
  31. package/lib/message/bip322-simple.d.ts +0 -19
  32. package/lib/message/bip322-simple.js +0 -145
  33. package/lib/message/deterministic-ecdsa.d.ts +0 -2
  34. package/lib/message/deterministic-ecdsa.js +0 -62
  35. package/lib/message/ecdsa.d.ts +0 -3
  36. package/lib/message/ecdsa.js +0 -24
  37. package/lib/message/index.d.ts +0 -3
  38. package/lib/message/index.js +0 -3
  39. package/lib/network/index.d.ts +0 -14
  40. package/lib/network/index.js +0 -35
  41. package/lib/runes/index.d.ts +0 -1
  42. package/lib/runes/index.js +0 -1
  43. package/lib/runes/rund_id.d.ts +0 -11
  44. package/lib/runes/rund_id.js +0 -25
  45. package/lib/runes/varint.d.ts +0 -14
  46. package/lib/runes/varint.js +0 -39
  47. package/lib/transaction/index.d.ts +0 -3
  48. package/lib/transaction/index.js +0 -3
  49. package/lib/transaction/inscription-utxo.d.ts +0 -33
  50. package/lib/transaction/inscription-utxo.js +0 -127
  51. package/lib/transaction/transaction.d.ts +0 -51
  52. package/lib/transaction/transaction.js +0 -353
  53. package/lib/transaction/utxo.d.ts +0 -35
  54. package/lib/transaction/utxo.js +0 -102
  55. package/lib/tx-helpers/index.d.ts +0 -8
  56. package/lib/tx-helpers/index.js +0 -8
  57. package/lib/tx-helpers/send-atomicals-ft.d.ts +0 -16
  58. package/lib/tx-helpers/send-atomicals-ft.js +0 -51
  59. package/lib/tx-helpers/send-atomicals-nft.d.ts +0 -14
  60. package/lib/tx-helpers/send-atomicals-nft.js +0 -30
  61. package/lib/tx-helpers/send-btc.d.ts +0 -28
  62. package/lib/tx-helpers/send-btc.js +0 -60
  63. package/lib/tx-helpers/send-inscription.d.ts +0 -16
  64. package/lib/tx-helpers/send-inscription.js +0 -34
  65. package/lib/tx-helpers/send-inscriptions.d.ts +0 -14
  66. package/lib/tx-helpers/send-inscriptions.js +0 -30
  67. package/lib/tx-helpers/send-runes.d.ts +0 -19
  68. package/lib/tx-helpers/send-runes.js +0 -87
  69. package/lib/tx-helpers/split-inscription-utxo.d.ts +0 -15
  70. package/lib/tx-helpers/split-inscription-utxo.js +0 -43
  71. package/lib/types.d.ts +0 -59
  72. package/lib/types.js +0 -12
  73. package/lib/utils.d.ts +0 -23
  74. package/lib/utils.js +0 -58
  75. package/lib/wallet/abstract-wallet.d.ts +0 -6
  76. package/lib/wallet/abstract-wallet.js +0 -1
  77. package/lib/wallet/estimate-wallet.d.ts +0 -23
  78. package/lib/wallet/estimate-wallet.js +0 -157
  79. package/lib/wallet/index.d.ts +0 -3
  80. package/lib/wallet/index.js +0 -3
  81. package/lib/wallet/local-wallet.d.ts +0 -23
  82. package/lib/wallet/local-wallet.js +0 -167
@@ -0,0 +1,841 @@
1
+ import { AddressTypes } from '@btc-vision/transaction';
2
+ import * as bitcoin from '@btc-vision/bitcoin';
3
+ import { ECPairInterface } from 'ecpair';
4
+ import { MLDSASecurityLevel } from '@btc-vision/transaction';
5
+ import { MnemonicStrength } from '@btc-vision/transaction';
6
+ import { Network } from '@btc-vision/bitcoin';
7
+ import { OPNetNetwork } from '@btc-vision/transaction';
8
+ import { Psbt } from '@btc-vision/bitcoin';
9
+ import { QuantumBIP32Factory } from '@btc-vision/transaction';
10
+ import { QuantumBIP32Interface } from '@btc-vision/transaction';
11
+ import { Wallet } from '@btc-vision/transaction';
12
+
13
+ /**
14
+ * Abstract wallet interface
15
+ */
16
+ export declare interface AbstractWallet {
17
+ signPsbt(psbt: Psbt, opts?: SignPsbtOptions): Promise<Psbt> | Psbt;
18
+ signMessage(message: string | Buffer, method: MessageSigningMethod): Promise<string>;
19
+ }
20
+
21
+ /**
22
+ * All address types for an account
23
+ */
24
+ export declare interface AccountAddresses {
25
+ readonly p2pkh?: string;
26
+ readonly p2wpkh?: string;
27
+ readonly p2tr?: string;
28
+ readonly p2shP2wpkh?: string;
29
+ }
30
+
31
+ /**
32
+ * Wallet account information
33
+ */
34
+ export declare interface AccountInfo {
35
+ readonly index: number;
36
+ readonly publicKey: string;
37
+ readonly quantumPublicKey: string;
38
+ readonly addresses: AccountAddresses;
39
+ }
40
+
41
+ /**
42
+ * Sign input with address specification
43
+ */
44
+ export declare interface AddressSignInput extends BaseSignInput {
45
+ readonly address: string;
46
+ }
47
+
48
+ /**
49
+ * Convert an address to its scriptPubKey
50
+ */
51
+ export declare function addressToScriptPubKey(address: string, network: Network): Buffer;
52
+
53
+ /**
54
+ * Base interface for inputs to sign in a PSBT
55
+ */
56
+ export declare interface BaseSignInput {
57
+ readonly index: number;
58
+ readonly sighashTypes?: readonly number[];
59
+ readonly disableTweakSigner?: boolean;
60
+ }
61
+
62
+ /**
63
+ * BIP322 signature result
64
+ */
65
+ export declare interface Bip322Signature {
66
+ readonly address: string;
67
+ readonly message: string | Buffer;
68
+ readonly signature: string;
69
+ readonly networkType: OPNetNetwork;
70
+ }
71
+
72
+ /**
73
+ * Classical key pair information
74
+ */
75
+ export declare interface ClassicalKeyInfo {
76
+ readonly publicKey: Buffer;
77
+ readonly privateKey?: Buffer;
78
+ }
79
+
80
+ /**
81
+ * Decode an address to get its network type, address type, and scriptPubKey
82
+ */
83
+ export declare function decodeAddress(address: string): DecodedAddress | null;
84
+
85
+ /**
86
+ * Result of an address decode operation
87
+ */
88
+ export declare interface DecodedAddress {
89
+ readonly networkType: OPNetNetwork;
90
+ readonly addressType: AddressTypes;
91
+ readonly scriptPubKey: Buffer;
92
+ }
93
+
94
+ /**
95
+ * HD derivation options
96
+ */
97
+ export declare interface DerivationOptions {
98
+ readonly addressType?: AddressTypes;
99
+ readonly account?: number;
100
+ readonly change?: boolean;
101
+ readonly index?: number;
102
+ }
103
+
104
+ /**
105
+ * Deserialize string to unified export
106
+ */
107
+ export declare function deserializeExport(serialized: string): UnifiedWalletExport;
108
+
109
+ /**
110
+ * Detect the address type from an address string
111
+ */
112
+ export declare function detectAddressType(address: string, network: Network): AddressTypes | null;
113
+
114
+ /**
115
+ * Detect network type from an address
116
+ */
117
+ export declare function detectNetworkFromAddress(address: string): OPNetNetwork | null;
118
+
119
+ /**
120
+ * Exported wallet format for unified key export
121
+ */
122
+ export declare interface ExportedWallet {
123
+ readonly version: number;
124
+ readonly classicalPrivateKey: string;
125
+ readonly quantumPrivateKey: string;
126
+ readonly quantumPublicKey: string;
127
+ readonly securityLevel: MLDSASecurityLevel;
128
+ readonly chainCode: string;
129
+ }
130
+
131
+ /**
132
+ * Export wallet keys to unified format
133
+ */
134
+ export declare function exportWallet(classicalPrivateKey: Buffer, classicalPublicKey: Buffer, quantumPrivateKey: Uint8Array, quantumPublicKey: Uint8Array, chainCode: Buffer, securityLevel: MLDSASecurityLevel, network: Network): UnifiedWalletExport;
135
+
136
+ /**
137
+ * Export wallet to portable string format
138
+ */
139
+ export declare function exportWalletToString(classicalPrivateKey: Buffer, classicalPublicKey: Buffer, quantumPrivateKey: Uint8Array, quantumPublicKey: Uint8Array, chainCode: Buffer, securityLevel: MLDSASecurityLevel, network: Network): string;
140
+
141
+ /**
142
+ * Extract signature from a signed BIP322 PSBT
143
+ */
144
+ export declare function extractBip322Signature(psbt: Psbt): string;
145
+
146
+ /**
147
+ * Convert legacy ExportedWallet format to unified format
148
+ */
149
+ export declare function fromLegacyExport(legacy: ExportedWallet, network: Network): UnifiedWalletExport;
150
+
151
+ /**
152
+ * Generate a PSBT for BIP322 simple message signing
153
+ */
154
+ export declare function generateBip322Psbt(message: string | Buffer, address: string, network: Network): Psbt;
155
+
156
+ /**
157
+ * Get address type with OPNetNetwork parameter
158
+ */
159
+ export declare function getAddressType(address: string, networkType: OPNetNetwork): AddressTypes | null;
160
+
161
+ /**
162
+ * Get the bech32 prefix for a network type
163
+ */
164
+ export declare function getBech32Prefix(networkType: OPNetNetwork): string;
165
+
166
+ /**
167
+ * HD Keyring with quantum-resistant cryptography support.
168
+ * Supports BIP39 mnemonic phrases with BIP360 quantum key derivation.
169
+ */
170
+ export declare class HdKeyring {
171
+ static readonly type = "HD Key Tree";
172
+ readonly type = "HD Key Tree";
173
+ private mnemonic;
174
+ private readonly wallets;
175
+ private readonly activeIndexes;
176
+ private readonly network;
177
+ private readonly securityLevel;
178
+ private readonly passphrase;
179
+ private addressType;
180
+ constructor(options?: HdKeyringOptions);
181
+ /**
182
+ * Generate a new mnemonic with quantum support
183
+ */
184
+ static generate(strength?: MnemonicStrength, passphrase?: string, network?: Network, securityLevel?: MLDSASecurityLevel): HdKeyring;
185
+ /**
186
+ * Initialize from an existing mnemonic phrase
187
+ */
188
+ initFromMnemonic(phrase: string): void;
189
+ /**
190
+ * Get the mnemonic phrase
191
+ */
192
+ getMnemonic(): string;
193
+ /**
194
+ * Check if keyring has a mnemonic
195
+ */
196
+ hasMnemonic(): boolean;
197
+ /**
198
+ * Derive a wallet at a specific index using Unisat-compatible derivation
199
+ */
200
+ deriveWallet(index: number): Wallet;
201
+ /**
202
+ * Derive a wallet using standard (non-Unisat) derivation
203
+ */
204
+ deriveStandardWallet(index: number): Wallet;
205
+ /**
206
+ * Add new accounts to the keyring
207
+ */
208
+ addAccounts(numberOfAccounts?: number): string[];
209
+ /**
210
+ * Activate specific account indexes
211
+ */
212
+ activateAccounts(indexes: number[]): string[];
213
+ /**
214
+ * Get all active account public keys
215
+ */
216
+ getAccounts(): string[];
217
+ /**
218
+ * Get detailed account info for all active accounts
219
+ */
220
+ getAccountsInfo(): AccountInfo[];
221
+ /**
222
+ * Get quantum public key for an account
223
+ */
224
+ getQuantumPublicKey(publicKey: string): string;
225
+ /**
226
+ * Get the index for a public key
227
+ */
228
+ getIndexByPublicKey(publicKey: string): number | null;
229
+ /**
230
+ * Get addresses for a specific public key
231
+ */
232
+ getAddressesForPublicKey(publicKey: string): AccountAddresses;
233
+ /**
234
+ * Get an address for a public key and address type
235
+ */
236
+ getAddress(publicKey: string, addressType: AddressTypes): string;
237
+ /**
238
+ * Remove an account by public key
239
+ */
240
+ removeAccount(publicKey: string): void;
241
+ /**
242
+ * Export the private key for an account
243
+ */
244
+ exportAccount(publicKey: string): string;
245
+ /**
246
+ * Sign a PSBT transaction
247
+ */
248
+ signTransaction(psbt: Psbt, inputs: readonly ToSignInput[]): Psbt;
249
+ /**
250
+ * Sign arbitrary data with ECDSA or Schnorr
251
+ */
252
+ signData(publicKey: string, data: string, type?: 'ecdsa' | 'schnorr'): string;
253
+ /**
254
+ * Get the Wallet for a public key
255
+ */
256
+ getWallet(publicKey: string): Wallet;
257
+ /**
258
+ * Serialize the keyring state
259
+ */
260
+ serialize(): HdKeyringOptions;
261
+ /**
262
+ * Get active indexes
263
+ */
264
+ getActiveIndexes(): readonly number[];
265
+ /**
266
+ * Change the address type for new derivations
267
+ */
268
+ setAddressType(addressType: AddressTypes): void;
269
+ /**
270
+ * Get current address type
271
+ */
272
+ getAddressType(): AddressTypes;
273
+ /**
274
+ * Get the security level
275
+ */
276
+ getSecurityLevel(): MLDSASecurityLevel;
277
+ /**
278
+ * Get the network
279
+ */
280
+ getNetwork(): Network;
281
+ /**
282
+ * Get paginated addresses for display
283
+ */
284
+ getAddressesPage(page: number, perPage?: number): {
285
+ address: string;
286
+ index: number;
287
+ }[];
288
+ /**
289
+ * Get the chain code for a wallet
290
+ */
291
+ getChainCode(publicKey: string): Buffer;
292
+ /**
293
+ * Get ML-DSA keypair for quantum operations
294
+ */
295
+ getMLDSAKeypair(publicKey: string): QuantumBIP32Interface;
296
+ private findWalletByPublicKey;
297
+ private getAddressFromWallet;
298
+ }
299
+
300
+ /**
301
+ * HD Keyring deserialization options
302
+ */
303
+ export declare interface HdKeyringOptions {
304
+ readonly mnemonic?: string | undefined;
305
+ readonly passphrase?: string | undefined;
306
+ readonly network?: Network | undefined;
307
+ readonly securityLevel?: MLDSASecurityLevel | undefined;
308
+ readonly activeIndexes?: readonly number[] | undefined;
309
+ readonly addressType?: AddressTypes | undefined;
310
+ }
311
+
312
+ /**
313
+ * Import wallet keys from unified format
314
+ */
315
+ export declare function importWallet(exportData: UnifiedWalletExport): {
316
+ keypair: ECPairInterface;
317
+ quantumKeypair: ReturnType<typeof QuantumBIP32Factory.fromPrivateKey>;
318
+ network: Network;
319
+ securityLevel: MLDSASecurityLevel;
320
+ chainCode: Buffer;
321
+ };
322
+
323
+ /**
324
+ * Import wallet from portable string format
325
+ */
326
+ export declare function importWalletFromString(serialized: string): {
327
+ keypair: ECPairInterface;
328
+ quantumKeypair: ReturnType<typeof QuantumBIP32Factory.fromPrivateKey>;
329
+ network: Network;
330
+ securityLevel: MLDSASecurityLevel;
331
+ chainCode: Buffer;
332
+ };
333
+
334
+ /**
335
+ * Type guard to check if sign input has address
336
+ */
337
+ export declare function isAddressSignInput(input: SignInput): input is AddressSignInput;
338
+
339
+ /**
340
+ * Check if an address is P2PKH or P2SH
341
+ */
342
+ export declare function isP2PKHOrP2SHAddress(address: string, network: Network): boolean;
343
+
344
+ /**
345
+ * Check if an address is P2WPKH
346
+ */
347
+ export declare function isP2WPKHAddress(address: string, network: Network): boolean;
348
+
349
+ /**
350
+ * Type guard to check if sign input has public key
351
+ */
352
+ export declare function isPublicKeySignInput(input: SignInput): input is PublicKeySignInput;
353
+
354
+ /**
355
+ * Validate if an address is valid for the given network
356
+ */
357
+ export declare function isValidAddress(address: string, network: Network): boolean;
358
+
359
+ /**
360
+ * Convert OPNetNetwork to Network and validate address
361
+ */
362
+ export declare function isValidAddressForNetworkType(address: string, networkType: OPNetNetwork): boolean;
363
+
364
+ /**
365
+ * Validate a Taproot (P2TR) address
366
+ */
367
+ export declare function isValidP2TRAddress(address: string, network: Network): boolean;
368
+
369
+ /**
370
+ * Validate a public key using AddressVerificator
371
+ */
372
+ export declare function isValidPublicKey(publicKey: Buffer | string, network: Network): boolean;
373
+
374
+ /**
375
+ * Keyring serialization options
376
+ */
377
+ export declare interface KeyringSerializeOptions {
378
+ readonly includePrivateKeys?: boolean;
379
+ }
380
+
381
+ /**
382
+ * Keystone hardware wallet key information
383
+ */
384
+ export declare interface KeystoneKey {
385
+ readonly path: string;
386
+ readonly extendedPublicKey: string;
387
+ }
388
+
389
+ /**
390
+ * Keystone keyring options
391
+ */
392
+ export declare interface KeystoneKeyringOptions {
393
+ readonly mfp: string;
394
+ readonly keys: readonly KeystoneKey[];
395
+ readonly network?: Network;
396
+ readonly activeIndexes?: readonly number[];
397
+ readonly addressType?: AddressTypes;
398
+ }
399
+
400
+ /**
401
+ * Local wallet implementation with full signing capabilities.
402
+ */
403
+ export declare class LocalWallet implements AbstractWallet {
404
+ private readonly keyring;
405
+ private readonly network;
406
+ private readonly addressType;
407
+ private readonly publicKey;
408
+ private readonly address;
409
+ private constructor();
410
+ /**
411
+ * Create wallet from WIF
412
+ */
413
+ static fromWIF(wif: string, addressType: AddressTypes | undefined, network: Network, quantumPrivateKey?: string): LocalWallet;
414
+ /**
415
+ * Create wallet from private key hex
416
+ */
417
+ static fromPrivateKey(privateKeyHex: string, addressType: AddressTypes | undefined, network: Network, quantumPrivateKey?: string): LocalWallet;
418
+ /**
419
+ * Create wallet from mnemonic
420
+ */
421
+ static fromMnemonic(mnemonic: string, addressType: AddressTypes | undefined, network: Network, passphrase?: string, accountIndex?: number): LocalWallet;
422
+ /**
423
+ * Create a random wallet
424
+ */
425
+ static random(addressType?: AddressTypes, network?: Network): LocalWallet;
426
+ /**
427
+ * Get the wallet address
428
+ */
429
+ getAddress(): string;
430
+ /**
431
+ * Get the public key
432
+ */
433
+ getPublicKey(): string;
434
+ /**
435
+ * Get the quantum public key
436
+ */
437
+ getQuantumPublicKey(): string;
438
+ /**
439
+ * Get the network
440
+ */
441
+ getNetwork(): Network;
442
+ /**
443
+ * Get the address type
444
+ */
445
+ getAddressType(): AddressTypes;
446
+ /**
447
+ * Sign a PSBT
448
+ */
449
+ signPsbt(psbt: Psbt, opts?: SignPsbtOptions): Psbt;
450
+ /**
451
+ * Sign a message
452
+ */
453
+ signMessage(message: string | Buffer, method: MessageSigningMethod): Promise<string>;
454
+ /**
455
+ * Sign raw data
456
+ */
457
+ signData(data: string, type?: 'ecdsa' | 'schnorr'): string;
458
+ /**
459
+ * Export the private key
460
+ */
461
+ exportPrivateKey(): string;
462
+ /**
463
+ * Export the quantum private key
464
+ */
465
+ exportQuantumPrivateKey(): string;
466
+ /**
467
+ * Export WIF
468
+ */
469
+ exportWIF(): string;
470
+ private getKeypair;
471
+ private getQuantumKeypair;
472
+ private formatInputsToSign;
473
+ }
474
+
475
+ /**
476
+ * Message input type - can be string, Buffer, or Uint8Array
477
+ */
478
+ export declare type MessageInput = string | Buffer | Uint8Array;
479
+
480
+ /**
481
+ * Message signing method types
482
+ */
483
+ export declare type MessageSigningMethod = 'bip322-simple' | 'ecdsa' | 'schnorr' | 'mldsa';
484
+
485
+ /**
486
+ * Result of ML-DSA signature operation
487
+ */
488
+ export declare interface MLDSASignatureResult {
489
+ readonly message: MessageInput;
490
+ readonly signature: Uint8Array;
491
+ readonly publicKey: Uint8Array;
492
+ readonly securityLevel: MLDSASecurityLevel;
493
+ }
494
+
495
+ /**
496
+ * Mnemonic options for wallet generation
497
+ */
498
+ export declare interface MnemonicOptions {
499
+ readonly phrase?: string;
500
+ readonly passphrase?: string;
501
+ readonly network?: Network;
502
+ readonly securityLevel?: MLDSASecurityLevel;
503
+ }
504
+
505
+ /**
506
+ * Sign input with public key specification
507
+ */
508
+ export declare interface PublicKeySignInput extends BaseSignInput {
509
+ readonly publicKey: string;
510
+ }
511
+
512
+ /**
513
+ * Generate a Bitcoin address from a public key
514
+ */
515
+ export declare function publicKeyToAddress(publicKey: Buffer | string, addressType: AddressTypes, network: Network): string;
516
+
517
+ /**
518
+ * Convert OPNetNetwork-based operations to Network-based
519
+ */
520
+ export declare function publicKeyToAddressWithNetworkType(publicKey: Buffer | string, addressType: AddressTypes, networkType: OPNetNetwork): string;
521
+
522
+ /**
523
+ * Generate a payment object from a public key
524
+ */
525
+ export declare function publicKeyToPayment(publicKey: Buffer | string, addressType: AddressTypes, network: Network): bitcoin.Payment;
526
+
527
+ /**
528
+ * Generate scriptPubKey from a public key
529
+ */
530
+ export declare function publicKeyToScriptPubKey(publicKey: Buffer | string, addressType: AddressTypes, network: Network): Buffer;
531
+
532
+ /**
533
+ * Quantum key pair information
534
+ */
535
+ export declare interface QuantumKeyInfo {
536
+ readonly publicKey: Uint8Array;
537
+ readonly securityLevel: MLDSASecurityLevel;
538
+ }
539
+
540
+ /**
541
+ * Result of Schnorr signature operation
542
+ */
543
+ export declare interface SchnorrSignatureResult {
544
+ readonly message: MessageInput;
545
+ readonly signature: Uint8Array;
546
+ readonly publicKey: Uint8Array;
547
+ }
548
+
549
+ /**
550
+ * Convert scriptPubKey to an address
551
+ */
552
+ export declare function scriptPubKeyToAddress(scriptPubKey: Buffer | string, network: Network): string;
553
+
554
+ /**
555
+ * Serialize unified export to string (base64 encoded JSON)
556
+ */
557
+ export declare function serializeExport(exportData: UnifiedWalletExport): string;
558
+
559
+ /**
560
+ * Signature type for message signing operations
561
+ */
562
+ export declare type SignatureType = 'ecdsa' | 'schnorr' | 'mldsa';
563
+
564
+ /**
565
+ * Sign a message using BIP322 simple format
566
+ */
567
+ export declare function signBip322Message(message: string | Buffer, address: string, network: Network, signPsbt: (psbt: Psbt) => Promise<Psbt>): Promise<string>;
568
+
569
+ /**
570
+ * Sign a message using BIP322 with OPNetNetwork parameter
571
+ */
572
+ export declare function signBip322MessageWithNetworkType(message: string | Buffer, address: string, networkType: OPNetNetwork, signPsbt: (psbt: Psbt) => Promise<Psbt>): Promise<Bip322Signature>;
573
+
574
+ /**
575
+ * Message signature result
576
+ */
577
+ export declare interface SignedMessage {
578
+ readonly message: string | Buffer;
579
+ readonly signature: Uint8Array;
580
+ readonly publicKey: Uint8Array;
581
+ readonly signatureType: SignatureType;
582
+ readonly securityLevel?: MLDSASecurityLevel;
583
+ }
584
+
585
+ /**
586
+ * Union type for sign inputs
587
+ */
588
+ export declare type SignInput = AddressSignInput | PublicKeySignInput;
589
+
590
+ /**
591
+ * Sign message with automatic type selection
592
+ */
593
+ export declare function signMessage(keypair: ECPairInterface | QuantumBIP32Interface, message: MessageInput, signatureType: SignatureType): SignedMessage;
594
+
595
+ /**
596
+ * Sign a message with ML-DSA (quantum-resistant)
597
+ */
598
+ export declare function signMLDSA(keypair: QuantumBIP32Interface, message: MessageInput): MLDSASignatureResult;
599
+
600
+ /**
601
+ * Options for signing PSBTs
602
+ */
603
+ export declare interface SignPsbtOptions {
604
+ readonly autoFinalized?: boolean;
605
+ readonly toSignInputs?: readonly SignInput[];
606
+ }
607
+
608
+ /**
609
+ * Sign a message with Schnorr (classical)
610
+ */
611
+ export declare function signSchnorr(keypair: ECPairInterface, message: MessageInput): SchnorrSignatureResult;
612
+
613
+ /**
614
+ * Sign a message with tweaked key for Taproot
615
+ */
616
+ export declare function signTweakedSchnorr(keypair: ECPairInterface, message: MessageInput, network?: Network): SchnorrSignatureResult;
617
+
618
+ /**
619
+ * Simple Keyring for single key pair management with quantum support.
620
+ * When importing from WIF or private key, a quantum key must be provided or generated.
621
+ */
622
+ export declare class SimpleKeyring {
623
+ static readonly type = "Simple Key Pair";
624
+ readonly type = "Simple Key Pair";
625
+ private readonly network;
626
+ private readonly securityLevel;
627
+ private keypair;
628
+ private quantumKeypair;
629
+ private chainCode;
630
+ constructor(options?: SimpleKeyringOptions);
631
+ /**
632
+ * Generate a new random key pair with quantum support
633
+ */
634
+ static generate(network?: Network, securityLevel?: MLDSASecurityLevel): SimpleKeyring;
635
+ /**
636
+ * Import from WIF (Wallet Import Format) with mandatory quantum key
637
+ */
638
+ static fromWIF(wif: string, quantumPrivateKey: string | undefined, network?: Network, securityLevel?: MLDSASecurityLevel): SimpleKeyring;
639
+ /**
640
+ * Import from hex private key with mandatory quantum key
641
+ */
642
+ static fromPrivateKey(privateKeyHex: string, quantumPrivateKey: string | undefined, network?: Network, securityLevel?: MLDSASecurityLevel): SimpleKeyring;
643
+ /**
644
+ * Import a private key (WIF or hex format)
645
+ */
646
+ importPrivateKey(privateKey: string, quantumPrivateKey?: string): void;
647
+ /**
648
+ * Import an existing quantum private key
649
+ */
650
+ importQuantumKey(quantumPrivateKeyHex: string): void;
651
+ /**
652
+ * Generate a fresh quantum key pair
653
+ */
654
+ generateFreshQuantumKey(): void;
655
+ /**
656
+ * Check if keyring has keys
657
+ */
658
+ hasKeys(): boolean;
659
+ /**
660
+ * Get the classical public key
661
+ */
662
+ getPublicKey(): string;
663
+ /**
664
+ * Get the quantum public key
665
+ */
666
+ getQuantumPublicKey(): string;
667
+ /**
668
+ * Get the quantum public key hash (universal identifier)
669
+ */
670
+ getQuantumPublicKeyHash(): string;
671
+ /**
672
+ * Get all accounts (returns array with single public key)
673
+ */
674
+ getAccounts(): string[];
675
+ /**
676
+ * Get addresses for the key pair
677
+ */
678
+ getAddresses(): AccountAddresses;
679
+ /**
680
+ * Get an address for a specific type
681
+ */
682
+ getAddress(addressType: AddressTypes): string;
683
+ /**
684
+ * Export the classical private key
685
+ */
686
+ exportPrivateKey(): string;
687
+ /**
688
+ * Export the quantum private key with chain code
689
+ */
690
+ exportQuantumPrivateKey(): string;
691
+ /**
692
+ * Export WIF format
693
+ */
694
+ exportWIF(): string;
695
+ /**
696
+ * Sign a PSBT transaction
697
+ */
698
+ signTransaction(psbt: Psbt, inputs: readonly ToSignInput[]): Psbt;
699
+ /**
700
+ * Sign arbitrary data with ECDSA or Schnorr
701
+ */
702
+ signData(data: string, type?: 'ecdsa' | 'schnorr'): string;
703
+ /**
704
+ * Verify a signature
705
+ */
706
+ verify(data: string, signature: string, type?: 'ecdsa' | 'schnorr'): boolean;
707
+ /**
708
+ * Get the keypair
709
+ */
710
+ getKeypair(): ECPairInterface;
711
+ /**
712
+ * Get the quantum keypair
713
+ */
714
+ getQuantumKeypair(): QuantumBIP32Interface;
715
+ /**
716
+ * Get the chain code
717
+ */
718
+ getChainCode(): Buffer;
719
+ /**
720
+ * Get the security level
721
+ */
722
+ getSecurityLevel(): MLDSASecurityLevel;
723
+ /**
724
+ * Get the network
725
+ */
726
+ getNetwork(): Network;
727
+ /**
728
+ * Serialize the keyring state (excludes private keys for safety)
729
+ */
730
+ serialize(): SimpleKeyringOptions;
731
+ /**
732
+ * Remove the key (clear keyring)
733
+ */
734
+ clear(): void;
735
+ }
736
+
737
+ /**
738
+ * Simple keyring options for WIF/private key import
739
+ */
740
+ export declare interface SimpleKeyringOptions {
741
+ readonly privateKey: string;
742
+ readonly quantumPrivateKey?: string | undefined;
743
+ readonly network?: Network | undefined;
744
+ readonly securityLevel?: MLDSASecurityLevel | undefined;
745
+ }
746
+
747
+ /**
748
+ * Convert OPNetNetwork enum to @btc-vision/bitcoin Network object
749
+ */
750
+ export declare function toNetwork(networkType: OPNetNetwork): Network;
751
+
752
+ /**
753
+ * Convert @btc-vision/bitcoin Network object to OPNetNetwork enum
754
+ */
755
+ export declare function toNetworkType(network: Network): OPNetNetwork;
756
+
757
+ /**
758
+ * Internal representation of inputs to sign
759
+ */
760
+ export declare interface ToSignInput {
761
+ readonly index: number;
762
+ readonly publicKey: string;
763
+ readonly sighashTypes?: readonly number[];
764
+ readonly disableTweakSigner?: boolean;
765
+ }
766
+
767
+ /**
768
+ * Unified wallet export format
769
+ */
770
+ export declare interface UnifiedWalletExport {
771
+ readonly magic: string;
772
+ readonly version: number;
773
+ readonly network: string;
774
+ readonly classical: {
775
+ readonly privateKey: string;
776
+ readonly publicKey: string;
777
+ };
778
+ readonly quantum: {
779
+ readonly privateKey: string;
780
+ readonly publicKey: string;
781
+ readonly securityLevel: MLDSASecurityLevel;
782
+ readonly chainCode: string;
783
+ };
784
+ readonly checksum: string;
785
+ }
786
+
787
+ /**
788
+ * Validate that an address matches the expected network
789
+ */
790
+ export declare function validateAddressNetwork(address: string, expectedNetwork: OPNetNetwork): boolean;
791
+
792
+ /**
793
+ * Validate export data without importing
794
+ */
795
+ export declare function validateExport(exportData: UnifiedWalletExport): boolean;
796
+
797
+ /**
798
+ * Verify a BIP322 simple message signature
799
+ */
800
+ export declare function verifyBip322Message(address: string, message: string | Buffer, signature: string, network: Network): boolean;
801
+
802
+ /**
803
+ * Verify a BIP322 signature with OPNetNetwork parameter
804
+ */
805
+ export declare function verifyBip322MessageWithNetworkType(address: string, message: string | Buffer, signature: string, networkType: OPNetNetwork): boolean;
806
+
807
+ /**
808
+ * Verify message with automatic type detection
809
+ */
810
+ export declare function verifyMessage(publicKey: Buffer | Uint8Array, message: MessageInput, signature: Uint8Array, signatureType: SignatureType, chainCode?: Buffer, network?: Network, securityLevel?: MLDSASecurityLevel): boolean;
811
+
812
+ /**
813
+ * Verify an ML-DSA signature
814
+ */
815
+ export declare function verifyMLDSA(publicKey: Uint8Array, chainCode: Buffer, network: Network, securityLevel: MLDSASecurityLevel, message: MessageInput, signature: Uint8Array): boolean;
816
+
817
+ /**
818
+ * Verify an ML-DSA signature using an existing keypair
819
+ */
820
+ export declare function verifyMLDSAWithKeypair(keypair: QuantumBIP32Interface, message: MessageInput, signature: Uint8Array): boolean;
821
+
822
+ /**
823
+ * Verify a Schnorr signature
824
+ */
825
+ export declare function verifySchnorr(publicKey: Buffer | Uint8Array, message: MessageInput, signature: Uint8Array): boolean;
826
+
827
+ /**
828
+ * Verify a tweaked Schnorr signature
829
+ */
830
+ export declare function verifyTweakedSchnorr(publicKey: Buffer | Uint8Array, message: MessageInput, signature: Uint8Array): boolean;
831
+
832
+ /**
833
+ * Combined wallet key information (classical + quantum)
834
+ */
835
+ export declare interface WalletKeyInfo {
836
+ readonly classical: ClassicalKeyInfo;
837
+ readonly quantum: QuantumKeyInfo;
838
+ readonly chainCode: Buffer;
839
+ }
840
+
841
+ export { }