Skip to content

Commit

Permalink
Merge branch 'dev' into refactor/optimize-session-invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
Harman-singh-waraich committed Oct 29, 2024
2 parents b72d241 + d1a6020 commit a859958
Show file tree
Hide file tree
Showing 19 changed files with 5,064 additions and 5,294 deletions.
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.0.2.cjs

This file was deleted.

934 changes: 934 additions & 0 deletions .yarn/releases/yarn-4.5.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.2.cjs
yarnPath: .yarn/releases/yarn-4.5.1.cjs
12 changes: 6 additions & 6 deletions contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@kleros/kleros-v2-eslint-config": "workspace:^",
"@kleros/kleros-v2-prettier-config": "workspace:^",
"@kleros/kleros-v2-tsconfig": "workspace:^",
"@logtail/pino": "^0.4.19",
"@logtail/pino": "^0.4.22",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-solhint": "^3.0.1",
Expand All @@ -73,14 +73,14 @@
"@typechain/hardhat": "^7.0.0",
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.3",
"@wagmi/cli": "^2.0.3",
"@types/node": "^20.17.1",
"@wagmi/cli": "^2.1.16",
"abitype": "^0.10.3",
"chai": "^4.4.1",
"dotenv": "^16.3.1",
"ethereumjs-util": "^7.1.5",
"ethers": "^5.7.2",
"graphql": "^16.8.1",
"graphql": "^16.9.0",
"graphql-request": "^6.1.0",
"hardhat": "2.15.0",
"hardhat-contract-sizer": "^2.10.0",
Expand All @@ -92,7 +92,7 @@
"hardhat-tracer": "^2.7.0",
"hardhat-watcher": "^2.5.0",
"node-fetch": "^3.3.2",
"pino": "^8.17.2",
"pino": "^8.21.0",
"pino-pretty": "^10.3.1",
"shelljs": "^0.8.5",
"solhint-plugin-prettier": "^0.1.0",
Expand All @@ -103,6 +103,6 @@
},
"dependencies": {
"@kleros/vea-contracts": "^0.4.0",
"viem": "^2.21.26"
"viem": "^2.21.35"
}
}
6 changes: 3 additions & 3 deletions kleros-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kleros/kleros-sdk",
"version": "2.1.7",
"version": "2.1.8",
"description": "SDK for Kleros version 2",
"repository": "[email protected]:kleros/kleros-v2.git",
"author": "Kleros",
Expand Down Expand Up @@ -44,10 +44,10 @@
"vitest": "^1.1.3"
},
"dependencies": {
"@reality.eth/reality-eth-lib": "^3.2.30",
"@reality.eth/reality-eth-lib": "^3.2.43",
"@urql/core": "^5.0.8",
"mustache": "^4.2.0",
"viem": "^2.21.26",
"viem": "^2.21.35",
"zod": "^3.22.4"
}
}
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"prettier-config",
"tsconfig"
],
"packageManager": "yarn@4.0.2+sha256.825003a0f561ad09a3b1ac4a3b3ea6207af2796d54f62a9420520915721f5186",
"packageManager": "yarn@4.5.1",
"volta": {
"node": "20.11.0",
"yarn": "4.3.1"
"yarn": "4.5.1"
},
"devDependencies": {
"@commitlint/cli": "^17.8.1",
Expand Down Expand Up @@ -62,7 +62,10 @@
"eth-sig-util@npm:^1.4.2": "3.0.0",
"fast-xml-parser": "^4.2.5",
"@babel/traverse:^7.22.5": "^7.23.6",
"yargs-unparser@npm:1.6.0": "1.6.4"
"yargs-unparser@npm:1.6.0": "1.6.4",
"dompurify@npm:^2.4.0": "2.5.7",
"secp256k1@npm:^4.0.1": "4.0.4",
"ws@npm:^8.11.0": "8.18.0"
},
"scripts": {
"check-prerequisites": "scripts/check-prerequisites.sh",
Expand Down
2 changes: 1 addition & 1 deletion subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@graphprotocol/graph-cli": "0.64.1",
"@kleros/kleros-v2-eslint-config": "workspace:^",
"@kleros/kleros-v2-prettier-config": "workspace:^",
"gluegun": "^5.1.6",
"gluegun": "^5.2.0",
"matchstick-as": "0.6.0"
},
"dependenciesComments": {
Expand Down
1 change: 1 addition & 0 deletions web-devtools/.env.devnet-neo.public
1 change: 1 addition & 0 deletions web-devtools/.env.devnet-university.public
1 change: 1 addition & 0 deletions web-devtools/.env.devnet.public
3 changes: 2 additions & 1 deletion web-devtools/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dist
.env.development.local
.env.test.local
.env.production.local
.env.devnet-university

# generated code
src/hooks/contracts/generated.ts
Expand All @@ -43,4 +44,4 @@ yarn-error.log*

# typescript
*.tsbuildinfo
next-env.d.ts
next-env.d.ts
12 changes: 6 additions & 6 deletions web-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"packageManager": "[email protected]+sha256.825003a0f561ad09a3b1ac4a3b3ea6207af2796d54f62a9420520915721f5186",
"volta": {
"node": "20.11.0",
"yarn": "4.3.1"
"yarn": "4.5.1"
},
"scripts": {
"clean": "rimraf .next src/graphql-generated src/hooks/contracts/generated.ts",
Expand All @@ -28,13 +28,13 @@
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/client-preset": "^4.3.2",
"@svgr/webpack": "^8.1.0",
"@types/node": "^20",
"@types/node": "^20.17.1",
"@types/react": "18.2.0",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"@typescript-eslint/utils": "^8.8.1",
"@wagmi/cli": "^2.0.3",
"@wagmi/cli": "^2.1.16",
"eslint": "^8.57.1",
"eslint-config-next": "^14.2.15",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -49,7 +49,7 @@
"@kleros/kleros-sdk": "workspace:^",
"@kleros/ui-components-library": "^2.15.0",
"@web3modal/wagmi": "^5.1.11",
"graphql": "^16.8.1",
"graphql": "^16.9.0",
"graphql-request": "^7.1.0",
"next": "14.2.14",
"react": "^18.2.0",
Expand All @@ -58,7 +58,7 @@
"react-toastify": "^10.0.5",
"typewriter-effect": "^2.21.0",
"vanilla-jsoneditor": "^0.21.4",
"viem": "^2.1.0",
"wagmi": "^2.2.1"
"viem": "^2.21.35",
"wagmi": "^2.12.25"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import retrieveVariables from "@kleros/kleros-sdk/src/dataMappings/utils/retrieveVariables";
import { Field } from "@kleros/ui-components-library";
import { useMemo, useState } from "react";
import styled from "styled-components";
import { useDebounce } from "react-use";
import WithHelpTooltip from "components/WithHelpTooltip";

const Container = styled.div`
width: 100%;
display: flex;
flex-direction: column;
gap: 16px;
margin-top: 32px;
`;

const Header = styled.h2`
margin: 0;
`;

const InputContainer = styled.div`
display: flex;
gap: 16px;
flex-wrap: wrap;
`;
const VariableName = styled.p`
font-family: "Roboto Mono", monospace;
`;

// prevent duplicating input fields
const DisputeRequestParams = [
"arbitrator",
"arbitrable",
"arbitratorDisputeID",
"externalDisputeID",
"templateID",
"templateUri",
];

interface ICustomContextInputs {
dataMapping: string;
setCustomContext: (context: Record<string, string>) => void;
}
const CustomContextInputs: React.FC<ICustomContextInputs> = ({ dataMapping, setCustomContext }) => {
const [customContextInputs, setCustomContextInputs] = useState<Record<string, string>>();

const requiredVariables = useMemo(() => {
try {
return retrieveVariables(dataMapping);
} catch (error) {
console.error("Failed to parse dataMapping:", error);
return [];
}
}, [dataMapping]);

useDebounce(
() => {
if (!customContextInputs) return;
setCustomContext(customContextInputs);
},
300,
[customContextInputs]
);

return requiredVariables.length ? (
<Container>
<WithHelpTooltip tooltipMsg="These are additional variables required by the data mapping to be passed as initial context. Please ignore the variables that will come from the result of the preceeding data mappings">
<Header>Additional Context</Header>
</WithHelpTooltip>
{requiredVariables.map((variable, index) =>
DisputeRequestParams.includes(variable) ? null : (
<InputContainer key={`${variable}-${index}`}>
<VariableName>{variable}:</VariableName>
<Field
type="text"
name={variable}
value={customContextInputs?.[variable]}
onChange={(e) => {
setCustomContextInputs((prev) => ({ ...prev, [variable]: e.target.value }));
}}
placeholder="0x..."
/>
</InputContainer>
)
)}
</Container>
) : null;
};

export default CustomContextInputs;
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ const StyledA = styled.a`
const presets = [
{
title: "Escrow",
txnHash: "0x85e60cb407c9a38e625263cc762ff4283d01f38201825e1d20109d8664cfa7d4",
txnHash: "0x2565b756e500240544f7fc36f938462c7efbbd2e343c57979f81fecdf1054e23",
chainId: 421614,
},
{
title: "Curated Lists",
txnHash: "0x6e5ad6f7436ef8570b50b0fbec76a11ccedbed85030c670e59d8f6617a499108",
txnHash: "0xa7981830bf8144ab2070f3a639bd36b204c4c48ee1fafef66abaf60272418ed4",
chainId: 421614,
},
{
title: "Trump-Biden",
txnHash: "0x9a3a420174f3c55c2b3eb2e77266777b74028b845e528a90142b5b57aafbdb90",
title: "Trump-Harris",
txnHash: "0x86db91678cf3f8c4503e37340cf2cd93bffcba84f9c43a98c090f6a4c76d8793",
chainId: 421614,
},
];
Expand Down
14 changes: 11 additions & 3 deletions web-devtools/src/app/(main)/dispute-template/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import ReactMarkdown from "components/ReactMarkdown";

import FetchDisputeRequestInput, { DisputeRequest } from "./FetchDisputeRequestInput";
import FetchFromIDInput from "./FetchFromIdInput";
import CustomContextInputs from "./CustomContextInputs";

const Container = styled.div`
height: auto;
Expand Down Expand Up @@ -105,6 +106,7 @@ const UpperContainer = styled.div`
`
)}
`;

const StyledForm = styled.form`
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -150,6 +152,7 @@ const DisputeTemplateView = () => {
const [disputeDetails, setDisputeDetails] = useState<DisputeDetails | undefined>(undefined);
const [disputeTemplateInput, setDisputeTemplateInput] = useState<string>("");
const [dataMappingsInput, setDataMappingsInput] = useState<string>("");
const [customContext, setCustomContext] = useState<Record<string, string>>();

const [params, setParams] = useState<DisputeRequest>({
_arbitrable: "0x10f7A6f42Af606553883415bc8862643A6e63fdA",
Expand Down Expand Up @@ -178,7 +181,7 @@ const DisputeTemplateView = () => {
setLoading(true);

setTimeout(() => {
const initialContext = {
let initialContext = {
arbitrator: debouncedParams._arbitrator,
arbitrable: debouncedParams._arbitrable,
arbitratorDisputeID: debouncedParams._arbitratorDisputeID,
Expand All @@ -187,6 +190,8 @@ const DisputeTemplateView = () => {
templateUri: debouncedParams._templateUri,
};

if (customContext) initialContext = { ...initialContext, ...customContext };

const fetchData = async () => {
try {
const data = dataMappingsInput ? await executeActions(JSON.parse(dataMappingsInput), initialContext) : {};
Expand All @@ -210,7 +215,7 @@ const DisputeTemplateView = () => {
if (disputeTemplateInput || dataMappingsInput || debouncedParams) {
scheduleFetchData();
}
}, [disputeTemplateInput, dataMappingsInput, debouncedParams]);
}, [disputeTemplateInput, dataMappingsInput, debouncedParams, customContext]);

return (
<>
Expand Down Expand Up @@ -277,9 +282,12 @@ const DisputeTemplateView = () => {
name="_templateUri"
value={params._templateUri}
onChange={handleFormUpdate}
placeholder="ipfs://... (optional)"
placeholder="/ipfs/... (optional)"
/>
</StyledRow>
<StyledRow>
<CustomContextInputs dataMapping={dataMappingsInput} setCustomContext={setCustomContext} />
</StyledRow>
</StyledForm>
<div>
<FetchFromIDInput
Expand Down
2 changes: 1 addition & 1 deletion web-devtools/src/components/JSONEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ const JSONEditor = (props: any) => {
}
}, [props]);

return <Container ref={refContainer}></Container>;
return <Container ref={refContainer} className={props.className}></Container>;
};
export default JSONEditor;
1 change: 0 additions & 1 deletion web-devtools/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"./*"
],
"src*": [
"../../kleros-sdk/src/*",
"./*"
],
"svgs*": [
Expand Down
10 changes: 5 additions & 5 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"@typescript-eslint/utils": "^8.8.1",
"@wagmi/cli": "^2.0.3",
"@wagmi/cli": "^2.1.16",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
Expand Down Expand Up @@ -95,7 +95,7 @@
"chartjs-plugin-datalabels": "^2.2.0",
"core-js": "^3.35.0",
"ethers": "^5.7.2",
"graphql": "^16.8.1",
"graphql": "^16.9.0",
"graphql-request": "~6.1.0",
"jose": "^5.2.3",
"moment": "^2.30.1",
Expand All @@ -114,9 +114,9 @@
"react-scripts": "^5.0.1",
"react-toastify": "^9.1.3",
"react-use": "^17.4.3",
"siwe": "^2.3.1",
"siwe": "^2.3.2",
"styled-components": "^5.3.11",
"viem": "^2.17.3",
"wagmi": "^2.12.8"
"viem": "^2.21.35",
"wagmi": "^2.12.25"
}
}
Loading

0 comments on commit a859958

Please sign in to comment.