@bsv/sdk 1.2.2 → 1.2.4

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 (72) hide show
  1. package/dist/cjs/package.json +1 -1
  2. package/dist/cjs/src/auth/Certificate.js +1 -1
  3. package/dist/cjs/src/auth/Certificate.js.map +1 -1
  4. package/dist/cjs/src/overlay-tools/LookupResolver.js +8 -5
  5. package/dist/cjs/src/overlay-tools/LookupResolver.js.map +1 -1
  6. package/dist/cjs/src/overlay-tools/OverlayAdminTokenTemplate.js.map +1 -1
  7. package/dist/cjs/src/overlay-tools/SHIPBroadcaster.js +2 -1
  8. package/dist/cjs/src/overlay-tools/SHIPBroadcaster.js.map +1 -1
  9. package/dist/cjs/src/transaction/Beef.js +19 -10
  10. package/dist/cjs/src/transaction/Beef.js.map +1 -1
  11. package/dist/cjs/src/transaction/Transaction.js +38 -6
  12. package/dist/cjs/src/transaction/Transaction.js.map +1 -1
  13. package/dist/cjs/src/wallet/CachedKeyDeriver.js.map +1 -1
  14. package/dist/cjs/src/wallet/KeyDeriver.js.map +1 -1
  15. package/dist/cjs/src/wallet/ProtoWallet.js.map +1 -1
  16. package/dist/cjs/src/wallet/WalletClient.js.map +1 -1
  17. package/dist/cjs/src/wallet/WalletError.js.map +1 -1
  18. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  19. package/dist/esm/src/auth/Certificate.js +1 -1
  20. package/dist/esm/src/auth/Certificate.js.map +1 -1
  21. package/dist/esm/src/overlay-tools/LookupResolver.js +8 -5
  22. package/dist/esm/src/overlay-tools/LookupResolver.js.map +1 -1
  23. package/dist/esm/src/overlay-tools/OverlayAdminTokenTemplate.js.map +1 -1
  24. package/dist/esm/src/overlay-tools/SHIPBroadcaster.js +2 -1
  25. package/dist/esm/src/overlay-tools/SHIPBroadcaster.js.map +1 -1
  26. package/dist/esm/src/transaction/Beef.js +19 -10
  27. package/dist/esm/src/transaction/Beef.js.map +1 -1
  28. package/dist/esm/src/transaction/Transaction.js +38 -6
  29. package/dist/esm/src/transaction/Transaction.js.map +1 -1
  30. package/dist/esm/src/wallet/CachedKeyDeriver.js.map +1 -1
  31. package/dist/esm/src/wallet/KeyDeriver.js.map +1 -1
  32. package/dist/esm/src/wallet/ProtoWallet.js.map +1 -1
  33. package/dist/esm/src/wallet/WalletClient.js.map +1 -1
  34. package/dist/esm/src/wallet/WalletError.js.map +1 -1
  35. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  36. package/dist/types/src/auth/Certificate.d.ts.map +1 -1
  37. package/dist/types/src/overlay-tools/LookupResolver.d.ts +10 -3
  38. package/dist/types/src/overlay-tools/LookupResolver.d.ts.map +1 -1
  39. package/dist/types/src/overlay-tools/OverlayAdminTokenTemplate.d.ts.map +1 -1
  40. package/dist/types/src/overlay-tools/SHIPBroadcaster.d.ts.map +1 -1
  41. package/dist/types/src/transaction/Beef.d.ts.map +1 -1
  42. package/dist/types/src/transaction/Transaction.d.ts.map +1 -1
  43. package/dist/types/src/wallet/CachedKeyDeriver.d.ts.map +1 -1
  44. package/dist/types/src/wallet/KeyDeriver.d.ts.map +1 -1
  45. package/dist/types/src/wallet/ProtoWallet.d.ts.map +1 -1
  46. package/dist/types/src/wallet/Wallet.interfaces.d.ts +11 -11
  47. package/dist/types/src/wallet/Wallet.interfaces.d.ts.map +1 -1
  48. package/dist/types/src/wallet/WalletClient.d.ts.map +1 -1
  49. package/dist/types/src/wallet/WalletError.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/overlay-tools.md +19 -4
  53. package/package.json +1 -1
  54. package/src/auth/Certificate.ts +9 -9
  55. package/src/auth/index.ts +1 -1
  56. package/src/overlay-tools/LookupResolver.ts +25 -9
  57. package/src/overlay-tools/OverlayAdminTokenTemplate.ts +4 -4
  58. package/src/overlay-tools/SHIPBroadcaster.ts +11 -9
  59. package/src/overlay-tools/__tests/LookupResolver.test.ts +83 -42
  60. package/src/overlay-tools/__tests/SHIPBroadcaster.test.ts +5 -5
  61. package/src/overlay-tools/index.ts +1 -1
  62. package/src/transaction/Beef.ts +33 -48
  63. package/src/transaction/BeefParty.ts +4 -4
  64. package/src/transaction/BeefTx.ts +1 -1
  65. package/src/transaction/Transaction.ts +38 -10
  66. package/src/transaction/__tests/Transaction.test.ts +133 -4
  67. package/src/wallet/CachedKeyDeriver.ts +10 -10
  68. package/src/wallet/KeyDeriver.ts +8 -8
  69. package/src/wallet/ProtoWallet.ts +176 -176
  70. package/src/wallet/Wallet.interfaces.ts +19 -19
  71. package/src/wallet/WalletClient.ts +30 -30
  72. package/src/wallet/WalletError.ts +2 -2
