25 lines
962 B
JavaScript
25 lines
962 B
JavaScript
|
import { Box } from './classes/box.js';
|
||
|
import { Scene } from './classes/scene.js';
|
||
|
import { Member } from './classes/member.js';
|
||
|
import { ValidationPool } from './classes/validation-pool.js';
|
||
|
|
||
|
const rootElement = document.getElementById('validation-pool');
|
||
|
const rootBox = new Box('rootBox', rootElement).flex();
|
||
|
|
||
|
const scene = window.scene = new Scene('Validation Pool test', rootBox).log('sequenceDiagram');
|
||
|
|
||
|
const pool = window.validationPool = new ValidationPool("validationPool", scene);
|
||
|
|
||
|
const member1 = window.member1 = await new Member("member1", scene).initialize();
|
||
|
const member2 = window.member2 = await new Member("member2", scene).initialize();
|
||
|
|
||
|
const voteId = pool.initiateVote({fee: 1, duration: 1, isBinding: false});
|
||
|
|
||
|
await member1.castVote(pool, voteId, true, 50);
|
||
|
await member2.castVote(pool, voteId, true, 50);
|
||
|
|
||
|
await member1.revealIdentity(pool, voteId);
|
||
|
await member2.revealIdentity(pool, voteId);
|
||
|
|
||
|
// await scene.renderSequenceDiagram();
|