@diamondslab/diamonds 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +32 -6
  3. package/dist/cli/diamond-abi-cli.d.ts +0 -1
  4. package/dist/cli/diamond-abi-cli.js +2 -1
  5. package/dist/core/CallbackManager.d.ts +0 -1
  6. package/dist/core/CallbackManager.js +0 -1
  7. package/dist/core/DeploymentManager.d.ts +0 -1
  8. package/dist/core/DeploymentManager.js +0 -1
  9. package/dist/core/Diamond.d.ts +0 -1
  10. package/dist/core/Diamond.js +0 -1
  11. package/dist/core/DiamondDeployer.d.ts +0 -1
  12. package/dist/core/DiamondDeployer.js +0 -1
  13. package/dist/core/index.d.ts +0 -1
  14. package/dist/core/index.js +0 -1
  15. package/dist/index.d.ts +0 -1
  16. package/dist/index.js +0 -1
  17. package/dist/repositories/DBDeploymentRepository.d.ts +0 -1
  18. package/dist/repositories/DBDeploymentRepository.js +0 -1
  19. package/dist/repositories/DeploymentRepository.d.ts +0 -1
  20. package/dist/repositories/DeploymentRepository.js +0 -1
  21. package/dist/repositories/FileDeploymentRepository.d.ts +0 -1
  22. package/dist/repositories/FileDeploymentRepository.js +0 -1
  23. package/dist/repositories/databaseHandler.d.ts +0 -1
  24. package/dist/repositories/databaseHandler.js +0 -1
  25. package/dist/repositories/index.d.ts +0 -1
  26. package/dist/repositories/index.js +0 -1
  27. package/dist/repositories/jsonFileHandler.d.ts +0 -1
  28. package/dist/repositories/jsonFileHandler.js +0 -1
  29. package/dist/repositories/prismaDBHandler.d.ts +0 -1
  30. package/dist/repositories/prismaDBHandler.js +0 -1
  31. package/dist/resolution/index.d.ts +0 -1
  32. package/dist/resolution/index.js +0 -1
  33. package/dist/resolution/selectorResolution.d.ts +0 -1
  34. package/dist/resolution/selectorResolution.js +0 -1
  35. package/dist/schemas/DeploymentSchema.d.ts +0 -1
  36. package/dist/schemas/DeploymentSchema.js +0 -1
  37. package/dist/schemas/index.d.ts +0 -1
  38. package/dist/schemas/index.js +0 -1
  39. package/dist/strategies/BaseDeploymentStrategy.d.ts +0 -1
  40. package/dist/strategies/BaseDeploymentStrategy.js +0 -1
  41. package/dist/strategies/DeploymentStrategy.d.ts +0 -1
  42. package/dist/strategies/DeploymentStrategy.js +0 -1
  43. package/dist/strategies/LocalDeploymentStrategy.d.ts +0 -1
  44. package/dist/strategies/LocalDeploymentStrategy.js +0 -1
  45. package/dist/strategies/OZDefenderDeploymentStrategy.d.ts +2 -3
  46. package/dist/strategies/OZDefenderDeploymentStrategy.js +12 -3
  47. package/dist/strategies/RPCDeploymentStrategy.d.ts +0 -1
  48. package/dist/strategies/RPCDeploymentStrategy.js +0 -1
  49. package/dist/strategies/index.d.ts +0 -1
  50. package/dist/strategies/index.js +0 -1
  51. package/dist/types/config.d.ts +0 -1
  52. package/dist/types/config.js +0 -1
  53. package/dist/types/defender.d.ts +0 -1
  54. package/dist/types/defender.js +0 -1
  55. package/dist/types/deployments.d.ts +0 -1
  56. package/dist/types/deployments.js +0 -1
  57. package/dist/types/index.d.ts +0 -1
  58. package/dist/types/index.js +0 -1
  59. package/dist/types/rpc.d.ts +0 -1
  60. package/dist/types/rpc.js +0 -1
  61. package/dist/utils/common.d.ts +1 -2
  62. package/dist/utils/common.js +0 -1
  63. package/dist/utils/configurationResolver.d.ts +0 -1
  64. package/dist/utils/configurationResolver.js +0 -1
  65. package/dist/utils/contractMapping.d.ts +0 -1
  66. package/dist/utils/contractMapping.js +0 -1
  67. package/dist/utils/defenderClients.d.ts +2 -5
  68. package/dist/utils/defenderClients.js +36 -16
  69. package/dist/utils/defenderStore.d.ts +0 -1
  70. package/dist/utils/defenderStore.js +0 -1
  71. package/dist/utils/diamondAbiGenerator.d.ts +0 -1
  72. package/dist/utils/diamondAbiGenerator.js +0 -1
  73. package/dist/utils/diffDeployedFacets.d.ts +0 -1
  74. package/dist/utils/diffDeployedFacets.js +0 -1
  75. package/dist/utils/index.d.ts +0 -1
  76. package/dist/utils/index.js +0 -1
  77. package/dist/utils/loupe.d.ts +0 -1
  78. package/dist/utils/loupe.js +0 -1
  79. package/dist/utils/rpcStore.d.ts +0 -1
  80. package/dist/utils/rpcStore.js +0 -1
  81. package/dist/utils/signer.d.ts +0 -1
  82. package/dist/utils/signer.js +0 -1
  83. package/dist/utils/txlogging.d.ts +0 -1
  84. package/dist/utils/txlogging.js +0 -1
  85. package/dist/utils/workspaceSetup.d.ts +0 -1
  86. package/dist/utils/workspaceSetup.js +0 -1
  87. package/package.json +29 -18
  88. package/diamonds/README.md +0 -3
  89. package/dist/cli/diamond-abi-cli.d.ts.map +0 -1
  90. package/dist/cli/diamond-abi-cli.js.map +0 -1
  91. package/dist/core/CallbackManager.d.ts.map +0 -1
  92. package/dist/core/CallbackManager.js.map +0 -1
  93. package/dist/core/DeploymentManager.d.ts.map +0 -1
  94. package/dist/core/DeploymentManager.js.map +0 -1
  95. package/dist/core/Diamond.d.ts.map +0 -1
  96. package/dist/core/Diamond.js.map +0 -1
  97. package/dist/core/DiamondDeployer.d.ts.map +0 -1
  98. package/dist/core/DiamondDeployer.js.map +0 -1
  99. package/dist/core/index.d.ts.map +0 -1
  100. package/dist/core/index.js.map +0 -1
  101. package/dist/index.d.ts.map +0 -1
  102. package/dist/index.js.map +0 -1
  103. package/dist/repositories/DBDeploymentRepository.d.ts.map +0 -1
  104. package/dist/repositories/DBDeploymentRepository.js.map +0 -1
  105. package/dist/repositories/DeploymentRepository.d.ts.map +0 -1
  106. package/dist/repositories/DeploymentRepository.js.map +0 -1
  107. package/dist/repositories/FileDeploymentRepository.d.ts.map +0 -1
  108. package/dist/repositories/FileDeploymentRepository.js.map +0 -1
  109. package/dist/repositories/databaseHandler.d.ts.map +0 -1
  110. package/dist/repositories/databaseHandler.js.map +0 -1
  111. package/dist/repositories/index.d.ts.map +0 -1
  112. package/dist/repositories/index.js.map +0 -1
  113. package/dist/repositories/jsonFileHandler.d.ts.map +0 -1
  114. package/dist/repositories/jsonFileHandler.js.map +0 -1
  115. package/dist/repositories/prismaDBHandler.d.ts.map +0 -1
  116. package/dist/repositories/prismaDBHandler.js.map +0 -1
  117. package/dist/resolution/index.d.ts.map +0 -1
  118. package/dist/resolution/index.js.map +0 -1
  119. package/dist/resolution/selectorResolution.d.ts.map +0 -1
  120. package/dist/resolution/selectorResolution.js.map +0 -1
  121. package/dist/schemas/DeploymentSchema.d.ts.map +0 -1
  122. package/dist/schemas/DeploymentSchema.js.map +0 -1
  123. package/dist/schemas/index.d.ts.map +0 -1
  124. package/dist/schemas/index.js.map +0 -1
  125. package/dist/strategies/BaseDeploymentStrategy.d.ts.map +0 -1
  126. package/dist/strategies/BaseDeploymentStrategy.js.map +0 -1
  127. package/dist/strategies/DeploymentStrategy.d.ts.map +0 -1
  128. package/dist/strategies/DeploymentStrategy.js.map +0 -1
  129. package/dist/strategies/LocalDeploymentStrategy.d.ts.map +0 -1
  130. package/dist/strategies/LocalDeploymentStrategy.js.map +0 -1
  131. package/dist/strategies/OZDefenderDeploymentStrategy.d.ts.map +0 -1
  132. package/dist/strategies/OZDefenderDeploymentStrategy.js.map +0 -1
  133. package/dist/strategies/RPCDeploymentStrategy.d.ts.map +0 -1
  134. package/dist/strategies/RPCDeploymentStrategy.js.map +0 -1
  135. package/dist/strategies/index.d.ts.map +0 -1
  136. package/dist/strategies/index.js.map +0 -1
  137. package/dist/types/config.d.ts.map +0 -1
  138. package/dist/types/config.js.map +0 -1
  139. package/dist/types/defender.d.ts.map +0 -1
  140. package/dist/types/defender.js.map +0 -1
  141. package/dist/types/deployments.d.ts.map +0 -1
  142. package/dist/types/deployments.js.map +0 -1
  143. package/dist/types/index.d.ts.map +0 -1
  144. package/dist/types/index.js.map +0 -1
  145. package/dist/types/rpc.d.ts.map +0 -1
  146. package/dist/types/rpc.js.map +0 -1
  147. package/dist/utils/common.d.ts.map +0 -1
  148. package/dist/utils/common.js.map +0 -1
  149. package/dist/utils/configurationResolver.d.ts.map +0 -1
  150. package/dist/utils/configurationResolver.js.map +0 -1
  151. package/dist/utils/contractMapping.d.ts.map +0 -1
  152. package/dist/utils/contractMapping.js.map +0 -1
  153. package/dist/utils/defenderClients.d.ts.map +0 -1
  154. package/dist/utils/defenderClients.js.map +0 -1
  155. package/dist/utils/defenderStore.d.ts.map +0 -1
  156. package/dist/utils/defenderStore.js.map +0 -1
  157. package/dist/utils/diamondAbiGenerator.d.ts.map +0 -1
  158. package/dist/utils/diamondAbiGenerator.js.map +0 -1
  159. package/dist/utils/diffDeployedFacets.d.ts.map +0 -1
  160. package/dist/utils/diffDeployedFacets.js.map +0 -1
  161. package/dist/utils/index.d.ts.map +0 -1
  162. package/dist/utils/index.js.map +0 -1
  163. package/dist/utils/loupe.d.ts.map +0 -1
  164. package/dist/utils/loupe.js.map +0 -1
  165. package/dist/utils/rpcStore.d.ts.map +0 -1
  166. package/dist/utils/rpcStore.js.map +0 -1
  167. package/dist/utils/signer.d.ts.map +0 -1
  168. package/dist/utils/signer.js.map +0 -1
  169. package/dist/utils/txlogging.d.ts.map +0 -1
  170. package/dist/utils/txlogging.js.map +0 -1
  171. package/dist/utils/workspaceSetup.d.ts.map +0 -1
  172. package/dist/utils/workspaceSetup.js.map +0 -1
  173. package/examples/defender-deployment/README.md +0 -415
  174. package/test/README.md +0 -136
