@btc-vision/wallet-sdk 2.0.13 → 2.1.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.
- package/LICENSE +15 -15
- package/README.md +79 -79
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +20 -20
- package/dist/index.esm.js +90 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +84 -85
package/dist/index.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ import { ECPairInterface } from 'ecpair';
|
|
|
4
4
|
import { MLDSASecurityLevel } from '@btc-vision/transaction';
|
|
5
5
|
import { MnemonicStrength } from '@btc-vision/transaction';
|
|
6
6
|
import { Network } from '@btc-vision/bitcoin';
|
|
7
|
-
import { OPNetNetwork } from '@btc-vision/transaction';
|
|
8
7
|
import { Psbt } from '@btc-vision/bitcoin';
|
|
9
8
|
import { QuantumBIP32Factory } from '@btc-vision/transaction';
|
|
10
9
|
import { QuantumBIP32Interface } from '@btc-vision/transaction';
|
|
11
10
|
import { Wallet } from '@btc-vision/transaction';
|
|
11
|
+
import { WalletNetworks } from '@btc-vision/transaction';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Abstract wallet interface
|
|
@@ -66,7 +66,7 @@ export declare interface Bip322Signature {
|
|
|
66
66
|
readonly address: string;
|
|
67
67
|
readonly message: string | Buffer;
|
|
68
68
|
readonly signature: string;
|
|
69
|
-
readonly networkType:
|
|
69
|
+
readonly networkType: WalletNetworks;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
@@ -86,7 +86,7 @@ export declare function decodeAddress(address: string): DecodedAddress | null;
|
|
|
86
86
|
* Result of an address decode operation
|
|
87
87
|
*/
|
|
88
88
|
export declare interface DecodedAddress {
|
|
89
|
-
readonly networkType:
|
|
89
|
+
readonly networkType: WalletNetworks;
|
|
90
90
|
readonly addressType: AddressTypes;
|
|
91
91
|
readonly scriptPubKey: Buffer;
|
|
92
92
|
}
|
|
@@ -114,7 +114,7 @@ export declare function detectAddressType(address: string, network: Network): Ad
|
|
|
114
114
|
/**
|
|
115
115
|
* Detect network type from an address
|
|
116
116
|
*/
|
|
117
|
-
export declare function detectNetworkFromAddress(address: string):
|
|
117
|
+
export declare function detectNetworkFromAddress(address: string): WalletNetworks | null;
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
120
|
* Exported wallet format for unified key export
|
|
@@ -154,14 +154,14 @@ export declare function fromLegacyExport(legacy: ExportedWallet, network: Networ
|
|
|
154
154
|
export declare function generateBip322Psbt(message: string | Buffer, address: string, network: Network): Psbt;
|
|
155
155
|
|
|
156
156
|
/**
|
|
157
|
-
* Get address type with
|
|
157
|
+
* Get address type with WalletNetworks parameter
|
|
158
158
|
*/
|
|
159
|
-
export declare function getAddressType(address: string, networkType:
|
|
159
|
+
export declare function getAddressType(address: string, networkType: WalletNetworks): AddressTypes | null;
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
162
|
* Get the bech32 prefix for a network type
|
|
163
163
|
*/
|
|
164
|
-
export declare function getBech32Prefix(networkType:
|
|
164
|
+
export declare function getBech32Prefix(networkType: WalletNetworks): string;
|
|
165
165
|
|
|
166
166
|
/**
|
|
167
167
|
* HD Keyring with quantum-resistant cryptography support.
|
|
@@ -368,9 +368,9 @@ export declare function isPublicKeySignInput(input: SignInput): input is PublicK
|
|
|
368
368
|
export declare function isValidAddress(address: string, network: Network): boolean;
|
|
369
369
|
|
|
370
370
|
/**
|
|
371
|
-
* Convert
|
|
371
|
+
* Convert WalletNetworks to Network and validate address
|
|
372
372
|
*/
|
|
373
|
-
export declare function isValidAddressForNetworkType(address: string, networkType:
|
|
373
|
+
export declare function isValidAddressForNetworkType(address: string, networkType: WalletNetworks): boolean;
|
|
374
374
|
|
|
375
375
|
/**
|
|
376
376
|
* Validate a Taproot (P2TR) address
|
|
@@ -534,9 +534,9 @@ export declare interface PublicKeySignInput extends BaseSignInput {
|
|
|
534
534
|
export declare function publicKeyToAddress(publicKey: Buffer | string, addressType: AddressTypes, network: Network): string;
|
|
535
535
|
|
|
536
536
|
/**
|
|
537
|
-
* Convert
|
|
537
|
+
* Convert WalletNetworks-based operations to Network-based
|
|
538
538
|
*/
|
|
539
|
-
export declare function publicKeyToAddressWithNetworkType(publicKey: Buffer | string, addressType: AddressTypes, networkType:
|
|
539
|
+
export declare function publicKeyToAddressWithNetworkType(publicKey: Buffer | string, addressType: AddressTypes, networkType: WalletNetworks): string;
|
|
540
540
|
|
|
541
541
|
/**
|
|
542
542
|
* Generate a payment object from a public key
|
|
@@ -586,9 +586,9 @@ export declare type SignatureType = 'ecdsa' | 'schnorr' | 'mldsa';
|
|
|
586
586
|
export declare function signBip322Message(message: string | Buffer, address: string, network: Network, signPsbt: (psbt: Psbt) => Promise<Psbt>): Promise<string>;
|
|
587
587
|
|
|
588
588
|
/**
|
|
589
|
-
* Sign a message using BIP322 with
|
|
589
|
+
* Sign a message using BIP322 with WalletNetworks parameter
|
|
590
590
|
*/
|
|
591
|
-
export declare function signBip322MessageWithNetworkType(message: string | Buffer, address: string, networkType:
|
|
591
|
+
export declare function signBip322MessageWithNetworkType(message: string | Buffer, address: string, networkType: WalletNetworks, signPsbt: (psbt: Psbt) => Promise<Psbt>): Promise<Bip322Signature>;
|
|
592
592
|
|
|
593
593
|
/**
|
|
594
594
|
* Message signature result
|
|
@@ -802,14 +802,14 @@ export declare interface SimpleKeyringOptions {
|
|
|
802
802
|
}
|
|
803
803
|
|
|
804
804
|
/**
|
|
805
|
-
* Convert
|
|
805
|
+
* Convert WalletNetworks enum to @btc-vision/bitcoin Network object
|
|
806
806
|
*/
|
|
807
|
-
export declare function toNetwork(networkType:
|
|
807
|
+
export declare function toNetwork(networkType: WalletNetworks): Network;
|
|
808
808
|
|
|
809
809
|
/**
|
|
810
|
-
* Convert @btc-vision/bitcoin Network object to
|
|
810
|
+
* Convert @btc-vision/bitcoin Network object to WalletNetworks enum
|
|
811
811
|
*/
|
|
812
|
-
export declare function toNetworkType(network: Network):
|
|
812
|
+
export declare function toNetworkType(network: Network): WalletNetworks;
|
|
813
813
|
|
|
814
814
|
/**
|
|
815
815
|
* Internal representation of inputs to sign
|
|
@@ -844,7 +844,7 @@ export declare interface UnifiedWalletExport {
|
|
|
844
844
|
/**
|
|
845
845
|
* Validate that an address matches the expected network
|
|
846
846
|
*/
|
|
847
|
-
export declare function validateAddressNetwork(address: string, expectedNetwork:
|
|
847
|
+
export declare function validateAddressNetwork(address: string, expectedNetwork: WalletNetworks): boolean;
|
|
848
848
|
|
|
849
849
|
/**
|
|
850
850
|
* Validate export data without importing
|
|
@@ -857,9 +857,9 @@ export declare function validateExport(exportData: UnifiedWalletExport): boolean
|
|
|
857
857
|
export declare function verifyBip322Message(address: string, message: string | Buffer, signature: string, network: Network): boolean;
|
|
858
858
|
|
|
859
859
|
/**
|
|
860
|
-
* Verify a BIP322 signature with
|
|
860
|
+
* Verify a BIP322 signature with WalletNetworks parameter
|
|
861
861
|
*/
|
|
862
|
-
export declare function verifyBip322MessageWithNetworkType(address: string, message: string | Buffer, signature: string, networkType:
|
|
862
|
+
export declare function verifyBip322MessageWithNetworkType(address: string, message: string | Buffer, signature: string, networkType: WalletNetworks): boolean;
|
|
863
863
|
|
|
864
864
|
/**
|
|
865
865
|
* Verify message with automatic type detection
|