@bsv/sdk 1.2.17 → 1.2.18

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.
Files changed (68) hide show
  1. package/dist/cjs/package.json +1 -1
  2. package/dist/cjs/src/primitives/BigNumber.js +85 -89
  3. package/dist/cjs/src/primitives/BigNumber.js.map +1 -1
  4. package/dist/cjs/src/primitives/PublicKey.js +5 -2
  5. package/dist/cjs/src/primitives/PublicKey.js.map +1 -1
  6. package/dist/cjs/src/primitives/Random.js +3 -2
  7. package/dist/cjs/src/primitives/Random.js.map +1 -1
  8. package/dist/cjs/src/primitives/utils.js +71 -62
  9. package/dist/cjs/src/primitives/utils.js.map +1 -1
  10. package/dist/cjs/src/totp/totp.js +0 -1
  11. package/dist/cjs/src/totp/totp.js.map +1 -1
  12. package/dist/cjs/src/transaction/Beef.js +26 -40
  13. package/dist/cjs/src/transaction/Beef.js.map +1 -1
  14. package/dist/cjs/src/transaction/BeefParty.js +1 -1
  15. package/dist/cjs/src/transaction/BeefTx.js +75 -73
  16. package/dist/cjs/src/transaction/BeefTx.js.map +1 -1
  17. package/dist/cjs/src/transaction/Transaction.js +70 -96
  18. package/dist/cjs/src/transaction/Transaction.js.map +1 -1
  19. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  20. package/dist/esm/src/primitives/BigNumber.js +85 -89
  21. package/dist/esm/src/primitives/BigNumber.js.map +1 -1
  22. package/dist/esm/src/primitives/PublicKey.js +5 -2
  23. package/dist/esm/src/primitives/PublicKey.js.map +1 -1
  24. package/dist/esm/src/primitives/Random.js +2 -2
  25. package/dist/esm/src/primitives/Random.js.map +1 -1
  26. package/dist/esm/src/primitives/utils.js +70 -61
  27. package/dist/esm/src/primitives/utils.js.map +1 -1
  28. package/dist/esm/src/totp/totp.js +0 -1
  29. package/dist/esm/src/totp/totp.js.map +1 -1
  30. package/dist/esm/src/transaction/Beef.js +25 -39
  31. package/dist/esm/src/transaction/Beef.js.map +1 -1
  32. package/dist/esm/src/transaction/BeefParty.js +1 -1
  33. package/dist/esm/src/transaction/BeefTx.js +76 -74
  34. package/dist/esm/src/transaction/BeefTx.js.map +1 -1
  35. package/dist/esm/src/transaction/Transaction.js +71 -97
  36. package/dist/esm/src/transaction/Transaction.js.map +1 -1
  37. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  38. package/dist/types/src/primitives/BigNumber.d.ts +24 -22
  39. package/dist/types/src/primitives/BigNumber.d.ts.map +1 -1
  40. package/dist/types/src/primitives/PublicKey.d.ts.map +1 -1
  41. package/dist/types/src/primitives/utils.d.ts +17 -17
  42. package/dist/types/src/primitives/utils.d.ts.map +1 -1
  43. package/dist/types/src/transaction/Beef.d.ts +9 -12
  44. package/dist/types/src/transaction/Beef.d.ts.map +1 -1
  45. package/dist/types/src/transaction/BeefParty.d.ts +1 -1
  46. package/dist/types/src/transaction/BeefTx.d.ts +5 -2
  47. package/dist/types/src/transaction/BeefTx.d.ts.map +1 -1
  48. package/dist/types/src/transaction/Transaction.d.ts +6 -0
  49. package/dist/types/src/transaction/Transaction.d.ts.map +1 -1
  50. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  51. package/dist/umd/bundle.js +1 -1
  52. package/docs/compat.md +13 -11
  53. package/docs/primitives.md +152 -188
  54. package/docs/transaction.md +72 -75
  55. package/package.json +1 -1
  56. package/src/primitives/BigNumber.ts +111 -111
  57. package/src/primitives/PublicKey.ts +5 -2
  58. package/src/primitives/Random.ts +2 -2
  59. package/src/primitives/utils.ts +92 -77
  60. package/src/totp/totp.ts +0 -1
  61. package/src/transaction/Beef.ts +20 -43
  62. package/src/transaction/BeefParty.ts +1 -1
  63. package/src/transaction/BeefTx.ts +89 -57
  64. package/src/transaction/Transaction.ts +77 -100
  65. package/src/transaction/__tests/Beef.test.ts +9 -9
  66. package/src/transaction/__tests/Transaction.benchmarks.test.ts +1 -1
  67. package/src/transaction/__tests/Transaction.test.ts +3 -3
  68. package/src/transaction/broadcasters/__tests/WhatsOnChainBroadcaster.test.ts +2 -2
@@ -1,6 +1,6 @@
1
1
  # API
2
2
 
3
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
3
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
4
4
 
5
5
  ## Interfaces
6
6
 