@@ -1,21 +1,41 @@
1
1
  "use strict";
2
+ // src/utils/defenderClients.ts
3
+ //
4
+ // Client singletons for the (deprecated) OpenZeppelin Defender deployment path.
5
+ // This module is re-exported by the package barrel (utils/index), so importing ANY
6
+ // part of @diamondslab/diamonds loads it. It must therefore never crash a consumer
7
+ // that doesn't use Defender:
8
+ // - the .env load is guarded (a consumer need not have a .env file), and
9
+ // - the @openzeppelin/defender-sdk packages are lazily required only when Defender
10
+ // credentials are actually present (they are optional/dev-only, not a hard
11
+ // runtime dependency of this package).
12
+ // Without credentials the clients are null, exactly as before.
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.deployClient = exports.adminClient = void 0;
4
- // src/utils/defenderClients.ts
5
- const defender_sdk_1 = require("@openzeppelin/defender-sdk");
6
- const defender_sdk_deploy_client_1 = require("@openzeppelin/defender-sdk-deploy-client");
7
- // Load environment variables from .env file
8
- process.loadEnvFile('.env');
15
+ // Optional: load environment variables from a local .env if one exists. Never throw.
16
+ try {
17
+ process.loadEnvFile('.env');
18
+ }
19
+ catch {
20
+ /* .env is optional — absent in library consumers and CI */
21
+ }
9
22
  const { DEFENDER_API_KEY, DEFENDER_API_SECRET } = process.env;
10
- if (!DEFENDER_API_KEY || !DEFENDER_API_SECRET) {
11
- console.warn("Warning: Missing Defender credentials in environment. Some functionality will be limited.");
23
+ function createDefenderClients() {
24
+ if (!DEFENDER_API_KEY || !DEFENDER_API_SECRET) {
25
+ console.warn('Warning: Missing Defender credentials in environment. Some functionality will be limited.');
26
+ return { adminClient: null, deployClient: null };
27
+ }
28
+ // Lazily require the deprecated Defender SDK so it is not a hard dependency for
29
+ // consumers that never use the OZDefender strategy.
30
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
31
+ const { Defender } = require('@openzeppelin/defender-sdk');
32
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
33
+ const { DeployClient } = require('@openzeppelin/defender-sdk-deploy-client');
34
+ return {
35
+ adminClient: new Defender({ apiKey: DEFENDER_API_KEY, apiSecret: DEFENDER_API_SECRET }),
36
+ deployClient: new DeployClient({ apiKey: DEFENDER_API_KEY, apiSecret: DEFENDER_API_SECRET }),
37
+ };
12
38
  }
13
- exports.adminClient = DEFENDER_API_KEY && DEFENDER_API_SECRET ? new defender_sdk_1.Defender({
14
- apiKey: DEFENDER_API_KEY,
15
- apiSecret: DEFENDER_API_SECRET,
16
- }) : null;
17
- exports.deployClient = DEFENDER_API_KEY && DEFENDER_API_SECRET ? new defender_sdk_deploy_client_1.DeployClient({
18
- apiKey: DEFENDER_API_KEY,
19
- apiSecret: DEFENDER_API_SECRET,
20
- }) : null;
21
- //# sourceMappingURL=defenderClients.js.map
39
+ const { adminClient, deployClient } = createDefenderClients();
40
+ exports.adminClient = adminClient;
41
+ exports.deployClient = deployClient;
@@ -11,4 +11,3 @@ export declare class DefenderDeploymentStore {
11
11
  updateStatus(stepName: string, status: DefenderProposalStatus): void;
12
12
  list(): DefenderStepRecord[];
13
13
  }
14
- //# sourceMappingURL=defenderStore.d.ts.map
@@ -89,4 +89,3 @@ class DefenderDeploymentStore {
89
89
  }
90
90
  }
91
91
  exports.DefenderDeploymentStore = DefenderDeploymentStore;
92
- //# sourceMappingURL=defenderStore.js.map
@@ -110,4 +110,3 @@ export declare function generateDiamondAbi(diamond: Diamond, options?: Partial<D
110
110
  */
111
111
  export declare function previewDiamondAbi(diamond: Diamond, plannedCuts: FacetCuts, options?: Partial<DiamondAbiGenerationOptions>): Promise<DiamondAbiGenerationResult>;
112
112
  export {};
113
- //# sourceMappingURL=diamondAbiGenerator.d.ts.map
@@ -412,4 +412,3 @@ async function previewDiamondAbi(diamond, plannedCuts, options = {}) {
412
412
  ...options
413
413
  });
414
414
  }
415
- //# sourceMappingURL=diamondAbiGenerator.js.map
@@ -23,4 +23,3 @@ export declare function compareFacetSelectors(deployedFacetData: Record<string,
23
23
  missingOnChain: string[];
24
24
  matched: string[];
25
25
  }>;
26
- //# sourceMappingURL=diffDeployedFacets.d.ts.map
@@ -103,4 +103,3 @@ function compareFacetSelectors(deployedFacetData, onChainFacets) {
103
103
  }
104
104
  return result;
105
105
  }
106
- //# sourceMappingURL=diffDeployedFacets.js.map
@@ -13,4 +13,3 @@ export * from './configurationResolver';
13
13
  export * from './workspaceSetup';
14
14
  export * from './diamondAbiGenerator';
15
15
  export * from './rpcStore';
16
- //# sourceMappingURL=index.d.ts.map
@@ -32,4 +32,3 @@ __exportStar(require("./configurationResolver"), exports);
32
32
  __exportStar(require("./workspaceSetup"), exports);
33
33
  __exportStar(require("./diamondAbiGenerator"), exports);
34
34
  __exportStar(require("./rpcStore"), exports);
35
- //# sourceMappingURL=index.js.map
@@ -41,4 +41,3 @@ export declare function logDiamondLoupe(tx: ContractTransactionResponse, diamond
41
41
  * (see DiamondLoupeFacet.sol)
42
42
  */
43
43
  export declare function getDeployedFacets(diamondAddress: string, signerOrProvider?: Signer | Provider, receiptToDecode?: TransactionReceipt, logDeployedFacets?: boolean): Promise<FacetStruct[]>;
44
- //# sourceMappingURL=loupe.d.ts.map
@@ -125,4 +125,3 @@ async function getDeployedFacets(diamondAddress, signerOrProvider = hardhat_1.de
125
125
  }
126
126
  return facets;
127
127
  }
128
- //# sourceMappingURL=loupe.js.map
@@ -33,4 +33,3 @@ export declare class RPCDeploymentStore {
33
33
  hasFailed: boolean;
34
34
  };
35
35
  }
36
- //# sourceMappingURL=rpcStore.d.ts.map
@@ -163,4 +163,3 @@ class RPCDeploymentStore {
163
163
  }
164
164
  }
165
165
  exports.RPCDeploymentStore = RPCDeploymentStore;
166
- //# sourceMappingURL=rpcStore.js.map
@@ -33,4 +33,3 @@ export declare function impersonateAndFundSigner(deployerAddress: string, provid
33
33
  * @returns The address of the old owner.
34
34
  */
35
35
  export declare const updateOwnerForTest: (rootAddress: string, provider: JsonRpcProvider) => Promise<any>;
36
- //# sourceMappingURL=signer.d.ts.map
@@ -97,4 +97,3 @@ const updateOwnerForTest = async (rootAddress, provider) => {
97
97
  return oldOwnerAddress;
98
98
  };
99
99
  exports.updateOwnerForTest = updateOwnerForTest;
100
- //# sourceMappingURL=signer.js.map
@@ -10,4 +10,3 @@ import { ContractTransactionResponse, Interface, InterfaceAbi, TransactionReceip
10
10
  * additional ABIs (e.g. library or facet events) can follow.
11
11
  */
12
12
  export declare function logTx(tx: ContractTransactionResponse, description?: string, interfaces?: (Interface | InterfaceAbi)[]): Promise<TransactionReceipt>;
13
- //# sourceMappingURL=txlogging.d.ts.map
@@ -84,4 +84,3 @@ async function logTx(tx, description = "", interfaces = []) {
84
84
  });
85
85
  return receipt;
86
86
  }
87
- //# sourceMappingURL=txlogging.js.map
@@ -29,4 +29,3 @@ export declare class WorkspaceSetup {
29
29
  */
30
30
  private static createHardhatConfigExample;
31
31
  }
32
- //# sourceMappingURL=workspaceSetup.d.ts.map
@@ -308,4 +308,3 @@ export default config;
308
308
  }
309
309
  }
310
310
  exports.WorkspaceSetup = WorkspaceSetup;
311
- //# sourceMappingURL=workspaceSetup.js.map
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@diamondslab/diamonds",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Tools for deploying and interfacing with ERC-2535 Diamond Proxies",
5
- "repository": "github:diamondslab/diamonds",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/DiamondsLab/diamonds.git"
8
+ },
6
9
  "main": "dist/index.js",
7
10
  "types": "dist/index.d.ts",
8
11
  "module": "dist/index.js",
@@ -18,12 +21,13 @@
18
21
  "./core": {
19
22
  "types": "./dist/core/index.d.ts",
20
23
  "default": "./dist/core/index.js"
21
- }
24
+ },
25
+ "./dist/*": {
26
+ "types": "./dist/*.d.ts",
27
+ "default": "./dist/*.js"
28
+ },
29
+ "./package.json": "./package.json"
22
30
  },
23
- "authors": [
24
- "Am0rfu5",
25
- "SuperGenius"
26
- ],
27
31
  "license": "MIT",
28
32
  "keywords": [
29
33
  "ethereum",
@@ -50,8 +54,8 @@
50
54
  "clean": "rimraf artifacts/* cache/* diamond-abi/* typechain-types/* diamond-typechain-types/*",
51
55
  "compile": "npx hardhat compile --config hardhat.config.ts && yarn diamond:generate-abi-typechain",
52
56
  "clean-compile": "yarn clean && yarn compile",
53
- "lint:fix": "prettier --write 'src/**/*.{js,ts}' 'test/**/*.{js,ts}' && tslint --fix --config tslint.json --project tsconfig.dev.json",
54
- "lint": "tslint --config tslint.json --project tsconfig.dev.json",
57
+ "lint:fix": "prettier --write src && eslint src --fix",
58
+ "lint": "eslint src",
55
59
  "build:dev": "tsc --project tsconfig.dev.json --noEmit",
56
60
  "watch": "tsc --project tsconfig.json -w",
57
61
  "prepublishOnly": "yarn build",
@@ -96,7 +100,7 @@
96
100
  "ci-perf-monitor": "node scripts/devops/ci-perf-monitor.js",
97
101
  "sign-artifacts": "npx ts-node scripts/devops/sign-artifacts.ts",
98
102
  "emergency-bypass": "npx ts-node scripts/devops/emergency-bypass.ts",
99
- "security-check": "yarn audit && yarn snyk:test && yarn socket:scan && yarn osv:scan && yarn semgrep:scan && yarn slither:scan && yarn git-secrets:scan",
103
+ "security-check": "yarn audit && yarn snyk:test && yarn socket:scan && yarn osv:scan && yarn semgrep:scan && yarn git-secrets:scan",
100
104
  "security-tool-update": "npx ts-node scripts/devops/security-tool-updater.ts",
101
105
  "provenance-check": "npx ts-node scripts/devops/provenance-validator.ts",
102
106
  "slsa-attest": "npx ts-node scripts/devops/slsa-attestation.ts generate",
@@ -134,13 +138,14 @@
134
138
  },
