viz-js-lib 0.12.7 → 0.13.1
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.
- package/.qoder/docs/spec/prediction-market-library-integration-spec.md +1138 -0
- package/VIZ-JS-LIB-COVERAGE-STATUS.md +86 -5
- package/dist/statistics.html +1 -1
- package/dist/viz-tests.min.js +5 -5
- package/dist/viz-tests.min.js.gz +0 -0
- package/dist/viz.min.js +6 -6
- package/dist/viz.min.js.gz +0 -0
- package/lib/api/methods.js +113 -0
- package/lib/auth/serializer/src/ChainTypes.js +44 -0
- package/lib/auth/serializer/src/operations.js +454 -3
- package/lib/auth/serializer/src/types.js +24 -0
- package/lib/broadcast/operations.js +92 -0
- package/lib/formatter.js +47 -0
- package/package.json +1 -1
- package/test/methods_by_version.js +29 -0
package/dist/viz.min.js.gz
CHANGED
|
Binary file
|
package/lib/api/methods.js
CHANGED
|
@@ -267,4 +267,117 @@ module.exports = [{
|
|
|
267
267
|
"api": "raw_block",
|
|
268
268
|
"method": "get_raw_block",
|
|
269
269
|
"params": ["block_num"]
|
|
270
|
+
}, {
|
|
271
|
+
"api": "prediction_market_api",
|
|
272
|
+
"method": "get_market",
|
|
273
|
+
"params": ["market_id"]
|
|
274
|
+
}, {
|
|
275
|
+
"api": "prediction_market_api",
|
|
276
|
+
"method": "list_markets",
|
|
277
|
+
"params": ["status", "from", "limit", "show_risky"]
|
|
278
|
+
}, {
|
|
279
|
+
"api": "prediction_market_api",
|
|
280
|
+
"method": "list_markets_by_oracle",
|
|
281
|
+
"params": ["oracle", "from", "limit"]
|
|
282
|
+
}, {
|
|
283
|
+
"api": "prediction_market_api",
|
|
284
|
+
"method": "list_markets_by_creator",
|
|
285
|
+
"params": ["creator", "from", "limit"]
|
|
286
|
+
}, {
|
|
287
|
+
"api": "prediction_market_api",
|
|
288
|
+
"method": "get_market_outcomes",
|
|
289
|
+
"params": ["market_id"]
|
|
290
|
+
}, {
|
|
291
|
+
"api": "prediction_market_api",
|
|
292
|
+
"method": "get_market_weight_sums",
|
|
293
|
+
"params": ["market_id"]
|
|
294
|
+
}, {
|
|
295
|
+
"api": "prediction_market_api",
|
|
296
|
+
"method": "get_market_bets",
|
|
297
|
+
"params": ["market_id", "from", "limit"]
|
|
298
|
+
}, {
|
|
299
|
+
"api": "prediction_market_api",
|
|
300
|
+
"method": "get_account_positions",
|
|
301
|
+
"params": ["account", "from", "limit"]
|
|
302
|
+
}, {
|
|
303
|
+
"api": "prediction_market_api",
|
|
304
|
+
"method": "get_market_liquidity",
|
|
305
|
+
"params": ["market_id", "from", "limit"]
|
|
306
|
+
}, {
|
|
307
|
+
"api": "prediction_market_api",
|
|
308
|
+
"method": "get_market_full",
|
|
309
|
+
"params": ["market_id", "account"]
|
|
310
|
+
}, {
|
|
311
|
+
"api": "prediction_market_api",
|
|
312
|
+
"method": "get_account_leverage_positions",
|
|
313
|
+
"params": ["account", "from", "limit"]
|
|
314
|
+
}, {
|
|
315
|
+
"api": "prediction_market_api",
|
|
316
|
+
"method": "get_market_leverage_positions",
|
|
317
|
+
"params": ["market_id", "from", "limit"]
|
|
318
|
+
}, {
|
|
319
|
+
"api": "prediction_market_api",
|
|
320
|
+
"method": "get_creator_ban",
|
|
321
|
+
"params": ["account"]
|
|
322
|
+
}, {
|
|
323
|
+
"api": "prediction_market_api",
|
|
324
|
+
"method": "get_leverage_quote",
|
|
325
|
+
"params": ["market_id", "outcome_index", "collateral"]
|
|
326
|
+
}, {
|
|
327
|
+
"api": "prediction_market_api",
|
|
328
|
+
"method": "get_leverage_close_preview",
|
|
329
|
+
"params": ["position_id"]
|
|
330
|
+
}, {
|
|
331
|
+
"api": "prediction_market_api",
|
|
332
|
+
"method": "get_leverage_convert_preview",
|
|
333
|
+
"params": ["position_id"]
|
|
334
|
+
}, {
|
|
335
|
+
"api": "prediction_market_api",
|
|
336
|
+
"method": "get_oracle",
|
|
337
|
+
"params": ["owner"]
|
|
338
|
+
}, {
|
|
339
|
+
"api": "prediction_market_api",
|
|
340
|
+
"method": "list_oracles",
|
|
341
|
+
"params": ["from", "limit"]
|
|
342
|
+
}, {
|
|
343
|
+
"api": "prediction_market_api",
|
|
344
|
+
"method": "get_dispute",
|
|
345
|
+
"params": ["market_id"]
|
|
346
|
+
}, {
|
|
347
|
+
"api": "prediction_market_api",
|
|
348
|
+
"method": "get_dispute_votes",
|
|
349
|
+
"params": ["market_id"]
|
|
350
|
+
}, {
|
|
351
|
+
"api": "prediction_market_api",
|
|
352
|
+
"method": "get_lazy_pool"
|
|
353
|
+
}, {
|
|
354
|
+
"api": "prediction_market_api",
|
|
355
|
+
"method": "get_lazy_deposit",
|
|
356
|
+
"params": ["account"]
|
|
357
|
+
}, {
|
|
358
|
+
"api": "prediction_market_api",
|
|
359
|
+
"method": "get_lazy_allocations",
|
|
360
|
+
"params": ["from", "limit"]
|
|
361
|
+
}, {
|
|
362
|
+
"api": "prediction_market_api",
|
|
363
|
+
"method": "get_market_lazy_allocation",
|
|
364
|
+
"params": ["market_id"]
|
|
365
|
+
}, {
|
|
366
|
+
"api": "prediction_market_api",
|
|
367
|
+
"method": "get_pm_chain_properties"
|
|
368
|
+
}, {
|
|
369
|
+
"api": "prediction_market_api",
|
|
370
|
+
"method": "get_market_meta",
|
|
371
|
+
"params": ["market_id"]
|
|
372
|
+
}, {
|
|
373
|
+
"api": "prediction_market_api",
|
|
374
|
+
"method": "list_markets_by_category",
|
|
375
|
+
"params": ["category", "from", "limit", "jurisdiction", "subcategory", "tag", "sort"]
|
|
376
|
+
}, {
|
|
377
|
+
"api": "prediction_market_api",
|
|
378
|
+
"method": "get_market_categories"
|
|
379
|
+
}, {
|
|
380
|
+
"api": "prediction_market_api",
|
|
381
|
+
"method": "get_market_kline",
|
|
382
|
+
"params": ["market_id", "from", "limit"]
|
|
270
383
|
}];
|
|
@@ -76,6 +76,50 @@ ChainTypes.operations = {
|
|
|
76
76
|
bid: 62,
|
|
77
77
|
outbid: 63,
|
|
78
78
|
set_reward_sharing: 64,
|
|
79
|
+
stakeholder_reward: 65,
|
|
80
|
+
// Prediction Markets (HF14) — user operations
|
|
81
|
+
pm_oracle_register: 66,
|
|
82
|
+
pm_oracle_update: 67,
|
|
83
|
+
pm_create_market: 68,
|
|
84
|
+
pm_oracle_accept_market: 69,
|
|
85
|
+
pm_place_bet: 70,
|
|
86
|
+
pm_commit_bet: 71,
|
|
87
|
+
pm_reveal_bet: 72,
|
|
88
|
+
pm_cancel_bet: 73,
|
|
89
|
+
pm_add_liquidity: 74,
|
|
90
|
+
pm_withdraw_liquidity: 75,
|
|
91
|
+
pm_resolve_market: 76,
|
|
92
|
+
pm_no_contest: 77,
|
|
93
|
+
pm_dispute_create: 78,
|
|
94
|
+
pm_dispute_vote: 79,
|
|
95
|
+
pm_dispute_resolve: 80,
|
|
96
|
+
pm_transfer_position: 81,
|
|
97
|
+
pm_lazy_deposit: 82,
|
|
98
|
+
pm_lazy_withdraw: 83,
|
|
99
|
+
// Prediction Markets (HF14) — virtual operations
|
|
100
|
+
pm_batch_settle: 84,
|
|
101
|
+
pm_commit_forfeit: 85,
|
|
102
|
+
pm_auto_payout: 86,
|
|
103
|
+
pm_dispute_finalize: 87,
|
|
104
|
+
pm_dispute_auto_close: 88,
|
|
105
|
+
pm_oracle_missed_penalty: 89,
|
|
106
|
+
pm_lazy_recall: 90,
|
|
107
|
+
// Prediction Markets (HF14) — leverage user operations
|
|
108
|
+
pm_leverage_open: 91,
|
|
109
|
+
pm_leverage_close: 92,
|
|
110
|
+
pm_leverage_convert: 93,
|
|
111
|
+
// Prediction Markets (HF14) — leverage/accept virtual operations
|
|
112
|
+
pm_leverage_liquidate: 94,
|
|
113
|
+
pm_leverage_resolve: 95,
|
|
114
|
+
pm_market_accepted: 96,
|
|
115
|
+
pm_payout: 97,
|
|
116
|
+
// Prediction Markets (HF14) — dispute/ban user operations
|
|
117
|
+
pm_dispute_oracle_respond: 98,
|
|
118
|
+
pm_unban: 99,
|
|
119
|
+
// Prediction Markets (HF14) — ban expiry virtual operation
|
|
120
|
+
pm_ban_expired: 100,
|
|
121
|
+
// Prediction Markets (HF14) — oracle-accept-window expiry virtual operation
|
|
122
|
+
pm_market_expired: 101,
|
|
79
123
|
// Aliases for backward compatibility (old witness names)
|
|
80
124
|
witness_update: 6,
|
|
81
125
|
account_witness_vote: 7,
|
|
@@ -28,7 +28,9 @@ sed 's/steemit_protocol_//g' > tmp.coffee
|
|
|
28
28
|
|
|
29
29
|
// Merge tmp.js - See "Generated code follows" below
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var int8 = _types2.default.int8,
|
|
32
|
+
int16 = _types2.default.int16,
|
|
33
|
+
int64 = _types2.default.int64,
|
|
32
34
|
uint8 = _types2.default.uint8,
|
|
33
35
|
uint16 = _types2.default.uint16,
|
|
34
36
|
uint32 = _types2.default.uint32,
|
|
@@ -601,9 +603,86 @@ var chain_properties_hf13 = new Serializer(4, {
|
|
|
601
603
|
distribution_epoch_length: uint32
|
|
602
604
|
});
|
|
603
605
|
|
|
606
|
+
// HF14: adds the Prediction-Market governance parameters (chain_properties_pm)
|
|
607
|
+
// on top of every HF13 field. Field order and units follow the integration
|
|
608
|
+
// spec §9 (get_pm_chain_properties). Percents that are plain-% or bp both fit
|
|
609
|
+
// uint16; durations/counters use uint32; monetary knobs are asset (VIZ).
|
|
610
|
+
var chain_properties_hf14 = new Serializer(5, {
|
|
611
|
+
account_creation_fee: asset,
|
|
612
|
+
maximum_block_size: uint32,
|
|
613
|
+
create_account_delegation_ratio: uint32,
|
|
614
|
+
create_account_delegation_time: uint32,
|
|
615
|
+
min_delegation: asset,
|
|
616
|
+
min_curation_percent: int16,
|
|
617
|
+
max_curation_percent: int16,
|
|
618
|
+
bandwidth_reserve_percent: int16,
|
|
619
|
+
bandwidth_reserve_below: asset,
|
|
620
|
+
flag_energy_additional_cost: int16,
|
|
621
|
+
vote_accounting_min_rshares: uint32,
|
|
622
|
+
committee_request_approve_min_percent: int16,
|
|
623
|
+
inflation_validator_percent: int16,
|
|
624
|
+
inflation_ratio_committee_vs_reward_fund: int16,
|
|
625
|
+
inflation_recalc_period: uint32,
|
|
626
|
+
data_operations_cost_additional_bandwidth: uint32,
|
|
627
|
+
validator_miss_penalty_percent: int16,
|
|
628
|
+
validator_miss_penalty_duration: uint32,
|
|
629
|
+
create_invite_min_balance: asset,
|
|
630
|
+
committee_create_request_fee: asset,
|
|
631
|
+
create_paid_subscription_fee: asset,
|
|
632
|
+
account_on_sale_fee: asset,
|
|
633
|
+
subaccount_on_sale_fee: asset,
|
|
634
|
+
validator_declaration_fee: asset,
|
|
635
|
+
withdraw_intervals: uint16,
|
|
636
|
+
distribution_epoch_length: uint32,
|
|
637
|
+
// --- Prediction Markets (HF14) governance parameters ---
|
|
638
|
+
pm_oracle_registration_fee: asset,
|
|
639
|
+
pm_min_oracle_insurance: asset,
|
|
640
|
+
pm_market_creation_fee: asset,
|
|
641
|
+
pm_min_liquidity: asset,
|
|
642
|
+
pm_max_outcomes: uint16,
|
|
643
|
+
pm_max_market_duration: uint32,
|
|
644
|
+
pm_max_oracle_fee_percent: uint16,
|
|
645
|
+
pm_listing_min_coverage_percent: uint16,
|
|
646
|
+
pm_betting_min_coverage_percent: uint16,
|
|
647
|
+
pm_default_time_penalty_percent: uint16,
|
|
648
|
+
pm_max_time_penalty: uint32,
|
|
649
|
+
pm_dispute_fee: asset,
|
|
650
|
+
pm_dispute_grace_sec: uint32,
|
|
651
|
+
pm_oracle_dispute_response_sec: uint32,
|
|
652
|
+
pm_dispute_auto_close_sec: uint32,
|
|
653
|
+
pm_dispute_vote_period_sec: uint32,
|
|
654
|
+
pm_dispute_approve_min_percent: uint16,
|
|
655
|
+
pm_oracle_penalty_percent: uint16,
|
|
656
|
+
pm_no_contest_penalty_percent: uint16,
|
|
657
|
+
pm_dispute_reward_multiplier: uint32,
|
|
658
|
+
pm_batch_epoch_blocks: uint32,
|
|
659
|
+
pm_reveal_window_blocks: uint32,
|
|
660
|
+
pm_commit_no_reveal_penalty_percent: uint16,
|
|
661
|
+
pm_min_batch_bet: asset,
|
|
662
|
+
pm_commit_reveal_enabled: bool,
|
|
663
|
+
pm_processing_cap_per_block: uint32,
|
|
664
|
+
pm_lazy_pool_enabled: bool,
|
|
665
|
+
pm_lazy_alloc_percent: uint16,
|
|
666
|
+
pm_lazy_max_total_alloc_percent: uint16,
|
|
667
|
+
pm_lazy_lock_sec: uint32,
|
|
668
|
+
pm_lazy_recall_step_percent: uint16,
|
|
669
|
+
pm_lazy_emergency_penalty_percent: uint16,
|
|
670
|
+
pm_leverage_enabled: bool,
|
|
671
|
+
pm_leverage_fund_percent: uint16,
|
|
672
|
+
pm_leverage_max_per_position_bp: uint16,
|
|
673
|
+
pm_leverage_pool_profit_percent: uint16,
|
|
674
|
+
pm_leverage_safety_margin_percent: uint16,
|
|
675
|
+
pm_leverage_max_slippage_percent: uint16,
|
|
676
|
+
pm_leverage_min_market_liquidity: asset,
|
|
677
|
+
pm_leverage_max_position_ratio_percent: uint16,
|
|
678
|
+
pm_leverage_expiration_buffer_sec: uint32,
|
|
679
|
+
pm_leverage_m_factor_percent: uint16,
|
|
680
|
+
pm_conversion_profit_cost_percent: uint16
|
|
681
|
+
});
|
|
682
|
+
|
|
604
683
|
var versioned_chain_properties_update = new Serializer("versioned_chain_properties_update", {
|
|
605
684
|
owner: string,
|
|
606
|
-
props: static_variant([chain_properties_init, chain_properties_hf4, chain_properties_hf6, chain_properties_hf9, chain_properties_hf13])
|
|
685
|
+
props: static_variant([chain_properties_init, chain_properties_hf4, chain_properties_hf6, chain_properties_hf9, chain_properties_hf13, chain_properties_hf14])
|
|
607
686
|
});
|
|
608
687
|
|
|
609
688
|
var receive_award = new Serializer("receive_award", {
|
|
@@ -723,7 +802,379 @@ var set_reward_sharing = new Serializer("set_reward_sharing", {
|
|
|
723
802
|
sharing_rate: uint16
|
|
724
803
|
});
|
|
725
804
|
|
|
726
|
-
|
|
805
|
+
// ---------------------------------------------------------------------------
|
|
806
|
+
// Stakeholder reward (op-id 65) — virtual op, emitted per stakeholder per
|
|
807
|
+
// validator at each distribution epoch end. Parsed from history only.
|
|
808
|
+
// ---------------------------------------------------------------------------
|
|
809
|
+
var stakeholder_reward = new Serializer("stakeholder_reward", {
|
|
810
|
+
validator: string,
|
|
811
|
+
stakeholder: string,
|
|
812
|
+
shares: asset
|
|
813
|
+
});
|
|
814
|
+
|
|
815
|
+
// ===========================================================================
|
|
816
|
+
// Prediction Markets (Onix, HF14) — op-ids 66..100
|
|
817
|
+
// User ops end with `extensions` (empty set); virtual ops have none.
|
|
818
|
+
// Field order below is the declared (binary) order from the integration spec.
|
|
819
|
+
// share_type / pm_object_id_type fields are int64; percents are uint16 unless
|
|
820
|
+
// noted; `side` is int8; `commitment` is a 32-byte sha256 (bytes(32)).
|
|
821
|
+
// ===========================================================================
|
|
822
|
+
|
|
823
|
+
// 66 — pm_oracle_register (active: owner)
|
|
824
|
+
var pm_oracle_register = new Serializer("pm_oracle_register", {
|
|
825
|
+
owner: string,
|
|
826
|
+
insurance: asset,
|
|
827
|
+
fee_percent: uint16,
|
|
828
|
+
fixed_fee: asset,
|
|
829
|
+
rules_url: string,
|
|
830
|
+
auto_accept_creator: string,
|
|
831
|
+
auto_accept_resolver: string,
|
|
832
|
+
auto_accept: bool,
|
|
833
|
+
extensions: set(future_extensions)
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
// 67 — pm_oracle_update (active: owner) — all change fields optional
|
|
837
|
+
var pm_oracle_update = new Serializer("pm_oracle_update", {
|
|
838
|
+
owner: string,
|
|
839
|
+
insurance_delta: optional(asset),
|
|
840
|
+
fee_percent: optional(uint16),
|
|
841
|
+
fixed_fee: optional(asset),
|
|
842
|
+
rules_url: optional(string),
|
|
843
|
+
auto_accept_creator: optional(string),
|
|
844
|
+
auto_accept_resolver: optional(string),
|
|
845
|
+
auto_accept: optional(bool),
|
|
846
|
+
extensions: set(future_extensions)
|
|
847
|
+
});
|
|
848
|
+
|
|
849
|
+
// 68 — pm_create_market (active: creator)
|
|
850
|
+
var pm_create_market = new Serializer("pm_create_market", {
|
|
851
|
+
creator: string,
|
|
852
|
+
oracle: string,
|
|
853
|
+
market_type: uint8,
|
|
854
|
+
outcomes: array(string),
|
|
855
|
+
url: string,
|
|
856
|
+
oracle_fee_percent: uint16,
|
|
857
|
+
oracle_fixed_fee: asset,
|
|
858
|
+
creator_fee_percent: uint16,
|
|
859
|
+
liquidity_fee_percent: uint16,
|
|
860
|
+
liquidity: asset,
|
|
861
|
+
lmsr_b: int64,
|
|
862
|
+
betting_expiration: time_point_sec,
|
|
863
|
+
result_expiration: time_point_sec,
|
|
864
|
+
time_penalty_type: uint8,
|
|
865
|
+
time_penalty_value: uint32,
|
|
866
|
+
penalty_curve_type: uint8,
|
|
867
|
+
allow_early_resolution: bool,
|
|
868
|
+
allow_cancellation: bool,
|
|
869
|
+
allow_batch: bool,
|
|
870
|
+
allow_instant_bet: bool,
|
|
871
|
+
endogeneity_tier: uint8,
|
|
872
|
+
dispute_mode: uint8,
|
|
873
|
+
dispute_resolver: string,
|
|
874
|
+
dispute_penalty_percent: int16,
|
|
875
|
+
metadata: string,
|
|
876
|
+
extensions: set(future_extensions)
|
|
877
|
+
});
|
|
878
|
+
|
|
879
|
+
// 69 — pm_oracle_accept_market (active: oracle)
|
|
880
|
+
var pm_oracle_accept_market = new Serializer("pm_oracle_accept_market", {
|
|
881
|
+
oracle: string,
|
|
882
|
+
market_id: int64,
|
|
883
|
+
accept: bool,
|
|
884
|
+
oracle_fee_percent: uint16,
|
|
885
|
+
oracle_fixed_fee: asset,
|
|
886
|
+
extensions: set(future_extensions)
|
|
887
|
+
});
|
|
888
|
+
|
|
889
|
+
// 70 — pm_place_bet (active: account)
|
|
890
|
+
var pm_place_bet = new Serializer("pm_place_bet", {
|
|
891
|
+
account: string,
|
|
892
|
+
market_id: int64,
|
|
893
|
+
side: int8,
|
|
894
|
+
outcome_index: int16,
|
|
895
|
+
amount: asset,
|
|
896
|
+
min_tokens: int64,
|
|
897
|
+
mode: uint8,
|
|
898
|
+
extensions: set(future_extensions)
|
|
899
|
+
});
|
|
900
|
+
|
|
901
|
+
// 71 — pm_commit_bet (active: account)
|
|
902
|
+
var pm_commit_bet = new Serializer("pm_commit_bet", {
|
|
903
|
+
account: string,
|
|
904
|
+
market_id: int64,
|
|
905
|
+
commitment: bytes(32),
|
|
906
|
+
escrow_amount: asset,
|
|
907
|
+
no_reveal_fee_percent: uint16,
|
|
908
|
+
extensions: set(future_extensions)
|
|
909
|
+
});
|
|
910
|
+
|
|
911
|
+
// 72 — pm_reveal_bet (active: account)
|
|
912
|
+
var pm_reveal_bet = new Serializer("pm_reveal_bet", {
|
|
913
|
+
account: string,
|
|
914
|
+
commit_id: int64,
|
|
915
|
+
side: int8,
|
|
916
|
+
outcome_index: int16,
|
|
917
|
+
amount: asset,
|
|
918
|
+
salt: string,
|
|
919
|
+
min_tokens: int64,
|
|
920
|
+
extensions: set(future_extensions)
|
|
921
|
+
});
|
|
922
|
+
|
|
923
|
+
// 73 — pm_cancel_bet (active: account)
|
|
924
|
+
var pm_cancel_bet = new Serializer("pm_cancel_bet", {
|
|
925
|
+
account: string,
|
|
926
|
+
bet_id: int64,
|
|
927
|
+
min_return: int64,
|
|
928
|
+
extensions: set(future_extensions)
|
|
929
|
+
});
|
|
930
|
+
|
|
931
|
+
// 74 — pm_add_liquidity (active: provider)
|
|
932
|
+
var pm_add_liquidity = new Serializer("pm_add_liquidity", {
|
|
933
|
+
provider: string,
|
|
934
|
+
market_id: int64,
|
|
935
|
+
amount: asset,
|
|
936
|
+
extensions: set(future_extensions)
|
|
937
|
+
});
|
|
938
|
+
|
|
939
|
+
// 75 — pm_withdraw_liquidity (active: provider)
|
|
940
|
+
var pm_withdraw_liquidity = new Serializer("pm_withdraw_liquidity", {
|
|
941
|
+
provider: string,
|
|
942
|
+
liquidity_id: int64,
|
|
943
|
+
amount: asset,
|
|
944
|
+
extensions: set(future_extensions)
|
|
945
|
+
});
|
|
946
|
+
|
|
947
|
+
// 76 — pm_resolve_market (active: oracle)
|
|
948
|
+
var pm_resolve_market = new Serializer("pm_resolve_market", {
|
|
949
|
+
oracle: string,
|
|
950
|
+
market_id: int64,
|
|
951
|
+
winning_outcome: int16,
|
|
952
|
+
decision_url: string,
|
|
953
|
+
decision_reason: string,
|
|
954
|
+
extensions: set(future_extensions)
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
// 77 — pm_no_contest (active: oracle)
|
|
958
|
+
var pm_no_contest = new Serializer("pm_no_contest", {
|
|
959
|
+
oracle: string,
|
|
960
|
+
market_id: int64,
|
|
961
|
+
reason: string,
|
|
962
|
+
extensions: set(future_extensions)
|
|
963
|
+
});
|
|
964
|
+
|
|
965
|
+
// 78 — pm_dispute_create (active: disputer)
|
|
966
|
+
var pm_dispute_create = new Serializer("pm_dispute_create", {
|
|
967
|
+
disputer: string,
|
|
968
|
+
market_id: int64,
|
|
969
|
+
proposed_outcome: int16,
|
|
970
|
+
reason: string,
|
|
971
|
+
extensions: set(future_extensions)
|
|
972
|
+
});
|
|
973
|
+
|
|
974
|
+
// 79 — pm_dispute_vote (regular: voter)
|
|
975
|
+
var pm_dispute_vote = new Serializer("pm_dispute_vote", {
|
|
976
|
+
voter: string,
|
|
977
|
+
market_id: int64,
|
|
978
|
+
vote_outcome: int16,
|
|
979
|
+
vote_percent: int16,
|
|
980
|
+
extensions: set(future_extensions)
|
|
981
|
+
});
|
|
982
|
+
|
|
983
|
+
// 80 — pm_dispute_resolve (active: resolver)
|
|
984
|
+
var pm_dispute_resolve = new Serializer("pm_dispute_resolve", {
|
|
985
|
+
resolver: string,
|
|
986
|
+
market_id: int64,
|
|
987
|
+
correct_outcome: int16,
|
|
988
|
+
penalty_amount: asset,
|
|
989
|
+
ban_oracle: bool,
|
|
990
|
+
ban_oracle_until: time_point_sec,
|
|
991
|
+
ban_creator: bool,
|
|
992
|
+
ban_creator_until: time_point_sec,
|
|
993
|
+
extensions: set(future_extensions)
|
|
994
|
+
});
|
|
995
|
+
|
|
996
|
+
// 81 — pm_transfer_position (active: from)
|
|
997
|
+
var pm_transfer_position = new Serializer("pm_transfer_position", {
|
|
998
|
+
from: string,
|
|
999
|
+
bet_id: int64,
|
|
1000
|
+
to: string,
|
|
1001
|
+
amount: int64,
|
|
1002
|
+
memo: string,
|
|
1003
|
+
extensions: set(future_extensions)
|
|
1004
|
+
});
|
|
1005
|
+
|
|
1006
|
+
// 82 — pm_lazy_deposit (active: account)
|
|
1007
|
+
var pm_lazy_deposit = new Serializer("pm_lazy_deposit", {
|
|
1008
|
+
account: string,
|
|
1009
|
+
amount: asset,
|
|
1010
|
+
extensions: set(future_extensions)
|
|
1011
|
+
});
|
|
1012
|
+
|
|
1013
|
+
// 83 — pm_lazy_withdraw (active: account)
|
|
1014
|
+
var pm_lazy_withdraw = new Serializer("pm_lazy_withdraw", {
|
|
1015
|
+
account: string,
|
|
1016
|
+
shares: int64,
|
|
1017
|
+
emergency: bool,
|
|
1018
|
+
extensions: set(future_extensions)
|
|
1019
|
+
});
|
|
1020
|
+
|
|
1021
|
+
// 84 — pm_batch_settle (virtual)
|
|
1022
|
+
var pm_batch_settle = new Serializer("pm_batch_settle", {
|
|
1023
|
+
market_id: int64,
|
|
1024
|
+
epoch: uint32,
|
|
1025
|
+
settled_bets: uint32
|
|
1026
|
+
});
|
|
1027
|
+
|
|
1028
|
+
// 85 — pm_commit_forfeit (virtual)
|
|
1029
|
+
var pm_commit_forfeit = new Serializer("pm_commit_forfeit", {
|
|
1030
|
+
account: string,
|
|
1031
|
+
commit_id: int64,
|
|
1032
|
+
market_id: int64,
|
|
1033
|
+
penalty: asset,
|
|
1034
|
+
refund: asset
|
|
1035
|
+
});
|
|
1036
|
+
|
|
1037
|
+
// 86 — pm_auto_payout (virtual)
|
|
1038
|
+
var pm_auto_payout = new Serializer("pm_auto_payout", {
|
|
1039
|
+
account: string,
|
|
1040
|
+
market_id: int64,
|
|
1041
|
+
bet_id: int64,
|
|
1042
|
+
payout: asset
|
|
1043
|
+
});
|
|
1044
|
+
|
|
1045
|
+
// 87 — pm_dispute_finalize (virtual)
|
|
1046
|
+
var pm_dispute_finalize = new Serializer("pm_dispute_finalize", {
|
|
1047
|
+
market_id: int64,
|
|
1048
|
+
winning_outcome: int16,
|
|
1049
|
+
oracle_penalty: asset
|
|
1050
|
+
});
|
|
1051
|
+
|
|
1052
|
+
// 88 — pm_dispute_auto_close (virtual)
|
|
1053
|
+
var pm_dispute_auto_close = new Serializer("pm_dispute_auto_close", {
|
|
1054
|
+
market_id: int64,
|
|
1055
|
+
oracle_penalty: asset
|
|
1056
|
+
});
|
|
1057
|
+
|
|
1058
|
+
// 89 — pm_oracle_missed_penalty (virtual)
|
|
1059
|
+
var pm_oracle_missed_penalty = new Serializer("pm_oracle_missed_penalty", {
|
|
1060
|
+
oracle: string,
|
|
1061
|
+
market_id: int64,
|
|
1062
|
+
slashed: asset
|
|
1063
|
+
});
|
|
1064
|
+
|
|
1065
|
+
// 90 — pm_lazy_recall (virtual)
|
|
1066
|
+
var pm_lazy_recall = new Serializer("pm_lazy_recall", {
|
|
1067
|
+
market_id: int64,
|
|
1068
|
+
recalled: asset
|
|
1069
|
+
});
|
|
1070
|
+
|
|
1071
|
+
// 91 — pm_leverage_open (active: account)
|
|
1072
|
+
var pm_leverage_open = new Serializer("pm_leverage_open", {
|
|
1073
|
+
account: string,
|
|
1074
|
+
market_id: int64,
|
|
1075
|
+
outcome_index: int16,
|
|
1076
|
+
collateral: asset,
|
|
1077
|
+
loan: asset,
|
|
1078
|
+
min_tokens: int64,
|
|
1079
|
+
max_slippage_percent: uint16,
|
|
1080
|
+
extensions: set(future_extensions)
|
|
1081
|
+
});
|
|
1082
|
+
|
|
1083
|
+
// 92 — pm_leverage_close (active: account)
|
|
1084
|
+
var pm_leverage_close = new Serializer("pm_leverage_close", {
|
|
1085
|
+
account: string,
|
|
1086
|
+
position_id: int64,
|
|
1087
|
+
min_return: int64,
|
|
1088
|
+
extensions: set(future_extensions)
|
|
1089
|
+
});
|
|
1090
|
+
|
|
1091
|
+
// 93 — pm_leverage_convert (active: account)
|
|
1092
|
+
var pm_leverage_convert = new Serializer("pm_leverage_convert", {
|
|
1093
|
+
account: string,
|
|
1094
|
+
position_id: int64,
|
|
1095
|
+
conversion_profit_cost: uint16,
|
|
1096
|
+
extensions: set(future_extensions)
|
|
1097
|
+
});
|
|
1098
|
+
|
|
1099
|
+
// 94 — pm_leverage_liquidate (virtual)
|
|
1100
|
+
var pm_leverage_liquidate = new Serializer("pm_leverage_liquidate", {
|
|
1101
|
+
account: string,
|
|
1102
|
+
position_id: int64,
|
|
1103
|
+
market_id: int64,
|
|
1104
|
+
cancel_value: asset,
|
|
1105
|
+
pool_received: asset,
|
|
1106
|
+
bettor_received: asset,
|
|
1107
|
+
reason: uint8
|
|
1108
|
+
});
|
|
1109
|
+
|
|
1110
|
+
// 95 — pm_leverage_resolve (virtual)
|
|
1111
|
+
var pm_leverage_resolve = new Serializer("pm_leverage_resolve", {
|
|
1112
|
+
account: string,
|
|
1113
|
+
position_id: int64,
|
|
1114
|
+
market_id: int64,
|
|
1115
|
+
won: bool,
|
|
1116
|
+
pool_received: asset,
|
|
1117
|
+
bettor_received: asset,
|
|
1118
|
+
outcome_index: int16,
|
|
1119
|
+
leverage: uint16
|
|
1120
|
+
});
|
|
1121
|
+
|
|
1122
|
+
// 96 — pm_market_accepted (virtual)
|
|
1123
|
+
var pm_market_accepted = new Serializer("pm_market_accepted", {
|
|
1124
|
+
oracle: string,
|
|
1125
|
+
creator: string,
|
|
1126
|
+
market_id: int64,
|
|
1127
|
+
oracle_fee_percent: uint16,
|
|
1128
|
+
oracle_fixed_fee: asset,
|
|
1129
|
+
self_oracle: bool
|
|
1130
|
+
});
|
|
1131
|
+
|
|
1132
|
+
// 97 — pm_payout (virtual)
|
|
1133
|
+
var pm_payout = new Serializer("pm_payout", {
|
|
1134
|
+
account: string,
|
|
1135
|
+
market_id: int64,
|
|
1136
|
+
bet_id: int64,
|
|
1137
|
+
side: int8,
|
|
1138
|
+
outcome_index: int16,
|
|
1139
|
+
amount: asset,
|
|
1140
|
+
payout: asset
|
|
1141
|
+
});
|
|
1142
|
+
|
|
1143
|
+
// 98 — pm_dispute_oracle_respond (active: oracle)
|
|
1144
|
+
var pm_dispute_oracle_respond = new Serializer("pm_dispute_oracle_respond", {
|
|
1145
|
+
oracle: string,
|
|
1146
|
+
market_id: int64,
|
|
1147
|
+
response: string,
|
|
1148
|
+
extensions: set(future_extensions)
|
|
1149
|
+
});
|
|
1150
|
+
|
|
1151
|
+
// 99 — pm_unban (active: resolver)
|
|
1152
|
+
var pm_unban = new Serializer("pm_unban", {
|
|
1153
|
+
resolver: string,
|
|
1154
|
+
target: string,
|
|
1155
|
+
unban_oracle: bool,
|
|
1156
|
+
unban_creator: bool,
|
|
1157
|
+
extensions: set(future_extensions)
|
|
1158
|
+
});
|
|
1159
|
+
|
|
1160
|
+
// 100 — pm_ban_expired (virtual)
|
|
1161
|
+
var pm_ban_expired = new Serializer("pm_ban_expired", {
|
|
1162
|
+
account: string,
|
|
1163
|
+
oracle: bool,
|
|
1164
|
+
creator: bool
|
|
1165
|
+
});
|
|
1166
|
+
|
|
1167
|
+
// 101 — pm_market_expired (virtual)
|
|
1168
|
+
var pm_market_expired = new Serializer("pm_market_expired", {
|
|
1169
|
+
oracle: string,
|
|
1170
|
+
creator: string,
|
|
1171
|
+
market_id: int64,
|
|
1172
|
+
refunded_liquidity: asset
|
|
1173
|
+
});
|
|
1174
|
+
|
|
1175
|
+
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, stakeholder_reward,
|
|
1176
|
+
// Prediction Markets (HF14) — op-ids 66..101, positional order is the tag
|
|
1177
|
+
pm_oracle_register, pm_oracle_update, pm_create_market, pm_oracle_accept_market, pm_place_bet, pm_commit_bet, pm_reveal_bet, pm_cancel_bet, pm_add_liquidity, pm_withdraw_liquidity, pm_resolve_market, pm_no_contest, pm_dispute_create, pm_dispute_vote, pm_dispute_resolve, pm_transfer_position, pm_lazy_deposit, pm_lazy_withdraw, pm_batch_settle, pm_commit_forfeit, pm_auto_payout, pm_dispute_finalize, pm_dispute_auto_close, pm_oracle_missed_penalty, pm_lazy_recall, pm_leverage_open, pm_leverage_close, pm_leverage_convert, pm_leverage_liquidate, pm_leverage_resolve, pm_market_accepted, pm_payout, pm_dispute_oracle_respond, pm_unban, pm_ban_expired, pm_market_expired];
|
|
727
1178
|
|
|
728
1179
|
// Export old witness names as aliases for backward compatibility
|
|
729
1180
|
module.exports.witness_update = validator_update;
|
|
@@ -100,6 +100,30 @@ Types.uint8 = {
|
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
+
Types.int8 = {
|
|
104
|
+
fromByteBuffer: function fromByteBuffer(b) {
|
|
105
|
+
return b.readInt8();
|
|
106
|
+
},
|
|
107
|
+
appendByteBuffer: function appendByteBuffer(b, object) {
|
|
108
|
+
v.require_range(-128, 127, object, 'int8 ' + object);
|
|
109
|
+
b.writeInt8(object);
|
|
110
|
+
return;
|
|
111
|
+
},
|
|
112
|
+
fromObject: function fromObject(object) {
|
|
113
|
+
v.require_range(-128, 127, object, 'int8 ' + object);
|
|
114
|
+
return object;
|
|
115
|
+
},
|
|
116
|
+
toObject: function toObject(object) {
|
|
117
|
+
var debug = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
118
|
+
|
|
119
|
+
if (debug.use_default && object === undefined) {
|
|
120
|
+
return 0;
|
|
121
|
+
}
|
|
122
|
+
v.require_range(-128, 127, object, 'int8 ' + object);
|
|
123
|
+
return parseInt(object);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
103
127
|
Types.uint16 = {
|
|
104
128
|
fromByteBuffer: function fromByteBuffer(b) {
|
|
105
129
|
return b.readUint16();
|