@bsv/sdk 1.6.11 → 1.6.14
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/README.md +4 -4
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/transaction/broadcasters/DefaultBroadcaster.js +1 -1
- package/dist/cjs/src/transaction/broadcasters/DefaultBroadcaster.js.map +1 -1
- package/dist/cjs/src/wallet/WalletClient.js +1 -0
- package/dist/cjs/src/wallet/WalletClient.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/transaction/broadcasters/DefaultBroadcaster.js +1 -1
- package/dist/esm/src/transaction/broadcasters/DefaultBroadcaster.js.map +1 -1
- package/dist/esm/src/wallet/WalletClient.js +1 -0
- package/dist/esm/src/wallet/WalletClient.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/wallet/WalletClient.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +1 -1
- package/docs/MARKDOWN_VALIDATION_GUIDE.md +175 -0
- package/docs/concepts/beef.md +8 -0
- package/docs/concepts/chain-tracking.md +12 -0
- package/docs/concepts/decentralized-identity.md +37 -0
- package/docs/concepts/fees.md +32 -0
- package/docs/concepts/identity-certificates.md +53 -1
- package/docs/concepts/index.md +15 -0
- package/docs/concepts/key-management.md +9 -0
- package/docs/concepts/script-templates.md +13 -0
- package/docs/concepts/sdk-philosophy.md +8 -0
- package/docs/concepts/signatures.md +15 -0
- package/docs/concepts/spv-verification.md +12 -0
- package/docs/concepts/transaction-encoding.md +19 -0
- package/docs/concepts/transaction-structure.md +4 -0
- package/docs/concepts/trust-model.md +16 -0
- package/docs/concepts/verification.md +31 -0
- package/docs/concepts/wallet-integration.md +6 -0
- package/docs/guides/development-wallet-setup.md +374 -0
- package/docs/guides/direct-transaction-creation.md +12 -2
- package/docs/guides/http-client-configuration.md +122 -48
- package/docs/guides/index.md +117 -9
- package/docs/guides/large-transactions.md +448 -0
- package/docs/guides/multisig-transactions.md +792 -0
- package/docs/guides/security-best-practices.md +494 -0
- package/docs/guides/transaction-batching.md +132 -0
- package/docs/guides/transaction-signing-methods.md +230 -79
- package/docs/index.md +0 -2
- package/docs/reference/auth.md +212 -159
- package/docs/reference/compat.md +120 -96
- package/docs/reference/configuration.md +6 -0
- package/docs/reference/debugging.md +5 -0
- package/docs/reference/errors.md +50 -0
- package/docs/reference/identity.md +21 -12
- package/docs/reference/index.md +14 -1
- package/docs/reference/kvstore.md +21 -19
- package/docs/reference/messages.md +3 -0
- package/docs/reference/op-codes.md +20 -1
- package/docs/reference/overlay-tools.md +46 -18
- package/docs/reference/primitives.md +571 -390
- package/docs/reference/registry.md +43 -20
- package/docs/reference/script.md +140 -105
- package/docs/reference/storage.md +32 -12
- package/docs/reference/totp.md +16 -11
- package/docs/reference/transaction-signatures.md +2 -1
- package/docs/reference/transaction.md +201 -120
- package/docs/reference/wallet.md +241 -64
- package/docs/tutorials/advanced-transaction.md +1 -4
- package/docs/tutorials/aes-encryption.md +3 -1
- package/docs/tutorials/authfetch-tutorial.md +29 -0
- package/docs/tutorials/ecdh-key-exchange.md +2 -0
- package/docs/tutorials/elliptic-curve-fundamentals.md +3 -0
- package/docs/tutorials/error-handling.md +1 -0
- package/docs/tutorials/first-transaction-low-level.md +1 -0
- package/docs/tutorials/first-transaction.md +5 -8
- package/docs/tutorials/hashes-and-hmacs.md +5 -31
- package/docs/tutorials/identity-management.md +27 -0
- package/docs/tutorials/index.md +114 -77
- package/docs/tutorials/key-management.md +5 -3
- package/docs/tutorials/protowallet-development.md +27 -0
- package/docs/tutorials/spv-merkle-proofs.md +9 -6
- package/docs/tutorials/testnet-transactions-low-level.md +25 -18
- package/docs/tutorials/transaction-broadcasting.md +10 -7
- package/docs/tutorials/transaction-types.md +5 -4
- package/docs/tutorials/type-42.md +0 -14
- package/docs/tutorials/uhrp-storage.md +23 -3
- package/package.json +1 -1
- package/src/identity/README.md +0 -1
- package/src/primitives/__tests/SymmetricKey.test.ts +45 -0
- package/src/primitives/__tests/SymmetricKeyCompatibility.test.ts +150 -0
- package/src/transaction/__tests/Transaction.test.ts +1 -1
- package/src/transaction/broadcasters/DefaultBroadcaster.ts +1 -1
- package/src/transaction/broadcasters/__tests/ARC.test.ts +1 -1
- package/src/wallet/WalletClient.ts +1 -0
package/docs/reference/compat.md
CHANGED
|
@@ -41,6 +41,7 @@ Decrypts a message encrypted using the Bitcore variant of ECIES.
|
|
|
41
41
|
```ts
|
|
42
42
|
public static bitcoreDecrypt(encBuf: number[], toPrivateKey: PrivateKey): number[]
|
|
43
43
|
```
|
|
44
|
+
|
|
44
45
|
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
45
46
|
|
|
46
47
|
Returns
|
|
@@ -49,10 +50,10 @@ The decrypted message as a number array.
|
|
|
49
50
|
|
|
50
51
|
Argument Details
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
- **encBuf**
|
|
54
|
+
- The encrypted message buffer.
|
|
55
|
+
- **toPrivateKey**
|
|
56
|
+
- The private key of the recipient.
|
|
56
57
|
|
|
57
58
|
#### Method bitcoreEncrypt
|
|
58
59
|
|
|
@@ -61,6 +62,7 @@ Encrypts a given message using the Bitcore variant of ECIES.
|
|
|
61
62
|
```ts
|
|
62
63
|
public static bitcoreEncrypt(messageBuf: number[], toPublicKey: PublicKey, fromPrivateKey?: PrivateKey, ivBuf?: number[]): number[]
|
|
63
64
|
```
|
|
65
|
+
|
|
64
66
|
See also: [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
65
67
|
|
|
66
68
|
Returns
|
|
@@ -69,14 +71,14 @@ The encrypted message as a number array.
|
|
|
69
71
|
|
|
70
72
|
Argument Details
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
- **messageBuf**
|
|
75
|
+
- The message to be encrypted, in number array format.
|
|
76
|
+
- **toPublicKey**
|
|
77
|
+
- The public key of the recipient.
|
|
78
|
+
- **fromPrivateKey**
|
|
79
|
+
- The private key of the sender. If not provided, a random private key is used.
|
|
80
|
+
- **ivBuf**
|
|
81
|
+
- The initialization vector for encryption. If not provided, a random IV is used.
|
|
80
82
|
|
|
81
83
|
#### Method electrumDecrypt
|
|
82
84
|
|
|
@@ -85,6 +87,7 @@ Decrypts a message encrypted using the Electrum ECIES method.
|
|
|
85
87
|
```ts
|
|
86
88
|
public static electrumDecrypt(encBuf: number[], toPrivateKey: PrivateKey, fromPublicKey?: PublicKey): number[]
|
|
87
89
|
```
|
|
90
|
+
|
|
88
91
|
See also: [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
89
92
|
|
|
90
93
|
Returns
|
|
@@ -93,12 +96,12 @@ The decrypted message as a number array.
|
|
|
93
96
|
|
|
94
97
|
Argument Details
|
|
95
98
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
- **encBuf**
|
|
100
|
+
- The encrypted message buffer.
|
|
101
|
+
- **toPrivateKey**
|
|
102
|
+
- The private key of the recipient.
|
|
103
|
+
- **fromPublicKey**
|
|
104
|
+
- The public key of the sender. If not provided, it is extracted from the message.
|
|
102
105
|
|
|
103
106
|
#### Method electrumEncrypt
|
|
104
107
|
|
|
@@ -107,6 +110,7 @@ Encrypts a given message using the Electrum ECIES method.
|
|
|
107
110
|
```ts
|
|
108
111
|
public static electrumEncrypt(messageBuf: number[], toPublicKey: PublicKey, fromPrivateKey?: PrivateKey, noKey = false): number[]
|
|
109
112
|
```
|
|
113
|
+
|
|
110
114
|
See also: [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
111
115
|
|
|
112
116
|
Returns
|
|
@@ -115,14 +119,14 @@ The encrypted message as a number array.
|
|
|
115
119
|
|
|
116
120
|
Argument Details
|
|
117
121
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
- **messageBuf**
|
|
123
|
+
- The message to be encrypted, in number array format.
|
|
124
|
+
- **toPublicKey**
|
|
125
|
+
- The public key of the recipient.
|
|
126
|
+
- **fromPrivateKey**
|
|
127
|
+
- The private key of the sender. If not provided, a random private key is used.
|
|
128
|
+
- **noKey**
|
|
129
|
+
- If true, does not include the sender's public key in the encrypted message.
|
|
126
130
|
|
|
127
131
|
#### Method ivkEkM
|
|
128
132
|
|
|
@@ -136,6 +140,7 @@ public static ivkEkM(privKey: PrivateKey, pubKey: PublicKey): {
|
|
|
136
140
|
kM: number[];
|
|
137
141
|
}
|
|
138
142
|
```
|
|
143
|
+
|
|
139
144
|
See also: [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
140
145
|
|
|
141
146
|
Returns
|
|
@@ -144,14 +149,15 @@ An object containing the iv, kE, and kM as number arrays.
|
|
|
144
149
|
|
|
145
150
|
Argument Details
|
|
146
151
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
152
|
+
- **privKey**
|
|
153
|
+
- The sender's private key.
|
|
154
|
+
- **pubKey**
|
|
155
|
+
- The receiver's public key.
|
|
151
156
|
|
|
152
157
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
153
158
|
|
|
154
159
|
---
|
|
160
|
+
|
|
155
161
|
### Class: HD
|
|
156
162
|
|
|
157
163
|
```ts
|
|
@@ -195,24 +201,25 @@ Initializes an HD wallet with optional parameters for version bytes, depth, pare
|
|
|
195
201
|
```ts
|
|
196
202
|
constructor(versionBytesNum?: number, depth?: number, parentFingerPrint?: number[], childIndex?: number, chainCode?: number[], privKey?: PrivateKey, pubKey?: PublicKey)
|
|
197
203
|
```
|
|
204
|
+
|
|
198
205
|
See also: [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
199
206
|
|
|
200
207
|
Argument Details
|
|
201
208
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
209
|
+
- **versionBytesNum**
|
|
210
|
+
- Version bytes number for the wallet.
|
|
211
|
+
- **depth**
|
|
212
|
+
- Depth of the key in the hierarchy.
|
|
213
|
+
- **parentFingerPrint**
|
|
214
|
+
- Fingerprint of the parent key.
|
|
215
|
+
- **childIndex**
|
|
216
|
+
- Index of the child key.
|
|
217
|
+
- **chainCode**
|
|
218
|
+
- Chain code for key derivation.
|
|
219
|
+
- **privKey**
|
|
220
|
+
- Private key of the wallet.
|
|
221
|
+
- **pubKey**
|
|
222
|
+
- Public key of the wallet.
|
|
216
223
|
|
|
217
224
|
#### Method derive
|
|
218
225
|
|
|
@@ -222,6 +229,7 @@ The path specifies the hierarchy of the child key to be derived.
|
|
|
222
229
|
```ts
|
|
223
230
|
public derive(path: string): HD
|
|
224
231
|
```
|
|
232
|
+
|
|
225
233
|
See also: [HD](./compat.md#class-hd)
|
|
226
234
|
|
|
227
235
|
Returns
|
|
@@ -230,8 +238,8 @@ A new HD instance representing the derived child wallet.
|
|
|
230
238
|
|
|
231
239
|
Argument Details
|
|
232
240
|
|
|
233
|
-
|
|
234
|
-
|
|
241
|
+
- **path**
|
|
242
|
+
- A string representing the derivation path (e.g., 'm/0'/1).
|
|
235
243
|
|
|
236
244
|
#### Method deriveChild
|
|
237
245
|
|
|
@@ -241,6 +249,7 @@ This method generates either a private or public child key depending on the curr
|
|
|
241
249
|
```ts
|
|
242
250
|
public deriveChild(i: number): HD
|
|
243
251
|
```
|
|
252
|
+
|
|
244
253
|
See also: [HD](./compat.md#class-hd)
|
|
245
254
|
|
|
246
255
|
Returns
|
|
@@ -249,8 +258,8 @@ A new HD instance representing the derived child wallet.
|
|
|
249
258
|
|
|
250
259
|
Argument Details
|
|
251
260
|
|
|
252
|
-
|
|
253
|
-
|
|
261
|
+
- **i**
|
|
262
|
+
- The index of the child key to derive.
|
|
254
263
|
|
|
255
264
|
#### Method fromBinary
|
|
256
265
|
|
|
@@ -260,6 +269,7 @@ Parses a binary buffer to set up the wallet's properties.
|
|
|
260
269
|
```ts
|
|
261
270
|
public static fromBinary(buf: number[]): HD
|
|
262
271
|
```
|
|
272
|
+
|
|
263
273
|
See also: [HD](./compat.md#class-hd)
|
|
264
274
|
|
|
265
275
|
Returns
|
|
@@ -268,8 +278,8 @@ The new instance with properties set from the buffer.
|
|
|
268
278
|
|
|
269
279
|
Argument Details
|
|
270
280
|
|
|
271
|
-
|
|
272
|
-
|
|
281
|
+
- **buf**
|
|
282
|
+
- A buffer containing the wallet data.
|
|
273
283
|
|
|
274
284
|
#### Method fromBinary
|
|
275
285
|
|
|
@@ -286,8 +296,8 @@ The current instance with properties set from the buffer.
|
|
|
286
296
|
|
|
287
297
|
Argument Details
|
|
288
298
|
|
|
289
|
-
|
|
290
|
-
|
|
299
|
+
- **buf**
|
|
300
|
+
- A buffer containing the wallet data.
|
|
291
301
|
|
|
292
302
|
#### Method fromRandom
|
|
293
303
|
|
|
@@ -310,6 +320,7 @@ This method creates a root HD wallet with randomly generated private and public
|
|
|
310
320
|
```ts
|
|
311
321
|
public static fromRandom(): HD
|
|
312
322
|
```
|
|
323
|
+
|
|
313
324
|
See also: [HD](./compat.md#class-hd)
|
|
314
325
|
|
|
315
326
|
Returns
|
|
@@ -324,6 +335,7 @@ This method generates keys and other properties from a given seed, conforming to
|
|
|
324
335
|
```ts
|
|
325
336
|
public static fromSeed(bytes: number[]): HD
|
|
326
337
|
```
|
|
338
|
+
|
|
327
339
|
See also: [HD](./compat.md#class-hd)
|
|
328
340
|
|
|
329
341
|
Returns
|
|
@@ -332,8 +344,8 @@ The current instance with properties set from the seed.
|
|
|
332
344
|
|
|
333
345
|
Argument Details
|
|
334
346
|
|
|
335
|
-
|
|
336
|
-
|
|
347
|
+
- **bytes**
|
|
348
|
+
- An array of bytes representing the seed.
|
|
337
349
|
|
|
338
350
|
#### Method fromSeed
|
|
339
351
|
|
|
@@ -350,8 +362,8 @@ The current instance with properties set from the seed.
|
|
|
350
362
|
|
|
351
363
|
Argument Details
|
|
352
364
|
|
|
353
|
-
|
|
354
|
-
|
|
365
|
+
- **bytes**
|
|
366
|
+
- An array of bytes representing the seed.
|
|
355
367
|
|
|
356
368
|
#### Method fromString
|
|
357
369
|
|
|
@@ -361,6 +373,7 @@ This method decodes a provided string to set up the HD wallet's properties.
|
|
|
361
373
|
```ts
|
|
362
374
|
public static fromString(str: string): HD
|
|
363
375
|
```
|
|
376
|
+
|
|
364
377
|
See also: [HD](./compat.md#class-hd)
|
|
365
378
|
|
|
366
379
|
Returns
|
|
@@ -369,8 +382,8 @@ The new instance with properties set from the string.
|
|
|
369
382
|
|
|
370
383
|
Argument Details
|
|
371
384
|
|
|
372
|
-
|
|
373
|
-
|
|
385
|
+
- **str**
|
|
386
|
+
- A base58 encoded string representing the wallet.
|
|
374
387
|
|
|
375
388
|
#### Method fromString
|
|
376
389
|
|
|
@@ -387,8 +400,8 @@ The current instance with properties set from the string.
|
|
|
387
400
|
|
|
388
401
|
Argument Details
|
|
389
402
|
|
|
390
|
-
|
|
391
|
-
|
|
403
|
+
- **str**
|
|
404
|
+
- A base58 encoded string representing the wallet.
|
|
392
405
|
|
|
393
406
|
#### Method isPrivate
|
|
394
407
|
|
|
@@ -424,6 +437,7 @@ This method strips away the private key information, leaving only the public par
|
|
|
424
437
|
```ts
|
|
425
438
|
public toPublic(): HD
|
|
426
439
|
```
|
|
440
|
+
|
|
427
441
|
See also: [HD](./compat.md#class-hd)
|
|
428
442
|
|
|
429
443
|
Returns
|
|
@@ -448,6 +462,7 @@ A base58 encoded string of the HD wallet.
|
|
|
448
462
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
449
463
|
|
|
450
464
|
---
|
|
465
|
+
|
|
451
466
|
### Class: Mnemonic
|
|
452
467
|
|
|
453
468
|
```ts
|
|
@@ -486,16 +501,17 @@ Constructs a Mnemonic object.
|
|
|
486
501
|
```ts
|
|
487
502
|
constructor(mnemonic?: string, seed?: number[], wordlist = wordList)
|
|
488
503
|
```
|
|
504
|
+
|
|
489
505
|
See also: [wordList](./compat.md#variable-wordlist)
|
|
490
506
|
|
|
491
507
|
Argument Details
|
|
492
508
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
509
|
+
- **mnemonic**
|
|
510
|
+
- An optional mnemonic phrase.
|
|
511
|
+
- **seed**
|
|
512
|
+
- An optional seed derived from the mnemonic.
|
|
513
|
+
- **wordlist**
|
|
514
|
+
- An object containing a list of words and space character used in the mnemonic.
|
|
499
515
|
|
|
500
516
|
#### Method check
|
|
501
517
|
|
|
@@ -531,8 +547,8 @@ The Mnemonic instance with the mnemonic set from the entropy.
|
|
|
531
547
|
|
|
532
548
|
Argument Details
|
|
533
549
|
|
|
534
|
-
|
|
535
|
-
|
|
550
|
+
- **buf**
|
|
551
|
+
- The entropy buffer to convert. Must be at least 128 bits.
|
|
536
552
|
|
|
537
553
|
Throws
|
|
538
554
|
|
|
@@ -552,8 +568,8 @@ The Mnemonic instance with loaded mnemonic and seed.
|
|
|
552
568
|
|
|
553
569
|
Argument Details
|
|
554
570
|
|
|
555
|
-
|
|
556
|
-
|
|
571
|
+
- **bin**
|
|
572
|
+
- The binary representation of a mnemonic and seed.
|
|
557
573
|
|
|
558
574
|
#### Method fromEntropy
|
|
559
575
|
|
|
@@ -570,8 +586,8 @@ The Mnemonic instance with the mnemonic set from the given entropy.
|
|
|
570
586
|
|
|
571
587
|
Argument Details
|
|
572
588
|
|
|
573
|
-
|
|
574
|
-
|
|
589
|
+
- **buf**
|
|
590
|
+
- The entropy buffer, must be at least 128 bits.
|
|
575
591
|
|
|
576
592
|
Throws
|
|
577
593
|
|
|
@@ -584,6 +600,7 @@ Static method to create a Mnemonic instance from a given entropy.
|
|
|
584
600
|
```ts
|
|
585
601
|
public static fromEntropy(buf: number[]): Mnemonic
|
|
586
602
|
```
|
|
603
|
+
|
|
587
604
|
See also: [Mnemonic](./compat.md#class-mnemonic)
|
|
588
605
|
|
|
589
606
|
Returns
|
|
@@ -592,8 +609,8 @@ A new Mnemonic instance.
|
|
|
592
609
|
|
|
593
610
|
Argument Details
|
|
594
611
|
|
|
595
|
-
|
|
596
|
-
|
|
612
|
+
- **buf**
|
|
613
|
+
- The entropy buffer.
|
|
597
614
|
|
|
598
615
|
#### Method fromRandom
|
|
599
616
|
|
|
@@ -609,8 +626,8 @@ The Mnemonic instance with the new random mnemonic.
|
|
|
609
626
|
|
|
610
627
|
Argument Details
|
|
611
628
|
|
|
612
|
-
|
|
613
|
-
|
|
629
|
+
- **bits**
|
|
630
|
+
- The bit length for the random mnemonic (must be a multiple of 32 and at least 128).
|
|
614
631
|
|
|
615
632
|
Throws
|
|
616
633
|
|
|
@@ -623,6 +640,7 @@ Static method to generate a Mnemonic instance with a random mnemonic.
|
|
|
623
640
|
```ts
|
|
624
641
|
public static fromRandom(bits?: number): Mnemonic
|
|
625
642
|
```
|
|
643
|
+
|
|
626
644
|
See also: [Mnemonic](./compat.md#class-mnemonic)
|
|
627
645
|
|
|
628
646
|
Returns
|
|
@@ -631,8 +649,8 @@ A new Mnemonic instance.
|
|
|
631
649
|
|
|
632
650
|
Argument Details
|
|
633
651
|
|
|
634
|
-
|
|
635
|
-
|
|
652
|
+
- **bits**
|
|
653
|
+
- The bit length for the random mnemonic.
|
|
636
654
|
|
|
637
655
|
#### Method fromString
|
|
638
656
|
|
|
@@ -648,8 +666,8 @@ The Mnemonic instance with the set mnemonic.
|
|
|
648
666
|
|
|
649
667
|
Argument Details
|
|
650
668
|
|
|
651
|
-
|
|
652
|
-
|
|
669
|
+
- **mnemonic**
|
|
670
|
+
- The mnemonic phrase as a string.
|
|
653
671
|
|
|
654
672
|
#### Method fromString
|
|
655
673
|
|
|
@@ -658,6 +676,7 @@ Static method to create a Mnemonic instance from a mnemonic string.
|
|
|
658
676
|
```ts
|
|
659
677
|
public static fromString(str: string): Mnemonic
|
|
660
678
|
```
|
|
679
|
+
|
|
661
680
|
See also: [Mnemonic](./compat.md#class-mnemonic)
|
|
662
681
|
|
|
663
682
|
Returns
|
|
@@ -666,8 +685,8 @@ A new Mnemonic instance.
|
|
|
666
685
|
|
|
667
686
|
Argument Details
|
|
668
687
|
|
|
669
|
-
|
|
670
|
-
|
|
688
|
+
- **str**
|
|
689
|
+
- The mnemonic phrase.
|
|
671
690
|
|
|
672
691
|
#### Method isValid
|
|
673
692
|
|
|
@@ -684,8 +703,8 @@ True if the mnemonic and passphrase combination is valid, false otherwise.
|
|
|
684
703
|
|
|
685
704
|
Argument Details
|
|
686
705
|
|
|
687
|
-
|
|
688
|
-
|
|
706
|
+
- **passphrase**
|
|
707
|
+
- The passphrase to validate.
|
|
689
708
|
|
|
690
709
|
#### Method isValid
|
|
691
710
|
|
|
@@ -701,10 +720,10 @@ True if the combination is valid, false otherwise.
|
|
|
701
720
|
|
|
702
721
|
Argument Details
|
|
703
722
|
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
723
|
+
- **mnemonic**
|
|
724
|
+
- The mnemonic phrase.
|
|
725
|
+
- **passphrase**
|
|
726
|
+
- The passphrase to validate.
|
|
708
727
|
|
|
709
728
|
#### Method mnemonic2Seed
|
|
710
729
|
|
|
@@ -723,8 +742,8 @@ The Mnemonic instance with the seed generated from the mnemonic.
|
|
|
723
742
|
|
|
724
743
|
Argument Details
|
|
725
744
|
|
|
726
|
-
|
|
727
|
-
|
|
745
|
+
- **passphrase**
|
|
746
|
+
- An optional passphrase for added security.
|
|
728
747
|
|
|
729
748
|
Throws
|
|
730
749
|
|
|
@@ -757,8 +776,8 @@ The generated seed.
|
|
|
757
776
|
|
|
758
777
|
Argument Details
|
|
759
778
|
|
|
760
|
-
|
|
761
|
-
|
|
779
|
+
- **passphrase**
|
|
780
|
+
- An optional passphrase for additional security.
|
|
762
781
|
|
|
763
782
|
Throws
|
|
764
783
|
|
|
@@ -781,6 +800,7 @@ The mnemonic phrase as a string.
|
|
|
781
800
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
782
801
|
|
|
783
802
|
---
|
|
803
|
+
|
|
784
804
|
## Functions
|
|
785
805
|
|
|
786
806
|
### Function: fromUtxo
|
|
@@ -809,14 +829,15 @@ See also: [Transaction](./transaction.md#class-transaction), [TransactionInput](
|
|
|
809
829
|
|
|
810
830
|
Argument Details
|
|
811
831
|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
832
|
+
- **utxo**
|
|
833
|
+
- : jsonUtxo
|
|
834
|
+
- **unlockingScriptTemplate**
|
|
835
|
+
- : { sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>, estimateLength: (tx: Transaction, inputIndex: number) => Promise<number> }
|
|
816
836
|
|
|
817
837
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
818
838
|
|
|
819
839
|
---
|
|
840
|
+
|
|
820
841
|
## Types
|
|
821
842
|
|
|
822
843
|
## Enums
|
|
@@ -854,6 +875,7 @@ See also: [Writer](./primitives.md#class-writer), [hash256](./primitives.md#vari
|
|
|
854
875
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
855
876
|
|
|
856
877
|
---
|
|
878
|
+
|
|
857
879
|
### Variable: sign
|
|
858
880
|
|
|
859
881
|
```ts
|
|
@@ -874,6 +896,7 @@ See also: [BigNumber](./primitives.md#class-bignumber), [PrivateKey](./primitive
|
|
|
874
896
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
875
897
|
|
|
876
898
|
---
|
|
899
|
+
|
|
877
900
|
### Variable: verify
|
|
878
901
|
|
|
879
902
|
```ts
|
|
@@ -888,6 +911,7 @@ See also: [BigNumber](./primitives.md#class-bignumber), [PublicKey](./primitives
|
|
|
888
911
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
889
912
|
|
|
890
913
|
---
|
|
914
|
+
|
|
891
915
|
### Variable: wordList
|
|
892
916
|
|
|
893
917
|
```ts
|
|
@@ -50,6 +50,7 @@ interface NetworkConfig {
|
|
|
50
50
|
### Predefined Networks
|
|
51
51
|
|
|
52
52
|
#### Mainnet Configuration
|
|
53
|
+
|
|
53
54
|
```typescript
|
|
54
55
|
const MAINNET_CONFIG: NetworkConfig = {
|
|
55
56
|
name: 'mainnet',
|
|
@@ -76,6 +77,7 @@ const MAINNET_CONFIG: NetworkConfig = {
|
|
|
76
77
|
```
|
|
77
78
|
|
|
78
79
|
#### Testnet Configuration
|
|
80
|
+
|
|
79
81
|
```typescript
|
|
80
82
|
const TESTNET_CONFIG: NetworkConfig = {
|
|
81
83
|
name: 'testnet',
|
|
@@ -101,6 +103,7 @@ const TESTNET_CONFIG: NetworkConfig = {
|
|
|
101
103
|
```
|
|
102
104
|
|
|
103
105
|
#### Regtest Configuration
|
|
106
|
+
|
|
104
107
|
```typescript
|
|
105
108
|
const REGTEST_CONFIG: NetworkConfig = {
|
|
106
109
|
name: 'regtest',
|
|
@@ -808,18 +811,21 @@ function validateConfig(config: SDKConfig): string[] {
|
|
|
808
811
|
### Environment-Specific Settings
|
|
809
812
|
|
|
810
813
|
#### Development
|
|
814
|
+
|
|
811
815
|
- Use testnet or regtest networks
|
|
812
816
|
- Enable debug logging
|
|
813
817
|
- Shorter timeouts for faster feedback
|
|
814
818
|
- Disable strict validation for testing
|
|
815
819
|
|
|
816
820
|
#### Staging
|
|
821
|
+
|
|
817
822
|
- Mirror production configuration
|
|
818
823
|
- Enable comprehensive logging
|
|
819
824
|
- Use production-like endpoints
|
|
820
825
|
- Enable all validation checks
|
|
821
826
|
|
|
822
827
|
#### Production
|
|
828
|
+
|
|
823
829
|
- Use mainnet network
|
|
824
830
|
- Minimal logging (warn/error only)
|
|
825
831
|
- Longer timeouts for reliability
|
|
@@ -667,23 +667,27 @@ const testDebugConfig = {
|
|
|
667
667
|
### Debug Checklist
|
|
668
668
|
|
|
669
669
|
1. **Enable appropriate logging level**
|
|
670
|
+
|
|
670
671
|
```typescript
|
|
671
672
|
// Set debug level based on issue severity
|
|
672
673
|
const config = { logging: { level: 'debug' } }
|
|
673
674
|
```
|
|
674
675
|
|
|
675
676
|
2. **Check network connectivity**
|
|
677
|
+
|
|
676
678
|
```typescript
|
|
677
679
|
NetworkInspector.startRequest('health-check', 'https://api.whatsonchain.com/v1/bsv/main/chain/info', 'GET')
|
|
678
680
|
```
|
|
679
681
|
|
|
680
682
|
3. **Validate transaction structure**
|
|
683
|
+
|
|
681
684
|
```typescript
|
|
682
685
|
const analysis = TransactionAnalyzer.analyze(transaction)
|
|
683
686
|
console.log('Transaction Analysis:', analysis)
|
|
684
687
|
```
|
|
685
688
|
|
|
686
689
|
4. **Monitor performance**
|
|
690
|
+
|
|
687
691
|
```typescript
|
|
688
692
|
PerformanceMonitor.startTimer('wallet-operation')
|
|
689
693
|
// ... perform operation
|
|
@@ -691,6 +695,7 @@ const testDebugConfig = {
|
|
|
691
695
|
```
|
|
692
696
|
|
|
693
697
|
5. **Check memory usage**
|
|
698
|
+
|
|
694
699
|
```typescript
|
|
695
700
|
MemoryMonitor.logMemoryUsage('before-operation')
|
|
696
701
|
// ... perform operation
|