From 5c7a66ab0b8854c58a64910f6400b24885382f9f Mon Sep 17 00:00:00 2001 From: mehditorabiv Date: Wed, 14 Aug 2024 14:12:24 +0300 Subject: [PATCH] upd --- src/constants.d.ts | 7 - .../Identifiers/Attestation/Attestation.tsx | 6 +- src/utils/contracts/eas/sepoliaChain.json | 1051 +++++++++++++++++ tsconfig.app.json | 3 +- 4 files changed, 1055 insertions(+), 12 deletions(-) delete mode 100644 src/constants.d.ts create mode 100644 src/utils/contracts/eas/sepoliaChain.json diff --git a/src/constants.d.ts b/src/constants.d.ts deleted file mode 100644 index cfe5f78..0000000 --- a/src/constants.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare module './contracts/chains/constants' { - export const SUPPORTED_CHAINS: { - chainId: number; - easContractAbi: unknown[]; - easContractAddress: string; - }[]; -} diff --git a/src/pages/Identifiers/Attestation/Attestation.tsx b/src/pages/Identifiers/Attestation/Attestation.tsx index ca79c22..13bd1ca 100644 --- a/src/pages/Identifiers/Attestation/Attestation.tsx +++ b/src/pages/Identifiers/Attestation/Attestation.tsx @@ -10,7 +10,7 @@ import { useWriteContract, useAccount } from 'wagmi'; import StepperComponent from '../../../components/shared/CustomStepper'; import { platformAuthentication } from '../../../services/api/auth'; import { useLinkIdentifierMutation } from '../../../services/api/linking/query'; -import { SUPPORTED_CHAINS } from '../../../contracts/chains/constants'; +import sepoliaChain from '../../../utils/contracts/eas/sepoliaChain.json'; const steps = [{ label: 'Auth' }, { label: 'Attest' }, { label: 'Transact' }]; @@ -101,8 +101,8 @@ export function Attestation() { const handleAttest = () => { writeContract({ - abi: SUPPORTED_CHAINS[0].easContractAbi, - address: SUPPORTED_CHAINS[0].easContractAddress as Address, + abi: sepoliaChain.easContractAbi, + address: sepoliaChain.easContractAddress as Address, functionName: 'attestByDelegation', args: [linkingIdentifierRequest], }); diff --git a/src/utils/contracts/eas/sepoliaChain.json b/src/utils/contracts/eas/sepoliaChain.json new file mode 100644 index 0000000..6ec0c4e --- /dev/null +++ b/src/utils/contracts/eas/sepoliaChain.json @@ -0,0 +1,1051 @@ +{ + "chainId": 11155111, + "easSchemaUUID": "0x85e90e3e16d319578888790af3284fea8bca549305071531e7478e3e0b5e7d6d", + "easContractAddress": "0xC2679fBD37d54388Ce493F1DB75320D236e1815e", + "easContractAbi": [ + { + "inputs": [ + { + "internalType": "contract ISchemaRegistry", + "name": "registry", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AccessDenied", + "type": "error" + }, + { + "inputs": [], + "name": "AlreadyRevoked", + "type": "error" + }, + { + "inputs": [], + "name": "AlreadyRevokedOffchain", + "type": "error" + }, + { + "inputs": [], + "name": "AlreadyTimestamped", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientValue", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAttestation", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAttestations", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidExpirationTime", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidLength", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidOffset", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidRegistry", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidRevocation", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidRevocations", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSchema", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSignature", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVerifier", + "type": "error" + }, + { + "inputs": [], + "name": "Irrevocable", + "type": "error" + }, + { + "inputs": [], + "name": "NotFound", + "type": "error" + }, + { + "inputs": [], + "name": "NotPayable", + "type": "error" + }, + { + "inputs": [], + "name": "WrongSchema", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "attester", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "uid", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "schema", + "type": "bytes32" + } + ], + "name": "Attested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "attester", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "uid", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "schema", + "type": "bytes32" + } + ], + "name": "Revoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "revoker", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "data", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint64", + "name": "timestamp", + "type": "uint64" + } + ], + "name": "RevokedOffchain", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "data", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint64", + "name": "timestamp", + "type": "uint64" + } + ], + "name": "Timestamped", + "type": "event" + }, + { + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "schema", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint64", + "name": "expirationTime", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "revocable", + "type": "bool" + }, + { + "internalType": "bytes32", + "name": "refUID", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "internalType": "struct AttestationRequestData", + "name": "data", + "type": "tuple" + } + ], + "internalType": "struct AttestationRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "attest", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "schema", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint64", + "name": "expirationTime", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "revocable", + "type": "bool" + }, + { + "internalType": "bytes32", + "name": "refUID", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "internalType": "struct AttestationRequestData", + "name": "data", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct EIP712Signature", + "name": "signature", + "type": "tuple" + }, + { + "internalType": "address", + "name": "attester", + "type": "address" + } + ], + "internalType": "struct DelegatedAttestationRequest", + "name": "delegatedRequest", + "type": "tuple" + } + ], + "name": "attestByDelegation", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "getAttestTypeHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "uid", + "type": "bytes32" + } + ], + "name": "getAttestation", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "uid", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "schema", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "time", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "expirationTime", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "revocationTime", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "refUID", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "address", + "name": "attester", + "type": "address" + }, + { + "internalType": "bool", + "name": "revocable", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Attestation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainSeparator", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getNonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "revoker", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "data", + "type": "bytes32" + } + ], + "name": "getRevokeOffchain", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRevokeTypeHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getSchemaRegistry", + "outputs": [ + { + "internalType": "contract ISchemaRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "data", + "type": "bytes32" + } + ], + "name": "getTimestamp", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "uid", + "type": "bytes32" + } + ], + "name": "isAttestationValid", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "schema", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint64", + "name": "expirationTime", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "revocable", + "type": "bool" + }, + { + "internalType": "bytes32", + "name": "refUID", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "internalType": "struct AttestationRequestData[]", + "name": "data", + "type": "tuple[]" + } + ], + "internalType": "struct MultiAttestationRequest[]", + "name": "multiRequests", + "type": "tuple[]" + } + ], + "name": "multiAttest", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "schema", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint64", + "name": "expirationTime", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "revocable", + "type": "bool" + }, + { + "internalType": "bytes32", + "name": "refUID", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "internalType": "struct AttestationRequestData[]", + "name": "data", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct EIP712Signature[]", + "name": "signatures", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "attester", + "type": "address" + } + ], + "internalType": "struct MultiDelegatedAttestationRequest[]", + "name": "multiDelegatedRequests", + "type": "tuple[]" + } + ], + "name": "multiAttestByDelegation", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "schema", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "uid", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "internalType": "struct RevocationRequestData[]", + "name": "data", + "type": "tuple[]" + } + ], + "internalType": "struct MultiRevocationRequest[]", + "name": "multiRequests", + "type": "tuple[]" + } + ], + "name": "multiRevoke", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "schema", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "uid", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "internalType": "struct RevocationRequestData[]", + "name": "data", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct EIP712Signature[]", + "name": "signatures", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "revoker", + "type": "address" + } + ], + "internalType": "struct MultiDelegatedRevocationRequest[]", + "name": "multiDelegatedRequests", + "type": "tuple[]" + } + ], + "name": "multiRevokeByDelegation", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32[]", + "name": "data", + "type": "bytes32[]" + } + ], + "name": "multiRevokeOffchain", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32[]", + "name": "data", + "type": "bytes32[]" + } + ], + "name": "multiTimestamp", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "schema", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "uid", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "internalType": "struct RevocationRequestData", + "name": "data", + "type": "tuple" + } + ], + "internalType": "struct RevocationRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "revoke", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "schema", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "uid", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "internalType": "struct RevocationRequestData", + "name": "data", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct EIP712Signature", + "name": "signature", + "type": "tuple" + }, + { + "internalType": "address", + "name": "revoker", + "type": "address" + } + ], + "internalType": "struct DelegatedRevocationRequest", + "name": "delegatedRequest", + "type": "tuple" + } + ], + "name": "revokeByDelegation", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "data", + "type": "bytes32" + } + ], + "name": "revokeOffchain", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "data", + "type": "bytes32" + } + ], + "name": "timestamp", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "permissionManagerContractAddress": "0x787aeDd9Fb3e16EeF5b00C0F35f105daD2A1aA15", + "permissionManagerContractFunctionName": "hasPermission", + "permissionManagerContractAbi": { + "inputs": [ + { + "internalType": "bytes32", + "name": "uid", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasPermission", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } +} diff --git a/tsconfig.app.json b/tsconfig.app.json index 5ff8aa8..97a8749 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -25,8 +25,7 @@ "noFallthroughCasesInSwitch": true, "baseUrl": ".", "paths": { - "@/*": ["./src/*"], - "@contracts/*": ["contracts/*"] + "@/*": ["./src/*"] } }, "include": [".prettierrc.cjs", ".eslintrc.cjs", "src"]