@kleros/kleros-sdk 2.1.1 → 2.1.2

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.
Files changed (47) hide show
  1. package/lib/src/consts.d.ts +1 -0
  2. package/lib/src/consts.js +4 -0
  3. package/lib/src/dataMappings/actions/callAction.d.ts +2 -0
  4. package/lib/src/dataMappings/actions/callAction.js +22 -0
  5. package/lib/src/dataMappings/actions/eventAction.d.ts +2 -0
  6. package/lib/src/dataMappings/actions/eventAction.js +25 -0
  7. package/lib/src/dataMappings/actions/fetchIpfsJsonAction.d.ts +2 -0
  8. package/lib/src/dataMappings/actions/fetchIpfsJsonAction.js +36 -0
  9. package/lib/src/dataMappings/actions/jsonAction.d.ts +2 -0
  10. package/lib/src/dataMappings/actions/jsonAction.js +10 -0
  11. package/lib/src/dataMappings/actions/subgraphAction.d.ts +2 -0
  12. package/lib/src/dataMappings/actions/subgraphAction.js +18 -0
  13. package/lib/src/dataMappings/disputeDetails.d.ts +35 -0
  14. package/lib/src/dataMappings/disputeDetails.js +11 -0
  15. package/lib/src/dataMappings/executeActions.d.ts +5 -0
  16. package/lib/src/dataMappings/executeActions.js +45 -0
  17. package/lib/src/dataMappings/retrieveRealityData.d.ts +15 -0
  18. package/lib/src/dataMappings/retrieveRealityData.js +100 -0
  19. package/lib/src/dataMappings/utils/actionTypeValidators.d.ts +7 -0
  20. package/lib/src/dataMappings/utils/actionTypeValidators.js +45 -0
  21. package/lib/src/dataMappings/utils/actionTypes.d.ts +40 -0
  22. package/lib/src/dataMappings/utils/actionTypes.js +2 -0
  23. package/lib/src/dataMappings/utils/createResultObject.d.ts +1 -0
  24. package/lib/src/dataMappings/utils/createResultObject.js +23 -0
  25. package/lib/src/dataMappings/utils/disputeDetailsSchema.d.ts +132 -0
  26. package/lib/src/dataMappings/utils/disputeDetailsSchema.js +67 -0
  27. package/lib/src/dataMappings/utils/disputeDetailsTypes.d.ts +7 -0
  28. package/lib/src/dataMappings/utils/disputeDetailsTypes.js +5 -0
  29. package/lib/src/dataMappings/utils/populateTemplate.d.ts +2 -0
  30. package/lib/src/dataMappings/utils/populateTemplate.js +20 -0
  31. package/lib/src/dataMappings/utils/replacePlaceholdersWithValues.d.ts +2 -0
  32. package/lib/src/dataMappings/utils/replacePlaceholdersWithValues.js +35 -0
  33. package/lib/src/dataMappings/utils/retrieveVariables.d.ts +2 -0
  34. package/lib/src/dataMappings/utils/retrieveVariables.js +15 -0
  35. package/lib/src/index.d.ts +3 -0
  36. package/lib/src/index.js +19 -0
  37. package/lib/src/requests/fetchDisputeDetails.d.ts +12 -0
  38. package/lib/src/requests/fetchDisputeDetails.js +24 -0
  39. package/lib/src/requests/fetchDisputeTemplateFromId.d.ts +8 -0
  40. package/lib/src/requests/fetchDisputeTemplateFromId.js +20 -0
  41. package/lib/src/sdk.d.ts +4 -0
  42. package/lib/src/sdk.js +18 -0
  43. package/lib/src/types/index.d.ts +15 -0
  44. package/lib/src/types/index.js +2 -0
  45. package/lib/src/utils/getDispute.d.ts +3 -0
  46. package/lib/src/utils/getDispute.js +44 -0
  47. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ export declare const MAX_BYTE_SIZE = 1000000;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAX_BYTE_SIZE = void 0;
