Skip to content

Commit 2de97df

Browse files
authored
Merge branch 'dev' into feat/make-cases-cards-links
2 parents 12f1370 + a79e377 commit 2de97df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+4675
-7372
lines changed

bot-pinner/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"description": "Pinning of the court data to decentralized storage.",
55
"author": "Kleros",
66
"license": "MIT",
7-
"packageManager": "[email protected]+sha256.825003a0f561ad09a3b1ac4a3b3ea6207af2796d54f62a9420520915721f5186",
87
"volta": {
98
"node": "20.11.0"
109
},
@@ -19,6 +18,6 @@
1918
"node": ">=16.13.0"
2019
},
2120
"devDependencies": {
22-
"@dappnode/dappnodesdk": "^0.3.11"
21+
"@dappnode/dappnodesdk": "^0.3.35"
2322
}
2423
}

contracts/package.json

+15-12
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"description": "Smart contracts for Kleros version 2",
55
"main": "typechain-types/index.ts",
66
"repository": "[email protected]:kleros/kleros-v2.git",
7+
"homepage": "https://github.com/kleros/kleros-v2/tree/master/contracts#readme",
78
"author": "Kleros",
89
"license": "MIT",
9-
"packageManager": "[email protected]+sha256.825003a0f561ad09a3b1ac4a3b3ea6207af2796d54f62a9420520915721f5186",
1010
"engines": {
1111
"node": ">=16.0.0"
1212
},
@@ -60,7 +60,7 @@
6060
"build:types": "tsc --project tsconfig.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap"
6161
},
6262
"devDependencies": {
63-
"@defi-wonderland/natspec-smells": "^1.0.3",
63+
"@defi-wonderland/natspec-smells": "^1.1.5",
6464
"@kleros/kleros-v2-eslint-config": "workspace:^",
6565
"@kleros/kleros-v2-prettier-config": "workspace:^",
6666
"@kleros/kleros-v2-tsconfig": "workspace:^",
@@ -71,18 +71,19 @@
7171
"@openzeppelin/contracts": "^5.1.0",
7272
"@typechain/ethers-v6": "^0.5.1",
7373
"@typechain/hardhat": "^9.1.0",
74-
"@types/chai": "^4.3.11",
75-
"@types/mocha": "^10.0.6",
76-
"@types/node": "^20.17.1",
77-
"@wagmi/cli": "^2.1.16",
74+
"@types/chai": "^4.3.20",
75+
"@types/mocha": "^10.0.10",
76+
"@types/node": "^20.17.6",
77+
"@wagmi/cli": "^2.1.18",
7878
"abitype": "^0.10.3",
79-
"chai": "^4.4.1",
80-
"dotenv": "^16.3.1",
79+
"chai": "^4.5.0",
80+
"dotenv": "^16.4.5",
81+
"eslint": "^9.15.0",
8182
"ethereumjs-util": "^7.1.5",
8283
"ethers": "^6.13.4",
8384
"graphql": "^16.9.0",
84-
"graphql-request": "^6.1.0",
85-
"hardhat": "2.22.15",
85+
"graphql-request": "^7.1.2",
86+
"hardhat": "2.22.16",
8687
"hardhat-contract-sizer": "^2.10.0",
8788
"hardhat-deploy": "^0.14.0",
8889
"hardhat-deploy-ethers": "^0.4.2",
@@ -94,15 +95,17 @@
9495
"node-fetch": "^3.3.2",
9596
"pino": "^8.21.0",
9697
"pino-pretty": "^10.3.1",
98+
"prettier": "^3.3.3",
99+
"prettier-plugin-solidity": "^1.4.1",
97100
"shelljs": "^0.8.5",
98101
"solhint-plugin-prettier": "^0.1.0",
99102
"solidity-coverage": "^0.8.13",
100103
"ts-node": "^10.9.2",
101104
"typechain": "^8.3.2",
102-
"typescript": "^5.3.3"
105+
"typescript": "^5.6.3"
103106
},
104107
"dependencies": {
105108
"@kleros/vea-contracts": "^0.4.0",
106-
"viem": "^2.21.35"
109+
"viem": "^2.21.48"
107110
}
108111
}

eslint-config/package.json

