viz-js-lib 0.14.0 → 0.16.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.
- package/dist/statistics.html +1 -1
- package/dist/viz-tests.min.js.gz +0 -0
- package/dist/viz.min.js +1 -1
- package/dist/viz.min.js.gz +0 -0
- package/lib/auth/serializer/src/ChainTypes.js +4 -0
- package/lib/auth/serializer/src/operations.js +32 -2
- package/package.json +1 -1
- package/test/pm_vop_payout_claim_test.js +63 -0
package/dist/viz.min.js.gz
CHANGED
|
Binary file
|
|
@@ -122,6 +122,10 @@ ChainTypes.operations = {
|
|
|
122
122
|
pm_market_expired: 101,
|
|
123
123
|
// Prediction Markets (HF14) — dispute-opened virtual operation (oracle history)
|
|
124
124
|
pm_dispute_opened: 102,
|
|
125
|
+
// Prediction Markets (HF14) — early-exit deferred claim payout (F1/#300)
|
|
126
|
+
pm_early_exit_claim_paid: 103,
|
|
127
|
+
// Prediction Markets (HF14) — settlement-time direct LP return (goal #442)
|
|
128
|
+
pm_lp_payout: 104,
|
|
125
129
|
// Aliases for backward compatibility (old witness names)
|
|
126
130
|
witness_update: 6,
|
|
127
131
|
account_witness_vote: 7,
|
|
@@ -682,7 +682,18 @@ var chain_properties_hf14 = new Serializer(5, {
|
|
|
682
682
|
pm_leverage_funding_rate_ppm_per_day: uint32,
|
|
683
683
|
pm_conversion_profit_cost_percent: uint16,
|
|
684
684
|
pm_closed_market_retention_sec: uint32,
|
|
685
|
-
pm_early_exit_reward_cap_percent: uint16
|
|
685
|
+
pm_early_exit_reward_cap_percent: uint16,
|
|
686
|
+
// #432: minimum bet of the instant path and the per-block row budget of the incremental
|
|
687
|
+
// settlement sweep. #689: the four vote caps (committee + dispute) follow at the very end.
|
|
688
|
+
// All appended at the END, matching FC_REFLECT_DERIVED(chain_properties_pm) in the node —
|
|
689
|
+
// the field order IS the wire format. The committee caps live here (not in hf9) so the
|
|
690
|
+
// already-live hf9 wire layout stays untouched and pre-HF14 validator votes are preserved.
|
|
691
|
+
pm_min_bet: asset,
|
|
692
|
+
pm_settle_rows_per_block: uint32,
|
|
693
|
+
committee_votes_per_request: uint32,
|
|
694
|
+
committee_vote_min_vesting: asset,
|
|
695
|
+
pm_dispute_votes_per_market: uint32,
|
|
696
|
+
pm_dispute_vote_min_vesting: asset
|
|
686
697
|
});
|
|
687
698
|
|
|
688
699
|
var versioned_chain_properties_update = new Serializer("versioned_chain_properties_update", {
|
|
@@ -1190,9 +1201,28 @@ var pm_market_expired = new Serializer("pm_market_expired", {
|
|
|
1190
1201
|
refunded_liquidity: asset
|
|
1191
1202
|
});
|
|
1192
1203
|
|
|
1204
|
+
// 103 — pm_early_exit_claim_paid (virtual)
|
|
1205
|
+
var pm_early_exit_claim_paid = new Serializer("pm_early_exit_claim_paid", {
|
|
1206
|
+
account: string,
|
|
1207
|
+
market_id: int64,
|
|
1208
|
+
kind: uint8,
|
|
1209
|
+
outcome_index: uint8,
|
|
1210
|
+
claimed: asset,
|
|
1211
|
+
paid: asset
|
|
1212
|
+
});
|
|
1213
|
+
|
|
1214
|
+
// 104 — pm_lp_payout (virtual)
|
|
1215
|
+
var pm_lp_payout = new Serializer("pm_lp_payout", {
|
|
1216
|
+
account: string,
|
|
1217
|
+
market_id: int64,
|
|
1218
|
+
principal: asset,
|
|
1219
|
+
income: asset,
|
|
1220
|
+
charge: asset
|
|
1221
|
+
});
|
|
1222
|
+
|
|
1193
1223
|
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,
|
|
1194
1224
|
// Prediction Markets (HF14) — op-ids 66..101, positional order is the tag
|
|
1195
|
-
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, pm_dispute_opened];
|
|
1225
|
+
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, pm_dispute_opened, pm_early_exit_claim_paid, pm_lp_payout];
|
|
1196
1226
|
|
|
1197
1227
|
// Export old witness names as aliases for backward compatibility
|
|
1198
1228
|
module.exports.witness_update = validator_update;
|
package/package.json
CHANGED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var assert = require('assert');
|
|
2
|
+
var ops = require('../src/auth/serializer/src/operations');
|
|
3
|
+
var Convert = require('../src/auth/serializer/src/convert');
|
|
4
|
+
|
|
5
|
+
// Lock-step regression: the C++ pm branch added two virtual operations after pm_dispute_opened (102):
|
|
6
|
+
// pm_early_exit_claim_paid (103, F1/#300) and pm_lp_payout (104, goal #442 / q#681=D).
|
|
7
|
+
// These asserts pin the JS serializer to the C++ FC_REFLECT field order so account_history
|
|
8
|
+
// decoders don't silently misparse the trailing ops.
|
|
9
|
+
describe("viz.auth: PM payout/claim serializers", () => {
|
|
10
|
+
|
|
11
|
+
it("pm_early_exit_claim_paid is registered at index 103", () => {
|
|
12
|
+
var opsTypes = require('../src/auth/serializer/src/ChainTypes');
|
|
13
|
+
assert.equal(opsTypes.operations.pm_early_exit_claim_paid, 103);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("pm_lp_payout is registered at index 104", () => {
|
|
17
|
+
var opsTypes = require('../src/auth/serializer/src/ChainTypes');
|
|
18
|
+
assert.equal(opsTypes.operations.pm_lp_payout, 104);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("round-trips pm_early_exit_claim_paid", () => {
|
|
22
|
+
var op = ops.pm_early_exit_claim_paid;
|
|
23
|
+
// C++ FC_REFLECT: (account)(market_id)(kind)(outcome_index)(claimed)(paid)
|
|
24
|
+
assert.deepEqual(op.keys, ["account", "market_id", "kind", "outcome_index", "claimed", "paid"]);
|
|
25
|
+
var sample = {
|
|
26
|
+
account: "bettor",
|
|
27
|
+
market_id: "42",
|
|
28
|
+
kind: 1,
|
|
29
|
+
outcome_index: 0,
|
|
30
|
+
claimed: "2.000 VIZ",
|
|
31
|
+
paid: "1.500 VIZ"
|
|
32
|
+
};
|
|
33
|
+
var hex = Convert(op).toHex(sample);
|
|
34
|
+
var back = Convert(op).fromHex(hex);
|
|
35
|
+
assert.equal(back.account.toString(), sample.account);
|
|
36
|
+
assert.equal(back.market_id.toString(), sample.market_id);
|
|
37
|
+
assert.equal(back.kind, sample.kind);
|
|
38
|
+
assert.equal(back.outcome_index, sample.outcome_index);
|
|
39
|
+
assert.equal(back.claimed, sample.claimed);
|
|
40
|
+
assert.equal(back.paid, sample.paid);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("round-trips pm_lp_payout", () => {
|
|
44
|
+
var op = ops.pm_lp_payout;
|
|
45
|
+
// C++ FC_REFLECT: (account)(market_id)(principal)(income)(charge)
|
|
46
|
+
assert.deepEqual(op.keys, ["account", "market_id", "principal", "income", "charge"]);
|
|
47
|
+
var sample = {
|
|
48
|
+
account: "vizoracle",
|
|
49
|
+
market_id: "42",
|
|
50
|
+
principal: "100.000 VIZ",
|
|
51
|
+
income: "2.500 VIZ",
|
|
52
|
+
charge: "0.000 VIZ"
|
|
53
|
+
};
|
|
54
|
+
var hex = Convert(op).toHex(sample);
|
|
55
|
+
var back = Convert(op).fromHex(hex);
|
|
56
|
+
assert.equal(back.account.toString(), sample.account);
|
|
57
|
+
assert.equal(back.market_id.toString(), sample.market_id);
|
|
58
|
+
assert.equal(back.principal, sample.principal);
|
|
59
|
+
assert.equal(back.income, sample.income);
|
|
60
|
+
assert.equal(back.charge, sample.charge);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
});
|