@maci-protocol/coordinator 0.0.0-ci.00107eb
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/CHANGELOG.md +51 -0
- package/LICENSE +21 -0
- package/README.md +103 -0
- package/build/hardhat.config.cjs +39 -0
- package/build/hardhat.config.cjs.map +1 -0
- package/build/hardhat.config.d.cts +27 -0
- package/build/hardhat.config.d.cts.map +1 -0
- package/build/scripts/generateKeypair.d.ts +2 -0
- package/build/scripts/generateKeypair.d.ts.map +1 -0
- package/build/scripts/generateKeypair.js +25 -0
- package/build/scripts/generateKeypair.js.map +1 -0
- package/build/scripts/generateMaciKeyPair.d.ts +2 -0
- package/build/scripts/generateMaciKeyPair.d.ts.map +1 -0
- package/build/scripts/generateMaciKeyPair.js +3 -0
- package/build/scripts/generateMaciKeyPair.js.map +1 -0
- package/build/scripts/getAuthHeader.d.ts +2 -0
- package/build/scripts/getAuthHeader.d.ts.map +1 -0
- package/build/scripts/getAuthHeader.js +31 -0
- package/build/scripts/getAuthHeader.js.map +1 -0
- package/build/tests/constants.d.ts +7 -0
- package/build/tests/constants.d.ts.map +1 -0
- package/build/tests/constants.js +11 -0
- package/build/tests/constants.js.map +1 -0
- package/build/tests/e2e.deploy.test.d.ts +2 -0
- package/build/tests/e2e.deploy.test.d.ts.map +1 -0
- package/build/tests/e2e.deploy.test.js +264 -0
- package/build/tests/e2e.deploy.test.js.map +1 -0
- package/build/tests/e2e.redis.test.d.ts +2 -0
- package/build/tests/e2e.redis.test.d.ts.map +1 -0
- package/build/tests/e2e.redis.test.js +118 -0
- package/build/tests/e2e.redis.test.js.map +1 -0
- package/build/tests/utils.d.ts +20 -0
- package/build/tests/utils.d.ts.map +1 -0
- package/build/tests/utils.js +55 -0
- package/build/tests/utils.js.map +1 -0
- package/build/ts/app.module.d.ts +3 -0
- package/build/ts/app.module.d.ts.map +1 -0
- package/build/ts/app.module.js +42 -0
- package/build/ts/app.module.js.map +1 -0
- package/build/ts/auth/AccountSignatureGuard.service.d.ts +44 -0
- package/build/ts/auth/AccountSignatureGuard.service.d.ts.map +1 -0
- package/build/ts/auth/AccountSignatureGuard.service.js +96 -0
- package/build/ts/auth/AccountSignatureGuard.service.js.map +1 -0
- package/build/ts/auth/__tests__/AccountSignatureGuard.test.d.ts +2 -0
- package/build/ts/auth/__tests__/AccountSignatureGuard.test.d.ts.map +1 -0
- package/build/ts/auth/__tests__/AccountSignatureGuard.test.js +113 -0
- package/build/ts/auth/__tests__/AccountSignatureGuard.test.js.map +1 -0
- package/build/ts/common/__tests__/common.test.d.ts +2 -0
- package/build/ts/common/__tests__/common.test.d.ts.map +1 -0
- package/build/ts/common/__tests__/common.test.js +77 -0
- package/build/ts/common/__tests__/common.test.js.map +1 -0
- package/build/ts/common/accountAbstraction.d.ts +38 -0
- package/build/ts/common/accountAbstraction.d.ts.map +1 -0
- package/build/ts/common/accountAbstraction.js +83 -0
- package/build/ts/common/accountAbstraction.js.map +1 -0
- package/build/ts/common/chain.d.ts +22 -0
- package/build/ts/common/chain.d.ts.map +1 -0
- package/build/ts/common/chain.js +37 -0
- package/build/ts/common/chain.js.map +1 -0
- package/build/ts/common/coordinatorKeypair.d.ts +7 -0
- package/build/ts/common/coordinatorKeypair.d.ts.map +1 -0
- package/build/ts/common/coordinatorKeypair.js +14 -0
- package/build/ts/common/coordinatorKeypair.js.map +1 -0
- package/build/ts/common/errors.d.ts +36 -0
- package/build/ts/common/errors.d.ts.map +1 -0
- package/build/ts/common/errors.js +37 -0
- package/build/ts/common/errors.js.map +1 -0
- package/build/ts/common/http.d.ts +6 -0
- package/build/ts/common/http.d.ts.map +1 -0
- package/build/ts/common/http.js +49 -0
- package/build/ts/common/http.js.map +1 -0
- package/build/ts/common/index.d.ts +6 -0
- package/build/ts/common/index.d.ts.map +1 -0
- package/build/ts/common/index.js +6 -0
- package/build/ts/common/index.js.map +1 -0
- package/build/ts/common/networks.d.ts +10 -0
- package/build/ts/common/networks.d.ts.map +1 -0
- package/build/ts/common/networks.js +61 -0
- package/build/ts/common/networks.js.map +1 -0
- package/build/ts/common/types.d.ts +8 -0
- package/build/ts/common/types.d.ts.map +1 -0
- package/build/ts/common/types.js +2 -0
- package/build/ts/common/types.js.map +1 -0
- package/build/ts/crypto/__tests__/crypto.service.test.d.ts +2 -0
- package/build/ts/crypto/__tests__/crypto.service.test.d.ts.map +1 -0
- package/build/ts/crypto/__tests__/crypto.service.test.js +26 -0
- package/build/ts/crypto/__tests__/crypto.service.test.js.map +1 -0
- package/build/ts/crypto/crypto.module.d.ts +3 -0
- package/build/ts/crypto/crypto.module.d.ts.map +1 -0
- package/build/ts/crypto/crypto.module.js +18 -0
- package/build/ts/crypto/crypto.module.js.map +1 -0
- package/build/ts/crypto/crypto.service.d.ts +31 -0
- package/build/ts/crypto/crypto.service.d.ts.map +1 -0
- package/build/ts/crypto/crypto.service.js +68 -0
- package/build/ts/crypto/crypto.service.js.map +1 -0
- package/build/ts/deployer/__tests__/deployer.controller.test.d.ts +2 -0
- package/build/ts/deployer/__tests__/deployer.controller.test.d.ts.map +1 -0
- package/build/ts/deployer/__tests__/deployer.controller.test.js +82 -0
- package/build/ts/deployer/__tests__/deployer.controller.test.js.map +1 -0
- package/build/ts/deployer/__tests__/deployer.service.test.d.ts +2 -0
- package/build/ts/deployer/__tests__/deployer.service.test.d.ts.map +1 -0
- package/build/ts/deployer/__tests__/deployer.service.test.js +272 -0
- package/build/ts/deployer/__tests__/deployer.service.test.js.map +1 -0
- package/build/ts/deployer/__tests__/utils.d.ts +61 -0
- package/build/ts/deployer/__tests__/utils.d.ts.map +1 -0
- package/build/ts/deployer/__tests__/utils.js +122 -0
- package/build/ts/deployer/__tests__/utils.js.map +1 -0
- package/build/ts/deployer/constants.d.ts +13 -0
- package/build/ts/deployer/constants.d.ts.map +1 -0
- package/build/ts/deployer/constants.js +13 -0
- package/build/ts/deployer/constants.js.map +1 -0
- package/build/ts/deployer/deployer.controller.d.ts +34 -0
- package/build/ts/deployer/deployer.controller.d.ts.map +1 -0
- package/build/ts/deployer/deployer.controller.js +102 -0
- package/build/ts/deployer/deployer.controller.js.map +1 -0
- package/build/ts/deployer/deployer.module.d.ts +3 -0
- package/build/ts/deployer/deployer.module.d.ts.map +1 -0
- package/build/ts/deployer/deployer.module.js +23 -0
- package/build/ts/deployer/deployer.module.js.map +1 -0
- package/build/ts/deployer/deployer.service.d.ts +85 -0
- package/build/ts/deployer/deployer.service.d.ts.map +1 -0
- package/build/ts/deployer/deployer.service.js +505 -0
- package/build/ts/deployer/deployer.service.js.map +1 -0
- package/build/ts/deployer/dto.d.ts +46 -0
- package/build/ts/deployer/dto.d.ts.map +1 -0
- package/build/ts/deployer/dto.js +125 -0
- package/build/ts/deployer/dto.js.map +1 -0
- package/build/ts/deployer/types.d.ts +351 -0
- package/build/ts/deployer/types.d.ts.map +1 -0
- package/build/ts/deployer/types.js +2 -0
- package/build/ts/deployer/types.js.map +1 -0
- package/build/ts/file/__tests__/file.service.test.d.ts +2 -0
- package/build/ts/file/__tests__/file.service.test.d.ts.map +1 -0
- package/build/ts/file/__tests__/file.service.test.js +77 -0
- package/build/ts/file/__tests__/file.service.test.js.map +1 -0
- package/build/ts/file/file.module.d.ts +3 -0
- package/build/ts/file/file.module.d.ts.map +1 -0
- package/build/ts/file/file.module.js +18 -0
- package/build/ts/file/file.module.js.map +1 -0
- package/build/ts/file/file.service.d.ts +63 -0
- package/build/ts/file/file.service.d.ts.map +1 -0
- package/build/ts/file/file.service.js +121 -0
- package/build/ts/file/file.service.js.map +1 -0
- package/build/ts/file/types.d.ts +36 -0
- package/build/ts/file/types.d.ts.map +1 -0
- package/build/ts/file/types.js +2 -0
- package/build/ts/file/types.js.map +1 -0
- package/build/ts/health/__tests__/health.controller.test.d.ts +2 -0
- package/build/ts/health/__tests__/health.controller.test.d.ts.map +1 -0
- package/build/ts/health/__tests__/health.controller.test.js +52 -0
- package/build/ts/health/__tests__/health.controller.test.js.map +1 -0
- package/build/ts/health/__tests__/health.service.test.d.ts +2 -0
- package/build/ts/health/__tests__/health.service.test.d.ts.map +1 -0
- package/build/ts/health/__tests__/health.service.test.js +101 -0
- package/build/ts/health/__tests__/health.service.test.js.map +1 -0
- package/build/ts/health/health.controller.d.ts +16 -0
- package/build/ts/health/health.controller.d.ts.map +1 -0
- package/build/ts/health/health.controller.js +43 -0
- package/build/ts/health/health.controller.js.map +1 -0
- package/build/ts/health/health.module.d.ts +3 -0
- package/build/ts/health/health.module.d.ts.map +1 -0
- package/build/ts/health/health.module.js +22 -0
- package/build/ts/health/health.module.js.map +1 -0
- package/build/ts/health/health.service.d.ts +42 -0
- package/build/ts/health/health.service.d.ts.map +1 -0
- package/build/ts/health/health.service.js +176 -0
- package/build/ts/health/health.service.js.map +1 -0
- package/build/ts/health/types.d.ts +87 -0
- package/build/ts/health/types.d.ts.map +1 -0
- package/build/ts/health/types.js +2 -0
- package/build/ts/health/types.js.map +1 -0
- package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.d.ts +11 -0
- package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.d.ts.map +1 -0
- package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.js +12 -0
- package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.js.map +1 -0
- package/build/ts/jest/setup.d.ts +8 -0
- package/build/ts/jest/setup.d.ts.map +1 -0
- package/build/ts/jest/setup.js +2 -0
- package/build/ts/jest/setup.js.map +1 -0
- package/build/ts/jest/transform.d.ts +8 -0
- package/build/ts/jest/transform.d.ts.map +1 -0
- package/build/ts/jest/transform.js +10 -0
- package/build/ts/jest/transform.js.map +1 -0
- package/build/ts/main.d.ts +2 -0
- package/build/ts/main.d.ts.map +1 -0
- package/build/ts/main.js +46 -0
- package/build/ts/main.js.map +1 -0
- package/build/ts/proof/__tests__/proof.controller.test.d.ts +2 -0
- package/build/ts/proof/__tests__/proof.controller.test.d.ts.map +1 -0
- package/build/ts/proof/__tests__/proof.controller.test.js +90 -0
- package/build/ts/proof/__tests__/proof.controller.test.js.map +1 -0
- package/build/ts/proof/__tests__/proof.gateway.test.d.ts +2 -0
- package/build/ts/proof/__tests__/proof.gateway.test.d.ts.map +1 -0
- package/build/ts/proof/__tests__/proof.gateway.test.js +63 -0
- package/build/ts/proof/__tests__/proof.gateway.test.js.map +1 -0
- package/build/ts/proof/__tests__/proof.service.test.d.ts +2 -0
- package/build/ts/proof/__tests__/proof.service.test.d.ts.map +1 -0
- package/build/ts/proof/__tests__/proof.service.test.js +84 -0
- package/build/ts/proof/__tests__/proof.service.test.js.map +1 -0
- package/build/ts/proof/dto.d.ts +70 -0
- package/build/ts/proof/dto.d.ts.map +1 -0
- package/build/ts/proof/dto.js +261 -0
- package/build/ts/proof/dto.js.map +1 -0
- package/build/ts/proof/proof.controller.d.ts +47 -0
- package/build/ts/proof/proof.controller.d.ts.map +1 -0
- package/build/ts/proof/proof.controller.js +158 -0
- package/build/ts/proof/proof.controller.js.map +1 -0
- package/build/ts/proof/proof.gateway.d.ts +35 -0
- package/build/ts/proof/proof.gateway.d.ts.map +1 -0
- package/build/ts/proof/proof.gateway.js +93 -0
- package/build/ts/proof/proof.gateway.js.map +1 -0
- package/build/ts/proof/proof.module.d.ts +3 -0
- package/build/ts/proof/proof.module.d.ts.map +1 -0
- package/build/ts/proof/proof.module.js +25 -0
- package/build/ts/proof/proof.module.js.map +1 -0
- package/build/ts/proof/proof.service.d.ts +52 -0
- package/build/ts/proof/proof.service.d.ts.map +1 -0
- package/build/ts/proof/proof.service.js +164 -0
- package/build/ts/proof/proof.service.js.map +1 -0
- package/build/ts/proof/types.d.ts +144 -0
- package/build/ts/proof/types.d.ts.map +1 -0
- package/build/ts/proof/types.js +11 -0
- package/build/ts/proof/types.js.map +1 -0
- package/build/ts/redis/__tests__/redis.service.test.d.ts +2 -0
- package/build/ts/redis/__tests__/redis.service.test.d.ts.map +1 -0
- package/build/ts/redis/__tests__/redis.service.test.js +148 -0
- package/build/ts/redis/__tests__/redis.service.test.js.map +1 -0
- package/build/ts/redis/redis.module.d.ts +3 -0
- package/build/ts/redis/redis.module.d.ts.map +1 -0
- package/build/ts/redis/redis.module.js +18 -0
- package/build/ts/redis/redis.module.js.map +1 -0
- package/build/ts/redis/redis.service.d.ts +53 -0
- package/build/ts/redis/redis.service.d.ts.map +1 -0
- package/build/ts/redis/redis.service.js +99 -0
- package/build/ts/redis/redis.service.js.map +1 -0
- package/build/ts/redis/types.d.ts +66 -0
- package/build/ts/redis/types.d.ts.map +1 -0
- package/build/ts/redis/types.js +2 -0
- package/build/ts/redis/types.js.map +1 -0
- package/build/ts/redis/utils.d.ts +20 -0
- package/build/ts/redis/utils.d.ts.map +1 -0
- package/build/ts/redis/utils.js +27 -0
- package/build/ts/redis/utils.js.map +1 -0
- package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts +2 -0
- package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts.map +1 -0
- package/build/ts/scheduler/__tests__/scheduler.controller.test.js +62 -0
- package/build/ts/scheduler/__tests__/scheduler.controller.test.js.map +1 -0
- package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts +2 -0
- package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts.map +1 -0
- package/build/ts/scheduler/__tests__/scheduler.service.test.js +369 -0
- package/build/ts/scheduler/__tests__/scheduler.service.test.js.map +1 -0
- package/build/ts/scheduler/dto.d.ts +41 -0
- package/build/ts/scheduler/dto.d.ts.map +1 -0
- package/build/ts/scheduler/dto.js +115 -0
- package/build/ts/scheduler/dto.js.map +1 -0
- package/build/ts/scheduler/scheduler.controller.d.ts +32 -0
- package/build/ts/scheduler/scheduler.controller.d.ts.map +1 -0
- package/build/ts/scheduler/scheduler.controller.js +118 -0
- package/build/ts/scheduler/scheduler.controller.js.map +1 -0
- package/build/ts/scheduler/scheduler.module.d.ts +3 -0
- package/build/ts/scheduler/scheduler.module.d.ts.map +1 -0
- package/build/ts/scheduler/scheduler.module.js +24 -0
- package/build/ts/scheduler/scheduler.module.js.map +1 -0
- package/build/ts/scheduler/scheduler.service.d.ts +71 -0
- package/build/ts/scheduler/scheduler.service.d.ts.map +1 -0
- package/build/ts/scheduler/scheduler.service.js +297 -0
- package/build/ts/scheduler/scheduler.service.js.map +1 -0
- package/build/ts/scheduler/types.d.ts +65 -0
- package/build/ts/scheduler/types.d.ts.map +1 -0
- package/build/ts/scheduler/types.js +2 -0
- package/build/ts/scheduler/types.js.map +1 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.d.ts +2 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.d.ts.map +1 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js +44 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js.map +1 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.d.ts +2 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.d.ts.map +1 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js +76 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js.map +1 -0
- package/build/ts/sessionKeys/__tests__/utils.d.ts +25 -0
- package/build/ts/sessionKeys/__tests__/utils.d.ts.map +1 -0
- package/build/ts/sessionKeys/__tests__/utils.js +65 -0
- package/build/ts/sessionKeys/__tests__/utils.js.map +1 -0
- package/build/ts/sessionKeys/dto.d.ts +11 -0
- package/build/ts/sessionKeys/dto.d.ts.map +1 -0
- package/build/ts/sessionKeys/dto.js +29 -0
- package/build/ts/sessionKeys/dto.js.map +1 -0
- package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts +53 -0
- package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts.map +1 -0
- package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js +105 -0
- package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.controller.d.ts +26 -0
- package/build/ts/sessionKeys/sessionKeys.controller.d.ts.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.controller.js +74 -0
- package/build/ts/sessionKeys/sessionKeys.controller.js.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.module.d.ts +3 -0
- package/build/ts/sessionKeys/sessionKeys.module.d.ts.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.module.js +23 -0
- package/build/ts/sessionKeys/sessionKeys.module.js.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.service.d.ts +62 -0
- package/build/ts/sessionKeys/sessionKeys.service.d.ts.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.service.js +121 -0
- package/build/ts/sessionKeys/sessionKeys.service.js.map +1 -0
- package/build/ts/sessionKeys/types.d.ts +11 -0
- package/build/ts/sessionKeys/types.d.ts.map +1 -0
- package/build/ts/sessionKeys/types.js +2 -0
- package/build/ts/sessionKeys/types.js.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.controller.test.d.ts +2 -0
- package/build/ts/subgraph/__tests__/subgraph.controller.test.d.ts.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.controller.test.js +50 -0
- package/build/ts/subgraph/__tests__/subgraph.controller.test.js.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.gateway.test.d.ts +2 -0
- package/build/ts/subgraph/__tests__/subgraph.gateway.test.d.ts.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.gateway.test.js +83 -0
- package/build/ts/subgraph/__tests__/subgraph.gateway.test.js.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.service.test.d.ts +2 -0
- package/build/ts/subgraph/__tests__/subgraph.service.test.d.ts.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.service.test.js +58 -0
- package/build/ts/subgraph/__tests__/subgraph.service.test.js.map +1 -0
- package/build/ts/subgraph/dto.d.ts +27 -0
- package/build/ts/subgraph/dto.d.ts.map +1 -0
- package/build/ts/subgraph/dto.js +83 -0
- package/build/ts/subgraph/dto.js.map +1 -0
- package/build/ts/subgraph/subgraph.controller.d.ts +24 -0
- package/build/ts/subgraph/subgraph.controller.d.ts.map +1 -0
- package/build/ts/subgraph/subgraph.controller.js +71 -0
- package/build/ts/subgraph/subgraph.controller.js.map +1 -0
- package/build/ts/subgraph/subgraph.gateway.d.ts +35 -0
- package/build/ts/subgraph/subgraph.gateway.d.ts.map +1 -0
- package/build/ts/subgraph/subgraph.gateway.js +93 -0
- package/build/ts/subgraph/subgraph.gateway.js.map +1 -0
- package/build/ts/subgraph/subgraph.module.d.ts +3 -0
- package/build/ts/subgraph/subgraph.module.d.ts.map +1 -0
- package/build/ts/subgraph/subgraph.module.js +23 -0
- package/build/ts/subgraph/subgraph.module.js.map +1 -0
- package/build/ts/subgraph/subgraph.service.d.ts +24 -0
- package/build/ts/subgraph/subgraph.service.d.ts.map +1 -0
- package/build/ts/subgraph/subgraph.service.js +119 -0
- package/build/ts/subgraph/subgraph.service.js.map +1 -0
- package/build/ts/subgraph/types.d.ts +93 -0
- package/build/ts/subgraph/types.d.ts.map +1 -0
- package/build/ts/subgraph/types.js +24 -0
- package/build/ts/subgraph/types.js.map +1 -0
- package/build/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +131 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error codes that are used for api responses
|
|
3
|
+
*/
|
|
4
|
+
export var ErrorCodes;
|
|
5
|
+
(function (ErrorCodes) {
|
|
6
|
+
ErrorCodes[ErrorCodes["NOT_MERGED_STATE_TREE"] = 0] = "NOT_MERGED_STATE_TREE";
|
|
7
|
+
ErrorCodes[ErrorCodes["PRIVATE_KEY_MISMATCH"] = 1] = "PRIVATE_KEY_MISMATCH";
|
|
8
|
+
ErrorCodes[ErrorCodes["POLL_NOT_FOUND"] = 2] = "POLL_NOT_FOUND";
|
|
9
|
+
ErrorCodes[ErrorCodes["DECRYPTION"] = 3] = "DECRYPTION";
|
|
10
|
+
ErrorCodes[ErrorCodes["ENCRYPTION"] = 4] = "ENCRYPTION";
|
|
11
|
+
ErrorCodes[ErrorCodes["FILE_NOT_FOUND"] = 5] = "FILE_NOT_FOUND";
|
|
12
|
+
ErrorCodes[ErrorCodes["SUBGRAPH_DEPLOY"] = 6] = "SUBGRAPH_DEPLOY";
|
|
13
|
+
ErrorCodes[ErrorCodes["SUBGRAPH_DEPLOY_KEY_NOT_FOUND"] = 7] = "SUBGRAPH_DEPLOY_KEY_NOT_FOUND";
|
|
14
|
+
ErrorCodes[ErrorCodes["SESSION_KEY_NOT_FOUND"] = 8] = "SESSION_KEY_NOT_FOUND";
|
|
15
|
+
ErrorCodes[ErrorCodes["INVALID_APPROVAL"] = 9] = "INVALID_APPROVAL";
|
|
16
|
+
ErrorCodes[ErrorCodes["UNSUPPORTED_NETWORK"] = 10] = "UNSUPPORTED_NETWORK";
|
|
17
|
+
ErrorCodes[ErrorCodes["COORDINATOR_RPC_URL_NOT_SET"] = 11] = "COORDINATOR_RPC_URL_NOT_SET";
|
|
18
|
+
ErrorCodes[ErrorCodes["FAILED_TO_MERGE_STATE_TREE"] = 12] = "FAILED_TO_MERGE_STATE_TREE";
|
|
19
|
+
ErrorCodes[ErrorCodes["FAILED_TO_MERGE_MESSAGE_SUBTREES"] = 13] = "FAILED_TO_MERGE_MESSAGE_SUBTREES";
|
|
20
|
+
ErrorCodes[ErrorCodes["FAILED_TO_MERGE_MESSAGE_TREE"] = 14] = "FAILED_TO_MERGE_MESSAGE_TREE";
|
|
21
|
+
ErrorCodes[ErrorCodes["UNSUPPORTED_VOICE_CREDIT_PROXY_FACTORY"] = 15] = "UNSUPPORTED_VOICE_CREDIT_PROXY_FACTORY";
|
|
22
|
+
ErrorCodes[ErrorCodes["UNSUPPORTED_VOICE_CREDIT_PROXY"] = 16] = "UNSUPPORTED_VOICE_CREDIT_PROXY";
|
|
23
|
+
ErrorCodes[ErrorCodes["UNSUPPORTED_POLICY"] = 17] = "UNSUPPORTED_POLICY";
|
|
24
|
+
ErrorCodes[ErrorCodes["FAILED_TO_DEPLOY_CONTRACT"] = 18] = "FAILED_TO_DEPLOY_CONTRACT";
|
|
25
|
+
ErrorCodes[ErrorCodes["FAILED_TO_SET_MACI_INSTANCE_ON_POLICY"] = 19] = "FAILED_TO_SET_MACI_INSTANCE_ON_POLICY";
|
|
26
|
+
ErrorCodes[ErrorCodes["MACI_NOT_DEPLOYED"] = 20] = "MACI_NOT_DEPLOYED";
|
|
27
|
+
ErrorCodes[ErrorCodes["VERIFIER_NOT_DEPLOYED"] = 21] = "VERIFIER_NOT_DEPLOYED";
|
|
28
|
+
ErrorCodes[ErrorCodes["VERIFYING_KEYS_REGISTRY_NOT_DEPLOYED"] = 22] = "VERIFYING_KEYS_REGISTRY_NOT_DEPLOYED";
|
|
29
|
+
ErrorCodes[ErrorCodes["FAILED_TO_SET_VERIFYING_KEYS"] = 23] = "FAILED_TO_SET_VERIFYING_KEYS";
|
|
30
|
+
ErrorCodes[ErrorCodes["FAILED_TO_DEPLOY_MACI"] = 24] = "FAILED_TO_DEPLOY_MACI";
|
|
31
|
+
ErrorCodes[ErrorCodes["FAILED_TO_DEPLOY_POLL"] = 25] = "FAILED_TO_DEPLOY_POLL";
|
|
32
|
+
ErrorCodes[ErrorCodes["NOT_MERGED_MESSAGE_TREE"] = 26] = "NOT_MERGED_MESSAGE_TREE";
|
|
33
|
+
ErrorCodes[ErrorCodes["FAILED_TO_UPDATE_SCHEDULED_POLL"] = 27] = "FAILED_TO_UPDATE_SCHEDULED_POLL";
|
|
34
|
+
ErrorCodes[ErrorCodes["POLL_ALREADY_SCHEDULED"] = 28] = "POLL_ALREADY_SCHEDULED";
|
|
35
|
+
ErrorCodes[ErrorCodes["POLL_ALREADY_TALLIED"] = 29] = "POLL_ALREADY_TALLIED";
|
|
36
|
+
})(ErrorCodes || (ErrorCodes = {}));
|
|
37
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../ts/common/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,UA+BX;AA/BD,WAAY,UAAU;IACpB,6EAAqB,CAAA;IACrB,2EAAoB,CAAA;IACpB,+DAAc,CAAA;IACd,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,+DAAc,CAAA;IACd,iEAAe,CAAA;IACf,6FAA6B,CAAA;IAC7B,6EAAqB,CAAA;IACrB,mEAAgB,CAAA;IAChB,0EAAmB,CAAA;IACnB,0FAA2B,CAAA;IAC3B,wFAA0B,CAAA;IAC1B,oGAAgC,CAAA;IAChC,4FAA4B,CAAA;IAC5B,gHAAsC,CAAA;IACtC,gGAA8B,CAAA;IAC9B,wEAAkB,CAAA;IAClB,sFAAyB,CAAA;IACzB,8GAAqC,CAAA;IACrC,sEAAiB,CAAA;IACjB,8EAAqB,CAAA;IACrB,4GAAoC,CAAA;IACpC,4FAA4B,CAAA;IAC5B,8EAAqB,CAAA;IACrB,8EAAqB,CAAA;IACrB,kFAAuB,CAAA;IACvB,kGAA+B,CAAA;IAC/B,gFAAsB,CAAA;IACtB,4EAAoB,CAAA;AACtB,CAAC,EA/BW,UAAU,KAAV,UAAU,QA+BrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../ts/common/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI5C;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,CAiD7D"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { HttpStatus } from "@nestjs/common";
|
|
2
|
+
import { ErrorCodes } from "./errors";
|
|
3
|
+
/**
|
|
4
|
+
* Map a thrown error (usually containing ErrorCodes) to an appropriate HTTP status
|
|
5
|
+
*/
|
|
6
|
+
export function mapErrorToHttpStatus(error) {
|
|
7
|
+
const { message } = error;
|
|
8
|
+
switch (message) {
|
|
9
|
+
case ErrorCodes.UNSUPPORTED_NETWORK.toString():
|
|
10
|
+
case ErrorCodes.UNSUPPORTED_VOICE_CREDIT_PROXY_FACTORY.toString():
|
|
11
|
+
case ErrorCodes.UNSUPPORTED_VOICE_CREDIT_PROXY.toString():
|
|
12
|
+
case ErrorCodes.UNSUPPORTED_POLICY.toString():
|
|
13
|
+
return HttpStatus.BAD_REQUEST;
|
|
14
|
+
case ErrorCodes.INVALID_APPROVAL.toString():
|
|
15
|
+
return HttpStatus.FORBIDDEN;
|
|
16
|
+
case ErrorCodes.SESSION_KEY_NOT_FOUND.toString():
|
|
17
|
+
case ErrorCodes.POLL_NOT_FOUND.toString():
|
|
18
|
+
return HttpStatus.NOT_FOUND;
|
|
19
|
+
case ErrorCodes.POLL_ALREADY_SCHEDULED.toString():
|
|
20
|
+
case ErrorCodes.POLL_ALREADY_TALLIED.toString():
|
|
21
|
+
case ErrorCodes.NOT_MERGED_STATE_TREE.toString():
|
|
22
|
+
case ErrorCodes.NOT_MERGED_MESSAGE_TREE.toString():
|
|
23
|
+
return HttpStatus.CONFLICT;
|
|
24
|
+
case ErrorCodes.MACI_NOT_DEPLOYED.toString():
|
|
25
|
+
case ErrorCodes.VERIFIER_NOT_DEPLOYED.toString():
|
|
26
|
+
case ErrorCodes.VERIFYING_KEYS_REGISTRY_NOT_DEPLOYED.toString():
|
|
27
|
+
return HttpStatus.PRECONDITION_FAILED;
|
|
28
|
+
case ErrorCodes.FILE_NOT_FOUND.toString():
|
|
29
|
+
case ErrorCodes.SUBGRAPH_DEPLOY_KEY_NOT_FOUND.toString():
|
|
30
|
+
case ErrorCodes.SUBGRAPH_DEPLOY.toString():
|
|
31
|
+
case ErrorCodes.PRIVATE_KEY_MISMATCH.toString():
|
|
32
|
+
case ErrorCodes.DECRYPTION.toString():
|
|
33
|
+
case ErrorCodes.ENCRYPTION.toString():
|
|
34
|
+
case ErrorCodes.COORDINATOR_RPC_URL_NOT_SET.toString():
|
|
35
|
+
case ErrorCodes.FAILED_TO_MERGE_STATE_TREE.toString():
|
|
36
|
+
case ErrorCodes.FAILED_TO_MERGE_MESSAGE_SUBTREES.toString():
|
|
37
|
+
case ErrorCodes.FAILED_TO_MERGE_MESSAGE_TREE.toString():
|
|
38
|
+
case ErrorCodes.FAILED_TO_SET_VERIFYING_KEYS.toString():
|
|
39
|
+
case ErrorCodes.FAILED_TO_DEPLOY_CONTRACT.toString():
|
|
40
|
+
case ErrorCodes.FAILED_TO_SET_MACI_INSTANCE_ON_POLICY.toString():
|
|
41
|
+
case ErrorCodes.FAILED_TO_DEPLOY_MACI.toString():
|
|
42
|
+
case ErrorCodes.FAILED_TO_DEPLOY_POLL.toString():
|
|
43
|
+
case ErrorCodes.FAILED_TO_UPDATE_SCHEDULED_POLL.toString():
|
|
44
|
+
return HttpStatus.INTERNAL_SERVER_ERROR;
|
|
45
|
+
default:
|
|
46
|
+
return HttpStatus.INTERNAL_SERVER_ERROR;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../ts/common/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAY;IAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE1B,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC;QAC/C,KAAK,UAAU,CAAC,sCAAsC,CAAC,QAAQ,EAAE,CAAC;QAClE,KAAK,UAAU,CAAC,8BAA8B,CAAC,QAAQ,EAAE,CAAC;QAC1D,KAAK,UAAU,CAAC,kBAAkB,CAAC,QAAQ,EAAE;YAC3C,OAAO,UAAU,CAAC,WAAW,CAAC;QAEhC,KAAK,UAAU,CAAC,gBAAgB,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EAAE,CAAC;QACxD,KAAK,UAAU,CAAC,4BAA4B,CAAC,QAAQ,EAAE,CAAC;QACxD,KAAK,UAAU,CAAC,yBAAyB,CAAC,QAAQ,EAAE,CAAC;QACrD,KAAK,UAAU,CAAC,qCAAqC,CAAC,QAAQ,EAAE,CAAC;QACjE,KAAK,UAAU,CAAC,qBAAqB,CAAC,QAAQ,EAAE,CAAC;QACjD,KAAK,UAAU,CAAC,qBAAqB,CAAC,QAAQ,EAAE,CAAC;QACjD,KAAK,UAAU,CAAC,+BAA+B,CAAC,QAAQ,EAAE;YACxD,OAAO,UAAU,CAAC,qBAAqB,CAAC;QAE1C;YACE,OAAO,UAAU,CAAC,qBAAqB,CAAC;IAC5C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ESupportedChains } from "@maci-protocol/sdk";
|
|
2
|
+
import { type Chain } from "viem/chains";
|
|
3
|
+
/**
|
|
4
|
+
* Get the Viem chain for a given network
|
|
5
|
+
*
|
|
6
|
+
* @param network - the network to get the chain for
|
|
7
|
+
* @returns the Viem chain
|
|
8
|
+
*/
|
|
9
|
+
export declare const viemChain: (network: ESupportedChains) => Chain;
|
|
10
|
+
//# sourceMappingURL=networks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../../../ts/common/networks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAKL,KAAK,KAAK,EAmBX,MAAM,aAAa,CAAC;AAIrB;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,SAAS,gBAAgB,KAAG,KAkDrD,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ESupportedChains } from "@maci-protocol/sdk";
|
|
2
|
+
import { arbitrum, arbitrumSepolia, base, baseSepolia, gnosis, gnosisChiado, hardhat, linea, lineaSepolia, localhost, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, polygonZkEvm, polygonZkEvmCardona, scroll, scrollSepolia, sepolia, zksync, zksyncSepoliaTestnet, } from "viem/chains";
|
|
3
|
+
import { ErrorCodes } from "./errors";
|
|
4
|
+
/**
|
|
5
|
+
* Get the Viem chain for a given network
|
|
6
|
+
*
|
|
7
|
+
* @param network - the network to get the chain for
|
|
8
|
+
* @returns the Viem chain
|
|
9
|
+
*/
|
|
10
|
+
export const viemChain = (network) => {
|
|
11
|
+
switch (network) {
|
|
12
|
+
case ESupportedChains.Mainnet:
|
|
13
|
+
return mainnet;
|
|
14
|
+
case ESupportedChains.Sepolia:
|
|
15
|
+
return sepolia;
|
|
16
|
+
case ESupportedChains.Optimism:
|
|
17
|
+
return optimism;
|
|
18
|
+
case ESupportedChains.OptimismSepolia:
|
|
19
|
+
return optimismSepolia;
|
|
20
|
+
case ESupportedChains.Scroll:
|
|
21
|
+
return scroll;
|
|
22
|
+
case ESupportedChains.ScrollSepolia:
|
|
23
|
+
return scrollSepolia;
|
|
24
|
+
case ESupportedChains.Arbitrum:
|
|
25
|
+
return arbitrum;
|
|
26
|
+
case ESupportedChains.ArbitrumSepolia:
|
|
27
|
+
return arbitrumSepolia;
|
|
28
|
+
case ESupportedChains.Base:
|
|
29
|
+
return base;
|
|
30
|
+
case ESupportedChains.BaseSepolia:
|
|
31
|
+
return baseSepolia;
|
|
32
|
+
case ESupportedChains.Gnosis:
|
|
33
|
+
return gnosis;
|
|
34
|
+
case ESupportedChains.GnosisChiado:
|
|
35
|
+
return gnosisChiado;
|
|
36
|
+
case ESupportedChains.Polygon:
|
|
37
|
+
return polygon;
|
|
38
|
+
case ESupportedChains.PolygonAmoy:
|
|
39
|
+
return polygonAmoy;
|
|
40
|
+
case ESupportedChains.Linea:
|
|
41
|
+
return linea;
|
|
42
|
+
case ESupportedChains.LineaSepolia:
|
|
43
|
+
return lineaSepolia;
|
|
44
|
+
case ESupportedChains.ZkSyncEra:
|
|
45
|
+
return zksync;
|
|
46
|
+
case ESupportedChains.ZkSyncSepolia:
|
|
47
|
+
return zksyncSepoliaTestnet;
|
|
48
|
+
case ESupportedChains.PolygonZkEvm:
|
|
49
|
+
return polygonZkEvm;
|
|
50
|
+
case ESupportedChains.PolygonCardonaZkEvm:
|
|
51
|
+
return polygonZkEvmCardona;
|
|
52
|
+
// coverage is not supported by viem and it wont be used in the coordinator
|
|
53
|
+
case ESupportedChains.Hardhat:
|
|
54
|
+
return hardhat;
|
|
55
|
+
case ESupportedChains.Localhost:
|
|
56
|
+
return localhost;
|
|
57
|
+
default:
|
|
58
|
+
throw new Error(ErrorCodes.UNSUPPORTED_NETWORK.toString());
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=networks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networks.js","sourceRoot":"","sources":["../../../ts/common/networks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,WAAW,EAEX,MAAM,EACN,YAAY,EACZ,OAAO,EACP,KAAK,EACL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Y;YAChC,OAAO,YAAY,CAAC;QACtB,KAAK,gBAAgB,CAAC,SAAS;YAC7B,OAAO,MAAM,CAAC;QAChB,KAAK,gBAAgB,CAAC,aAAa;YACjC,OAAO,oBAAoB,CAAC;QAC9B,KAAK,gBAAgB,CAAC,YAAY;YAChC,OAAO,YAAY,CAAC;QACtB,KAAK,gBAAgB,CAAC,mBAAmB;YACvC,OAAO,mBAAmB,CAAC;QAC7B,2EAA2E;QAC3E,KAAK,gBAAgB,CAAC,OAAO;YAC3B,OAAO,OAAO,CAAC;QACjB,KAAK,gBAAgB,CAAC,SAAS;YAC7B,OAAO,SAAS,CAAC;QACnB;YACE,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CreateKernelAccountReturnType, type KernelAccountClient } from "@zerodev/sdk";
|
|
2
|
+
import { type BundlerClient } from "viem/account-abstraction";
|
|
3
|
+
import type { Chain, HttpTransport, PublicClient, Transport } from "viem";
|
|
4
|
+
export type KernelClientType = KernelAccountClient<Transport, Chain, CreateKernelAccountReturnType>;
|
|
5
|
+
export type BundlerClientType = BundlerClient;
|
|
6
|
+
export type PublicClientType = PublicClient<Transport, Chain>;
|
|
7
|
+
export type PublicClientHTTPType = PublicClient<HttpTransport, Chain>;
|
|
8
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,6BAA6B,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1E,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,SAAS,EAAE,KAAK,EAAE,6BAA6B,CAAC,CAAC;AAEpG,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAE9C,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAE9D,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../ts/common/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.service.test.d.ts","sourceRoot":"","sources":["../../../../ts/crypto/__tests__/crypto.service.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import fc from "fast-check";
|
|
2
|
+
import { generateKeyPairSync } from "crypto";
|
|
3
|
+
import { ErrorCodes } from "../../common";
|
|
4
|
+
import { CryptoService } from "../crypto.service";
|
|
5
|
+
describe("CryptoService", () => {
|
|
6
|
+
test("should throw encryption error if key is invalid", () => {
|
|
7
|
+
const service = new CryptoService();
|
|
8
|
+
expect(() => service.encrypt("", "")).toThrow(ErrorCodes.ENCRYPTION.toString());
|
|
9
|
+
});
|
|
10
|
+
test("should throw decryption error if key is invalid", () => {
|
|
11
|
+
const service = new CryptoService();
|
|
12
|
+
expect(() => service.decrypt("", "")).toThrow(ErrorCodes.DECRYPTION.toString());
|
|
13
|
+
});
|
|
14
|
+
test("should encrypt and decrypt properly", () => {
|
|
15
|
+
fc.assert(fc.property(fc.string(), (text) => {
|
|
16
|
+
const service = new CryptoService();
|
|
17
|
+
const keypair = generateKeyPairSync("rsa", {
|
|
18
|
+
modulusLength: 2048,
|
|
19
|
+
});
|
|
20
|
+
const encryptedText = service.encrypt(keypair.publicKey.export({ type: "pkcs1", format: "pem" }), text);
|
|
21
|
+
const decryptedText = service.decrypt(keypair.privateKey.export({ type: "pkcs1", format: "pem" }), encryptedText);
|
|
22
|
+
return decryptedText === text;
|
|
23
|
+
}));
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=crypto.service.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.service.test.js","sourceRoot":"","sources":["../../../../ts/crypto/__tests__/crypto.service.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,IAAI,CAAC,iDAAiD,EAAE,GAAG,EAAE;QAC3D,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QAEpC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,iDAAiD,EAAE,GAAG,EAAE;QAC3D,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QAEpC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC/C,EAAE,CAAC,MAAM,CACP,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAY,EAAE,EAAE;YACxC,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;YAEpC,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,EAAE;gBACzC,aAAa,EAAE,IAAI;aACpB,CAAC,CAAC;YAEH,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;YAExG,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CACnC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAC3D,aAAa,CACd,CAAC;YAEF,OAAO,aAAa,KAAK,IAAI,CAAC;QAChC,CAAC,CAAC,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.module.d.ts","sourceRoot":"","sources":["../../../ts/crypto/crypto.module.ts"],"names":[],"mappings":"AAIA,qBAIa,YAAY;CAAG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Module } from "@nestjs/common";
|
|
8
|
+
import { CryptoService } from "./crypto.service";
|
|
9
|
+
let CryptoModule = class CryptoModule {
|
|
10
|
+
};
|
|
11
|
+
CryptoModule = __decorate([
|
|
12
|
+
Module({
|
|
13
|
+
exports: [CryptoService],
|
|
14
|
+
providers: [CryptoService],
|
|
15
|
+
})
|
|
16
|
+
], CryptoModule);
|
|
17
|
+
export { CryptoModule };
|
|
18
|
+
//# sourceMappingURL=crypto.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.module.js","sourceRoot":"","sources":["../../../ts/crypto/crypto.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAM1C,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,YAAY;IAJxB,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,aAAa,CAAC;QACxB,SAAS,EAAE,CAAC,aAAa,CAAC;KAC3B,CAAC;GACW,YAAY,CAAG"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type KeyLike } from "crypto";
|
|
2
|
+
/**
|
|
3
|
+
* CryptoService is responsible for encrypting and decrypting user sensitive data
|
|
4
|
+
*/
|
|
5
|
+
export declare class CryptoService {
|
|
6
|
+
/**
|
|
7
|
+
* Logger
|
|
8
|
+
*/
|
|
9
|
+
private readonly logger;
|
|
10
|
+
/**
|
|
11
|
+
* Initialize service
|
|
12
|
+
*/
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Encrypt plaintext with public key
|
|
16
|
+
*
|
|
17
|
+
* @param publicKey - public key
|
|
18
|
+
* @param value - plaintext
|
|
19
|
+
* @returns ciphertext
|
|
20
|
+
*/
|
|
21
|
+
encrypt(publicKey: KeyLike, value: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Decrypt ciphertext with private key
|
|
24
|
+
*
|
|
25
|
+
* @param privateKey - private key
|
|
26
|
+
* @param value - ciphertext
|
|
27
|
+
* @returns plaintext
|
|
28
|
+
*/
|
|
29
|
+
decrypt(privateKey: KeyLike, value: string): string;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=crypto.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.service.d.ts","sourceRoot":"","sources":["../../../ts/crypto/crypto.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiC,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAIrE;;GAEG;AACH,qBACa,aAAa;IACxB;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC;;OAEG;;IAKH;;;;;;OAMG;IACH,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAWlD;;;;;;OAMG;IACH,OAAO,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;CAUpD"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var CryptoService_1;
|
|
11
|
+
import { Injectable, Logger } from "@nestjs/common";
|
|
12
|
+
import { publicEncrypt, privateDecrypt } from "crypto";
|
|
13
|
+
import { ErrorCodes } from "../common";
|
|
14
|
+
/**
|
|
15
|
+
* CryptoService is responsible for encrypting and decrypting user sensitive data
|
|
16
|
+
*/
|
|
17
|
+
let CryptoService = CryptoService_1 = class CryptoService {
|
|
18
|
+
/**
|
|
19
|
+
* Logger
|
|
20
|
+
*/
|
|
21
|
+
logger;
|
|
22
|
+
/**
|
|
23
|
+
* Initialize service
|
|
24
|
+
*/
|
|
25
|
+
constructor() {
|
|
26
|
+
this.logger = new Logger(CryptoService_1.name);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Encrypt plaintext with public key
|
|
30
|
+
*
|
|
31
|
+
* @param publicKey - public key
|
|
32
|
+
* @param value - plaintext
|
|
33
|
+
* @returns ciphertext
|
|
34
|
+
*/
|
|
35
|
+
encrypt(publicKey, value) {
|
|
36
|
+
try {
|
|
37
|
+
const encrypted = publicEncrypt(publicKey, Buffer.from(value));
|
|
38
|
+
return encrypted.toString("base64");
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
this.logger.error(`Error: ${ErrorCodes.ENCRYPTION}`, error);
|
|
42
|
+
throw new Error(ErrorCodes.ENCRYPTION.toString());
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Decrypt ciphertext with private key
|
|
47
|
+
*
|
|
48
|
+
* @param privateKey - private key
|
|
49
|
+
* @param value - ciphertext
|
|
50
|
+
* @returns plaintext
|
|
51
|
+
*/
|
|
52
|
+
decrypt(privateKey, value) {
|
|
53
|
+
try {
|
|
54
|
+
const decryptedData = privateDecrypt(privateKey, Buffer.from(value, "base64"));
|
|
55
|
+
return decryptedData.toString();
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
this.logger.error(`Error: ${ErrorCodes.DECRYPTION}`, error);
|
|
59
|
+
throw new Error(ErrorCodes.DECRYPTION.toString());
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
CryptoService = CryptoService_1 = __decorate([
|
|
64
|
+
Injectable(),
|
|
65
|
+
__metadata("design:paramtypes", [])
|
|
66
|
+
], CryptoService);
|
|
67
|
+
export { CryptoService };
|
|
68
|
+
//# sourceMappingURL=crypto.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.service.js","sourceRoot":"","sources":["../../../ts/crypto/crypto.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAgB,MAAM,QAAQ,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;GAEG;AAEI,IAAM,aAAa,qBAAnB,MAAM,aAAa;IACxB;;OAEG;IACc,MAAM,CAAS;IAEhC;;OAEG;IACH;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,SAAkB,EAAE,KAAa;QACvC,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAE/D,OAAO,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,UAAU,CAAC,UAAU,EAAE,EAAE,KAAK,CAAC,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,UAAmB,EAAE,KAAa;QACxC,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;YAE/E,OAAO,aAAa,CAAC,QAAQ,EAAE,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,UAAU,CAAC,UAAU,EAAE,EAAE,KAAK,CAAC,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;CACF,CAAA;AAhDY,aAAa;IADzB,UAAU,EAAE;;GACA,aAAa,CAgDzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployer.controller.test.d.ts","sourceRoot":"","sources":["../../../../ts/deployer/__tests__/deployer.controller.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ESupportedChains } from "@maci-protocol/sdk";
|
|
2
|
+
import { Test } from "@nestjs/testing";
|
|
3
|
+
import { zeroAddress } from "viem";
|
|
4
|
+
import { ErrorCodes } from "../../common";
|
|
5
|
+
import { DeployerController } from "../deployer.controller";
|
|
6
|
+
import { DeployerService } from "../deployer.service";
|
|
7
|
+
import { testMaciDeploymentConfig, testPollDeploymentConfig } from "./utils";
|
|
8
|
+
describe("DeployerController", () => {
|
|
9
|
+
afterEach(() => {
|
|
10
|
+
jest.clearAllMocks();
|
|
11
|
+
});
|
|
12
|
+
let deployerController;
|
|
13
|
+
const mockDeployerService = {
|
|
14
|
+
deployMaci: jest.fn(),
|
|
15
|
+
deployPoll: jest.fn(),
|
|
16
|
+
};
|
|
17
|
+
const defaultDeployMaciReturn = zeroAddress;
|
|
18
|
+
const defaultDeployPollReturn = "0";
|
|
19
|
+
const approval = "approval";
|
|
20
|
+
const sessionKeyAddress = zeroAddress;
|
|
21
|
+
beforeEach(async () => {
|
|
22
|
+
const app = await Test.createTestingModule({
|
|
23
|
+
controllers: [DeployerController],
|
|
24
|
+
})
|
|
25
|
+
.useMocker((token) => {
|
|
26
|
+
if (token === DeployerService) {
|
|
27
|
+
mockDeployerService.deployMaci.mockResolvedValue({ address: defaultDeployMaciReturn });
|
|
28
|
+
mockDeployerService.deployPoll.mockResolvedValue({ pollId: defaultDeployPollReturn });
|
|
29
|
+
return mockDeployerService;
|
|
30
|
+
}
|
|
31
|
+
return jest.fn();
|
|
32
|
+
})
|
|
33
|
+
.compile();
|
|
34
|
+
deployerController = app.get(DeployerController);
|
|
35
|
+
});
|
|
36
|
+
afterEach(() => {
|
|
37
|
+
jest.clearAllMocks();
|
|
38
|
+
});
|
|
39
|
+
describe("v1/deploy/maci", () => {
|
|
40
|
+
test("should deploy all contracts", async () => {
|
|
41
|
+
const { address } = await deployerController.deployMACIContracts({
|
|
42
|
+
chain: ESupportedChains.OptimismSepolia,
|
|
43
|
+
approval,
|
|
44
|
+
sessionKeyAddress,
|
|
45
|
+
config: testMaciDeploymentConfig,
|
|
46
|
+
});
|
|
47
|
+
expect(address).toEqual(defaultDeployMaciReturn);
|
|
48
|
+
});
|
|
49
|
+
test("should return 400 bad request when the service throws", async () => {
|
|
50
|
+
mockDeployerService.deployMaci.mockRejectedValue(new Error(ErrorCodes.SESSION_KEY_NOT_FOUND.toString()));
|
|
51
|
+
const controller = new DeployerController(mockDeployerService);
|
|
52
|
+
await expect(controller.deployMACIContracts({
|
|
53
|
+
chain: ESupportedChains.OptimismSepolia,
|
|
54
|
+
approval: "0x123",
|
|
55
|
+
sessionKeyAddress: "0x123",
|
|
56
|
+
config: testMaciDeploymentConfig,
|
|
57
|
+
})).rejects.toThrow(ErrorCodes.SESSION_KEY_NOT_FOUND.toString());
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe("v1/deploy/poll", () => {
|
|
61
|
+
test("should deploy a new poll", async () => {
|
|
62
|
+
const { pollId } = await deployerController.deployPoll({
|
|
63
|
+
chain: ESupportedChains.OptimismSepolia,
|
|
64
|
+
approval,
|
|
65
|
+
sessionKeyAddress,
|
|
66
|
+
config: testPollDeploymentConfig,
|
|
67
|
+
});
|
|
68
|
+
expect(pollId).toEqual(defaultDeployPollReturn);
|
|
69
|
+
});
|
|
70
|
+
test("should return 400 bad request when the service throws", async () => {
|
|
71
|
+
mockDeployerService.deployPoll.mockRejectedValue(new Error(ErrorCodes.SESSION_KEY_NOT_FOUND.toString()));
|
|
72
|
+
const controller = new DeployerController(mockDeployerService);
|
|
73
|
+
await expect(controller.deployPoll({
|
|
74
|
+
chain: ESupportedChains.OptimismSepolia,
|
|
75
|
+
approval: "0x123",
|
|
76
|
+
sessionKeyAddress: "0x123",
|
|
77
|
+
config: testPollDeploymentConfig,
|
|
78
|
+
})).rejects.toThrow(ErrorCodes.SESSION_KEY_NOT_FOUND.toString());
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=deployer.controller.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployer.controller.test.js","sourceRoot":"","sources":["../../../../ts/deployer/__tests__/deployer.controller.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAE7E,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,IAAI,kBAAsC,CAAC;IAE3C,MAAM,mBAAm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