viz-js-lib 0.11.0 → 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.
Files changed (60) hide show
  1. package/.qoder/docs/spec/viz-dns-nameserver-spec.md +982 -0
  2. package/.qoder/docs/viz-cpp-node-docs/data-types.md +322 -0
  3. package/.qoder/docs/viz-cpp-node-docs/index.md +160 -0
  4. package/.qoder/docs/viz-cpp-node-docs/op-account-market.md +236 -0
  5. package/.qoder/docs/viz-cpp-node-docs/op-account.md +199 -0
  6. package/.qoder/docs/viz-cpp-node-docs/op-award.md +162 -0
  7. package/.qoder/docs/viz-cpp-node-docs/op-committee.md +193 -0
  8. package/.qoder/docs/viz-cpp-node-docs/op-content.md +157 -0
  9. package/.qoder/docs/viz-cpp-node-docs/op-escrow.md +224 -0
  10. package/.qoder/docs/viz-cpp-node-docs/op-invite.md +219 -0
  11. package/.qoder/docs/viz-cpp-node-docs/op-proposal.md +229 -0
  12. package/.qoder/docs/viz-cpp-node-docs/op-recovery.md +188 -0
  13. package/.qoder/docs/viz-cpp-node-docs/op-subscription.md +146 -0
  14. package/.qoder/docs/viz-cpp-node-docs/op-transfer-vesting.md +224 -0
  15. package/.qoder/docs/viz-cpp-node-docs/op-witness.md +252 -0
  16. package/.qoder/docs/viz-cpp-node-docs/plugins.md +887 -0
  17. package/.qoder/docs/viz-cpp-node-docs/virtual-operations.md +513 -0
  18. package/.qoder/repowiki/en/content/API Reference/API Reference.md +724 -0
  19. package/.qoder/repowiki/en/content/API Reference/Configuration Options.md +410 -0
  20. package/.qoder/repowiki/en/content/API Reference/Core API Methods.md +547 -0
  21. package/.qoder/repowiki/en/content/API Reference/Streaming APIs.md +380 -0
  22. package/.qoder/repowiki/en/content/API Reference/Transport Layer.md +341 -0
  23. package/.qoder/repowiki/en/content/API Reference/VIZ Blockchain Operations Coverage Status.md +427 -0
  24. package/.qoder/repowiki/en/content/Authentication & Cryptography/Authentication & Cryptography.md +430 -0
  25. package/.qoder/repowiki/en/content/Authentication & Cryptography/Digital Signatures.md +462 -0
  26. package/.qoder/repowiki/en/content/Authentication & Cryptography/Key Management.md +456 -0
  27. package/.qoder/repowiki/en/content/Authentication & Cryptography/Memo Encryption.md +331 -0
  28. package/.qoder/repowiki/en/content/Authentication & Cryptography/Security Practices.md +488 -0
  29. package/.qoder/repowiki/en/content/Broadcast Transactions/Broadcast Transactions.md +432 -0
  30. package/.qoder/repowiki/en/content/Broadcast Transactions/Network Broadcasting.md +418 -0
  31. package/.qoder/repowiki/en/content/Broadcast Transactions/Operation Construction.md +352 -0
  32. package/.qoder/repowiki/en/content/Broadcast Transactions/Transaction Preparation.md +353 -0
  33. package/.qoder/repowiki/en/content/Broadcast Transactions/Transaction Signing.md +404 -0
  34. package/.qoder/repowiki/en/content/Data Serialization/Data Serialization.md +540 -0
  35. package/.qoder/repowiki/en/content/Data Serialization/Encoding & Decoding.md +463 -0
  36. package/.qoder/repowiki/en/content/Data Serialization/Object Templates.md +413 -0
  37. package/.qoder/repowiki/en/content/Data Serialization/Type System.md +514 -0
  38. package/.qoder/repowiki/en/content/Data Serialization/Validation Rules.md +439 -0
  39. package/.qoder/repowiki/en/content/Examples & Tutorials.md +485 -0
  40. package/.qoder/repowiki/en/content/Getting Started.md +345 -0
  41. package/.qoder/repowiki/en/content/Testing & Development.md +637 -0
  42. package/.qoder/repowiki/en/content/Utilities & Helpers.md +557 -0
  43. package/.qoder/repowiki/en/meta/repowiki-metadata.json +1 -0
  44. package/VIZ-JS-LIB-COVERAGE-STATUS.md +356 -0
  45. package/config.json +3 -1
  46. package/dist/statistics.html +1 -1
  47. package/dist/viz-tests.min.js +32 -42
  48. package/dist/viz-tests.min.js.gz +0 -0
  49. package/dist/viz.min.js +8 -18
  50. package/dist/viz.min.js.gz +0 -0
  51. package/lib/api/methods.js +24 -0
  52. package/lib/auth/serializer/src/ChainTypes.js +2 -1
  53. package/lib/auth/serializer/src/operations.js +35 -2
  54. package/lib/broadcast/index.js +29 -15
  55. package/lib/broadcast/operations.js +4 -0
  56. package/lib/dns.js +658 -0
  57. package/lib/index.js +3 -1
  58. package/package.json +3 -2
  59. package/test/dns.test.js +395 -0
  60. package/webpack/makeConfig.js +3 -0
