Skip to content

Commit 31df995

Browse files
committed
refactor(sdk): allow-custom-description-for-rta
1 parent 489ad78 commit 31df995

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

kleros-sdk/src/dataMappings/utils/populateTemplate.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,18 @@ export const populateTemplate = (mustacheTemplate: string, data: any): DisputeDe
1111
throw validation.error;
1212
}
1313

14-
// Filter out any existing answer with id 0 and add our standard Refuse to Arbitrate option
14+
const templateRTAAnswer = (dispute as DisputeDetails).answers.find(
15+
(answer) => answer.id && BigInt(answer.id) === BigInt(0)
16+
);
17+
18+
const CustomRTA: DisputeDetails["answers"][number] = {
19+
...RefuseToArbitrateAnswer,
20+
description: templateRTAAnswer?.description ?? RefuseToArbitrateAnswer.description,
21+
};
22+
23+
// Filter out any existing answer with id 0 and add customised Refuse to Arbitrate option
1524
(dispute as DisputeDetails).answers = [
16-
RefuseToArbitrateAnswer,
25+
CustomRTA,
1726
...((dispute as DisputeDetails).answers.filter((answer) => answer.id && BigInt(answer.id) !== BigInt(0)) || []),
1827
];
1928

0 commit comments

Comments
 (0)