@aztec/pxe 0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2 → 0.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dest/bin/index.d.ts +3 -0
  2. package/dest/bin/index.d.ts.map +1 -0
  3. package/dest/bin/index.js +5 -3
  4. package/dest/config/index.d.ts +46 -0
  5. package/dest/config/index.d.ts.map +1 -0
  6. package/dest/config/index.js +21 -18
  7. package/dest/config/package_info.d.ts +5 -0
  8. package/dest/config/package_info.d.ts.map +1 -0
  9. package/dest/config/package_info.js +2 -4
  10. package/dest/contract_data_oracle/index.d.ts +104 -0
  11. package/dest/contract_data_oracle/index.d.ts.map +1 -0
  12. package/dest/contract_data_oracle/index.js +79 -69
  13. package/dest/contract_data_oracle/private_functions_tree.d.ts +65 -0
  14. package/dest/contract_data_oracle/private_functions_tree.d.ts.map +1 -0
  15. package/dest/contract_data_oracle/private_functions_tree.js +50 -44
  16. package/dest/database/contracts/contract_artifact_db.d.ts +20 -0
  17. package/dest/database/contracts/contract_artifact_db.d.ts.map +1 -0
  18. package/dest/database/contracts/contract_artifact_db.js +2 -3
  19. package/dest/database/contracts/contract_instance_db.d.ts +19 -0
  20. package/dest/database/contracts/contract_instance_db.d.ts.map +1 -0
  21. package/dest/database/contracts/contract_instance_db.js +2 -3
  22. package/dest/database/index.d.ts +3 -0
  23. package/dest/database/index.d.ts.map +1 -0
  24. package/dest/database/index.js +1 -0
  25. package/dest/database/kv_pxe_database.d.ts +55 -0
  26. package/dest/database/kv_pxe_database.d.ts.map +1 -0
  27. package/dest/database/kv_pxe_database.js +259 -243
  28. package/dest/database/note_dao.d.ts +103 -0
  29. package/dest/database/note_dao.d.ts.map +1 -0
  30. package/dest/database/note_dao.js +43 -28
  31. package/dest/database/outgoing_note_dao.d.ts +73 -0
  32. package/dest/database/outgoing_note_dao.d.ts.map +1 -0
  33. package/dest/database/outgoing_note_dao.js +34 -20
  34. package/dest/database/pxe_database.d.ts +216 -0
  35. package/dest/database/pxe_database.d.ts.map +1 -0
  36. package/dest/database/pxe_database.js +2 -4
  37. package/dest/database/pxe_database_test_suite.d.ts +7 -0
  38. package/dest/database/pxe_database_test_suite.d.ts.map +1 -0
  39. package/dest/database/pxe_database_test_suite.js +151 -296
  40. package/dest/index.d.ts +15 -0
  41. package/dest/index.d.ts.map +1 -0
  42. package/dest/index.js +1 -0
  43. package/dest/kernel_oracle/index.d.ts +34 -0
  44. package/dest/kernel_oracle/index.d.ts.map +1 -0
  45. package/dest/kernel_oracle/index.js +6 -9
  46. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +28 -0
  47. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
  48. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +66 -68
  49. package/dest/kernel_prover/hints/index.d.ts +2 -0
  50. package/dest/kernel_prover/hints/index.d.ts.map +1 -0
  51. package/dest/kernel_prover/hints/index.js +1 -0
  52. package/dest/kernel_prover/index.d.ts +3 -0
  53. package/dest/kernel_prover/index.d.ts.map +1 -0
  54. package/dest/kernel_prover/index.js +1 -0
  55. package/dest/kernel_prover/kernel_prover.d.ts +38 -0
  56. package/dest/kernel_prover/kernel_prover.d.ts.map +1 -0
  57. package/dest/kernel_prover/kernel_prover.js +65 -60
  58. package/dest/kernel_prover/proving_data_oracle.d.ts +65 -0
  59. package/dest/kernel_prover/proving_data_oracle.d.ts.map +1 -0
  60. package/dest/kernel_prover/proving_data_oracle.js +2 -4
  61. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +10 -0
  62. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +1 -0
  63. package/dest/note_decryption_utils/add_public_values_to_payload.js +9 -8
  64. package/dest/pxe_http/index.d.ts +2 -0
  65. package/dest/pxe_http/index.d.ts.map +1 -0
  66. package/dest/pxe_http/index.js +1 -0
  67. package/dest/pxe_http/pxe_http_server.d.ts +16 -0
  68. package/dest/pxe_http/pxe_http_server.d.ts.map +1 -0
  69. package/dest/pxe_http/pxe_http_server.js +6 -8
  70. package/dest/pxe_service/error_enriching.d.ts +11 -0
  71. package/dest/pxe_service/error_enriching.d.ts.map +1 -0
  72. package/dest/pxe_service/error_enriching.js +13 -10
  73. package/dest/pxe_service/index.d.ts +4 -0
  74. package/dest/pxe_service/index.d.ts.map +1 -0
  75. package/dest/pxe_service/index.js +1 -0
  76. package/dest/pxe_service/pxe_service.d.ts +98 -0
  77. package/dest/pxe_service/pxe_service.d.ts.map +1 -0
  78. package/dest/pxe_service/pxe_service.js +290 -282
  79. package/dest/pxe_service/test/pxe_test_suite.d.ts +3 -0
  80. package/dest/pxe_service/test/pxe_test_suite.d.ts.map +1 -0
  81. package/dest/pxe_service/test/pxe_test_suite.js +27 -40
  82. package/dest/simulator/index.d.ts +10 -0
  83. package/dest/simulator/index.d.ts.map +1 -0
  84. package/dest/simulator/index.js +3 -1
  85. package/dest/simulator_oracle/index.d.ts +129 -0
  86. package/dest/simulator_oracle/index.d.ts.map +1 -0
  87. package/dest/simulator_oracle/index.js +231 -266
  88. package/dest/simulator_oracle/tagging_utils.d.ts +16 -0
  89. package/dest/simulator_oracle/tagging_utils.d.ts.map +1 -0
  90. package/dest/simulator_oracle/tagging_utils.js +6 -4
  91. package/dest/synchronizer/index.d.ts +2 -0
  92. package/dest/synchronizer/index.d.ts.map +1 -0
  93. package/dest/synchronizer/index.js +1 -0
  94. package/dest/synchronizer/synchronizer.d.ts +30 -0
  95. package/dest/synchronizer/synchronizer.d.ts.map +1 -0
  96. package/dest/synchronizer/synchronizer.js +42 -42
  97. package/dest/utils/create_pxe_service.d.ts +16 -0
  98. package/dest/utils/create_pxe_service.d.ts.map +1 -0
  99. package/dest/utils/create_pxe_service.js +9 -9
  100. package/package.json +15 -15
  101. package/src/pxe_service/pxe_service.ts +10 -5
