From 74f9186b8ba83aed727e1a94091f170c3b4af018 Mon Sep 17 00:00:00 2001 From: bitbeckers Date: Fri, 1 Mar 2024 19:12:28 +0100 Subject: [PATCH] feat(mint): mint on base sepolia in fe --- contracts/RELEASE.md | 4 +++ contracts/package.json | 2 +- contracts/src/index.ts | 6 +++++ defender/package.json | 2 +- frontend/components/dapp-context.tsx | 6 ++--- frontend/hooks/hypercerts-client.ts | 2 +- frontend/package.json | 4 +-- pnpm-lock.yaml | 38 ++++++++++++++-------------- sdk/RELEASE.md | 5 ++++ sdk/package.json | 4 +-- sdk/src/constants.ts | 10 ++++++++ sdk/src/indexer/gql/graphql.ts | 5 ++++ sdk/src/types/client.ts | 4 +-- sdk/src/utils/config.ts | 6 +++-- 14 files changed, 65 insertions(+), 33 deletions(-) diff --git a/contracts/RELEASE.md b/contracts/RELEASE.md index 4764bcec..e8b1a9ac 100644 --- a/contracts/RELEASE.md +++ b/contracts/RELEASE.md @@ -1,3 +1,7 @@ +# 1.1.2 + +- Add Base and Base Sepolia to types + # 1.1.1 - Improve ESM support by exporting `index.mjs` instead of `index.js`. @baumstern diff --git a/contracts/package.json b/contracts/package.json index 163fe79d..f155217d 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -1,7 +1,7 @@ { "name": "@hypercerts-org/contracts", "description": "EVM compatible protocol for managing impact claims", - "version": "1.1.1", + "version": "1.1.2", "author": { "name": "Hypercerts Foundation", "url": "https://github.com/hypercerts-org/hypercerts" diff --git a/contracts/src/index.ts b/contracts/src/index.ts index 147ce320..9ae6d333 100644 --- a/contracts/src/index.ts +++ b/contracts/src/index.ts @@ -72,6 +72,12 @@ const deployments = { ...DEPLOYMENTS.protocol["11155111"], ...DEPLOYMENTS.marketplace["11155111"], }, + 84532: { + ...DEPLOYMENTS.protocol["84532"], + }, + 8453: { + ...DEPLOYMENTS.protocol["8453"], + }, } as Record; const asDeployedChain = (chainId: string | number) => { diff --git a/defender/package.json b/defender/package.json index 13d05a93..2ff45321 100644 --- a/defender/package.json +++ b/defender/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@graphql-mesh/cache-localforage": "^0.95.7", - "@hypercerts-org/contracts": "1.1.1", + "@hypercerts-org/contracts": "1.1.2", "@openzeppelin/defender-autotask-client": "1.54.1", "@openzeppelin/defender-autotask-utils": "1.54.1", "@openzeppelin/defender-base-client": "1.54.1", diff --git a/frontend/components/dapp-context.tsx b/frontend/components/dapp-context.tsx index bed7f318..69a461c4 100644 --- a/frontend/components/dapp-context.tsx +++ b/frontend/components/dapp-context.tsx @@ -31,7 +31,7 @@ import { import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; import React, { ReactNode, useEffect } from "react"; -import { celo, Chain, optimism, sepolia } from "viem/chains"; +import { celo, Chain, optimism, sepolia, baseSepolia, base } from "viem/chains"; import { configureChains, WagmiConfig, createConfig } from "wagmi"; import { publicProvider } from "wagmi/providers/public"; @@ -44,8 +44,8 @@ import { const queryClient = new QueryClient(); -const TEST_CHAINS = [sepolia]; -const PROD_CHAINS = [optimism, celo]; +const TEST_CHAINS = [sepolia, baseSepolia]; +const PROD_CHAINS = [optimism, celo, base]; export const CHAINS = (isProduction ? PROD_CHAINS : TEST_CHAINS) as Chain[]; diff --git a/frontend/hooks/hypercerts-client.ts b/frontend/hooks/hypercerts-client.ts index 1d3dd052..fafcae20 100644 --- a/frontend/hooks/hypercerts-client.ts +++ b/frontend/hooks/hypercerts-client.ts @@ -4,7 +4,7 @@ import { HypercertClient, HypercertClientConfig } from "@hypercerts-org/sdk"; import { useWalletClient, useNetwork } from "wagmi"; const isSupportedChain = (chainId: number) => { - const supportedChainIds = [10, 42220, 11155111]; // Replace with actual chain IDs + const supportedChainIds = [10, 42220, 11155111, 84532, 8453]; // Replace with actual chain IDs return supportedChainIds.includes(chainId); }; diff --git a/frontend/package.json b/frontend/package.json index 14c037dd..0f149720 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -23,9 +23,9 @@ "@emotion/react": "^11.10.5", "@emotion/styled": "^11.10.5", "@graphprotocol/client-cli": "^2.2.16", - "@hypercerts-org/contracts": "1.1.1-alpha.0", + "@hypercerts-org/contracts": "1.1.2", "@hypercerts-org/observabletreemap": "workspace: *", - "@hypercerts-org/sdk": "1.4.2-alpha.0", + "@hypercerts-org/sdk": "1.4.3", "@mui/icons-material": "^5.11.9", "@mui/material": "^5.11.2", "@mui/x-date-pickers": "^5.0.12", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 41ea00db..8ba87458 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -205,8 +205,8 @@ importers: specifier: ^0.95.7 version: 0.95.8(@graphql-mesh/types@0.95.8)(@graphql-mesh/utils@0.95.8)(graphql@16.8.1)(tslib@2.6.2) '@hypercerts-org/contracts': - specifier: 1.1.1 - version: 1.1.1(ts-node@10.9.1)(typescript@4.9.5) + specifier: 1.1.2 + version: 1.1.2(ts-node@10.9.1)(typescript@4.9.5) '@openzeppelin/defender-autotask-client': specifier: 1.54.1 version: 1.54.1 @@ -345,14 +345,14 @@ importers: specifier: ^2.2.16 version: 2.2.22(@babel/core@7.23.5)(@envelop/core@3.0.6)(@graphql-mesh/cross-helpers@0.3.4)(@graphql-mesh/store@0.93.1)(@graphql-mesh/types@0.93.2)(@graphql-mesh/utils@0.93.2)(@graphql-tools/delegate@9.0.35)(@graphql-tools/merge@8.4.2)(@graphql-tools/utils@9.2.1)(@graphql-tools/wrap@9.4.2)(@types/node@18.18.7)(graphql-tag@2.12.6)(graphql@16.8.1)(react-native@0.72.6) '@hypercerts-org/contracts': - specifier: 1.1.1-alpha.0 - version: 1.1.1-alpha.0(typescript@5.1.6) + specifier: 1.1.2 + version: 1.1.2(typescript@5.1.6) '@hypercerts-org/observabletreemap': specifier: 'workspace: *' version: link:../vendor/observabletreemap '@hypercerts-org/sdk': - specifier: 1.4.2-alpha.0 - version: 1.4.2-alpha.0(react@18.2.0)(typescript@5.1.6)(zod@3.22.4) + specifier: 1.4.3 + version: 1.4.3(react@18.2.0)(typescript@5.1.6)(zod@3.22.4) '@mui/icons-material': specifier: ^5.11.9 version: 5.14.15(@mui/material@5.14.15)(@types/react@18.2.33)(react@18.2.0) @@ -568,8 +568,8 @@ importers: specifier: ^3.2.0 version: 3.2.0(graphql@16.8.1) '@hypercerts-org/contracts': - specifier: 1.1.1-alpha.1 - version: 1.1.1-alpha.1(ts-node@10.9.1)(typescript@5.3.2) + specifier: 1.1.2 + version: 1.1.2(ts-node@10.9.1)(typescript@5.3.2) '@openzeppelin/merkle-tree': specifier: ^1.0.5 version: 1.0.5 @@ -7311,8 +7311,8 @@ packages: /@humanwhocodes/object-schema@2.0.1: resolution: {integrity: sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==} - /@hypercerts-org/contracts@1.1.1(ts-node@10.9.1)(typescript@4.9.5): - resolution: {integrity: sha512-TxzArJFWMzBh6EsBj9WQCO4CHjzWZFSMpltzFheUMCYp8TIBXBKC0zNViX68hbI7gEJQoA4xvPDVEqAkY1E8ig==} + /@hypercerts-org/contracts@1.1.2(ts-node@10.9.1)(typescript@4.9.5): + resolution: {integrity: sha512-+Y7TD1LX1c2FyU7OYuQ/NUFfcKaW5fIZ9R/Xr+DhNUbi7KstHhhdVEl1hmSExuvySbAD3wNKFaQWdlBRxT520Q==} dependencies: hardhat: 2.19.1(ts-node@10.9.1)(typescript@4.9.5) transitivePeerDependencies: @@ -7323,10 +7323,10 @@ packages: - utf-8-validate dev: false - /@hypercerts-org/contracts@1.1.1-alpha.0(typescript@5.1.6): - resolution: {integrity: sha512-3bypIOuTMLM/5KXopzOCOxcR+nUImFf/phPtZ/PoHceAx4CZZe1ygnK8l+GHaBxOX7/HcAp/9D7NBbcnJjHYcw==} + /@hypercerts-org/contracts@1.1.2(ts-node@10.9.1)(typescript@5.3.2): + resolution: {integrity: sha512-+Y7TD1LX1c2FyU7OYuQ/NUFfcKaW5fIZ9R/Xr+DhNUbi7KstHhhdVEl1hmSExuvySbAD3wNKFaQWdlBRxT520Q==} dependencies: - hardhat: 2.19.1(typescript@5.1.6) + hardhat: 2.19.1(ts-node@10.9.1)(typescript@5.3.2) transitivePeerDependencies: - bufferutil - supports-color @@ -7335,10 +7335,10 @@ packages: - utf-8-validate dev: false - /@hypercerts-org/contracts@1.1.1-alpha.1(ts-node@10.9.1)(typescript@5.3.2): - resolution: {integrity: sha512-M7cNYEf+i6rT2jSOT4sob/oIlKalT2zSweBQq6iP1wCA16Vhf0Y5JDhwLH64z4XENJfOKKSO0TmDDF2kKvHReg==} + /@hypercerts-org/contracts@1.1.2(typescript@5.1.6): + resolution: {integrity: sha512-+Y7TD1LX1c2FyU7OYuQ/NUFfcKaW5fIZ9R/Xr+DhNUbi7KstHhhdVEl1hmSExuvySbAD3wNKFaQWdlBRxT520Q==} dependencies: - hardhat: 2.19.1(ts-node@10.9.1)(typescript@5.3.2) + hardhat: 2.19.1(typescript@5.1.6) transitivePeerDependencies: - bufferutil - supports-color @@ -7347,13 +7347,13 @@ packages: - utf-8-validate dev: false - /@hypercerts-org/sdk@1.4.2-alpha.0(react@18.2.0)(typescript@5.1.6)(zod@3.22.4): - resolution: {integrity: sha512-VT8cd0dfbREKbD8YyQrmoyBLUrVerLwdzLqet6f+LO4yh0dtKHwKIuJJNqbhao5vwzn/iSyob08xIFmGu8rivA==} + /@hypercerts-org/sdk@1.4.3(react@18.2.0)(typescript@5.1.6)(zod@3.22.4): + resolution: {integrity: sha512-9K/2dY/r5dXZiFPlM9rg06P36aH49grpetsvisi9HxJMJYTIQy6ZKvB/ix3zC7LS+zSv8fhz13AEoQVlmP3Svw==} dependencies: '@ethereum-attestation-service/eas-sdk': 1.3.7(typescript@5.1.6) '@ethersproject/abstract-signer': 5.7.0 '@graphql-typed-document-node/core': 3.2.0(graphql@16.8.1) - '@hypercerts-org/contracts': 1.1.1-alpha.0(typescript@5.1.6) + '@hypercerts-org/contracts': 1.1.2(typescript@5.1.6) '@openzeppelin/merkle-tree': 1.0.5 '@urql/core': 4.2.0(graphql@16.8.1) '@whatwg-node/fetch': 0.9.14 diff --git a/sdk/RELEASE.md b/sdk/RELEASE.md index 5f65a06f..e97c8e8a 100644 --- a/sdk/RELEASE.md +++ b/sdk/RELEASE.md @@ -1,11 +1,16 @@ # Release notes +## 1.4.3 + +- Add Base and Base Sepolia to supported chains in config + ## 1.4.2 - Improve ESM support by exporting `index.mjs` instead of `index.js`. @baumstern - Added dweb IPFS gateway links and use `Promise.any` call to try and fetch data from multiple gateways. - Expose timeout on HTTP requests from storage layer up to client wrapper methods as optional config. - Default timeout on calls of 0 ms (no timeout) to avoid issues with large files or multiple IPFS calls. +- Updated contracts package to support Base and Base Sepolia ## New contributors diff --git a/sdk/package.json b/sdk/package.json index e9d327d4..3ac4d84b 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@hypercerts-org/sdk", - "version": "1.4.2-alpha.2", + "version": "1.4.3", "description": "SDK for hypercerts protocol", "repository": "git@github.com:hypercerts-org/hypercerts.git", "author": "Hypercerts team", @@ -24,7 +24,7 @@ "@ethereum-attestation-service/eas-sdk": "1.3.7", "@ethersproject/abstract-signer": "^5.7.0", "@graphql-typed-document-node/core": "^3.2.0", - "@hypercerts-org/contracts": "1.1.1-alpha.1", + "@hypercerts-org/contracts": "1.1.2", "@openzeppelin/merkle-tree": "^1.0.5", "@urql/core": "^4.2.0", "@whatwg-node/fetch": "^0.9.13", diff --git a/sdk/src/constants.ts b/sdk/src/constants.ts index dffe3011..b6956c20 100644 --- a/sdk/src/constants.ts +++ b/sdk/src/constants.ts @@ -31,6 +31,16 @@ const DEPLOYMENTS: { [key in SupportedChainIds]: Partial } = { graphName: "hypercerts-sepolia", graphUrl: `${DEFAULT_GRAPH_BASE_URL}/hypercerts-sepolia`, } as const, + 84532: { + addresses: deployments[84532], + graphName: "hypercerts-base-sepolia", + graphUrl: `${DEFAULT_GRAPH_BASE_URL}/hypercerts-base-sepolia`, + } as const, + 8453: { + addresses: deployments[8453], + graphName: "hypercerts-base-mainnet", + graphUrl: `${DEFAULT_GRAPH_BASE_URL}/hypercerts-base-mainnet`, + } as const, }; // Example schema on Sepolia diff --git a/sdk/src/indexer/gql/graphql.ts b/sdk/src/indexer/gql/graphql.ts index 26091837..16905658 100644 --- a/sdk/src/indexer/gql/graphql.ts +++ b/sdk/src/indexer/gql/graphql.ts @@ -103,6 +103,11 @@ export enum AcceptedToken_OrderBy { TokenSymbol = "token__symbol", } +export enum Aggregation_Interval { + Day = "day", + Hour = "hour", +} + export type Allowlist = { __typename?: "Allowlist"; claim: Claim; diff --git a/sdk/src/types/client.ts b/sdk/src/types/client.ts index d0c498a6..fab055bc 100644 --- a/sdk/src/types/client.ts +++ b/sdk/src/types/client.ts @@ -10,9 +10,9 @@ import { HypercertMinterAbi } from "@hypercerts-org/contracts"; /** * Enum to verify the supported chainIds * - * @note 10 = Optimism, 42220 = Celo, 11155111 = Sepolia + * @note 10 = Optimism, 42220 = Celo, 11155111 = Sepolia, 84532 = Base Sepolia, 8453 = Base Mainnet */ -export type SupportedChainIds = 10 | 42220 | 11155111; +export type SupportedChainIds = 10 | 42220 | 11155111 | 84532 | 8453; export type SupportedOverrides = ContractOverrides & StorageConfigOverrides; diff --git a/sdk/src/utils/config.ts b/sdk/src/utils/config.ts index 3f2dec35..7ac30a8e 100644 --- a/sdk/src/utils/config.ts +++ b/sdk/src/utils/config.ts @@ -1,4 +1,4 @@ -import { sepolia, optimism, celo, Chain } from "viem/chains"; +import { sepolia, optimism, celo, Chain, baseSepolia, base } from "viem/chains"; import { DEPLOYMENTS } from "../constants"; import { @@ -25,6 +25,8 @@ import { deployments } from "../../src"; * - 10: Optimism * - 42220: Celo * - 11155111: Sepolia + * - 84532: Base Sepolia + * - 8453: Base Mainnet * * @param {Partial} overrides - An object containing any configuration values to override. This should be a partial HypercertClientConfig object. * @returns {Partial} The final configuration object for the Hypercert client. @@ -181,7 +183,7 @@ const getEasContractAddress = (overrides: Partial) => { }; const getDefaultChain = (chainId: number) => { - const _chains = [sepolia, optimism, celo]; + const _chains = [sepolia, optimism, celo, base, baseSepolia]; for (const chain of Object.values(_chains)) { if ("id" in chain) {