@@ -63,7 +63,8 @@ describe('LookupResolver', () => {
63
63
  query: {
64
64
  service: 'ls_foo'
65
65
  }
66
- }
66
+ },
67
+ 1000
67
68
  ],
68
69
  [
69
70
  'https://slaphost.com',
@@ -71,8 +72,9 @@ describe('LookupResolver', () => {
71
72
  service: 'ls_foo',
72
73
  query: {
73
74
  test: 1
74
- }
75
- }
75
+ },
76
+ },
77
+ undefined
76
78
  ]
77
79
  ])
78
80
  })
@@ -139,7 +141,8 @@ describe('LookupResolver', () => {
139
141
  query: {
140
142
  service: 'ls_foo'
141
143
  }
142
- }
144
+ },
145
+ 1000
143
146
  ],
144
147
  [
145
148
  'https://slaphost.com',
@@ -148,7 +151,8 @@ describe('LookupResolver', () => {
148
151
  query: {
149
152
  test: 1
150
153
  }
151
- }
154
+ },
155
+ undefined
152
156
  ],
153
157
  [ // additional host should also have been queried
154
158
  'https://additional.host',
@@ -157,7 +161,8 @@ describe('LookupResolver', () => {
157
161
  query: {
158
162
  test: 1
159
163
  }
160
- }
164
+ },
165
+ undefined
161
166
  ]
162
167
  ])
163
168
  })
@@ -197,7 +202,8 @@ describe('LookupResolver', () => {
197
202
  query: {
198
203
  test: 1
199
204
  }
200
- }
205
+ },
206
+ undefined
201
207
  ]
202
208
  ])
203
209
  })
@@ -252,7 +258,8 @@ describe('LookupResolver', () => {
252
258
  query: {
253
259
  test: 1
254
260
  }
255
- }
261
+ },
262
+ undefined
256
263
  ],
257
264
  [ // additional host should also have been queried
258
265
  'https://additional.host',
@@ -261,7 +268,8 @@ describe('LookupResolver', () => {
261
268
  query: {
262
269
  test: 1
263
270
  }
264
- }
271
+ },
272
+ undefined
265
273
  ]
266
274
  ])
267
275
  })
@@ -341,7 +349,8 @@ describe('LookupResolver', () => {
341
349
  query: {
342
350
  service: 'ls_foo'
343
351
  }
344
- }
352
+ },
353
+ 1000
345
354
  ],
