@bsv/sdk 1.10.1 → 1.10.3
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/identity/IdentityClient.js +124 -20
- package/dist/cjs/src/identity/IdentityClient.js.map +1 -1
- package/dist/cjs/src/primitives/ReaderUint8Array.js +180 -0
- package/dist/cjs/src/primitives/ReaderUint8Array.js.map +1 -0
- package/dist/cjs/src/primitives/WriterUint8Array.js +173 -0
- package/dist/cjs/src/primitives/WriterUint8Array.js.map +1 -0
- package/dist/cjs/src/primitives/utils.js +20 -2
- package/dist/cjs/src/primitives/utils.js.map +1 -1
- package/dist/cjs/src/transaction/Beef.js +85 -27
- package/dist/cjs/src/transaction/Beef.js.map +1 -1
- package/dist/cjs/src/transaction/BeefTx.js +32 -14
- package/dist/cjs/src/transaction/BeefTx.js.map +1 -1
- package/dist/cjs/src/transaction/MerklePath.js +25 -6
- package/dist/cjs/src/transaction/MerklePath.js.map +1 -1
- package/dist/cjs/src/transaction/Transaction.js +77 -26
- package/dist/cjs/src/transaction/Transaction.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/identity/IdentityClient.js +124 -20
- package/dist/esm/src/identity/IdentityClient.js.map +1 -1
- package/dist/esm/src/primitives/ReaderUint8Array.js +176 -0
- package/dist/esm/src/primitives/ReaderUint8Array.js.map +1 -0
- package/dist/esm/src/primitives/WriterUint8Array.js +169 -0
- package/dist/esm/src/primitives/WriterUint8Array.js.map +1 -0
- package/dist/esm/src/primitives/utils.js +18 -1
- package/dist/esm/src/primitives/utils.js.map +1 -1
- package/dist/esm/src/transaction/Beef.js +86 -28
- package/dist/esm/src/transaction/Beef.js.map +1 -1
- package/dist/esm/src/transaction/BeefTx.js +33 -15
- package/dist/esm/src/transaction/BeefTx.js.map +1 -1
- package/dist/esm/src/transaction/MerklePath.js +26 -7
- package/dist/esm/src/transaction/MerklePath.js.map +1 -1
- package/dist/esm/src/transaction/Transaction.js +78 -27
- package/dist/esm/src/transaction/Transaction.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/identity/IdentityClient.d.ts +8 -0
- package/dist/types/src/identity/IdentityClient.d.ts.map +1 -1
- package/dist/types/src/primitives/ReaderUint8Array.d.ts +32 -0
- package/dist/types/src/primitives/ReaderUint8Array.d.ts.map +1 -0
- package/dist/types/src/primitives/WriterUint8Array.d.ts +54 -0
- package/dist/types/src/primitives/WriterUint8Array.d.ts.map +1 -0
- package/dist/types/src/primitives/utils.d.ts +15 -3
- package/dist/types/src/primitives/utils.d.ts.map +1 -1
- package/dist/types/src/transaction/Beef.d.ts +24 -7
- package/dist/types/src/transaction/Beef.d.ts.map +1 -1
- package/dist/types/src/transaction/BeefTx.d.ts +13 -6
- package/dist/types/src/transaction/BeefTx.d.ts.map +1 -1
- package/dist/types/src/transaction/MerklePath.d.ts +16 -3
- package/dist/types/src/transaction/MerklePath.d.ts.map +1 -1
- package/dist/types/src/transaction/Transaction.d.ts +44 -7
- package/dist/types/src/transaction/Transaction.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +3 -3
- package/dist/umd/bundle.js.map +1 -1
- package/docs/reference/primitives.md +167 -29
- package/docs/reference/script.md +1 -1
- package/docs/reference/transaction.md +177 -34
- package/package.json +1 -1
- package/src/identity/IdentityClient.ts +153 -29
- package/src/identity/__tests/IdentityClient.test.ts +289 -1
- package/src/overlay-tools/__tests/SHIPBroadcaster.test.ts +9 -0
- package/src/primitives/ReaderUint8Array.ts +196 -0
- package/src/primitives/WriterUint8Array.ts +195 -0
- package/src/primitives/__tests/ReaderUint8Array.test.ts +317 -0
- package/src/primitives/__tests/WriterUint8Array.test.ts +208 -0
- package/src/primitives/utils.ts +20 -2
- package/src/transaction/Beef.ts +103 -40
- package/src/transaction/BeefTx.ts +38 -19
- package/src/transaction/MerklePath.ts +30 -9
- package/src/transaction/Transaction.ts +91 -38
- package/src/transaction/__tests/Beef.test.ts +75 -0
|
@@ -44,16 +44,17 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
44
44
|
|
|
45
45
|
| | | |
|
|
46
46
|
| --- | --- | --- |
|
|
47
|
-
| [BasePoint](#class-basepoint) | [
|
|
48
|
-
| [BigNumber](#class-bignumber) | [
|
|
49
|
-
| [Curve](#class-curve) | [
|
|
50
|
-
| [DRBG](#class-drbg) | [
|
|
51
|
-
| [JacobianPoint](#class-jacobianpoint) | [
|
|
52
|
-
| [K256](#class-k256) | [
|
|
53
|
-
| [KeyShares](#class-keyshares) | [ReductionContext](#class-reductioncontext) | [
|
|
54
|
-
| [Mersenne](#class-mersenne) | [SHA1](#class-sha1) | [
|
|
55
|
-
| [MontgomoryMethod](#class-montgomorymethod) | [SHA1HMAC](#class-sha1hmac) | [
|
|
47
|
+
| [BasePoint](#class-basepoint) | [Polynomial](#class-polynomial) | [SHA512](#class-sha512) |
|
|
48
|
+
| [BigNumber](#class-bignumber) | [PrivateKey](#class-privatekey) | [SHA512HMAC](#class-sha512hmac) |
|
|
49
|
+
| [Curve](#class-curve) | [PublicKey](#class-publickey) | [Schnorr](#class-schnorr) |
|
|
50
|
+
| [DRBG](#class-drbg) | [RIPEMD160](#class-ripemd160) | [Secp256r1](#class-secp256r1) |
|
|
51
|
+
| [JacobianPoint](#class-jacobianpoint) | [Reader](#class-reader) | [Signature](#class-signature) |
|
|
52
|
+
| [K256](#class-k256) | [ReaderUint8Array](#class-readeruint8array) | [SymmetricKey](#class-symmetrickey) |
|
|
53
|
+
| [KeyShares](#class-keyshares) | [ReductionContext](#class-reductioncontext) | [TransactionSignature](#class-transactionsignature) |
|
|
54
|
+
| [Mersenne](#class-mersenne) | [SHA1](#class-sha1) | [Writer](#class-writer) |
|
|
55
|
+
| [MontgomoryMethod](#class-montgomorymethod) | [SHA1HMAC](#class-sha1hmac) | [WriterUint8Array](#class-writeruint8array) |
|
|
56
56
|
| [Point](#class-point) | [SHA256](#class-sha256) | |
|
|
57
|
+
| [PointInFiniteField](#class-pointinfinitefield) | [SHA256HMAC](#class-sha256hmac) | |
|
|
57
58
|
|
|
58
59
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
59
60
|
|
|
@@ -3340,6 +3341,43 @@ See also: [BigNumber](./primitives.md#class-bignumber)
|
|
|
3340
3341
|
|
|
3341
3342
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3342
3343
|
|
|
3344
|
+
---
|
|
3345
|
+
### Class: ReaderUint8Array
|
|
3346
|
+
|
|
3347
|
+
Reader for serialized Uint8Array binary data.
|
|
3348
|
+
|
|
3349
|
+
```ts
|
|
3350
|
+
export class ReaderUint8Array {
|
|
3351
|
+
public bin: Uint8Array;
|
|
3352
|
+
public pos: number;
|
|
3353
|
+
static makeReader(bin: Uint8Array | number[], pos: number = 0): Reader | ReaderUint8Array
|
|
3354
|
+
constructor(bin: Uint8Array | number[] = new Uint8Array(0), pos: number = 0)
|
|
3355
|
+
public eof(): boolean
|
|
3356
|
+
public read(len = this.length): Uint8Array
|
|
3357
|
+
public readReverse(len = this.length): Uint8Array
|
|
3358
|
+
public readUInt8(): number
|
|
3359
|
+
public readInt8(): number
|
|
3360
|
+
public readUInt16BE(): number
|
|
3361
|
+
public readInt16BE(): number
|
|
3362
|
+
public readUInt16LE(): number
|
|
3363
|
+
public readInt16LE(): number
|
|
3364
|
+
public readUInt32BE(): number
|
|
3365
|
+
public readInt32BE(): number
|
|
3366
|
+
public readUInt32LE(): number
|
|
3367
|
+
public readInt32LE(): number
|
|
3368
|
+
public readUInt64BEBn(): BigNumber
|
|
3369
|
+
public readUInt64LEBn(): BigNumber
|
|
3370
|
+
public readInt64LEBn(): BigNumber
|
|
3371
|
+
public readVarIntNum(signed: boolean = true): number
|
|
3372
|
+
public readVarInt(): Uint8Array
|
|
3373
|
+
public readVarIntBn(): BigNumber
|
|
3374
|
+
}
|
|
3375
|
+
```
|
|
3376
|
+
|
|
3377
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Reader](./primitives.md#class-reader)
|
|
3378
|
+
|
|
3379
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3380
|
+
|
|
3343
3381
|
---
|
|
3344
3382
|
### Class: ReductionContext
|
|
3345
3383
|
|
|
@@ -4994,7 +5032,91 @@ export class Writer {
|
|
|
4994
5032
|
}
|
|
4995
5033
|
```
|
|
4996
5034
|
|
|
4997
|
-
See also: [BigNumber](./primitives.md#class-bignumber), [toArray](./primitives.md#variable-toarray)
|
|
5035
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [toArray](./primitives.md#variable-toarray), [toUint8Array](./primitives.md#variable-touint8array)
|
|
5036
|
+
|
|
5037
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5038
|
+
|
|
5039
|
+
---
|
|
5040
|
+
### Class: WriterUint8Array
|
|
5041
|
+
|
|
5042
|
+
WriterUint8Array is a utility class for writing binary data into a dynamically
|
|
5043
|
+
growing Uint8Array buffer. It provides methods to write various integer types
|
|
5044
|
+
and variable-length integers, similar to the Writer class but optimized for
|
|
5045
|
+
Uint8Array usage.
|
|
5046
|
+
|
|
5047
|
+
```ts
|
|
5048
|
+
export class WriterUint8Array {
|
|
5049
|
+
constructor(bufs?: WriterChunk[], initialCapacity: number = 256)
|
|
5050
|
+
getLength(): number
|
|
5051
|
+
toUint8Array(): Uint8Array
|
|
5052
|
+
toArray(): number[]
|
|
5053
|
+
toUint8ArrayZeroCopy(): Uint8Array
|
|
5054
|
+
write(bytes: WriterChunk): this
|
|
5055
|
+
writeReverse(buf: WriterChunk): this
|
|
5056
|
+
writeUInt8(value: number): this
|
|
5057
|
+
writeInt8(value: number): this
|
|
5058
|
+
writeUInt16LE(value: number): this
|
|
5059
|
+
writeUInt16BE(value: number): this
|
|
5060
|
+
writeInt16LE(value: number): this
|
|
5061
|
+
writeInt16BE(value: number): this
|
|
5062
|
+
writeUInt32LE(value: number): this
|
|
5063
|
+
writeUInt32BE(value: number): this
|
|
5064
|
+
writeInt32LE(value: number): this
|
|
5065
|
+
writeInt32BE(value: number): this
|
|
5066
|
+
writeUInt64BEBn(bn: BigNumber): this
|
|
5067
|
+
writeUInt64LEBn(bn: BigNumber): this
|
|
5068
|
+
writeUInt64LE(n: number): this
|
|
5069
|
+
writeVarIntNum(n: number): this
|
|
5070
|
+
writeVarIntBn(bn: BigNumber): this
|
|
5071
|
+
reset(): void
|
|
5072
|
+
}
|
|
5073
|
+
```
|
|
5074
|
+
|
|
5075
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [toArray](./primitives.md#variable-toarray), [toUint8Array](./primitives.md#variable-touint8array)
|
|
5076
|
+
|
|
5077
|
+
#### Method getLength
|
|
5078
|
+
|
|
5079
|
+
Returns the current length of written data
|
|
5080
|
+
|
|
5081
|
+
```ts
|
|
5082
|
+
getLength(): number
|
|
5083
|
+
```
|
|
5084
|
+
|
|
5085
|
+
#### Method reset
|
|
5086
|
+
|
|
5087
|
+
Resets the writer to empty state (reuses the buffer)
|
|
5088
|
+
|
|
5089
|
+
```ts
|
|
5090
|
+
reset(): void
|
|
5091
|
+
```
|
|
5092
|
+
|
|
5093
|
+
#### Method toArray
|
|
5094
|
+
|
|
5095
|
+
Legacy compatibility method – returns number[] (Byte[])
|
|
5096
|
+
|
|
5097
|
+
```ts
|
|
5098
|
+
toArray(): number[]
|
|
5099
|
+
```
|
|
5100
|
+
|
|
5101
|
+
#### Method toUint8Array
|
|
5102
|
+
|
|
5103
|
+
```ts
|
|
5104
|
+
toUint8Array(): Uint8Array
|
|
5105
|
+
```
|
|
5106
|
+
|
|
5107
|
+
Returns
|
|
5108
|
+
|
|
5109
|
+
the written data as Uint8Array copy of the internal buffer
|
|
5110
|
+
|
|
5111
|
+
#### Method toUint8ArrayZeroCopy
|
|
5112
|
+
|
|
5113
|
+
```ts
|
|
5114
|
+
toUint8ArrayZeroCopy(): Uint8Array
|
|
5115
|
+
```
|
|
5116
|
+
|
|
5117
|
+
Returns
|
|
5118
|
+
|
|
5119
|
+
the written data as Uint8Array. CAUTION: This is zero-copy subarray of the internal buffer).
|
|
4998
5120
|
|
|
4999
5121
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5000
5122
|
|
|
@@ -5351,24 +5473,25 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
5351
5473
|
|
|
5352
5474
|
| | | |
|
|
5353
5475
|
| --- | --- | --- |
|
|
5354
|
-
| [BI_EIGHT](#variable-bi_eight) | [
|
|
5355
|
-
| [BI_FOUR](#variable-bi_four) | [
|
|
5356
|
-
| [BI_ONE](#variable-bi_one) | [
|
|
5357
|
-
| [BI_THREE](#variable-bi_three) | [
|
|
5358
|
-
| [BI_TWO](#variable-bi_two) | [
|
|
5359
|
-
| [BI_ZERO](#variable-bi_zero) | [
|
|
5360
|
-
| [GX_BIGINT](#variable-gx_bigint) | [
|
|
5361
|
-
| [GY_BIGINT](#variable-gy_bigint) | [
|
|
5362
|
-
| [MASK_256](#variable-mask_256) | [
|
|
5363
|
-
| [N_BIGINT](#variable-n_bigint) | [
|
|
5364
|
-
| [P_BIGINT](#variable-p_bigint) | [
|
|
5365
|
-
| [P_PLUS1_DIV4](#variable-p_plus1_div4) | [
|
|
5366
|
-
| [biMod](#variable-bimod) | [
|
|
5367
|
-
| [biModAdd](#variable-bimodadd) | [
|
|
5368
|
-
| [biModInv](#variable-bimodinv) | [
|
|
5369
|
-
| [biModMul](#variable-bimodmul) | [
|
|
5370
|
-
| [biModPow](#variable-bimodpow) | [
|
|
5371
|
-
| [biModSqr](#variable-bimodsqr) | [
|
|
5476
|
+
| [BI_EIGHT](#variable-bi_eight) | [biModSub](#variable-bimodsub) | [rightShift](#variable-rightshift) |
|
|
5477
|
+
| [BI_FOUR](#variable-bi_four) | [checkBit](#variable-checkbit) | [ripemd160](#variable-ripemd160) |
|
|
5478
|
+
| [BI_ONE](#variable-bi_one) | [encode](#variable-encode) | [scalarMultiplyWNAF](#variable-scalarmultiplywnaf) |
|
|
5479
|
+
| [BI_THREE](#variable-bi_three) | [exclusiveOR](#variable-exclusiveor) | [sha1](#variable-sha1) |
|
|
5480
|
+
| [BI_TWO](#variable-bi_two) | [fromBase58](#variable-frombase58) | [sha256](#variable-sha256) |
|
|
5481
|
+
| [BI_ZERO](#variable-bi_zero) | [fromBase58Check](#variable-frombase58check) | [sha256hmac](#variable-sha256hmac) |
|
|
5482
|
+
| [GX_BIGINT](#variable-gx_bigint) | [getBytes](#variable-getbytes) | [sha512](#variable-sha512) |
|
|
5483
|
+
| [GY_BIGINT](#variable-gy_bigint) | [getBytes64](#variable-getbytes64) | [sha512hmac](#variable-sha512hmac) |
|
|
5484
|
+
| [MASK_256](#variable-mask_256) | [hash160](#variable-hash160) | [sign](#variable-sign) |
|
|
5485
|
+
| [N_BIGINT](#variable-n_bigint) | [hash256](#variable-hash256) | [toArray](#variable-toarray) |
|
|
5486
|
+
| [P_BIGINT](#variable-p_bigint) | [incrementLeastSignificantThirtyTwoBits](#variable-incrementleastsignificantthirtytwobits) | [toBase58](#variable-tobase58) |
|
|
5487
|
+
| [P_PLUS1_DIV4](#variable-p_plus1_div4) | [jpAdd](#variable-jpadd) | [toBase58Check](#variable-tobase58check) |
|
|
5488
|
+
| [biMod](#variable-bimod) | [jpDouble](#variable-jpdouble) | [toHex](#variable-tohex) |
|
|
5489
|
+
| [biModAdd](#variable-bimodadd) | [jpNeg](#variable-jpneg) | [toUTF8](#variable-toutf8) |
|
|
5490
|
+
| [biModInv](#variable-bimodinv) | [minimallyEncode](#variable-minimallyencode) | [toUint8Array](#variable-touint8array) |
|
|
5491
|
+
| [biModMul](#variable-bimodmul) | [modInvN](#variable-modinvn) | [verify](#variable-verify) |
|
|
5492
|
+
| [biModPow](#variable-bimodpow) | [modMulN](#variable-modmuln) | [zero2](#variable-zero2) |
|
|
5493
|
+
| [biModSqr](#variable-bimodsqr) | [modN](#variable-modn) | |
|
|
5494
|
+
| [biModSqrt](#variable-bimodsqrt) | [multiply](#variable-multiply) | |
|
|
5372
5495
|
|
|
5373
5496
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5374
5497
|
|
|
@@ -6300,7 +6423,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
6300
6423
|
### Variable: toHex
|
|
6301
6424
|
|
|
6302
6425
|
```ts
|
|
6303
|
-
toHex = (msg: number[]): string => {
|
|
6426
|
+
toHex = (msg: number[] | Uint8Array): string => {
|
|
6304
6427
|
if (CAN_USE_BUFFER) {
|
|
6305
6428
|
return BufferCtor.from(msg).toString("hex");
|
|
6306
6429
|
}
|
|
@@ -6401,6 +6524,21 @@ toUTF8 = (arr: number[]): string => {
|
|
|
6401
6524
|
|
|
6402
6525
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
6403
6526
|
|
|
6527
|
+
---
|
|
6528
|
+
### Variable: toUint8Array
|
|
6529
|
+
|
|
6530
|
+
```ts
|
|
6531
|
+
toUint8Array = (msg: any, enc?: "hex" | "utf8" | "base64"): Uint8Array => {
|
|
6532
|
+
if (msg instanceof Uint8Array)
|
|
6533
|
+
return msg;
|
|
6534
|
+
return new Uint8Array(toArray(msg, enc));
|
|
6535
|
+
}
|
|
6536
|
+
```
|
|
6537
|
+
|
|
6538
|
+
See also: [toArray](./primitives.md#variable-toarray)
|
|
6539
|
+
|
|
6540
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
6541
|
+
|
|
6404
6542
|
---
|
|
6405
6543
|
### Variable: verify
|
|
6406
6544
|
|
package/docs/reference/script.md
CHANGED
|
@@ -444,7 +444,7 @@ export default class Script {
|
|
|
444
444
|
}
|
|
445
445
|
```
|
|
446
446
|
|
|
447
|
-
See also: [BigNumber](./primitives.md#class-bignumber), [ScriptChunk](./script.md#interface-scriptchunk), [toHex](./primitives.md#variable-tohex)
|
|
447
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [ScriptChunk](./script.md#interface-scriptchunk), [toHex](./primitives.md#variable-tohex), [toUint8Array](./primitives.md#variable-touint8array)
|
|
448
448
|
|
|
449
449
|
#### Constructor
|
|
450
450
|
|
|
@@ -575,25 +575,26 @@ export class Beef {
|
|
|
575
575
|
findTransactionForSigning(txid: string): Transaction | undefined
|
|
576
576
|
findAtomicTransaction(txid: string): Transaction | undefined
|
|
577
577
|
mergeBump(bump: MerklePath): number
|
|
578
|
-
mergeRawTx(rawTx: number[], bumpIndex?: number): BeefTx
|
|
578
|
+
mergeRawTx(rawTx: number[] | Uint8Array, bumpIndex?: number): BeefTx
|
|
579
579
|
mergeTransaction(tx: Transaction): BeefTx
|
|
580
580
|
removeExistingTxid(txid: string): void
|
|
581
581
|
mergeTxidOnly(txid: string): BeefTx
|
|
582
582
|
mergeBeefTx(btx: BeefTx): BeefTx
|
|
583
|
-
mergeBeef(beef: number[] |
|
|
583
|
+
mergeBeef(beef: Beef | number[] | Uint8Array): void
|
|
584
584
|
isValid(allowTxidOnly?: boolean): boolean
|
|
585
585
|
async verify(chainTracker: ChainTracker, allowTxidOnly?: boolean): Promise<boolean>
|
|
586
586
|
verifyValid(allowTxidOnly?: boolean): {
|
|
587
587
|
valid: boolean;
|
|
588
588
|
roots: Record<number, string>;
|
|
589
589
|
}
|
|
590
|
-
toWriter(writer: Writer): void
|
|
590
|
+
toWriter(writer: Writer | WriterUint8Array): void
|
|
591
591
|
toBinary(): number[]
|
|
592
592
|
toUint8Array(): Uint8Array
|
|
593
593
|
toBinaryAtomic(txid: string): number[]
|
|
594
|
+
toUint8ArrayAtomic(txid: string): Uint8Array
|
|
594
595
|
toHex(): string
|
|
595
|
-
static fromReader(br: Reader): Beef
|
|
596
|
-
static fromBinary(bin: number[]): Beef
|
|
596
|
+
static fromReader(br: Reader | ReaderUint8Array): Beef
|
|
597
|
+
static fromBinary(bin: number[] | Uint8Array): Beef
|
|
597
598
|
static fromString(s: string, enc: "hex" | "utf8" | "base64" = "hex"): Beef
|
|
598
599
|
sortTxs(): {
|
|
599
600
|
missingInputs: string[];
|
|
@@ -610,7 +611,7 @@ export class Beef {
|
|
|
610
611
|
}
|
|
611
612
|
```
|
|
612
613
|
|
|
613
|
-
See also: [BEEF_V2](./transaction.md#variable-beef_v2), [BeefTx](./transaction.md#class-beeftx), [ChainTracker](./transaction.md#interface-chaintracker), [MerklePath](./transaction.md#class-merklepath), [Reader](./primitives.md#class-reader), [Transaction](./transaction.md#class-transaction), [Writer](./primitives.md#class-writer), [toHex](./primitives.md#variable-tohex), [verify](./compat.md#variable-verify)
|
|
614
|
+
See also: [BEEF_V2](./transaction.md#variable-beef_v2), [BeefTx](./transaction.md#class-beeftx), [ChainTracker](./transaction.md#interface-chaintracker), [MerklePath](./transaction.md#class-merklepath), [Reader](./primitives.md#class-reader), [ReaderUint8Array](./primitives.md#class-readeruint8array), [Transaction](./transaction.md#class-transaction), [Writer](./primitives.md#class-writer), [WriterUint8Array](./primitives.md#class-writeruint8array), [toHex](./primitives.md#variable-tohex), [toUint8Array](./primitives.md#variable-touint8array), [verify](./compat.md#variable-verify)
|
|
614
615
|
|
|
615
616
|
#### Method addComputedLeaves
|
|
616
617
|
|
|
@@ -705,7 +706,7 @@ Argument Details
|
|
|
705
706
|
Constructs an instance of the Beef class based on the provided binary array
|
|
706
707
|
|
|
707
708
|
```ts
|
|
708
|
-
static fromBinary(bin: number[]): Beef
|
|
709
|
+
static fromBinary(bin: number[] | Uint8Array): Beef
|
|
709
710
|
```
|
|
710
711
|
See also: [Beef](./transaction.md#class-beef)
|
|
711
712
|
|
|
@@ -716,7 +717,7 @@ An instance of the Beef class constructed from the binary data
|
|
|
716
717
|
Argument Details
|
|
717
718
|
|
|
718
719
|
+ **bin**
|
|
719
|
-
+ The binary array from which to construct BEEF
|
|
720
|
+
+ The binary array or Uint8Array from which to construct BEEF
|
|
720
721
|
|
|
721
722
|
#### Method fromString
|
|
722
723
|
|
|
@@ -808,7 +809,7 @@ Checks that a transaction with the same txid hasn't already been merged.
|
|
|
808
809
|
Replaces existing transaction with same txid.
|
|
809
810
|
|
|
810
811
|
```ts
|
|
811
|
-
mergeRawTx(rawTx: number[], bumpIndex?: number): BeefTx
|
|
812
|
+
mergeRawTx(rawTx: number[] | Uint8Array, bumpIndex?: number): BeefTx
|
|
812
813
|
```
|
|
813
814
|
See also: [BeefTx](./transaction.md#class-beeftx)
|
|
814
815
|
|
|
@@ -886,6 +887,8 @@ Returns
|
|
|
886
887
|
|
|
887
888
|
A binary array representing the BEEF
|
|
888
889
|
|
|
890
|
+
An array of byte values containing binary serialization of the BEEF
|
|
891
|
+
|
|
889
892
|
#### Method toBinaryAtomic
|
|
890
893
|
|
|
891
894
|
Serialize this Beef as AtomicBEEF.
|
|
@@ -924,14 +927,42 @@ Returns
|
|
|
924
927
|
|
|
925
928
|
Summary of `Beef` contents as multi-line string.
|
|
926
929
|
|
|
930
|
+
#### Method toUint8Array
|
|
931
|
+
|
|
932
|
+
Returns a binary array representing the serialized BEEF
|
|
933
|
+
|
|
934
|
+
```ts
|
|
935
|
+
toUint8Array(): Uint8Array
|
|
936
|
+
```
|
|
937
|
+
|
|
938
|
+
Returns
|
|
939
|
+
|
|
940
|
+
A Uint8Array containing binary serialization of the BEEF
|
|
941
|
+
|
|
942
|
+
#### Method toUint8ArrayAtomic
|
|
943
|
+
|
|
944
|
+
Serialize this Beef as AtomicBEEF.
|
|
945
|
+
|
|
946
|
+
`txid` must exist
|
|
947
|
+
|
|
948
|
+
after sorting, if txid is not last txid, creates a clone and removes newer txs
|
|
949
|
+
|
|
950
|
+
```ts
|
|
951
|
+
toUint8ArrayAtomic(txid: string): Uint8Array
|
|
952
|
+
```
|
|
953
|
+
|
|
954
|
+
Returns
|
|
955
|
+
|
|
956
|
+
serialized contents of this Beef with AtomicBEEF prefix.
|
|
957
|
+
|
|
927
958
|
#### Method toWriter
|
|
928
959
|
|
|
929
960
|
Serializes this data to `writer`
|
|
930
961
|
|
|
931
962
|
```ts
|
|
932
|
-
toWriter(writer: Writer): void
|
|
963
|
+
toWriter(writer: Writer | WriterUint8Array): void
|
|
933
964
|
```
|
|
934
|
-
See also: [Writer](./primitives.md#class-writer)
|
|
965
|
+
See also: [Writer](./primitives.md#class-writer), [WriterUint8Array](./primitives.md#class-writeruint8array)
|
|
935
966
|
|
|
936
967
|
#### Method trimKnownTxids
|
|
937
968
|
|
|
@@ -1136,7 +1167,7 @@ which they can merge if necessary to create a valid beef.
|
|
|
1136
1167
|
export default class BeefTx {
|
|
1137
1168
|
_bumpIndex?: number;
|
|
1138
1169
|
_tx?: Transaction;
|
|
1139
|
-
_rawTx?:
|
|
1170
|
+
_rawTx?: Uint8Array;
|
|
1140
1171
|
_txid?: string;
|
|
1141
1172
|
inputTxids: string[] = [];
|
|
1142
1173
|
isValid?: boolean = undefined;
|
|
@@ -1147,21 +1178,22 @@ export default class BeefTx {
|
|
|
1147
1178
|
get txid(): string
|
|
1148
1179
|
get tx(): Transaction | undefined
|
|
1149
1180
|
get rawTx(): number[] | undefined
|
|
1150
|
-
|
|
1181
|
+
get rawTxUint8Array(): Uint8Array | undefined
|
|
1182
|
+
constructor(tx: Transaction | Uint8Array | number[] | string, bumpIndex?: number)
|
|
1151
1183
|
static fromTx(tx: Transaction, bumpIndex?: number): BeefTx
|
|
1152
|
-
static fromRawTx(rawTx: number[], bumpIndex?: number): BeefTx
|
|
1184
|
+
static fromRawTx(rawTx: Uint8Array | number[], bumpIndex?: number): BeefTx
|
|
1153
1185
|
static fromTxid(txid: string, bumpIndex?: number): BeefTx
|
|
1154
|
-
toWriter(writer: Writer, version: number): void
|
|
1155
|
-
static fromReader(br: Reader, version: number): BeefTx
|
|
1186
|
+
toWriter(writer: Writer | WriterUint8Array, version: number): void
|
|
1187
|
+
static fromReader(br: Reader | ReaderUint8Array, version: number): BeefTx
|
|
1156
1188
|
}
|
|
1157
1189
|
```
|
|
1158
1190
|
|
|
1159
|
-
See also: [Reader](./primitives.md#class-reader), [Transaction](./transaction.md#class-transaction), [Writer](./primitives.md#class-writer)
|
|
1191
|
+
See also: [Reader](./primitives.md#class-reader), [ReaderUint8Array](./primitives.md#class-readeruint8array), [Transaction](./transaction.md#class-transaction), [Writer](./primitives.md#class-writer), [WriterUint8Array](./primitives.md#class-writeruint8array)
|
|
1160
1192
|
|
|
1161
1193
|
#### Constructor
|
|
1162
1194
|
|
|
1163
1195
|
```ts
|
|
1164
|
-
constructor(tx: Transaction | number[] | string, bumpIndex?: number)
|
|
1196
|
+
constructor(tx: Transaction | Uint8Array | number[] | string, bumpIndex?: number)
|
|
1165
1197
|
```
|
|
1166
1198
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1167
1199
|
|
|
@@ -1293,8 +1325,8 @@ export default class MerklePath {
|
|
|
1293
1325
|
duplicate?: boolean;
|
|
1294
1326
|
}>>;
|
|
1295
1327
|
static fromHex(hex: string): MerklePath
|
|
1296
|
-
static fromReader(reader: Reader, legalOffsetsOnly: boolean = true): MerklePath
|
|
1297
|
-
static fromBinary(bump: number[]): MerklePath
|
|
1328
|
+
static fromReader(reader: Reader | ReaderUint8Array, legalOffsetsOnly: boolean = true): MerklePath
|
|
1329
|
+
static fromBinary(bump: number[] | Uint8Array): MerklePath
|
|
1298
1330
|
static fromCoinbaseTxidAndHeight(txid: string, height: number): MerklePath
|
|
1299
1331
|
constructor(blockHeight: number, path: Array<Array<{
|
|
1300
1332
|
offset: number;
|
|
@@ -1302,7 +1334,9 @@ export default class MerklePath {
|
|
|
1302
1334
|
txid?: boolean;
|
|
1303
1335
|
duplicate?: boolean;
|
|
1304
1336
|
}>>, legalOffsetsOnly: boolean = true)
|
|
1337
|
+
toWriter(writer: Writer | WriterUint8Array): void
|
|
1305
1338
|
toBinary(): number[]
|
|
1339
|
+
toBinaryUint8Array(): Uint8Array
|
|
1306
1340
|
toHex(): string
|
|
1307
1341
|
computeRoot(txid?: string): string
|
|
1308
1342
|
findOrComputeLeaf(height: number, offset: number): MerklePathLeaf | undefined
|
|
@@ -1312,7 +1346,7 @@ export default class MerklePath {
|
|
|
1312
1346
|
}
|
|
1313
1347
|
```
|
|
1314
1348
|
|
|
1315
|
-
See also: [ChainTracker](./transaction.md#interface-chaintracker), [MerklePathLeaf](./transaction.md#interface-merklepathleaf), [Reader](./primitives.md#class-reader), [toHex](./primitives.md#variable-tohex), [verify](./compat.md#variable-verify)
|
|
1349
|
+
See also: [ChainTracker](./transaction.md#interface-chaintracker), [MerklePathLeaf](./transaction.md#interface-merklepathleaf), [Reader](./primitives.md#class-reader), [ReaderUint8Array](./primitives.md#class-readeruint8array), [Writer](./primitives.md#class-writer), [WriterUint8Array](./primitives.md#class-writeruint8array), [toHex](./primitives.md#variable-tohex), [verify](./compat.md#variable-verify)
|
|
1316
1350
|
|
|
1317
1351
|
#### Method combine
|
|
1318
1352
|
|
|
@@ -1369,7 +1403,7 @@ See also: [MerklePathLeaf](./transaction.md#interface-merklepathleaf)
|
|
|
1369
1403
|
Creates a MerklePath instance from a binary array.
|
|
1370
1404
|
|
|
1371
1405
|
```ts
|
|
1372
|
-
static fromBinary(bump: number[]): MerklePath
|
|
1406
|
+
static fromBinary(bump: number[] | Uint8Array): MerklePath
|
|
1373
1407
|
```
|
|
1374
1408
|
See also: [MerklePath](./transaction.md#class-merklepath)
|
|
1375
1409
|
|
|
@@ -1430,6 +1464,18 @@ Returns
|
|
|
1430
1464
|
|
|
1431
1465
|
- The binary array representation of the Merkle Path.
|
|
1432
1466
|
|
|
1467
|
+
#### Method toBinaryUint8Array
|
|
1468
|
+
|
|
1469
|
+
Converts the MerklePath to a binary array format.
|
|
1470
|
+
|
|
1471
|
+
```ts
|
|
1472
|
+
toBinaryUint8Array(): Uint8Array
|
|
1473
|
+
```
|
|
1474
|
+
|
|
1475
|
+
Returns
|
|
1476
|
+
|
|
1477
|
+
- The binary array representation of the Merkle Path.
|
|
1478
|
+
|
|
1433
1479
|
#### Method toHex
|
|
1434
1480
|
|
|
1435
1481
|
Converts the MerklePath to a hexadecimal string format.
|
|
@@ -1442,6 +1488,20 @@ Returns
|
|
|
1442
1488
|
|
|
1443
1489
|
- The hexadecimal string representation of the Merkle Path.
|
|
1444
1490
|
|
|
1491
|
+
#### Method toWriter
|
|
1492
|
+
|
|
1493
|
+
Serializes the MerklePath to the writer provided.
|
|
1494
|
+
|
|
1495
|
+
```ts
|
|
1496
|
+
toWriter(writer: Writer | WriterUint8Array): void
|
|
1497
|
+
```
|
|
1498
|
+
See also: [Writer](./primitives.md#class-writer), [WriterUint8Array](./primitives.md#class-writeruint8array)
|
|
1499
|
+
|
|
1500
|
+
Argument Details
|
|
1501
|
+
|
|
1502
|
+
+ **writer**
|
|
1503
|
+
+ The writer to which the Merkle Path will be serialized.
|
|
1504
|
+
|
|
1445
1505
|
#### Method trim
|
|
1446
1506
|
|
|
1447
1507
|
Remove all internal nodes that are not required by level zero txid nodes.
|
|
@@ -1565,10 +1625,10 @@ export default class Transaction {
|
|
|
1565
1625
|
lockTime: number;
|
|
1566
1626
|
metadata: Record<string, any>;
|
|
1567
1627
|
merklePath?: MerklePath;
|
|
1568
|
-
static fromBEEF(beef: number[], txid?: string): Transaction
|
|
1569
|
-
static fromAtomicBEEF(beef: number[]): Transaction
|
|
1570
|
-
static fromEF(ef: number[]): Transaction
|
|
1571
|
-
static parseScriptOffsets(bin: number[]): {
|
|
1628
|
+
static fromBEEF(beef: number[] | Uint8Array, txid?: string): Transaction
|
|
1629
|
+
static fromAtomicBEEF(beef: number[] | Uint8Array): Transaction
|
|
1630
|
+
static fromEF(ef: number[] | Uint8Array): Transaction
|
|
1631
|
+
static parseScriptOffsets(bin: number[] | Uint8Array): {
|
|
1572
1632
|
inputs: Array<{
|
|
1573
1633
|
vin: number;
|
|
1574
1634
|
offset: number;
|
|
@@ -1580,8 +1640,8 @@ export default class Transaction {
|
|
|
1580
1640
|
length: number;
|
|
1581
1641
|
}>;
|
|
1582
1642
|
}
|
|
1583
|
-
static fromReader(br: Reader): Transaction
|
|
1584
|
-
static fromBinary(bin: number[]): Transaction
|
|
1643
|
+
static fromReader(br: Reader | ReaderUint8Array): Transaction
|
|
1644
|
+
static fromBinary(bin: number[] | Uint8Array): Transaction
|
|
1585
1645
|
static fromHex(hex: string): Transaction
|
|
1586
1646
|
static fromHexEF(hex: string): Transaction
|
|
1587
1647
|
static fromHexBEEF(hex: string, txid?: string): Transaction
|
|
@@ -1597,6 +1657,7 @@ export default class Transaction {
|
|
|
1597
1657
|
toBinary(): number[]
|
|
1598
1658
|
toUint8Array(): Uint8Array
|
|
1599
1659
|
toEF(): number[]
|
|
1660
|
+
toEFUint8Array(): Uint8Array
|
|
1600
1661
|
toHexEF(): string
|
|
1601
1662
|
toHex(): string
|
|
1602
1663
|
toHexBEEF(): string
|
|
@@ -1606,12 +1667,15 @@ export default class Transaction {
|
|
|
1606
1667
|
id(enc: "hex"): string;
|
|
1607
1668
|
id(enc?: "hex"): number[] | string
|
|
1608
1669
|
async verify(chainTracker: ChainTracker | "scripts only" = defaultChainTracker(), feeModel?: FeeModel, memoryLimit?: number): Promise<boolean>
|
|
1670
|
+
writeSerializedBEEF(writer: Writer | WriterUint8Array, allowPartial?: boolean): void
|
|
1609
1671
|
toBEEF(allowPartial?: boolean): number[]
|
|
1672
|
+
toBEEFUint8Array(allowPartial?: boolean): Uint8Array
|
|
1610
1673
|
toAtomicBEEF(allowPartial?: boolean): number[]
|
|
1674
|
+
toAtomicBEEFUint8Array(allowPartial?: boolean): Uint8Array
|
|
1611
1675
|
}
|
|
1612
1676
|
```
|
|
1613
1677
|
|
|
1614
|
-
See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [BroadcastResponse](./transaction.md#interface-broadcastresponse), [Broadcaster](./transaction.md#interface-broadcaster), [ChainTracker](./transaction.md#interface-chaintracker), [FeeModel](./transaction.md#interface-feemodel), [LivePolicy](./transaction.md#class-livepolicy), [MerklePath](./transaction.md#class-merklepath), [Reader](./primitives.md#class-reader), [TransactionInput](./transaction.md#interface-transactioninput), [TransactionOutput](./transaction.md#interface-transactionoutput), [defaultBroadcaster](./transaction.md#function-defaultbroadcaster), [defaultChainTracker](./transaction.md#function-defaultchaintracker), [sign](./compat.md#variable-sign), [toHex](./primitives.md#variable-tohex), [verify](./compat.md#variable-verify)
|
|
1678
|
+
See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [BroadcastResponse](./transaction.md#interface-broadcastresponse), [Broadcaster](./transaction.md#interface-broadcaster), [ChainTracker](./transaction.md#interface-chaintracker), [FeeModel](./transaction.md#interface-feemodel), [LivePolicy](./transaction.md#class-livepolicy), [MerklePath](./transaction.md#class-merklepath), [Reader](./primitives.md#class-reader), [ReaderUint8Array](./primitives.md#class-readeruint8array), [TransactionInput](./transaction.md#interface-transactioninput), [TransactionOutput](./transaction.md#interface-transactionoutput), [Writer](./primitives.md#class-writer), [WriterUint8Array](./primitives.md#class-writeruint8array), [defaultBroadcaster](./transaction.md#function-defaultbroadcaster), [defaultChainTracker](./transaction.md#function-defaultchaintracker), [sign](./compat.md#variable-sign), [toHex](./primitives.md#variable-tohex), [toUint8Array](./primitives.md#variable-touint8array), [verify](./compat.md#variable-verify)
|
|
1615
1679
|
|
|
1616
1680
|
#### Method addInput
|
|
1617
1681
|
|
|
@@ -1703,7 +1767,7 @@ Creates a new transaction from an Atomic BEEF (BRC-95) structure.
|
|
|
1703
1767
|
Extracts the subject transaction and supporting merkle path and source transactions contained in the BEEF data
|
|
1704
1768
|
|
|
1705
1769
|
```ts
|
|
1706
|
-
static fromAtomicBEEF(beef: number[]): Transaction
|
|
1770
|
+
static fromAtomicBEEF(beef: number[] | Uint8Array): Transaction
|
|
1707
1771
|
```
|
|
1708
1772
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1709
1773
|
|
|
@@ -1724,7 +1788,7 @@ If the TXID is provided but not found in the BEEF data, an error will be thrown.
|
|
|
1724
1788
|
If no TXID is provided, the last transaction in the BEEF data is returned, or the atomic txid.
|
|
1725
1789
|
|
|
1726
1790
|
```ts
|
|
1727
|
-
static fromBEEF(beef: number[], txid?: string): Transaction
|
|
1791
|
+
static fromBEEF(beef: number[] | Uint8Array, txid?: string): Transaction
|
|
1728
1792
|
```
|
|
1729
1793
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1730
1794
|
|
|
@@ -1744,7 +1808,7 @@ Argument Details
|
|
|
1744
1808
|
Creates a Transaction instance from a binary array.
|
|
1745
1809
|
|
|
1746
1810
|
```ts
|
|
1747
|
-
static fromBinary(bin: number[]): Transaction
|
|
1811
|
+
static fromBinary(bin: number[] | Uint8Array): Transaction
|
|
1748
1812
|
```
|
|
1749
1813
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1750
1814
|
|
|
@@ -1762,7 +1826,7 @@ Argument Details
|
|
|
1762
1826
|
Creates a new transaction, linked to its inputs and their associated merkle paths, from a EF (BRC-30) structure.
|
|
1763
1827
|
|
|
1764
1828
|
```ts
|
|
1765
|
-
static fromEF(ef: number[]): Transaction
|
|
1829
|
+
static fromEF(ef: number[] | Uint8Array): Transaction
|
|
1766
1830
|
```
|
|
1767
1831
|
See also: [Transaction](./transaction.md#class-transaction)
|
|
1768
1832
|
|
|
@@ -1920,7 +1984,7 @@ This function efficiently parses binary transaction data to determine the offset
|
|
|
1920
1984
|
This supports the efficient retreival of script data from transaction data.
|
|
1921
1985
|
|
|
1922
1986
|
```ts
|
|
1923
|
-
static parseScriptOffsets(bin: number[]): {
|
|
1987
|
+
static parseScriptOffsets(bin: number[] | Uint8Array): {
|
|
1924
1988
|
inputs: Array<{
|
|
1925
1989
|
vin: number;
|
|
1926
1990
|
offset: number;
|
|
@@ -1977,6 +2041,30 @@ Throws
|
|
|
1977
2041
|
|
|
1978
2042
|
Error if there are any missing sourceTransactions unless `allowPartial` is true.
|
|
1979
2043
|
|
|
2044
|
+
#### Method toAtomicBEEFUint8Array
|
|
2045
|
+
|
|
2046
|
+
Serializes this transaction and its inputs into the Atomic BEEF (BRC-95) format.
|
|
2047
|
+
The Atomic BEEF format starts with a 4-byte prefix `0x01010101`, followed by the TXID of the subject transaction,
|
|
2048
|
+
and then the BEEF data containing only the subject transaction and its dependencies.
|
|
2049
|
+
This format ensures that the BEEF structure is atomic and contains no unrelated transactions.
|
|
2050
|
+
|
|
2051
|
+
```ts
|
|
2052
|
+
toAtomicBEEFUint8Array(allowPartial?: boolean): Uint8Array
|
|
2053
|
+
```
|
|
2054
|
+
|
|
2055
|
+
Returns
|
|
2056
|
+
|
|
2057
|
+
- The serialized Atomic BEEF structure.
|
|
2058
|
+
|
|
2059
|
+
Argument Details
|
|
2060
|
+
|
|
2061
|
+
+ **allowPartial**
|
|
2062
|
+
+ If true, error will not be thrown if there are any missing sourceTransactions.
|
|
2063
|
+
|
|
2064
|
+
Throws
|
|
2065
|
+
|
|
2066
|
+
Error if there are any missing sourceTransactions unless `allowPartial` is true.
|
|
2067
|
+
|
|
1980
2068
|
#### Method toBEEF
|
|
1981
2069
|
|
|
1982
2070
|
Serializes this transaction, together with its inputs and the respective merkle proofs, into the BEEF (BRC-62) format. This enables efficient verification of its compliance with the rules of SPV.
|
|
@@ -1998,6 +2086,27 @@ Throws
|
|
|
1998
2086
|
|
|
1999
2087
|
Error if there are any missing sourceTransactions unless `allowPartial` is true.
|
|
2000
2088
|
|
|
2089
|
+
#### Method toBEEFUint8Array
|
|
2090
|
+
|
|
2091
|
+
Serializes this transaction, together with its inputs and the respective merkle proofs, into the BEEF (BRC-62) format. This enables efficient verification of its compliance with the rules of SPV.
|
|
2092
|
+
|
|
2093
|
+
```ts
|
|
2094
|
+
toBEEFUint8Array(allowPartial?: boolean): Uint8Array
|
|
2095
|
+
```
|
|
2096
|
+
|
|
2097
|
+
Returns
|
|
2098
|
+
|
|
2099
|
+
The serialized BEEF structure
|
|
2100
|
+
|
|
2101
|
+
Argument Details
|
|
2102
|
+
|
|
2103
|
+
+ **allowPartial**
|
|
2104
|
+
+ If true, error will not be thrown if there are any missing sourceTransactions.
|
|
2105
|
+
|
|
2106
|
+
Throws
|
|
2107
|
+
|
|
2108
|
+
Error if there are any missing sourceTransactions unless `allowPartial` is true.
|
|
2109
|
+
|
|
2001
2110
|
#### Method toBinary
|
|
2002
2111
|
|
|
2003
2112
|
Converts the transaction to a binary array format.
|
|
@@ -2022,6 +2131,18 @@ Returns
|
|
|
2022
2131
|
|
|
2023
2132
|
- The BRC-30 EF representation of the transaction.
|
|
2024
2133
|
|
|
2134
|
+
#### Method toEFUint8Array
|
|
2135
|
+
|
|
2136
|
+
Converts the transaction to a BRC-30 EF format.
|
|
2137
|
+
|
|
2138
|
+
```ts
|
|
2139
|
+
toEFUint8Array(): Uint8Array
|
|
2140
|
+
```
|
|
2141
|
+
|
|
2142
|
+
Returns
|
|
2143
|
+
|
|
2144
|
+
- The BRC-30 EF representation of the transaction.
|
|
2145
|
+
|
|
2025
2146
|
#### Method toHex
|
|
2026
2147
|
|
|
2027
2148
|
Converts the transaction to a hexadecimal string format.
|
|
@@ -2111,6 +2232,28 @@ Example
|
|
|
2111
2232
|
tx.verify(new WhatsOnChain(), LivePolicy.getInstance())
|
|
2112
2233
|
```
|
|
2113
2234
|
|
|
2235
|
+
#### Method writeSerializedBEEF
|
|
2236
|
+
|
|
2237
|
+
Serializes this transaction, together with its inputs and the respective merkle proofs, into the BEEF (BRC-62) format. This enables efficient verification of its compliance with the rules of SPV.
|
|
2238
|
+
|
|
2239
|
+
```ts
|
|
2240
|
+
writeSerializedBEEF(writer: Writer | WriterUint8Array, allowPartial?: boolean): void
|
|
2241
|
+
```
|
|
2242
|
+
See also: [Writer](./primitives.md#class-writer), [WriterUint8Array](./primitives.md#class-writeruint8array)
|
|
2243
|
+
|
|
2244
|
+
Returns
|
|
2245
|
+
|
|
2246
|
+
The serialized BEEF structure
|
|
2247
|
+
|
|
2248
|
+
Argument Details
|
|
2249
|
+
|
|
2250
|
+
+ **allowPartial**
|
|
2251
|
+
+ If true, error will not be thrown if there are any missing sourceTransactions.
|
|
2252
|
+
|
|
2253
|
+
Throws
|
|
2254
|
+
|
|
2255
|
+
Error if there are any missing sourceTransactions unless `allowPartial` is true.
|
|
2256
|
+
|
|
2114
2257
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2115
2258
|
|
|
2116
2259
|
---
|