@maci-protocol/coordinator 0.0.0-ci.d969539 → 0.0.0-ci.da13fbb

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 (101) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +31 -6
  3. package/build/hardhat.config.cjs +3 -0
  4. package/build/hardhat.config.cjs.map +1 -1
  5. package/build/hardhat.config.d.cts +3 -0
  6. package/build/scripts/generateMaciKeyPair.js +2 -2
  7. package/build/scripts/generateMaciKeyPair.js.map +1 -1
  8. package/build/tests/constants.d.ts +0 -1
  9. package/build/tests/constants.d.ts.map +1 -1
  10. package/build/tests/constants.js +0 -1
  11. package/build/tests/constants.js.map +1 -1
  12. package/build/tests/e2e.aa.test.js +18 -25
  13. package/build/tests/e2e.aa.test.js.map +1 -1
  14. package/build/tests/e2e.deploy.test.js +127 -82
  15. package/build/tests/e2e.deploy.test.js.map +1 -1
  16. package/build/tests/utils.d.ts +6 -0
  17. package/build/tests/utils.d.ts.map +1 -1
  18. package/build/tests/utils.js +12 -3
  19. package/build/tests/utils.js.map +1 -1
  20. package/build/ts/common/__tests__/common.test.js +9 -13
  21. package/build/ts/common/__tests__/common.test.js.map +1 -1
  22. package/build/ts/common/accountAbstraction.d.ts +2 -19
  23. package/build/ts/common/accountAbstraction.d.ts.map +1 -1
  24. package/build/ts/common/accountAbstraction.js +15 -44
  25. package/build/ts/common/accountAbstraction.js.map +1 -1
  26. package/build/ts/common/chain.d.ts +16 -0
  27. package/build/ts/common/chain.d.ts.map +1 -0
  28. package/build/ts/common/chain.js +32 -0
  29. package/build/ts/common/chain.js.map +1 -0
  30. package/build/ts/common/coordinatorKeypair.d.ts +7 -0
  31. package/build/ts/common/coordinatorKeypair.d.ts.map +1 -0
  32. package/build/ts/common/coordinatorKeypair.js +14 -0
  33. package/build/ts/common/coordinatorKeypair.js.map +1 -0
  34. package/build/ts/common/errors.d.ts +17 -18
  35. package/build/ts/common/errors.d.ts.map +1 -1
  36. package/build/ts/common/errors.js +17 -18
  37. package/build/ts/common/errors.js.map +1 -1
  38. package/build/ts/common/index.d.ts +2 -0
  39. package/build/ts/common/index.d.ts.map +1 -1
  40. package/build/ts/common/index.js +2 -0
  41. package/build/ts/common/index.js.map +1 -1
  42. package/build/ts/common/types.d.ts +2 -3
  43. package/build/ts/common/types.d.ts.map +1 -1
  44. package/build/ts/deployer/__tests__/deployer.service.test.js +30 -289
  45. package/build/ts/deployer/__tests__/deployer.service.test.js.map +1 -1
  46. package/build/ts/deployer/__tests__/utils.d.ts +27 -1
  47. package/build/ts/deployer/__tests__/utils.d.ts.map +1 -1
  48. package/build/ts/deployer/__tests__/utils.js +40 -11
  49. package/build/ts/deployer/__tests__/utils.js.map +1 -1
  50. package/build/ts/deployer/deployer.service.d.ts +17 -53
  51. package/build/ts/deployer/deployer.service.d.ts.map +1 -1
  52. package/build/ts/deployer/deployer.service.js +176 -462
  53. package/build/ts/deployer/deployer.service.js.map +1 -1
  54. package/build/ts/deployer/dto.d.ts +4 -4
  55. package/build/ts/deployer/dto.d.ts.map +1 -1
  56. package/build/ts/deployer/dto.js +9 -1
  57. package/build/ts/deployer/dto.js.map +1 -1
  58. package/build/ts/deployer/types.d.ts +53 -26
  59. package/build/ts/deployer/types.d.ts.map +1 -1
  60. package/build/ts/file/__tests__/file.service.test.js +12 -11
  61. package/build/ts/file/__tests__/file.service.test.js.map +1 -1
  62. package/build/ts/file/file.service.d.ts +4 -3
  63. package/build/ts/file/file.service.d.ts.map +1 -1
  64. package/build/ts/file/file.service.js +14 -9
  65. package/build/ts/file/file.service.js.map +1 -1
  66. package/build/ts/file/types.d.ts +2 -2
  67. package/build/ts/file/types.d.ts.map +1 -1
  68. package/build/ts/proof/__tests__/proof.controller.test.js +5 -3
  69. package/build/ts/proof/__tests__/proof.controller.test.js.map +1 -1
  70. package/build/ts/proof/__tests__/proof.gateway.test.js +6 -3
  71. package/build/ts/proof/__tests__/proof.gateway.test.js.map +1 -1
  72. package/build/ts/proof/__tests__/proof.service.test.js +18 -31
  73. package/build/ts/proof/__tests__/proof.service.test.js.map +1 -1
  74. package/build/ts/proof/dto.d.ts +13 -15
  75. package/build/ts/proof/dto.d.ts.map +1 -1
  76. package/build/ts/proof/dto.js +51 -44
  77. package/build/ts/proof/dto.js.map +1 -1
  78. package/build/ts/proof/proof.controller.d.ts +3 -2
  79. package/build/ts/proof/proof.controller.d.ts.map +1 -1
  80. package/build/ts/proof/proof.controller.js +1 -4
  81. package/build/ts/proof/proof.controller.js.map +1 -1
  82. package/build/ts/proof/proof.service.d.ts +4 -6
  83. package/build/ts/proof/proof.service.d.ts.map +1 -1
  84. package/build/ts/proof/proof.service.js +48 -130
  85. package/build/ts/proof/proof.service.js.map +1 -1
  86. package/build/ts/proof/types.d.ts +19 -14
  87. package/build/ts/proof/types.d.ts.map +1 -1
  88. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts +53 -0
  89. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts.map +1 -0
  90. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js +105 -0
  91. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js.map +1 -0
  92. package/build/ts/sessionKeys/sessionKeys.service.d.ts +13 -2
  93. package/build/ts/sessionKeys/sessionKeys.service.d.ts.map +1 -1
  94. package/build/ts/sessionKeys/sessionKeys.service.js +22 -4
  95. package/build/ts/sessionKeys/sessionKeys.service.js.map +1 -1
  96. package/build/tsconfig.build.tsbuildinfo +1 -1
  97. package/package.json +32 -32
  98. package/build/ts/deployer/utils.d.ts +0 -8
  99. package/build/ts/deployer/utils.d.ts.map +0 -1
  100. package/build/ts/deployer/utils.js +0 -9
  101. package/build/ts/deployer/utils.js.map +0 -1