4
+ exports.MAX_BYTE_SIZE = 1000000;
@@ -0,0 +1,2 @@
1
+ import { AbiCallMapping } from "src/dataMappings/utils/actionTypes";
2
+ export declare const callAction: (mapping: AbiCallMapping) => Promise<Record<string, any>>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.callAction = void 0;
4
+ const viem_1 = require("viem");
5
+ const createResultObject_1 = require("src/dataMappings/utils/createResultObject");
6
+ const sdk_1 = require("src/sdk");
7
+ const callAction = async (mapping) => {
8
+ const publicClient = (0, sdk_1.getPublicClient)();
9
+ if (!publicClient) {
10
+ throw new Error("SDK not configured. Please call `configureSDK` before using.");
11
+ }
12
+ const { abi: source, address, functionName, args, seek, populate } = mapping;
13
+ const parsedAbi = typeof source === "string" ? (0, viem_1.parseAbiItem)(source) : source;
14
+ const data = await publicClient.readContract({
15
+ address,
16
+ abi: [parsedAbi],
17
+ functionName,
18
+ args,
19
+ });
20
+ return (0, createResultObject_1.createResultObject)(data, seek, populate);
21
+ };
22
+ exports.callAction = callAction;
@@ -0,0 +1,2 @@
1
+ import { AbiEventMapping } from "src/dataMappings/utils/actionTypes";
2
+ export declare const eventAction: (mapping: AbiEventMapping) => Promise<Record<string, any>>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.eventAction = void 0;
4
+ const viem_1 = require("viem");
5
+ const createResultObject_1 = require("src/dataMappings/utils/createResultObject");
6
+ const sdk_1 = require("src/sdk");
7
+ const eventAction = async (mapping) => {
8
+ const publicClient = (0, sdk_1.getPublicClient)();
9
+ if (!publicClient) {
10
+ throw new Error("SDK not configured. Please call `configureSDK` before using.");
11
+ }
12
+ const { abi: source, address, eventFilter, seek, populate } = mapping;
13
+ const parsedAbi = (0, viem_1.parseAbiItem)(source);
14
+ const filter = await publicClient.createEventFilter({
15
+ address,
16
+ event: parsedAbi,
17
+ args: eventFilter.args,
18
+ fromBlock: eventFilter.fromBlock,
19
+ toBlock: eventFilter.toBlock,
20
+ });
21
+ const contractEvent = await publicClient.getFilterLogs({ filter });
22
+ const eventData = contractEvent[0].args;
23
+ return (0, createResultObject_1.createResultObject)(eventData, seek, populate);
24
+ };
25
+ exports.eventAction = eventAction;
@@ -0,0 +1,2 @@
1
+ import { FetchIpfsJsonMapping } from "src/dataMappings/utils/actionTypes";
2
+ export declare const fetchIpfsJsonAction: (mapping: FetchIpfsJsonMapping) => Promise<Record<string, any>>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchIpfsJsonAction = void 0;
4
+ const createResultObject_1 = require("src/dataMappings/utils/createResultObject");
5
+ const consts_1 = require("src/consts");
6
+ const fetchIpfsJsonAction = async (mapping) => {
7
+ const { ipfsUri, seek, populate } = mapping;
8
+ let httpUri;
9
+ if (ipfsUri.startsWith("/ipfs/")) {
10
+ httpUri = `https://ipfs.io${ipfsUri}`;
11
+ }
12
+ else if (ipfsUri.startsWith("ipfs://")) {
13
+ httpUri = ipfsUri.replace("ipfs://", "https://ipfs.io/ipfs/");
14
+ }
15
+ else if (!ipfsUri.startsWith("http")) {
16
+ httpUri = `https://ipfs.io/ipfs/${ipfsUri}`;
17
+ }
18
+ else {
19
+ throw new Error("Invalid IPFS URI format");
20
+ }
21
+ const response = await fetch(httpUri, { method: "GET" });
22
+ if (!response.ok) {
23
+ throw new Error("Failed to fetch data from IPFS");
24
+ }
25
+ const contentLength = response.headers.get("content-length");
26
+ if (contentLength && parseInt(contentLength) > consts_1.MAX_BYTE_SIZE) {
27
+ throw new Error("Response size is too large");
28
+ }
29
+ const contentType = response.headers.get("content-type");
30
+ if (!contentType || !contentType.includes("application/json")) {
31
+ throw new Error("Fetched data is not JSON");
32
+ }
33
+ const data = await response.json();
34
+ return (0, createResultObject_1.createResultObject)(data, seek, populate);
35
+ };
36
+ exports.fetchIpfsJsonAction = fetchIpfsJsonAction;
@@ -0,0 +1,2 @@
1
+ import { JsonMapping } from "../utils/actionTypes";
2
+ export declare const jsonAction: (mapping: JsonMapping) => Record<string, any>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jsonAction = void 0;
4
+ const createResultObject_1 = require("src/dataMappings/utils/createResultObject");
5
+ const jsonAction = (mapping) => {
6
+ const { value, seek, populate } = mapping;
7
+ const parsedValue = typeof value === "string" ? JSON.parse(value) : value;
8
+ return (0, createResultObject_1.createResultObject)(parsedValue, seek, populate);
9
+ };
10
+ exports.jsonAction = jsonAction;
@@ -0,0 +1,2 @@
1
+ import { SubgraphMapping } from "../utils/actionTypes";
2
+ export declare const subgraphAction: (mapping: SubgraphMapping) => Promise<Record<string, any>>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.subgraphAction = void 0;
4
+ const createResultObject_1 = require("src/dataMappings/utils/createResultObject");
5
+ const subgraphAction = async (mapping) => {
6
+ const { endpoint, query, variables, seek, populate } = mapping;
7
+ const response = await fetch(endpoint, {
8
+ method: "POST",
9
+ headers: {
10
+ "Content-Type": "application/json",
11
+ Accept: "application/json",
12
+ },
13
+ body: JSON.stringify({ query, variables }),
14
+ });
15
+ const { data } = await response.json();
16
+ return (0, createResultObject_1.createResultObject)(data, seek, populate);
17
+ };
18
+ exports.subgraphAction = subgraphAction;
@@ -0,0 +1,35 @@
1
+ export type DisputeDetails = {
2
+ title: string;
3
+ description: string;
4
+ question: string;
5
+ type: QuestionType;
6
+ answers: Answer[];
7
+ policyURI: string;
8
+ attachment: Attachment;
9
+ frontendUrl: string;
10
+ arbitrableChainID: string;
11
+ arbitrableAddress: `0x${string}`;
12
+ arbitratorChainID: string;
13
+ arbitratorAddress: `0x${string}`;
14
+ category: string;
15
+ lang: string;
16
+ specification: string;
17
+ version: string;
18
+ };
19
+ export declare enum QuestionType {
20
+ Bool = "bool",
21
+ Datetime = "datetime",
22
+ MultipleSelect = "multiple-select",
23
+ SingleSelect = "single-select",
24
+ Uint = "uint"
25
+ }
26
+ export type Answer = {
27
+ title: string;
28
+ description: string;
29
+ id: `0x${string}`;
30
+ reserved: boolean;
31
+ };
32
+ export type Attachment = {
33
+ label: string;
34
+ uri: string;
35
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuestionType = void 0;
4
+ var QuestionType;
5
+ (function (QuestionType) {
6
+ QuestionType["Bool"] = "bool";
7
+ QuestionType["Datetime"] = "datetime";
8
+ QuestionType["MultipleSelect"] = "multiple-select";
9
+ QuestionType["SingleSelect"] = "single-select";
10
+ QuestionType["Uint"] = "uint";
11
+ })(QuestionType || (exports.QuestionType = QuestionType = {}));
@@ -0,0 +1,5 @@
1
+ import { ActionMapping } from "./utils/actionTypes";
2
+ type ActionResult = Record<string, unknown> | null | undefined;
3
+ export declare const executeAction: (mapping: ActionMapping, context?: Record<string, unknown>) => Promise<ActionResult>;
4
+ export declare const executeActions: (mappings: ActionMapping[], initialContext?: Record<string, unknown>) => Promise<Record<string, unknown>>;
5
+ export {};
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeActions = exports.executeAction = void 0;
4
+ const callAction_1 = require("./actions/callAction");
5
+ const eventAction_js_1 = require("./actions/eventAction.js");
6
+ const fetchIpfsJsonAction_1 = require("./actions/fetchIpfsJsonAction");
7
+ const jsonAction_1 = require("./actions/jsonAction");
8
+ const subgraphAction_1 = require("./actions/subgraphAction");
9
+ const retrieveRealityData_1 = require("./retrieveRealityData");
10
+ const actionTypeValidators_1 = require("./utils/actionTypeValidators");
11
+ const replacePlaceholdersWithValues_1 = require("./utils/replacePlaceholdersWithValues");
12
+ const executeAction = async (mapping, context = {}) => {
13
+ mapping = (0, replacePlaceholdersWithValues_1.replacePlaceholdersWithValues)(mapping, context);
14
+ switch (mapping.type) {
15
+ case "graphql":
16
+ return await (0, subgraphAction_1.subgraphAction)((0, actionTypeValidators_1.validateSubgraphMapping)(mapping));
17
+ case "json":
18
+ return (0, jsonAction_1.jsonAction)((0, actionTypeValidators_1.validateJsonMapping)(mapping));
19
+ case "abi/call":
20
+ return await (0, callAction_1.callAction)((0, actionTypeValidators_1.validateAbiCallMapping)(mapping));
21
+ case "abi/event":
22
+ return await (0, eventAction_js_1.eventAction)((0, actionTypeValidators_1.validateAbiEventMapping)(mapping));
23
+ case "fetch/ipfs/json":
24
+ return await (0, fetchIpfsJsonAction_1.fetchIpfsJsonAction)((0, actionTypeValidators_1.validateFetchIpfsJsonMapping)(mapping));
25
+ case "reality":
26
+ mapping = (0, actionTypeValidators_1.validateRealityMapping)(mapping);
27
+ return await (0, retrieveRealityData_1.retrieveRealityData)(mapping.realityQuestionID, context.arbitrableAddress);
28
+ default:
29
+ throw new Error(`Unsupported action type: ${JSON.stringify(mapping)}`);
30
+ }
31
+ };
32
+ exports.executeAction = executeAction;
33
+ const executeActions = async (mappings, initialContext = {}) => {
34
+ const context = { ...initialContext };
35
+ for (const mapping of mappings) {
36
+ const actionResult = await (0, exports.executeAction)(mapping, context);
37
+ if (actionResult) {
38
+ Object.keys(actionResult).forEach((key) => {
39
+ context[key] = actionResult[key];
40
+ });
41
+ }
42
+ }
43
+ return context;
44
+ };
45
+ exports.executeActions = executeActions;
@@ -0,0 +1,15 @@
1
+ export type RealityAnswer = {
2
+ title: string;
3
+ description: string;
4
+ id: string;
5
+ reserved: boolean;
6
+ last?: boolean;
7
+ };
8
+ export declare const retrieveRealityData: (realityQuestionID: string, arbitrable?: `0x${string}`) => Promise<{
9
+ question: unknown;
10
+ type: any;
11
+ realityAddress: unknown;
12
+ questionId: unknown;
13
+ realityUser: unknown;
14
+ answers: RealityAnswer[];
15
+ }>;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.retrieveRealityData = void 0;
4
+ const executeActions_1 = require("./executeActions");
5
+ const retrieveRealityData = async (realityQuestionID, arbitrable) => {
6
+ if (!arbitrable) {
7
+ throw new Error("No arbitrable address provided");
8
+ }
9
+ const questionMapping = {
10
+ type: "abi/event",
11
+ abi: "event LogNewQuestion(bytes32 indexed question_id, address indexed user, uint256 template_id, string question, bytes32 indexed content_hash, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce, uint256 created)",
12
+ address: arbitrable,
13
+ eventFilter: {
14
+ args: [realityQuestionID],
15
+ fromBlock: "earliest",
16
+ toBlock: "latest",
17
+ },
18
+ seek: [
19
+ "question_id",
20
+ "user",
21
+ "template_id",
22
+ "question",
23
+ "content_hash",
24
+ "arbitrator",
25
+ "timeout",
26
+ "opening_ts",
27
+ "nonce",
28
+ "created",
29
+ ],
30
+ populate: [
31
+ "realityQuestionID",
32
+ "realityUser",
33
+ "realityTemplateID",
34
+ "realityQuestion",
35
+ "contentHash",
36
+ "arbitrator",
37
+ "timeout",
38
+ "openingTs",
39
+ "nonce",
40
+ "created",
41
+ ],
42
+ };
43
+ const questionData = await (0, executeActions_1.executeAction)(questionMapping);
44
+ console.log("questionData", questionData);
45
+ const templateMapping = {
46
+ type: "abi/event",
47
+ abi: "event LogNewTemplate(uint256 indexed template_id, address indexed user, string question_text)",
48
+ address: arbitrable,
49
+ eventFilter: {
50
+ args: [0],
51
+ fromBlock: "earliest",
52
+ toBlock: "latest",
53
+ },
54
+ seek: ["template_id", "question_text"],
55
+ populate: ["templateID", "questionText"],
56
+ };
57
+ const templateData = await (0, executeActions_1.executeAction)(templateMapping);
58
+ console.log("templateData", templateData);
59
+ if (!templateData || !questionData) {
60
+ throw new Error("Failed to retrieve template or question data");
61
+ }
62
+ const rc_question = require("@reality.eth/reality-eth-lib/formatters/question.js");
63
+ const populatedTemplate = rc_question.populatedJSONForTemplate(templateData.questionText, questionData.realityQuestion);
64
+ console.log("populatedTemplate", populatedTemplate);
65
+ let answers = [];
66
+ if (populatedTemplate.type === "bool") {
67
+ answers = [
68
+ {
69
+ title: "Yes",
70
+ description: "",
71
+ id: "0x01",
72
+ reserved: false,
73
+ },
74
+ {
75
+ title: "No",
76
+ description: "",
77
+ id: "0x02",
78
+ reserved: false,
79
+ },
80
+ ];
81
+ }
82
+ answers.push({
83
+ id: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
84
+ title: "Answered Too Soon",
85
+ description: "",
86
+ reserved: true,
87
+ });
88
+ for (let i = 0; i < answers.length; i++) {
89
+ answers[i].last = i === answers.length - 1;
90
+ }
91
+ return {
92
+ question: questionData.realityQuestion,
93
+ type: populatedTemplate.type,
94
+ realityAddress: questionData.arbitrator,
95
+ questionId: questionData.realityQuestionID,
96
+ realityUser: questionData.realityUser,
97
+ answers,
98
+ };
99
+ };
100
+ exports.retrieveRealityData = retrieveRealityData;
@@ -0,0 +1,7 @@
1
+ import { SubgraphMapping, AbiEventMapping, AbiCallMapping, JsonMapping, ActionMapping, FetchIpfsJsonMapping, RealityMapping } from "./actionTypes";
2
+ export declare const validateSubgraphMapping: (mapping: ActionMapping) => SubgraphMapping;
3
+ export declare const validateAbiEventMapping: (mapping: ActionMapping) => AbiEventMapping;
4
+ export declare const validateAbiCallMapping: (mapping: ActionMapping) => AbiCallMapping;
5
+ export declare const validateJsonMapping: (mapping: ActionMapping) => JsonMapping;
6
+ export declare const validateFetchIpfsJsonMapping: (mapping: ActionMapping) => FetchIpfsJsonMapping;
7
+ export declare const validateRealityMapping: (mapping: ActionMapping) => RealityMapping;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateRealityMapping = exports.validateFetchIpfsJsonMapping = exports.validateJsonMapping = exports.validateAbiCallMapping = exports.validateAbiEventMapping = exports.validateSubgraphMapping = void 0;
4
+ const validateSubgraphMapping = (mapping) => {
5
+ if (mapping.endpoint === undefined) {
6
+ throw new Error("Invalid mapping for graphql action.");
7
+ }
8
+ return mapping;
9
+ };
10
+ exports.validateSubgraphMapping = validateSubgraphMapping;
11
+ const validateAbiEventMapping = (mapping) => {
12
+ if (mapping.abi === undefined || mapping.eventFilter === undefined) {
13
+ throw new Error("Invalid mapping for abi/event action.");
14
+ }
15
+ return mapping;
16
+ };
17
+ exports.validateAbiEventMapping = validateAbiEventMapping;
18
+ const validateAbiCallMapping = (mapping) => {
19
+ if (mapping.abi === undefined || mapping.functionName === undefined) {
20
+ throw new Error("Invalid mapping for abi/call action.");
21
+ }
22
+ return mapping;
23
+ };
24
+ exports.validateAbiCallMapping = validateAbiCallMapping;
25
+ const validateJsonMapping = (mapping) => {
26
+ if (mapping.value === undefined) {
27
+ throw new Error("Invalid mapping for json action.");
28
+ }
29
+ return mapping;
30
+ };
31
+ exports.validateJsonMapping = validateJsonMapping;
32
+ const validateFetchIpfsJsonMapping = (mapping) => {
33
+ if (mapping.ipfsUri === undefined) {
34
+ throw new Error("Invalid mapping for fetch/ipfs/json action.");
35
+ }
36
+ return mapping;
37
+ };
38
+ exports.validateFetchIpfsJsonMapping = validateFetchIpfsJsonMapping;
39
+ const validateRealityMapping = (mapping) => {
40
+ if (mapping.type !== "reality" || typeof mapping.realityQuestionID !== "string") {
41
+ throw new Error("Invalid mapping for reality action.");
42
+ }
43
+ return mapping;
44
+ };
45
+ exports.validateRealityMapping = validateRealityMapping;
@@ -0,0 +1,40 @@
1
+ import { type Address, type BlockNumber, type BlockTag } from "viem";
2
+ type MappingType = "graphql" | "abi/call" | "abi/event" | "json" | "fetch/ipfs/json" | "reality";
3
+ type AbstractMapping<T extends MappingType> = {
4
+ type: T;
5
+ seek: string[];
6
+ populate: string[];
7
+ };
8
+ export type JsonMapping = AbstractMapping<"json"> & {
9
+ value: object;
10
+ };
11
+ export type SubgraphMapping = AbstractMapping<"graphql"> & {
12
+ endpoint: string;
13
+ query: string;
14
+ variables: {
15
+ [key: string]: unknown;
16
+ };
17
+ };
18
+ export type AbiCallMapping = AbstractMapping<"abi/call"> & {
19
+ abi: string;
20
+ address: Address;
21
+ functionName: string;
22
+ args: any[];
23
+ };
24
+ export type AbiEventMapping = AbstractMapping<"abi/event"> & {
25
+ abi: string;
26
+ address: Address;
27
+ eventFilter: {
28
+ fromBlock: BlockNumber | BlockTag;
29
+ toBlock: BlockNumber | BlockTag;
30
+ args: any;
31
+ };
32
+ };
33
+ export type FetchIpfsJsonMapping = AbstractMapping<"fetch/ipfs/json"> & {
34
+ ipfsUri: string;
35
+ };
36
+ export type RealityMapping = AbstractMapping<"reality"> & {
37
+ realityQuestionID: string;
38
+ };
39
+ export type ActionMapping = SubgraphMapping | AbiEventMapping | AbiCallMapping | JsonMapping | FetchIpfsJsonMapping | RealityMapping;
40
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export declare const createResultObject: (sourceData: Record<string, any>, seek: string[], populate: string[]) => Record<string, any>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createResultObject = void 0;
4
+ const createResultObject = (sourceData, seek, populate) => {
5
+ const result = {};
6
+ const getNestedValue = (obj, path) => {
7
+ return path.split(".").reduce((acc, part) => {
8
+ if (acc && part.includes("[")) {
9
+ const [key, index] = part.replace(/\]/g, "").split("[");
10
+ return acc[key]?.[index];
11
+ }
12
+ return acc ? acc[part] : undefined;
13
+ }, obj);
14
+ };
15
+ seek.forEach((key, idx) => {
16
+ const foundValue = getNestedValue(sourceData, key);
17
+ if (foundValue !== undefined) {
18
+ result[populate[idx]] = foundValue;
19
+ }
20
+ });
21
+ return result;
22
+ };
23
+ exports.createResultObject = createResultObject;
@@ -0,0 +1,132 @@
1
+ import { z } from "zod";
2
+ export declare const isHexAddress: (str: string) => boolean;
3
+ export declare const isHexId: (str: string) => boolean;
4
+ export declare const isMultiaddr: (str: string) => boolean;
5
+ export declare const ethAddressSchema: z.ZodEffects<z.ZodString, string, string>;
6
+ export declare const ensNameSchema: z.ZodEffects<z.ZodString, string, string>;
7
+ export declare const ethAddressOrEnsNameSchema: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
8
+ export declare enum QuestionType {
9
+ Bool = "bool",
10
+ Datetime = "datetime",
11
+ MultipleSelect = "multiple-select",
12
+ SingleSelect = "single-select",
13
+ Uint = "uint"
14
+ }
15
+ export declare const QuestionTypeSchema: z.ZodNativeEnum<typeof QuestionType>;
16
+ export declare const AnswerSchema: z.ZodObject<{
17
+ id: z.ZodOptional<z.ZodString>;
18
+ title: z.ZodString;
19
+ description: z.ZodString;
20
+ reserved: z.ZodOptional<z.ZodBoolean>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ description: string;
23
+ title: string;
24
+ id?: string | undefined;
25
+ reserved?: boolean | undefined;
26
+ }, {
27
+ description: string;
28
+ title: string;
29
+ id?: string | undefined;
30
+ reserved?: boolean | undefined;
31
+ }>;
32
+ export declare const AttachmentSchema: z.ZodObject<{
33
+ label: z.ZodString;
34
+ uri: z.ZodString;
35
+ }, "strip", z.ZodTypeAny, {
36
+ label: string;
37
+ uri: string;
38
+ }, {
39
+ label: string;
40
+ uri: string;
41
+ }>;
42
+ export declare const AliasSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>>;
43
+ declare const DisputeDetailsSchema: z.ZodObject<{
44
+ title: z.ZodString;
45
+ description: z.ZodString;
46
+ question: z.ZodString;
47
+ answers: z.ZodArray<z.ZodObject<{
48
+ id: z.ZodOptional<z.ZodString>;
49
+ title: z.ZodString;
50
+ description: z.ZodString;
51
+ reserved: z.ZodOptional<z.ZodBoolean>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ description: string;
54
+ title: string;
55
+ id?: string | undefined;
56
+ reserved?: boolean | undefined;
57
+ }, {
58
+ description: string;
59
+ title: string;
60
+ id?: string | undefined;
61
+ reserved?: boolean | undefined;
62
+ }>, "many">;
63
+ policyURI: z.ZodEffects<z.ZodString, string, string>;
64
+ attachment: z.ZodOptional<z.ZodObject<{
65
+ label: z.ZodString;
66
+ uri: z.ZodString;
67
+ }, "strip", z.ZodTypeAny, {
68
+ label: string;
69
+ uri: string;
70
+ }, {
71
+ label: string;
72
+ uri: string;
73
+ }>>;
74
+ frontendUrl: z.ZodOptional<z.ZodString>;
75
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
76
+ arbitratorChainID: z.ZodString;
77
+ arbitratorAddress: z.ZodEffects<z.ZodString, string, string>;
78
+ category: z.ZodOptional<z.ZodString>;
79
+ lang: z.ZodOptional<z.ZodString>;
80
+ specification: z.ZodOptional<z.ZodString>;
81
+ aliases: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>>>;
82
+ version: z.ZodString;
83
+ }, "strip", z.ZodTypeAny, {
84
+ description: string;
85
+ question: string;
86
+ answers: {
87
+ description: string;
88
+ title: string;
89
+ id?: string | undefined;
90
+ reserved?: boolean | undefined;
91
+ }[];
92
+ title: string;
93
+ policyURI: string;
94
+ arbitratorChainID: string;
95
+ arbitratorAddress: string;
96
+ version: string;
97
+ attachment?: {
98
+ label: string;
99
+ uri: string;
100
+ } | undefined;
101
+ frontendUrl?: string | undefined;
102
+ metadata?: Record<string, unknown> | undefined;
103
+ category?: string | undefined;
104
+ lang?: string | undefined;
105
+ specification?: string | undefined;
106
+ aliases?: Record<string, string> | undefined;
107
+ }, {
108
+ description: string;
109
+ question: string;
110
+ answers: {
111
+ description: string;
112
+ title: string;
113
+ id?: string | undefined;
114
+ reserved?: boolean | undefined;
115
+ }[];
116
+ title: string;
117
+ policyURI: string;
118
+ arbitratorChainID: string;
119
+ arbitratorAddress: string;
120
+ version: string;
121
+ attachment?: {
122
+ label: string;
123
+ uri: string;
124
+ } | undefined;
125
+ frontendUrl?: string | undefined;
126
+ metadata?: Record<string, unknown> | undefined;
127
+ category?: string | undefined;
128
+ lang?: string | undefined;
129
+ specification?: string | undefined;
130
+ aliases?: Record<string, string> | undefined;
131
+ }>;
132
+ export default DisputeDetailsSchema;
@@ -0,0 +1,67 @@
1
+ "use strict";
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;
4
+ const zod_1 = require("zod");
5
+ const viem_1 = require("viem");
6
+ const ens_1 = require("viem/ens");
7
+ const isHexAddress = (str) => /^0x[a-fA-F0-9]{40}$/.test(str);
8
+ exports.isHexAddress = isHexAddress;
9
+ const isHexId = (str) => /^0x[a-fA-F0-9]{1,64}$/.test(str);
10
+ exports.isHexId = isHexId;
11
+ const isMultiaddr = (str) => /^\/(?:ip4|ip6|dns4|dns6|dnsaddr|tcp|udp|utp|tls|ws|wss|p2p-circuit|p2p-webrtc-star|p2p-webrtc-direct|p2p-websocket-star|onion|ipfs)(\/[^\s\/]+)+$|^ipfs:\/\/[a-zA-Z0-9]+\/[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)?$/.test(str);
12
+ exports.isMultiaddr = isMultiaddr;
13
+ exports.ethAddressSchema = zod_1.z.string().refine((value) => (0, viem_1.isAddress)(value, { strict: false }), {
14
+ message: "Provided address is invalid.",
15
+ });
16
+ exports.ensNameSchema = zod_1.z
17
+ .string()
18
+ .refine((value) => typeof (0, ens_1.normalize)(value) === "string" && value.endsWith(".eth"), {
19
+ message: "Provided ENS name is invalid.",
20
+ });
21
+ exports.ethAddressOrEnsNameSchema = zod_1.z.union([exports.ethAddressSchema, exports.ensNameSchema], {
22
+ errorMap: () => ({ message: "Provided address or ENS name is invalid." }),
23
+ });
24
+ var QuestionType;
25
+ (function (QuestionType) {
26
+ QuestionType["Bool"] = "bool";
27
+ QuestionType["Datetime"] = "datetime";
28
+ QuestionType["MultipleSelect"] = "multiple-select";
29
+ QuestionType["SingleSelect"] = "single-select";
30
+ QuestionType["Uint"] = "uint";
31
+ })(QuestionType || (exports.QuestionType = QuestionType = {}));
32
+ exports.QuestionTypeSchema = zod_1.z.nativeEnum(QuestionType);
33
+ exports.AnswerSchema = zod_1.z.object({
34
+ id: zod_1.z
35
+ .string()
36
+ .regex(/^0x[0-9a-fA-F]+$/)
37
+ .optional(),
38
+ title: zod_1.z.string(),
39
+ description: zod_1.z.string(),
40
+ reserved: zod_1.z.boolean().optional(),
41
+ });
42
+ exports.AttachmentSchema = zod_1.z.object({
43
+ label: zod_1.z.string(),
44
+ uri: zod_1.z.string(),
45
+ });
46
+ exports.AliasSchema = zod_1.z.record(exports.ethAddressOrEnsNameSchema);
47
+ const MetadataSchema = zod_1.z.record(zod_1.z.unknown());
48
+ const DisputeDetailsSchema = zod_1.z.object({
49
+ title: zod_1.z.string(),
50
+ description: zod_1.z.string(),
51
+ question: zod_1.z.string(),
52
+ answers: zod_1.z.array(exports.AnswerSchema),
53
+ policyURI: zod_1.z.string().refine((value) => (0, exports.isMultiaddr)(value), {
54
+ message: "Provided policy URI is not a valid multiaddr.",
55
+ }),
56
+ attachment: exports.AttachmentSchema.optional(),
57
+ frontendUrl: zod_1.z.string().optional(),
58
+ metadata: MetadataSchema.optional(),
59
+ arbitratorChainID: zod_1.z.string(),
60
+ arbitratorAddress: exports.ethAddressSchema,
61
+ category: zod_1.z.string().optional(),
62
+ lang: zod_1.z.string().optional(),
63
+ specification: zod_1.z.string().optional(),
64
+ aliases: exports.AliasSchema.optional(),
65
+ version: zod_1.z.string(),
66
+ });
67
+ exports.default = DisputeDetailsSchema;
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ import DisputeDetailsSchema, { AliasSchema, AnswerSchema, AttachmentSchema } from "./disputeDetailsSchema";
3
+ export { QuestionType } from "./disputeDetailsSchema";
4
+ export type DisputeDetails = z.infer<typeof DisputeDetailsSchema>;
5
+ export type Answer = z.infer<typeof AnswerSchema>;
6
+ export type Alias = z.infer<typeof AliasSchema>;
7
+ export type Attachment = z.infer<typeof AttachmentSchema>;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuestionType = void 0;
4
+ var disputeDetailsSchema_1 = require("./disputeDetailsSchema");
5
+ Object.defineProperty(exports, "QuestionType", { enumerable: true, get: function () { return disputeDetailsSchema_1.QuestionType; } });
@@ -0,0 +1,2 @@
1
+ import { DisputeDetails } from "./disputeDetailsTypes";
2
+ export declare const populateTemplate: (mustacheTemplate: string, data: any) => DisputeDetails;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.populateTemplate = void 0;
7
+ const mustache_1 = __importDefault(require("mustache"));
8
+ const disputeDetailsSchema_1 = __importDefault(require("./disputeDetailsSchema"));
9
+ const populateTemplate = (mustacheTemplate, data) => {
10
+ const render = mustache_1.default.render(mustacheTemplate, data);
11
+ const dispute = JSON.parse(render);
12
+ const validation = disputeDetailsSchema_1.default.safeParse(dispute);
13
+ if (!validation.success) {
14
+ console.error("Validation errors:", validation.error.errors, "\n\nDispute details:", `${JSON.stringify(dispute)}`);
15
+ throw new Error("Invalid dispute details format");
16
+ }
17
+ console.log(dispute);
18
+ return dispute;
19
+ };
20
+ exports.populateTemplate = populateTemplate;
@@ -0,0 +1,2 @@
1
+ import { ActionMapping } from "./actionTypes";
2
+ export declare function replacePlaceholdersWithValues(mapping: ActionMapping, context: Record<string, unknown>): ActionMapping | ActionMapping[];
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.replacePlaceholdersWithValues = void 0;
7
+ const mustache_1 = __importDefault(require("mustache"));
8
+ const retrieveVariables_1 = __importDefault(require("./retrieveVariables"));
9
+ function replacePlaceholdersWithValues(mapping, context) {
10
+ function replace(obj) {
11
+ if (typeof obj === "string") {
12
+ validateContext(obj, context);
13
+ return mustache_1.default.render(obj, context);
14
+ }
15
+ else if (Array.isArray(obj)) {
16
+ return obj.map(replace);
17
+ }
18
+ else if (typeof obj === "object" && obj !== null) {
19
+ return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, replace(value)]));
20
+ }
21
+ else {
22
+ return obj;
23
+ }
24
+ }
25
+ return replace(mapping);
26
+ }
27
+ exports.replacePlaceholdersWithValues = replacePlaceholdersWithValues;
28
+ const validateContext = (template, context) => {
29
+ const variables = (0, retrieveVariables_1.default)(template);
30
+ variables.forEach((variable) => {
31
+ if (!context[variable])
32
+ throw new Error(`Expected key : "${variable}" to be provided in context.`);
33
+ });
34
+ return true;
35
+ };
@@ -0,0 +1,2 @@
1
+ declare const retrieveVariables: (template: string) => string[];
2
+ export default retrieveVariables;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const mustache_1 = __importDefault(require("mustache"));
7
+ const retrieveVariables = (template) => mustache_1.default
8
+ .parse(template)
9
+ .filter(function (v) {
10
+ return v[0] === "name" || v[0] === "&";
11
+ })
12
+ .map(function (v) {
13
+ return v[1];
14
+ });
15
+ exports.default = retrieveVariables;
@@ -0,0 +1,3 @@
1
+ export * from "./sdk";
2
+ export * from "./types";
3
+ export * from "./utils/getDispute";
@@ -0,0 +1,19 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./sdk"), exports);
18
+ __exportStar(require("./types"), exports);
19
+ __exportStar(require("./utils/getDispute"), exports);
@@ -0,0 +1,12 @@
1
+ type DisputeDetailsQueryResponse = {
2
+ dispute: {
3
+ arbitrated: {
4
+ id: string;
5
+ };
6
+ arbitrableChainId: number;
7
+ externalDisputeId: number;
8
+ templateId: number;
9
+ };
10
+ };
11
+ declare const fetchDisputeDetails: (endpoint: string, id: number) => Promise<DisputeDetailsQueryResponse>;
12
+ export default fetchDisputeDetails;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const graphql_request_1 = require("graphql-request");
4
+ const fetchDisputeDetails = async (endpoint, id) => {
5
+ const query = `
6
+ query DisputeDetails {
7
+ dispute(id: ${id}) {
8
+ arbitrated {
9
+ id
10
+ }
11
+ arbitrableChainId
12
+ externalDisputeId
13
+ templateId
14
+ }
15
+ }
16
+ `;
17
+ try {
18
+ return await (0, graphql_request_1.request)(endpoint, query);
19
+ }
20
+ catch (error) {
21
+ throw new Error(`Error querying Dispute Details , endpoint : ${endpoint}, message : ${error?.message}`);
22
+ }
23
+ };
24
+ exports.default = fetchDisputeDetails;
@@ -0,0 +1,8 @@
1
+ type DisputeTemplateQueryResponse = {
2
+ disputeTemplate: {
3
+ templateData: string;
4
+ templateDataMappings: string;
5
+ };
6
+ };
7
+ declare const fetchDisputeTemplateFromId: (endpoint: string, id: number) => Promise<DisputeTemplateQueryResponse>;
8
+ export default fetchDisputeTemplateFromId;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const graphql_request_1 = require("graphql-request");
4
+ const fetchDisputeTemplateFromId = async (endpoint, id) => {
5
+ const query = `
6
+ query DisputeTemplate {
7
+ disputeTemplate(id: ${id}) {
8
+ templateData
9
+ templateDataMappings
10
+ }
11
+ }
12
+ `;
13
+ try {
14
+ return await (0, graphql_request_1.request)(endpoint, query);
15
+ }
16
+ catch (error) {
17
+ throw new Error(`Error querying Dispute Template Registry , endpoint : ${endpoint}, message : ${error?.message}`);
18
+ }
19
+ };
20
+ exports.default = fetchDisputeTemplateFromId;
@@ -0,0 +1,4 @@
1
+ import { type PublicClient } from "viem";
2
+ import { SdkConfig } from "./types";
3
+ export declare const configureSDK: (config: SdkConfig) => void;
4
+ export declare const getPublicClient: () => PublicClient | undefined;
package/lib/src/sdk.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPublicClient = exports.configureSDK = void 0;
4
+ const viem_1 = require("viem");
5
+ let publicClient;
6
+ const configureSDK = (config) => {
7
+ if (config.client) {
8
+ publicClient = (0, viem_1.createPublicClient)(config.client);
9
+ }
10
+ };
11
+ exports.configureSDK = configureSDK;
12
+ const getPublicClient = () => {
13
+ if (!publicClient) {
14
+ throw new Error("SDK not configured. Please call `configureSDK` before using.");
15
+ }
16
+ return publicClient;
17
+ };
18
+ exports.getPublicClient = getPublicClient;
@@ -0,0 +1,15 @@
1
+ import { PublicClientConfig } from "viem";
2
+ export type SdkConfig = {
3
+ client: PublicClientConfig;
4
+ };
5
+ type GetDisputeParametersOptions = {
6
+ sdkConfig: SdkConfig;
7
+ additionalContext: Record<string, any>;
8
+ };
9
+ export type GetDisputeParameters = {
10
+ disputeId: number;
11
+ coreSubgraph: string;
12
+ dtrSubgraph: string;
13
+ options: GetDisputeParametersOptions | undefined;
14
+ };
15
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { type GetDisputeParameters } from "src/types";
2
+ import { DisputeDetails } from "dataMappings/utils/disputeDetailsTypes";
3
+ export declare const getDispute: (disputeParameters: GetDisputeParameters) => Promise<DisputeDetails | undefined>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getDispute = void 0;
7
+ const sdk_1 = require("src/sdk");
8
+ const fetchDisputeDetails_1 = __importDefault(require("src/requests/fetchDisputeDetails"));
9
+ const fetchDisputeTemplateFromId_1 = __importDefault(require("src/requests/fetchDisputeTemplateFromId"));
10
+ const executeActions_1 = require("dataMappings/executeActions");
11
+ const populateTemplate_1 = require("dataMappings/utils/populateTemplate");
12
+ const getDispute = async (disputeParameters) => {
13
+ if (disputeParameters.options?.sdkConfig) {
14
+ (0, sdk_1.configureSDK)(disputeParameters.options.sdkConfig);
15
+ }
16
+ const { disputeId, dtrSubgraph, coreSubgraph, options } = disputeParameters;
17
+ const disputeDetails = await (0, fetchDisputeDetails_1.default)(coreSubgraph, disputeId);
18
+ if (!disputeDetails?.dispute) {
19
+ throw new Error(`Dispute details not found for disputeId: ${disputeId}`);
20
+ }
21
+ const template = await (0, fetchDisputeTemplateFromId_1.default)(dtrSubgraph, disputeDetails.dispute.templateId);
22
+ if (!template) {
23
+ throw new Error(`Template not found for template ID: ${disputeDetails.dispute.templateId}`);
24
+ }
25
+ const { templateData, templateDataMappings } = template.disputeTemplate;
26
+ const initialContext = {
27
+ arbitrableAddress: disputeDetails.dispute.arbitrated.id,
28
+ arbitrableChainID: disputeDetails.dispute.arbitrableChainId,
29
+ externalDisputeID: disputeDetails.dispute.externalDisputeId,
30
+ ...options?.additionalContext,
31
+ };
32
+ let data = {};
33
+ if (templateDataMappings) {
34
+ try {
35
+ data = await (0, executeActions_1.executeActions)(JSON.parse(templateDataMappings), initialContext);
36
+ }
37
+ catch (err) {
38
+ throw new Error(err);
39
+ }
40
+ }
41
+ const populatedTemplate = (0, populateTemplate_1.populateTemplate)(templateData, data);
42
+ return populatedTemplate;
43
+ };
44
+ exports.getDispute = getDispute;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kleros/kleros-sdk",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "SDK for Kleros version 2",
5
5
  "repository": "git@github.com:kleros/kleros-v2.git",
6
6
  "author": "Kleros",