346
355
  [
347
356
  'https://mock.slap2',
@@ -350,7 +359,8 @@ describe('LookupResolver', () => {
350
359
  query: {
351
360
  service: 'ls_foo'
352
361
  }
353
- }
362
+ },
363
+ 1000
354
364
  ],
355
365
  [
356
366
  'https://slaphost1.com',
@@ -359,7 +369,8 @@ describe('LookupResolver', () => {
359
369
  query: {
360
370
  test: 1
361
371
  }
362
- }
372
+ },
373
+ undefined
363
374
  ],
364
375
  [
365
376
  'https://slaphost2.com',
@@ -368,7 +379,8 @@ describe('LookupResolver', () => {
368
379
  query: {
369
380
  test: 1
370
381
  }
371
- }
382
+ },
383
+ undefined
372
384
  ]
373
385
  ])
374
386
  })
@@ -434,7 +446,8 @@ describe('LookupResolver', () => {
434
446
  query: {
435
447
  service: 'ls_foo'
436
448
  }
437
- }
449
+ },
450
+ 1000
438
451
  ],
439
452
  [
440
453
  'https://slaphost1.com',
@@ -443,7 +456,8 @@ describe('LookupResolver', () => {
443
456
  query: {
444
457
  test: 1
445
458
  }
446
- }
459
+ },
460
+ undefined
447
461
  ],
448
462
  [
449
463
  'https://slaphost2.com',
@@ -452,7 +466,8 @@ describe('LookupResolver', () => {
452
466
  query: {
453
467
  test: 1
454
468
  }
455
- }
469
+ },
470
+ undefined
456
471
  ]
457
472
  ])
458
473
  })
@@ -521,7 +536,8 @@ describe('LookupResolver', () => {
521
536
  query: {
522
537
  service: 'ls_foo'
523
538
  }
524
- }
539
+ },
540
+ 1000
525
541
  ],
526
542
  [
527
543
  'https://slaphost1.com',
@@ -530,7 +546,8 @@ describe('LookupResolver', () => {
530
546
  query: {
531
547
  test: 1
532
548
  }
533
- }
549
+ },
550
+ undefined
534
551
  ],
535
552
  [
536
553
  'https://slaphost2.com',
@@ -539,7 +556,8 @@ describe('LookupResolver', () => {
539
556
  query: {
540
557
  test: 1
541
558
  }
542
- }
559
+ },
560
+ undefined
543
561
  ]
544
562
  ])
545
563
  })
@@ -607,7 +625,8 @@ describe('LookupResolver', () => {
607
625
  query: {
608
626
  service: 'ls_foo'
609
627
  }
610
- }
628
+ },
629
+ 1000
611
630
  ],
612
631
  [
613
632
  'https://slaphost1.com',
@@ -616,7 +635,8 @@ describe('LookupResolver', () => {
616
635
  query: {
617
636
  test: 1
618
637
  }
619
- }
638
+ },
639
+ undefined
620
640
  ],
621
641
  [
622
642
  'https://slaphost2.com',
@@ -625,7 +645,8 @@ describe('LookupResolver', () => {
625
645
  query: {
626
646
  test: 1
627
647
  }
628
- }
648
+ },
649
+ undefined
629
650
  ]
630
651
  ])
631
652
  })
@@ -655,7 +676,8 @@ describe('LookupResolver', () => {
655
676
  query: {
656
677
  service: 'ls_foo'
657
678
  }
658
- }
679
+ },
680
+ 1000
659
681
  ]
660
682
  ])
661
683
  })
@@ -725,7 +747,8 @@ describe('LookupResolver', () => {
725
747
  query: {
726
748
  service: 'ls_foo'
727
749
  }
728
- }
750
+ },
751
+ 1000
729
752
  ],
730
753
  [
731
754
  'https://slaphost1.com',
@@ -734,7 +757,8 @@ describe('LookupResolver', () => {
734
757
  query: {
735
758
  test: 1
736
759
  }
737
- }
760
+ },
761
+ undefined
738
762
  ],
