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