@kleros/kleros-sdk 2.1.10 → 2.1.11
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.
|
@@ -42,7 +42,6 @@ const retrieveRealityData = async (realityQuestionID, arbitrable) => {
|
|
|
42
42
|
],
|
|
43
43
|
};
|
|
44
44
|
const questionData = await (0, executeActions_1.executeAction)(questionMapping);
|
|
45
|
-
console.log("questionData", questionData);
|
|
46
45
|
const templateMapping = {
|
|
47
46
|
type: "abi/event",
|
|
48
47
|
abi: "event LogNewTemplate(uint256 indexed template_id, address indexed user, string question_text)",
|
|
@@ -56,7 +55,6 @@ const retrieveRealityData = async (realityQuestionID, arbitrable) => {
|
|
|
56
55
|
populate: ["templateID", "questionText"],
|
|
57
56
|
};
|
|
58
57
|
const templateData = await (0, executeActions_1.executeAction)(templateMapping);
|
|
59
|
-
console.log("templateData", templateData);
|
|
60
58
|
if (!templateData) {
|
|
61
59
|
throw new errors_1.NotFoundError("Template Data", "Failed to retrieve template data");
|
|
62
60
|
}
|
|
@@ -65,7 +63,6 @@ const retrieveRealityData = async (realityQuestionID, arbitrable) => {
|
|
|
65
63
|
}
|
|
66
64
|
const rc_question = require("@reality.eth/reality-eth-lib/formatters/question.js");
|
|
67
65
|
const populatedTemplate = rc_question.populatedJSONForTemplate(templateData.questionText, questionData.realityQuestion);
|
|
68
|
-
console.log("populatedTemplate", populatedTemplate);
|
|
69
66
|
let answers = [];
|
|
70
67
|
if (populatedTemplate.type === "bool") {
|
|
71
68
|
answers = [
|
|
@@ -6,16 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.populateTemplate = void 0;
|
|
7
7
|
const mustache_1 = __importDefault(require("mustache"));
|
|
8
8
|
const disputeDetailsSchema_1 = __importDefault(require("./disputeDetailsSchema"));
|
|
9
|
-
const errors_1 = require("../../errors");
|
|
10
9
|
const populateTemplate = (mustacheTemplate, data) => {
|
|
11
10
|
const render = mustache_1.default.render(mustacheTemplate, data);
|
|
12
11
|
const dispute = JSON.parse(render);
|
|
13
12
|
const validation = disputeDetailsSchema_1.default.safeParse(dispute);
|
|
14
13
|
if (!validation.success) {
|
|
15
|
-
|
|
16
|
-
throw new errors_1.InvalidFormatError("Invalid dispute details format");
|
|
14
|
+
throw validation.error;
|
|
17
15
|
}
|
|
18
|
-
console.log(dispute);
|
|
19
16
|
return dispute;
|
|
20
17
|
};
|
|
21
18
|
exports.populateTemplate = populateTemplate;
|
|
@@ -40,6 +40,17 @@ const getDispute = async (disputeParameters) => {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
const populatedTemplate = (0, utils_1.populateTemplate)(templateData, data);
|
|
43
|
+
if (!populatedTemplate.answers?.some((answer) => answer.id && Number(answer.id) === 0)) {
|
|
44
|
+
populatedTemplate.answers = [
|
|
45
|
+
{
|
|
46
|
+
id: "0x0",
|
|
47
|
+
title: "Refuse to Arbitrate / Invalid",
|
|
48
|
+
description: "Refuse to Arbitrate / Invalid",
|
|
49
|
+
reserved: true,
|
|
50
|
+
},
|
|
51
|
+
...(populatedTemplate.answers || []),
|
|
52
|
+
];
|
|
53
|
+
}
|
|
43
54
|
return populatedTemplate;
|
|
44
55
|
};
|
|
45
56
|
exports.getDispute = getDispute;
|
package/package.json
CHANGED