@@ -19,7 +19,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
19
19
  | [MontgomoryMethod](#class-montgomorymethod) | [SHA1HMAC](#class-sha1hmac) | |
20
20
  | [Point](#class-point) | [SHA256](#class-sha256) | |
21
21
 
22
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
22
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
23
23
 
24
24
  ---
25
25
 
@@ -49,7 +49,7 @@ export default abstract class BasePoint {
49
49
 
50
50
  See also: [Curve](#class-curve)
51
51
 
52
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
52
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
53
53
 
54
54
  ---
55
55
  ### Class: BigNumber
@@ -60,10 +60,10 @@ numbers.
60
60
 
61
61
  ```ts
62
62
  export default class BigNumber {
63
- static zeros: string[]
64
- static groupSizes: number[]
65
- static groupBases: number[]
66
- static wordSize: number = 26;
63
+ public static readonly zeros: string[]
64
+ static readonly groupSizes: number[]
65
+ static readonly groupBases: number[]
66
+ static readonly wordSize: number = 26;
67
67
  negative: number;
68
68
  words: number[];
69
69
  length: number;
@@ -75,9 +75,9 @@ export default class BigNumber {
75
75
  copy(dest: BigNumber): void
76
76
  static move(dest: BigNumber, src: BigNumber): void
77
77
  clone(): BigNumber
78
- expand(size): BigNumber
79
- strip(): BigNumber
80
- normSign(): BigNumber
78
+ expand(size: number): this
79
+ strip(): this
80
+ normSign(): this
81
81
  inspect(): string
82
82
  toString(base: number | "hex" = 10, padding: number = 1): string
83
83
  toNumber(): number
@@ -101,14 +101,14 @@ export default class BigNumber {
101
101
  iand(num: BigNumber): BigNumber
102
102
  and(num: BigNumber): BigNumber
103
103
  uand(num: BigNumber): BigNumber
104
- iuxor(num: BigNumber): BigNumber
105
- ixor(num: BigNumber): BigNumber
104
+ iuxor(num: BigNumber): this
105
+ ixor(num: BigNumber): this
106
106
  xor(num: BigNumber): BigNumber
107
107
  uxor(num: BigNumber): BigNumber
108
108
  inotn(width: number): BigNumber
109
109
  notn(width: number): BigNumber
110
- setn(bit: number, val: 0 | 1 | true | false): BigNumber
111
- iadd(num: BigNumber): BigNumber
110
+ setn(bit: number, val: 0 | 1 | true | false): this
111
+ iadd(num: BigNumber): this
112
112
  add(num: BigNumber): BigNumber
113
113
  isub(num: BigNumber): BigNumber
114
114
  sub(num: BigNumber): BigNumber
@@ -121,24 +121,24 @@ export default class BigNumber {
121
121
  sqr(): BigNumber
122
122
  isqr(): BigNumber
123
123
  pow(num: BigNumber): BigNumber
124
- iushln(bits: number): BigNumber
125
- ishln(bits: number): BigNumber
126
- iushrn(bits: number, hint?: number, extended?: BigNumber): BigNumber
127
- ishrn(bits, hint?, extended?): BigNumber
124
+ iushln(bits: number): this
125
+ ishln(bits: number): this
126
+ iushrn(bits: number, hint?: number, extended?: BigNumber): this
127
+ ishrn(bits, hint?, extended?): this
128
128
  shln(bits): BigNumber
129
129
  ushln(bits): BigNumber
130
130
  shrn(bits): BigNumber
131
131
  ushrn(bits): BigNumber
132
132
  testn(bit: number): boolean
133
- imaskn(bits): BigNumber
133
+ imaskn(bits): this
134
134
  maskn(bits): BigNumber
135
135
  iaddn(num: number): BigNumber
136
136
  isubn(num: number): BigNumber
137
137
  addn(num: number): BigNumber
138
138
  subn(num: number): BigNumber
139
- iabs(): BigNumber
139
+ iabs(): this
140
140
  abs(): BigNumber
141
- _ishlnsubmul(num: BigNumber, mul, shift: number): BigNumber
141
+ _ishlnsubmul(num: BigNumber, mul, shift: number): this
142
142
  divmod(num: BigNumber, mode?: "div" | "mod", positive?: boolean): any
143
143
  div(num: BigNumber): BigNumber
144
144
  mod(num: BigNumber): BigNumber
@@ -158,7 +158,7 @@ export default class BigNumber {
158
158
  isEven(): boolean
159
159
  isOdd(): boolean
160
160
  andln(num: number): number
161
- bincn(bit: number): BigNumber
161
+ bincn(bit: number): this
162
162
  isZero(): boolean
163
163
  cmpn(num: number): 1 | 0 | -1
164
164
  cmp(num: BigNumber): 1 | 0 | -1
@@ -175,7 +175,7 @@ export default class BigNumber {
175
175
  eq(num: BigNumber): boolean
176
176
  toRed(ctx: ReductionContext): BigNumber
177
177
  fromRed(): BigNumber
178
- forceRed(ctx: ReductionContext): BigNumber
178
+ forceRed(ctx: ReductionContext): this
179
179
  redAdd(num: BigNumber): BigNumber
180
180
  redIAdd(num: BigNumber): BigNumber
181
181
  redSub(num: BigNumber): BigNumber
@@ -277,7 +277,7 @@ See also: [ReductionContext](#class-reductioncontext)
277
277
  The word size of big number chunks.
278
278
 
279
279
  ```ts
280
- static wordSize: number = 26
280
+ static readonly wordSize: number = 26
281
281
  ```
282
282
 
283
283
  Example
@@ -334,7 +334,7 @@ Perform an in-place shift left, subtract, and multiply operation on a BigNumber
334
334
  This method modifies the existing BigNumber instance.
335
335
 
336
336
  ```ts
337
- _ishlnsubmul(num: BigNumber, mul, shift: number): BigNumber
337
+ _ishlnsubmul(num: BigNumber, mul, shift: number): this
338
338
  ```
339
339
  See also: [BigNumber](#class-bignumber)
340
340
 
@@ -490,9 +490,8 @@ let result = a.andln(13); // 12
490
490
  Increments the value at the bit position specified by the input parameter.
491
491
 
492
492
  ```ts
493
- bincn(bit: number): BigNumber
493
+ bincn(bit: number): this
494
494
  ```
495
- See also: [BigNumber](#class-bignumber)
496
495
 
497
496
  Returns
498
497
 
@@ -835,9 +834,8 @@ let isEqual = bigNumber.eqn(1234); // Returns true
835
834
  Increases the BigNumber length up to a certain size and initializes new elements with 0.
836
835
 
837
836
  ```ts
838
- expand(size): BigNumber
837
+ expand(size: number): this
839
838
  ```
840
- See also: [BigNumber](#class-bignumber)
841
839
 
842
840
  Returns
843
841
 
@@ -860,9 +858,9 @@ bn.expand(10);
860
858
  Forces the current BigNumber into a reduction context, irrespective of the BigNumber's current state.
861
859
 
862
860
  ```ts
863
- forceRed(ctx: ReductionContext): BigNumber
861
+ forceRed(ctx: ReductionContext): this
864
862
  ```
865
- See also: [BigNumber](#class-bignumber), [ReductionContext](#class-reductioncontext)
863
+ See also: [ReductionContext](#class-reductioncontext)
866
864
 
867
865
  Returns
868
866
 
@@ -1254,9 +1252,8 @@ let isGreater = bigNumber.gtn(1234); // Returns true
1254
1252
  Performs an in-place operation to make the BigNumber an absolute value.
1255
1253
 
1256
1254
  ```ts
1257
- iabs(): BigNumber
1255
+ iabs(): this
1258
1256
  ```
1259
- See also: [BigNumber](#class-bignumber)
1260
1257
 
1261
1258
  Returns
1262
1259
 
@@ -1274,7 +1271,7 @@ myNumber.iabs(); // myNumber becomes 50.
1274
1271
  Add `num` to `this` BigNumber in-place.
1275
1272
 
1276
1273
  ```ts
1277
- iadd(num: BigNumber): BigNumber
1274
+ iadd(num: BigNumber): this
1278
1275
  ```
1279
1276
  See also: [BigNumber](#class-bignumber)
1280
1277
 
@@ -1385,9 +1382,8 @@ bigNum.idivn(num); // the bigNum here directly becomes '2'
1385
1382
  Performs an in-place operation to keep only the lower bits of the number.
1386
1383
 
1387
1384
  ```ts
1388
- imaskn(bits): BigNumber
1385
+ imaskn(bits): this
1389
1386
  ```
1390
- See also: [BigNumber](#class-bignumber)
1391
1387
 
1392
1388
  Returns
1393
1389
 
@@ -1696,9 +1692,8 @@ let isZero = a.isZero(); // true
1696
1692
  Performs an in-place left shift operation on the BigNumber instance only if it is non-negative.
1697
1693
 
1698
1694
  ```ts
1699
- ishln(bits: number): BigNumber
1695
+ ishln(bits: number): this
1700
1696
  ```
1701
- See also: [BigNumber](#class-bignumber)
1702
1697
 
1703
1698
  Returns
1704
1699
 
@@ -1721,9 +1716,8 @@ myNumber.ishln(2); // Returns BigNumber of value 16
1721
1716
  Performs an in-place right shift operation on the BigNumber instance only if it is non-negative.
1722
1717
 
1723
1718
  ```ts
1724
- ishrn(bits, hint?, extended?): BigNumber
1719
+ ishrn(bits, hint?, extended?): this
1725
1720
  ```
1726
- See also: [BigNumber](#class-bignumber)
1727
1721
 
1728
1722
  Returns
1729
1723
 
@@ -1882,9 +1876,8 @@ bn1.iuor(bn2); // now, bn1 binary: 1110
1882
1876
  Performs in-place bitwise left shift operation on the BigNumber instance.
1883
1877
 
1884
1878
  ```ts
1885
- iushln(bits: number): BigNumber
1879
+ iushln(bits: number): this
1886
1880
  ```
1887
- See also: [BigNumber](#class-bignumber)
1888
1881
 
1889
1882
  Returns
1890
1883
 
@@ -1907,7 +1900,7 @@ myNumber.iushln(2); // Returns BigNumber of value 16
1907
1900
  Performs an in-place unsigned bitwise right shift operation on the BigNumber instance.
1908
1901
 
1909
1902
  ```ts
1910
- iushrn(bits: number, hint?: number, extended?: BigNumber): BigNumber
1903
+ iushrn(bits: number, hint?: number, extended?: BigNumber): this
1911
1904
  ```
1912
1905
  See also: [BigNumber](#class-bignumber)
1913
1906
 
@@ -1938,7 +1931,7 @@ in-place with the provided BigNumber. It keeps the bits set in the result only i
1938
1931
  corresponding bits in the operands are different.
1939
1932
 
1940
1933
  ```ts
1941
- iuxor(num: BigNumber): BigNumber
1934
+ iuxor(num: BigNumber): this
1942
1935
  ```
1943
1936
  See also: [BigNumber](#class-bignumber)
1944
1937
 
@@ -1967,7 +1960,7 @@ instance only if neither operand is negative. This method is similar to the iuxo
1967
1960
  checks for negative values before operation.
1968
1961
 
1969
1962
  ```ts
1970
- ixor(num: BigNumber): BigNumber
1963
+ ixor(num: BigNumber): this
1971
1964
  ```
1972
1965
  See also: [BigNumber](#class-bignumber)
1973
1966
 
@@ -2355,9 +2348,8 @@ const neg = bn.neg(); // -1234
2355
2348
  Normalizes the sign of the BigNumber. Changes -0 to 0.
2356
2349
 
2357
2350
  ```ts
2358
- normSign(): BigNumber
2351
+ normSign(): this
2359
2352
  ```
2360
- See also: [BigNumber](#class-bignumber)
2361
2353
 
2362
2354
  Returns
2363
2355
 
@@ -2821,9 +2813,8 @@ Set `bit` of `this` BigNumber. The `bit` is a position in the binary representat
2821
2813
  and `val` is the value to be set at that position (`0` or `1`).
2822
2814
 
2823
2815
  ```ts
2824
- setn(bit: number, val: 0 | 1 | true | false): BigNumber
2816
+ setn(bit: number, val: 0 | 1 | true | false): this
2825
2817
  ```
2826
- See also: [BigNumber](#class-bignumber)
2827
2818
 
2828
2819
  Returns
2829
2820
 
@@ -2921,9 +2912,8 @@ const result = bn.sqr();
2921
2912
  Removes leading zeros.
2922
2913
 
2923
2914
  ```ts
2924
- strip(): BigNumber
2915
+ strip(): this
2925
2916
  ```
2926
- See also: [BigNumber](#class-bignumber)
2927
2917
 
2928
2918
  Returns
2929
2919
 
@@ -3537,7 +3527,7 @@ const zeroBits = bn.zeroBits(); // 3
3537
3527
 
3538
3528
  </details>
3539
3529
 
3540
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
3530
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
3541
3531
 
3542
3532
  ---
3543
3533
  ### Class: Curve
@@ -3607,7 +3597,7 @@ export default class Curve {
3607
3597
 
3608
3598
  See also: [BigNumber](#class-bignumber), [Point](#class-point), [ReductionContext](#class-reductioncontext)
3609
3599
 
3610
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
3600
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
3611
3601
 
3612
3602
  ---
3613
3603
  ### Class: DRBG
@@ -3706,7 +3696,7 @@ drbg.update('e13af...');
3706
3696
 
3707
3697
  </details>
3708
3698
 
3709
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
3699
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
3710
3700
 
3711
3701
  ---
3712
3702
  ### Class: JacobianPoint
@@ -4047,7 +4037,7 @@ const pointP = pointJ.toP(); // The point in affine coordinates.
4047
4037
 
4048
4038
  </details>
4049
4039
 
4050
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
4040
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
4051
4041
 
4052
4042
  ---
4053
4043
  ### Class: K256
@@ -4144,7 +4134,7 @@ k256.split(input, output);
4144
4134
 
4145
4135
  </details>
4146
4136
 
4147
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
4137
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
4148
4138
 
4149
4139
  ---
4150
4140
  ### Class: KeyShares
@@ -4168,7 +4158,7 @@ export class KeyShares {
4168
4158
 
4169
4159
  See also: [PointInFiniteField](#class-pointinfinitefield)
4170
4160
 
4171
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
4161
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
4172
4162
 
4173
4163
  ---
4174
4164
  ### Class: Mersenne
@@ -4322,7 +4312,7 @@ mersenne.split(new BigNumber('2345', 16), new BigNumber());
4322
4312
 
4323
4313
  </details>
4324
4314
 
4325
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
4315
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
4326
4316
 
4327
4317
  ---
4328
4318
  ### Class: MontgomoryMethod
@@ -4545,7 +4535,7 @@ const product = montMethod.mul(a, b);
4545
4535
 
4546
4536
  </details>
4547
4537
 
4548
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
4538
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
4549
4539
 
4550
4540
  ---
4551
4541
  ### Class: Point
@@ -5180,7 +5170,7 @@ const isValid = aPoint.validate();
5180
5170
 
5181
5171
  </details>
5182
5172
 
5183
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
5173
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
5184
5174
 
5185
5175
  ---
5186
5176
  ### Class: PointInFiniteField
@@ -5211,7 +5201,7 @@ toString(): string
5211
5201
 
5212
5202
  </details>
5213
5203
 
5214
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
5204
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
5215
5205
 
5216
5206
  ---
5217
5207
  ### Class: Polynomial
@@ -5241,7 +5231,7 @@ export default class Polynomial {
5241
5231
 
5242
5232
  See also: [BigNumber](#class-bignumber), [PointInFiniteField](#class-pointinfinitefield), [PrivateKey](#class-privatekey)
5243
5233
 
5244
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
5234
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
5245
5235
 
5246
5236
  ---
5247
5237
  ### Class: PrivateKey
@@ -5747,7 +5737,7 @@ const isSignatureValid = privateKey.verify('Hello, World!', signature);
5747
5737
 
5748
5738
  </details>
5749
5739
 
5750
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
5740
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
5751
5741
 
5752
5742
  ---
5753
5743
  ### Class: PublicKey
@@ -6057,7 +6047,7 @@ const isVerified = myPubKey.verify(myMessage, mySignature)
6057
6047
 
6058
6048
  </details>
6059
6049
 
6060
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
6050
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
6061
6051
 
6062
6052
  ---
6063
6053
  ### Class: RIPEMD160
@@ -6097,7 +6087,7 @@ h: number[]
6097
6087
 
6098
6088
  </details>
6099
6089
 
6100
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
6090
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
6101
6091
 
6102
6092
  ---
6103
6093
  ### Class: Reader
@@ -6130,7 +6120,7 @@ export class Reader {
6130
6120
 
6131
6121
  See also: [BigNumber](#class-bignumber)
6132
6122
 
6133
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
6123
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
6134
6124
 
6135
6125
  ---
6136
6126
  ### Class: ReductionContext
@@ -6686,7 +6676,7 @@ this.verify2(new BigNumber(10).toRed(this), new BigNumber(20)); //throws an Erro
6686
6676
 
6687
6677
  </details>
6688
6678
 
6689
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
6679
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
6690
6680
 
6691
6681
  ---
6692
6682
  ### Class: SHA1
@@ -6744,7 +6734,7 @@ k: number[]
6744
6734
 
6745
6735
  </details>
6746
6736
 
6747
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
6737
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
6748
6738
 
6749
6739
  ---
6750
6740
  ### Class: SHA1HMAC
@@ -6763,7 +6753,7 @@ export class SHA1HMAC {
6763
6753
 
6764
6754
  See also: [SHA1](#class-sha1)
6765
6755
 
6766
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
6756
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
6767
6757
 
6768
6758
  ---
6769
6759
  ### Class: SHA256
@@ -6822,7 +6812,7 @@ k: number[]
6822
6812
 
6823
6813
  </details>
6824
6814
 
6825
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
6815
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
6826
6816
 
6827
6817
  ---
6828
6818
  ### Class: SHA256HMAC
@@ -6973,7 +6963,7 @@ myHMAC.update('deadbeef', 'hex');
6973
6963
 
6974
6964
  </details>
6975
6965
 
6976
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
6966
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
6977
6967
 
6978
6968
  ---
6979
6969
  ### Class: SHA512
@@ -7032,7 +7022,7 @@ k: number[]
7032
7022
 
7033
7023
  </details>
7034
7024
 
7035
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7025
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7036
7026
 
7037
7027
  ---
7038
7028
  ### Class: SHA512HMAC
@@ -7183,7 +7173,7 @@ myHMAC.update('deadbeef', 'hex');
7183
7173
 
7184
7174
  </details>
7185
7175
 
7186
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7176
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7187
7177
 
7188
7178
  ---
7189
7179
  ### Class: Schnorr
@@ -7297,7 +7287,7 @@ Argument Details
7297
7287
 
7298
7288
  </details>
7299
7289
 
7300
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7290
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7301
7291
 
7302
7292
  ---
7303
7293
  ### Class: Signature
@@ -7591,7 +7581,7 @@ const isVerified = signature.verify(msg, publicKey);
7591
7581
 
7592
7582
  </details>
7593
7583
 
7594
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7584
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7595
7585
 
7596
7586
  ---
7597
7587
  ### Class: SymmetricKey
@@ -7695,7 +7685,7 @@ const symmetricKey = SymmetricKey.fromRandom();
7695
7685
 
7696
7686
  </details>
7697
7687
 
7698
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7688
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7699
7689
 
7700
7690
  ---
7701
7691
  ### Class: TransactionSignature
@@ -7746,7 +7736,7 @@ public hasLowS(): boolean
7746
7736
 
7747
7737
  </details>
7748
7738
 
7749
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7739
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7750
7740
 
7751
7741
  ---
7752
7742
  ### Class: Writer
@@ -7757,23 +7747,23 @@ export class Writer {
7757
7747
  constructor(bufs?: number[][])
7758
7748
  getLength(): number
7759
7749
  toArray(): number[]
7760
- write(buf: number[]): Writer
7761
- writeReverse(buf: number[]): Writer
7762
- writeUInt8(n: number): Writer
7763
- writeInt8(n: number): Writer
7764
- writeUInt16BE(n: number): Writer
7765
- writeInt16BE(n: number): Writer
7766
- writeUInt16LE(n: number): Writer
7767
- writeInt16LE(n: number): Writer
7768
- writeUInt32BE(n: number): Writer
7769
- writeInt32BE(n: number): Writer
7770
- writeUInt32LE(n: number): Writer
7771
- writeInt32LE(n: number): Writer
7772
- writeUInt64BEBn(bn: BigNumber): Writer
7773
- writeUInt64LEBn(bn: BigNumber): Writer
7774
- writeUInt64LE(n: number): Writer
7775
- writeVarIntNum(n: number): Writer
7776
- writeVarIntBn(bn: BigNumber): Writer
7750
+ write(buf: number[]): this
7751
+ writeReverse(buf: number[]): this
7752
+ writeUInt8(n: number): this
7753
+ writeInt8(n: number): this
7754
+ writeUInt16BE(n: number): this
7755
+ writeInt16BE(n: number): this
7756
+ writeUInt16LE(n: number): this
7757
+ writeInt16LE(n: number): this
7758
+ writeUInt32BE(n: number): this
7759
+ writeInt32BE(n: number): this
7760
+ writeUInt32LE(n: number): this
7761
+ writeInt32LE(n: number): this
7762
+ writeUInt64BEBn(bn: BigNumber): this
7763
+ writeUInt64LEBn(bn: BigNumber): this
7764
+ writeUInt64LE(n: number): this
7765
+ writeVarIntNum(n: number): this
7766
+ writeVarIntBn(bn: BigNumber): this
7777
7767
  static varIntNum(n: number): number[]
7778
7768
  static varIntBn(bn: BigNumber): number[]
7779
7769
  }
@@ -7781,7 +7771,7 @@ export class Writer {
7781
7771
 
7782
7772
  See also: [BigNumber](#class-bignumber), [toArray](#variable-toarray)
7783
7773
 
7784
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7774
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7785
7775
 
7786
7776
  ---
7787
7777
  ## Functions
@@ -7796,7 +7786,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
7796
7786
  | [toArray](#function-toarray) |
7797
7787
  | [toBase64](#function-tobase64) |
7798
7788
 
7799
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7789
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7800
7790
 
7801
7791
  ---
7802
7792
 
@@ -7806,7 +7796,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
7806
7796
  export function AES(input: number[], key: number[]): number[]
7807
7797
  ```
7808
7798
 
7809
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7799
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7810
7800
 
7811
7801
  ---
7812
7802
  ### Function: AESGCM
@@ -7818,7 +7808,7 @@ export function AESGCM(plainText: number[], additionalAuthenticatedData: number[
7818
7808
  }
7819
7809
  ```
7820
7810
 
7821
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7811
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7822
7812
 
7823
7813
  ---
7824
7814
  ### Function: AESGCMDecrypt
@@ -7827,7 +7817,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
7827
7817
  export function AESGCMDecrypt(cipherText: number[], additionalAuthenticatedData: number[], initializationVector: number[], authenticationTag: number[], key: number[]): number[] | null
7828
7818
  ```
7829
7819
 
7830
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7820
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7831
7821
 
7832
7822
  ---
7833
7823
  ### Function: ghash
@@ -7836,7 +7826,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
7836
7826
  export function ghash(input: number[], hashSubKey: number[]): number[]
7837
7827
  ```
7838
7828
 
7839
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7829
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7840
7830
 
7841
7831
  ---
7842
7832
  ### Function: pbkdf2
@@ -7870,7 +7860,7 @@ Argument Details
7870
7860
 
7871
7861
  </details>
7872
7862
 
7873
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7863
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7874
7864
 
7875
7865
  ---
7876
7866
  ### Function: toArray
@@ -7894,7 +7884,7 @@ Argument Details
7894
7884
 
7895
7885
  </details>
7896
7886
 
7897
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7887
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7898
7888
 
7899
7889
  ---
7900
7890
  ### Function: toBase64
@@ -7927,11 +7917,13 @@ Argument Details
7927
7917
 
7928
7918
  </details>
7929
7919
 
7930
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7920
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7931
7921
 
7932
7922
  ---
7933
7923
  ## Types
7934
7924
 
7925
+ ## Enums
7926
+
7935
7927
  ## Variables
7936
7928
 
7937
7929
  | | | |
@@ -7946,7 +7938,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
7946
7938
  | [hash256](#variable-hash256) | [sha512](#variable-sha512) | [zero2](#variable-zero2) |
7947
7939
  | [incrementLeastSignificantThirtyTwoBits](#variable-incrementleastsignificantthirtytwobits) | [sha512hmac](#variable-sha512hmac) | |
7948
7940
 
7949
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7941
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7950
7942
 
7951
7943
  ---
7952
7944
 
@@ -7958,7 +7950,7 @@ checkBit = function (byteArray: number[], byteIndex: number, bitIndex: number):
7958
7950
  }
7959
7951
  ```
7960
7952
 
7961
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7953
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7962
7954
 
7963
7955
  ---
7964
7956
  ### Variable: encode
@@ -7978,7 +7970,7 @@ encode = (arr: number[], enc?: "hex" | "utf8"): string | number[] => {
7978
7970
 
7979
7971
  See also: [toHex](#variable-tohex), [toUTF8](#variable-toutf8)
7980
7972
 
7981
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7973
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7982
7974
 
7983
7975
  ---
7984
7976
  ### Variable: exclusiveOR
@@ -7994,7 +7986,7 @@ exclusiveOR = function (block0: number[], block1: number[]): number[] {
7994
7986
  }
7995
7987
  ```
7996
7988
 
7997
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7989
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
7998
7990
 
7999
7991
  ---
8000
7992
  ### Variable: fromBase58
@@ -8013,7 +8005,7 @@ fromBase58 = (str: string): number[] => {
8013
8005
  const uint8 = new Uint8Array([
8014
8006
  ...new Uint8Array(psz),
8015
8007
  ...str
8016
- .match(/.{1}/gmu)
8008
+ .match(/./gmu)
8017
8009
  .map((i) => base58chars.indexOf(i))
8018
8010
  .reduce((acc, i) => {
8019
8011
  acc = acc.map((j) => {
@@ -8030,7 +8022,7 @@ fromBase58 = (str: string): number[] => {
8030
8022
  }
8031
8023
  ```
8032
8024
 
8033
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8025
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8034
8026
 
8035
8027
  ---
8036
8028
  ### Variable: fromBase58Check
@@ -8057,7 +8049,7 @@ fromBase58Check = (str: string, enc?: "hex", prefixLength: number = 1) => {
8057
8049
 
8058
8050
  See also: [fromBase58](#variable-frombase58), [hash256](#variable-hash256), [toHex](#variable-tohex)
8059
8051
 
8060
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8052
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8061
8053
 
8062
8054
  ---
8063
8055
  ### Variable: getBytes
@@ -8073,7 +8065,7 @@ getBytes = function (numericValue: number): number[] {
8073
8065
  }
8074
8066
  ```
8075
8067
 
8076
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8068
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8077
8069
 
8078
8070
  ---
8079
8071
  ### Variable: hash160
@@ -8087,7 +8079,7 @@ hash160 = (msg: number[] | string, enc?: "hex" | "utf8"): number[] => {
8087
8079
 
8088
8080
  See also: [RIPEMD160](#class-ripemd160), [SHA256](#class-sha256)
8089
8081
 
8090
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8082
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8091
8083
 
8092
8084
  ---
8093
8085
  ### Variable: hash256
@@ -8101,7 +8093,7 @@ hash256 = (msg: number[] | string, enc?: "hex" | "utf8"): number[] => {
8101
8093
 
8102
8094
  See also: [SHA256](#class-sha256)
8103
8095
 
8104
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8096
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8105
8097
 
8106
8098
  ---
8107
8099
  ### Variable: incrementLeastSignificantThirtyTwoBits
@@ -8123,7 +8115,7 @@ incrementLeastSignificantThirtyTwoBits = function (block: number[]): number[] {
8123
8115
  }
8124
8116
  ```
8125
8117
 
8126
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8118
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8127
8119
 
8128
8120
  ---
8129
8121
  ### Variable: minimallyEncode
@@ -8146,19 +8138,20 @@ minimallyEncode = (buf: number[]): number[] => {
8146
8138
  for (let i = buf.length - 1; i > 0; i--) {
8147
8139
  if (buf[i - 1] !== 0) {
8148
8140
  if ((buf[i - 1] & 128) !== 0) {
8149
- buf[i++] = last;
8141
+ buf[i] = last;
8142
+ return buf.slice(0, i + 1);
8150
8143
  }
8151
8144
  else {
8152
8145
  buf[i - 1] |= last;
8146
+ return buf.slice(0, i);
8153
8147
  }
8154
- return buf.slice(0, i);
8155
8148
  }
8156
8149
  }
8157
8150
  return [];
8158
8151
  }
8159
8152
  ```
8160
8153
 
8161
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8154
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8162
8155
 
8163
8156
  ---
8164
8157
  ### Variable: multiply
@@ -8188,7 +8181,7 @@ multiply = function (block0: number[], block1: number[]): number[] {
8188
8181
 
8189
8182
  See also: [checkBit](#variable-checkbit), [exclusiveOR](#variable-exclusiveor), [rightShift](#variable-rightshift)
8190
8183
 
8191
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8184
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8192
8185
 
8193
8186
  ---
8194
8187
  ### Variable: rightShift
@@ -8210,7 +8203,7 @@ rightShift = function (block: number[]): number[] {
8210
8203
  }
8211
8204
  ```
8212
8205
 
8213
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8206
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8214
8207
 
8215
8208
  ---
8216
8209
  ### Variable: ripemd160
@@ -8223,7 +8216,7 @@ ripemd160 = (msg: number[] | string, enc?: "hex" | "utf8"): number[] => {
8223
8216
 
8224
8217
  See also: [RIPEMD160](#class-ripemd160)
8225
8218
 
8226
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8219
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8227
8220
 
8228
8221
  ---
8229
8222
  ### Variable: sha1
@@ -8236,7 +8229,7 @@ sha1 = (msg: number[] | string, enc?: "hex" | "utf8"): number[] => {
8236
8229
 
8237
8230
  See also: [SHA1](#class-sha1)
8238
8231
 
8239
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8232
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8240
8233
 
8241
8234
  ---
8242
8235
  ### Variable: sha256
@@ -8249,7 +8242,7 @@ sha256 = (msg: number[] | string, enc?: "hex" | "utf8"): number[] => {
8249
8242
 
8250
8243
  See also: [SHA256](#class-sha256)
8251
8244
 
8252
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8245
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8253
8246
 
8254
8247
  ---
8255
8248
  ### Variable: sha256hmac
@@ -8262,7 +8255,7 @@ sha256hmac = (key: number[] | string, msg: number[] | string, enc?: "hex"): numb
8262
8255
 
8263
8256
  See also: [SHA256HMAC](#class-sha256hmac)
8264
8257
 
8265
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8258
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8266
8259
 
8267
8260
  ---
8268
8261
  ### Variable: sha512
@@ -8275,7 +8268,7 @@ sha512 = (msg: number[] | string, enc?: "hex" | "utf8"): number[] => {
8275
8268
 
8276
8269
  See also: [SHA512](#class-sha512)
8277
8270
 
8278
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8271
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8279
8272
 
8280
8273
  ---
8281
8274
  ### Variable: sha512hmac
@@ -8288,7 +8281,7 @@ sha512hmac = (key: number[] | string, msg: number[] | string, enc?: "hex"): numb
8288
8281
 
8289
8282
  See also: [SHA512HMAC](#class-sha512hmac)
8290
8283
 
8291
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8284
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8292
8285
 
8293
8286
  ---
8294
8287
  ### Variable: sign
@@ -8536,69 +8529,32 @@ sign = (msg: BigNumber, key: BigNumber, forceLowS: boolean = false, customK?: Bi
8536
8529
 
8537
8530
  See also: [BigNumber](#class-bignumber), [Curve](#class-curve), [DRBG](#class-drbg), [Signature](#class-signature), [toArray](#variable-toarray)
8538
8531
 
8539
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8532
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8540
8533
 
8541
8534
  ---
8542
8535
  ### Variable: toArray
8543
8536
 
8544
8537
  ```ts
8545
8538
  toArray = (msg: any, enc?: "hex" | "utf8" | "base64"): any[] => {
8546
- if (Array.isArray(msg)) {
8539
+ if (Array.isArray(msg))
8547
8540
  return msg.slice();
8548
- }
8549
- if (!(msg as boolean)) {
8541
+ if (!msg)
8550
8542
  return [];
8551
- }
8552
- const res: any[] = [];
8553
8543
  if (typeof msg !== "string") {
8554
- for (let i = 0; i < msg.length; i++) {
8555
- res[i] = msg[i] | 0;
8556
- }
8557
- return res;
8544
+ return Array.from(msg, (item: any) => item | 0);
8558
8545
  }
8559
- if (enc === "hex") {
8560
- msg = msg.replace(/[^a-z0-9]+/ig, "");
8561
- if (msg.length % 2 !== 0) {
8562
- msg = "0" + (msg as string);
8563
- }
8564
- for (let i = 0; i < msg.length; i += 2) {
8565
- res.push(parseInt((msg[i] as string) + (msg[i + 1] as string), 16));
8566
- }
8567
- }
8568
- else if (enc === "base64") {
8569
- const base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
8570
- const result: number[] = [];
8571
- let currentBit: number = 0;
8572
- let currentByte: number = 0;
8573
- for (const char of msg.replace(/=+$/, "")) {
8574
- currentBit = (currentBit << 6) | base64Chars.indexOf(char);
8575
- currentByte += 6;
8576
- if (currentByte >= 8) {
8577
- currentByte -= 8;
8578
- result.push((currentBit >> currentByte) & 255);
8579
- currentBit &= (1 << currentByte) - 1;
8580
- }
8581
- }
8582
- return result;
8583
- }
8584
- else {
8585
- for (let i = 0; i < msg.length; i++) {
8586
- const c = msg.charCodeAt(i);
8587
- const hi = c >> 8;
8588
- const lo = c & 255;
8589
- if (hi as unknown as boolean) {
8590
- res.push(hi, lo);
8591
- }
8592
- else {
8593
- res.push(lo);
8594
- }
8595
- }
8546
+ switch (enc) {
8547
+ case "hex":
8548
+ return hexToArray(msg);
8549
+ case "base64":
8550
+ return base64ToArray(msg);
8551
+ default:
8552
+ return utf8ToArray(msg);
8596
8553
  }
8597
- return res;
8598
8554
  }
8599
8555
  ```
8600
8556
 
8601
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8557
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8602
8558
 
8603
8559
  ---
8604
8560
  ### Variable: toBase58
@@ -8633,7 +8589,7 @@ toBase58 = (bin: number[]): string => {
8633
8589
  }
8634
8590
  ```
8635
8591
 
8636
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8592
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8637
8593
 
8638
8594
  ---
8639
8595
  ### Variable: toBase58Check
@@ -8648,7 +8604,7 @@ toBase58Check = (bin: number[], prefix: number[] = [0]) => {
8648
8604
 
8649
8605
  See also: [hash256](#variable-hash256), [toBase58](#variable-tobase58)
8650
8606
 
8651
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8607
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8652
8608
 
8653
8609
  ---
8654
8610
  ### Variable: toHex
@@ -8656,8 +8612,8 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
8656
8612
  ```ts
8657
8613
  toHex = (msg: number[]): string => {
8658
8614
  let res = "";
8659
- for (let i = 0; i < msg.length; i++) {
8660
- res += zero2(msg[i].toString(16));
8615
+ for (const num of msg) {
8616
+ res += zero2(num.toString(16));
8661
8617
  }
8662
8618
  return res;
8663
8619
  }
@@ -8665,7 +8621,7 @@ toHex = (msg: number[]): string => {
8665
8621
 
8666
8622
  See also: [zero2](#variable-zero2)
8667
8623
 
8668
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8624
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8669
8625
 
8670
8626
  ---
8671
8627
  ### Variable: toUTF8
@@ -8673,26 +8629,34 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
8673
8629
  ```ts
8674
8630
  toUTF8 = (arr: number[]): string => {
8675
8631
  let result = "";
8632
+ let skip = 0;
8676
8633
  for (let i = 0; i < arr.length; i++) {
8677
8634
  const byte = arr[i];
8635
+ if (skip > 0) {
8636
+ skip--;
8637
+ continue;
8638
+ }
8678
8639
  if (byte <= 127) {
8679
8640
  result += String.fromCharCode(byte);
8680
8641
  }
8681
8642
  else if (byte >= 192 && byte <= 223) {
8682
- const byte2 = arr[++i];
8643
+ const byte2 = arr[i + 1];
8644
+ skip = 1;
8683
8645
  const codePoint = ((byte & 31) << 6) | (byte2 & 63);
8684
8646
  result += String.fromCharCode(codePoint);
8685
8647
  }
8686
8648
  else if (byte >= 224 && byte <= 239) {
8687
- const byte2 = arr[++i];
8688
- const byte3 = arr[++i];
8649
+ const byte2 = arr[i + 1];
8650
+ const byte3 = arr[i + 2];
8651
+ skip = 2;
8689
8652
  const codePoint = ((byte & 15) << 12) | ((byte2 & 63) << 6) | (byte3 & 63);
8690
8653
  result += String.fromCharCode(codePoint);
8691
8654
  }
8692
8655
  else if (byte >= 240 && byte <= 247) {
8693
- const byte2 = arr[++i];
8694
- const byte3 = arr[++i];
8695
- const byte4 = arr[++i];
8656
+ const byte2 = arr[i + 1];
8657
+ const byte3 = arr[i + 2];
8658
+ const byte4 = arr[i + 3];
8659
+ skip = 3;
8696
8660
  const codePoint = ((byte & 7) << 18) | ((byte2 & 63) << 12) | ((byte3 & 63) << 6) | (byte4 & 63);
8697
8661
  const surrogate1 = 55296 + ((codePoint - 65536) >> 10);
8698
8662
  const surrogate2 = 56320 + ((codePoint - 65536) & 1023);
@@ -8703,7 +8667,7 @@ toUTF8 = (arr: number[]): string => {
8703
8667
  }
8704
8668
  ```
8705
8669
 
8706
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8670
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8707
8671
 
8708
8672
  ---
8709
8673
  ### Variable: verify
@@ -8870,7 +8834,7 @@ verify = (msg: BigNumber, sig: Signature, key: Point): boolean => {
8870
8834
 
8871
8835
  See also: [BigNumber](#class-bignumber), [Curve](#class-curve), [JacobianPoint](#class-jacobianpoint), [Point](#class-point), [Signature](#class-signature)
8872
8836
 
8873
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8837
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8874
8838
 
8875
8839
  ---
8876
8840
  ### Variable: zero2
@@ -8886,6 +8850,6 @@ zero2 = (word: string): string => {
8886
8850
  }
8887
8851
  ```
8888
8852
 
8889
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8853
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
8890
8854
 
8891
8855
  ---