+12-11
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,26 @@
55
"main": ".eslintrc.js",
66
"license": "MIT",
77
"dependencies": {
8-
"@typescript-eslint/eslint-plugin": "^8.8.1",
9-
"@typescript-eslint/parser": "^8.8.1",
10-
"@typescript-eslint/utils": "^8.8.1",
8+
"@typescript-eslint/eslint-plugin": "^8.15.0",
9+
"@typescript-eslint/parser": "^8.15.0",
10+
"@typescript-eslint/utils": "^8.15.0",
11+
"eslint": "^9.15.0",
1112
"eslint-config-prettier": "^9.1.0",
12-
"eslint-config-standard": "^17.1.0",
1313
"eslint-plugin-import": "^2.31.0",
1414
"eslint-plugin-node": "^11.1.0",
1515
"eslint-plugin-prettier": "^5.2.1",
16-
"eslint-plugin-promise": "^6.0.0",
16+
"eslint-plugin-promise": "^6.6.0",
1717
"eslint-plugin-security": "^3.0.1",
18-
"eslint-utils": "^3.0.0"
18+
"eslint-utils": "^3.0.0",
19+
"prettier": "^3.3.3"
1920
},
2021
"devDependencies": {
21-
"@eslint/eslintrc": "^3.1.0",
22-
"@eslint/js": "^9.12.0",
23-
"globals": "^15.11.0",
24-
"typescript": "^5.3.3"
22+
"@eslint/eslintrc": "^3.2.0",
23+
"@eslint/js": "^9.15.0",
24+
"globals": "^15.12.0",
25+
"typescript": "^5.6.3"
2526
},
2627
"peerDependencies": {
27-
"eslint": "8.x"
28+
"eslint": "^8.0.0 || ^9.0.0"
2829
}
2930
}