739
763
  [
740
764
  'https://slaphost2.com',
@@ -743,7 +767,8 @@ describe('LookupResolver', () => {
743
767
  query: {
744
768
  test: 1
745
769
  }
746
- }
770
+ },
771
+ undefined
747
772
  ]
748
773
  ])
749
774
  })
@@ -777,7 +802,8 @@ describe('LookupResolver', () => {
777
802
  query: {
778
803
  test: 1
779
804
  }
780
- }
805
+ },
806
+ undefined
781
807
  ]
782
808
  ])
783
809
  })
@@ -808,7 +834,8 @@ describe('LookupResolver', () => {
808
834
  query: {
809
835
  service: 'ls_foo'
810
836
  }
811
- }
837
+ },
838
+ 1000
812
839
  ]
813
840
  ])
814
841
  })
@@ -882,7 +909,8 @@ describe('LookupResolver', () => {
882
909
  query: {
883
910
  service: 'ls_foo'
884
911
  }
885
- }
912
+ },
913
+ 1000
886
914
  ],
887
915
  [
888
916
  'https://mock.slap2',
@@ -891,7 +919,8 @@ describe('LookupResolver', () => {
891
919
  query: {
892
920
  service: 'ls_foo'
893
921
  }
894
- }
922
+ },
923
+ 1000
895
924
  ],
896
925
  [
897
926
  'https://slaphost.com',
@@ -900,7 +929,8 @@ describe('LookupResolver', () => {
900
929
  query: {
901
930
  test: 1
902
931
  }
903
- }
932
+ },
933
+ undefined
904
934
  ]
905
935
  ])
906
936
  })
@@ -977,7 +1007,8 @@ describe('LookupResolver', () => {
977
1007
  query: {
978
1008
  service: 'ls_foo'
979
1009
  }
980
- }
1010
+ },
1011
+ 1000
981
1012
  ],
982
1013
  [
983
1014
  'https://slaphost1.com',
@@ -986,7 +1017,8 @@ describe('LookupResolver', () => {
986
1017
  query: {
987
1018
  test: 1
988
1019
  }
989
- }
1020
+ },
1021
+ undefined
990
1022
  ],
991
1023
  [
992
1024
  'https://slaphost2.com',
@@ -995,7 +1027,8 @@ describe('LookupResolver', () => {
995
1027
  query: {
996
1028
  test: 1
997
1029
  }
998
- }
1030
+ },
1031
+ undefined
999
1032
  ]
1000
1033
  ])
1001
1034
  })
@@ -1063,7 +1096,8 @@ describe('LookupResolver', () => {
1063
1096
  query: {
1064
1097
  service: 'ls_foo'
1065
1098
  }
1066
- }
1099
+ },
1100
+ 1000
1067
1101
  ],
1068
1102
  [
1069
1103
  'https://slaphost1.com',
@@ -1072,7 +1106,8 @@ describe('LookupResolver', () => {
1072
1106
  query: {
1073
1107
  test: 1
1074
1108
  }
1075
- }
1109
+ },
1110
+ undefined
1076
1111
  ],
1077
1112
  [
1078
1113
  'https://slaphost2.com',
@@ -1081,7 +1116,8 @@ describe('LookupResolver', () => {
1081
1116
  query: {
1082
1117
  test: 1
1083
1118
  }
1084
- }
1119
+ },
1120
+ undefined
1085
1121
  ]
1086
1122
  ])
1087
1123
  })
@@ -1148,7 +1184,8 @@ describe('LookupResolver', () => {
1148
1184
  query: {
1149
1185
  service: 'ls_foo'
1150
1186
  }
1151
- }
1187
+ },
1188
+ 1000
1152
1189
  ],
1153
1190
  [
1154
1191
  'https://slaphost1.com',
@@ -1157,7 +1194,8 @@ describe('LookupResolver', () => {
1157
1194
  query: {
1158
1195
  test: 1
1159
1196
  }
1160
- }
1197
+ },
1198
+ undefined
1161
1199
  ],
