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
Binary file
@@ -165,6 +165,14 @@ module.exports = [{
165
165
  "api": "database_api",
166
166
  "method": "get_owner_history",
167
167
  "params": ["account"]
168
+ }, {
169
+ "api": "database_api",
170
+ "method": "get_master_history",
171
+ "params": ["account"]
172
+ }, {
173
+ "api": "database_api",
174
+ "method": "set_block_applied_callback",
175
+ "params": ["callback"]
168
176
  }, {
169
177
  "api": "database_api",
170
178
  "method": "get_recovery_request",
@@ -344,4 +352,20 @@ module.exports = [{
344
352
  "api": "custom_protocol_api",
345
353
  "method": "get_account",
346
354
  "params": ["account", "custom_protocol_id"]
355
+ }, {
356
+ "api": "auth_util",
357
+ "method": "check_authority_signature",
358
+ "params": ["account_name", "level", "signatures"]
359
+ }, {
360
+ "api": "block_info",
361
+ "method": "get_block_info",
362
+ "params": ["start_block_num", "count"]
363
+ }, {
364
+ "api": "block_info",
365
+ "method": "get_blocks_with_info",
366
+ "params": ["start_block_num", "count"]
367
+ }, {
368
+ "api": "raw_block",
369
+ "method": "get_raw_block",
370
+ "params": ["block_num"]
347
371
  }];
@@ -74,7 +74,8 @@ ChainTypes.operations = {
74
74
  fixed_award: 60,
75
75
  target_account_sale: 61,
76
76
  bid: 62,
77
- outbid: 63
77
+ outbid: 63,
78
+ set_reward_sharing: 64
78
79
  };
79
80
 
80
81
  //types.hpp
@@ -572,10 +572,38 @@ var chain_properties_hf9 = new Serializer(3, {
572
572
  witness_declaration_fee: asset,
573
573
  withdraw_intervals: uint16
574
574
  });
575
+ var chain_properties_hf13 = new Serializer(4, {
576
+ account_creation_fee: asset,
577
+ maximum_block_size: uint32,
578
+ create_account_delegation_ratio: uint32,
579
+ create_account_delegation_time: uint32,
580
+ min_delegation: asset,
581
+ min_curation_percent: int16,
582
+ max_curation_percent: int16,
583
+ bandwidth_reserve_percent: int16,
584
+ bandwidth_reserve_below: asset,
585
+ flag_energy_additional_cost: int16,
586
+ vote_accounting_min_rshares: uint32,
587
+ committee_request_approve_min_percent: int16,
588
+ inflation_witness_percent: int16,
589
+ inflation_ratio_committee_vs_reward_fund: int16,
590
+ inflation_recalc_period: uint32,
591
+ data_operations_cost_additional_bandwidth: uint32,
592
+ witness_miss_penalty_percent: int16,
593
+ witness_miss_penalty_duration: uint32,
594
+ create_invite_min_balance: asset,
595
+ committee_create_request_fee: asset,
596
+ create_paid_subscription_fee: asset,
597
+ account_on_sale_fee: asset,
598
+ subaccount_on_sale_fee: asset,
599
+ witness_declaration_fee: asset,
600
+ withdraw_intervals: uint16,
601
+ distribution_epoch_length: uint32
602
+ });
575
603
 
576
604
  var versioned_chain_properties_update = new Serializer("versioned_chain_properties_update", {
577
605
  owner: string,
578
- props: static_variant([chain_properties_init, chain_properties_hf4, chain_properties_hf6, chain_properties_hf9])
606
+ props: static_variant([chain_properties_init, chain_properties_hf4, chain_properties_hf6, chain_properties_hf9, chain_properties_hf13])
579
607
  });
580
608
 
581
609
  var receive_award = new Serializer("receive_award", {
@@ -690,7 +718,12 @@ var outbid = new Serializer("outbid", {
690
718
  bid: asset
691
719
  });
692
720
 
693
- operation.st_operations = [vote, content, transfer, transfer_to_vesting, withdraw_vesting, account_update, witness_update, account_witness_vote, account_witness_proxy, delete_content, custom, set_withdraw_vesting_route, request_account_recovery, recover_account, change_recovery_account, escrow_transfer, escrow_dispute, escrow_release, escrow_approve, delegate_vesting_shares, account_create, account_metadata, proposal_create, proposal_update, proposal_delete, chain_properties_update, author_reward, curation_reward, content_reward, fill_vesting_withdraw, shutdown_witness, hardfork, content_payout_update, content_benefactor_reward, return_vesting_delegation, committee_worker_create_request, committee_worker_cancel_request, committee_vote_request, committee_cancel_request, committee_approve_request, committee_pay_request, committee_payout_request, witness_reward, create_invite, claim_invite_balance, invite_registration, versioned_chain_properties_update, award, receive_award, benefactor_award, set_paid_subscription, paid_subscribe, paid_subscription_action, cancel_paid_subscription, set_account_price, set_subaccount_price, buy_account, account_sale, use_invite_balance, expire_escrow_ratification, fixed_award, target_account_sale, bid, outbid];
721
+ var set_reward_sharing = new Serializer("set_reward_sharing", {
722
+ owner: string,
723
+ sharing_rate: uint16
724
+ });
725
+
726
+ operation.st_operations = [vote, content, transfer, transfer_to_vesting, withdraw_vesting, account_update, witness_update, account_witness_vote, account_witness_proxy, delete_content, custom, set_withdraw_vesting_route, request_account_recovery, recover_account, change_recovery_account, escrow_transfer, escrow_dispute, escrow_release, escrow_approve, delegate_vesting_shares, account_create, account_metadata, proposal_create, proposal_update, proposal_delete, chain_properties_update, author_reward, curation_reward, content_reward, fill_vesting_withdraw, shutdown_witness, hardfork, content_payout_update, content_benefactor_reward, return_vesting_delegation, committee_worker_create_request, committee_worker_cancel_request, committee_vote_request, committee_cancel_request, committee_approve_request, committee_pay_request, committee_payout_request, witness_reward, create_invite, claim_invite_balance, invite_registration, versioned_chain_properties_update, award, receive_award, benefactor_award, set_paid_subscription, paid_subscribe, paid_subscription_action, cancel_paid_subscription, set_account_price, set_subaccount_price, buy_account, account_sale, use_invite_balance, expire_escrow_ratification, fixed_award, target_account_sale, bid, outbid, set_reward_sharing];
694
727
 
695
728
  //# -------------------------------
696
729
  //# Generated code end S T O P
@@ -74,28 +74,42 @@ Broadcaster._prepareTransaction = function Broadcaster$_prepareTransaction(tx) {
74
74
  return propertiesP.then(function (properties) {
75
75
  // Set defaults on the transaction
76
76
  var chainDate = new Date(properties.time + 'Z');
77
- var need_get_block = true;
78
- if (typeof properties.last_irreversible_block_ref_num !== 'undefined') {
79
- if (0 != properties.last_irreversible_block_ref_num) {
80
- need_get_block = false;
77
+ var expirationSeconds = _config2.default.get('tx_expiration_seconds') || 60;
78
+ var expiration = new Date(chainDate.getTime() + expirationSeconds * 1000);
79
+ var useIrreversible = _config2.default.get('reference_irreversible_block');
80
+
81
+ if (useIrreversible) {
82
+ if (typeof properties.last_irreversible_block_ref_num !== 'undefined' && properties.last_irreversible_block_ref_num !== 0) {
81
83
  return Object.assign({
82
84
  ref_block_num: properties.last_irreversible_block_ref_num,
83
85
  ref_block_prefix: properties.last_irreversible_block_ref_prefix,
84
- expiration: new Date(chainDate.getTime() + 60 * 1000)
86
+ expiration: expiration
85
87
  }, tx);
86
88
  }
87
89
  }
88
- if (need_get_block) {
89
- var refBlockNum = properties.head_block_number - 3 & 0xFFFF;
90
- return _api2.default.getBlockAsync(properties.head_block_number - 2).then(function (block) {
91
- var headBlockId = block.previous;
92
- return Object.assign({
93
- ref_block_num: refBlockNum,
94
- ref_block_prefix: new Buffer(headBlockId, 'hex').readUInt32LE(4),
95
- expiration: new Date(chainDate.getTime() + 60 * 1000)
96
- }, tx);
97
- });
90
+
91
+ // Default: use head block directly (cli_wallet behavior, no offset)
92
+ var refBlockNum = properties.head_block_number & 0xFFFF;
93
+
94
+ if (properties.head_block_id) {
95
+ var refBlockPrefix = new Buffer(properties.head_block_id, 'hex').readUInt32LE(4);
96
+ return Object.assign({
97
+ ref_block_num: refBlockNum,
98
+ ref_block_prefix: refBlockPrefix,
99
+ expiration: expiration
100
+ }, tx);
98
101
  }
102
+
103
+ // Fallback for older nodes without head_block_id in dynamic global properties
104
+ var fallbackRefBlockNum = properties.head_block_number - 3 & 0xFFFF;
105
+ return _api2.default.getBlockAsync(properties.head_block_number - 2).then(function (block) {
106
+ var headBlockId = block.previous;
107
+ return Object.assign({
108
+ ref_block_num: fallbackRefBlockNum,
109
+ ref_block_prefix: new Buffer(headBlockId, 'hex').readUInt32LE(4),
110
+ expiration: expiration
111
+ }, tx);
112
+ });
99
113
  });
100
114
  };
101
115
 
@@ -180,4 +180,8 @@ module.exports = [{
180
180
  "roles": ["active"],
181
181
  "operation": "use_invite_balance",
182
182
  "params": ["initiator", "receiver", "invite_secret"]
183
+ }, {
184
+ "roles": ["active"],
185
+ "operation": "set_reward_sharing",
186
+ "params": ["owner", "sharing_rate"]
183
187
  }];