@@ -1,4 +1,4 @@
1
- import { FUNCTION_TREE_HEIGHT, MembershipWitness, computePrivateFunctionLeaf, computePrivateFunctionsTree, getContractClassFromArtifact } from '@aztec/circuits.js';
1
+ import { FUNCTION_TREE_HEIGHT, MembershipWitness, computePrivateFunctionLeaf, computePrivateFunctionsTree, getContractClassFromArtifact, } from '@aztec/circuits.js';
2
2
  import { FunctionSelector } from '@aztec/foundation/abi';
3
3
  import { Fr } from '@aztec/foundation/fields';
4
4
  import { assertLength } from '@aztec/foundation/serialize';
@@ -7,11 +7,9 @@ import { assertLength } from '@aztec/foundation/serialize';
7
7
  * It manages the construction of the function tree, computes its root, and generates membership witnesses
8
8
  * for constrained functions. This class also enables lookup of specific function artifact using selectors.
9
9
  * It is used in combination with the AztecNode to compute various data for executing private transactions.
10
- */ export class PrivateFunctionsTree {
11
- artifact;
12
- contractClass;
13
- tree;
14
- constructor(artifact, contractClass){
10
+ */
11
+ export class PrivateFunctionsTree {
12
+ constructor(artifact, contractClass) {
15
13
  this.artifact = artifact;
16
14
  this.contractClass = contractClass;
17
15
  }
@@ -20,64 +18,71 @@ import { assertLength } from '@aztec/foundation/serialize';
20
18
  return new PrivateFunctionsTree(artifact, contractClass);
21
19
  }
22
20
  /**
23
- * Retrieve the artifact of a given function.
24
- * The function is identified by its selector, which represents a unique identifier for the function's signature.
25
- * Throws an error if the function with the provided selector is not found in the contract.
26
- *
27
- * @param selector - The function selector.
28
- * @returns The artifact object containing relevant information about the targeted function.
29
- */ async getFunctionArtifact(selector) {
30
- const functionsAndSelectors = await Promise.all(this.artifact.functions.map(async (f)=>({
31
- f,
32
- selector: await FunctionSelector.fromNameAndParameters(f.name, f.parameters)
33
- })));
34
- const artifact = functionsAndSelectors.find((f)=>selector.equals(f.selector))?.f;
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
+ async getFunctionArtifact(selector) {
29
+ const functionsAndSelectors = await Promise.all(this.artifact.functions.map(async (f) => ({
30
+ f,
31
+ selector: await FunctionSelector.fromNameAndParameters(f.name, f.parameters),
32
+ })));
33
+ const artifact = functionsAndSelectors.find(f => selector.equals(f.selector))?.f;
35
34
  if (!artifact) {
36
35
  throw new Error(`Unknown function. Selector ${selector.toString()} not found in the artifact ${this.artifact.name} with class ${this.getContractClassId().toString()}.`);
37
36
  }
38
37
  return artifact;
39
38
  }
40
39
  /**
41
- * Retrieve the bytecode of a function in the contract by its function selector.
42
- * The function selector is a unique identifier for each function in a contract.
43
- * Throws an error if the function with the given selector is not found in the contract.
44
- *
45
- * @param selector - The selector of a function to get bytecode for.
46
- * @returns The bytecode of the function as a string.
47
- */ async getBytecode(selector) {
40
+ * Retrieve the bytecode of a function in the contract by its function selector.
41
+ * The function selector is a unique identifier for each function in a contract.
42
+ * Throws an error if the function with the given selector is not found in the contract.
43
+ *
44
+ * @param selector - The selector of a function to get bytecode for.
45
+ * @returns The bytecode of the function as a string.
46
+ */
47
+ async getBytecode(selector) {
48
48
  const artifact = await this.getFunctionArtifact(selector);
49
49
  return artifact.bytecode;
50
50
  }
51
51
  /**
52
- * Calculate and return the root of the function tree for the current contract.
53
- * This root is a cryptographic commitment to the set of constrained functions within the contract,
54
- * which is used in the Aztec node's proof system. The root will be cached after the first call.
55
- *
56
- * @returns A promise that resolves to the Fr (finite field element) representation of the function tree root.
57
- */ getFunctionTreeRoot() {
52
+ * Calculate and return the root of the function tree for the current contract.
53
+ * This root is a cryptographic commitment to the set of constrained functions within the contract,
54
+ * which is used in the Aztec node's proof system. The root will be cached after the first call.
55
+ *
56
+ * @returns A promise that resolves to the Fr (finite field element) representation of the function tree root.
57
+ */
58
+ getFunctionTreeRoot() {
58
59
  return this.getTree();
59
60
  }
60
- /** Returns the contract class object. */ getContractClass() {
61
+ /** Returns the contract class object. */
62
+ getContractClass() {
61
63
  return this.contractClass;
62
64
  }
63
- /** Returns the contract artifact. */ getArtifact() {
65
+ /** Returns the contract artifact. */
66
+ getArtifact() {
64
67
  return this.artifact;
65
68
  }
66
69
  /**
67
- * Returns the contract class identifier for the given artifact.
68
- */ getContractClassId() {
70
+ * Returns the contract class identifier for the given artifact.
71
+ */
72
+ getContractClassId() {
69
73
  return this.getContractClass().id;
70
74
  }
71
75
  /**
72
- * Retrieve the membership witness of a function within a contract's function tree.
73
- * A membership witness represents the position and authentication path of a target function
74
- * in the Merkle tree of constrained functions. It is required to prove the existence of the
75
- * function within the contract during execution. Throws if fn does not exist or is not private.
76
- *
77
- * @param selector - The function selector.
78
- * @returns A MembershipWitness instance representing the position and authentication path of the function in the function tree.
79
- */ async getFunctionMembershipWitness(selector) {
80
- const fn = this.getContractClass().privateFunctions.find((f)=>f.selector.equals(selector));
76
+ * Retrieve the membership witness of a function within a contract's function tree.
77
+ * A membership witness represents the position and authentication path of a target function
78
+ * in the Merkle tree of constrained functions. It is required to prove the existence of the
79
+ * function within the contract during execution. Throws if fn does not exist or is not private.
80
+ *
81
+ * @param selector - The function selector.
82
+ * @returns A MembershipWitness instance representing the position and authentication path of the function in the function tree.
83
+ */
84
+ async getFunctionMembershipWitness(selector) {
85
+ const fn = this.getContractClass().privateFunctions.find(f => f.selector.equals(selector));
81
86
  if (!fn) {
82
87
  throw new Error(`Private function with selector ${selector.toString()} not found in contract class.`);
83
88
  }
@@ -95,3 +100,4 @@ import { assertLength } from '@aztec/foundation/serialize';
95
100
  return this.tree;
96
101
  }
97
102
  }
103
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9mdW5jdGlvbnNfdHJlZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdF9kYXRhX29yYWNsZS9wcml2YXRlX2Z1bmN0aW9uc190cmVlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFFTCxvQkFBb0IsRUF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QyxnQkFBZ0IsRUFBRSxDQUFDLGdCQUFnQixDQUFDO1lBQ3JELElBQUksQ0FBQyxJQUFJLEdBQUcsTUFBTSwyQkFBMkIsQ0FBQyxHQUFHLENBQUMsQ0FBQztRQUNyRCxDQUFDO1FBQ0QsT0FBTyxJQUFJLENBQUMsSUFBSSxDQUFDO0lBQ25CLENBQUM7Q0FDRiJ9
@@ -0,0 +1,20 @@
1
+ import { type ContractArtifact } from '@aztec/foundation/abi';
2
+ import { type Fr } from '@aztec/foundation/fields';
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/contracts/contract_artifact_db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD;;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"}
@@ -1,3 +1,2 @@
1
- /**
2
- * PXE database for managing contract artifacts.
3
- */ export { };
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfYXJ0aWZhY3RfZGIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvZGF0YWJhc2UvY29udHJhY3RzL2NvbnRyYWN0X2FydGlmYWN0X2RiLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
@@ -0,0 +1,19 @@
1
+ import { type AztecAddress, type ContractInstanceWithAddress } from '@aztec/circuits.js';
2
+ /**
3
+ * PXE database for managing contract instances.
4
+ */
5
+ export interface ContractInstanceDatabase {
6
+ /**
7
+ * Adds a new contract to the db or updates an existing one.
8
+ * @param contract - Contract to insert.
9
+ */
10
+ addContractInstance(contract: ContractInstanceWithAddress): Promise<void>;
11
+ /**
12
+ * Gets a contract given its address.
13
+ * @param address - Address of the contract.
14
+ */
15
+ getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
16
+ /** Returns the addresses all contract instances registered in the DB. */
17
+ getContractsAddresses(): Promise<AztecAddress[]>;
18
+ }
19
+ //# sourceMappingURL=contract_instance_db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract_instance_db.d.ts","sourceRoot":"","sources":["../../../src/database/contracts/contract_instance_db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEzF;;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"}
@@ -1,3 +1,2 @@
1
- /**
2
- * PXE database for managing contract instances.
3
- */ export { };
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfaW5zdGFuY2VfZGIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvZGF0YWJhc2UvY29udHJhY3RzL2NvbnRyYWN0X2luc3RhbmNlX2RiLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
@@ -0,0 +1,3 @@
1
+ export * from './pxe_database.js';
2
+ export * from './kv_pxe_database.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,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from './pxe_database.js';
2
2
  export * from './kv_pxe_database.js';
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZGF0YWJhc2UvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxtQkFBbUIsQ0FBQztBQUNsQyxjQUFjLHNCQUFzQixDQUFDIn0=
@@ -0,0 +1,55 @@
1
+ import { type InBlock, type NotesFilter } from '@aztec/circuit-types';
2
+ import { AztecAddress, BlockHeader, CompleteAddress, type ContractInstanceWithAddress, type IndexedTaggingSecret } from '@aztec/circuits.js';
3
+ import { type ContractArtifact } from '@aztec/foundation/abi';
4
+ import { Fr, type Point } from '@aztec/foundation/fields';
5
+ import { type LogFn } from '@aztec/foundation/log';
6
+ import { type AztecAsyncKVStore } from '@aztec/kv-store';
7
+ import { NoteDao } from './note_dao.js';
8
+ import { type PxeDatabase } from './pxe_database.js';
9
+ /**
10
+ * A PXE database backed by LMDB.
11
+ */
12
+ export declare class KVPxeDatabase implements PxeDatabase {
13
+ #private;
14
+ private db;
15
+ debug: LogFn;
16
+ protected constructor(db: AztecAsyncKVStore);
17
+ static create(db: AztecAsyncKVStore): Promise<KVPxeDatabase>;
18
+ getContract(address: AztecAddress): Promise<(ContractInstanceWithAddress & ContractArtifact) | undefined>;
19
+ addContractArtifact(id: Fr, contract: ContractArtifact): Promise<void>;
20
+ getContractArtifact(id: Fr): Promise<ContractArtifact | undefined>;
21
+ addContractInstance(contract: ContractInstanceWithAddress): Promise<void>;
22
+ getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
23
+ getContractsAddresses(): Promise<AztecAddress[]>;
24
+ addAuthWitness(messageHash: Fr, witness: Fr[]): Promise<void>;
25
+ getAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
26
+ addCapsule(capsule: Fr[]): Promise<void>;
27
+ popCapsule(): Promise<Fr[] | undefined>;
28
+ addNote(note: NoteDao, scope?: AztecAddress): Promise<void>;
29
+ addNotes(notes: NoteDao[], scope?: AztecAddress): Promise<void>;
30
+ removeNotesAfter(blockNumber: number): Promise<void>;
31
+ unnullifyNotesAfter(blockNumber: number): Promise<void>;
32
+ getNotes(filter: NotesFilter): Promise<NoteDao[]>;
33
+ removeNullifiedNotes(nullifiers: InBlock<Fr>[], accountAddressPoint: Point): Promise<NoteDao[]>;
34
+ addNullifiedNote(note: NoteDao): Promise<void>;
35
+ setHeader(header: BlockHeader): Promise<void>;
36
+ getBlockNumber(): Promise<number | undefined>;
37
+ getBlockHeader(): Promise<BlockHeader>;
38
+ addCompleteAddress(completeAddress: CompleteAddress): Promise<boolean>;
39
+ getCompleteAddress(account: AztecAddress): Promise<CompleteAddress | undefined>;
40
+ getCompleteAddresses(): Promise<CompleteAddress[]>;
41
+ addSenderAddress(address: AztecAddress): Promise<boolean>;
42
+ getSenderAddresses(): Promise<AztecAddress[]>;
43
+ removeSenderAddress(address: AztecAddress): Promise<boolean>;
44
+ estimateSize(): Promise<number>;
45
+ setTaggingSecretsIndexesAsSender(indexedSecrets: IndexedTaggingSecret[]): Promise<void>;
46
+ setTaggingSecretsIndexesAsRecipient(indexedSecrets: IndexedTaggingSecret[]): Promise<void>;
47
+ getTaggingSecretsIndexesAsRecipient(appTaggingSecrets: Fr[]): Promise<number[]>;
48
+ getTaggingSecretsIndexesAsSender(appTaggingSecrets: Fr[]): Promise<number[]>;
49
+ resetNoteSyncData(): Promise<void>;
50
+ dbStore(contractAddress: AztecAddress, slot: Fr, values: Fr[]): Promise<void>;
51
+ dbLoad(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null>;
52
+ dbDelete(contractAddress: AztecAddress, slot: Fr): Promise<void>;
53
+ dbCopy(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number): Promise<void>;
54
+ }
55
+ //# 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":"AAAA,OAAO,EAAE,KAAK,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EACL,YAAY,EACZ,WAAW,EACX,eAAe,EACf,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EAG1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,gBAAgB,EAAkC,MAAM,uBAAuB,CAAC;AAE9F,OAAO,EAAE,EAAE,EAAE,KAAK,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,KAAK,KAAK,EAAyB,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAEL,KAAK,iBAAiB,EAKvB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,OAAO,EAAE,MAAM,eA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