@aztec/pxe 0.77.0-testnet-ignition.28 → 0.77.0-testnet-ignition.29

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 (67) hide show
  1. package/dest/bin/index.d.ts +3 -0
  2. package/dest/bin/index.d.ts.map +1 -0
  3. package/dest/config/index.d.ts +47 -0
  4. package/dest/config/index.d.ts.map +1 -0
  5. package/dest/config/package_info.d.ts +5 -0
  6. package/dest/config/package_info.d.ts.map +1 -0
  7. package/dest/contract_data_provider/contract_data_provider.d.ts +104 -0
  8. package/dest/contract_data_provider/contract_data_provider.d.ts.map +1 -0
  9. package/dest/contract_data_provider/index.d.ts +3 -0
  10. package/dest/contract_data_provider/index.d.ts.map +1 -0
  11. package/dest/contract_data_provider/private_functions_tree.d.ts +66 -0
  12. package/dest/contract_data_provider/private_functions_tree.d.ts.map +1 -0
  13. package/dest/database/index.d.ts +3 -0
  14. package/dest/database/index.d.ts.map +1 -0
  15. package/dest/database/interfaces/contract_artifact_db.d.ts +20 -0
  16. package/dest/database/interfaces/contract_artifact_db.d.ts.map +1 -0
  17. package/dest/database/interfaces/contract_instance_db.d.ts +20 -0
  18. package/dest/database/interfaces/contract_instance_db.d.ts.map +1 -0
  19. package/dest/database/interfaces/index.d.ts +4 -0
  20. package/dest/database/interfaces/index.d.ts.map +1 -0
  21. package/dest/database/interfaces/pxe_database.d.ts +211 -0
  22. package/dest/database/interfaces/pxe_database.d.ts.map +1 -0
  23. package/dest/database/interfaces/pxe_database_test_suite.d.ts +7 -0
  24. package/dest/database/interfaces/pxe_database_test_suite.d.ts.map +1 -0
  25. package/dest/database/kv_pxe_database.d.ts +57 -0
  26. package/dest/database/kv_pxe_database.d.ts.map +1 -0
  27. package/dest/database/note_dao.d.ts +106 -0
  28. package/dest/database/note_dao.d.ts.map +1 -0
  29. package/dest/index.d.ts +9 -0
  30. package/dest/index.d.ts.map +1 -0
  31. package/dest/kernel_oracle/index.d.ts +44 -0
  32. package/dest/kernel_oracle/index.d.ts.map +1 -0
  33. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +28 -0
  34. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
  35. package/dest/kernel_prover/hints/index.d.ts +2 -0
  36. package/dest/kernel_prover/hints/index.d.ts.map +1 -0
  37. package/dest/kernel_prover/index.d.ts +3 -0
  38. package/dest/kernel_prover/index.d.ts.map +1 -0
  39. package/dest/kernel_prover/kernel_prover.d.ts +38 -0
  40. package/dest/kernel_prover/kernel_prover.d.ts.map +1 -0
  41. package/dest/kernel_prover/proving_data_oracle.d.ts +73 -0
  42. package/dest/kernel_prover/proving_data_oracle.d.ts.map +1 -0
  43. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +11 -0
  44. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +1 -0
  45. package/dest/pxe_data_provider/index.d.ts +151 -0
  46. package/dest/pxe_data_provider/index.d.ts.map +1 -0
  47. package/dest/pxe_data_provider/tagging_utils.d.ts +17 -0
  48. package/dest/pxe_data_provider/tagging_utils.d.ts.map +1 -0
  49. package/dest/pxe_http/index.d.ts +2 -0
  50. package/dest/pxe_http/index.d.ts.map +1 -0
  51. package/dest/pxe_http/pxe_http_server.d.ts +16 -0
  52. package/dest/pxe_http/pxe_http_server.d.ts.map +1 -0
  53. package/dest/pxe_service/error_enriching.d.ts +12 -0
  54. package/dest/pxe_service/error_enriching.d.ts.map +1 -0
  55. package/dest/pxe_service/index.d.ts +3 -0
  56. package/dest/pxe_service/index.d.ts.map +1 -0
  57. package/dest/pxe_service/pxe_service.d.ts +107 -0
  58. package/dest/pxe_service/pxe_service.d.ts.map +1 -0
  59. package/dest/pxe_service/test/pxe_test_suite.d.ts +3 -0
  60. package/dest/pxe_service/test/pxe_test_suite.d.ts.map +1 -0
  61. package/dest/synchronizer/index.d.ts +2 -0
  62. package/dest/synchronizer/index.d.ts.map +1 -0
  63. package/dest/synchronizer/synchronizer.d.ts +33 -0
  64. package/dest/synchronizer/synchronizer.d.ts.map +1 -0
  65. package/dest/utils/create_pxe_service.d.ts +16 -0
  66. package/dest/utils/create_pxe_service.d.ts.map +1 -0
  67. package/package.json +15 -15
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env -S node --no-warnings
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,47 @@
1
+ import { type ConfigMappingsType } from '@aztec/foundation/config';
2
+ import { type DataStoreConfig } from '@aztec/kv-store/config';
3
+ import { type ChainConfig } from '@aztec/stdlib/config';
4
+ import type { Network } from '@aztec/stdlib/network';
5
+ /**
6
+ * Temporary configuration until WASM can be used instead of native
7
+ */
8
+ export interface BBProverConfig {
9
+ bbWorkingDirectory?: string;
10
+ bbBinaryPath?: string;
11
+ bbSkipCleanup?: boolean;
12
+ }
13
+ /**
14
+ * Configuration settings for the prover factory
15
+ */
16
+ export interface KernelProverConfig {
17
+ /** Whether we are running with real proofs */
18
+ proverEnabled?: boolean;
19
+ }
20
+ /**
21
+ * Configuration settings for the PXE.
22
+ */
23
+ export interface PXEConfig {
24
+ /** L2 block to start scanning from for new accounts */
25
+ l2StartingBlock: number;
26
+ }
27
+ export type PXEServiceConfig = PXEConfig & KernelProverConfig & BBProverConfig & DataStoreConfig & ChainConfig;
28
+ export type CliPXEOptions = {
29
+ /** External Aztec network to connect to. e.g. devnet */
30
+ network?: Network;
31
+ /** API Key required by the external network's node */
32
+ apiKey?: string;
33
+ /** Custom Aztec Node URL to connect to */
34
+ nodeUrl?: string;
35
+ };
36
+ export declare const pxeConfigMappings: ConfigMappingsType<PXEServiceConfig>;
37
+ /**
38
+ * Creates an instance of PXEServiceConfig out of environment variables using sensible defaults for integration testing if not set.
39
+ */
40
+ export declare function getPXEServiceConfig(): PXEServiceConfig;
41
+ export declare const pxeCliConfigMappings: ConfigMappingsType<CliPXEOptions>;
42
+ export declare const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions & PXEServiceConfig>;
43
+ /**
44
+ * Creates an instance of CliPxeOptions out of environment variables
45
+ */
46
+ export declare function getCliPXEOptions(): CliPXEOptions & PXEServiceConfig;
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8CAA8C;IAC9C,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AACD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,uDAAuD;IACvD,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,kBAAkB,GAAG,cAAc,GAAG,eAAe,GAAG,WAAW,CAAC;AAE/G,MAAM,MAAM,aAAa,GAAG;IAC1B,wDAAwD;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,kBAAkB,CAAC,gBAAgB,CA0BlE,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,CAEtD;AAED,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,aAAa,CAclE,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,aAAa,GAAG,gBAAgB,CAUrF,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,GAAG,gBAAgB,CAQnE"}
@@ -0,0 +1,5 @@
1
+ export declare function getPackageInfo(): {
2
+ version: string;
3
+ name: string;
4
+ };
5
+ //# sourceMappingURL=package_info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package_info.d.ts","sourceRoot":"","sources":["../../src/config/package_info.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc;;;EAE7B"}
@@ -0,0 +1,104 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ /// <reference types="node" resolution-mode="require"/>
3
+ import type { Fr } from '@aztec/foundation/fields';
4
+ import type { MembershipWitness } from '@aztec/foundation/trees';
5
+ import { type ContractArtifact, type FunctionArtifact, type FunctionDebugMetadata, type FunctionSelector } from '@aztec/stdlib/abi';
6
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
+ import type { ContractClass, ContractInstance } from '@aztec/stdlib/contract';
8
+ import type { ContractArtifactDatabase } from '../database/interfaces/contract_artifact_db.js';
9
+ import type { ContractInstanceDatabase } from '../database/interfaces/contract_instance_db.js';
10
+ /**
11
+ * ContractDataProvider serves as a data manager and retriever for Aztec.nr contracts.
12
+ * It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
13
+ * from a given contract address and function selector. The class maintains a cache of ContractTree instances
14
+ * to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch
15
+ * the required information and facilitate cryptographic proof generation.
16
+ */
17
+ export declare class ContractDataProvider {
18
+ private db;
19
+ /** Map from contract class id to private function tree. */
20
+ private contractClasses;
21
+ constructor(db: ContractArtifactDatabase & ContractInstanceDatabase);
22
+ /** Returns a contract instance for a given address. Throws if not found. */
23
+ getContractInstance(contractAddress: AztecAddress): Promise<ContractInstance>;
24
+ /** Returns a contract class for a given class id. Throws if not found. */
25
+ getContractClass(contractClassId: Fr): Promise<ContractClass>;
26
+ getContractArtifact(contractClassId: Fr): Promise<ContractArtifact>;
27
+ /**
28
+ * Retrieves the artifact of a specified function within a given contract.
29
+ * The function is identified by its selector, which is a unique code generated from the function's signature.
30
+ * Throws an error if the contract address or function selector are invalid or not found.
31
+ *
32
+ * @param contractAddress - The AztecAddress representing the contract containing the function.
33
+ * @param selector - The function selector.
34
+ * @returns The corresponding function's artifact as an object.
35
+ */
36
+ getFunctionArtifact(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionArtifact>;
37
+ /**
38
+ * Retrieves the artifact of a specified function within a given contract.
39
+ * The function is identified by its name, which is unique within a contract.
40
+ * Throws if the contract has not been added to the database.
41
+ *
42
+ * @param contractAddress - The AztecAddress representing the contract containing the function.
43
+ * @param functionName - The name of the function.
44
+ * @returns The corresponding function's artifact as an object
45
+ */
46
+ getFunctionArtifactByName(contractAddress: AztecAddress, functionName: string): Promise<FunctionArtifact | undefined>;
47
+ /**
48
+ * Retrieves the debug metadata of a specified function within a given contract.
49
+ * The function is identified by its selector, which is a unique code generated from the function's signature.
50
+ * Returns undefined if the debug metadata for the given function is not found.
51
+ * Throws if the contract has not been added to the database.
52
+ *
53
+ * @param contractAddress - The AztecAddress representing the contract containing the function.
54
+ * @param selector - The function selector.
55
+ * @returns The corresponding function's artifact as an object.
56
+ */
57
+ getFunctionDebugMetadata(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionDebugMetadata | undefined>;
58
+ /**
59
+ * Retrieve the bytecode of a specific function in a contract at the given address.
60
+ * The returned bytecode is required for executing and verifying the function's behavior
61
+ * in the Aztec network. Throws an error if the contract or function cannot be found.
62
+ *
63
+ * @param contractAddress - The contract's address.
64
+ * @param selector - The function selector.
65
+ * @returns A Promise that resolves to a Buffer containing the bytecode of the specified function.
66
+ * @throws Error if the contract address is unknown or not found.
67
+ */
68
+ getBytecode(contractAddress: AztecAddress, selector: FunctionSelector): Promise<Buffer>;
69
+ /**
70
+ * Retrieve the function membership witness for the given contract class and function selector.
71
+ * The function membership witness represents a proof that the function belongs to the specified contract.
72
+ * Throws an error if the contract address or function selector is unknown.
73
+ *
74
+ * @param contractClassId - The id of the class.
75
+ * @param selector - The function selector.
76
+ * @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
77
+ */
78
+ getFunctionMembershipWitness(contractClassId: Fr, selector: FunctionSelector): Promise<MembershipWitness<5>>;
79
+ getDebugContractName(contractAddress: AztecAddress): Promise<string>;
80
+ getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
81
+ /**
82
+ * Retrieve or create a ContractTree instance based on the provided class id.
83
+ * If an existing tree with the same class id is found in the cache, it will be returned.
84
+ * Otherwise, a new ContractTree instance will be created using the contract data from the database
85
+ * and added to the cache before returning.
86
+ *
87
+ * @param classId - The class id of the contract for which the ContractTree is required.
88
+ * @returns A ContractTree instance associated with the specified contract address.
89
+ * @throws An Error if the contract is not found in the ContractDatabase.
90
+ */
91
+ private getTreeForClassId;
92
+ /**
93
+ * Retrieve or create a ContractTree instance based on the provided AztecAddress.
94
+ * If an existing tree with the same contract address is found in the cache, it will be returned.
95
+ * Otherwise, a new ContractTree instance will be created using the contract data from the database
96
+ * and added to the cache before returning.
97
+ *
98
+ * @param contractAddress - The AztecAddress of the contract for which the ContractTree is required.
99
+ * @returns A ContractTree instance associated with the specified contract address.
100
+ * @throws An Error if the contract is not found in the ContractDatabase.
101
+ */
102
+ private getTreeForAddress;
103
+ }
104
+ //# sourceMappingURL=contract_data_provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract_data_provider.d.ts","sourceRoot":"","sources":["../../src/contract_data_provider/contract_data_provider.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BA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Ae,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB;IAKlF;;;;;;;;OAQG;IACU,4BAA4B,CACvC,eAAe,EAAE,EAAE,EACnB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAKnB,oBAAoB,CAAC,eAAe,EAAE,YAAY;IAKlD,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB;IAO3F;;;;;;;;;OASG;YACW,iBAAiB;IAY/B;;;;;;;;;OASG;YACW,iBAAiB;CAIhC"}
@@ -0,0 +1,3 @@
1
+ export { ContractDataProvider } from './contract_data_provider.js';
2
+ export { PrivateFunctionsTree } from './private_functions_tree.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract_data_provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,66 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ /// <reference types="node" resolution-mode="require"/>
3
+ import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
4
+ import { Fr } from '@aztec/foundation/fields';
5
+ import { MembershipWitness, type MerkleTree } from '@aztec/foundation/trees';
6
+ import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
7
+ import { type ContractClassWithId } from '@aztec/stdlib/contract';
8
+ /**
9
+ * Represents a Merkle tree of functions for a particular Contract Class.
10
+ * It manages the construction of the function tree, computes its root, and generates membership witnesses
11
+ * for constrained functions. This class also enables lookup of specific function artifact using selectors.
12
+ * It is used in combination with the AztecNode to compute various data for executing private transactions.
13
+ */
14
+ export declare class PrivateFunctionsTree {
15
+ private readonly artifact;
16
+ private contractClass;
17
+ private tree?;
18
+ private constructor();
19
+ static create(artifact: ContractArtifact): Promise<PrivateFunctionsTree>;
20
+ /**
21
+ * Retrieve the artifact of a given function.
22
+ * The function is identified by its selector, which represents a unique identifier for the function's signature.
23
+ * Throws an error if the function with the provided selector is not found in the contract.
24
+ *
25
+ * @param selector - The function selector.
26
+ * @returns The artifact object containing relevant information about the targeted function.
27
+ */
28
+ getFunctionArtifact(selector: FunctionSelector): Promise<import("@aztec/stdlib/abi").FunctionArtifact>;
29
+ /**
30
+ * Retrieve the bytecode of a function in the contract by its function selector.
31
+ * The function selector is a unique identifier for each function in a contract.
32
+ * Throws an error if the function with the given selector is not found in the contract.
33
+ *
34
+ * @param selector - The selector of a function to get bytecode for.
35
+ * @returns The bytecode of the function as a string.
36
+ */
37
+ getBytecode(selector: FunctionSelector): Promise<Buffer>;
38
+ /**
39
+ * Calculate and return the root of the function tree for the current contract.
40
+ * This root is a cryptographic commitment to the set of constrained functions within the contract,
41
+ * which is used in the Aztec node's proof system. The root will be cached after the first call.
42
+ *
43
+ * @returns A promise that resolves to the Fr (finite field element) representation of the function tree root.
44
+ */
45
+ getFunctionTreeRoot(): Promise<MerkleTree>;
46
+ /** Returns the contract class object. */
47
+ getContractClass(): ContractClassWithId;
48
+ /** Returns the contract artifact. */
49
+ getArtifact(): ContractArtifact;
50
+ /**
51
+ * Returns the contract class identifier for the given artifact.
52
+ */
53
+ getContractClassId(): Fr;
54
+ /**
55
+ * Retrieve the membership witness of a function within a contract's function tree.
56
+ * A membership witness represents the position and authentication path of a target function
57
+ * in the Merkle tree of constrained functions. It is required to prove the existence of the
58
+ * function within the contract during execution. Throws if fn does not exist or is not private.
59
+ *
60
+ * @param selector - The function selector.
61
+ * @returns A MembershipWitness instance representing the position and authentication path of the function in the function tree.
62
+ */
63
+ getFunctionMembershipWitness(selector: FunctionSelector): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT>>;
64
+ private getTree;
65
+ }
66
+ //# sourceMappingURL=private_functions_tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../src/contract_data_provider/private_functions_tree.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EACL,KAAK,mBAAmB,EAIzB,MAAM,wBAAwB,CAAC;AAEhC;;;;;GAKG;AACH,qBAAa,oBAAoB;IAGX,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAAoB,OAAO,CAAC,aAAa;IAFtF,OAAO,CAAC,IAAI,CAAC,CAAa;IAE1B,OAAO;WAEM,MAAM,CAAC,QAAQ,EAAE,gBAAgB;IAK9C;;;;;;;OAOG;IACU,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB;IAkB3D;;;;;;;OAOG;IACU,WAAW,CAAC,QAAQ,EAAE,gBAAgB;IAKnD;;;;;;OAMG;IACI,mBAAmB;IAI1B,yCAAyC;IAClC,gBAAgB;IAIvB,qCAAqC;IAC9B,WAAW;IAIlB;;OAEG;IACI,kBAAkB;IAIzB;;;;;;;;OAQG;IACU,4BAA4B,CACvC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC;YAiB5C,OAAO;CAOtB"}
@@ -0,0 +1,3 @@
1
+ export * from './kv_pxe_database.js';
2
+ export * from './interfaces/index.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/database/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { Fr } from '@aztec/foundation/fields';
2
+ import type { ContractArtifact } from '@aztec/stdlib/abi';
3
+ /**
4
+ * PXE database for managing contract artifacts.
5
+ */
6
+ export interface ContractArtifactDatabase {
7
+ /**
8
+ * Adds a new contract artifact to the database or updates an existing one.
9
+ * @param id - Id of the corresponding contract class.
10
+ * @param contract - Contract artifact to add.
11
+ * @throws - If there are duplicate private function selectors.
12
+ */
13
+ addContractArtifact(id: Fr, contract: ContractArtifact): Promise<void>;
14
+ /**
15
+ * Gets a contract artifact given its resulting contract class id.
16
+ * @param id - Contract class id for the given artifact.
17
+ */
18
+ getContractArtifact(id: Fr): Promise<ContractArtifact | undefined>;
19
+ }
20
+ //# sourceMappingURL=contract_artifact_db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract_artifact_db.d.ts","sourceRoot":"","sources":["../../../src/database/interfaces/contract_artifact_db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvE;;;OAGG;IACH,mBAAmB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;CACpE"}
@@ -0,0 +1,20 @@
1
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
+ /**
4
+ * PXE database for managing contract instances.
5
+ */
6
+ export interface ContractInstanceDatabase {
7
+ /**
8
+ * Adds a new contract to the db or updates an existing one.
9
+ * @param contract - Contract to insert.
10
+ */
11
+ addContractInstance(contract: ContractInstanceWithAddress): Promise<void>;
12
+ /**
13
+ * Gets a contract given its address.
14
+ * @param address - Address of the contract.
15
+ */
16
+ getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
17
+ /** Returns the addresses all contract instances registered in the DB. */
18
+ getContractsAddresses(): Promise<AztecAddress[]>;
19
+ }
20
+ //# sourceMappingURL=contract_instance_db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract_instance_db.d.ts","sourceRoot":"","sources":["../../../src/database/interfaces/contract_instance_db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,mBAAmB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC,CAAC;IAE7F,yEAAyE;IACzE,qBAAqB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;CAClD"}
@@ -0,0 +1,4 @@
1
+ export type { ContractArtifactDatabase } from './contract_artifact_db.js';
2
+ export type { ContractInstanceDatabase } from './contract_instance_db.js';
3
+ export type { PxeDatabase } from './pxe_database.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/database/interfaces/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,YAAY,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,211 @@
1
+ import type { Fr } from '@aztec/foundation/fields';
2
+ import type { ContractArtifact } from '@aztec/stdlib/abi';
3
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
+ import type { InBlock } from '@aztec/stdlib/block';
5
+ import type { CompleteAddress, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
6
+ import type { PublicKey } from '@aztec/stdlib/keys';
7
+ import type { IndexedTaggingSecret } from '@aztec/stdlib/logs';
8
+ import type { NotesFilter } from '@aztec/stdlib/note';
9
+ import type { BlockHeader } from '@aztec/stdlib/tx';
10
+ import type { NoteDao } from '../note_dao.js';
11
+ import type { ContractArtifactDatabase } from './contract_artifact_db.js';
12
+ import type { ContractInstanceDatabase } from './contract_instance_db.js';
13
+ /**
14
+ * A database interface that provides methods for retrieving, adding, and removing transactional data related to Aztec
15
+ * addresses, storage slots, and nullifiers.
16
+ */
17
+ export interface PxeDatabase extends ContractArtifactDatabase, ContractInstanceDatabase {
18
+ getContract(address: AztecAddress): Promise<(ContractInstanceWithAddress & ContractArtifact) | undefined>;
19
+ /**
20
+ * Add a auth witness to the database.
21
+ * @param messageHash - The message hash.
22
+ * @param witness - An array of field elements representing the auth witness.
23
+ */
24
+ addAuthWitness(messageHash: Fr, witness: Fr[]): Promise<void>;
25
+ /**
26
+ * Fetching the auth witness for a given message hash.
27
+ * @param messageHash - The message hash.
28
+ * @returns A Promise that resolves to an array of field elements representing the auth witness.
29
+ */
30
+ getAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
31
+ /**
32
+ * Gets notes based on the provided filter.
33
+ * @param filter - The filter to apply to the notes.
34
+ * @returns The requested notes.
35
+ */
36
+ getNotes(filter: NotesFilter): Promise<NoteDao[]>;
37
+ /**
38
+ * Adds a note to DB.
39
+ * @param note - The note to add.
40
+ * @param scope - The scope to add the note under. Currently optional.
41
+ * @remark - Will create a database for the scope if it does not already exist.
42
+ */
43
+ addNote(note: NoteDao, scope?: AztecAddress): Promise<void>;
44
+ /**
45
+ * Adds a nullified note to DB.
46
+ * @param note - The note to add.
47
+ */
48
+ addNullifiedNote(note: NoteDao): Promise<void>;
49
+ /**
50
+ * Adds an array of notes to DB.
51
+ * This function is used to insert multiple notes to the database at once,
52
+ * which can improve performance when dealing with large numbers of transactions.
53
+ *
54
+ * @param notes - An array of notes.
55
+ * @param scope - The scope to add the notes under. Currently optional.
56
+ * @remark - Will create a database for the scope if it does not already exist.
57
+ */
58
+ addNotes(notes: NoteDao[], scope?: AztecAddress): Promise<void>;
59
+ /**
60
+ * Remove nullified notes associated with the given account and nullifiers.
61
+ *
62
+ * @param nullifiers - An array of Fr instances representing nullifiers to be matched.
63
+ * @param account - A PublicKey instance representing the account for which the records are being removed.
64
+ * @returns Removed notes.
65
+ */
66
+ removeNullifiedNotes(nullifiers: InBlock<Fr>[], account: PublicKey): Promise<NoteDao[]>;
67
+ /**
68
+ * Gets the most recently processed block number.
69
+ * @returns The most recently processed block number or undefined if never synched.
70
+ */
71
+ getBlockNumber(): Promise<number | undefined>;
72
+ /**
73
+ * Retrieve the stored Block Header from the database.
74
+ * The function returns a Promise that resolves to the Block Header.
75
+ * This data is required to reproduce block attestations.
76
+ * Throws an error if the block header is not available within the database.
77
+ *
78
+ * note: this data is a combination of the tree roots and the global variables hash.
79
+ *
80
+ * @returns The Block Header.
81
+ * @throws If no block have been processed yet.
82
+ */
83
+ getBlockHeader(): Promise<BlockHeader>;
84
+ /**
85
+ * Set the latest Block Header.
86
+ * Note that this will overwrite any existing hash or roots in the database.
87
+ *
88
+ * @param header - An object containing the most recent block header.
89
+ * @returns A Promise that resolves when the hash has been successfully updated in the database.
90
+ */
91
+ setHeader(header: BlockHeader): Promise<void>;
92
+ /**
93
+ * Adds sender address to the database.
94
+ * @param address - The address to add to the address book.
95
+ * @returns A promise resolving to true if the address was added, false if it already exists.
96
+ */
97
+ addSenderAddress(address: AztecAddress): Promise<boolean>;
98
+ /**
99
+ * Retrieves the list of sender addresses in the address book.
100
+ * @returns An array of Aztec addresses.
101
+ */
102
+ getSenderAddresses(): Promise<AztecAddress[]>;
103
+ /**
104
+ * Removes a sender address from the database.
105
+ * @param address - The address to remove from the address book.
106
+ * @returns A promise resolving to true if the address was removed, false if it does not exist.
107
+ */
108
+ removeSenderAddress(address: AztecAddress): Promise<boolean>;
109
+ /**
110
+ * Adds complete address to the database.
111
+ * @param address - The complete address to add.
112
+ * @returns A promise resolving to true if the address was added, false if it already exists.
113
+ * @throws If we try to add a CompleteAddress with the same AztecAddress but different public key or partial
114
+ * address.
115
+ */
116
+ addCompleteAddress(address: CompleteAddress): Promise<boolean>;
117
+ /**
118
+ * Retrieve the complete address associated to a given address.
119
+ * @param account - The account address.
120
+ * @returns A promise that resolves to a CompleteAddress instance if found, or undefined if not found.
121
+ */
122
+ getCompleteAddress(account: AztecAddress): Promise<CompleteAddress | undefined>;
123
+ /**
124
+ * Retrieves the list of complete addresses added to this database
125
+ * @returns A promise that resolves to an array of AztecAddress instances.
126
+ */
127
+ getCompleteAddresses(): Promise<CompleteAddress[]>;
128
+ /**
129
+ * Returns the estimated size in bytes of this db.
130
+ * @returns The estimated size in bytes of this db.
131
+ */
132
+ estimateSize(): Promise<number>;
133
+ /**
134
+ * Returns the last seen indexes for the provided app siloed tagging secrets or 0 if they've never been seen.
135
+ * @param appTaggingSecrets - The app siloed tagging secrets.
136
+ * @returns The indexes for the provided secrets, 0 if they've never been seen.
137
+ */
138
+ getTaggingSecretsIndexesAsRecipient(appTaggingSecrets: Fr[]): Promise<number[]>;
139
+ /**
140
+ * Returns the last seen indexes for the provided app siloed tagging secrets or 0 if they've never been used
141
+ * @param appTaggingSecrets - The app siloed tagging secrets.
142
+ * @returns The indexes for the provided secrets, 0 if they've never been seen.
143
+ */
144
+ getTaggingSecretsIndexesAsSender(appTaggingSecrets: Fr[]): Promise<number[]>;
145
+ /**
146
+ * Sets the index for the provided app siloed tagging secrets
147
+ * To be used when the generated tags have been "seen" as a sender
148
+ * @param appTaggingSecrets - The app siloed tagging secrets.
149
+ */
150
+ setTaggingSecretsIndexesAsSender(indexedTaggingSecrets: IndexedTaggingSecret[]): Promise<void>;
151
+ /**
152
+ * Sets the index for the provided app siloed tagging secrets
153
+ * To be used when the generated tags have been "seen" as a recipient
154
+ * @param appTaggingSecrets - The app siloed tagging secrets.
155
+ */
156
+ setTaggingSecretsIndexesAsRecipient(indexedTaggingSecrets: IndexedTaggingSecret[]): Promise<void>;
157
+ /**
158
+ * Deletes all notes synched after this block number.
159
+ * @param blockNumber - All notes strictly after this block number are removed.
160
+ */
161
+ removeNotesAfter(blockNumber: number): Promise<void>;
162
+ /**
163
+ * Restores notes nullified after the given block.
164
+ * @param blockNumber - All nullifiers strictly after this block are removed.
165
+ */
166
+ unnullifyNotesAfter(blockNumber: number): Promise<void>;
167
+ /**
168
+ * Resets the indexes used to sync notes to 0 for every sender and recipient, causing the next sync process to
169
+ * start from scratch, taking longer than usual.
170
+ * This can help fix desynchronization issues, including finding logs that had previously been overlooked, and
171
+ * is also required to deal with chain reorgs.
172
+ */
173
+ resetNoteSyncData(): Promise<void>;
174
+ /**
175
+ * Stores arbitrary information in a per-contract non-volatile database (called capsules), which can later
176
+ * be retrieved with `loadCapsule`. If data was already stored at this slot, it is overwritten.
177
+ * @param contractAddress - The contract address to scope the data under.
178
+ * @param slot - The slot in the database in which to store the value. Slots need not be contiguous.
179
+ * @param capsule - An array of field elements representing the capsule.
180
+ * @remarks A capsule is a "blob" of data that is passed to the contract through an oracle. It works similarly
181
+ * to public contract storage in that it's indexed by the contract address and storage slot but instead of the global
182
+ * network state it's backed by local PXE db.
183
+ */
184
+ storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void>;
185
+ /**
186
+ * Returns data previously stored via `storeCapsule` in the per-contract non-volatile database (called capsules).
187
+ * @param contractAddress - The contract address under which the data is scoped.
188
+ * @param slot - The slot in the database to read.
189
+ * @returns The stored data or `null` if no data is stored under the slot.
190
+ */
191
+ loadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null>;
192
+ /**
193
+ * Deletes data in the per-contract non-volatile database (called capsules). Does nothing if no data was present.
194
+ * @param contractAddress - The contract address under which the data is scoped.
195
+ * @param slot - The slot in the database to delete.
196
+ */
197
+ deleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void>;
198
+ /**
199
+ * Copies a number of contiguous entries in the per-contract non-volatile database (called capsules). This allows for
200
+ * efficient data structures by avoiding repeated calls to `loadCapsule` and `storeCapsule`.
201
+ * Supports overlapping source and destination regions (which will result in the overlapped source values being
202
+ * overwritten). All copied slots must exist in the database (i.e. have been stored and not deleted)
203
+ *
204
+ * @param contractAddress - The contract address under which the data is scoped.
205
+ * @param srcSlot - The first slot to copy from.
206
+ * @param dstSlot - The first slot to copy to.
207
+ * @param numEntries - The number of entries to copy.
208
+ */
209
+ copyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number): Promise<void>;
210
+ }
211
+ //# sourceMappingURL=pxe_database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pxe_database.d.ts","sourceRoot":"","sources":["../../../src/database/interfaces/pxe_database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AA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AM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD;;;;;OAKG;IACH,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnC;;;;;;;;;OASG;IACH,YAAY,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpF;;;;;OAKG;IACH,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAE3E;;;;OAIG;IACH,aAAa,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtE;;;;;;;;;;OAUG;IACH,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzG"}
@@ -0,0 +1,7 @@
1
+ import type { PxeDatabase } from './pxe_database.js';
2
+ /**
3
+ * A common test suite for a PXE database.
4
+ * @param getDatabase - A function that returns a database instance.
5
+ */
6
+ export declare function describePxeDatabase(getDatabase: () => PxeDatabase): void;
7
+ //# sourceMappingURL=pxe_database_test_suite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pxe_database_test_suite.d.ts","sourceRoot":"","sources":["../../../src/database/interfaces/pxe_database_test_suite.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,WAAW,QAuhBjE"}
@@ -0,0 +1,57 @@
1
+ import { Fr, type Point } from '@aztec/foundation/fields';
2
+ import { type LogFn } from '@aztec/foundation/log';
3
+ import type { AztecAsyncKVStore } from '@aztec/kv-store';
4
+ import { type ContractArtifact } from '@aztec/stdlib/abi';
5
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
6
+ import type { InBlock } from '@aztec/stdlib/block';
7
+ import { CompleteAddress, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
8
+ import type { IndexedTaggingSecret } from '@aztec/stdlib/logs';
9
+ import { type NotesFilter } from '@aztec/stdlib/note';
10
+ import { BlockHeader } from '@aztec/stdlib/tx';
11
+ import type { PxeDatabase } from './interfaces/pxe_database.js';
12
+ import { NoteDao } from './note_dao.js';
13
+ /**
14
+ * A PXE database backed by LMDB.
15
+ */
16
+ export declare class KVPxeDatabase implements PxeDatabase {
17
+ #private;
18
+ private db;
19
+ debug: LogFn;
20
+ protected constructor(db: AztecAsyncKVStore);
21
+ static create(db: AztecAsyncKVStore): Promise<KVPxeDatabase>;
22
+ getContract(address: AztecAddress): Promise<(ContractInstanceWithAddress & ContractArtifact) | undefined>;
23
+ addContractArtifact(id: Fr, contract: ContractArtifact): Promise<void>;
24
+ getContractArtifact(id: Fr): Promise<ContractArtifact | undefined>;
25
+ addContractInstance(contract: ContractInstanceWithAddress): Promise<void>;
26
+ getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
27
+ getContractsAddresses(): Promise<AztecAddress[]>;
28
+ addAuthWitness(messageHash: Fr, witness: Fr[]): Promise<void>;
29
+ getAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
30
+ addNote(note: NoteDao, scope?: AztecAddress): Promise<void>;
31
+ addNotes(notes: NoteDao[], scope?: AztecAddress): Promise<void>;
32
+ removeNotesAfter(blockNumber: number): Promise<void>;
33
+ unnullifyNotesAfter(blockNumber: number): Promise<void>;
34
+ getNotes(filter: NotesFilter): Promise<NoteDao[]>;
35
+ removeNullifiedNotes(nullifiers: InBlock<Fr>[], accountAddressPoint: Point): Promise<NoteDao[]>;
36
+ addNullifiedNote(note: NoteDao): Promise<void>;
37
+ setHeader(header: BlockHeader): Promise<void>;
38
+ getBlockNumber(): Promise<number | undefined>;
39
+ getBlockHeader(): Promise<BlockHeader>;
40
+ addCompleteAddress(completeAddress: CompleteAddress): Promise<boolean>;
41
+ getCompleteAddress(account: AztecAddress): Promise<CompleteAddress | undefined>;
42
+ getCompleteAddresses(): Promise<CompleteAddress[]>;
43
+ addSenderAddress(address: AztecAddress): Promise<boolean>;
44
+ getSenderAddresses(): Promise<AztecAddress[]>;
45
+ removeSenderAddress(address: AztecAddress): Promise<boolean>;
46
+ estimateSize(): Promise<number>;
47
+ setTaggingSecretsIndexesAsSender(indexedSecrets: IndexedTaggingSecret[]): Promise<void>;
48
+ setTaggingSecretsIndexesAsRecipient(indexedSecrets: IndexedTaggingSecret[]): Promise<void>;
49
+ getTaggingSecretsIndexesAsRecipient(appTaggingSecrets: Fr[]): Promise<number[]>;
50
+ getTaggingSecretsIndexesAsSender(appTaggingSecrets: Fr[]): Promise<number[]>;
51
+ resetNoteSyncData(): Promise<void>;
52
+ storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void>;
53
+ loadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null>;
54
+ deleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void>;
55
+ copyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number): Promise<void>;
56
+ }
57
+ //# sourceMappingURL=kv_pxe_database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kv_pxe_database.d.ts","sourceRoot":"","sources":["../../src/database/kv_pxe_database.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,KAAK,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,KAAK,KAAK,EAAyB,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAEV,iBAAiB,EAIlB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,gBAAgB,EAAkC,MAAM,mBAAmB,CAAC;AAE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