@diamondslab/diamonds 1.0.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.
- package/README.md +618 -0
- package/diamonds/README.md +3 -0
- package/dist/core/CallbackManager.d.ts +13 -0
- package/dist/core/CallbackManager.d.ts.map +1 -0
- package/dist/core/CallbackManager.js +95 -0
- package/dist/core/CallbackManager.js.map +1 -0
- package/dist/core/DeploymentManager.d.ts +10 -0
- package/dist/core/DeploymentManager.d.ts.map +1 -0
- package/dist/core/DeploymentManager.js +50 -0
- package/dist/core/DeploymentManager.js.map +1 -0
- package/dist/core/Diamond.d.ts +58 -0
- package/dist/core/Diamond.d.ts.map +1 -0
- package/dist/core/Diamond.js +146 -0
- package/dist/core/Diamond.js.map +1 -0
- package/dist/core/DiamondDeployer.d.ts +10 -0
- package/dist/core/DiamondDeployer.d.ts.map +1 -0
- package/dist/core/DiamondDeployer.js +33 -0
- package/dist/core/DiamondDeployer.js.map +1 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +12 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/repositories/DBDeploymentRepository.d.ts +1 -0
- package/dist/repositories/DBDeploymentRepository.d.ts.map +1 -0
- package/dist/repositories/DBDeploymentRepository.js +20 -0
- package/dist/repositories/DBDeploymentRepository.js.map +1 -0
- package/dist/repositories/DeploymentRepository.d.ts +8 -0
- package/dist/repositories/DeploymentRepository.d.ts.map +1 -0
- package/dist/repositories/DeploymentRepository.js +7 -0
- package/dist/repositories/DeploymentRepository.js.map +1 -0
- package/dist/repositories/FileDeploymentRepository.d.ts +18 -0
- package/dist/repositories/FileDeploymentRepository.d.ts.map +1 -0
- package/dist/repositories/FileDeploymentRepository.js +58 -0
- package/dist/repositories/FileDeploymentRepository.js.map +1 -0
- package/dist/repositories/databaseHandler.d.ts +1 -0
- package/dist/repositories/databaseHandler.d.ts.map +1 -0
- package/dist/repositories/databaseHandler.js +13 -0
- package/dist/repositories/databaseHandler.js.map +1 -0
- package/dist/repositories/index.d.ts +4 -0
- package/dist/repositories/index.d.ts.map +1 -0
- package/dist/repositories/index.js +20 -0
- package/dist/repositories/index.js.map +1 -0
- package/dist/repositories/jsonFileHandler.d.ts +81 -0
- package/dist/repositories/jsonFileHandler.d.ts.map +1 -0
- package/dist/repositories/jsonFileHandler.js +223 -0
- package/dist/repositories/jsonFileHandler.js.map +1 -0
- package/dist/repositories/prismaDBHandler.d.ts +1 -0
- package/dist/repositories/prismaDBHandler.d.ts.map +1 -0
- package/dist/repositories/prismaDBHandler.js +11 -0
- package/dist/repositories/prismaDBHandler.js.map +1 -0
- package/dist/schemas/DeploymentSchema.d.ts +309 -0
- package/dist/schemas/DeploymentSchema.d.ts.map +1 -0
- package/dist/schemas/DeploymentSchema.js +56 -0
- package/dist/schemas/DeploymentSchema.js.map +1 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +18 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/strategies/BaseDeploymentStrategy.d.ts +41 -0
- package/dist/strategies/BaseDeploymentStrategy.d.ts.map +1 -0
- package/dist/strategies/BaseDeploymentStrategy.js +545 -0
- package/dist/strategies/BaseDeploymentStrategy.js.map +1 -0
- package/dist/strategies/DeploymentStrategy.d.ts +19 -0
- package/dist/strategies/DeploymentStrategy.d.ts.map +1 -0
- package/dist/strategies/DeploymentStrategy.js +3 -0
- package/dist/strategies/DeploymentStrategy.js.map +1 -0
- package/dist/strategies/LocalDeploymentStrategy.d.ts +4 -0
- package/dist/strategies/LocalDeploymentStrategy.d.ts.map +1 -0
- package/dist/strategies/LocalDeploymentStrategy.js +8 -0
- package/dist/strategies/LocalDeploymentStrategy.js.map +1 -0
- package/dist/strategies/OZDefenderDeploymentStrategy.d.ts +62 -0
- package/dist/strategies/OZDefenderDeploymentStrategy.d.ts.map +1 -0
- package/dist/strategies/OZDefenderDeploymentStrategy.js +757 -0
- package/dist/strategies/OZDefenderDeploymentStrategy.js.map +1 -0
- package/dist/strategies/RPCDeploymentStrategy.d.ts +139 -0
- package/dist/strategies/RPCDeploymentStrategy.d.ts.map +1 -0
- package/dist/strategies/RPCDeploymentStrategy.js +710 -0
- package/dist/strategies/RPCDeploymentStrategy.js.map +1 -0
- package/dist/strategies/index.d.ts +6 -0
- package/dist/strategies/index.d.ts.map +1 -0
- package/dist/strategies/index.js +12 -0
- package/dist/strategies/index.js.map +1 -0
- package/dist/types/config.d.ts +26 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/defender.d.ts +22 -0
- package/dist/types/defender.d.ts.map +1 -0
- package/dist/types/defender.js +3 -0
- package/dist/types/defender.js.map +1 -0
- package/dist/types/deployments.d.ts +71 -0
- package/dist/types/deployments.d.ts.map +1 -0
- package/dist/types/deployments.js +20 -0
- package/dist/types/deployments.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +21 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/rpc.d.ts +35 -0
- package/dist/types/rpc.d.ts.map +1 -0
- package/dist/types/rpc.js +3 -0
- package/dist/types/rpc.js.map +1 -0
- package/dist/utils/common.d.ts +20 -0
- package/dist/utils/common.d.ts.map +1 -0
- package/dist/utils/common.js +45 -0
- package/dist/utils/common.js.map +1 -0
- package/dist/utils/configurationResolver.d.ts +30 -0
- package/dist/utils/configurationResolver.d.ts.map +1 -0
- package/dist/utils/configurationResolver.js +151 -0
- package/dist/utils/configurationResolver.js.map +1 -0
- package/dist/utils/contractMapping.d.ts +29 -0
- package/dist/utils/contractMapping.d.ts.map +1 -0
- package/dist/utils/contractMapping.js +224 -0
- package/dist/utils/contractMapping.js.map +1 -0
- package/dist/utils/defenderClients.d.ts +5 -0
- package/dist/utils/defenderClients.d.ts.map +1 -0
- package/dist/utils/defenderClients.js +21 -0
- package/dist/utils/defenderClients.js.map +1 -0
- package/dist/utils/defenderStore.d.ts +14 -0
- package/dist/utils/defenderStore.d.ts.map +1 -0
- package/dist/utils/defenderStore.js +92 -0
- package/dist/utils/defenderStore.js.map +1 -0
- package/dist/utils/diamondAbiGenerator.d.ts +113 -0
- package/dist/utils/diamondAbiGenerator.d.ts.map +1 -0
- package/dist/utils/diamondAbiGenerator.js +415 -0
- package/dist/utils/diamondAbiGenerator.js.map +1 -0
- package/dist/utils/diffDeployedFacets.d.ts +26 -0
- package/dist/utils/diffDeployedFacets.d.ts.map +1 -0
- package/dist/utils/diffDeployedFacets.js +106 -0
- package/dist/utils/diffDeployedFacets.js.map +1 -0
- package/dist/utils/index.d.ts +16 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +35 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/loupe.d.ts +44 -0
- package/dist/utils/loupe.d.ts.map +1 -0
- package/dist/utils/loupe.js +128 -0
- package/dist/utils/loupe.js.map +1 -0
- package/dist/utils/rpcStore.d.ts +36 -0
- package/dist/utils/rpcStore.d.ts.map +1 -0
- package/dist/utils/rpcStore.js +166 -0
- package/dist/utils/rpcStore.js.map +1 -0
- package/dist/utils/signer.d.ts +36 -0
- package/dist/utils/signer.d.ts.map +1 -0
- package/dist/utils/signer.js +91 -0
- package/dist/utils/signer.js.map +1 -0
- package/dist/utils/txlogging.d.ts +13 -0
- package/dist/utils/txlogging.d.ts.map +1 -0
- package/dist/utils/txlogging.js +87 -0
- package/dist/utils/txlogging.js.map +1 -0
- package/dist/utils/workspaceSetup.d.ts +32 -0
- package/dist/utils/workspaceSetup.d.ts.map +1 -0
- package/dist/utils/workspaceSetup.js +311 -0
- package/dist/utils/workspaceSetup.js.map +1 -0
- package/docs/DIAMOND_ABI_CONFIGURATION_SUMMARY.md +40 -0
- package/docs/DIAMOND_ABI_GENERATION.md +220 -0
- package/docs/DIAMOND_ABI_GENERATOR_EXAMPLES.md +1204 -0
- package/docs/DIAMOND_ABI_GENERATOR_IMPLEMENTATION.md +947 -0
- package/docs/DIAMOND_ABI_GENERATOR_QUICK_REFERENCE.md +336 -0
- package/docs/README-DEFENDER.md +394 -0
- package/docs/README_DIAMOND_ABI_GENERATOR.md +303 -0
- package/docs/ROADMAP.md +250 -0
- package/docs/assets/image.png +0 -0
- package/docs/defender-integration.md +451 -0
- package/docs/diamond_module-BaseStrategy_design-v2.uxf +247 -0
- package/docs/diamond_module-BaseStrategy_design.uxf +272 -0
- package/docs/monitoring-troubleshooting.md +556 -0
- package/docs/testing-guide.md +713 -0
- package/examples/Diamond_Config_and_Deployment_examples/diamonds/ProxyDiamond/callbacks/ERC20ProxyFacet.ts +31 -0
- package/examples/Diamond_Config_and_Deployment_examples/diamonds/ProxyDiamond/proxydiamond.config.json +27 -0
- package/examples/Local_Hardhat_Deployer_Script_example/LocalDiamondDeployer.ts +180 -0
- package/examples/OZ_Defender_Deployer_Script_example/OZDiamondDeployer.ts +107 -0
- package/examples/OZ_Defender_Deployer_Script_example/run-oz-deploy.ts +17 -0
- package/examples/Test_examples/ProxyDiamondDeployment.test.ts +202 -0
- package/examples/defender-deployment/.env.example +35 -0
- package/examples/defender-deployment/README.md +415 -0
- package/examples/defender-deployment/contracts/ExampleDiamond.sol +41 -0
- package/examples/defender-deployment/contracts/ExampleFacet1.sol +84 -0
- package/examples/defender-deployment/contracts/ExampleFacet2.sol +104 -0
- package/examples/defender-deployment/contracts/UpgradeFacet.sol +92 -0
- package/examples/defender-deployment/deploy-script.ts +170 -0
- package/examples/defender-deployment/diamond-config.json +36 -0
- package/examples/defender-deployment/upgrade-script.ts +237 -0
- package/examples/hardhat-diamonds-config.example.ts +41 -0
- package/package.json +228 -0
- package/src/core/CallbackManager.ts +70 -0
- package/src/core/DeploymentManager.ts +64 -0
- package/src/core/Diamond.ts +197 -0
- package/src/core/DiamondDeployer.ts +36 -0
- package/src/core/index.ts +4 -0
- package/src/index.ts +5 -0
- package/src/repositories/DBDeploymentRepository.ts +22 -0
- package/src/repositories/DeploymentRepository.ts +12 -0
- package/src/repositories/FileDeploymentRepository.ts +67 -0
- package/src/repositories/databaseHandler.ts +14 -0
- package/src/repositories/index.ts +4 -0
- package/src/repositories/jsonFileHandler.ts +252 -0
- package/src/repositories/prismaDBHandler.ts +10 -0
- package/src/schemas/DeploymentSchema.ts +71 -0
- package/src/schemas/index.ts +1 -0
- package/src/strategies/BaseDeploymentStrategy.ts +649 -0
- package/src/strategies/DeploymentStrategy.ts +25 -0
- package/src/strategies/LocalDeploymentStrategy.ts +5 -0
- package/src/strategies/OZDefenderDeploymentStrategy.ts +849 -0
- package/src/strategies/RPCDeploymentStrategy.ts +881 -0
- package/src/strategies/index.ts +5 -0
- package/src/types/config.ts +34 -0
- package/src/types/defender.ts +24 -0
- package/src/types/deployments.ts +102 -0
- package/src/types/index.ts +4 -0
- package/src/types/rpc.ts +37 -0
- package/src/utils/common.ts +54 -0
- package/src/utils/configurationResolver.ts +141 -0
- package/src/utils/contractMapping.ts +220 -0
- package/src/utils/defenderClients.ts +22 -0
- package/src/utils/defenderStore.ts +62 -0
- package/src/utils/diamondAbiGenerator.ts +523 -0
- package/src/utils/diffDeployedFacets.ts +131 -0
- package/src/utils/index.ts +15 -0
- package/src/utils/loupe.ts +159 -0
- package/src/utils/rpcStore.ts +152 -0
- package/src/utils/signer.ts +93 -0
- package/src/utils/txlogging.ts +97 -0
- package/src/utils/workspaceSetup.ts +315 -0
- package/test/README.md +136 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FileDeploymentRepository = void 0;
|
|
7
|
+
const jsonFileHandler_1 = require("./jsonFileHandler");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
class FileDeploymentRepository {
|
|
11
|
+
deploymentDataPath;
|
|
12
|
+
deployedDiamondDataFilePath;
|
|
13
|
+
configFilePath;
|
|
14
|
+
writeDeployedDiamondData;
|
|
15
|
+
deploymentId;
|
|
16
|
+
constructor(config) {
|
|
17
|
+
this.deploymentDataPath = config.deploymentsPath || 'diamonds';
|
|
18
|
+
this.writeDeployedDiamondData = config.writeDeployedDiamondData ?? true;
|
|
19
|
+
this.deploymentId = `${config.diamondName.toLowerCase()}-${config.networkName.toLowerCase()}-${config.chainId.toString()}`;
|
|
20
|
+
if (config.deployedDiamondDataFilePath) {
|
|
21
|
+
this.deployedDiamondDataFilePath = config.deployedDiamondDataFilePath;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.deployedDiamondDataFilePath = (0, path_1.join)(this.deploymentDataPath, config.diamondName, `deployments/${this.deploymentId}.json`);
|
|
25
|
+
}
|
|
26
|
+
if (config.configFilePath) {
|
|
27
|
+
this.configFilePath = config.configFilePath;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this.configFilePath = (0, path_1.join)(this.deploymentDataPath, config.diamondName, `${config.diamondName.toLowerCase()}.config.json`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
setWriteDeployedDiamondData(write) {
|
|
34
|
+
this.writeDeployedDiamondData = write;
|
|
35
|
+
}
|
|
36
|
+
getWriteDeployedDiamondData() {
|
|
37
|
+
return this.writeDeployedDiamondData;
|
|
38
|
+
}
|
|
39
|
+
loadDeployedDiamondData() {
|
|
40
|
+
return (0, jsonFileHandler_1.readDeployFile)(this.deployedDiamondDataFilePath, this.writeDeployedDiamondData);
|
|
41
|
+
}
|
|
42
|
+
saveDeployedDiamondData(info) {
|
|
43
|
+
if (this.writeDeployedDiamondData) {
|
|
44
|
+
(0, jsonFileHandler_1.writeDeployInfo)(this.deployedDiamondDataFilePath, info);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
console.log(chalk_1.default.cyanBright("Skipping write of diamond deployment data. Set writeDeployedDiamondData to true to enable."));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
loadDeployConfig() {
|
|
51
|
+
return (0, jsonFileHandler_1.readDeployConfig)(this.configFilePath);
|
|
52
|
+
}
|
|
53
|
+
getDeploymentId() {
|
|
54
|
+
return this.deploymentId;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.FileDeploymentRepository = FileDeploymentRepository;
|
|
58
|
+
//# sourceMappingURL=FileDeploymentRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileDeploymentRepository.js","sourceRoot":"","sources":["../../src/repositories/FileDeploymentRepository.ts"],"names":[],"mappings":";;;;;;AAEA,uDAAsF;AAEtF,+BAA4B;AAC5B,kDAA0B;AAE1B,MAAa,wBAAwB;IAC3B,kBAAkB,CAAS;IAC3B,2BAA2B,CAAS;IACpC,cAAc,CAAS;IACvB,wBAAwB,CAAU;IAClC,YAAY,CAAS;IAE7B,YAAY,MAAqB;QAC/B,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,eAAgB,IAAI,UAAU,CAAC;QAChE,IAAI,CAAC,wBAAwB,GAAG,MAAM,CAAC,wBAAwB,IAAI,IAAI,CAAC;QACxE,IAAI,CAAC,YAAY,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC,WAAW,EAAE,IAAI,MAAM,CAAC,WAAY,CAAC,WAAW,EAAE,IAAI,MAAM,CAAC,OAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;QAE7H,IAAI,MAAM,CAAC,2BAA2B,EAAE,CAAC;YACvC,IAAI,CAAC,2BAA2B,GAAG,MAAM,CAAC,2BAA2B,CAAC;QACxE,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,2BAA2B,GAAG,IAAA,WAAI,EACr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seHandler.d.ts","sourceRoot":"","sources":["../../src/repositories/databaseHandler.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { DeployedDiamondData, DeployConfig } from "../schemas";
|
|
3
|
+
// // This would internally use your chosen DB driver (e.g. pg, Prisma, TypeORM)
|
|
4
|
+
// export async function readDeployedDiamondData(network: string, diamond: string): Promise<DeployedDiamondData> {
|
|
5
|
+
// // SQL or ORM call here
|
|
6
|
+
// }
|
|
7
|
+
// export async function saveDeploymentInfo(network: string, diamond: string, info: DeployedDiamondData): Promise<void> {
|
|
8
|
+
// // SQL or ORM upsert
|
|
9
|
+
// }
|
|
10
|
+
// export async function getDeployConfigData(projectId: string): Promise<DeployConfig> {
|
|
11
|
+
// // SQL or ORM fetch
|
|
12
|
+
// }
|
|
13
|
+
//# sourceMappingURL=databaseHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DeploymentRepository"), exports);
|
|
18
|
+
__exportStar(require("./FileDeploymentRepository"), exports);
|
|
19
|
+
__exportStar(require("./jsonFileHandler"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,6DAA2C;AAC3C,oDAAkC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRUD and validation helpers for JSON files
|
|
3
|
+
*
|
|
4
|
+
* These should all be synchronous and handle issues like empty files or non-existent files
|
|
5
|
+
* gracefully in a way that allows for control by the caller, e.g. gives the caller the
|
|
6
|
+
* ability to create an empty file on failure.
|
|
7
|
+
*/
|
|
8
|
+
import { DeployConfig, DeployedDiamondData } from "../schemas/DeploymentSchema";
|
|
9
|
+
export declare function readDeployFilePathDiamondNetwork(networkName: string, diamondName: string, deploymentId: string, deploymentsPath: string, createNew?: boolean): DeployedDiamondData;
|
|
10
|
+
/**
|
|
11
|
+
* Reads and validates a JSON file as DeployedDiamondData
|
|
12
|
+
* @param path - The path to the deployment file.
|
|
13
|
+
* @param createIfMissing - If true, creates a new deployment file with default values if
|
|
14
|
+
* the file does not exist. Otherwise this will throw an error if the file does not exist.
|
|
15
|
+
* @returns The parsed and validated deployment object.
|
|
16
|
+
*/
|
|
17
|
+
export declare function readDeployFile(path: string, createNew?: boolean): DeployedDiamondData;
|
|
18
|
+
/**
|
|
19
|
+
* Default deployment object with empty values
|
|
20
|
+
* This is used to create a new deployment file if it does not exist or for a mock deployment.
|
|
21
|
+
* @type {DeployedDiamondData}
|
|
22
|
+
*/
|
|
23
|
+
export declare function defaultDeployment(): DeployedDiamondData;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new deployment file with default empty values
|
|
26
|
+
* @param path - The path to the deployment file.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createNewDeployFile(path: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* Writes JSON to file
|
|
31
|
+
*/
|
|
32
|
+
export declare function writeDeployInfo(path: string, data: DeployedDiamondData): void;
|
|
33
|
+
/**
|
|
34
|
+
* Update deployment JSON file
|
|
35
|
+
*/
|
|
36
|
+
export declare function updateDeployInfo(path: string, updater: (data: DeployedDiamondData) => void): void;
|
|
37
|
+
/**
|
|
38
|
+
* Deletes the deployment file
|
|
39
|
+
*/
|
|
40
|
+
export declare function deleteDeployInfo(path: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Validates the Deployment File without loading it.
|
|
43
|
+
* @param path
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
export declare function validateDeployFile(path: string): boolean;
|
|
47
|
+
export declare function loadFacetsConfig(deploymentsPath: string, diamondName: string): DeployConfig;
|
|
48
|
+
/**
|
|
49
|
+
* Loads and validates the facets config <diamondName>.config.json file.
|
|
50
|
+
* @param filePath - The path to the facets file.
|
|
51
|
+
* @returns The parsed and validated facets object.
|
|
52
|
+
*/
|
|
53
|
+
export declare const readDeployConfig: (filePath: string) => DeployConfig;
|
|
54
|
+
/**
|
|
55
|
+
* Saves the Diamond Config object to a file.
|
|
56
|
+
* @param filePath - The path to the facets file.
|
|
57
|
+
* @param data - The facets object to save.
|
|
58
|
+
*/
|
|
59
|
+
export declare const saveDeployConfig: (filePath: string, data: DeployConfig) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Updates a specific facet in the facets file.
|
|
62
|
+
* @param filePath - The path to the facets file.
|
|
63
|
+
* @param facetKey - The key of the facet to update.
|
|
64
|
+
* @param update - The partial update to apply to the facet.
|
|
65
|
+
* @returns The updated facets object.
|
|
66
|
+
*/
|
|
67
|
+
export declare const updateFacetConfig: (filePath: string, facetKey: string, update: Partial<DeployConfig["facets"][string]>) => DeployConfig;
|
|
68
|
+
/**
|
|
69
|
+
* Deletes a specific facet from the facets file.
|
|
70
|
+
* @param filePath - The path to the facets file.
|
|
71
|
+
* @param facetKey - The key of the facet to delete.
|
|
72
|
+
* @returns The updated facets object.
|
|
73
|
+
*/
|
|
74
|
+
export declare const deleteFacet: (filePath: string, facetKey: string) => DeployConfig;
|
|
75
|
+
/**
|
|
76
|
+
* Validates that the facets file exists, is valid JSON, and conforms to the schema.
|
|
77
|
+
* @param filePath - The path to the facets file.
|
|
78
|
+
* @returns A boolean indicating whether the file is valid.
|
|
79
|
+
*/
|
|
80
|
+
export declare const validateDeployConfig: (filePath: string) => boolean;
|
|
81
|
+
//# sourceMappingURL=jsonFileHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,OAA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
|
+
* These should all be synchronous and handle issues like empty files or non-existent files
|
|
6
|
+
* gracefully in a way that allows for control by the caller, e.g. gives the caller the
|
|
7
|
+
* ability to create an empty file on failure.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.validateDeployConfig = exports.deleteFacet = exports.updateFacetConfig = exports.saveDeployConfig = exports.readDeployConfig = void 0;
|
|
11
|
+
exports.readDeployFilePathDiamondNetwork = readDeployFilePathDiamondNetwork;
|
|
12
|
+
exports.readDeployFile = readDeployFile;
|
|
13
|
+
exports.defaultDeployment = defaultDeployment;
|
|
14
|
+
exports.createNewDeployFile = createNewDeployFile;
|
|
15
|
+
exports.writeDeployInfo = writeDeployInfo;
|
|
16
|
+
exports.updateDeployInfo = updateDeployInfo;
|
|
17
|
+
exports.deleteDeployInfo = deleteDeployInfo;
|
|
18
|
+
exports.validateDeployFile = validateDeployFile;
|
|
19
|
+
exports.loadFacetsConfig = loadFacetsConfig;
|
|
20
|
+
const fs_extra_1 = require("fs-extra");
|
|
21
|
+
const path_1 = require("path");
|
|
22
|
+
const DeploymentSchema_1 = require("../schemas/DeploymentSchema");
|
|
23
|
+
function readDeployFilePathDiamondNetwork(networkName, diamondName, deploymentId, deploymentsPath, createNew = false) {
|
|
24
|
+
const filePath = (0, path_1.join)(deploymentsPath, diamondName, `${deploymentId}.json`);
|
|
25
|
+
return readDeployFile(filePath, createNew);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Reads and validates a JSON file as DeployedDiamondData
|
|
29
|
+
* @param path - The path to the deployment file.
|
|
30
|
+
* @param createIfMissing - If true, creates a new deployment file with default values if
|
|
31
|
+
* the file does not exist. Otherwise this will throw an error if the file does not exist.
|
|
32
|
+
* @returns The parsed and validated deployment object.
|
|
33
|
+
*/
|
|
34
|
+
function readDeployFile(path, createNew = true) {
|
|
35
|
+
let raw;
|
|
36
|
+
if (!(0, fs_extra_1.pathExistsSync)(path) && createNew) {
|
|
37
|
+
createNewDeployFile(path);
|
|
38
|
+
raw = (0, fs_extra_1.readJsonSync)(path);
|
|
39
|
+
const parsed = DeploymentSchema_1.DeployedDiamondDataSchema.safeParse(raw);
|
|
40
|
+
if (!parsed.success) {
|
|
41
|
+
throw new Error(`Invalid deployment format: ${JSON.stringify(parsed.error.format(), null, 2)}`);
|
|
42
|
+
}
|
|
43
|
+
return parsed.data;
|
|
44
|
+
}
|
|
45
|
+
else if ((0, fs_extra_1.pathExistsSync)(path)) {
|
|
46
|
+
raw = (0, fs_extra_1.readJsonSync)(path);
|
|
47
|
+
const parsed = DeploymentSchema_1.DeployedDiamondDataSchema.safeParse(raw);
|
|
48
|
+
if (!parsed.success) {
|
|
49
|
+
throw new Error(`Invalid deployment format: ${JSON.stringify(parsed.error.format(), null, 2)}`);
|
|
50
|
+
}
|
|
51
|
+
return parsed.data;
|
|
52
|
+
}
|
|
53
|
+
// This is a mock deployment object with empty values
|
|
54
|
+
return defaultDeployment();
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Resolves the absolute path of a file relative to the project root.
|
|
58
|
+
* @param relativePath - The relative path to resolve.
|
|
59
|
+
* @returns The absolute path.
|
|
60
|
+
*/
|
|
61
|
+
const resolvePath = (relativePath) => {
|
|
62
|
+
return (0, path_1.resolve)(process.cwd(), relativePath);
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Default deployment object with empty values
|
|
66
|
+
* This is used to create a new deployment file if it does not exist or for a mock deployment.
|
|
67
|
+
* @type {DeployedDiamondData}
|
|
68
|
+
*/
|
|
69
|
+
function defaultDeployment() {
|
|
70
|
+
return {
|
|
71
|
+
DiamondAddress: "",
|
|
72
|
+
DeployerAddress: "",
|
|
73
|
+
DeployedFacets: {}, // Empty object for facets
|
|
74
|
+
ExternalLibraries: {}, // Empty object for external libraries
|
|
75
|
+
protocolVersion: 0, // Default protocol version
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Creates a new deployment file with default empty values
|
|
80
|
+
* @param path - The path to the deployment file.
|
|
81
|
+
*/
|
|
82
|
+
function createNewDeployFile(path) {
|
|
83
|
+
// Ensure the directory exists before writing
|
|
84
|
+
(0, fs_extra_1.ensureFileSync)(path);
|
|
85
|
+
// Validate the default deployment object before writing
|
|
86
|
+
const validated = DeploymentSchema_1.DeployedDiamondDataSchema.parse(defaultDeployment());
|
|
87
|
+
(0, fs_extra_1.writeJsonSync)(path, validated, { spaces: 2 });
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Writes JSON to file
|
|
91
|
+
*/
|
|
92
|
+
function writeDeployInfo(path, data) {
|
|
93
|
+
const validated = DeploymentSchema_1.DeployedDiamondDataSchema.parse(data);
|
|
94
|
+
(0, fs_extra_1.writeJsonSync)(path, validated, { spaces: 2 });
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Update deployment JSON file
|
|
98
|
+
*/
|
|
99
|
+
function updateDeployInfo(path, updater) {
|
|
100
|
+
const data = readDeployFile(path);
|
|
101
|
+
updater(data);
|
|
102
|
+
writeDeployInfo(path, data);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Deletes the deployment file
|
|
106
|
+
*/
|
|
107
|
+
function deleteDeployInfo(path) {
|
|
108
|
+
if ((0, fs_extra_1.pathExistsSync)(path)) {
|
|
109
|
+
(0, fs_extra_1.removeSync)(path);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Validates the Deployment File without loading it.
|
|
114
|
+
* @param path
|
|
115
|
+
* @returns
|
|
116
|
+
*/
|
|
117
|
+
function validateDeployFile(path) {
|
|
118
|
+
try {
|
|
119
|
+
if (!(0, fs_extra_1.pathExistsSync)(path)) {
|
|
120
|
+
console.log(`Deployment file not found: ${path}`);
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
const raw = (0, fs_extra_1.readJsonSync)(path);
|
|
124
|
+
DeploymentSchema_1.DeployedDiamondDataSchema.parse(raw);
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function loadFacetsConfig(deploymentsPath, diamondName) {
|
|
132
|
+
const file = (0, path_1.join)(deploymentsPath, diamondName, `${diamondName}.config.json`);
|
|
133
|
+
const valid = (0, exports.validateDeployConfig)(file);
|
|
134
|
+
const facets = (0, exports.readDeployConfig)(file);
|
|
135
|
+
return facets;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Loads and validates the facets config <diamondName>.config.json file.
|
|
139
|
+
* @param filePath - The path to the facets file.
|
|
140
|
+
* @returns The parsed and validated facets object.
|
|
141
|
+
*/
|
|
142
|
+
const readDeployConfig = (filePath) => {
|
|
143
|
+
try {
|
|
144
|
+
const fullPath = resolvePath(filePath);
|
|
145
|
+
// Read the JSON file
|
|
146
|
+
const raw = (0, fs_extra_1.readJsonSync)(fullPath);
|
|
147
|
+
// Validate and parse the JSON data
|
|
148
|
+
return DeploymentSchema_1.DeployConfigSchema.parse(raw);
|
|
149
|
+
}
|
|
150
|
+
catch (e) {
|
|
151
|
+
console.error('Failed to load facets:', e);
|
|
152
|
+
throw e;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
exports.readDeployConfig = readDeployConfig;
|
|
156
|
+
/**
|
|
157
|
+
* Saves the Diamond Config object to a file.
|
|
158
|
+
* @param filePath - The path to the facets file.
|
|
159
|
+
* @param data - The facets object to save.
|
|
160
|
+
*/
|
|
161
|
+
const saveDeployConfig = (filePath, data) => {
|
|
162
|
+
const fullPath = resolvePath(filePath);
|
|
163
|
+
(0, fs_extra_1.ensureFileSync)(fullPath);
|
|
164
|
+
(0, fs_extra_1.writeJsonSync)(fullPath, data, { spaces: 2 });
|
|
165
|
+
};
|
|
166
|
+
exports.saveDeployConfig = saveDeployConfig;
|
|
167
|
+
/**
|
|
168
|
+
* Updates a specific facet in the facets file.
|
|
169
|
+
* @param filePath - The path to the facets file.
|
|
170
|
+
* @param facetKey - The key of the facet to update.
|
|
171
|
+
* @param update - The partial update to apply to the facet.
|
|
172
|
+
* @returns The updated facets object.
|
|
173
|
+
*/
|
|
174
|
+
const updateFacetConfig = (filePath, facetKey, update) => {
|
|
175
|
+
const deployConfig = (0, exports.readDeployConfig)(filePath);
|
|
176
|
+
deployConfig.facets[facetKey] = {
|
|
177
|
+
...(deployConfig.facets[facetKey] || {}),
|
|
178
|
+
...update,
|
|
179
|
+
};
|
|
180
|
+
(0, exports.saveDeployConfig)(filePath, deployConfig);
|
|
181
|
+
return deployConfig;
|
|
182
|
+
};
|
|
183
|
+
exports.updateFacetConfig = updateFacetConfig;
|
|
184
|
+
/**
|
|
185
|
+
* Deletes a specific facet from the facets file.
|
|
186
|
+
* @param filePath - The path to the facets file.
|
|
187
|
+
* @param facetKey - The key of the facet to delete.
|
|
188
|
+
* @returns The updated facets object.
|
|
189
|
+
*/
|
|
190
|
+
const deleteFacet = (filePath, facetKey) => {
|
|
191
|
+
const deployConfig = (0, exports.readDeployConfig)(filePath);
|
|
192
|
+
delete deployConfig.facets[facetKey];
|
|
193
|
+
(0, exports.saveDeployConfig)(filePath, deployConfig);
|
|
194
|
+
return deployConfig;
|
|
195
|
+
};
|
|
196
|
+
exports.deleteFacet = deleteFacet;
|
|
197
|
+
/**
|
|
198
|
+
* Validates that the facets file exists, is valid JSON, and conforms to the schema.
|
|
199
|
+
* @param filePath - The path to the facets file.
|
|
200
|
+
* @returns A boolean indicating whether the file is valid.
|
|
201
|
+
*/
|
|
202
|
+
const validateDeployConfig = (filePath) => {
|
|
203
|
+
try {
|
|
204
|
+
const fullPath = resolvePath(filePath);
|
|
205
|
+
// Check if the file exists
|
|
206
|
+
if (!(0, fs_extra_1.existsSync)(fullPath)) {
|
|
207
|
+
console.error(`Validation failed: File does not exist at path "${filePath}"`);
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
// Read the file and parse it as JSON
|
|
211
|
+
const raw = (0, fs_extra_1.readJsonSync)(fullPath);
|
|
212
|
+
// Validate the JSON against the schema
|
|
213
|
+
DeploymentSchema_1.DeployConfigSchema.parse(raw);
|
|
214
|
+
// If all checks pass, return true
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
catch (e) {
|
|
218
|
+
console.error('Validation failed:', e);
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
exports.validateDeployConfig = validateDeployConfig;
|
|
223
|
+
//# sourceMappingURL=jsonFileHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonFileHandler.js","sourceRoot":"","sources":["../../src/repositories/jsonFileHandler.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAkBH,4EASC;AASD,wCAwBC;AAgBD,8CAQC;AAKD,kDAMC;AAKD,0CAGC;AAKD,4CAIC;AAKD,4CAIC;AAOD,gDAYC;AAED,4CASC;AArJD,uCAOkB;AAClB,+BAAqC;AACrC,kEAKqC;AAErC,SAAgB,gCAAgC,CAC9C,WAAmB,EACnB,WAAmB,EACnB,YAAoB,EACpB,eAAuB,EACvB,YAAqB,KAAK;IAE1B,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,eAAe,EAAE,WAAW,EAAE,GAAG,YAAY,OAAO,CAAC,CAAC;IAC5E,OAAO,cAAc,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,YAAqB,IAAI;IAEpE,IAAI,GAAY,CAAC;IACjB,IAAI,CAAC,IAAA,yBAAc,EAAC,IAAI,CAAC,IAAI,SAAS,EAAE,CAAC;QACvC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC1B,GAAG,GAAG,IAAA,uBAAY,EAAC,IAAI,CAAC,CAAC;QAEzB,MAAM,MAAM,GAAG,4CAAyB,CAAC,SAAS,CAAC,GAAG,CAAC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,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAA;AAtBY,QAAA,oBAAoB,wBAsBhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=prismaDBHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prismaDBHandler.d.ts","sourceRoot":"","sources":["../../src/repositories/prismaDBHandler.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// // databaseHandler.ts (Prisma example)
|
|
3
|
+
// import { prisma } from './prisma';
|
|
4
|
+
// import { DeployedDiamondData, DeployConfig } from '../schemas';
|
|
5
|
+
// export async function readDeployedDiamondData(network: string, diamond: string): Promise<DeployedDiamondData> {
|
|
6
|
+
// const record = await prisma.deployment.findUnique({
|
|
7
|
+
// where: { network_diamond: { network, diamond } }
|
|
8
|
+
// });
|
|
9
|
+
// return record?.info as DeployedDiamondData;
|
|
10
|
+
// }
|
|
11
|
+
//# sourceMappingURL=prismaDBHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|