viz-js-lib 0.12.3 → 0.12.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.
@@ -18,21 +18,32 @@
18
18
  - [test/broadcast.test.js](file://test/broadcast.test.js)
19
19
  </cite>
20
20
 
21
+ ## Update Summary
22
+ **Changes Made**
23
+ - Enhanced transaction preparation with new configuration options for reference block handling
24
+ - Added support for configurable transaction expiration times
25
+ - Improved reference block selection logic with irreversible block support
26
+ - Updated configuration system to support runtime customization of broadcast behavior
27
+ - Added comprehensive documentation for new configuration options
28
+
21
29
  ## Table of Contents
22
30
  1. [Introduction](#introduction)
23
31
  2. [Project Structure](#project-structure)
24
32
  3. [Core Components](#core-components)
25
33
  4. [Architecture Overview](#architecture-overview)
26
34
  5. [Detailed Component Analysis](#detailed-component-analysis)
27
- 6. [Dependency Analysis](#dependency-analysis)
28
- 7. [Performance Considerations](#performance-considerations)
29
- 8. [Troubleshooting Guide](#troubleshooting-guide)
30
- 9. [Conclusion](#conclusion)
31
- 10. [Appendices](#appendices)
35
+ 6. [Configuration Options](#configuration-options)
36
+ 7. [Dependency Analysis](#dependency-analysis)
37
+ 8. [Performance Considerations](#performance-considerations)
38
+ 9. [Troubleshooting Guide](#troubleshooting-guide)
39
+ 10. [Conclusion](#conclusion)
40
+ 11. [Appendices](#appendices)
32
41
 
33
42
  ## Introduction
34
43
  This document explains the transaction broadcasting functionality in the VIZ JavaScript library. It covers the broadcast system architecture, operation construction, transaction signing, and network submission. It documents supported operation types (including transfers, votes, comments, and custom JSON), transaction building blocks, fee calculation, expiration handling, and broadcast verification. Practical examples, error handling strategies, debugging techniques, batch operations, transaction simulation, and integration with the authentication system are included.
35
44
 
45
+ **Updated** Enhanced with new configuration options for reference block handling and transaction expiration control, providing improved flexibility for different network conditions and use cases.
46
+
36
47
  ## Project Structure
37
48
  The broadcast subsystem is composed of:
38
49
  - Broadcast orchestrator that prepares, signs, and submits transactions
@@ -40,7 +51,7 @@ The broadcast subsystem is composed of:
40
51
  - Authentication module handling cryptographic signing
41
52
  - API transport layer for network communication
42
53
  - Formatter utilities for common tasks like permlink generation
43
- - Configuration for chain ID, address prefix, and broadcast mode
54
+ - Configuration system for chain ID, address prefix, broadcast mode, and advanced options
44
55
 
45
56
  ```mermaid
46
57
  graph TB
@@ -59,7 +70,7 @@ AMETH["src/api/methods.js"]
59
70
  WS["src/api/transports/ws.js"]
60
71
  BASE["src/api/transports/base.js"]
61
72
  end
62
- subgraph "Utilities"
73
+ subgraph "Utilities & Config"
63
74
  FMT["src/formatter.js"]
64
75
  CFG["src/config.js"]
65
76
  CJSON["config.json"]
@@ -78,55 +89,57 @@ BHELP --> BIDX
78
89
  ```
79
90
 
80
91
  **Diagram sources**
81
- - [src/broadcast/index.js](file://src/broadcast/index.js#L1-L137)
82
- - [src/broadcast/operations.js](file://src/broadcast/operations.js#L1-L475)
83
- - [src/broadcast/helpers.js](file://src/broadcast/helpers.js#L1-L82)
84
- - [src/auth/index.js](file://src/auth/index.js#L1-L133)
85
- - [src/auth/serializer/src/operations.js](file://src/auth/serializer/src/operations.js#L73-L125)
86
- - [src/auth/serializer/src/types.js](file://src/auth/serializer/src/types.js#L30-L69)
87
- - [src/api/methods.js](file://src/api/methods.js#L356-L374)
88
- - [src/api/transports/ws.js](file://src/api/transports/ws.js#L1-L136)
89
- - [src/api/transports/base.js](file://src/api/transports/base.js#L1-L34)
90
- - [src/formatter.js](file://src/formatter.js#L69-L76)
91
- - [src/config.js](file://src/config.js#L1-L10)
92
- - [config.json](file://config.json#L1-L7)
92
+ - [src/broadcast/index.js:1-146](file://src/broadcast/index.js#L1-L146)
93
+ - [src/broadcast/operations.js:1-475](file://src/broadcast/operations.js#L1-L475)
94
+ - [src/broadcast/helpers.js:1-82](file://src/broadcast/helpers.js#L1-L82)
95
+ - [src/auth/index.js:1-133](file://src/auth/index.js#L1-L133)
96
+ - [src/auth/serializer/src/operations.js:73-125](file://src/auth/serializer/src/operations.js#L73-L125)
97
+ - [src/auth/serializer/src/types.js:30-69](file://src/auth/serializer/src/types.js#L30-L69)
98
+ - [src/api/methods.js:356-374](file://src/api/methods.js#L356-L374)
99
+ - [src/api/transports/ws.js:1-136](file://src/api/transports/ws.js#L1-L136)
100
+ - [src/api/transports/base.js:1-34](file://src/api/transports/base.js#L1-L34)
101
+ - [src/formatter.js:69-76](file://src/formatter.js#L69-L76)
102
+ - [src/config.js:1-10](file://src/config.js#L1-L10)
103
+ - [config.json:1-9](file://config.json#L1-L9)
93
104
 
94
105
  **Section sources**
95
- - [src/broadcast/index.js](file://src/broadcast/index.js#L1-L137)
96
- - [src/broadcast/operations.js](file://src/broadcast/operations.js#L1-L475)
97
- - [src/broadcast/helpers.js](file://src/broadcast/helpers.js#L1-L82)
98
- - [src/auth/index.js](file://src/auth/index.js#L1-L133)
99
- - [src/auth/serializer/src/operations.js](file://src/auth/serializer/src/operations.js#L73-L125)
100
- - [src/auth/serializer/src/types.js](file://src/auth/serializer/src/types.js#L30-L69)
101
- - [src/api/methods.js](file://src/api/methods.js#L356-L374)
102
- - [src/api/transports/ws.js](file://src/api/transports/ws.js#L1-L136)
103
- - [src/api/transports/base.js](file://src/api/transports/base.js#L1-L34)
104
- - [src/formatter.js](file://src/formatter.js#L69-L76)
105
- - [src/config.js](file://src/config.js#L1-L10)
106
- - [config.json](file://config.json#L1-L7)
106
+ - [src/broadcast/index.js:1-146](file://src/broadcast/index.js#L1-L146)
107
+ - [src/broadcast/operations.js:1-475](file://src/broadcast/operations.js#L1-L475)
108
+ - [src/broadcast/helpers.js:1-82](file://src/broadcast/helpers.js#L1-L82)
109
+ - [src/auth/index.js:1-133](file://src/auth/index.js#L1-L133)
110
+ - [src/auth/serializer/src/operations.js:73-125](file://src/auth/serializer/src/operations.js#L73-L125)
111
+ - [src/auth/serializer/src/types.js:30-69](file://src/auth/serializer/src/types.js#L30-L69)
112
+ - [src/api/methods.js:356-374](file://src/api/methods.js#L356-L374)
113
+ - [src/api/transports/ws.js:1-136](file://src/api/transports/ws.js#L1-L136)
114
+ - [src/api/transports/base.js:1-34](file://src/api/transports/base.js#L1-L34)
115
+ - [src/formatter.js:69-76](file://src/formatter.js#L69-L76)
116
+ - [src/config.js:1-10](file://src/config.js#L1-L10)
117
+ - [config.json:1-9](file://config.json#L1-L9)
107
118
 
108
119
  ## Core Components
109
- - Broadcaster: Orchestrates transaction preparation, signing, and submission. It fetches dynamic global properties, sets reference block and expiration, signs with private keys, and broadcasts via network broadcast API.
120
+ - Broadcaster: Orchestrates transaction preparation, signing, and submission. It fetches dynamic global properties, sets reference block and expiration based on configuration, signs with private keys, and broadcasts via network broadcast API.
110
121
  - Operations registry: Declares supported operations, parameter lists, and required roles for each operation.
111
122
  - Authentication: Provides signing functions, key derivation, and WIF utilities.
112
123
  - API methods: Exposes network broadcast APIs and other endpoints used by the broadcaster.
113
124
  - Transport: WebSocket transport for API communication with connection lifecycle and error handling.
114
125
  - Formatter: Utility functions for common tasks such as generating permlinks for comments.
115
- - Config: Centralized configuration including chain ID, address prefix, and broadcast mode.
126
+ - Config: Centralized configuration including chain ID, address prefix, broadcast mode, and advanced options for reference block handling and transaction expiration.
127
+
128
+ **Updated** Enhanced configuration system now supports runtime customization of reference block behavior and transaction expiration timing.
116
129
 
117
130
  **Section sources**
118
- - [src/broadcast/index.js](file://src/broadcast/index.js#L24-L84)
119
- - [src/broadcast/operations.js](file://src/broadcast/operations.js#L1-L475)
120
- - [src/auth/index.js](file://src/auth/index.js#L107-L130)
121
- - [src/api/methods.js](file://src/api/methods.js#L356-L374)
122
- - [src/api/transports/ws.js](file://src/api/transports/ws.js#L27-L94)
123
- - [src/formatter.js](file://src/formatter.js#L69-L76)
124
- - [src/config.js](file://src/config.js#L1-L10)
125
- - [config.json](file://config.json#L1-L7)
131
+ - [src/broadcast/index.js:24-84](file://src/broadcast/index.js#L24-L84)
132
+ - [src/broadcast/operations.js:1-475](file://src/broadcast/operations.js#L1-L475)
133
+ - [src/auth/index.js:107-130](file://src/auth/index.js#L107-L130)
134
+ - [src/api/methods.js:356-374](file://src/api/methods.js#L356-L374)
135
+ - [src/api/transports/ws.js:27-94](file://src/api/transports/ws.js#L27-L94)
136
+ - [src/formatter.js:69-76](file://src/formatter.js#L69-L76)
137
+ - [src/config.js:1-10](file://src/config.js#L1-L10)
138
+ - [config.json:1-9](file://config.json#L1-L9)
126
139
 
127
140
  ## Architecture Overview
128
141
  End-to-end flow for broadcasting a transaction:
129
- 1. Prepare transaction: Fetch dynamic global properties, compute reference block and expiration.
142
+ 1. Prepare transaction: Fetch dynamic global properties, compute reference block and expiration based on configuration.
130
143
  2. Sign transaction: Compute chain ID concatenated with serialized transaction buffer; sign with provided private keys.
131
144
  3. Submit transaction: Choose broadcast method based on configuration; submit to network broadcast API.
132
145
 
@@ -139,7 +152,7 @@ participant Auth as "Auth.signTransaction"
139
152
  App->>Br : "send(tx, privKeys, callback)"
140
153
  Br->>API : "getDynamicGlobalPropertiesAsync()"
141
154
  API-->>Br : "dynamic properties"
142
- Br->>Br : "_prepareTransaction(tx)<br/>set ref_block_num/prefix<br/>set expiration"
155
+ Br->>Br : "_prepareTransaction(tx)<br/>Check config options<br/>Set ref_block_num/prefix<br/>Set expiration"
143
156
  Br->>Auth : "signTransaction(transaction, privKeys)"
144
157
  Auth-->>Br : "signed_transaction"
145
158
  Br->>API : "broadcastTransactionWithCallbackAsync / broadcastTransactionAsync"
@@ -148,26 +161,29 @@ Br-->>App : "signed transaction"
148
161
  ```
149
162
 
150
163
  **Diagram sources**
151
- - [src/broadcast/index.js](file://src/broadcast/index.js#L24-L47)
152
- - [src/broadcast/index.js](file://src/broadcast/index.js#L49-L84)
153
- - [src/auth/index.js](file://src/auth/index.js#L107-L130)
154
- - [src/api/methods.js](file://src/api/methods.js#L356-L374)
164
+ - [src/broadcast/index.js:24-47](file://src/broadcast/index.js#L24-L47)
165
+ - [src/broadcast/index.js:49-84](file://src/broadcast/index.js#L49-L84)
166
+ - [src/auth/index.js:107-130](file://src/auth/index.js#L107-L130)
167
+ - [src/api/methods.js:356-374](file://src/api/methods.js#L356-L374)
155
168
 
156
169
  ## Detailed Component Analysis
157
170
 
158
171
  ### Transaction Preparation and Submission
159
172
  - Dynamic properties: Retrieves chain time and last irreversible block reference to compute expiration and reference fields.
160
- - Reference block selection: Uses last irreversible block if available; otherwise derives from head block number and block header.
161
- - Expiration: Adds a fixed offset to chain time to ensure reasonable validity window.
173
+ - Reference block selection: Uses last irreversible block if available and configured; otherwise derives from head block number and block header.
174
+ - Expiration: Adds configurable offset to chain time to ensure reasonable validity window.
162
175
  - Broadcasting modes: Supports synchronous and callback-based broadcast depending on configuration.
163
176
 
177
+ **Updated** Enhanced with configurable reference block handling and transaction expiration control.
178
+
164
179
  ```mermaid
165
180
  flowchart TD
166
181
  Start(["Prepare Transaction"]) --> GetProps["getDynamicGlobalPropertiesAsync()"]
167
- GetProps --> HasLIB{"Has LIB info?"}
168
- HasLIB --> |Yes| UseLIB["Set ref_block_num/prefix from LIB<br/>Compute expiration"]
182
+ GetProps --> CheckConfig["Check config options:<br/>reference_irreversible_block<br/>tx_expiration_seconds"]
183
+ CheckConfig --> HasLIB{"Has LIB info AND<br/>reference_irreversible_block?"}
184
+ HasLIB --> |Yes| UseLIB["Set ref_block_num/prefix from LIB<br/>Compute expiration from config"]
169
185
  HasLIB --> |No| HeadBlk["Compute ref_block_num from head block<br/>Fetch block header"]
170
- HeadBlk --> SetRef["Set ref_block_num/prefix from block header<br/>Compute expiration"]
186
+ HeadBlk --> SetRef["Set ref_block_num/prefix from block header<br/>Compute expiration from config"]
171
187
  UseLIB --> BuildTx["Merge defaults into tx"]
172
188
  SetRef --> BuildTx
173
189
  BuildTx --> Sign["Auth.signTransaction()"]
@@ -179,14 +195,14 @@ BCast --> Done
179
195
  ```
180
196
 
181
197
  **Diagram sources**
182
- - [src/broadcast/index.js](file://src/broadcast/index.js#L49-L84)
183
- - [src/auth/index.js](file://src/auth/index.js#L107-L130)
184
- - [src/api/methods.js](file://src/api/methods.js#L356-L374)
198
+ - [src/broadcast/index.js:49-93](file://src/broadcast/index.js#L49-L93)
199
+ - [src/auth/index.js:107-130](file://src/auth/index.js#L107-L130)
200
+ - [src/api/methods.js:356-374](file://src/api/methods.js#L356-L374)
185
201
 
186
202
  **Section sources**
187
- - [src/broadcast/index.js](file://src/broadcast/index.js#L49-L84)
188
- - [src/config.js](file://src/config.js#L1-L10)
189
- - [config.json](file://config.json#L5-L6)
203
+ - [src/broadcast/index.js:49-93](file://src/broadcast/index.js#L49-L93)
204
+ - [src/config.js:1-10](file://src/config.js#L1-L10)
205
+ - [config.json:6-8](file://config.json#L6-L8)
190
206
 
191
207
  ### Operation Construction and Generation
192
208
  - Operation registry defines supported operations, parameter names, and required roles.
@@ -216,14 +232,14 @@ Broadcaster --> Formatter : "uses for permlink"
216
232
  ```
217
233
 
218
234
  **Diagram sources**
219
- - [src/broadcast/operations.js](file://src/broadcast/operations.js#L1-L475)
220
- - [src/broadcast/index.js](file://src/broadcast/index.js#L89-L129)
221
- - [src/formatter.js](file://src/formatter.js#L69-L76)
235
+ - [src/broadcast/operations.js:1-475](file://src/broadcast/operations.js#L1-L475)
236
+ - [src/broadcast/index.js:89-129](file://src/broadcast/index.js#L89-L129)
237
+ - [src/formatter.js:69-76](file://src/formatter.js#L69-L76)
222
238
 
223
239
  **Section sources**
224
- - [src/broadcast/operations.js](file://src/broadcast/operations.js#L1-L475)
225
- - [src/broadcast/index.js](file://src/broadcast/index.js#L89-L129)
226
- - [src/formatter.js](file://src/formatter.js#L69-L76)
240
+ - [src/broadcast/operations.js:1-475](file://src/broadcast/operations.js#L1-L475)
241
+ - [src/broadcast/index.js:89-129](file://src/broadcast/index.js#L89-L129)
242
+ - [src/formatter.js:69-76](file://src/formatter.js#L69-L76)
227
243
 
228
244
  ### Signing and Serialization
229
245
  - Transaction serialization: Uses generated serializers for transaction and signed_transaction structures.
@@ -246,15 +262,15 @@ Ser-->>Br : "signed_transaction"
246
262
  ```
247
263
 
248
264
  **Diagram sources**
249
- - [src/auth/index.js](file://src/auth/index.js#L107-L130)
250
- - [src/auth/serializer/src/operations.js](file://src/auth/serializer/src/operations.js#L73-L125)
251
- - [src/config.js](file://src/config.js#L5-L6)
252
- - [config.json](file://config.json#L4-L4)
265
+ - [src/auth/index.js:107-130](file://src/auth/index.js#L107-L130)
266
+ - [src/auth/serializer/src/operations.js:73-125](file://src/auth/serializer/src/operations.js#L73-L125)
267
+ - [src/config.js:5-6](file://src/config.js#L5-L6)
268
+ - [config.json:4-4](file://config.json#L4-L4)
253
269
 
254
270
  **Section sources**
255
- - [src/auth/index.js](file://src/auth/index.js#L107-L130)
256
- - [src/auth/serializer/src/operations.js](file://src/auth/serializer/src/operations.js#L73-L125)
257
- - [src/auth/serializer/src/types.js](file://src/auth/serializer/src/types.js#L30-L69)
271
+ - [src/auth/index.js:107-130](file://src/auth/index.js#L107-L130)
272
+ - [src/auth/serializer/src/operations.js:73-125](file://src/auth/serializer/src/operations.js#L73-L125)
273
+ - [src/auth/serializer/src/types.js:30-69](file://src/auth/serializer/src/types.js#L30-L69)
258
274
 
259
275
  ### Supported Operations and Examples
260
276
  Common operations and their typical usage:
@@ -266,28 +282,63 @@ Common operations and their typical usage:
266
282
  Examples are provided in the example page and tests demonstrating usage patterns and callback handling.
267
283
 
268
284
  **Section sources**
269
- - [src/broadcast/operations.js](file://src/broadcast/operations.js#L2-L36)
270
- - [examples/broadcast.html](file://examples/broadcast.html#L15-L25)
271
- - [examples/broadcast.html](file://examples/broadcast.html#L27-L60)
272
- - [examples/broadcast.html](file://examples/broadcast.html#L74-L83)
273
- - [test/broadcast.test.js](file://test/broadcast.test.js#L16-L31)
274
- - [test/broadcast.test.js](file://test/broadcast.test.js#L80-L97)
275
- - [test/broadcast.test.js](file://test/broadcast.test.js#L127-L141)
285
+ - [src/broadcast/operations.js:2-36](file://src/broadcast/operations.js#L2-L36)
286
+ - [examples/broadcast.html:15-25](file://examples/broadcast.html#L15-L25)
287
+ - [examples/broadcast.html:27-60](file://examples/broadcast.html#L27-L60)
288
+ - [examples/broadcast.html:74-83](file://examples/broadcast.html#L74-L83)
289
+ - [test/broadcast.test.js:16-31](file://test/broadcast.test.js#L16-L31)
290
+ - [test/broadcast.test.js:80-97](file://test/broadcast.test.js#L80-L97)
291
+ - [test/broadcast.test.js:127-141](file://test/broadcast.test.js#L127-L141)
276
292
 
277
293
  ### Authority Management Helpers
278
294
  - Add/remove account authorizations for delegated posting or active permissions.
279
295
  - Updates account authority structures and triggers an account update transaction.
280
296
 
281
297
  **Section sources**
282
- - [src/broadcast/helpers.js](file://src/broadcast/helpers.js#L6-L80)
298
+ - [src/broadcast/helpers.js:6-80](file://src/broadcast/helpers.js#L6-L80)
283
299
 
284
300
  ### Network Transport and API Methods
285
301
  - WebSocket transport manages connection lifecycle, request queuing, and response/error handling.
286
302
  - API methods expose network broadcast endpoints used by the broadcaster.
287
303
 
288
304
  **Section sources**
289
- - [src/api/transports/ws.js](file://src/api/transports/ws.js#L27-L94)
290
- - [src/api/methods.js](file://src/api/methods.js#L356-L374)
305
+ - [src/api/transports/ws.js:27-94](file://src/api/transports/ws.js#L27-L94)
306
+ - [src/api/methods.js:356-374](file://src/api/methods.js#L356-L374)
307
+
308
+ ## Configuration Options
309
+
310
+ The VIZ JavaScript broadcast system now supports advanced configuration options for fine-tuning transaction behavior:
311
+
312
+ ### Reference Block Configuration
313
+ - `reference_irreversible_block`: Boolean flag controlling whether to use the last irreversible block (LIB) as the reference block
314
+ - When enabled: Uses `last_irreversible_block_ref_num` and `last_irreversible_block_ref_prefix` from dynamic properties
315
+ - When disabled: Falls back to head block reference using `head_block_number` and `head_block_id`
316
+
317
+ ### Transaction Expiration Configuration
318
+ - `tx_expiration_seconds`: Configurable expiration time in seconds (defaults to 60 if not specified)
319
+ - Controls how long transactions remain valid after creation
320
+ - Can be adjusted based on network conditions and application requirements
321
+
322
+ ### Configuration Usage Examples
323
+
324
+ ```javascript
325
+ // Enable irreversible block references and custom expiration
326
+ viz.config.set('reference_irreversible_block', true);
327
+ viz.config.set('tx_expiration_seconds', 120); // 2 minutes
328
+
329
+ // Disable irreversible block references (default behavior)
330
+ viz.config.set('reference_irreversible_block', false);
331
+
332
+ // Set custom expiration time
333
+ viz.config.set('tx_expiration_seconds', 300); // 5 minutes
334
+ ```
335
+
336
+ **New Section** Added comprehensive documentation for the new configuration system that enhances broadcast transaction functionality.
337
+
338
+ **Section sources**
339
+ - [src/broadcast/index.js:55-67](file://src/broadcast/index.js#L55-L67)
340
+ - [src/config.js:1-10](file://src/config.js#L1-L10)
341
+ - [config.json:6-8](file://config.json#L6-L8)
291
342
 
292
343
  ## Dependency Analysis
293
344
  High-level dependencies among broadcast components:
@@ -307,64 +358,75 @@ Cfg --> CJSON["config.json"]
307
358
  ```
308
359
 
309
360
  **Diagram sources**
310
- - [src/broadcast/index.js](file://src/broadcast/index.js#L1-L11)
311
- - [src/broadcast/operations.js](file://src/broadcast/operations.js#L1-L10)
312
- - [src/auth/index.js](file://src/auth/index.js#L1-L11)
313
- - [src/auth/serializer/src/operations.js](file://src/auth/serializer/src/operations.js#L20-L52)
314
- - [src/auth/serializer/src/types.js](file://src/auth/serializer/src/types.js#L10-L14)
315
- - [src/api/methods.js](file://src/api/methods.js#L1-L10)
316
- - [src/api/transports/ws.js](file://src/api/transports/ws.js#L1-L14)
317
- - [src/api/transports/base.js](file://src/api/transports/base.js#L1-L9)
318
- - [src/config.js](file://src/config.js#L1-L10)
319
- - [config.json](file://config.json#L1-L7)
361
+ - [src/broadcast/index.js:1-11](file://src/broadcast/index.js#L1-L11)
362
+ - [src/broadcast/operations.js:1-10](file://src/broadcast/operations.js#L1-L10)
363
+ - [src/auth/index.js:1-11](file://src/auth/index.js#L1-L11)
364
+ - [src/auth/serializer/src/operations.js:20-52](file://src/auth/serializer/src/operations.js#L20-L52)
365
+ - [src/auth/serializer/src/types.js:10-14](file://src/auth/serializer/src/types.js#L10-L14)
366
+ - [src/api/methods.js:1-10](file://src/api/methods.js#L1-L10)
367
+ - [src/api/transports/ws.js:1-14](file://src/api/transports/ws.js#L1-L14)
368
+ - [src/api/transports/base.js:1-9](file://src/api/transports/base.js#L1-L9)
369
+ - [src/config.js:1-10](file://src/config.js#L1-L10)
370
+ - [config.json:1-9](file://config.json#L1-L9)
320
371
 
321
372
  **Section sources**
322
- - [src/broadcast/index.js](file://src/broadcast/index.js#L1-L11)
323
- - [src/auth/index.js](file://src/auth/index.js#L1-L11)
324
- - [src/auth/serializer/src/operations.js](file://src/auth/serializer/src/operations.js#L20-L52)
325
- - [src/auth/serializer/src/types.js](file://src/auth/serializer/src/types.js#L10-L14)
326
- - [src/api/methods.js](file://src/api/methods.js#L1-L10)
327
- - [src/api/transports/ws.js](file://src/api/transports/ws.js#L1-L14)
328
- - [src/api/transports/base.js](file://src/api/transports/base.js#L1-L9)
329
- - [src/config.js](file://src/config.js#L1-L10)
330
- - [config.json](file://config.json#L1-L7)
373
+ - [src/broadcast/index.js:1-11](file://src/broadcast/index.js#L1-L11)
374
+ - [src/auth/index.js:1-11](file://src/auth/index.js#L1-L11)
375
+ - [src/auth/serializer/src/operations.js:20-52](file://src/auth/serializer/src/operations.js#L20-L52)
376
+ - [src/auth/serializer/src/types.js:10-14](file://src/auth/serializer/src/types.js#L10-L14)
377
+ - [src/api/methods.js:1-10](file://src/api/methods.js#L1-L10)
378
+ - [src/api/transports/ws.js:1-14](file://src/api/transports/ws.js#L1-L14)
379
+ - [src/api/transports/base.js:1-9](file://src/api/transports/base.js#L1-L9)
380
+ - [src/config.js:1-10](file://src/config.js#L1-L10)
381
+ - [config.json:1-9](file://config.json#L1-L9)
331
382
 
332
383
  ## Performance Considerations
333
- - Transaction validity window: Expiration is set to a short future offset; ensure clock synchronization to avoid premature expiration.
384
+ - Transaction validity window: Expiration is set to configurable offset; ensure clock synchronization to avoid premature expiration.
334
385
  - Reference block freshness: Using last irreversible block improves finality guarantees; fallback to head block requires careful handling of reorg risks.
335
386
  - Batch operations: Group multiple operations into a single transaction to reduce fees and latency.
336
387
  - Simulation: Use potential/signature verification APIs to estimate required keys and validate transactions before submission.
388
+ - Network optimization: Configurable reference block selection allows adaptation to different network conditions and latency requirements.
337
389
 
338
- [No sources needed since this section provides general guidance]
390
+ **Updated** Enhanced performance considerations now include configurable reference block handling and transaction expiration optimization.
339
391
 
340
392
  ## Troubleshooting Guide
341
- - Transaction rejected due to expiration: Verify dynamic properties retrieval and local time alignment.
342
- - Invalid reference block: Confirm head block and LIB availability; handle fallback logic.
393
+ - Transaction rejected due to expiration: Verify dynamic properties retrieval and local time alignment; adjust `tx_expiration_seconds` as needed.
394
+ - Invalid reference block: Confirm head block and LIB availability; handle fallback logic based on `reference_irreversible_block` setting.
343
395
  - Missing signatures: Ensure correct private keys are provided and chain ID matches the network.
344
396
  - WebSocket connectivity: Inspect transport error handling and reconnection behavior.
345
397
  - Authority issues: Use helper methods to add/remove delegated authorizations and verify account authority structures.
398
+ - Configuration issues: Verify that configuration options are properly set and accessible via the config system.
399
+
400
+ **Updated** Added troubleshooting guidance for the new configuration options and their impact on transaction behavior.
346
401
 
347
402
  **Section sources**
348
- - [src/broadcast/index.js](file://src/broadcast/index.js#L49-L84)
349
- - [src/api/transports/ws.js](file://src/api/transports/ws.js#L96-L134)
350
- - [src/broadcast/helpers.js](file://src/broadcast/helpers.js#L6-L80)
351
- - [test/broadcast.test.js](file://test/broadcast.test.js#L33-L52)
403
+ - [src/broadcast/index.js:49-93](file://src/broadcast/index.js#L49-L93)
404
+ - [src/api/transports/ws.js:96-134](file://src/api/transports/ws.js#L96-L134)
405
+ - [src/broadcast/helpers.js:6-80](file://src/broadcast/helpers.js#L6-L80)
406
+ - [test/broadcast.test.js:33-52](file://test/broadcast.test.js#L33-L52)
352
407
 
353
408
  ## Conclusion
354
- The VIZ JavaScript broadcast system provides a robust, modular pipeline for constructing, signing, and submitting transactions. It supports a wide range of operations, integrates tightly with the authentication and serialization layers, and offers flexible transport and configuration options. Following the patterns and guidelines outlined here enables reliable transaction broadcasting across applications.
409
+ The VIZ JavaScript broadcast system provides a robust, modular pipeline for constructing, signing, and submitting transactions. It supports a wide range of operations, integrates tightly with the authentication and serialization layers, and offers flexible transport and configuration options. The enhanced configuration system now provides fine-grained control over reference block handling and transaction expiration, enabling reliable transaction broadcasting across diverse applications and network conditions.
355
410
 
356
- [No sources needed since this section summarizes without analyzing specific files]
411
+ **Updated** Enhanced conclusion reflects the new configuration capabilities that improve the system's flexibility and adaptability to different use cases.
357
412
 
358
413
  ## Appendices
359
414
 
360
415
  ### Practical Examples Index
361
- - Voting: [examples/broadcast.html](file://examples/broadcast.html#L15-L25)
362
- - Comment creation: [examples/broadcast.html](file://examples/broadcast.html#L27-L60)
363
- - Post creation: [examples/broadcast.html](file://examples/broadcast.html#L44-L60)
364
- - Custom JSON: [examples/broadcast.html](file://examples/broadcast.html#L74-L83)
416
+ - Voting: [examples/broadcast.html:15-25](file://examples/broadcast.html#L15-L25)
417
+ - Comment creation: [examples/broadcast.html:27-60](file://examples/broadcast.html#L27-L60)
418
+ - Post creation: [examples/broadcast.html:44-60](file://examples/broadcast.html#L44-L60)
419
+ - Custom JSON: [examples/broadcast.html:74-83](file://examples/broadcast.html#L74-L83)
365
420
 
366
421
  ### Testing References
367
- - Generated methods existence: [test/broadcast.test.js](file://test/broadcast.test.js#L16-L31)
368
- - Transaction preparation: [test/broadcast.test.js](file://test/broadcast.test.js#L33-L52)
369
- - Downvote and vote flows: [test/broadcast.test.js](file://test/broadcast.test.js#L54-L120)
370
- - Custom JSON flow: [test/broadcast.test.js](file://test/broadcast.test.js#L122-L152)
422
+ - Generated methods existence: [test/broadcast.test.js:16-31](file://test/broadcast.test.js#L16-L31)
423
+ - Transaction preparation: [test/broadcast.test.js:33-52](file://test/broadcast.test.js#L33-L52)
424
+ - Downvote and vote flows: [test/broadcast.test.js:54-120](file://test/broadcast.test.js#L54-L120)
425
+ - Custom JSON flow: [test/broadcast.test.js:122-152](file://test/broadcast.test.js#L122-L152)
426
+
427
+ ### Configuration Examples
428
+ - Enabling irreversible block references: [config.json:6-6](file://config.json#L6-L6)
429
+ - Setting custom expiration: [config.json:7-7](file://config.json#L7-L7)
430
+ - Runtime configuration updates: [src/broadcast/index.js:55-57](file://src/broadcast/index.js#L55-L57)
431
+
432
+ **New Section** Added configuration examples and references for the new broadcast options.