viz-js-lib 0.12.5 → 0.12.6

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.
Binary file
@@ -1,36 +1,65 @@
1
1
  "use strict";
2
2
 
3
3
  module.exports = [{
4
- "api": "witness_api",
4
+ "api": "validator_api",
5
5
  "method": "get_miner_queue"
6
6
  }, {
7
- "api": "witness_api",
7
+ "api": "validator_api",
8
+ "method": "get_validator_schedule"
9
+ }, {
10
+ "api": "validator_api",
8
11
  "method": "get_witness_schedule"
9
12
  }, {
10
- "api": "witness_api",
13
+ "api": "validator_api",
14
+ "method": "get_validators",
15
+ "params": ["validatorIds"]
16
+ }, {
17
+ "api": "validator_api",
11
18
  "method": "get_witnesses",
12
19
  "params": ["witnessIds"]
13
20
  }, {
14
- "api": "witness_api",
21
+ "api": "validator_api",
22
+ "method": "get_validator_by_account",
23
+ "params": ["accountName"]
24
+ }, {
25
+ "api": "validator_api",
15
26
  "method": "get_witness_by_account",
16
27
  "params": ["accountName"]
17
28
  }, {
18
- "api": "witness_api",
29
+ "api": "validator_api",
30
+ "method": "get_validators_by_vote",
31
+ "params": ["from", "limit"]
32
+ }, {
33
+ "api": "validator_api",
19
34
  "method": "get_witnesses_by_vote",
20
35
  "params": ["from", "limit"]
21
36
  }, {
22
- "api": "witness_api",
37
+ "api": "validator_api",
38
+ "method": "get_validators_by_counted_vote",
39
+ "params": ["from", "limit"]
40
+ }, {
41
+ "api": "validator_api",
23
42
  "method": "get_witnesses_by_counted_vote",
24
43
  "params": ["from", "limit"]
25
44
  }, {
26
- "api": "witness_api",
45
+ "api": "validator_api",
46
+ "method": "get_validator_count"
47
+ }, {
48
+ "api": "validator_api",
27
49
  "method": "get_witness_count"
28
50
  }, {
29
- "api": "witness_api",
51
+ "api": "validator_api",
52
+ "method": "lookup_validator_accounts",
53
+ "params": ["lowerBoundName", "limit"]
54
+ }, {
55
+ "api": "validator_api",
30
56
  "method": "lookup_witness_accounts",
31
57
  "params": ["lowerBoundName", "limit"]
32
58
  }, {
33
- "api": "witness_api",
59
+ "api": "validator_api",
60
+ "method": "get_active_validators"
61
+ }, {
62
+ "api": "validator_api",
34
63
  "method": "get_active_witnesses"
35
64
  }, {
36
65
  "api": "account_history",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var ChainTypes;
3
+ var ChainTypes = void 0;
4
4
 
5
5
  module.exports = ChainTypes = {};
6
6
 
@@ -17,9 +17,9 @@ ChainTypes.operations = {
17
17
  transfer_to_vesting: 3,
18
18
  withdraw_vesting: 4,
19
19
  account_update: 5,
20
- witness_update: 6,
21
- account_witness_vote: 7,
22
- account_witness_proxy: 8,
20
+ validator_update: 6,
21
+ account_validator_vote: 7,
22
+ account_validator_proxy: 8,
23
23
  delete_content: 9,
24
24
  custom: 10,
25
25
  set_withdraw_vesting_route: 11,
@@ -41,7 +41,7 @@ ChainTypes.operations = {
41
41
  curation_reward: 27,
42
42
  content_reward: 28,
43
43
  fill_vesting_withdraw: 29,
44
- shutdown_witness: 30,
44
+ shutdown_validator: 30,
45
45
  hardfork: 31,
46
46
  content_payout_update: 32,
47
47
  content_benefactor_reward: 33,
@@ -53,7 +53,7 @@ ChainTypes.operations = {
53
53
  committee_approve_request: 39,
54
54
  committee_payout_request: 40,
55
55
  committee_pay_request: 41,
56
- witness_reward: 42,
56
+ validator_reward: 42,
57
57
  create_invite: 43,
58
58
  claim_invite_balance: 44,
59
59
  invite_registration: 45,
@@ -75,7 +75,13 @@ ChainTypes.operations = {
75
75
  target_account_sale: 61,
76
76
  bid: 62,
77
77
  outbid: 63,
78
- set_reward_sharing: 64
78
+ set_reward_sharing: 64,
79
+ // Aliases for backward compatibility (old witness names)
80
+ witness_update: 6,
81
+ account_witness_vote: 7,
82
+ account_witness_proxy: 8,
83
+ shutdown_witness: 30,
84
+ witness_reward: 42
79
85
  };
80
86
 
81
87
  //types.hpp
@@ -124,17 +124,17 @@ var signed_transaction = new Serializer("signed_transaction", {
124
124
  var signed_block = new Serializer("signed_block", {
125
125
  previous: bytes(20),
126
126
  timestamp: time_point_sec,
127
- witness: string,
127
+ validator: string,
128
128
  transaction_merkle_root: bytes(20),
129
129
  extensions: set(static_variant([future_extensions, version, hardfork_version_vote])),
130
- witness_signature: bytes(65),
130
+ validator_signature: bytes(65),
131
131
  transactions: array(signed_transaction)
132
132
  });
133
133
 
134
134
  var block_header = new Serializer("block_header", {
135
135
  previous: bytes(20),
136
136
  timestamp: time_point_sec,
137
- witness: string,
137
+ validator: string,
138
138
  transaction_merkle_root: bytes(20),
139
139
  extensions: set(static_variant([future_extensions, version, hardfork_version_vote]))
140
140
  });
@@ -142,10 +142,10 @@ var block_header = new Serializer("block_header", {
142
142
  var signed_block_header = new Serializer("signed_block_header", {
143
143
  previous: bytes(20),
144
144
  timestamp: time_point_sec,
145
- witness: string,
145
+ validator: string,
146
146
  transaction_merkle_root: bytes(20),
147
147
  extensions: set(static_variant([future_extensions, version, hardfork_version_vote])),
148
- witness_signature: bytes(65)
148
+ validator_signature: bytes(65)
149
149
  });
150
150
 
151
151
  var vote = new Serializer("vote", {
@@ -215,7 +215,7 @@ var chain_properties_init = new Serializer("chain_properties_init", {
215
215
  committee_request_approve_min_percent: int16
216
216
  });
217
217
 
218
- var witness_update = new Serializer("witness_update", {
218
+ var validator_update = new Serializer("validator_update", {
219
219
  owner: string,
220
220
  url: string,
221
221
  block_signing_key: public_key
@@ -226,13 +226,13 @@ var chain_properties_update = new Serializer("chain_properties_update", {
226
226
  props: chain_properties_init
227
227
  });
228
228
 
229
- var account_witness_vote = new Serializer("account_witness_vote", {
229
+ var account_validator_vote = new Serializer("account_validator_vote", {
230
230
  account: string,
231
- witness: string,
231
+ validator: string,
232
232
  approve: bool
233
233
  });
234
234
 
235
- var account_witness_proxy = new Serializer("account_witness_proxy", {
235
+ var account_validator_proxy = new Serializer("account_validator_proxy", {
236
236
  account: string,
237
237
  proxy: string
238
238
  });
@@ -402,7 +402,7 @@ var fill_vesting_withdraw = new Serializer("fill_vesting_withdraw", {
402
402
  deposited: asset
403
403
  });
404
404
 
405
- var shutdown_witness = new Serializer("shutdown_witness", {
405
+ var shutdown_validator = new Serializer("shutdown_validator", {
406
406
  owner: string
407
407
  });
408
408
 
@@ -465,8 +465,8 @@ var committee_payout_request = new Serializer("committee_payout_request", {
465
465
  request_id: uint32
466
466
  });
467
467
 
468
- var witness_reward = new Serializer("witness_reward", {
469
- witness: string,
468
+ var validator_reward = new Serializer("validator_reward", {
469
+ validator: string,
470
470
  shares: asset
471
471
  });
472
472
 
@@ -521,7 +521,7 @@ var chain_properties_hf4 = new Serializer(1, {
521
521
  flag_energy_additional_cost: int16,
522
522
  vote_accounting_min_rshares: uint32,
523
523
  committee_request_approve_min_percent: int16,
524
- inflation_witness_percent: int16,
524
+ inflation_validator_percent: int16,
525
525
  inflation_ratio_committee_vs_reward_fund: int16,
526
526
  inflation_recalc_period: uint32
527
527
  });
@@ -538,12 +538,12 @@ var chain_properties_hf6 = new Serializer(2, {
538
538
  flag_energy_additional_cost: int16,
539
539
  vote_accounting_min_rshares: uint32,
540
540
  committee_request_approve_min_percent: int16,
541
- inflation_witness_percent: int16,
541
+ inflation_validator_percent: int16,
542
542
  inflation_ratio_committee_vs_reward_fund: int16,
543
543
  inflation_recalc_period: uint32,
544
544
  data_operations_cost_additional_bandwidth: uint32,
545
- witness_miss_penalty_percent: int16,
546
- witness_miss_penalty_duration: uint32
545
+ validator_miss_penalty_percent: int16,
546
+ validator_miss_penalty_duration: uint32
547
547
  });
548
548
  var chain_properties_hf9 = new Serializer(3, {
549
549
  account_creation_fee: asset,
@@ -558,18 +558,18 @@ var chain_properties_hf9 = new Serializer(3, {
558
558
  flag_energy_additional_cost: int16,
559
559
  vote_accounting_min_rshares: uint32,
560
560
  committee_request_approve_min_percent: int16,
561
- inflation_witness_percent: int16,
561
+ inflation_validator_percent: int16,
562
562
  inflation_ratio_committee_vs_reward_fund: int16,
563
563
  inflation_recalc_period: uint32,
564
564
  data_operations_cost_additional_bandwidth: uint32,
565
- witness_miss_penalty_percent: int16,
566
- witness_miss_penalty_duration: uint32,
565
+ validator_miss_penalty_percent: int16,
566
+ validator_miss_penalty_duration: uint32,
567
567
  create_invite_min_balance: asset,
568
568
  committee_create_request_fee: asset,
569
569
  create_paid_subscription_fee: asset,
570
570
  account_on_sale_fee: asset,
571
571
  subaccount_on_sale_fee: asset,
572
- witness_declaration_fee: asset,
572
+ validator_declaration_fee: asset,
573
573
  withdraw_intervals: uint16
574
574
  });
575
575
  var chain_properties_hf13 = new Serializer(4, {
@@ -585,18 +585,18 @@ var chain_properties_hf13 = new Serializer(4, {
585
585
  flag_energy_additional_cost: int16,
586
586
  vote_accounting_min_rshares: uint32,
587
587
  committee_request_approve_min_percent: int16,
588
- inflation_witness_percent: int16,
588
+ inflation_validator_percent: int16,
589
589
  inflation_ratio_committee_vs_reward_fund: int16,
590
590
  inflation_recalc_period: uint32,
591
591
  data_operations_cost_additional_bandwidth: uint32,
592
- witness_miss_penalty_percent: int16,
593
- witness_miss_penalty_duration: uint32,
592
+ validator_miss_penalty_percent: int16,
593
+ validator_miss_penalty_duration: uint32,
594
594
  create_invite_min_balance: asset,
595
595
  committee_create_request_fee: asset,
596
596
  create_paid_subscription_fee: asset,
597
597
  account_on_sale_fee: asset,
598
598
  subaccount_on_sale_fee: asset,
599
- witness_declaration_fee: asset,
599
+ validator_declaration_fee: asset,
600
600
  withdraw_intervals: uint16,
601
601
  distribution_epoch_length: uint32
602
602
  });
@@ -723,7 +723,14 @@ var set_reward_sharing = new Serializer("set_reward_sharing", {
723
723
  sharing_rate: uint16
724
724
  });
725
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];
726
+ operation.st_operations = [vote, content, transfer, transfer_to_vesting, withdraw_vesting, account_update, validator_update, account_validator_vote, account_validator_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_validator, 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, validator_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];
727
+
728
+ // Export old witness names as aliases for backward compatibility
729
+ module.exports.witness_update = validator_update;
730
+ module.exports.account_witness_vote = account_validator_vote;
731
+ module.exports.account_witness_proxy = account_validator_proxy;
732
+ module.exports.shutdown_witness = shutdown_validator;
733
+ module.exports.witness_reward = validator_reward;
727
734
 
728
735
  //# -------------------------------
729
736
  //# Generated code end S T O P
@@ -68,7 +68,11 @@ var Serializer = function () {
68
68
  for (var i = 0, field; i < iterable.length; i++) {
69
69
  field = iterable[i];
70
70
  var type = this.types[field];
71
- type.appendByteBuffer(b, object[field]);
71
+ var value = object[field];
72
+ if (value === undefined && Serializer.field_aliases[field] !== undefined) {
73
+ value = object[Serializer.field_aliases[field]];
74
+ }
75
+ type.appendByteBuffer(b, value);
72
76
  }
73
77
  } catch (error) {
74
78
  try {
@@ -91,6 +95,9 @@ var Serializer = function () {
91
95
  field = iterable[i];
92
96
  var type = this.types[field];
93
97
  var value = serialized_object[field];
98
+ if (value === undefined && Serializer.field_aliases[field] !== undefined) {
99
+ value = serialized_object[Serializer.field_aliases[field]];
100
+ }
94
101
  //DEBUG value = value.resolve if value.resolve
95
102
  //DEBUG console.log('... value',field,value)
96
103
  var object = type.fromObject(value);
@@ -208,4 +215,16 @@ var Serializer = function () {
208
215
  return Serializer;
209
216
  }();
210
217
 
218
+ // Map new field name → old field name for backward compat when input uses old names
219
+
220
+
221
+ Serializer.field_aliases = {
222
+ 'validator': 'witness',
223
+ 'validator_signature': 'witness_signature',
224
+ 'inflation_validator_percent': 'inflation_witness_percent',
225
+ 'validator_miss_penalty_percent': 'witness_miss_penalty_percent',
226
+ 'validator_miss_penalty_duration': 'witness_miss_penalty_duration',
227
+ 'validator_declaration_fee': 'witness_declaration_fee'
228
+ };
229
+
211
230
  module.exports = Serializer;
@@ -266,7 +266,7 @@ Types.string = {
266
266
 
267
267
  Types.string_binary = {
268
268
  fromByteBuffer: function fromByteBuffer(b) {
269
- var b_copy;
269
+ var b_copy = void 0;
270
270
  var len = b.readVarint32();
271
271
  b_copy = b.copy(b.offset, b.offset + len), b.skip(len);
272
272
  return new Buffer(b_copy.toBinary(), 'binary');
@@ -546,7 +546,10 @@ Types.set = function (st_operation) {
546
546
  Types.fixed_array = function (count, st_operation) {
547
547
  return {
548
548
  fromByteBuffer: function fromByteBuffer(b) {
549
- var i, j, ref, results;
549
+ var i = void 0,
550
+ j = void 0,
551
+ ref = void 0,
552
+ results = void 0;
550
553
  results = [];
551
554
  for (i = j = 0, ref = count; j < ref; i = j += 1) {
552
555
  results.push(st_operation.fromByteBuffer(b));
@@ -554,7 +557,9 @@ Types.fixed_array = function (count, st_operation) {
554
557
  return sortOperation(results, st_operation);
555
558
  },
556
559
  appendByteBuffer: function appendByteBuffer(b, object) {
557
- var i, j, ref;
560
+ var i = void 0,
561
+ j = void 0,
562
+ ref = void 0;
558
563
  if (count !== 0) {
559
564
  v.required(object);
560
565
  object = sortOperation(object, st_operation);
@@ -564,7 +569,10 @@ Types.fixed_array = function (count, st_operation) {
564
569
  }
565
570
  },
566
571
  fromObject: function fromObject(object) {
567
- var i, j, ref, results;
572
+ var i = void 0,
573
+ j = void 0,
574
+ ref = void 0,
575
+ results = void 0;
568
576
  if (count !== 0) {
569
577
  v.required(object);
570
578
  }
@@ -575,7 +583,13 @@ Types.fixed_array = function (count, st_operation) {
575
583
  return results;
576
584
  },
577
585
  toObject: function toObject(object, debug) {
578
- var i, j, k, ref, ref1, results, results1;
586
+ var i = void 0,
587
+ j = void 0,
588
+ k = void 0,
589
+ ref = void 0,
590
+ ref1 = void 0,
591
+ results = void 0,
592
+ results1 = void 0;
579
593
  if (debug == null) {
580
594
  debug = {};
581
595
  }
@@ -791,6 +805,14 @@ Types.optional = function (st_operation) {
791
805
  };
792
806
 
793
807
  Types.static_variant = function (_st_operations) {
808
+ // Witness-to-validator alias map for backward compatibility
809
+ var WITNESS_ALIAS_MAP = {
810
+ 'witness_update': 'validator_update',
811
+ 'account_witness_vote': 'account_validator_vote',
812
+ 'account_witness_proxy': 'account_validator_proxy',
813
+ 'shutdown_witness': 'shutdown_validator',
814
+ 'witness_reward': 'validator_reward'
815
+ };
794
816
  return {
795
817
  nosort: true,
796
818
  st_operations: _st_operations,
@@ -812,6 +834,7 @@ Types.static_variant = function (_st_operations) {
812
834
  }
813
835
  pos++;
814
836
  }
837
+ // Try alias lookup for old witness names
815
838
  } catch (err) {
816
839
  _didIteratorError = true;
817
840
  _iteratorError = err;
@@ -826,6 +849,38 @@ Types.static_variant = function (_st_operations) {
826
849
  }
827
850
  }
828
851
  }
852
+
853
+ if (type_id === undefined && WITNESS_ALIAS_MAP[value]) {
854
+ pos = 0;
855
+ var _iteratorNormalCompletion2 = true;
856
+ var _didIteratorError2 = false;
857
+ var _iteratorError2 = undefined;
858
+
859
+ try {
860
+ for (var _iterator2 = this.st_operations[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
861
+ var _op = _step2.value;
862
+
863
+ if (_op.operation_name === WITNESS_ALIAS_MAP[value]) {
864
+ type_id = pos;
865
+ break;
866
+ }
867
+ pos++;
868
+ }
869
+ } catch (err) {
870
+ _didIteratorError2 = true;
871
+ _iteratorError2 = err;
872
+ } finally {
873
+ try {
874
+ if (!_iteratorNormalCompletion2 && _iterator2.return) {
875
+ _iterator2.return();
876
+ }
877
+ } finally {
878
+ if (_didIteratorError2) {
879
+ throw _iteratorError2;
880
+ }
881
+ }
882
+ }
883
+ }
829
884
  }
830
885
  return type_id;
831
886
  },
@@ -24,6 +24,10 @@ module.exports = [{
24
24
  "roles": ["master", "active"],
25
25
  "operation": "account_update",
26
26
  "params": ["account", "master", "active", "regular", "memo_key", "json_metadata"]
27
+ }, {
28
+ "roles": ["active"],
29
+ "operation": "validator_update",
30
+ "params": ["owner", "url", "block_signing_key"]
27
31
  }, {
28
32
  "roles": ["active"],
29
33
  "operation": "witness_update",
@@ -32,10 +36,18 @@ module.exports = [{
32
36
  "roles": ["active"],
33
37
  "operation": "chain_properties_update",
34
38
  "params": ["owner", "props"]
39
+ }, {
40
+ "roles": ["regular"],
41
+ "operation": "account_validator_vote",
42
+ "params": ["account", "validator", "approve"]
35
43
  }, {
36
44
  "roles": ["regular"],
37
45
  "operation": "account_witness_vote",
38
46
  "params": ["account", "witness", "approve"]
47
+ }, {
48
+ "roles": ["regular"],
49
+ "operation": "account_validator_proxy",
50
+ "params": ["account", "proxy"]
39
51
  }, {
40
52
  "roles": ["regular"],
41
53
  "operation": "account_witness_proxy",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viz-js-lib",
3
- "version": "0.12.5",
3
+ "version": "0.12.6",
4
4
  "description": "viz.js the JavaScript Library with API support for VIZ blockchain",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -8,6 +8,7 @@ export const methods_test = [
8
8
  "get_account_votes",
9
9
  "get_accounts",
10
10
  "get_active_votes",
11
+ "get_active_validators",
11
12
  "get_active_witnesses",
12
13
  "get_all_content_replies",
13
14
  "get_block",
@@ -59,6 +60,12 @@ export const methods_test = [
59
60
  "get_trending_tags",
60
61
  "get_vesting_delegations",
61
62
  "get_withdraw_routes",
63
+ "get_validator_by_account",
64
+ "get_validator_count",
65
+ "get_validator_schedule",
66
+ "get_validators",
67
+ "get_validators_by_counted_vote",
68
+ "get_validators_by_vote",
62
69
  "get_witness_by_account",
63
70
  "get_witness_count",
64
71
  "get_witness_schedule",
@@ -66,6 +73,7 @@ export const methods_test = [
66
73
  "get_witnesses_by_vote",
67
74
  "lookup_account_names",
68
75
  "lookup_accounts",
76
+ "lookup_validator_accounts",
69
77
  "lookup_witness_accounts",
70
78
  "verify_account_authority",
71
79
  "verify_authority",