@@ -1,21 +1,16 @@
1
- import { EPolicies, EContracts, EInitialVoiceCreditProxies, EMode, type ISetVerifyingKeysArgs, VkRegistry } from "@maci-protocol/sdk";
1
+ import { EPolicies, EInitialVoiceCreditProxies, EMode, ISetVerifyingKeysArgs, BasePolicy, ConstantInitialVoiceCreditProxy } from "@maci-protocol/sdk";
2
2
  import { Signer } from "ethers";
3
- import { GetUserOperationReceiptReturnType } from "permissionless";
4
- import { Abi, type Hex } from "viem";
5
- import { ESupportedNetworks, KernelClientType, BundlerClientType, PublicClientType } from "../common";
3
+ import { type Hex } from "viem";
4
+ import { ESupportedNetworks } from "../common";
6
5
  import { FileService } from "../file/file.service";
7
6
  import { SessionKeysService } from "../sessionKeys/sessionKeys.service";
8
- import { IContractData, IDeployMaciArgs, IDeployPollArgs, IPolicyArgs, IInitialVoiceCreditProxyArgs, IVkRegistryArgs } from "./types";
7
+ import { IDeployMaciArgs, IDeployPollArgs, IPolicyArgs, IInitialVoiceCreditProxyArgs, IVerifyingKeysRegistryArgs } from "./types";
9
8
  /**
10
9
  * DeployerService is responsible for deploying contracts.
11
10
  */
