@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/script.md
CHANGED
|
@@ -28,6 +28,7 @@ export default interface ScriptChunk {
|
|
|
28
28
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
29
29
|
|
|
30
30
|
---
|
|
31
|
+
|
|
31
32
|
### Interface: ScriptTemplate
|
|
32
33
|
|
|
33
34
|
```ts
|
|
@@ -46,6 +47,7 @@ Creates a locking script with the given parameters.
|
|
|
46
47
|
```ts
|
|
47
48
|
lock: (...params: any[]) => LockingScript | Promise<LockingScript>
|
|
48
49
|
```
|
|
50
|
+
|
|
49
51
|
See also: [LockingScript](./script.md#class-lockingscript)
|
|
50
52
|
|
|
51
53
|
#### Property unlock
|
|
@@ -53,17 +55,20 @@ See also: [LockingScript](./script.md#class-lockingscript)
|
|
|
53
55
|
Creates a function that generates an unlocking script along with its signature and length estimation.
|
|
54
56
|
|
|
55
57
|
This method returns an object containing two functions:
|
|
58
|
+
|
|
56
59
|
1. `sign` - A function that, when called with a transaction and an input index, returns an UnlockingScript instance.
|
|
57
60
|
2. `estimateLength` - A function that returns the estimated length of the unlocking script in bytes.
|
|
58
61
|
|
|
59
62
|
```ts
|
|
60
63
|
unlock: (...params: any[]) => ScriptTemplateUnlock
|
|
61
64
|
```
|
|
65
|
+
|
|
62
66
|
See also: [ScriptTemplateUnlock](./script.md#interface-scripttemplateunlock)
|
|
63
67
|
|
|
64
68
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
65
69
|
|
|
66
70
|
---
|
|
71
|
+
|
|
67
72
|
### Interface: ScriptTemplateUnlock
|
|
68
73
|
|
|
69
74
|
```ts
|
|
@@ -78,6 +83,7 @@ See also: [Transaction](./transaction.md#class-transaction), [UnlockingScript](.
|
|
|
78
83
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
79
84
|
|
|
80
85
|
---
|
|
86
|
+
|
|
81
87
|
## Classes
|
|
82
88
|
|
|
83
89
|
| |
|
|
@@ -133,6 +139,7 @@ Always returns false for a LockingScript instance.
|
|
|
133
139
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
134
140
|
|
|
135
141
|
---
|
|
142
|
+
|
|
136
143
|
### Class: P2PKH
|
|
137
144
|
|
|
138
145
|
P2PKH (Pay To Public Key Hash) class implementing ScriptTemplate.
|
|
@@ -158,6 +165,7 @@ Creates a P2PKH locking script for a given public key hash or address string
|
|
|
158
165
|
```ts
|
|
159
166
|
lock(pubkeyhash: string | number[]): LockingScript
|
|
160
167
|
```
|
|
168
|
+
|
|
161
169
|
See also: [LockingScript](./script.md#class-lockingscript)
|
|
162
170
|
|
|
163
171
|
Returns
|
|
@@ -166,14 +174,15 @@ Returns
|
|
|
166
174
|
|
|
167
175
|
Argument Details
|
|
168
176
|
|
|
169
|
-
|
|
170
|
-
|
|
177
|
+
- **pubkeyhash**
|
|
178
|
+
- or address - An array or address representing the public key hash.
|
|
171
179
|
|
|
172
180
|
#### Method unlock
|
|
173
181
|
|
|
174
182
|
Creates a function that generates a P2PKH unlocking script along with its signature and length estimation.
|
|
175
183
|
|
|
176
184
|
The returned object contains:
|
|
185
|
+
|
|
177
186
|
1. `sign` - A function that, when invoked with a transaction and an input index,
|
|
178
187
|
produces an unlocking script suitable for a P2PKH locked output.
|
|
179
188
|
2. `estimateLength` - A function that returns the estimated length of the unlocking script in bytes.
|
|
@@ -184,6 +193,7 @@ unlock(privateKey: PrivateKey, signOutputs: "all" | "none" | "single" = "all", a
|
|
|
184
193
|
estimateLength: () => Promise<108>;
|
|
185
194
|
}
|
|
186
195
|
```
|
|
196
|
+
|
|
187
197
|
See also: [PrivateKey](./primitives.md#class-privatekey), [Script](./script.md#class-script), [Transaction](./transaction.md#class-transaction), [UnlockingScript](./script.md#class-unlockingscript), [sign](./compat.md#variable-sign)
|
|
188
198
|
|
|
189
199
|
Returns
|
|
@@ -192,20 +202,21 @@ Returns
|
|
|
192
202
|
|
|
193
203
|
Argument Details
|
|
194
204
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
+
- **privateKey**
|
|
206
|
+
- The private key used for signing the transaction.
|
|
207
|
+
- **signOutputs**
|
|
208
|
+
- The signature scope for outputs.
|
|
209
|
+
- **anyoneCanPay**
|
|
210
|
+
- Flag indicating if the signature allows for other inputs to be added later.
|
|
211
|
+
- **sourceSatoshis**
|
|
212
|
+
- Optional. The amount being unlocked. Otherwise the input.sourceTransaction is required.
|
|
213
|
+
- **lockingScript**
|
|
214
|
+
- Optional. The lockinScript. Otherwise the input.sourceTransaction is required.
|
|
205
215
|
|
|
206
216
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
207
217
|
|
|
208
218
|
---
|
|
219
|
+
|
|
209
220
|
### Class: PushDrop
|
|
210
221
|
|
|
211
222
|
```ts
|
|
@@ -240,14 +251,15 @@ Constructs a new instance of the PushDrop class.
|
|
|
240
251
|
```ts
|
|
241
252
|
constructor(wallet: WalletInterface, originator?: string)
|
|
242
253
|
```
|
|
254
|
+
|
|
243
255
|
See also: [WalletInterface](./wallet.md#interface-walletinterface)
|
|
244
256
|
|
|
245
257
|
Argument Details
|
|
246
258
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
259
|
+
- **wallet**
|
|
260
|
+
- The wallet interface used for creating signatures and accessing public keys.
|
|
261
|
+
- **originator**
|
|
262
|
+
- — The originator to use with Wallet requests
|
|
251
263
|
|
|
252
264
|
#### Method decode
|
|
253
265
|
|
|
@@ -260,6 +272,7 @@ static decode(script: LockingScript): {
|
|
|
260
272
|
fields: number[][];
|
|
261
273
|
}
|
|
262
274
|
```
|
|
275
|
+
|
|
263
276
|
See also: [LockingScript](./script.md#class-lockingscript), [PublicKey](./primitives.md#class-publickey)
|
|
264
277
|
|
|
265
278
|
Returns
|
|
@@ -268,8 +281,8 @@ An object containing PushDrop token fields and the locking public key. If a sign
|
|
|
268
281
|
|
|
269
282
|
Argument Details
|
|
270
283
|
|
|
271
|
-
|
|
272
|
-
|
|
284
|
+
- **script**
|
|
285
|
+
- PushDrop script to decode back into token fields
|
|
273
286
|
|
|
274
287
|
#### Method lock
|
|
275
288
|
|
|
@@ -281,6 +294,7 @@ async lock(fields: number[][], protocolID: [
|
|
|
281
294
|
string
|
|
282
295
|
], keyID: string, counterparty: string, forSelf = false, includeSignature = true, lockPosition: "before" | "after" = "before"): Promise<LockingScript>
|
|
283
296
|
```
|
|
297
|
+
|
|
284
298
|
See also: [LockingScript](./script.md#class-lockingscript), [SecurityLevel](./wallet.md#type-securitylevel)
|
|
285
299
|
|
|
286
300
|
Returns
|
|
@@ -289,18 +303,18 @@ The generated PushDrop locking script.
|
|
|
289
303
|
|
|
290
304
|
Argument Details
|
|
291
305
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
306
|
+
- **fields**
|
|
307
|
+
- The token fields to include in the locking script.
|
|
308
|
+
- **protocolID**
|
|
309
|
+
- The protocol ID to use.
|
|
310
|
+
- **keyID**
|
|
311
|
+
- The key ID to use.
|
|
312
|
+
- **counterparty**
|
|
313
|
+
- The counterparty involved in the transaction, "self" or "anyone".
|
|
314
|
+
- **forSelf**
|
|
315
|
+
- Flag indicating if the lock is for the creator (default no).
|
|
316
|
+
- **includeSignature**
|
|
317
|
+
- Flag indicating if a signature should be included in the script (default yes).
|
|
304
318
|
|
|
305
319
|
#### Method unlock
|
|
306
320
|
|
|
@@ -315,6 +329,7 @@ unlock(protocolID: [
|
|
|
315
329
|
estimateLength: () => Promise<73>;
|
|
316
330
|
}
|
|
317
331
|
```
|
|
332
|
+
|
|
318
333
|
See also: [LockingScript](./script.md#class-lockingscript), [SecurityLevel](./wallet.md#type-securitylevel), [Transaction](./transaction.md#class-transaction), [UnlockingScript](./script.md#class-unlockingscript), [sign](./compat.md#variable-sign)
|
|
319
334
|
|
|
320
335
|
Returns
|
|
@@ -323,26 +338,27 @@ An object containing functions to sign the transaction and estimate the script l
|
|
|
323
338
|
|
|
324
339
|
Argument Details
|
|
325
340
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
341
|
+
- **protocolID**
|
|
342
|
+
- The protocol ID to use.
|
|
343
|
+
- **keyID**
|
|
344
|
+
- The key ID to use.
|
|
345
|
+
- **counterparty**
|
|
346
|
+
- The counterparty involved in the transaction, "self" or "anyone".
|
|
347
|
+
- **sourceTXID**
|
|
348
|
+
- The TXID of the source transaction.
|
|
349
|
+
- **sourceSatoshis**
|
|
350
|
+
- The number of satoshis in the source output.
|
|
351
|
+
- **lockingScript**
|
|
352
|
+
- The locking script of the source output.
|
|
353
|
+
- **signOutputs**
|
|
354
|
+
- Specifies which outputs to sign.
|
|
355
|
+
- **anyoneCanPay**
|
|
356
|
+
- Specifies if the anyone-can-pay flag is set.
|
|
342
357
|
|
|
343
358
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
344
359
|
|
|
345
360
|
---
|
|
361
|
+
|
|
346
362
|
### Class: RPuzzle
|
|
347
363
|
|
|
348
364
|
RPuzzle class implementing ScriptTemplate.
|
|
@@ -371,8 +387,8 @@ constructor(type: "raw" | "SHA1" | "SHA256" | "HASH256" | "RIPEMD160" | "HASH160
|
|
|
371
387
|
|
|
372
388
|
Argument Details
|
|
373
389
|
|
|
374
|
-
|
|
375
|
-
|
|
390
|
+
- **type**
|
|
391
|
+
- Denotes the type of puzzle to create
|
|
376
392
|
|
|
377
393
|
#### Method lock
|
|
378
394
|
|
|
@@ -381,6 +397,7 @@ Creates an R puzzle locking script for a given R value or R value hash.
|
|
|
381
397
|
```ts
|
|
382
398
|
lock(value: number[]): LockingScript
|
|
383
399
|
```
|
|
400
|
+
|
|
384
401
|
See also: [LockingScript](./script.md#class-lockingscript)
|
|
385
402
|
|
|
386
403
|
Returns
|
|
@@ -389,14 +406,15 @@ Returns
|
|
|
389
406
|
|
|
390
407
|
Argument Details
|
|
391
408
|
|
|
392
|
-
|
|
393
|
-
|
|
409
|
+
- **value**
|
|
410
|
+
- An array representing the R value or its hash.
|
|
394
411
|
|
|
395
412
|
#### Method unlock
|
|
396
413
|
|
|
397
414
|
Creates a function that generates an R puzzle unlocking script along with its signature and length estimation.
|
|
398
415
|
|
|
399
416
|
The returned object contains:
|
|
417
|
+
|
|
400
418
|
1. `sign` - A function that, when invoked with a transaction and an input index,
|
|
401
419
|
produces an unlocking script suitable for an R puzzle locked output.
|
|
402
420
|
2. `estimateLength` - A function that returns the estimated length of the unlocking script in bytes.
|
|
@@ -407,6 +425,7 @@ unlock(k: BigNumber, privateKey: PrivateKey, signOutputs: "all" | "none" | "sing
|
|
|
407
425
|
estimateLength: () => Promise<108>;
|
|
408
426
|
}
|
|
409
427
|
```
|
|
428
|
+
|
|
410
429
|
See also: [BigNumber](./primitives.md#class-bignumber), [PrivateKey](./primitives.md#class-privatekey), [Transaction](./transaction.md#class-transaction), [UnlockingScript](./script.md#class-unlockingscript), [sign](./compat.md#variable-sign)
|
|
411
430
|
|
|
412
431
|
Returns
|
|
@@ -415,18 +434,19 @@ Returns
|
|
|
415
434
|
|
|
416
435
|
Argument Details
|
|
417
436
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
437
|
+
- **k**
|
|
438
|
+
- — The K-value used to unlock the R-puzzle.
|
|
439
|
+
- **privateKey**
|
|
440
|
+
- The private key used for signing the transaction. If not provided, a random key will be generated.
|
|
441
|
+
- **signOutputs**
|
|
442
|
+
- The signature scope for outputs.
|
|
443
|
+
- **anyoneCanPay**
|
|
444
|
+
- Flag indicating if the signature allows for other inputs to be added later.
|
|
426
445
|
|
|
427
446
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
428
447
|
|
|
429
448
|
---
|
|
449
|
+
|
|
430
450
|
### Class: Script
|
|
431
451
|
|
|
432
452
|
The Script class represents a script in a Bitcoin SV transaction,
|
|
@@ -464,12 +484,13 @@ See also: [BigNumber](./primitives.md#class-bignumber), [ScriptChunk](./script.m
|
|
|
464
484
|
```ts
|
|
465
485
|
constructor(chunks: ScriptChunk[] = [])
|
|
466
486
|
```
|
|
487
|
+
|
|
467
488
|
See also: [ScriptChunk](./script.md#interface-scriptchunk)
|
|
468
489
|
|
|
469
490
|
Argument Details
|
|
470
491
|
|
|
471
|
-
|
|
472
|
-
|
|
492
|
+
- **chunks**
|
|
493
|
+
- =[] - An array of script chunks to directly initialize the script.
|
|
473
494
|
|
|
474
495
|
#### Method findAndDelete
|
|
475
496
|
|
|
@@ -478,6 +499,7 @@ Deletes the given item wherever it appears in the current script.
|
|
|
478
499
|
```ts
|
|
479
500
|
findAndDelete(script: Script): Script
|
|
480
501
|
```
|
|
502
|
+
|
|
481
503
|
See also: [Script](./script.md#class-script)
|
|
482
504
|
|
|
483
505
|
Returns
|
|
@@ -486,14 +508,15 @@ This script instance for chaining.
|
|
|
486
508
|
|
|
487
509
|
Argument Details
|
|
488
510
|
|
|
489
|
-
|
|
490
|
-
|
|
511
|
+
- **script**
|
|
512
|
+
- The script containing the item to delete from the current script.
|
|
491
513
|
|
|
492
514
|
#### Method fromASM
|
|
493
515
|
|
|
494
516
|
```ts
|
|
495
517
|
static fromASM(asm: string): Script
|
|
496
518
|
```
|
|
519
|
+
|
|
497
520
|
See also: [Script](./script.md#class-script)
|
|
498
521
|
|
|
499
522
|
Returns
|
|
@@ -502,8 +525,8 @@ A new Script instance.
|
|
|
502
525
|
|
|
503
526
|
Argument Details
|
|
504
527
|
|
|
505
|
-
|
|
506
|
-
|
|
528
|
+
- **asm**
|
|
529
|
+
- The script in ASM string format.
|
|
507
530
|
|
|
508
531
|
Example
|
|
509
532
|
|
|
@@ -516,6 +539,7 @@ const script = Script.fromASM("OP_DUP OP_HASH160 abcd... OP_EQUALVERIFY OP_CHECK
|
|
|
516
539
|
```ts
|
|
517
540
|
static fromBinary(bin: number[]): Script
|
|
518
541
|
```
|
|
542
|
+
|
|
519
543
|
See also: [Script](./script.md#class-script)
|
|
520
544
|
|
|
521
545
|
Returns
|
|
@@ -524,8 +548,8 @@ A new Script instance.
|
|
|
524
548
|
|
|
525
549
|
Argument Details
|
|
526
550
|
|
|
527
|
-
|
|
528
|
-
|
|
551
|
+
- **bin**
|
|
552
|
+
- The script in binary array format.
|
|
529
553
|
|
|
530
554
|
Example
|
|
531
555
|
|
|
@@ -538,6 +562,7 @@ const script = Script.fromBinary([0x76, 0xa9, ...])
|
|
|
538
562
|
```ts
|
|
539
563
|
static fromHex(hex: string): Script
|
|
540
564
|
```
|
|
565
|
+
|
|
541
566
|
See also: [Script](./script.md#class-script)
|
|
542
567
|
|
|
543
568
|
Returns
|
|
@@ -546,8 +571,8 @@ A new Script instance.
|
|
|
546
571
|
|
|
547
572
|
Argument Details
|
|
548
573
|
|
|
549
|
-
|
|
550
|
-
|
|
574
|
+
- **hex**
|
|
575
|
+
- The script in hexadecimal format.
|
|
551
576
|
|
|
552
577
|
Example
|
|
553
578
|
|
|
@@ -590,6 +615,7 @@ True if the script is an unlocking script, otherwise false.
|
|
|
590
615
|
```ts
|
|
591
616
|
removeCodeseparators(): Script
|
|
592
617
|
```
|
|
618
|
+
|
|
593
619
|
See also: [Script](./script.md#class-script)
|
|
594
620
|
|
|
595
621
|
Returns
|
|
@@ -601,6 +627,7 @@ This script instance for chaining.
|
|
|
601
627
|
```ts
|
|
602
628
|
setChunkOpCode(i: number, op: number): Script
|
|
603
629
|
```
|
|
630
|
+
|
|
604
631
|
See also: [Script](./script.md#class-script)
|
|
605
632
|
|
|
606
633
|
Returns
|
|
@@ -609,10 +636,10 @@ This script instance for chaining.
|
|
|
609
636
|
|
|
610
637
|
Argument Details
|
|
611
638
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
639
|
+
- **i**
|
|
640
|
+
- The index of the chunk.
|
|
641
|
+
- **op**
|
|
642
|
+
- The opcode to set.
|
|
616
643
|
|
|
617
644
|
#### Method toASM
|
|
618
645
|
|
|
@@ -649,6 +676,7 @@ The script in hexadecimal format.
|
|
|
649
676
|
```ts
|
|
650
677
|
writeBin(bin: number[]): Script
|
|
651
678
|
```
|
|
679
|
+
|
|
652
680
|
See also: [Script](./script.md#class-script)
|
|
653
681
|
|
|
654
682
|
Returns
|
|
@@ -657,8 +685,8 @@ This script instance for chaining.
|
|
|
657
685
|
|
|
658
686
|
Argument Details
|
|
659
687
|
|
|
660
|
-
|
|
661
|
-
|
|
688
|
+
- **bin**
|
|
689
|
+
- The binary data to append.
|
|
662
690
|
|
|
663
691
|
Throws
|
|
664
692
|
|
|
@@ -669,6 +697,7 @@ Throws an error if the data is too large to be pushed.
|
|
|
669
697
|
```ts
|
|
670
698
|
writeBn(bn: BigNumber): Script
|
|
671
699
|
```
|
|
700
|
+
|
|
672
701
|
See also: [BigNumber](./primitives.md#class-bignumber), [Script](./script.md#class-script)
|
|
673
702
|
|
|
674
703
|
Returns
|
|
@@ -677,14 +706,15 @@ This script instance for chaining.
|
|
|
677
706
|
|
|
678
707
|
Argument Details
|
|
679
708
|
|
|
680
|
-
|
|
681
|
-
|
|
709
|
+
- **bn**
|
|
710
|
+
- The BigNumber to append.
|
|
682
711
|
|
|
683
712
|
#### Method writeNumber
|
|
684
713
|
|
|
685
714
|
```ts
|
|
686
715
|
writeNumber(num: number): Script
|
|
687
716
|
```
|
|
717
|
+
|
|
688
718
|
See also: [Script](./script.md#class-script)
|
|
689
719
|
|
|
690
720
|
Returns
|
|
@@ -693,14 +723,15 @@ This script instance for chaining.
|
|
|
693
723
|
|
|
694
724
|
Argument Details
|
|
695
725
|
|
|
696
|
-
|
|
697
|
-
|
|
726
|
+
- **num**
|
|
727
|
+
- The number to append.
|
|
698
728
|
|
|
699
729
|
#### Method writeOpCode
|
|
700
730
|
|
|
701
731
|
```ts
|
|
702
732
|
writeOpCode(op: number): Script
|
|
703
733
|
```
|
|
734
|
+
|
|
704
735
|
See also: [Script](./script.md#class-script)
|
|
705
736
|
|
|
706
737
|
Returns
|
|
@@ -709,14 +740,15 @@ This script instance for chaining.
|
|
|
709
740
|
|
|
710
741
|
Argument Details
|
|
711
742
|
|
|
712
|
-
|
|
713
|
-
|
|
743
|
+
- **op**
|
|
744
|
+
- The opcode to append.
|
|
714
745
|
|
|
715
746
|
#### Method writeScript
|
|
716
747
|
|
|
717
748
|
```ts
|
|
718
749
|
writeScript(script: Script): Script
|
|
719
750
|
```
|
|
751
|
+
|
|
720
752
|
See also: [Script](./script.md#class-script)
|
|
721
753
|
|
|
722
754
|
Returns
|
|
@@ -725,12 +757,13 @@ This script instance for chaining.
|
|
|
725
757
|
|
|
726
758
|
Argument Details
|
|
727
759
|
|
|
728
|
-
|
|
729
|
-
|
|
760
|
+
- **script**
|
|
761
|
+
- The script to append.
|
|
730
762
|
|
|
731
763
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
732
764
|
|
|
733
765
|
---
|
|
766
|
+
|
|
734
767
|
### Class: Spend
|
|
735
768
|
|
|
736
769
|
The Spend class represents a spend action within a Bitcoin SV transaction.
|
|
@@ -799,34 +832,35 @@ constructor(params: {
|
|
|
799
832
|
memoryLimit?: number;
|
|
800
833
|
})
|
|
801
834
|
```
|
|
835
|
+
|
|
802
836
|
See also: [LockingScript](./script.md#class-lockingscript), [TransactionInput](./transaction.md#interface-transactioninput), [TransactionOutput](./transaction.md#interface-transactionoutput), [UnlockingScript](./script.md#class-unlockingscript)
|
|
803
837
|
|
|
804
838
|
Argument Details
|
|
805
839
|
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
840
|
+
- **params.sourceTXID**
|
|
841
|
+
- The transaction ID of the source UTXO.
|
|
842
|
+
- **params.sourceOutputIndex**
|
|
843
|
+
- The index of the output in the source transaction.
|
|
844
|
+
- **params.sourceSatoshis**
|
|
845
|
+
- The amount of satoshis in the source UTXO.
|
|
846
|
+
- **params.lockingScript**
|
|
847
|
+
- The locking script associated with the UTXO.
|
|
848
|
+
- **params.transactionVersion**
|
|
849
|
+
- The version of the current transaction.
|
|
850
|
+
- **params.otherInputs**
|
|
851
|
+
- -
|
|
818
852
|
An array of other inputs in the transaction.
|
|
819
|
-
|
|
820
|
-
|
|
853
|
+
- **params.outputs**
|
|
854
|
+
- -
|
|
821
855
|
The outputs of the current transaction.
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
856
|
+
- **params.inputIndex**
|
|
857
|
+
- The index of this input in the current transaction.
|
|
858
|
+
- **params.unlockingScript**
|
|
859
|
+
- The unlocking script for this spend.
|
|
860
|
+
- **params.inputSequence**
|
|
861
|
+
- The sequence number of this input.
|
|
862
|
+
- **params.lockTime**
|
|
863
|
+
- The lock time of the transaction.
|
|
830
864
|
|
|
831
865
|
Example
|
|
832
866
|
|
|
@@ -869,6 +903,7 @@ if (spend.validate()) {
|
|
|
869
903
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
870
904
|
|
|
871
905
|
---
|
|
906
|
+
|
|
872
907
|
### Class: UnlockingScript
|
|
873
908
|
|
|
874
909
|
The UnlockingScript class represents an unlocking script in a Bitcoin SV transaction.
|
|
@@ -908,6 +943,7 @@ Always returns true for an UnlockingScript instance.
|
|
|
908
943
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
909
944
|
|
|
910
945
|
---
|
|
946
|
+
|
|
911
947
|
## Functions
|
|
912
948
|
|
|
913
949
|
## Types
|
|
@@ -915,4 +951,3 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
915
951
|
## Enums
|
|
916
952
|
|
|
917
953
|
## Variables
|
|
918
|
-
|