@kleros/kleros-sdk 2.1.11 → 2.2.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.
|
@@ -14,21 +14,27 @@ export declare enum QuestionType {
|
|
|
14
14
|
}
|
|
15
15
|
export declare const QuestionTypeSchema: z.ZodNativeEnum<typeof QuestionType>;
|
|
16
16
|
export declare const AnswerSchema: z.ZodObject<{
|
|
17
|
-
id: z.
|
|
17
|
+
id: z.ZodString;
|
|
18
18
|
title: z.ZodString;
|
|
19
19
|
description: z.ZodString;
|
|
20
20
|
reserved: z.ZodOptional<z.ZodBoolean>;
|
|
21
21
|
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
id: string;
|
|
22
23
|
description: string;
|
|
23
24
|
title: string;
|
|
24
|
-
id?: string | undefined;
|
|
25
25
|
reserved?: boolean | undefined;
|
|
26
26
|
}, {
|
|
27
|
+
id: string;
|
|
27
28
|
description: string;
|
|
28
29
|
title: string;
|
|
29
|
-
id?: string | undefined;
|
|
30
30
|
reserved?: boolean | undefined;
|
|
31
31
|
}>;
|
|
32
|
+
export declare const RefuseToArbitrateAnswer: {
|
|
33
|
+
id: string;
|
|
34
|
+
title: string;
|
|
35
|
+
description: string;
|
|
36
|
+
reserved: boolean;
|
|
37
|
+
};
|
|
32
38
|
export declare const AttachmentSchema: z.ZodObject<{
|
|
33
39
|
label: z.ZodString;
|
|
34
40
|
uri: z.ZodString;
|
|
@@ -45,19 +51,19 @@ declare const DisputeDetailsSchema: z.ZodObject<{
|
|
|
45
51
|
description: z.ZodString;
|
|
46
52
|
question: z.ZodString;
|
|
47
53
|
answers: z.ZodArray<z.ZodObject<{
|
|
48
|
-
id: z.
|
|
54
|
+
id: z.ZodString;
|
|
49
55
|
title: z.ZodString;
|
|
50
56
|
description: z.ZodString;
|
|
51
57
|
reserved: z.ZodOptional<z.ZodBoolean>;
|
|
52
58
|
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
id: string;
|
|
53
60
|
description: string;
|
|
54
61
|
title: string;
|
|
55
|
-
id?: string | undefined;
|
|
56
62
|
reserved?: boolean | undefined;
|
|
57
63
|
}, {
|
|
64
|
+
id: string;
|
|
58
65
|
description: string;
|
|
59
66
|
title: string;
|
|
60
|
-
id?: string | undefined;
|
|
61
67
|
reserved?: boolean | undefined;
|
|
62
68
|
}>, "many">;
|
|
63
69
|
policyURI: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -84,9 +90,9 @@ declare const DisputeDetailsSchema: z.ZodObject<{
|
|
|
84
90
|
description: string;
|
|
85
91
|
question: string;
|
|
86
92
|
answers: {
|
|
93
|
+
id: string;
|
|
87
94
|
description: string;
|
|
88
95
|
title: string;
|
|
89
|
-
id?: string | undefined;
|
|
90
96
|
reserved?: boolean | undefined;
|
|
91
97
|
}[];
|
|
92
98
|
title: string;
|
|
@@ -108,9 +114,9 @@ declare const DisputeDetailsSchema: z.ZodObject<{
|
|
|
108
114
|
description: string;
|
|
109
115
|
question: string;
|
|
110
116
|
answers: {
|
|
117
|
+
id: string;
|
|
111
118
|
description: string;
|
|
112
119
|
title: string;
|
|
113
|
-
id?: string | undefined;
|
|
114
120
|
reserved?: boolean | undefined;
|
|
115
121
|
}[];
|
|
116
122
|
title: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AliasSchema = exports.AttachmentSchema = exports.AnswerSchema = exports.QuestionTypeSchema = exports.QuestionType = exports.ethAddressOrEnsNameSchema = exports.ensNameSchema = exports.ethAddressSchema = exports.isMultiaddr = exports.isHexId = exports.isHexAddress = void 0;
|
|
3
|
+
exports.AliasSchema = exports.AttachmentSchema = exports.RefuseToArbitrateAnswer = exports.AnswerSchema = exports.QuestionTypeSchema = exports.QuestionType = exports.ethAddressOrEnsNameSchema = exports.ensNameSchema = exports.ethAddressSchema = exports.isMultiaddr = exports.isHexId = exports.isHexAddress = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const viem_1 = require("viem");
|
|
6
6
|
const ens_1 = require("viem/ens");
|
|
@@ -31,14 +31,17 @@ var QuestionType;
|
|
|
31
31
|
})(QuestionType || (exports.QuestionType = QuestionType = {}));
|
|
32
32
|
exports.QuestionTypeSchema = zod_1.z.nativeEnum(QuestionType);
|
|
33
33
|
exports.AnswerSchema = zod_1.z.object({
|
|
34
|
-
id: zod_1.z
|
|
35
|
-
.string()
|
|
36
|
-
.regex(/^0x[0-9a-fA-F]+$/)
|
|
37
|
-
.optional(),
|
|
34
|
+
id: zod_1.z.string().regex(/^0x[0-9a-fA-F]+$/),
|
|
38
35
|
title: zod_1.z.string(),
|
|
39
36
|
description: zod_1.z.string(),
|
|
40
37
|
reserved: zod_1.z.boolean().optional(),
|
|
41
38
|
});
|
|
39
|
+
exports.RefuseToArbitrateAnswer = {
|
|
40
|
+
id: "0x0",
|
|
41
|
+
title: "Refuse to Arbitrate / Invalid",
|
|
42
|
+
description: "Refuse to Arbitrate / Invalid",
|
|
43
|
+
reserved: true,
|
|
44
|
+
};
|
|
42
45
|
exports.AttachmentSchema = zod_1.z.object({
|
|
43
46
|
label: zod_1.z.string(),
|
|
44
47
|
uri: zod_1.z.string(),
|
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.populateTemplate = void 0;
|
|
7
30
|
const mustache_1 = __importDefault(require("mustache"));
|
|
8
|
-
const disputeDetailsSchema_1 =
|
|
31
|
+
const disputeDetailsSchema_1 = __importStar(require("./disputeDetailsSchema"));
|
|
9
32
|
const populateTemplate = (mustacheTemplate, data) => {
|
|
10
33
|
const render = mustache_1.default.render(mustacheTemplate, data);
|
|
11
34
|
const dispute = JSON.parse(render);
|
|
@@ -13,6 +36,10 @@ const populateTemplate = (mustacheTemplate, data) => {
|
|
|
13
36
|
if (!validation.success) {
|
|
14
37
|
throw validation.error;
|
|
15
38
|
}
|
|
39
|
+
dispute.answers = [
|
|
40
|
+
disputeDetailsSchema_1.RefuseToArbitrateAnswer,
|
|
41
|
+
...(dispute.answers.filter((answer) => answer.id && BigInt(answer.id) !== BigInt(0)) || []),
|
|
42
|
+
];
|
|
16
43
|
return dispute;
|
|
17
44
|
};
|
|
18
45
|
exports.populateTemplate = populateTemplate;
|
|
@@ -40,17 +40,6 @@ 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
|
-
}
|
|
54
43
|
return populatedTemplate;
|
|
55
44
|
};
|
|
56
45
|
exports.getDispute = getDispute;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kleros/kleros-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "SDK for Kleros version 2",
|
|
5
5
|
"repository": "git@github.com:kleros/kleros-v2.git",
|
|
6
6
|
"homepage": "https://github.com/kleros/kleros-v2/tree/master/kleros-sdk#readme",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
],
|
|
16
16
|
"type": "commonjs",
|
|
17
17
|
"volta": {
|
|
18
|
-
"node": "20.
|
|
18
|
+
"node": "20.18.2"
|
|
19
19
|
},
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public",
|