12
11
  export declare class DeployerService {
13
12
  private readonly sessionKeysService;
14
13
  private readonly fileService;
15
- /**
16
- * Logger
17
- */
18
- private readonly logger;
19
14
  /**
20
15
  * Contract storage instance
21
16
  */
@@ -27,67 +22,36 @@ export declare class DeployerService {
27
22
  */
28
23
  constructor(sessionKeysService: SessionKeysService, fileService: FileService);
29
24
  /**
30
- * Get the policy abi and bytecode based on the policy type
31
- * and also check if there is already an instance deployed
25
+ * Get the policy contract object
26
+ * always deploy and save it
32
27
  *
28
+ * @param signer - the signer
33
29
  * @param policyType - the policy type
34
30
  * @param network - the network
35
31
  * @param args - the policy args
36
- * @returns - the policy abi and bytecode
32
+ * @returns - the policy contract
37
33
  */
38
- getPolicyData(policyType: EPolicies, network: ESupportedNetworks, args?: IPolicyArgs): IContractData;
34
+ deployAndSavePolicy(signer: Signer, policyType: EPolicies, network: ESupportedNetworks, args?: IPolicyArgs): Promise<BasePolicy>;
39
35
  /**
40
- * Get the voice credit proxy abi and bytecode based on the voice credit proxy type
41
- * and also check if there is already an instance deployed
36
+ * Get the voice credit proxy contract object
37
+ * always deploy and save it
42
38
  *
39
+ * @param signer - the signer
43
40
  * @param voiceCreditProxyType - the voice credit proxy type
44
41
  * @param network - the network
45
- * @param args - the voice credit proxy args
46
- * @returns - the voice credit proxy abi and bytecode
47
- */
48
- getVoiceCreditProxyData(voiceCreditProxyType: EInitialVoiceCreditProxies, network: ESupportedNetworks, args: IInitialVoiceCreditProxyArgs): IContractData;
49
- /**
50
- * @param abi - the abi
51
- * @param bytecode - the bytecode
52
- * @param args - the args
53
- * @param publicClient - the public client
54
- * @returns - the address
55
- */
56
- deployAndGetAddress(kernelClient: KernelClientType, abi: Abi, bytecode: Hex, args: unknown[], bundlerClient: BundlerClientType, publicClient: PublicClientType): Promise<string | undefined>;
57
- /**
58
- * Deploy a contract and store the address
59
- *
60
- * @param contract - the contract to deploy
61
- * @param args - the args
62
- * @param abi - the abi
63
- * @param bytecode - the bytecode
64
- * @param kernelClient - the kernel client
65
- * @param publicClient - the public client
66
- * @param chain - the chain
67
- * @returns - the address of the deployed contract
68
- */
69
- deployAndStore(contract: EContracts, args: unknown[], abi: Abi, bytecode: Hex, kernelClient: KernelClientType, bundlerClient: BundlerClientType, publicClient: PublicClientType, chain: ESupportedNetworks): Promise<Hex>;
70
- /**
71
- * Estimate gas, add a bit extra and send the user operation (aka. transaction)
72
- * @param to - the to address of the user operation
73
- * @param value - the value of the user operation
74
- * @param abi - the abi
75
- * @param functionName - the function name
76
42
  * @param args - the args
77
- * @param errorMessage - the error message
78
- * @param kernelClient - the kernel client
79
- * @param bundlerClient - the bundler client
43
+ * @returns - the voice credit proxy contract
80
44
  */
81
- estimateGasAndSend(to: Hex, value: bigint, abi: Abi, functionName: string, args: unknown[], errorMessage: string, kernelClient: KernelClientType, bundlerClient: BundlerClientType): Promise<GetUserOperationReceiptReturnType>;
45
+ deployAndSaveVoiceCreditProxy(signer: Signer, voiceCreditProxyType: EInitialVoiceCreditProxies, network: ESupportedNetworks, args?: IInitialVoiceCreditProxyArgs): Promise<ConstantInitialVoiceCreditProxy>;
82
46
  /**
83
47
  * Get verifying keys arguments (specially zkey paths)
84
48
  * @param signer - the signer
85
- * @param vkRegistryContract - the deployed vk registry contract
86
- * @param vkRegistryArgs - the arguments send to the endpoint
49
+ * @param verifyingKeysRegistryContract - the deployed verifyingKey registry contract
50
+ * @param verifyingKeysRegistryArgs - the arguments send to the endpoint
87
51
  * @param mode - use QV or NON_QV
88
52
  * @returns SetVerifyingKeysArgs
89
53
  */
90
- getVerifyingKeysArgs(signer: Signer, vkRegistryContract: VkRegistry, vkRegistryArgs: IVkRegistryArgs, mode: EMode): Promise<ISetVerifyingKeysArgs>;
54
+ getVerifyingKeysArgs(signer: Signer, verifyingKeysRegistryAddress: Hex, verifyingKeysRegistryArgs: IVerifyingKeysRegistryArgs, mode: EMode): Promise<ISetVerifyingKeysArgs>;
91
55
  /**
92
56
  * Deploy MACI contracts
93
57
  *
@@ -1 +1 @@
1
- {"version":3,"file":"deployer.service.d.ts","sourceRoot":"","sources":["../../../ts/deployer/deployer.service.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,SAAS,EAsBT,UAAU,EACV,0BAA0B,EAC1B,KAAK,EAEL,KAAK,qBAAqB,EAK1B,UAAU,EACX,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAA8B,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,GAAG,EAAsB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAIzD,OAAO,EAAc,kBAAkB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAGxE,OAAO,EACL,aAAa,EACb,eAAe,EACf,eAAe,EAEf,WAAW,EAGX,4BAA4B,EAG5B,eAAe,EAIhB,MAAM,SAAS,CAAC;AAGjB;;GAEG;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