kleros-app/README.md

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Kleros App
2+
3+
Library for Kleros DApps with reusable abstractions and components.
4+
5+
# Usage
6+
7+
```node
8+
yarn install @kleros/kleros-app
9+
```
10+
11+
## 1. Atlas Interaction
12+
13+
- This library exports utilities to interact with Atlas (Kleros' backend) with minimal code.
14+
15+
- AtlasProvider : Provides functions to interact with Atlas.
16+
17+
> AtlasProvider needs to be wrapped with [<WagmiProvider/>](https://wagmi.sh/react/api/WagmiProvider) and [<QueryClientProvider/>](https://tanstack.com/query/latest/docs/framework/react/reference/QueryClientProvider#queryclientprovider) to work properly.
18+
19+
#### Usage
20+
21+
1. At the root of your app, setup AtlasProvider.
22+
**uri** : Atlas backend uri
23+
**product** : The product / Kleros DApp interacting with Atlas (CourtV2, Curate, etc.)
24+
25+
```typescript
26+
import { WagmiProvider } from 'wagmi'
27+
import { config } from './config'
28+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
29+
import { AtlasProvider, Products } from "@kleros/kleros-app";
30+
31+
const queryClient = new QueryClient()
32+
33+
function App() {
34+
return
35+
<WagmiProvider config={config}>
36+
<QueryClientProvider client={queryClient}>
37+
<AtlasProvider config={{ uri: import.meta.env.REACT_APP_ATLAS_URI, product: Products.CourtV2 }}>
38+
...
39+
</AtlasProvider>
40+
</QueryClientProvider>
41+
</WagmiProvider>
42+
}
43+
```
44+
45+
2. Once Provider is set up, use the functions provided.
46+
47+
```typescript
48+
import React, { useCallback } from "react";
49+
50+
import { useAccount } from "wagmi";
51+
import { useAtlasProvider } from "@kleros/kleros-app";
52+
import { Button } from "@kleros/ui-components-library";
53+
54+
55+
interface IEnsureAuth {
56+
children: React.ReactElement;
57+
className?: string;
58+
}
59+
60+
const EnsureAuth: React.FC<IEnsureAuth> = ({ children, className }) => {
61+
const { address } = useAccount();
62+
const { isVerified, isSigningIn, authoriseUser } = useAtlasProvider();
63+
64+
const handleClick = useCallback(() => {
65+
// authorise a user
66+
authoriseUser()
67+
.then((res) => { console.log(res)})
68+
.catch((err) => {
69+
console.log(err);
70+
});
71+
}, [authoriseUser]);
72+
73+
return isVerified ? (
74+
children
75+
) : (
76+
<Button
77+
text="Sign In"
78+
onClick={handleClick}
79+
disabled={isSigningIn || !address}
80+
isLoading={isSigningIn}
81+
{...{ className }}
82+
/>
83+
);
84+
};
85+
86+
export default EnsureAuth;
87+
88+
```
89+
90+
3. [IAtlasProvider](https://github.com/kleros/kleros-v2/blob/feat/kleros-app/kleros-app/src/lib/atlas/providers/AtlasProvider.tsx)
91+
92+
```typescript
93+
interface IAtlasProvider {
94+
isVerified: boolean;
95+
isSigningIn: boolean;
96+
isAddingUser: boolean;
97+
isFetchingUser: boolean;
98+
isUpdatingUser: boolean;
99+
isUploadingFile: boolean;
100+
user: User | undefined;
101+
userExists: boolean;
102+
authoriseUser: () => Promise<void>;
103+
addUser: (userSettings: AddUserData) => Promise<boolean>;
104+
updateEmail: (userSettings: UpdateEmailData) => Promise<boolean>;
105+
uploadFile: (file: File, role: Roles) => Promise<string | null>;
106+
confirmEmail: (userSettings: ConfirmEmailData) => Promise<
107+
ConfirmEmailResponse & {
108+
isError: boolean;
109+
}
110+
>;
111+
}
112+
```

kleros-app/eslint.config.mjs

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
2+
import react from "eslint-plugin-react";
3+
import reactHooks from "eslint-plugin-react-hooks";
4+
import security from "eslint-plugin-security";
5+
import _import from "eslint-plugin-import";
6+
import globals from "globals";
7+
import tsParser from "@typescript-eslint/parser";
8+
import path from "node:path";
9+
import { fileURLToPath } from "node:url";
10+
import js from "@eslint/js";
11+
import { FlatCompat } from "@eslint/eslintrc";
12+
13+
const __filename = fileURLToPath(import.meta.url);
14+
const __dirname = path.dirname(__filename);
15+
const compat = new FlatCompat({
16+
baseDirectory: __dirname,
17+
recommendedConfig: js.configs.recommended,
18+
allConfig: js.configs.all,
19+
});
20+
21+
export default [
22+
{
23+
ignores: ["src/assets"],
24+
},
25+
...fixupConfigRules(
26+
compat.extends(
27+
"plugin:react/recommended",
28+
"plugin:react-hooks/recommended",
29+
"plugin:import/recommended",
30+
"plugin:import/react",
31+
"plugin:@typescript-eslint/recommended",
32+
"plugin:prettier/recommended",
33+
"prettier"
34+
)
35+
),
36+
{
37+
plugins: {
38+
react: fixupPluginRules(react),
39+
"react-hooks": fixupPluginRules(reactHooks),
40+
security: fixupPluginRules(security),
41+
import: fixupPluginRules(_import),
42+
},
43+
44+
languageOptions: {
45+
globals: {
46+
...globals.browser,
47+
...globals.node,
48+
Atomics: "readonly",
49+
SharedArrayBuffer: "readonly",
50+
},
51+
52+
parser: tsParser,
53+
ecmaVersion: 2020,
54+
sourceType: "module",
55+
56+
parserOptions: {
57+
ecmaFeatures: {
58+
jsx: true,
59+
},
60+
},
61+
},
62+
63+
settings: {
64+
react: {
65+
version: "^18.3.1",
66+
},
67+
68+
"import/resolver": {
69+
typescript: {
70+
project: "./tsconfig.json",
71+
},
72+
},
73+
},
74+
75+
rules: {
76+
"max-len": [
77+
"warn",
78+
{
79+
code: 120,
80+
},
81+
],
82+
83+
"react/prop-types": 0,
84+
"no-unused-vars": "off",
85+
86+
"@typescript-eslint/no-unused-vars": [
87+
"error",
88+
{
89+
varsIgnorePattern: "(^_+[0-9]*$)|([iI]gnored$)|(^ignored)",
90+
argsIgnorePattern: "(^_+[0-9]*$)|([iI]gnored$)|(^ignored)",
91+
},
92+
],
93+
94+
"no-console": [
95+
"error",
96+
{
97+
allow: ["warn", "error", "info", "debug"],
98+
},
99+
],
100+
101+
"@typescript-eslint/no-non-null-assertion": "off",
102+
"@typescript-eslint/no-explicit-any": "off",
103+
"security/detect-object-injection": "off",
104+
"security/detect-non-literal-fs-filename": "off",
105+
106+
"import/extensions": [
107+
"error",
108+
"ignorePackages",
109+
{
110+
js: "never",
111+
jsx: "never",
112+
ts: "never",
113+
tsx: "never",
114+
},
115+
],
116+
117+
"import/no-unresolved": "off",
118+
},
119+
},
120+
];

0 commit comments

Comments
 (0)