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,236 @@
1
+ # VIZ Blockchain — Account Market Operations
2
+
3
+ Spec for implementing account sale operations in PHP/Node.js libraries.
4
+
5
+ Account market operations allow accounts to be bought and sold. An account owner sets their account for sale, and a buyer can purchase it.
6
+
7
+ ---
8
+
9
+ ## `set_account_price_operation`
10
+
11
+ **Type ID:** `54`
12
+ **Required authority:** `master` of `account`
13
+
14
+ Sets an account for sale or updates its sale parameters.
15
+
16
+ ### Fields
17
+
18
+ | Field | Type | Required | Description |
19
+ |---|---|---|---|
20
+ | `account` | `account_name_type` | yes | Account being listed for sale |
21
+ | `account_seller` | `account_name_type` | yes | Account to receive payment |
22
+ | `account_offer_price` | `asset` (VIZ) | yes | Asking price |
23
+ | `account_on_sale` | `bool` | yes | `true` to list, `false` to delist |
24
+
25
+ ### JSON Example
26
+
27
+ ```json
28
+ [54, {
29
+ "account": "alice",
30
+ "account_seller": "alice",
31
+ "account_offer_price": "1000.000 VIZ",
32
+ "account_on_sale": true
33
+ }]
34
+ ```
35
+
36
+ ### PHP Example
37
+
38
+ ```php
39
+ $op = [
40
+ 'type' => 'set_account_price_operation',
41
+ 'value' => [
42
+ 'account' => 'alice',
43
+ 'account_seller' => 'alice',
44
+ 'account_offer_price' => '1000.000 VIZ',
45
+ 'account_on_sale' => true,
46
+ ],
47
+ ];
48
+ ```
49
+
50
+ ### Node.js Example
51
+
52
+ ```js
53
+ const op = ['set_account_price', {
54
+ account: 'alice',
55
+ account_seller: 'alice',
56
+ account_offer_price: '1000.000 VIZ',
57
+ account_on_sale: true,
58
+ }];
59
+ ```
60
+
61
+ ### Checklist
62
+ - [ ] `account_offer_price.symbol` must be `VIZ`
63
+ - [ ] `account_offer_price.amount` > 0
64
+ - [ ] `account_on_sale: false` delists the account
65
+ - [ ] Fee (`account_on_sale_fee`) is charged when listing
66
+ - [ ] `account_seller` can differ from `account` (payment redirected)
67
+ - [ ] Sign with `account`'s master key
68
+
69
+ ---
70
+
71
+ ## `set_subaccount_price_operation`
72
+
73
+ **Type ID:** `55`
74
+ **Required authority:** `master` of `account`
75
+
76
+ Lists the right to create subaccounts of `account` for sale. A "subaccount" of `alice` would be `alice.bob`.
77
+
78
+ ### Fields
79
+
80
+ | Field | Type | Required | Description |
81
+ |---|---|---|---|
82
+ | `account` | `account_name_type` | yes | Parent account |
83
+ | `subaccount_seller` | `account_name_type` | yes | Account to receive payment |
84
+ | `subaccount_offer_price` | `asset` (VIZ) | yes | Price per subaccount creation |
85
+ | `subaccount_on_sale` | `bool` | yes | `true` to list, `false` to delist |
86
+
87
+ ### JSON Example
88
+
89
+ ```json
90
+ [55, {
91
+ "account": "alice",
92
+ "subaccount_seller": "alice",
93
+ "subaccount_offer_price": "50.000 VIZ",
94
+ "subaccount_on_sale": true
95
+ }]
96
+ ```
97
+
98
+ ### PHP Example
99
+
100
+ ```php
101
+ $op = [
102
+ 'type' => 'set_subaccount_price_operation',
103
+ 'value' => [
104
+ 'account' => 'alice',
105
+ 'subaccount_seller' => 'alice',
106
+ 'subaccount_offer_price' => '50.000 VIZ',
107
+ 'subaccount_on_sale' => true,
108
+ ],
109
+ ];
110
+ ```
111
+
112
+ ### Checklist
113
+ - [ ] `subaccount_offer_price.symbol` must be `VIZ`
114
+ - [ ] `subaccount_on_sale: false` delists
115
+ - [ ] Fee (`subaccount_on_sale_fee`) is charged when listing
116
+ - [ ] Sign with `account`'s master key
117
+
118
+ ---
119
+
120
+ ## `buy_account_operation`
121
+
122
+ **Type ID:** `56`
123
+ **Required authority:** `active` of `buyer`
124
+
125
+ Purchases an account that is listed for sale. All authorities are transferred to the buyer.
126
+
127
+ ### Fields
128
+
129
+ | Field | Type | Required | Description |
130
+ |---|---|---|---|
131
+ | `buyer` | `account_name_type` | yes | Purchasing account |
132
+ | `account` | `account_name_type` | yes | Account being purchased |
133
+ | `account_offer_price` | `asset` (VIZ) | yes | Purchase price (must match listing) |
134
+ | `account_authorities_key` | `public_key_type` | yes | New key set as all authorities of purchased account |
135
+ | `tokens_to_shares` | `asset` (VIZ) | yes | Additional VIZ to convert to SHARES for bought account |
136
+
137
+ ### JSON Example
138
+
139
+ ```json
140
+ [56, {
141
+ "buyer": "bob",
142
+ "account": "alice",
143
+ "account_offer_price": "1000.000 VIZ",
144
+ "account_authorities_key": "VIZ5newowner...",
145
+ "tokens_to_shares": "0.000 VIZ"
146
+ }]
147
+ ```
148
+
149
+ ### PHP Example
150
+
151
+ ```php
152
+ $op = [
153
+ 'type' => 'buy_account_operation',
154
+ 'value' => [
155
+ 'buyer' => 'bob',
156
+ 'account' => 'alice',
157
+ 'account_offer_price' => '1000.000 VIZ',
158
+ 'account_authorities_key' => 'VIZ5newowner...',
159
+ 'tokens_to_shares' => '0.000 VIZ',
160
+ ],
161
+ ];
162
+ ```
163
+
164
+ ### Node.js Example
165
+
166
+ ```js
167
+ const op = ['buy_account', {
168
+ buyer: 'bob',
169
+ account: 'alice',
170
+ account_offer_price: '1000.000 VIZ',
171
+ account_authorities_key: 'VIZ5newowner...',
172
+ tokens_to_shares: '0.000 VIZ',
173
+ }];
174
+ ```
175
+
176
+ ### Checklist
177
+ - [ ] `account` must be currently listed for sale (`account_on_sale: true`)
178
+ - [ ] `account_offer_price` must exactly match the listed price
179
+ - [ ] `account_authorities_key` is set as master, active, regular, and memo key
180
+ - [ ] `tokens_to_shares.symbol` must be `VIZ`
181
+ - [ ] `tokens_to_shares.amount` >= 0 (can be 0)
182
+ - [ ] Payment goes to `account_seller` as specified in the listing
183
+ - [ ] Virtual `account_sale_operation` fires on successful purchase
184
+ - [ ] Sign with `buyer`'s active key
185
+
186
+ ---
187
+
188
+ ## `target_account_sale_operation`
189
+
190
+ **Type ID:** `61`
191
+ **Required authority:** `master` of `account`
192
+
193
+ Lists an account for sale to a specific buyer only (private/targeted sale). Added in HF11.
194
+
195
+ ### Fields
196
+
197
+ | Field | Type | Required | Description |
198
+ |---|---|---|---|
199
+ | `account` | `account_name_type` | yes | Account being listed |
200
+ | `account_seller` | `account_name_type` | yes | Account to receive payment |
201
+ | `target_buyer` | `account_name_type` | yes | Only this account can buy |
202
+ | `account_offer_price` | `asset` (VIZ) | yes | Asking price |
203
+ | `account_on_sale` | `bool` | yes | `true` to list, `false` to delist |
204
+
205
+ ### JSON Example
206
+
207
+ ```json
208
+ [61, {
209
+ "account": "alice",
210
+ "account_seller": "alice",
211
+ "target_buyer": "charlie",
212
+ "account_offer_price": "500.000 VIZ",
213
+ "account_on_sale": true
214
+ }]
215
+ ```
216
+
217
+ ### PHP Example
218
+
219
+ ```php
220
+ $op = [
221
+ 'type' => 'target_account_sale_operation',
222
+ 'value' => [
223
+ 'account' => 'alice',
224
+ 'account_seller' => 'alice',
225
+ 'target_buyer' => 'charlie',
226
+ 'account_offer_price' => '500.000 VIZ',
227
+ 'account_on_sale' => true,
228
+ ],
229
+ ];
230
+ ```
231
+
232
+ ### Checklist
233
+ - [ ] Only `target_buyer` can purchase this account via `buy_account_operation`
234
+ - [ ] `account_offer_price.symbol` must be `VIZ`
235
+ - [ ] `account_on_sale: false` delists the targeted sale
236
+ - [ ] Sign with `account`'s master key
@@ -0,0 +1,199 @@
1
+ # VIZ Blockchain — Account Operations
2
+
3
+ Spec for implementing account-related operations in PHP/Node.js libraries.
4
+
5
+ ---
6
+
7
+ ## `account_create_operation`
8
+
9
+ **Type ID:** `20`
10
+ **Required authority:** `active` of `creator`
11
+
12
+ Creates a new blockchain account.
13
+
14
+ ### Fields
15
+
16
+ | Field | Type | Required | Description |
17
+ |---|---|---|---|
18
+ | `fee` | `asset` (VIZ) | yes | Creation fee (converted to SHARES for new account) |
19
+ | `delegation` | `asset` (SHARES) | yes | Initial SHARES delegation to new account |
20
+ | `creator` | `account_name_type` | yes | Account paying the fee and creating |
21
+ | `new_account_name` | `account_name_type` | yes | Name for the new account |
22
+ | `master` | `authority` | yes | Master authority for new account |
23
+ | `active` | `authority` | yes | Active authority for new account |
24
+ | `regular` | `authority` | yes | Regular authority for new account |
25
+ | `memo_key` | `public_key_type` | yes | Memo public key |
26
+ | `json_metadata` | `string` | yes | JSON metadata (may be empty `""`) |
27
+ | `referrer` | `account_name_type` | yes | Referrer account name (may be empty `""`) |
28
+ | `extensions` | `extensions_type` | yes | Always `[]` |
29
+
30
+ ### JSON Example
31
+
32
+ ```json
33
+ [20, {
34
+ "fee": "1.000 VIZ",
35
+ "delegation": "10.000000 SHARES",
36
+ "creator": "alice",
37
+ "new_account_name": "bob",
38
+ "master": {
39
+ "weight_threshold": 1,
40
+ "account_auths": [],
41
+ "key_auths": [["VIZ5hqSa4NkEZGAMUpoH5EaEr64mBJuMcPpGjvk8qb7hcPFTbXSQ9", 1]]
42
+ },
43
+ "active": {
44
+ "weight_threshold": 1,
45
+ "account_auths": [],
46
+ "key_auths": [["VIZ5hqSa4NkEZGAMUpoH5EaEr64mBJuMcPpGjvk8qb7hcPFTbXSQ9", 1]]
47
+ },
48
+ "regular": {
49
+ "weight_threshold": 1,
50
+ "account_auths": [],
51
+ "key_auths": [["VIZ5hqSa4NkEZGAMUpoH5EaEr64mBJuMcPpGjvk8qb7hcPFTbXSQ9", 1]]
52
+ },
53
+ "memo_key": "VIZ5hqSa4NkEZGAMUpoH5EaEr64mBJuMcPpGjvk8qb7hcPFTbXSQ9",
54
+ "json_metadata": "",
55
+ "referrer": "",
56
+ "extensions": []
57
+ }]
58
+ ```
59
+
60
+ ### PHP Example
61
+
62
+ ```php
63
+ $op = [
64
+ 'type' => 'account_create_operation',
65
+ 'value' => [
66
+ 'fee' => '1.000 VIZ',
67
+ 'delegation' => '10.000000 SHARES',
68
+ 'creator' => 'alice',
69
+ 'new_account_name' => 'bob',
70
+ 'master' => ['weight_threshold' => 1, 'account_auths' => [], 'key_auths' => [['VIZ5hq...', 1]]],
71
+ 'active' => ['weight_threshold' => 1, 'account_auths' => [], 'key_auths' => [['VIZ5hq...', 1]]],
72
+ 'regular' => ['weight_threshold' => 1, 'account_auths' => [], 'key_auths' => [['VIZ5hq...', 1]]],
73
+ 'memo_key' => 'VIZ5hq...',
74
+ 'json_metadata' => '',
75
+ 'referrer' => '',
76
+ 'extensions' => [],
77
+ ],
78
+ ];
79
+ ```
80
+
81
+ ### Node.js Example
82
+
83
+ ```js
84
+ const op = ['account_create', {
85
+ fee: '1.000 VIZ',
86
+ delegation: '10.000000 SHARES',
87
+ creator: 'alice',
88
+ new_account_name: 'bob',
89
+ master: { weight_threshold: 1, account_auths: [], key_auths: [['VIZ5hq...', 1]] },
90
+ active: { weight_threshold: 1, account_auths: [], key_auths: [['VIZ5hq...', 1]] },
91
+ regular: { weight_threshold: 1, account_auths: [], key_auths: [['VIZ5hq...', 1]] },
92
+ memo_key: 'VIZ5hq...',
93
+ json_metadata: '',
94
+ referrer: '',
95
+ extensions: [],
96
+ }];
97
+ ```
98
+
99
+ ### Checklist
100
+ - [ ] `fee.symbol` must be `VIZ`
101
+ - [ ] `delegation.symbol` must be `SHARES`
102
+ - [ ] `new_account_name` must pass `is_valid_create_account_name` validation
103
+ - [ ] All three authorities must be provided (even if identical)
104
+ - [ ] `memo_key` must be a valid VIZ public key
105
+ - [ ] `fee` >= chain `account_creation_fee` property
106
+ - [ ] Sign with `creator`'s active key
107
+
108
+ ---
109
+
110
+ ## `account_update_operation`
111
+
112
+ **Type ID:** `5`
113
+ **Required authority:** `master` of `account` (if changing master key), else `active`
114
+
115
+ Updates account keys and metadata.
116
+
117
+ ### Fields
118
+
119
+ | Field | Type | Required | Description |
120
+ |---|---|---|---|
121
+ | `account` | `account_name_type` | yes | Account to update |
122
+ | `master` | `optional<authority>` | no | New master authority (triggers master-auth requirement) |
123
+ | `active` | `optional<authority>` | no | New active authority |
124
+ | `regular` | `optional<authority>` | no | New regular authority |
125
+ | `memo_key` | `public_key_type` | yes | New memo key |
126
+ | `json_metadata` | `string` | yes | New JSON metadata |
127
+
128
+ ### JSON Example
129
+
130
+ ```json
131
+ [5, {
132
+ "account": "alice",
133
+ "active": {
134
+ "weight_threshold": 1,
135
+ "account_auths": [],
136
+ "key_auths": [["VIZ5new...", 1]]
137
+ },
138
+ "memo_key": "VIZ5new...",
139
+ "json_metadata": "{\"profile\":\"updated\"}"
140
+ }]
141
+ ```
142
+
143
+ ### Checklist
144
+ - [ ] `master` field is **optional** — omit (or set to `null`) if not changing master key
145
+ - [ ] If `master` is present → sign with current **master** key
146
+ - [ ] If `master` is absent → sign with current **active** key
147
+ - [ ] `memo_key` is always required (even if unchanged)
148
+
149
+ ---
150
+
151
+ ## `account_metadata_operation`
152
+
153
+ **Type ID:** `21`
154
+ **Required authority:** `regular` of `account`
155
+
156
+ Updates only the account's JSON metadata. Cheaper in bandwidth than full `account_update`.
157
+
158
+ ### Fields
159
+
160
+ | Field | Type | Required | Description |
161
+ |---|---|---|---|
162
+ | `account` | `account_name_type` | yes | Account to update |
163
+ | `json_metadata` | `string` | yes | New JSON metadata string |
164
+
165
+ ### JSON Example
166
+
167
+ ```json
168
+ [21, {
169
+ "account": "alice",
170
+ "json_metadata": "{\"name\":\"Alice\",\"about\":\"Hello!\"}"
171
+ }]
172
+ ```
173
+
174
+ ### PHP Example
175
+
176
+ ```php
177
+ $op = [
178
+ 'type' => 'account_metadata_operation',
179
+ 'value' => [
180
+ 'account' => 'alice',
181
+ 'json_metadata' => json_encode(['name' => 'Alice', 'about' => 'Hello!']),
182
+ ],
183
+ ];
184
+ ```
185
+
186
+ ### Node.js Example
187
+
188
+ ```js
189
+ const op = ['account_metadata', {
190
+ account: 'alice',
191
+ json_metadata: JSON.stringify({ name: 'Alice', about: 'Hello!' }),
192
+ }];
193
+ ```
194
+
195
+ ### Checklist
196
+ - [ ] `json_metadata` must be valid UTF-8
197
+ - [ ] Max metadata size limited by bandwidth
198
+ - [ ] Sign with `account`'s regular key
199
+ - [ ] Faster/cheaper than `account_update` for metadata-only changes
@@ -0,0 +1,162 @@
1
+ # VIZ Blockchain — Award Operations
2
+
3
+ Spec for implementing award operations in PHP/Node.js libraries.
4
+
5
+ Awards are the primary social reward mechanism in VIZ. An account spends "energy" to award SHARES directly to another account (and optionally to beneficiaries).
6
+
7
+ ---
8
+
9
+ ## `award_operation`
10
+
11
+ **Type ID:** `47`
12
+ **Required authority:** `regular` of `initiator`
13
+
14
+ Awards SHARES to `receiver` from the reward pool, proportional to the initiator's energy expenditure and SHARES stake.
15
+
16
+ ### Fields
17
+
18
+ | Field | Type | Required | Description |
19
+ |---|---|---|---|
20
+ | `initiator` | `account_name_type` | yes | Account giving the award |
21
+ | `receiver` | `account_name_type` | yes | Account receiving the award |
22
+ | `energy` | `uint16_t` | yes | Energy to spend (basis points: 1–10000) |
23
+ | `custom_sequence` | `uint64_t` | yes | Application-defined sequence number |
24
+ | `memo` | `string` | yes | Optional message/reason |
25
+ | `beneficiaries` | `vector<beneficiary_route_type>` | yes | Optional beneficiaries receiving a share |
26
+
27
+ ### JSON Example
28
+
29
+ ```json
30
+ [47, {
31
+ "initiator": "alice",
32
+ "receiver": "bob",
33
+ "energy": 1000,
34
+ "custom_sequence": 0,
35
+ "memo": "great article!",
36
+ "beneficiaries": []
37
+ }]
38
+ ```
39
+
40
+ ### PHP Example
41
+
42
+ ```php
43
+ $op = [
44
+ 'type' => 'award_operation',
45
+ 'value' => [
46
+ 'initiator' => 'alice',
47
+ 'receiver' => 'bob',
48
+ 'energy' => 1000,
49
+ 'custom_sequence' => 0,
50
+ 'memo' => 'great article!',
51
+ 'beneficiaries' => [],
52
+ ],
53
+ ];
54
+ ```
55
+
56
+ ### Node.js Example
57
+
58
+ ```js
59
+ const op = ['award', {
60
+ initiator: 'alice',
61
+ receiver: 'bob',
62
+ energy: 1000,
63
+ custom_sequence: 0,
64
+ memo: 'great article!',
65
+ beneficiaries: [],
66
+ }];
67
+ ```
68
+
69
+ ### Checklist
70
+ - [ ] `energy` range: 1–10000 (1 = 0.01%, 10000 = 100%)
71
+ - [ ] Energy regenerates at 100%/day (CHAIN_ENERGY_REGENERATION_SECONDS)
72
+ - [ ] Beneficiary weights sum must be <= 10000 (100%)
73
+ - [ ] Beneficiaries list must be sorted by account name ascending
74
+ - [ ] If beneficiaries are present, `receiver` gets `(1 - sum_beneficiary_weights/10000)` share
75
+ - [ ] `custom_sequence` is app-defined, can be 0
76
+ - [ ] Sign with `initiator`'s regular key
77
+ - [ ] Virtual `receive_award_operation` fires for `receiver`
78
+ - [ ] Virtual `benefactor_award_operation` fires for each beneficiary
79
+
80
+ ---
81
+
82
+ ## `fixed_award_operation`
83
+
84
+ **Type ID:** `60`
85
+ **Required authority:** `regular` of `initiator`
86
+
87
+ Awards a **fixed amount** of SHARES to `receiver`, spending energy proportionally based on the desired amount. Added in HF11.
88
+
89
+ ### Fields
90
+
91
+ | Field | Type | Required | Description |
92
+ |---|---|---|---|
93
+ | `initiator` | `account_name_type` | yes | Account giving the award |
94
+ | `receiver` | `account_name_type` | yes | Account receiving the award |
95
+ | `reward_amount` | `asset` (SHARES) | yes | Fixed amount of SHARES to award |
96
+ | `max_energy` | `uint16_t` | yes | Maximum energy to spend (0 = no limit) |
97
+ | `custom_sequence` | `uint64_t` | yes | Application-defined sequence number |
98
+ | `memo` | `string` | yes | Optional message/reason |
99
+ | `beneficiaries` | `vector<beneficiary_route_type>` | yes | Optional beneficiaries |
100
+
101
+ ### JSON Example
102
+
103
+ ```json
104
+ [60, {
105
+ "initiator": "alice",
106
+ "receiver": "bob",
107
+ "reward_amount": "10.000000 SHARES",
108
+ "max_energy": 5000,
109
+ "custom_sequence": 1,
110
+ "memo": "fixed reward",
111
+ "beneficiaries": [
112
+ {"account": "charlie", "weight": 1000}
113
+ ]
114
+ }]
115
+ ```
116
+
117
+ ### PHP Example
118
+
119
+ ```php
120
+ $op = [
121
+ 'type' => 'fixed_award_operation',
122
+ 'value' => [
123
+ 'initiator' => 'alice',
124
+ 'receiver' => 'bob',
125
+ 'reward_amount' => '10.000000 SHARES',
126
+ 'max_energy' => 5000,
127
+ 'custom_sequence' => 1,
128
+ 'memo' => 'fixed reward',
129
+ 'beneficiaries' => [
130
+ ['account' => 'charlie', 'weight' => 1000],
131
+ ],
132
+ ],
133
+ ];
134
+ ```
135
+
136
+ ### Node.js Example
137
+
138
+ ```js
139
+ const op = ['fixed_award', {
140
+ initiator: 'alice',
141
+ receiver: 'bob',
142
+ reward_amount: '10.000000 SHARES',
143
+ max_energy: 5000,
144
+ custom_sequence: 1,
145
+ memo: 'fixed reward',
146
+ beneficiaries: [
147
+ { account: 'charlie', weight: 1000 },
148
+ ],
149
+ }];
150
+ ```
151
+
152
+ ### Checklist
153
+ - [ ] `reward_amount.symbol` must be `SHARES`
154
+ - [ ] `reward_amount.amount` must be > 0
155
+ - [ ] `max_energy` = 0 means no energy cap (spend as much as needed)
156
+ - [ ] `max_energy` = 1–10000 limits maximum energy expenditure
157
+ - [ ] Actual energy spent depends on initiator's stake and current reward pool
158
+ - [ ] Beneficiary weights sum must be <= 10000 (100%)
159
+ - [ ] Beneficiaries list must be sorted by account name ascending
160
+ - [ ] Sign with `initiator`'s regular key
161
+ - [ ] Virtual `receive_award_operation` fires for `receiver`
162
+ - [ ] Virtual `benefactor_award_operation` fires for each beneficiary