135
139
  "files": [
136
140
  "dist/",
137
- "LICENSE",
138
- "README.md"
141
+ "/LICENSE",
142
+ "/README.md",
143
+ "/CHANGELOG.md"
139
144
  ],
140
145
  "devDependencies": {
141
146
  "@commitlint/cli": "^19.8.1",
142
147
  "@commitlint/config-conventional": "^19.8.1",
143
- "@diamondslab/hardhat-diamonds": "^1.0.0",
148
+ "@diamondslab/hardhat-diamonds": "^1.2.0",
144
149
  "@ethersproject/abi": "^5.8.0",
145
150
  "@ethersproject/bytes": "^5.8.0",
146
151
  "@ethersproject/providers": "^5.8.0",
@@ -214,8 +219,7 @@
214
219
  "web3": "^4.16.0",
215
220
  "web3-core": "^4.7.1",
216
221
  "web3-utils": "^4.3.3",
217
- "winston": "^3.17.0",
218
- "zod": "^4.0.2"
222
+ "winston": "^3.17.0"
219
223
  },
220
224
  "peerDependencies": {
221
225
  "ethers": "^6.0.0",
@@ -226,9 +230,16 @@
226
230
  "packageManager": "yarn@4.10.3",
227
231
  "dependencies": {
228
232
  "@ethersproject/abstract-signer": "^5.8.0",
229
- "axios": "^1.12.0",
230
233
  "debug": "^4.4.1",
231
234
  "fs-extra": "^11.3.0",
232
- "lodash": "^4.17.21"
235
+ "zod": "^4.0.2"
236
+ },
237
+ "author": "Am0rfu5",
238
+ "contributors": [
239
+ "SuperGenius"
240
+ ],
241
+ "engines": {
242
+ "node": ">=18.0.0",
243
+ "yarn": ">=4.0.0"
233
244
  }
234
- }
245
+ }
@@ -1,3 +0,0 @@
1
- # diamonds directory
2
-
3
- >> THIS DIRECTORY IS USED FOR TEST CONFIGURATION AND DEPLOYMENTS
@@ -1 +0,0 @@
1
- {"version":3,"file":"diamond-abi-cli.d.ts","sourceRoot":"","sources":["../../src/cli/diamond-abi-cli.ts"],"names":[],"mappings":";AAqeA,OAAO,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"diamond-abi-cli.js","sourceRoot":"","sources":["../../src/cli/diamond-abi-cli.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AACpC,kDAA0B;AAO1B,2BAAgC;AAChC,6EAA6E;AAC7E,6EAA6E;AAC7E,8EAA8E;AAC9E,yEAAyE;AACzE,+EAA+E;AAE/E,kFAAkF;AAClF,6EAA6E;AAC7E,yFAAyF;AAEzF,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,2EAA2E;AAC3E,iFAAiF;AACjF,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE9D,OAAO;KACL,IAAI,CAAC,aAAa,CAAC;KACnB,WAAW,CAAC,kCAAkC,CAAC;KAC/C,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtB,mBAAmB;AACnB,OAAO;KACL,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,qCAAqC,CAAC;KAClD,MAAM,CAAC,sBAAsB,EAAE,cAAc,EAAE,eAAe,CAAC;KAC/D,MAAM,CAAC,sBAAsB,EAAE,cAAc,EAAE,WAAW,CAAC;KAC3D,MAAM,CAAC,qBAAqB,EAAE,UAAU,EAAE,OAAO,CAAC;KAClD,MAAM,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G,EAAE,OAAO,CAAC,CAAC,CAAC;QACpE,CAAC;IACF,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC,CAAC;IAC3D,CAAC;AACF,CAAC;AAED,SAAS,UAAU,CAAC,QAAa;IAChC,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,IAAI,EAAE,CAAC;IAC/B,OAAO;QACN,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,MAAM;QACrE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,MAAM;QAC/D,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,MAAM;KAC/D,CAAC;AACH,CAAC;AAED,+BAA+B;AAC/B,OAAO,CAAC,KAAK,EAAE,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport { Command } from 'commander';\nimport chalk from 'chalk';\n// The diamond/ABI-generator modules transitively import `hardhat` at module\n// scope, so they (and `hardhat` itself) are imported lazily inside the\n// `generate`/`preview` actions. This keeps `validate` and `compare` — which only\n// read ABI JSON files — runnable as a plain `node`/`npx` bin with no Hardhat.\nimport type { Diamond } from '../core/Diamond';\nimport type { DiamondConfig } from '../types';\nimport { existsSync } from 'fs';\n// NOTE: `hardhat` (and, via its config, the hardhat-ethers plugin) is loaded\n// lazily inside `setupDiamondConnection` so commands that don't need a chain\n// connection (`validate`, `compare`) run without booting the Hardhat runtime.\n// Importing `@nomicfoundation/hardhat-ethers` at module scope would call\n// `extendEnvironment` before a Hardhat context exists (HH5), so it is avoided.\n\n// This CLI formats and inspects arbitrary ABI/JSON artifacts and indexes internal\n// selector maps, so `any` and dynamic property access are intentional below.\n/* eslint-disable @typescript-eslint/no-explicit-any, security/detect-object-injection */\n\nconst program = new Command();\n\n// Keep the CLI version in sync with the package version. The relative path\n// resolves to the package root from both src/cli (dev) and dist/cli (published).\nconst { version: pkgVersion } = require('../../package.json');\n\nprogram\n\t.name('diamond-abi')\n\t.description('Diamond ABI generation utilities')\n\t.version(pkgVersion);\n\n// Generate command\nprogram\n\t.command('generate')\n\t.description('Generate ABI for a deployed diamond')\n\t.option('-d, --diamond <name>', 'Diamond name', 'GeniusDiamond')\n\t.option('-n, --network <name>', 'Network name', 'localhost')\n\t.option('-c, --chain-id <id>', 'Chain ID', '31337')\n\t.option('-o, --output <dir>', 'Output directory (overrides diamond config)', undefined)\n\t.option('--deployments-path <path>', 'Deployments path', './diamonds')\n\t.option('--contracts-path <path>', 'Contracts path', './contracts')\n\t.option('--include-source', 'Include source information in ABI', false)\n\t.option('--validate-selectors', 'Validate function selector uniqueness', true)\n\t.option('-v, --verbose', 'Verbose output', false)\n\t.action(async (options) => {\n\t\ttry {\n\t\t\tconsole.log(chalk.blue('🔧 Generating Diamond ABI...'));\n\n\t\t\tconst { generateDiamondAbi } = await import('../utils/diamondAbiGenerator.js');\n\t\t\tconst { Diamond } = await import('../core/Diamond.js');\n\t\t\tconst { FileDeploymentRepository } = await import(\n\t\t\t\t'../repositories/FileDeploymentRepository.js'\n\t\t\t);\n\n\t\t\tconst config: DiamondConfig = {\n\t\t\t\tdiamondName: options.diamond,\n\t\t\t\tnetworkName: options.network,\n\t\t\t\tchainId: parseInt(options.chainId),\n\t\t\t\tdeploymentsPath: options.deploymentsPath,\n\t\t\t\tcontractsPath: options.contractsPath,\n\t\t\t};\n\n\t\t\tif (options.verbose) {\n\t\t\t\tconsole.log(chalk.cyan('📋 Configuration:'));\n\t\t\t\tconsole.log(chalk.gray(` Diamond: ${config.diamondName}`));\n\t\t\t\tconsole.log(chalk.gray(` Network: ${config.networkName}`));\n\t\t\t\tconsole.log(chalk.gray(` Chain ID: ${config.chainId}`));\n\t\t\t\tconsole.log(chalk.gray(` Output: ${options.output}`));\n\t\t\t}\n\n\t\t\t// Create diamond instance\n\t\t\tconst repository = new FileDeploymentRepository(config);\n\t\t\tconst diamond: Diamond = new Diamond(config, repository);\n\n\t\t\t// Set provider and signer if available\n\t\t\tawait setupDiamondConnection(diamond, options.verbose);\n\n\t\t\t// Generate ABI using Diamond's configured paths\n\t\t\tconst result = await generateDiamondAbi(diamond, {\n\t\t\t\toutputDir: options.output ?? diamond.getDiamondAbiPath(),\n\t\t\t\tincludeSourceInfo: options.includeSource,\n\t\t\t\tvalidateSelectors: options.validateSelectors,\n\t\t\t\tverbose: options.verbose,\n\t\t\t});\n\n\t\t\tconsole.log(chalk.green('\\n✅ Diamond ABI generation completed!'));\n\t\t\tdisplayResults(result, options.verbose);\n\t\t} catch (error) {\n\t\t\tconsole.error(chalk.red('❌ Error generating Diamond ABI:'), error);\n\t\t\tprocess.exit(1);\n\t\t}\n\t});\n\n// Preview command\nprogram\n\t.command('preview')\n\t.description('Preview ABI changes for planned diamond cuts')\n\t.option('-d, --diamond <name>', 'Diamond name', 'GeniusDiamond')\n\t.option('-n, --network <name>', 'Network name', 'localhost')\n\t.option('-c, --chain-id <id>', 'Chain ID', '31337')\n\t.option('--deployments-path <path>', 'Deployments path', './diamonds')\n\t.option('--contracts-path <path>', 'Contracts path', './contracts')\n\t.option('-v, --verbose', 'Verbose output', false)\n\t.action(async (options) => {\n\t\ttry {\n\t\t\tconsole.log(chalk.blue('🔍 Previewing Diamond ABI changes...'));\n\n\t\t\tconst { generateDiamondAbi, previewDiamondAbi } = await import(\n\t\t\t\t'../utils/diamondAbiGenerator.js'\n\t\t\t);\n\t\t\tconst { Diamond } = await import('../core/Diamond.js');\n\t\t\tconst { FileDeploymentRepository } = await import(\n\t\t\t\t'../repositories/FileDeploymentRepository.js'\n\t\t\t);\n\n\t\t\tconst config: DiamondConfig = {\n\t\t\t\tdiamondName: options.diamond,\n\t\t\t\tnetworkName: options.network,\n\t\t\t\tchainId: parseInt(options.chainId),\n\t\t\t\tdeploymentsPath: options.deploymentsPath,\n\t\t\t\tcontractsPath: options.contractsPath,\n\t\t\t};\n\n\t\t\tconst repository = new FileDeploymentRepository(config);\n\t\t\tconst diamond: Diamond = new Diamond(config, repository);\n\n\t\t\tawait setupDiamondConnection(diamond, options.verbose);\n\n\t\t\t// Get current state\n\t\t\tconst currentResult = await generateDiamondAbi(diamond, {\n\t\t\t\tverbose: false,\n\t\t\t\tincludeSourceInfo: false,\n\t\t\t});\n\n\t\t\tconsole.log(chalk.cyan('\\n📋 Current ABI state:'));\n\t\t\tconsole.log(chalk.gray(` Functions: ${currentResult.stats.totalFunctions}`));\n\t\t\tconsole.log(chalk.gray(` Events: ${currentResult.stats.totalEvents}`));\n\t\t\tconsole.log(chalk.gray(` Facets: ${currentResult.stats.facetCount}`));\n\n\t\t\t// Check for planned cuts\n\t\t\tconst registry = diamond.functionSelectorRegistry;\n\t\t\tconst plannedCuts = Array.from(registry.entries())\n\t\t\t\t.filter(([_, entry]) => entry.action !== 0) // Not deployed\n\t\t\t\t.map(([selector, entry]) => ({\n\t\t\t\t\tfacetAddress: entry.address,\n\t\t\t\t\taction: entry.action,\n\t\t\t\t\tfunctionSelectors: [selector],\n\t\t\t\t\tname: entry.facetName,\n\t\t\t\t}));\n\n\t\t\tif (plannedCuts.length === 0) {\n\t\t\t\tconsole.log(\n\t\t\t\t\tchalk.yellow('\\n⚠️ No planned cuts found in function selector registry'),\n\t\t\t\t);\n\t\t\t\tconsole.log(\n\t\t\t\t\tchalk.gray(' Use the diamond deployment system to plan upgrades first.'),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconsole.log(chalk.cyan(`\\n🔄 Found ${plannedCuts.length} planned cuts:`));\n\t\t\tfor (const cut of plannedCuts) {\n\t\t\t\tconst actionName =\n\t\t\t\t\tcut.action === 1 ? 'Add' : cut.action === 2 ? 'Remove' : 'Replace';\n\t\t\t\tconsole.log(\n\t\t\t\t\tchalk.gray(\n\t\t\t\t\t\t` ${actionName}: ${cut.name} (${cut.functionSelectors.length} selectors)`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Preview with planned cuts\n\t\t\tconst previewResult = await previewDiamondAbi(diamond, plannedCuts, {\n\t\t\t\tverbose: options.verbose,\n\t\t\t\tincludeSourceInfo: false,\n\t\t\t});\n\n\t\t\tconsole.log(chalk.green('\\n✅ ABI preview completed!'));\n\t\t\tconsole.log(chalk.blue('\\n📊 Preview Results:'));\n\t\t\tconsole.log(\n\t\t\t\tchalk.cyan(` Functions after cuts: ${previewResult.stats.totalFunctions}`),\n\t\t\t);\n\t\t\tconsole.log(chalk.cyan(` Events after cuts: ${previewResult.stats.totalEvents}`));\n\t\t\tconsole.log(chalk.cyan(` Facets after cuts: ${previewResult.stats.facetCount}`));\n\n\t\t\t// Show differences\n\t\t\tconst functionDiff =\n\t\t\t\tpreviewResult.stats.totalFunctions - currentResult.stats.totalFunctions;\n\t\t\tconst facetDiff = previewResult.stats.facetCount - currentResult.stats.facetCount;\n\n\t\t\tif (functionDiff !== 0) {\n\t\t\t\tconst color = functionDiff > 0 ? chalk.green : chalk.red;\n\t\t\t\tconsole.log(\n\t\t\t\t\tcolor(` Function change: ${functionDiff > 0 ? '+' : ''}${functionDiff}`),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (facetDiff !== 0) {\n\t\t\t\tconst color = facetDiff > 0 ? chalk.green : chalk.red;\n\t\t\t\tconsole.log(color(` Facet change: ${facetDiff > 0 ? '+' : ''}${facetDiff}`));\n\t\t\t}\n\n\t\t\tif (options.verbose) {\n\t\t\t\tconsole.log(chalk.blue('\\n🎯 Planned Function Changes:'));\n\t\t\t\tdisplaySelectorChanges(currentResult.selectorMap, previewResult.selectorMap);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(chalk.red('❌ Error previewing Diamond ABI:'), error);\n\t\t\tprocess.exit(1);\n\t\t}\n\t});\n\n// Compare command\nprogram\n\t.command('compare')\n\t.description('Compare two diamond ABI files')\n\t.argument('<file1>', 'First ABI file path')\n\t.argument('<file2>', 'Second ABI file path')\n\t.option('-v, --verbose', 'Verbose output', false)\n\t.action(async (file1, file2, options) => {\n\t\ttry {\n\t\t\tconsole.log(chalk.blue('🔍 Comparing Diamond ABI files...'));\n\n\t\t\tif (!existsSync(file1)) {\n\t\t\t\tthrow new Error(`File not found: ${file1}`);\n\t\t\t}\n\t\t\tif (!existsSync(file2)) {\n\t\t\t\tthrow new Error(`File not found: ${file2}`);\n\t\t\t}\n\n\t\t\tconst abi1 = JSON.parse(require('fs').readFileSync(file1, 'utf8'));\n\t\t\tconst abi2 = JSON.parse(require('fs').readFileSync(file2, 'utf8'));\n\n\t\t\tconsole.log(chalk.cyan(`\\n📋 Comparing:`));\n\t\t\tconsole.log(chalk.gray(` File 1: ${file1}`));\n\t\t\tconsole.log(chalk.gray(` File 2: ${file2}`));\n\n\t\t\tconst result1 = analyzeAbi(abi1);\n\t\t\tconst result2 = analyzeAbi(abi2);\n\n\t\t\tconsole.log(chalk.blue('\\n📊 Comparison Results:'));\n\n\t\t\t// Function comparison\n\t\t\tconst funcDiff = result2.functions - result1.functions;\n\t\t\tconsole.log(\n\t\t\t\tchalk.cyan(`Functions: ${result1.functions} → ${result2.functions} `),\n\t\t\t\tfuncDiff === 0\n\t\t\t\t\t? chalk.gray('(no change)')\n\t\t\t\t\t: funcDiff > 0\n\t\t\t\t\t\t? chalk.green(`(+${funcDiff})`)\n\t\t\t\t\t\t: chalk.red(`(${funcDiff})`),\n\t\t\t);\n\n\t\t\t// Event comparison\n\t\t\tconst eventDiff = result2.events - result1.events;\n\t\t\tconsole.log(\n\t\t\t\tchalk.cyan(`Events: ${result1.events} → ${result2.events} `),\n\t\t\t\teventDiff === 0\n\t\t\t\t\t? chalk.gray('(no change)')\n\t\t\t\t\t: eventDiff > 0\n\t\t\t\t\t\t? chalk.green(`(+${eventDiff})`)\n\t\t\t\t\t\t: chalk.red(`(${eventDiff})`),\n\t\t\t);\n\n\t\t\t// Error comparison\n\t\t\tconst errorDiff = result2.errors - result1.errors;\n\t\t\tconsole.log(\n\t\t\t\tchalk.cyan(`Errors: ${result1.errors} → ${result2.errors} `),\n\t\t\t\terrorDiff === 0\n\t\t\t\t\t? chalk.gray('(no change)')\n\t\t\t\t\t: errorDiff > 0\n\t\t\t\t\t\t? chalk.green(`(+${errorDiff})`)\n\t\t\t\t\t\t: chalk.red(`(${errorDiff})`),\n\t\t\t);\n\n\t\t\tif (options.verbose && abi1._diamondMetadata && abi2._diamondMetadata) {\n\t\t\t\tconsole.log(chalk.blue('\\n🔍 Detailed Selector Comparison:'));\n\t\t\t\tdisplaySelectorChanges(\n\t\t\t\t\tabi1._diamondMetadata.selectorMap ?? {},\n\t\t\t\t\tabi2._diamondMetadata.selectorMap ?? {},\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(chalk.red('❌ Error comparing ABI files:'), error);\n\t\t\tprocess.exit(1);\n\t\t}\n\t});\n\n// Validate command\nprogram\n\t.command('validate')\n\t.description('Validate a diamond ABI file')\n\t.argument('<file>', 'ABI file path')\n\t.option('-v, --verbose', 'Verbose output', false)\n\t.action(async (file, options) => {\n\t\ttry {\n\t\t\tconsole.log(chalk.blue('🔍 Validating Diamond ABI...'));\n\n\t\t\tif (!existsSync(file)) {\n\t\t\t\tthrow new Error(`File not found: ${file}`);\n\t\t\t}\n\n\t\t\tconst artifact = JSON.parse(require('fs').readFileSync(file, 'utf8'));\n\n\t\t\t// Basic structure validation\n\t\t\tconst hasRequiredFields = artifact.abi && artifact.contractName;\n\t\t\tif (!hasRequiredFields) {\n\t\t\t\tthrow new Error('Invalid artifact: missing required fields (abi, contractName)');\n\t\t\t}\n\n\t\t\t// ABI validation with ethers\n\t\t\tconst { Interface } = await import('ethers');\n\t\t\tlet ethersInterface: InstanceType<typeof Interface>;\n\t\t\ttry {\n\t\t\t\tethersInterface = new Interface(artifact.abi);\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(`Invalid ABI: ${error}`);\n\t\t\t}\n\n\t\t\tconst analysis = analyzeAbi(artifact);\n\n\t\t\tconsole.log(chalk.green('✅ ABI validation passed!'));\n\t\t\tconsole.log(chalk.blue('\\n📊 ABI Analysis:'));\n\t\t\tconsole.log(chalk.cyan(` Functions: ${analysis.functions}`));\n\t\t\tconsole.log(chalk.cyan(` Events: ${analysis.events}`));\n\t\t\tconsole.log(chalk.cyan(` Errors: ${analysis.errors}`));\n\t\t\tconsole.log(chalk.cyan(` Total fragments: ${ethersInterface.fragments.length}`));\n\n\t\t\tif (artifact._diamondMetadata) {\n\t\t\t\tconst metadata = artifact._diamondMetadata;\n\t\t\t\tconsole.log(chalk.blue('\\n💎 Diamond Metadata:'));\n\t\t\t\tconsole.log(chalk.cyan(` Diamond: ${metadata.diamondName}`));\n\t\t\t\tconsole.log(chalk.cyan(` Network: ${metadata.networkName}`));\n\t\t\t\tconsole.log(chalk.cyan(` Chain ID: ${metadata.chainId}`));\n\t\t\t\tconsole.log(chalk.cyan(` Generated: ${metadata.generatedAt}`));\n\n\t\t\t\tif (metadata.selectorMap) {\n\t\t\t\t\tconst selectorCount = Object.keys(metadata.selectorMap).length;\n\t\t\t\t\tconst facetCount = new Set(Object.values(metadata.selectorMap)).size;\n\t\t\t\t\tconsole.log(chalk.cyan(` Function selectors: ${selectorCount}`));\n\t\t\t\t\tconsole.log(chalk.cyan(` Facets: ${facetCount}`));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.verbose) {\n\t\t\t\tconsole.log(chalk.blue('\\n🔍 Function Signatures:'));\n\t\t\t\tethersInterface.fragments\n\t\t\t\t\t.filter((f: any) => f.type === 'function')\n\t\t\t\t\t.slice(0, 10) // Show first 10\n\t\t\t\t\t.forEach((f: any) => {\n\t\t\t\t\t\tconsole.log(chalk.gray(` ${(f as any).format()}`));\n\t\t\t\t\t});\n\n\t\t\t\tif (\n\t\t\t\t\tethersInterface.fragments.filter((f: any) => f.type === 'function').length > 10\n\t\t\t\t) {\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\tchalk.gray(\n\t\t\t\t\t\t\t` ... and ${ethersInterface.fragments.filter((f: any) => f.type === 'function').length - 10} more`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(chalk.red('❌ ABI validation failed:'), error);\n\t\t\tprocess.exit(1);\n\t\t}\n\t});\n\n// Helper functions\nasync function setupDiamondConnection(diamond: Diamond, verbose: boolean): Promise<void> {\n\ttry {\n\t\t// Typed as `any`: the `hre.ethers` helper is added at runtime by the\n\t\t// hardhat-ethers plugin (loaded via the project's hardhat config).\n\t\tconst hre: any = (await import('hardhat')).default;\n\t\tdiamond.setProvider(hre.ethers.provider);\n\t\tconst signers = await hre.ethers.getSigners();\n\t\tif (signers.length > 0) {\n\t\t\tdiamond.setSigner(signers[0]);\n\t\t}\n\n\t\tif (verbose) {\n\t\t\tconsole.log(chalk.gray('✅ Connected to Hardhat provider'));\n\t\t}\n\t} catch (error) {\n\t\tif (verbose) {\n\t\t\tconsole.log(\n\t\t\t\tchalk.yellow('⚠️ Could not connect to provider (running in standalone mode)'),\n\t\t\t);\n\t\t}\n\t}\n}\n\nfunction displayResults(result: any, verbose: boolean): void {\n\tconsole.log(chalk.blue('\\n📊 Generation Results:'));\n\tconsole.log(chalk.cyan(` Functions: ${result.stats.totalFunctions}`));\n\tconsole.log(chalk.cyan(` Events: ${result.stats.totalEvents}`));\n\tconsole.log(chalk.cyan(` Errors: ${result.stats.totalErrors}`));\n\tconsole.log(chalk.cyan(` Facets: ${result.stats.facetCount}`));\n\n\tif (result.outputPath) {\n\t\tconsole.log(chalk.cyan(` Output: ${result.outputPath}`));\n\t}\n\n\tif (result.stats.duplicateSelectorsSkipped > 0) {\n\t\tconsole.log(\n\t\t\tchalk.yellow(` Duplicates skipped: ${result.stats.duplicateSelectorsSkipped}`),\n\t\t);\n\t}\n\n\tif (verbose && result.selectorMap) {\n\t\tconsole.log(chalk.blue('\\n🎯 Function Selector Mapping:'));\n\t\tconst sortedSelectors = Object.entries(result.selectorMap).sort(([, a], [, b]) =>\n\t\t\t(a as string).localeCompare(b as string),\n\t\t);\n\t\tsortedSelectors.slice(0, 20).forEach(([selector, facet]) => {\n\t\t\tconsole.log(chalk.gray(` ${selector} → ${facet}`));\n\t\t});\n\n\t\tif (sortedSelectors.length > 20) {\n\t\t\tconsole.log(chalk.gray(` ... and ${sortedSelectors.length - 20} more`));\n\t\t}\n\t}\n}\n\nfunction displaySelectorChanges(\n\toldMap: Record<string, string>,\n\tnewMap: Record<string, string>,\n): void {\n\tconst oldSelectors = new Set(Object.keys(oldMap));\n\tconst newSelectors = new Set(Object.keys(newMap));\n\n\tconst added = Array.from(newSelectors).filter((s) => !oldSelectors.has(s));\n\tconst removed = Array.from(oldSelectors).filter((s) => !newSelectors.has(s));\n\tconst changed = Array.from(oldSelectors).filter(\n\t\t(s) => newSelectors.has(s) && oldMap[s] !== newMap[s],\n\t);\n\n\tif (added.length > 0) {\n\t\tconsole.log(chalk.green(`\\n ➕ Added (${added.length}):`));\n\t\tadded.slice(0, 10).forEach((selector) => {\n\t\t\tconsole.log(chalk.gray(` ${selector} → ${newMap[selector]}`));\n\t\t});\n\t\tif (added.length > 10) {\n\t\t\tconsole.log(chalk.gray(` ... and ${added.length - 10} more`));\n\t\t}\n\t}\n\n\tif (removed.length > 0) {\n\t\tconsole.log(chalk.red(`\\n ➖ Removed (${removed.length}):`));\n\t\tremoved.slice(0, 10).forEach((selector) => {\n\t\t\tconsole.log(chalk.gray(` ${selector} → ${oldMap[selector]}`));\n\t\t});\n\t\tif (removed.length > 10) {\n\t\t\tconsole.log(chalk.gray(` ... and ${removed.length - 10} more`));\n\t\t}\n\t}\n\n\tif (changed.length > 0) {\n\t\tconsole.log(chalk.yellow(`\\n 🔄 Changed (${changed.length}):`));\n\t\tchanged.slice(0, 10).forEach((selector) => {\n\t\t\tconsole.log(chalk.gray(` ${selector}: ${oldMap[selector]} → ${newMap[selector]}`));\n\t\t});\n\t\tif (changed.length > 10) {\n\t\t\tconsole.log(chalk.gray(` ... and ${changed.length - 10} more`));\n\t\t}\n\t}\n\n\tif (added.length === 0 && removed.length === 0 && changed.length === 0) {\n\t\tconsole.log(chalk.gray(' No selector changes detected'));\n\t}\n}\n\nfunction analyzeAbi(artifact: any): { functions: number; events: number; errors: number } {\n\tconst abi = artifact.abi ?? [];\n\treturn {\n\t\tfunctions: abi.filter((item: any) => item.type === 'function').length,\n\t\tevents: abi.filter((item: any) => item.type === 'event').length,\n\t\terrors: abi.filter((item: any) => item.type === 'error').length,\n\t};\n}\n\n// Parse command line arguments\nprogram.parse();\n\nexport {};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CallbackManager.d.ts","sourceRoot":"","sources":["../../src/core/CallbackManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,qBAAa,eAAe;IAKN,OAAO,CAAC,aAAa;IAJzC,OAAO,CAAC,MAAM,CAAC,SAAS,CAA2C;IAEnE,OAAO,CAAC,SAAS,CAA6E;IAE9F,OAAO;WAIO,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,eAAe;WAQ1E,cAAc,IAAI,IAAI;WAItB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAItD,OAAO,CAAC,aAAa;IAyBR,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAexG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"C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QAAQ,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;;AAhEH,0CAiEC","sourcesContent":["import * as fs from \"fs-extra\";\nimport { resolve, join } from \"path\";\nimport { CallbackArgs } from \"../types\";\n\nexport class CallbackManager {\n private static instances: Map<string, CallbackManager> = new Map();\n\n private callbacks: Record<string, Record<string, (args: CallbackArgs) => Promise<void>>> = {};\n\n private constructor(private callbacksPath: string) {\n this.loadCallbacks();\n }\n\n public static getInstance(diamondName: string, deploymentsPath: string): CallbackManager {\n if (!this.instances.has(diamondName)) {\n const callbacksPath = join(deploymentsPath, diamondName, \"callbacks\");\n this.instances.set(diamondName, new CallbackManager(callbacksPath));\n }\n return this.instances.get(diamondName)!;\n }\n\n public static clearInstances(): void {\n this.instances.clear();\n }\n\n public static clearInstance(diamondName: string): void {\n this.instances.delete(diamondName);\n }\n\n private loadCallbacks(): void {\n if (!fs.existsSync(this.callbacksPath)) {\n console.error(`Facet callbacks path \"${this.callbacksPath}\" does not exist.`);\n return;\n }\n\n const files = fs.readdirSync(this.callbacksPath);\n\n files.forEach(file => {\n if (!file.endsWith(\".ts\") && !file.endsWith(\".js\")) return;\n\n const facetName = file.split(\".\")[0];\n const filePath = resolve(this.callbacksPath, file);\n const module = require(filePath);\n\n this.callbacks[facetName] = {};\n\n Object.entries(module).forEach(([callbackName, callbackFn]) => {\n if (typeof callbackFn === 'function') {\n this.callbacks[facetName][callbackName] = callbackFn as (args: CallbackArgs) => Promise<void>;\n }\n });\n });\n }\n\n public async executeCallback(facetName: string, callbacks: string[], args: CallbackArgs): Promise<void> {\n const registeredCallbacks = this.callbacks[facetName];\n for (const callbackName of callbacks) {\n if (!registeredCallbacks) {\n throw new Error(`Callbacks for facet \"${facetName}\" not found.`);\n }\n\n const callback = registeredCallbacks[callbackName];\n if (!callback) {\n throw new Error(`Callback \"${callbackName}\" for facet \"${facetName}\" not found.`);\n }\n\n await callback(args);\n }\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DeploymentManager.d.ts","sourceRoot":"","sources":["../../src/core/DeploymentManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAqB;gBAEzB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,kBAAkB;IAKpD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IA2BvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAwB/B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DeploymentManager.js","sourceRoot":"","sources":["../../src/core/DeploymentManager.ts"],"names":[],"mappings":";;;AAGA,MAAa,iBAAiB;IACpB,OAAO,CAAU;IACjB,QAAQ,CAAqB;IAErC,YAAY,OAAgB,EAAE,QAA4B;QACxD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,CAAC,GAAG,CAAC,uCAAuC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;QAElC,MAAM,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnD,MAAM,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAChD,MAAM,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEpD,MAAM,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,QAAQ,CAAC,YAAY,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,CAAC,CAAC;QAC/C,MAAM,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEnD,MAAM,IAAI,CAAC,QAAQ,CAAC,iCAAiC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpE,MAAM,IAAI,CAAC,QAAQ,CAAC,8BAA8B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjE,MAAM,IAAI,CAAC,QAAQ,CAAC,kCAAkC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAErE,MAAM,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvD,MAAM,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpD,MAAM,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAExD,MAAM,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5D,MAAM,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,MAAM,IAAI,CAAC,QAAQ,CAAC,0BAA0B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE7D,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;IACnD,CAAC;CAEF;AA5DD,8CA4DC","sourcesContent":["import { DeploymentStrategy } from \"../strategies/DeploymentStrategy\";\nimport { Diamond } from \"./Diamond\";\n\nexport class DeploymentManager {\n private diamond: Diamond;\n private strategy: DeploymentStrategy;\n\n constructor(diamond: Diamond, strategy: DeploymentStrategy) {\n this.diamond = diamond;\n this.strategy = strategy;\n }\n\n async deploy(): Promise<void> {\n console.log(`🚀 Starting deployment for Diamond: ${this.diamond.diamondName}`);\n this.diamond.newDeployment = true;\n\n await this.strategy.preDeployDiamond(this.diamond);\n await this.strategy.deployDiamond(this.diamond);\n await this.strategy.postDeployDiamond(this.diamond);\n\n await this.strategy.preDeployFacets(this.diamond);\n await this.strategy.deployFacets(this.diamond);\n await this.strategy.postDeployFacets(this.diamond);\n\n await this.strategy.preUpdateFunctionSelectorRegistry(this.diamond);\n await this.strategy.updateFunctionSelectorRegistry(this.diamond);\n await this.strategy.postUpdateFunctionSelectorRegistry(this.diamond);\n\n await this.strategy.prePerformDiamondCut(this.diamond);\n await this.strategy.performDiamondCut(this.diamond);\n await this.strategy.postPerformDiamondCut(this.diamond);\n\n await this.strategy.preRunPostDeployCallbacks(this.diamond);\n await this.strategy.runPostDeployCallbacks(this.diamond);\n await this.strategy.postRunPostDeployCallbacks(this.diamond);\n\n console.log(`✅ Deployment completed successfully.`);\n }\n\n async upgrade(): Promise<void> {\n console.log(`♻️ Starting upgrade for Diamond: ${this.diamond.diamondName}`);\n\n this.diamond.newDeployment = false;\n\n await this.strategy.preDeployFacets(this.diamond);\n await this.strategy.deployFacets(this.diamond);\n await this.strategy.postDeployFacets(this.diamond);\n\n await this.strategy.preUpdateFunctionSelectorRegistry(this.diamond);\n await this.strategy.updateFunctionSelectorRegistry(this.diamond);\n await this.strategy.postUpdateFunctionSelectorRegistry(this.diamond);\n\n await this.strategy.prePerformDiamondCut(this.diamond);\n await this.strategy.performDiamondCut(this.diamond);\n await this.strategy.postPerformDiamondCut(this.diamond);\n\n await this.strategy.preRunPostDeployCallbacks(this.diamond);\n await this.strategy.runPostDeployCallbacks(this.diamond);\n await this.strategy.postRunPostDeployCallbacks(this.diamond);\n\n console.log(`✅ Upgrade completed successfully.`);\n }\n\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Diamond.d.ts","sourceRoot":"","sources":["../../src/core/Diamond.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAC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AAO,CAAC","sourcesContent":["import { Signer } from 'ethers';\nimport { join } from 'path';\nimport { DeploymentRepository } from '../repositories/DeploymentRepository';\nimport {\n DeployConfig,\n DeployedDiamondData,\n DeployedFacets,\n FacetsConfig,\n} from '../schemas';\nimport {\n DiamondConfig,\n FunctionSelectorRegistryEntry,\n NewDeployedFacet,\n NewDeployedFacets,\n RegistryFacetCutAction,\n SupportedProvider,\n} from '../types';\nimport { CallbackManager } from './CallbackManager';\n\nexport class Diamond {\n\tprivate static instances: Map<string, Diamond> = new Map();\n\n\tpublic diamondName: string;\n\tpublic networkName: string;\n\tpublic chainId: number | bigint;\n\tpublic deploymentsPath: string;\n\tpublic contractsPath: string;\n\tpublic diamondAbiPath: string;\n\tpublic diamondAbiFileName: string;\n\tpublic deploymentId: string;\n\tpublic facetSelectors: string[] = [];\n\tpublic callbackManager: CallbackManager;\n\tprivate deployedDiamondData: DeployedDiamondData;\n\tprivate config: DiamondConfig;\n\tprivate facetsConfig: FacetsConfig;\n\tprivate repository: DeploymentRepository;\n\tpublic signer: Signer | undefined;\n\tpublic provider: SupportedProvider | undefined;\n\tpublic deployConfig: DeployConfig;\n\tpublic newDeployment: boolean = true;\n\tpublic initAddress: string | undefined;\n\n\tconstructor(config: DiamondConfig, repository: DeploymentRepository) {\n\t\tthis.config = config;\n\t\tthis.diamondName = config.diamondName;\n\t\tthis.networkName = config.networkName ?? 'hardhat';\n\t\tthis.chainId = config.chainId ?? 31337;\n\t\tthis.deploymentsPath = config.deploymentsPath ?? 'diamonds';\n\t\tthis.contractsPath = config.contractsPath ?? 'contracts';\n\t\tthis.diamondAbiFileName = config.diamondAbiFileName ?? config.diamondName;\n\n\t\t// Set diamond ABI path - default to diamond-abi subdirectory of configFilePath directory\n\t\tif (config.diamondAbiPath) {\n\t\t\tthis.diamondAbiPath = config.diamondAbiPath;\n\t\t} else {\n\t\t\tconst configDir = config.configFilePath\n\t\t\t\t? config.configFilePath.replace(/\\/[^\\/]*$/, '') // Remove filename from path\n\t\t\t\t: join(this.deploymentsPath, config.diamondName);\n\t\t\tthis.diamondAbiPath = join(configDir, 'diamond-abi');\n\t\t}\n\n\t\tthis.repository = repository;\n\t\tthis.deploymentId = repository.getDeploymentId();\n\n\t\t// Load existing deployment info\n\t\tthis.deployedDiamondData = this.repository.loadDeployedDiamondData();\n\t\tthis.deployConfig = this.repository.loadDeployConfig();\n\n\t\tthis.facetsConfig = this.deployConfig.facets;\n\n\t\tthis.callbackManager = CallbackManager.getInstance(\n\t\t\tthis.diamondName,\n\t\t\tthis.deploymentsPath,\n\t\t);\n\n\t\tthis._initializeFunctionSelectorRegistry(this);\n\t}\n\n\tpublic functionSelectorRegistry = new Map<string, FunctionSelectorRegistryEntry>();\n\n\tprivate _initializeFunctionSelectorRegistry(diamond: Diamond): void {\n\t\tconst diamondConfig: DiamondConfig = diamond.getDiamondConfig();\n\t\tconst deployedDiamondData: DeployedDiamondData = diamond.getDeployedDiamondData();\n\t\tconst deployedFacets: DeployedFacets = deployedDiamondData.DeployedFacets ?? {};\n\n\t\tfor (const [\n\t\t\tfacetName,\n\t\t\t{ address: contractAddress, funcSelectors: selectors },\n\t\t] of Object.entries(deployedFacets)) {\n\t\t\tconsole.log(facetName);\n\t\t\tif (!selectors || !contractAddress) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (const selector of selectors) {\n\t\t\t\tconst facetConfig = this.facetsConfig[facetName as keyof FacetsConfig];\n\t\t\t\tconst priority = facetConfig?.priority ?? 1000;\n\t\t\t\tthis.functionSelectorRegistry.set(selector, {\n\t\t\t\t\tfacetName,\n\t\t\t\t\tpriority,\n\t\t\t\t\taddress: contractAddress,\n\t\t\t\t\taction: RegistryFacetCutAction.Deployed,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic registerFunctionSelectors(\n\t\tselectors: Record<string, Omit<FunctionSelectorRegistryEntry, 'selector'>>,\n\t): void {\n\t\tObject.entries(selectors).forEach(([selector, entry]) => {\n\t\t\tthis.functionSelectorRegistry.set(selector, entry);\n\t\t});\n\t}\n\n\tpublic updateFunctionSelectorRegistry(\n\t\tselector: string,\n\t\tentry: FunctionSelectorRegistryEntry,\n\t): void {\n\t\tthis.functionSelectorRegistry.set(selector, entry);\n\t}\n\n\tpublic isFunctionSelectorRegistered(selector: string): boolean {\n\t\treturn this.functionSelectorRegistry.has(selector);\n\t}\n\n\tpublic newDeployedFacets: NewDeployedFacets = {};\n\n\tpublic getNewDeployedFacets(): NewDeployedFacets {\n\t\treturn this.newDeployedFacets ?? {};\n\t}\n\n\tpublic updateNewDeployedFacets(facetName: string, facet: NewDeployedFacet): void {\n\t\tthis.newDeployedFacets = this.newDeployedFacets ?? {};\n\t\tthis.newDeployedFacets[facetName as keyof NewDeployedFacets] = facet;\n\t}\n\n\tgetDeployedDiamondData(): DeployedDiamondData {\n\t\treturn this.deployedDiamondData;\n\t}\n\n\tsetDeployedDiamondData(data: DeployedDiamondData): void {\n\t\tthis.deployedDiamondData = data;\n\t}\n\n\tupdateDeployedDiamondData(data: DeployedDiamondData): void {\n\t\tthis.deployedDiamondData = data;\n\t\tthis.repository.saveDeployedDiamondData(data);\n\t}\n\n\tpublic getDiamondConfig(): DiamondConfig {\n\t\treturn this.config;\n\t}\n\n\tpublic getDeployConfig(): DeployConfig {\n\t\treturn this.deployConfig;\n\t}\n\n\tpublic getFacetsConfig(): FacetsConfig {\n\t\treturn this.facetsConfig;\n\t}\n\n\tpublic setProvider(provider: SupportedProvider): void {\n\t\tthis.provider = provider;\n\t}\n\n\tpublic getProvider(): SupportedProvider | undefined {\n\t\treturn this.provider;\n\t}\n\n\tpublic setSigner(signer: Signer): void {\n\t\tthis.signer = signer;\n\t}\n\n\tpublic getSigner(): Signer | undefined {\n\t\treturn this.signer;\n\t}\n\n\tpublic isUpgradeDeployment(): boolean {\n\t\treturn !!this.deployedDiamondData.DiamondAddress;\n\t}\n\n\tpublic initializerRegistry: Map<string, string> = new Map();\n\n\tpublic registerInitializers(facetName: string, initFunction: string): void {\n\t\tthis.initializerRegistry.set(facetName, initFunction);\n\t}\n\n\tpublic setInitAddress(initAddress: string): void {\n\t\tthis.initAddress = initAddress;\n\t}\n\tpublic getInitAddress(): string | undefined {\n\t\treturn this.initAddress;\n\t}\n\n\tpublic getDiamondAbiPath(): string {\n\t\treturn this.diamondAbiPath;\n\t}\n\n\tpublic getDiamondAbiFileName(): string {\n\t\treturn this.diamondAbiFileName;\n\t}\n\n\tpublic getDiamondAbiFilePath(): string {\n\t\treturn join(this.diamondAbiPath, `${this.diamondAbiFileName}.json`);\n\t}\n}\n\nexport default Diamond;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DiamondDeployer.d.ts","sourceRoot":"","sources":["../../src/core/DiamondDeployer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGnD,qBAAa,eAAe;IAE1B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAqB;gBAGnC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,kBAAkB;IAMxB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAc7B,UAAU,IAAI,OAAO;CAG7B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DiamondDeployer.js","sourceRoot":"","sources":["../../src/core/DiamondDeployer.ts"],"names":[],"mappings":";;;AACA,2DAAwD;AAIxD,MAAa,eAAe;IAC1B,qCAAqC;IAC7B,OAAO,CAAU;IACjB,QAAQ,CAAqB;IAErC,YACE,OAAgB,EAChB,QAA4B;QAE5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAAA,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,MAAM,OAAO,GAAG,IAAI,qCAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnE,IAAI,mBAAwC,CAAC;QAC7C,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC;QAC3D,IAAI,YAAY,IAAI,YAAY,CAAC,cAAc,EAAE,CAAC;YAChD,mBAAmB,GAAG,YAAY,CAAC;YACnC,OAAO,CAAC,GAAG,CAAC,+BAA+B,mBAAmB,CAAC,cAAc,yBAAyB,CAAC,CAAC;YACxG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC;YACjF,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AA9BD,0CA8BC","sourcesContent":["import { Diamond } from './Diamond';\nimport { DeploymentManager } from './DeploymentManager';\nimport { DeploymentStrategy } from '../strategies';\nimport { DeployedDiamondData } from '../schemas';\n\nexport class DiamondDeployer {\n // private provider: JsonRpcProvider;\n private diamond: Diamond;\n private strategy: DeploymentStrategy;\n\n constructor(\n diamond: Diamond,\n strategy: DeploymentStrategy\n ) {\n this.diamond = diamond;\n this.strategy = strategy;;\n }\n\n async deployDiamond(): Promise<void> {\n const manager = new DeploymentManager(this.diamond, this.strategy);\n let deployedDiamondData: DeployedDiamondData;\n const deployedData = this.diamond.getDeployedDiamondData();\n if (deployedData && deployedData.DiamondAddress) {\n deployedDiamondData = deployedData;\n console.log(`Diamond already deployed at ${deployedDiamondData.DiamondAddress}. Performing upgrade...`);\n await manager.upgrade();\n } else {\n console.log(`Diamond not previously deployed. Performing initial deployment...`);\n await manager.deploy();\n }\n }\n\n public getDiamond(): Diamond {\n return this.diamond;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAC1B,qDAAoD;AAA3C,kHAAA,eAAe,OAAA","sourcesContent":["export { Diamond } from \"./Diamond\";\nexport { DiamondDeployer } from \"./DiamondDeployer\";\nexport { DeploymentManager } from \"./DeploymentManager\";\nexport { CallbackManager } from \"./CallbackManager\";"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,0CAAwB;AACxB,+CAA6B;AAC7B,4CAA0B;AAC1B,0CAAwB","sourcesContent":["export * from \"./core\";\nexport * from \"./types\";\nexport * from \"./strategies\";\nexport * from \"./schemas\";\nexport * from \"./utils\";\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DBDeploymentRepository.d.ts","sourceRoot":"","sources":["../../src/repositories/DBDeploymentRepository.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DBDeploymentRepository.js","sourceRoot":"","sources":["../../src/repositories/DBDeploymentRepository.ts"],"names":[],"mappings":";AAAA,WAAW;AACX,6BAA6B;AAC7B,wBAAwB;AACxB,wBAAwB;AACxB,8BAA8B;;AAE9B,iEAAiE;AACjE,kEAAkE;AAElE,wEAAwE;AACxE,oGAAoG;AACpG,sEAAsE;AACtE,MAAM;AAEN,gHAAgH;AAChH,gEAAgE;AAChE,MAAM;AAEN,gFAAgF;AAChF,uDAAuD;AACvD,MAAM;AACN,IAAI","sourcesContent":["// import {\n// readDeployedDiamondData,\n// saveDeploymentInfo,\n// getDeployConfigData\n// } from './databaseHandler';\n\n// import { DeploymentRepository } from './DeploymentRepository';\n// import { DeployedDiamondData, DeployConfig } from '../schemas';\n\n// export class DbDeploymentRepository implements DeploymentRepository {\n// async loadDeployInfo(key: { network: string; diamond: string }): Promise<DeployedDiamondData> {\n// return await readDeployedDiamondData(key.network, key.diamond);\n// }\n\n// async saveDeployInfo(key: { network: string; diamond: string }, info: DeployedDiamondData): Promise<void> {\n// await saveDeploymentInfo(key.network, key.diamond, info);\n// }\n\n// async loadDeployConfig(key: { projectId: string }): Promise<DeployConfig> {\n// return await getDeployConfigData(key.projectId);\n// }\n// }\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DeploymentRepository.d.ts","sourceRoot":"","sources":["../../src/repositories/DeploymentRepository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/D,8BAAsB,oBAAoB;IACxC,QAAQ,CAAC,uBAAuB,IAAI,mBAAmB;IAEvD,QAAQ,CAAC,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI;IAEjE,QAAQ,CAAC,gBAAgB,IAAI,YAAY;IAEzC,QAAQ,CAAC,eAAe,IAAI,MAAM;CACnC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DeploymentRepository.js","sourceRoot":"","sources":["../../src/repositories/DeploymentRepository.ts"],"names":[],"mappings":";;;AAGA,MAAsB,oBAAoB;CAQzC;AARD,oDAQC","sourcesContent":["// DeploymentRepository.ts\nimport { DeployedDiamondData, DeployConfig } from \"../schemas\";\n\nexport abstract class DeploymentRepository {\n abstract loadDeployedDiamondData(): DeployedDiamondData;\n\n abstract saveDeployedDiamondData(info: DeployedDiamondData): void;\n\n abstract loadDeployConfig(): DeployConfig;\n\n abstract getDeploymentId(): string;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileDeploymentRepository.d.ts","sourceRoot":"","sources":["../../src/repositories/FileDeploymentRepository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,qBAAa,wBAAyB,YAAW,oBAAoB;IACpE,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,2BAA2B,CAAS;IAC5C,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,wBAAwB,CAAU;IAC1C,OAAO,CAAC,YAAY,CAAS;gBAEjB,MAAM,EAAE,aAAa;IA2B1B,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAIjD,2BAA2B,IAAI,OAAO;IAI7C,uBAAuB,IAAI,mBAAmB;IAI9C,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI;IAYxD,gBAAgB,IAAI,YAAY;IAIzB,eAAe,IAAI,MAAM;CAGhC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileDeploymentRepository.js","sourceRoot":"","sources":["../../src/repositories/FileDeploymentRepository.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,+BAA4B;AAI5B,uDAAsF;AAEtF,MAAa,wBAAwB;IAC5B,kBAAkB,CAAS;IAC3B,2BAA2B,CAAS;IACpC,cAAc,CAAS;IACvB,wBAAw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I,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC,CAAC,gCAAgC;IACjG,CAAC;IAED,uBAAuB,CAAC,IAAyB;QAChD,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;YACnC,IAAA,iCAAe,EAAC,IAAI,CAAC,2BAA2B,EAAE,IAAI,CAAC,CAAC;QACzD,CAAC;aAAM,CAAC;YACP,OAAO,CAAC,GAAG,CACV,eAAK,CAAC,UAAU,CACf,4FAA4F,CAC5F,CACD,CAAC;QACH,CAAC;IACF,CAAC;IAED,gBAAgB;QACf,OAAO,IAAA,kCAAgB,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC9C,CAAC;IAEM,eAAe;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;CACD;AAjED,4DAiEC","sourcesContent":["import chalk from 'chalk';\nimport { join } from 'path';\nimport { DeployConfig, DeployedDiamondData } from '../schemas';\nimport { DiamondConfig } from '../types';\nimport { DeploymentRepository } from './DeploymentRepository';\nimport { readDeployConfig, readDeployFile, writeDeployInfo } from './jsonFileHandler';\n\nexport class FileDeploymentRepository implements DeploymentRepository {\n\tprivate deploymentDataPath: string;\n\tprivate deployedDiamondDataFilePath: string;\n\tprivate configFilePath: string;\n\tprivate writeDeployedDiamondData: boolean;\n\tprivate deploymentId: string;\n\n\tconstructor(config: DiamondConfig) {\n\t\tthis.deploymentDataPath = config.deploymentsPath ?? 'diamonds';\n\t\tthis.writeDeployedDiamondData = config.writeDeployedDiamondData ?? true;\n\t\tconst networkName = config.networkName ?? 'unknown';\n\t\tconst chainId = config.chainId ?? 0;\n\t\tthis.deploymentId = `${config.diamondName.toLowerCase()}-${networkName.toLowerCase()}-${chainId.toString()}`;\n\n\t\tif (config.deployedDiamondDataFilePath) {\n\t\t\tthis.deployedDiamondDataFilePath = config.deployedDiamondDataFilePath;\n\t\t} else {\n\t\t\tthis.deployedDiamondDataFilePath = join(\n\t\t\t\tthis.deploymentDataPath,\n\t\t\t\tconfig.diamondName,\n\t\t\t\t`deployments/${this.deploymentId}.json`,\n\t\t\t);\n\t\t}\n\t\tif (config.configFilePath) {\n\t\t\tthis.configFilePath = config.configFilePath;\n\t\t} else {\n\t\t\tthis.configFilePath = join(\n\t\t\t\tthis.deploymentDataPath,\n\t\t\t\tconfig.diamondName,\n\t\t\t\t`${config.diamondName.toLowerCase()}.config.json`,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic setWriteDeployedDiamondData(write: boolean): void {\n\t\tthis.writeDeployedDiamondData = write;\n\t}\n\n\tpublic getWriteDeployedDiamondData(): boolean {\n\t\treturn this.writeDeployedDiamondData;\n\t}\n\n\tloadDeployedDiamondData(): DeployedDiamondData {\n\t\treturn readDeployFile(this.deployedDiamondDataFilePath, false); // Never create file during load\n\t}\n\n\tsaveDeployedDiamondData(info: DeployedDiamondData): void {\n\t\tif (this.writeDeployedDiamondData) {\n\t\t\twriteDeployInfo(this.deployedDiamondDataFilePath, info);\n\t\t} else {\n\t\t\tconsole.log(\n\t\t\t\tchalk.cyanBright(\n\t\t\t\t\t'Skipping write of diamond deployment data. Set writeDeployedDiamondData to true to enable.',\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tloadDeployConfig(): DeployConfig {\n\t\treturn readDeployConfig(this.configFilePath);\n\t}\n\n\tpublic getDeploymentId(): string {\n\t\treturn this.deploymentId;\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"databaseHandler.d.ts","sourceRoot":"","sources":["../../src/repositories/databaseHandler.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"databaseHandler.js","sourceRoot":"","sources":["../../src/repositories/databaseHandler.ts"],"names":[],"mappings":";AAAA,kEAAkE;;AAElE,gFAAgF;AAChF,kHAAkH;AAClH,4BAA4B;AAC5B,IAAI;AAEJ,yHAAyH;AACzH,yBAAyB;AACzB,IAAI;AAEJ,wFAAwF;AACxF,wBAAwB;AACxB,IAAI","sourcesContent":["// import { DeployedDiamondData, DeployConfig } from \"../schemas\";\n\n// // This would internally use your chosen DB driver (e.g. pg, Prisma, TypeORM)\n// export async function readDeployedDiamondData(network: string, diamond: string): Promise<DeployedDiamondData> {\n// // SQL or ORM call here\n// }\n\n// export async function saveDeploymentInfo(network: string, diamond: string, info: DeployedDiamondData): Promise<void> {\n// // SQL or ORM upsert\n// }\n\n// export async function getDeployConfigData(projectId: string): Promise<DeployConfig> {\n// // SQL or ORM fetch\n// }\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,6DAA2C;AAC3C,oDAAkC","sourcesContent":["export * from \"./DeploymentRepository\";\nexport * from \"./FileDeploymentRepository\";\nexport * from \"./jsonFileHandler\";\n\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsonFileHandler.d.ts","sourceRoot":"","sources":["../../src/repositories/jsonFileHandler.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,OAAO,EACL,YAAY,EAEZ,mBAAmB,EAEpB,MAAM,6BAA6B,CAAC;AAErC,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EACvB,SAAS,GAAE,OAAe,GACzB,mBAAmB,CAGrB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,OAAc,GAClE,mBAAmB,CAuBtB;AAWD;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,mBAAmB,CAQvD;AACD;;;GAGG;A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EAAE,YAAY,CAAC,CAAC;IACzC,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AALW,QAAA,WAAW,eAKtB;AAEF;;;;GAIG;AACI,MAAM,oBAAoB,GAAG,CAAC,QAAgB,EAAW,EAAE;IAChE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;QAEvC,2BAA2B;QAC3B,IAAI,CAAC,IAAA,qBAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,KAAK,CAAC,mDAAmD,QAAQ,GAAG,CAAC,CAAC;YAC9E,OAAO,KAAK,CAAC;QACf,CAAC;QAED,qCAAqC;QACrC,MAAM,GAAG,GAAG,IAAA,uBAAY,EAAC,QAAQ,CAAC,CAAC;QAEnC,uCAAuC;QACvC,qCAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE9B,kCAAkC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAA;AAtBY,QAAA,oBAAoB,wBAsBhC","sourcesContent":["/**\n * CRUD and validation helpers for JSON files\n * \n * These should all be synchronous and handle issues like empty files or non-existent files\n * gracefully in a way that allows for control by the caller, e.g. gives the caller the\n * ability to create an empty file on failure.\n */\n\nimport {\n ensureFileSync,\n existsSync,\n pathExistsSync,\n readJsonSync,\n removeSync,\n writeJsonSync\n} from \"fs-extra\";\nimport { join, resolve } from \"path\";\nimport {\n DeployConfig,\n DeployConfigSchema,\n DeployedDiamondData,\n DeployedDiamondDataSchema\n} from \"../schemas/DeploymentSchema\";\n\nexport function readDeployFilePathDiamondNetwork(\n networkName: string,\n diamondName: string,\n deploymentId: string,\n deploymentsPath: string,\n createNew: boolean = false\n): DeployedDiamondData {\n const filePath = join(deploymentsPath, diamondName, `${deploymentId}.json`);\n return readDeployFile(filePath, createNew);\n}\n\n/**\n * Reads and validates a JSON file as DeployedDiamondData\n * @param path - The path to the deployment file.\n * @param createIfMissing - If true, creates a new deployment file with default values if \n * the file does not exist. Otherwise this will throw an error if the file does not exist.\n * @returns The parsed and validated deployment object.\n */\nexport function readDeployFile(path: string, createNew: boolean = true)\n : DeployedDiamondData {\n let raw: unknown;\n if (!pathExistsSync(path) && createNew) {\n createNewDeployFile(path);\n raw = readJsonSync(path);\n\n const parsed = DeployedDiamondDataSchema.safeParse(raw);\n if (!parsed.success) {\n throw new Error(`Invalid deployment format: ${JSON.stringify(parsed.error.format(), null, 2)}`);\n }\n\n return parsed.data;\n } else if (pathExistsSync(path)) {\n raw = readJsonSync(path);\n const parsed = DeployedDiamondDataSchema.safeParse(raw);\n if (!parsed.success) {\n throw new Error(`Invalid deployment format: ${JSON.stringify(parsed.error.format(), null, 2)}`);\n }\n return parsed.data;\n }\n\n // This is a mock deployment object with empty values\n return defaultDeployment();\n}\n\n/**\n * Resolves the absolute path of a file relative to the project root.\n * @param relativePath - The relative path to resolve.\n * @returns The absolute path.\n */\nconst resolvePath = (relativePath: string): string => {\n return resolve(process.cwd(), relativePath);\n};\n\n/**\n * Default deployment object with empty values\n * This is used to create a new deployment file if it does not exist or for a mock deployment.\n * @type {DeployedDiamondData}\n */\nexport function defaultDeployment(): DeployedDiamondData {\n return {\n DiamondAddress: \"\",\n DeployerAddress: \"\",\n DeployedFacets: {}, // Empty object for facets\n ExternalLibraries: {}, // Empty object for external libraries\n protocolVersion: 0, // Default protocol version\n };\n}\n/**\n * Creates a new deployment file with default empty values\n * @param path - The path to the deployment file.\n */\nexport function createNewDeployFile(path: string) {\n // Ensure the directory exists before writing\n ensureFileSync(path);\n // Validate the default deployment object before writing\n const validated = DeployedDiamondDataSchema.parse(defaultDeployment());\n writeJsonSync(path, validated, { spaces: 2 });\n}\n\n/**\n * Writes JSON to file\n */\nexport function writeDeployInfo(path: string, data: DeployedDiamondData) {\n const validated = DeployedDiamondDataSchema.parse(data);\n writeJsonSync(path, validated, { spaces: 2 });\n}\n\n/**\n * Update deployment JSON file\n */\nexport function updateDeployInfo(path: string, updater: (data: DeployedDiamondData) => void) {\n const data = readDeployFile(path);\n updater(data);\n writeDeployInfo(path, data);\n}\n\n/**\n * Deletes the deployment file\n */\nexport function deleteDeployInfo(path: string) {\n if (pathExistsSync(path)) {\n removeSync(path);\n }\n}\n\n/**\n * Validates the Deployment File without loading it.\n * @param path \n * @returns \n */\nexport function validateDeployFile(path: string): boolean {\n try {\n if (!pathExistsSync(path)) {\n console.log(`Deployment file not found: ${path}`);\n return false;\n }\n const raw = readJsonSync(path);\n DeployedDiamondDataSchema.parse(raw);\n return true;\n } catch {\n return false;\n }\n}\n\nexport function loadFacetsConfig(\n deploymentsPath: string,\n diamondName: string\n): DeployConfig {\n const file = join(deploymentsPath, diamondName, `${diamondName}.config.json`);\n const valid = validateDeployConfig(file);\n\n const facets = readDeployConfig(file);\n return facets;\n}\n\n/**\n * Loads and validates the facets config <diamondName>.config.json file.\n * @param filePath - The path to the facets file.\n * @returns The parsed and validated facets object.\n */\nexport const readDeployConfig = (filePath: string): DeployConfig => {\n try {\n const fullPath = resolvePath(filePath);\n\n // Read the JSON file\n const raw = readJsonSync(fullPath);\n\n // Validate and parse the JSON data\n return DeployConfigSchema.parse(raw);\n } catch (e) {\n console.error('Failed to load facets:', e);\n throw e;\n }\n};\n\n/**\n * Saves the Diamond Config object to a file.\n * @param filePath - The path to the facets file.\n * @param data - The facets object to save.\n */\nexport const saveDeployConfig = (filePath: string, data: DeployConfig): void => {\n const fullPath = resolvePath(filePath);\n ensureFileSync(fullPath);\n writeJsonSync(fullPath, data, { spaces: 2 });\n};\n\n/**\n * Updates a specific facet in the facets file.\n * @param filePath - The path to the facets file.\n * @param facetKey - The key of the facet to update.\n * @param update - The partial update to apply to the facet.\n * @returns The updated facets object.\n */\nexport const updateFacetConfig = (\n filePath: string,\n facetKey: string,\n update: Partial<DeployConfig[\"facets\"][string]>\n): DeployConfig => {\n const deployConfig = readDeployConfig(filePath);\n deployConfig.facets[facetKey] = {\n ...(deployConfig.facets[facetKey] || {}),\n ...update,\n };\n saveDeployConfig(filePath, deployConfig);\n return deployConfig;\n};\n\n/**\n * Deletes a specific facet from the facets file.\n * @param filePath - The path to the facets file.\n * @param facetKey - The key of the facet to delete.\n * @returns The updated facets object.\n */\nexport const deleteFacet = (filePath: string, facetKey: string): DeployConfig => {\n const deployConfig = readDeployConfig(filePath);\n delete deployConfig.facets[facetKey];\n saveDeployConfig(filePath, deployConfig);\n return deployConfig;\n};\n\n/**\n * Validates that the facets file exists, is valid JSON, and conforms to the schema.\n * @param filePath - The path to the facets file.\n * @returns A boolean indicating whether the file is valid.\n */\nexport const validateDeployConfig = (filePath: string): boolean => {\n try {\n const fullPath = resolvePath(filePath);\n\n // Check if the file exists\n if (!existsSync(fullPath)) {\n console.error(`Validation failed: File does not exist at path \"${filePath}\"`);\n return false;\n }\n\n // Read the file and parse it as JSON\n const raw = readJsonSync(fullPath);\n\n // Validate the JSON against the schema\n DeployConfigSchema.parse(raw);\n\n // If all checks pass, return true\n return true;\n } catch (e) {\n console.error('Validation failed:', e);\n return false;\n }\n}"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"prismaDBHandler.d.ts","sourceRoot":"","sources":["../../src/repositories/prismaDBHandler.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"prismaDBHandler.js","sourceRoot":"","sources":["../../src/repositories/prismaDBHandler.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,qCAAqC;AACrC,kEAAkE;;AAElE,kHAAkH;AAClH,wDAAwD;AACxD,uDAAuD;AACvD,QAAQ;AACR,gDAAgD;AAChD,IAAI","sourcesContent":["// // databaseHandler.ts (Prisma example)\n// import { prisma } from './prisma';\n// import { DeployedDiamondData, DeployConfig } from '../schemas';\n\n// export async function readDeployedDiamondData(network: string, diamond: string): Promise<DeployedDiamondData> {\n// const record = await prisma.deployment.findUnique({\n// where: { network_diamond: { network, diamond } }\n// });\n// return record?.info as DeployedDiamondData;\n// }\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resolution/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resolution/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC","sourcesContent":["export * from './selectorResolution';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"selectorResolution.d.ts","sourceRoot":"","sources":["../../src/resolution/selectorResolution.ts"],"names":[],"mappings":"AACA,OAAO,EACN,6BAA6B,EAC7B,iBAAiB,EAEjB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;GAgBG;AAEH,yFAAyF;AACzF,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CACtC,MAAM,EACN;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAChE,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACpC,cAAc,EAAE,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,EAAE,EACxB,aAAa,EAAE,MAAM,EAAE,GACrB,MAAM,EAAE,CAaV;AAED,MAAM,WAAW,mBAAmB;IACnC,yFAAyF;IACzF,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,8FAA8F;IAC9F,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,sFAAsF;IACtF,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CA0J/E"}