1162
1200
  [
1163
1201
  'https://slaphost2.com',
@@ -1166,7 +1204,8 @@ describe('LookupResolver', () => {
1166
1204
  query: {
1167
1205
  test: 1
1168
1206
  }
1169
- }
1207
+ },
1208
+ undefined
1170
1209
  ]
1171
1210
  ])
1172
1211
  })
@@ -1217,7 +1256,8 @@ describe('LookupResolver', () => {
1217
1256
  query: {
1218
1257
  service: 'ls_foo'
1219
1258
  }
1220
- }
1259
+ },
1260
+ 1000
1221
1261
  ],
1222
1262
  [
1223
1263
  'https://slaphost.com',
@@ -1226,7 +1266,8 @@ describe('LookupResolver', () => {
1226
1266
  query: {
1227
1267
  test: 1
1228
1268
  }
1229
- }
1269
+ },
1270
+ undefined
1230
1271
  ]
1231
1272
  ])
1232
1273
  })
@@ -69,8 +69,8 @@ describe('SHIPCast', () => {
69
69
  service: 'ls_ship',
70
70
  query: {
71
71
  topics: ['tm_foo']
72
- }
73
- })
72
+ },
73
+ }, 1000)
74
74
 
75
75
  expect(mockFacilitator.send).toHaveBeenCalledWith('https://shiphost.com', {
76
76
  beef: testTx.toBEEF(),
@@ -231,8 +231,8 @@ describe('SHIPCast', () => {
231
231
  service: 'ls_ship',
232
232
  query: {
233
233
  topics: ['tm_foo']
234
- }
235
- })
234
+ },
235
+ }, 1000)
236
236
 
237
237
  expect(mockFacilitator.send).not.toHaveBeenCalled()
238
238
  })
@@ -396,7 +396,7 @@ describe('SHIPCast', () => {
396
396
  query: {
397
397
  topics: ['tm_foo', 'tm_bar']
398
398
  }
399
- })
399
+ }, 1000)
400
400
 
401
401
  expect(mockFacilitator.send).toHaveBeenCalledTimes(2)
402
402
  })
@@ -2,4 +2,4 @@ export * from './LookupResolver.js'
2
2
  export * from './SHIPBroadcaster.js'
3
3
  export { default as OverlayAdminTokenTemplate } from './OverlayAdminTokenTemplate.js'
4
4
  export { default as LookupResolver } from './LookupResolver.js'
5
- export { default as SHIPBroadcaster } from './SHIPBroadcaster.js'
5
+ export { default as SHIPBroadcaster } from './SHIPBroadcaster.js'
@@ -17,12 +17,12 @@ export type BeefVersion = undefined | 'V1' | 'V2'
17
17
  *
18
18
  * BUMP standard: BRC-74: BSV Unified Merkle Path (BUMP) Format
19
19
  * https://github.com/bitcoin-sv/BRCs/blob/master/transactions/0074.md
20
- *
20
+ *
21
21
  * BRC-95: Atomic BEEF Transactions
22
22
  * https://github.com/bitcoin-sv/BRCs/blob/master/transactions/0095.md
23
- *
23
+ *
24
24
  * The Atomic BEEF format is supported by the binary deserialization static method `fromBinary`.
25
- *
25
+ *
26
26
  * BRC-96: BEEF V2, Txid Only Extension
27
27
  * https://github.com/bitcoin-sv/BRCs/blob/master/transactions/0096.md
28
28
  *
@@ -57,7 +57,7 @@ export type BeefVersion = undefined | 'V1' | 'V2'
57
57
  *
58
58
  * A valid `Beef` is only required when sent to a party with no shared history,
59
59
  * such as a transaction processor.
60
- *
60
+ *
61
61
  * IMPORTANT NOTE:
62
62
  * It is fundamental to the BEEF value proposition that only valid transactions and valid
63
63
  * merkle path (BUMP) data be added to it. Merging invalid data breaks the `verify` and `isValid`
