@bsv/sdk 1.3.22 → 1.3.23

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.3.22",
3
+ "version": "1.3.23",
4
4
  "type": "module",
5
5
  "description": "BSV Blockchain Software Development Kit",
6
6
  "main": "dist/cjs/mod.js",
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import {
3
2
  Transaction,
4
3
  BroadcastResponse,
@@ -60,10 +59,7 @@ export interface SHIPBroadcasterConfig {
60
59
  /** Determines which topics (all, any, or a specific list) must be present within STEAK received from at least one host for the broadcast to be considered a success. */
61
60
  requireAcknowledgmentFromAnyHostForTopics?: 'all' | 'any' | string[]
62
61
  /** Determines a mapping whose keys are specific hosts and whose values are the topics (all, any, or a specific list) that must be present within the STEAK received by the given hosts, in order for the broadcast to be considered a success. */
63
- requireAcknowledgmentFromSpecificHostsForTopics?: Record<
64
- string,
65
- 'all' | 'any' | string[]
66
- >
62
+ requireAcknowledgmentFromSpecificHostsForTopics?: Record<string, 'all' | 'any' | string[]>
67
63
  }
68
64
 
69
65
  /** Facilitates transaction broadcasts that return STEAK. */
@@ -73,8 +69,7 @@ export interface OverlayBroadcastFacilitator {
73
69
 
74
70
  const MAX_SHIP_QUERY_TIMEOUT = 1000
75
71
 
76
- export class HTTPSOverlayBroadcastFacilitator
77
- implements OverlayBroadcastFacilitator {
72
+ export class HTTPSOverlayBroadcastFacilitator implements OverlayBroadcastFacilitator {
78
73
  httpClient: typeof fetch
79
74
 
80
75
  constructor (httpClient = fetch) {
@@ -106,24 +101,13 @@ implements OverlayBroadcastFacilitator {
106
101
  /**
107
102
  * Represents a SHIP transaction broadcaster.
108
103
  */
109
- export default class SHIPCast implements Broadcaster {
104
+ export default class SHIPBroadcaster implements Broadcaster {
110
105
  private readonly topics: string[]
111
106
  private readonly facilitator: OverlayBroadcastFacilitator
112
107
  private readonly resolver: LookupResolver
113
- private readonly requireAcknowledgmentFromAllHostsForTopics:
114
- | 'all'
115
- | 'any'
116
- | string[]
117
-
118
- private readonly requireAcknowledgmentFromAnyHostForTopics:
119
- | 'all'
120
- | 'any'
121
- | string[]
122
-
123
- private readonly requireAcknowledgmentFromSpecificHostsForTopics: Record<
124
- string,
125
- 'all' | 'any' | string[]
126
- >
108
+ private readonly requireAcknowledgmentFromAllHostsForTopics: | 'all' | 'any' | string[]
109
+ private readonly requireAcknowledgmentFromAnyHostForTopics: | 'all' | 'any' | string[]
110
+ private readonly requireAcknowledgmentFromSpecificHostsForTopics: Record<string, 'all' | 'any' | string[]>
127
111
 
128
112
  /**
129
113
  * Constructs an instance of the SHIP broadcaster.
@@ -145,7 +129,7 @@ export default class SHIPCast implements Broadcaster {
145
129
  requireAcknowledgmentFromAllHostsForTopics,
146
130
  requireAcknowledgmentFromAnyHostForTopics,
147
131
  requireAcknowledgmentFromSpecificHostsForTopics
148
- } = config ?? defaultConfig
132
+ } = config ?? {}
149
133
  this.facilitator = facilitator ?? new HTTPSOverlayBroadcastFacilitator()
150
134
  this.resolver = resolver ?? new LookupResolver()
151
135
  this.requireAcknowledgmentFromAllHostsForTopics =
@@ -215,14 +199,14 @@ export default class SHIPCast implements Broadcaster {
215
199
 
216
200
  for (const result of successfulHosts) {
217
201
  const host = result.host
218
- const steak = result.steak
202
+ const steak = result.steak as STEAK
219
203
 
220
204
  const acknowledgedTopics = new Set<string>()
221
205
 
222
206
  for (const [topic, instructions] of Object.entries(steak)) {
223
207
  const outputsToAdmit = instructions.outputsToAdmit
224
208
  const coinsToRetain = instructions.coinsToRetain
225
- const coinsRemoved = instructions.coinsRemoved
209
+ const coinsRemoved = instructions.coinsRemoved as number[]
226
210
 
227
211
  if (
228
212
  outputsToAdmit?.length > 0 ||