@@ -0,0 +1,513 @@
1
+ # VIZ Blockchain — Virtual Operations
2
+
3
+ Virtual operations are generated by the blockchain itself (not broadcast by users). They appear in operation history and can be tracked via account history or operation history APIs. They **cannot** be included in user transactions.
4
+
5
+ ---
6
+
7
+ ## `author_reward_operation`
8
+
9
+ **Type ID:** `26`
10
+ **Trigger:** Content payout
11
+
12
+ Fired when an author receives their reward share from a content payout.
13
+
14
+ ### Fields
15
+
16
+ | Field | Type | Description |
17
+ |---|---|---|
18
+ | `author` | `account_name_type` | Content author |
19
+ | `permlink` | `string` | Content permlink |
20
+ | `token_payout` | `asset` (VIZ) | Liquid token portion of payout |
21
+ | `vesting_payout` | `asset` (SHARES) | SHARES portion of payout |
22
+
23
+ ### JSON Example
24
+
25
+ ```json
26
+ [26, {
27
+ "author": "alice",
28
+ "permlink": "my-article",
29
+ "token_payout": "1.500 VIZ",
30
+ "vesting_payout": "0.000000 SHARES"
31
+ }]
32
+ ```
33
+
34
+ ---
35
+
36
+ ## `curation_reward_operation`
37
+
38
+ **Type ID:** `27`
39
+ **Trigger:** Content payout
40
+
41
+ Fired when a curator receives their curation reward.
42
+
43
+ ### Fields
44
+
45
+ | Field | Type | Description |
46
+ |---|---|---|
47
+ | `curator` | `account_name_type` | Curator account |
48
+ | `reward` | `asset` (SHARES) | Curation reward in SHARES |
49
+ | `content_author` | `account_name_type` | Author of the curated content |
50
+ | `content_permlink` | `string` | Permlink of the curated content |
51
+
52
+ ### JSON Example
53
+
54
+ ```json
55
+ [27, {
56
+ "curator": "bob",
57
+ "reward": "0.500000 SHARES",
58
+ "content_author": "alice",
59
+ "content_permlink": "my-article"
60
+ }]
61
+ ```
62
+
63
+ ---
64
+
65
+ ## `content_reward_operation`
66
+
67
+ **Type ID:** `28`
68
+ **Trigger:** Content payout
69
+
70
+ Fired when a content post reaches its payout time.
71
+
72
+ ### Fields
73
+
74
+ | Field | Type | Description |
75
+ |---|---|---|
76
+ | `author` | `account_name_type` | Content author |
77
+ | `permlink` | `string` | Content permlink |
78
+ | `payout` | `asset` | Total payout amount |
79
+
80
+ ---
81
+
82
+ ## `fill_vesting_withdraw_operation`
83
+
84
+ **Type ID:** `29`
85
+ **Trigger:** Each vesting withdrawal interval
86
+
87
+ Fired each time a vesting withdrawal interval completes (weekly).
88
+
89
+ ### Fields
90
+
91
+ | Field | Type | Description |
92
+ |---|---|---|
93
+ | `from_account` | `account_name_type` | Account withdrawing |
94
+ | `to_account` | `account_name_type` | Account receiving (may differ via route) |
95
+ | `withdrawn` | `asset` (SHARES) | SHARES amount withdrawn this interval |
96
+ | `deposited` | `asset` (VIZ) | VIZ tokens deposited to `to_account` |
97
+
98
+ ### JSON Example
99
+
100
+ ```json
101
+ [29, {
102
+ "from_account": "alice",
103
+ "to_account": "alice",
104
+ "withdrawn": "35.714285 SHARES",
105
+ "deposited": "10.000 VIZ"
106
+ }]
107
+ ```
108
+
109
+ ### Checklist for listeners
110
+ - [ ] Fired once per interval (default: every 1 day) for each active withdrawal
111
+ - [ ] `to_account` may differ if `set_withdraw_vesting_route_operation` was used
112
+ - [ ] If `auto_vest == true` in route, `deposited` will be SHARES, not VIZ
113
+
114
+ ---
115
+
116
+ ## `shutdown_witness_operation`
117
+
118
+ **Type ID:** `30`
119
+ **Trigger:** Witness removed due to vote weight falling below threshold
120
+
121
+ ### Fields
122
+
123
+ | Field | Type | Description |
124
+ |---|---|---|
125
+ | `owner` | `account_name_type` | Witness that was shut down |
126
+
127
+ ---
128
+
129
+ ## `hardfork_operation`
130
+
131
+ **Type ID:** `31`
132
+ **Trigger:** Network hardfork activation
133
+
134
+ ### Fields
135
+
136
+ | Field | Type | Description |
137
+ |---|---|---|
138
+ | `hardfork_id` | `uint32_t` | Hardfork number |
139
+
140
+ ---
141
+
142
+ ## `content_payout_update_operation`
143
+
144
+ **Type ID:** `32`
145
+ **Trigger:** Content payout update
146
+
147
+ Fired when content payout is updated (e.g., after vote changes).
148
+
149
+ ### Fields
150
+
151
+ | Field | Type | Description |
152
+ |---|---|---|
153
+ | `author` | `account_name_type` | Content author |
154
+ | `permlink` | `string` | Content permlink |
155
+
156
+ ---
157
+
158
+ ## `content_benefactor_reward_operation`
159
+
160
+ **Type ID:** `33`
161
+ **Trigger:** Content payout
162
+
163
+ Fired for each beneficiary when content is paid out.
164
+
165
+ ### Fields
166
+
167
+ | Field | Type | Description |
168
+ |---|---|---|
169
+ | `benefactor` | `account_name_type` | Beneficiary account |
170
+ | `author` | `account_name_type` | Content author |
171
+ | `permlink` | `string` | Content permlink |
172
+ | `reward` | `asset` | Beneficiary's reward share |
173
+
174
+ ---
175
+
176
+ ## `return_vesting_delegation_operation`
177
+
178
+ **Type ID:** `34`
179
+ **Trigger:** End of vesting delegation limbo period (1 week after delegation removal)
180
+
181
+ ### Fields
182
+
183
+ | Field | Type | Description |
184
+ |---|---|---|
185
+ | `account` | `account_name_type` | Account receiving the returned SHARES |
186
+ | `vesting_shares` | `asset` (SHARES) | SHARES returned from limbo |
187
+
188
+ ### JSON Example
189
+
190
+ ```json
191
+ [34, {
192
+ "account": "alice",
193
+ "vesting_shares": "500.000000 SHARES"
194
+ }]
195
+ ```
196
+
197
+ ---
198
+
199
+ ## `committee_cancel_request_operation`
200
+
201
+ **Type ID:** `38`
202
+ **Trigger:** Committee request expires without enough votes
203
+
204
+ ### Fields
205
+
206
+ | Field | Type | Description |
207
+ |---|---|---|
208
+ | `request_id` | `uint32_t` | ID of cancelled request |
209
+
210
+ ---
211
+
212
+ ## `committee_approve_request_operation`
213
+
214
+ **Type ID:** `39`
215
+ **Trigger:** Committee request reaches required approval threshold
216
+
217
+ ### Fields
218
+
219
+ | Field | Type | Description |
220
+ |---|---|---|
221
+ | `request_id` | `uint32_t` | ID of approved request |
222
+
223
+ ---
224
+
225
+ ## `committee_payout_request_operation`
226
+
227
+ **Type ID:** `40`
228
+ **Trigger:** Committee request payout is processed
229
+
230
+ ### Fields
231
+
232
+ | Field | Type | Description |
233
+ |---|---|---|
234
+ | `request_id` | `uint32_t` | ID of paid request |
235
+
236
+ ---
237
+
238
+ ## `committee_pay_request_operation`
239
+
240
+ **Type ID:** `41`
241
+ **Trigger:** Worker receives payment from committee
242
+
243
+ ### Fields
244
+
245
+ | Field | Type | Description |
246
+ |---|---|---|
247
+ | `worker` | `account_name_type` | Worker account receiving payment |
248
+ | `request_id` | `uint32_t` | Committee request ID |
249
+ | `tokens` | `asset` (VIZ) | Amount paid to worker |
250
+
251
+ ### JSON Example
252
+
253
+ ```json
254
+ [41, {
255
+ "worker": "alice",
256
+ "request_id": 42,
257
+ "tokens": "250.000 VIZ"
258
+ }]
259
+ ```
260
+
261
+ ---
262
+
263
+ ## `witness_reward_operation`
264
+
265
+ **Type ID:** `42`
266
+ **Trigger:** Block production reward
267
+
268
+ Fired when a witness receives their block production reward.
269
+
270
+ ### Fields
271
+
272
+ | Field | Type | Description |
273
+ |---|---|---|
274
+ | `witness` | `account_name_type` | Witness account |
275
+ | `shares` | `asset` (SHARES) | Reward in SHARES |
276
+
277
+ ### JSON Example
278
+
279
+ ```json
280
+ [42, {
281
+ "witness": "alice",
282
+ "shares": "1.234567 SHARES"
283
+ }]
284
+ ```
285
+
286
+ ---
287
+
288
+ ## `receive_award_operation`
289
+
290
+ **Type ID:** `48`
291
+ **Trigger:** `award_operation` or `fixed_award_operation`
292
+
293
+ Fired when the receiver gets their award.
294
+
295
+ ### Fields
296
+
297
+ | Field | Type | Description |
298
+ |---|---|---|
299
+ | `initiator` | `account_name_type` | Account that gave the award |
300
+ | `receiver` | `account_name_type` | Account that received the award |
301
+ | `custom_sequence` | `uint64_t` | App-defined sequence from the award op |
302
+ | `memo` | `string` | Memo from the award op |
303
+ | `shares` | `asset` (SHARES) | SHARES received |
304
+
305
+ ### JSON Example
306
+
307
+ ```json
308
+ [48, {
309
+ "initiator": "alice",
310
+ "receiver": "bob",
311
+ "custom_sequence": 0,
312
+ "memo": "great article!",
313
+ "shares": "5.000000 SHARES"
314
+ }]
315
+ ```
316
+
317
+ ---
318
+
319
+ ## `benefactor_award_operation`
320
+
321
+ **Type ID:** `49`
322
+ **Trigger:** `award_operation` or `fixed_award_operation` with beneficiaries
323
+
324
+ Fired for each beneficiary when an award is given.
325
+
326
+ ### Fields
327
+
328
+ | Field | Type | Description |
329
+ |---|---|---|
330
+ | `initiator` | `account_name_type` | Account that gave the award |
331
+ | `benefactor` | `account_name_type` | Beneficiary account |
332
+ | `receiver` | `account_name_type` | Primary receiver of the award |
333
+ | `custom_sequence` | `uint64_t` | App-defined sequence |
334
+ | `memo` | `string` | Memo from the award op |
335
+ | `shares` | `asset` (SHARES) | SHARES received by beneficiary |
336
+
337
+ ---
338
+
339
+ ## `paid_subscription_action_operation`
340
+
341
+ **Type ID:** `52`
342
+ **Trigger:** `paid_subscribe_operation` or auto-renewal payment
343
+
344
+ Fired on each subscription payment.
345
+
346
+ ### Fields
347
+
348
+ | Field | Type | Description |
349
+ |---|---|---|
350
+ | `subscriber` | `account_name_type` | Subscriber account |
351
+ | `account` | `account_name_type` | Subscription provider |
352
+ | `level` | `uint16_t` | Subscription level |
353
+ | `amount` | `asset` (VIZ) | Payment amount |
354
+ | `period` | `uint16_t` | Number of periods |
355
+ | `summary_duration_sec` | `uint64_t` | Total subscription duration in seconds |
356
+ | `summary_amount` | `asset` (VIZ) | Total amount paid to date |
357
+
358
+ ### JSON Example
359
+
360
+ ```json
361
+ [52, {
362
+ "subscriber": "bob",
363
+ "account": "alice",
364
+ "level": 2,
365
+ "amount": "20.000 VIZ",
366
+ "period": 1,
367
+ "summary_duration_sec": 2592000,
368
+ "summary_amount": "20.000 VIZ"
369
+ }]
370
+ ```
371
+
372
+ ---
373
+
374
+ ## `cancel_paid_subscription_operation`
375
+
376
+ **Type ID:** `53`
377
+ **Trigger:** Subscription expiry without renewal, or insufficient funds for auto-renewal
378
+
379
+ ### Fields
380
+
381
+ | Field | Type | Description |
382
+ |---|---|---|
383
+ | `subscriber` | `account_name_type` | Subscriber account |
384
+ | `account` | `account_name_type` | Subscription provider |
385
+
386
+ ---
387
+
388
+ ## `account_sale_operation`
389
+
390
+ **Type ID:** `57`
391
+ **Trigger:** `buy_account_operation` completes successfully
392
+
393
+ Fired when an account is sold.
394
+
395
+ ### Fields
396
+
397
+ | Field | Type | Description |
398
+ |---|---|---|
399
+ | `account` | `account_name_type` | Account that was sold |
400
+ | `price` | `asset` (VIZ) | Sale price |
401
+ | `buyer` | `account_name_type` | Buyer account |
402
+ | `seller` | `account_name_type` | Seller (payment recipient) |
403
+
404
+ ### JSON Example
405
+
406
+ ```json
407
+ [57, {
408
+ "account": "alice",
409
+ "price": "1000.000 VIZ",
410
+ "buyer": "bob",
411
+ "seller": "alice"
412
+ }]
413
+ ```
414
+
415
+ ---
416
+
417
+ ## `expire_escrow_ratification_operation`
418
+
419
+ **Type ID:** `59`
420
+ **Trigger:** Escrow not ratified by both parties before `ratification_deadline`
421
+
422
+ Fired when an escrow expires before being fully approved. Funds are returned to `from`.
423
+
424
+ ### Fields
425
+
426
+ | Field | Type | Description |
427
+ |---|---|---|
428
+ | `from` | `account_name_type` | Original escrow sender |
429
+ | `to` | `account_name_type` | Original intended recipient |
430
+ | `agent` | `account_name_type` | Escrow agent |
431
+ | `escrow_id` | `uint32_t` | Escrow ID |
432
+ | `token_amount` | `asset` (VIZ) | Returned token amount |
433
+ | `fee` | `asset` (VIZ) | Fee returned (agent not paid since not approved) |
434
+ | `ratification_deadline` | `time_point_sec` | Deadline that was missed |
435
+
436
+ ---
437
+
438
+ ## `bid_operation`
439
+
440
+ **Type ID:** `62`
441
+ **Trigger:** New bid placed on an account for sale (HF11)
442
+
443
+ ### Fields
444
+
445
+ | Field | Type | Description |
446
+ |---|---|---|
447
+ | `account` | `account_name_type` | Account being bid on |
448
+ | `bidder` | `account_name_type` | Account placing the bid |
449
+ | `bid` | `asset` (VIZ) | Bid amount |
450
+
451
+ ---
452
+
453
+ ## `outbid_operation`
454
+
455
+ **Type ID:** `63`
456
+ **Trigger:** A previous bidder is outbid (HF11)
457
+
458
+ Fired when a previous bid is replaced by a higher bid. The outbid amount is returned.
459
+
460
+ ### Fields
461
+
462
+ | Field | Type | Description |
463
+ |---|---|---|
464
+ | `account` | `account_name_type` | Account being bid on |
465
+ | `bidder` | `account_name_type` | Account that was outbid |
466
+ | `bid` | `asset` (VIZ) | Returned bid amount |
467
+
468
+ ---
469
+
470
+ ## Implementation Notes for Libraries
471
+
472
+ ### Listening to Virtual Operations
473
+
474
+ ```php
475
+ // PHP: subscribe to account history
476
+ $history = $api->get_account_history('alice', -1, 100);
477
+ foreach ($history as [$index, $entry]) {
478
+ $opType = $entry['op'][0];
479
+ $opData = $entry['op'][1];
480
+ switch ($opType) {
481
+ case 'receive_award_operation':
482
+ // handle award received
483
+ break;
484
+ case 'fill_vesting_withdraw_operation':
485
+ // handle withdrawal
486
+ break;
487
+ }
488
+ }
489
+ ```
490
+
491
+ ```js
492
+ // Node.js: stream operations
493
+ client.database.getAccountHistory('alice', -1, 100).then(history => {
494
+ for (const [index, entry] of history) {
495
+ const [opType, opData] = entry.op;
496
+ switch (opType) {
497
+ case 'receive_award':
498
+ // handle award
499
+ break;
500
+ case 'witness_reward':
501
+ // handle witness reward
502
+ break;
503
+ }
504
+ }
505
+ });
506
+ ```
507
+
508
+ ### Checklist for Virtual Operation Handling
509
+ - [ ] Virtual operations are read-only — never include them in transactions
510
+ - [ ] Filter by operation type in account/operation history
511
+ - [ ] Virtual ops share the same type variant as regular ops — use the same deserialization
512
+ - [ ] `summary_duration_sec` in paid subscriptions may be 0 for first payment
513
+ - [ ] Multiple virtual ops may fire in the same block for the same account