@@ -108,14 +108,13 @@ export class Beef {
108
108
  /**
109
109
  * Finds a Transaction in this `Beef`
110
110
  * and adds any missing input SourceTransactions from this `Beef`.
111
- *
111
+ *
112
112
  * The result is suitable for signing.
113
- *
113
+ *
114
114
  * @param txid The id of the target transaction.
115
115
  * @returns Transaction with all available input `SourceTransaction`s from this Beef.
116
116
  */
117
117
  findTransactionForSigning (txid: string): Transaction | undefined {
118
-
119
118
  const beefTx = this.findTxid(txid)
120
119
  if (!beefTx) return undefined
121
120
 
@@ -130,24 +129,22 @@ export class Beef {
130
129
 
131
130
  return beefTx.tx
132
131
  }
132
+
133
133
  /**
134
134
  * Builds the proof tree rooted at a specific `Transaction`.
135
- *
135
+ *
136
136
  * To succeed, the Beef must contain all the required transaction and merkle path data.
137
- *
137
+ *
138
138
  * @param txid The id of the target transaction.
139
139
  * @returns Transaction with input `SourceTransaction` and `MerklePath` populated from this Beef.
140
140
  */
141
141
  findAtomicTransaction (txid: string): Transaction | undefined {
142
-
143
142
  const beefTx = this.findTxid(txid)
144
143
  if (!beefTx) return undefined
145
144
 
146
145
  const addInputProof = (beef: Beef, tx: Transaction) => {
147
146
  const mp = beef.findBump(tx.id('hex'))
148
- if (mp)
149
- tx.merklePath = mp
150
- else {
147
+ if (mp) { tx.merklePath = mp } else {
151
148
  for (const i of tx.inputs) {
152
149
  if (!i.sourceTransaction) {
153
150
  const itx = beef.findTxid(i.sourceTXID)
@@ -159,8 +156,7 @@ export class Beef {
159
156
  const mp = beef.findBump(i.sourceTransaction.id('hex'))
160
157
  if (mp) {
161
158
  i.sourceTransaction.merklePath = mp
162
- }
163
- else {
159
+ } else {
164
160
  addInputProof(beef, i.sourceTransaction)
165
161
  }
166
162
  }
@@ -397,7 +393,7 @@ export class Beef {
397
393
 
398
394
  /**
399
395
  * Serializes this data to `writer`
400
- * @param writer
396
+ * @param writer
401
397
  */
402
398
  toWriter (writer: Writer) {
403
399
  writer.writeUInt32LE(this.magic)
@@ -425,20 +421,18 @@ export class Beef {
425
421
 
426
422
  /**
427
423
  * Serialize this Beef as AtomicBEEF.
428
- *
424
+ *
429
425
  * `txid` must exist and be the last transaction
430
426
  * in sorted (dependency) order.
431
- *
432
- * @param txid
427
+ *
428
+ * @param txid
433
429
  * @returns serialized contents of this Beef with AtomicBEEF prefix.
434
430
  */
435
- toBinaryAtomic(txid: string) {
431
+ toBinaryAtomic (txid: string) {
436
432
  this.sortTxs()
437
433
  const tx = this.findTxid(txid)
438
- if (!tx)
439
- throw new Error(`${txid} does not exist in this Beef`)
440
- if (this.txs[this.txs.length - 1] !== tx)
441
- throw new Error(`${txid} is not the last transaction in this Beef`)
434
+ if (!tx) { throw new Error(`${txid} does not exist in this Beef`) }
435
+ if (this.txs[this.txs.length - 1] !== tx) { throw new Error(`${txid} is not the last transaction in this Beef`) }
442
436
  const writer = new Writer()
443
437
  writer.writeUInt32LE(ATOMIC_BEEF)
444
438
  writer.write(toArray(txid, 'hex'))
@@ -456,7 +450,7 @@ export class Beef {
456
450
 
457
451
  static fromReader (br: Reader): Beef {
458
452
  let version = br.readUInt32LE()
459
- let atomicTxid: string | undefined = undefined
453
+ let atomicTxid: string | undefined
460
454
  if (version === ATOMIC_BEEF) {
461
455
  // Skip the txid and re-read the BEEF version
462
456
  atomicTxid = toHex(br.read(32))
@@ -527,19 +521,18 @@ export class Beef {
527
521
  * - Oldest Tx Anchored by Path
528
522
  * - Newer Txs depending on Older parents
529
523
  * - Newest Tx
530
- *
524
+ *
531
525
  * with proof (MerklePath) last, longest chain of dependencies first
532
- *
526
+ *
533
527
  * @returns `{ missingInputs, notValid, valid, withMissingInputs }`
534
528
  */
535
- sortTxs ()
536
- : {
537
- missingInputs: string[],
538
- notValid: string[],
539
- valid: string[],
540
- withMissingInputs: string[],
541
- txidOnly: string[]
542
- } {
529
+ sortTxs (): {
530
+ missingInputs: string[]
531
+ notValid: string[]
532
+ valid: string[]
533
+ withMissingInputs: string[]
534
+ txidOnly: string[]
535
+ } {
543
536
  // Hashtable of valid txids (with proof or all inputs chain to proof)
544
537
  const validTxids: Record<string, boolean> = {}
545
538
 
@@ -560,10 +553,7 @@ export class Beef {
560
553
  if (tx.isValid) {
561
554
  validTxids[tx.txid] = true
562
555
  result.push(tx)
563
- } else if (tx.isTxidOnly)
564
- txidOnly.push(tx)
565
- else
566
- queue.push(tx)
556
+ } else if (tx.isTxidOnly) { txidOnly.push(tx) } else { queue.push(tx) }
567
557
  }
568
558
 
569
559
  // Hashtable of unknown input txids used to fund transactions without their own proof.
@@ -587,10 +577,7 @@ export class Beef {
587
577
  }
588
578
  }
589
579
  }
590
- if (hasMissingInput)
591
- txsMissingInputs.push(tx)
592
- else
593
- queue.push(tx)
580
+ if (hasMissingInput) { txsMissingInputs.push(tx) } else { queue.push(tx) }
594
581
  }
595
582
 
596
583
  // As long as we have unsorted transactions...
@@ -601,11 +588,9 @@ export class Beef {
601
588
  if (tx.inputTxids.every(txid => validTxids[txid])) {
602
589
  validTxids[tx.txid] = true
603
590
  result.push(tx)
604
- } else
605
- queue.push(tx)
591
+ } else { queue.push(tx) }
606
592
  }
607
- if (oldQueue.length === queue.length)
608
- break;
593
+ if (oldQueue.length === queue.length) { break }
609
594
  }
610
595
 
611
596
  // transactions that don't have proofs and don't chain to proofs
@@ -652,7 +637,7 @@ export class Beef {
652
637
  /**
653
638
  * @returns array of transaction txids that either have a proof or whose inputs chain back to a proven transaction.
654
639
  */
655
- getValidTxids() : string[] {
640
+ getValidTxids (): string[] {
656
641
  const r = this.sortTxs()
657
642
  return r.valid
658
643
  }
@@ -94,13 +94,13 @@ export class BeefParty extends Beef {
94
94
 
95
95
  /**
96
96
  * Merge a `beef` received from a specific `party`.
97
- *
97
+ *
98
98
  * Updates this `BeefParty` to track all the txids
99
99
  * corresponding to transactions for which `party`
100
100
  * has raw transaction and validity proof data.
101
- *
102
- * @param party
103
- * @param beef
101
+ *
102
+ * @param party
103
+ * @param beef
104
104
  */
105
105
  mergeBeefFromParty (party: string, beef: number[] | Beef) {
106
106
  const b: Beef = Array.isArray(beef) ? Beef.fromBinary(beef) : beef
@@ -20,7 +20,7 @@ export default class BeefTx {
20
20
  inputTxids: string[] = []
21
21
  /**
22
22
  * true if `hasProof` or all inputs chain to `hasProof`.
23
- *
23
+ *
24
24
  * Typically set by sorting transactions by proven dependency chains.
25
25
  */
26
26
  isValid?: boolean = undefined