viz-js-lib 0.10.3 → 0.11.0

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
@@ -135,6 +135,14 @@ module.exports = [{
135
135
  "api": "database_api",
136
136
  "method": "get_block",
137
137
  "params": ["blockNum"]
138
+ }, {
139
+ "api": "database_api",
140
+ "method": "get_irreversible_block_header",
141
+ "params": ["blockNum"]
142
+ }, {
143
+ "api": "database_api",
144
+ "method": "get_irreversible_block",
145
+ "params": ["blockNum"]
138
146
  }, {
139
147
  "api": "database_api",
140
148
  "method": "get_config"
@@ -224,6 +232,10 @@ module.exports = [{
224
232
  "api": "database_api",
225
233
  "method": "get_accounts_on_sale",
226
234
  "params": ["from", "limit"]
235
+ }, {
236
+ "api": "database_api",
237
+ "method": "get_accounts_on_auction",
238
+ "params": ["from", "limit"]
227
239
  }, {
228
240
  "api": "database_api",
229
241
  "method": "get_subaccounts_on_sale",
@@ -70,7 +70,11 @@ ChainTypes.operations = {
70
70
  buy_account: 56,
71
71
  account_sale: 57,
72
72
  use_invite_balance: 58,
73
- expire_escrow_ratification: 59
73
+ expire_escrow_ratification: 59,
74
+ fixed_award: 60,
75
+ target_account_sale: 61,
76
+ bid: 62,
77
+ outbid: 63
74
78
  };
75
79
 
76
80
  //types.hpp
@@ -498,6 +498,16 @@ var award = new Serializer("award", {
498
498
  beneficiaries: set(beneficiaries)
499
499
  });
500
500
 
501
+ var fixed_award = new Serializer("fixed_award", {
502
+ initiator: string,
503
+ receiver: string,
504
+ reward_amount: asset,
505
+ max_energy: uint16,
506
+ custom_sequence: uint64,
507
+ memo: string,
508
+ beneficiaries: set(beneficiaries)
509
+ });
510
+
501
511
  var chain_properties_hf4 = new Serializer(1, {
502
512
  account_creation_fee: asset,
503
513
  maximum_block_size: uint32,
@@ -622,6 +632,14 @@ var set_account_price = new Serializer("set_account_price", {
622
632
  account_on_sale: bool
623
633
  });
624
634
 
635
+ var target_account_sale = new Serializer("target_account_sale", {
636
+ account: string,
637
+ account_seller: string,
638
+ target_buyer: string,
639
+ account_offer_price: asset,
640
+ account_on_sale: bool
641
+ });
642
+
625
643
  var set_subaccount_price = new Serializer("set_subaccount_price", {
626
644
  account: string,
627
645
  subaccount_seller: string,
@@ -660,7 +678,19 @@ var expire_escrow_ratification = new Serializer("expire_escrow_ratification", {
660
678
  ratification_deadline: time_point_sec
661
679
  });
662
680
 
663
- 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];
681
+ var bid = new Serializer("bid", {
682
+ account: string,
683
+ bidder: string,
684
+ bid: asset
685
+ });
686
+
687
+ var outbid = new Serializer("outbid", {
688
+ account: string,
689
+ bidder: string,
690
+ bid: asset
691
+ });
692
+
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];
664
694
 
665
695
  //# -------------------------------
666
696
  //# Generated code end S T O P
@@ -74,15 +74,28 @@ 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 refBlockNum = properties.head_block_number - 3 & 0xFFFF;
78
- return _api2.default.getBlockAsync(properties.head_block_number - 2).then(function (block) {
79
- var headBlockId = block.previous;
80
- return Object.assign({
81
- ref_block_num: refBlockNum,
82
- ref_block_prefix: new Buffer(headBlockId, 'hex').readUInt32LE(4),
83
- expiration: new Date(chainDate.getTime() + 60 * 1000)
84
- }, tx);
85
- });
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;
81
+ return Object.assign({
82
+ ref_block_num: properties.last_irreversible_block_ref_num,
83
+ ref_block_prefix: properties.last_irreversible_block_ref_prefix,
84
+ expiration: new Date(chainDate.getTime() + 60 * 1000)
85
+ }, tx);
86
+ }
87
+ }
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
+ });
98
+ }
86
99
  });
87
100
  };
88
101
 
@@ -148,6 +148,10 @@ module.exports = [{
148
148
  "roles": ["regular"],
149
149
  "operation": "award",
150
150
  "params": ["initiator", "receiver", "energy", "custom_sequence", "memo", "beneficiaries"]
151
+ }, {
152
+ "roles": ["regular"],
153
+ "operation": "fixed_award",
154
+ "params": ["initiator", "receiver", "reward_amount", "max_energy", "custom_sequence", "memo", "beneficiaries"]
151
155
  }, {
152
156
  "roles": ["active"],
153
157
  "operation": "set_paid_subscription",
@@ -160,6 +164,10 @@ module.exports = [{
160
164
  "roles": ["master"],
161
165
  "operation": "set_account_price",
162
166
  "params": ["account", "account_seller", "account_offer_price", "account_on_sale"]
167
+ }, {
168
+ "roles": ["master"],
169
+ "operation": "target_account_sale",
170
+ "params": ["account", "account_seller", "target_buyer", "account_offer_price", "account_on_sale"]
163
171
  }, {
164
172
  "roles": ["master"],
165
173
  "operation": "set_subaccount_price",
package/lib/utils.js CHANGED
@@ -315,7 +315,7 @@ function voiceEncodedPublication(wif, account, passphrase, comment, title, markd
315
315
  for (var i in passphrase) {
316
316
  var number = i;
317
317
  if (0 == number) {
318
- object['nt'] = 't'; //text
318
+ object['nt'] = 'p'; //publication
319
319
  } else {
320
320
  object['nt'] = 'e'; //encoded
321
321
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viz-js-lib",
3
- "version": "0.10.3",
3
+ "version": "0.11.0",
4
4
  "description": "viz.js the JavaScript Library with API support for VIZ blockchain",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {