@bsv/sdk 1.2.0 → 1.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "type": "module",
5
5
  "description": "BSV Blockchain Software Development Kit",
6
6
  "main": "dist/cjs/mod.js",
@@ -214,7 +214,7 @@
214
214
  "ts-jest": "^29.1.1",
215
215
  "ts-loader": "^9.5.1",
216
216
  "ts-standard": "^12.0.2",
217
- "ts2md": "^0.2.0",
217
+ "ts2md": "^0.2.4",
218
218
  "tsconfig-to-dual-package": "^1.2.0",
219
219
  "typescript": "^5.2.2",
220
220
  "webpack": "^5.95.0",
@@ -116,8 +116,8 @@ export default class SHIPCast implements Broadcaster {
116
116
  } = config ?? {} as SHIPBroadcasterConfig
117
117
  this.facilitator = facilitator ?? new HTTPSOverlayBroadcastFacilitator()
118
118
  this.resolver = resolver ?? new LookupResolver()
119
- this.requireAcknowledgmentFromAllHostsForTopics = requireAcknowledgmentFromAllHostsForTopics ?? 'all'
120
- this.requireAcknowledgmentFromAnyHostForTopics = requireAcknowledgmentFromAnyHostForTopics ?? []
119
+ this.requireAcknowledgmentFromAllHostsForTopics = requireAcknowledgmentFromAllHostsForTopics ?? []
120
+ this.requireAcknowledgmentFromAnyHostForTopics = requireAcknowledgmentFromAnyHostForTopics ?? 'all'
121
121
  this.requireAcknowledgmentFromSpecificHostsForTopics = requireAcknowledgmentFromSpecificHostsForTopics ?? {}
122
122
  }
123
123
 
@@ -178,6 +178,7 @@ export default class SHIPCast implements Broadcaster {
178
178
  for (const [topic, instructions] of Object.entries(steak)) {
179
179
  const outputsToAdmit = instructions.outputsToAdmit
180
180
  const coinsToRetain = instructions.coinsToRetain
181
+ // TODO: Account for coins removed property on STEAK
181
182
  if ((outputsToAdmit && outputsToAdmit.length > 0) || (coinsToRetain && coinsToRetain.length > 0)) {
182
183
  acknowledgedTopics.add(topic)
183
184
  }
@@ -401,7 +401,7 @@ describe('SHIPCast', () => {
401
401
  expect(mockFacilitator.send).toHaveBeenCalledTimes(2)
402
402
  })
403
403
 
404
- it('should fail when a host does not acknowledge all topics (default behavior)', async () => {
404
+ it('should fail if at least one host does not acknowledge every topic (default behavior)', async () => {
405
405
  const shipHostKey1 = new PrivateKey(42)
406
406
  const shipWallet1 = new ProtoWallet(shipHostKey1)
407
407
  const shipLib1 = new OverlayAdminTokenTemplate(shipWallet1)
@@ -434,7 +434,7 @@ describe('SHIPCast', () => {
434
434
  const steak = {}
435
435
  for (const topic of topics) {
436
436
  steak[topic] = {
437
- outputsToAdmit: [0],
437
+ outputsToAdmit: [],
438
438
  coinsToRetain: []
439
439
  }
440
440
  }
@@ -462,8 +462,8 @@ describe('SHIPCast', () => {
462
462
 
463
463
  expect(response).toEqual({
464
464
  status: 'error',
465
- code: 'ERR_REQUIRE_ACK_FROM_ALL_HOSTS_FAILED',
466
- description: 'Not all hosts acknowledged the required topics.'
465
+ code: 'ERR_REQUIRE_ACK_FROM_ANY_HOST_FAILED',
466
+ description: 'No host acknowledged the required topics.'
467
467
  })
468
468
  })
469
469