diff --git a/contracts/package.json b/contracts/package.json index 78530c9c..02c1a8d6 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": "0.9.0", + "version": "0.10.0", "author": { "name": "Hypercerts Foundation", "url": "https://github.com/hypercerts-org/hypercerts" diff --git a/contracts/src/index.ts b/contracts/src/index.ts index 3019f4fc..08e9a196 100644 --- a/contracts/src/index.ts +++ b/contracts/src/index.ts @@ -21,7 +21,7 @@ import type { IAllowlist } from "../types/src/protocol/interfaces/IAllowlist"; import type { IHypercertToken } from "../types/src/protocol/interfaces/IHypercertToken"; import type { Errors } from "../types/src/protocol/libs/Errors"; -import deployments from "./deployments.json"; +import deploymentsJSON from "./deployments.json"; /* in order to adjust the build folder: @@ -31,8 +31,24 @@ import deployments from "./deployments.json"; 4) bump package.json version to publish a new package to npm. */ +export type Deployment = { + HypercertMinterUUPS: `0x${string}`; + HypercertMinterImplementation: `0x${string}`; + TransferManager?: `0x${string}`; + HypercertExchange?: `0x${string}`; +}; + +export type DeployedChains = keyof typeof deploymentsJSON; + // Deployments -export { deployments }; +const deployments = deploymentsJSON as Record; + +const asDeployedChain = (chainId: string | number) => { + if (chainId in deployments) return chainId as DeployedChains; + throw new Error(`Chain ${chainId} not deployed`); +}; + +export { deployments, asDeployedChain }; // Interfaces export { IAllowlist, IHypercertToken };