@aztec/pxe 0.77.0 → 0.78.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 (180) hide show
  1. package/dest/bin/index.js +1 -1
  2. package/dest/config/index.d.ts +1 -0
  3. package/dest/config/index.d.ts.map +1 -1
  4. package/dest/config/index.js +1 -0
  5. package/dest/entrypoints/client/bundle/index.d.ts +6 -0
  6. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -0
  7. package/dest/entrypoints/client/bundle/index.js +5 -0
  8. package/dest/entrypoints/client/bundle/utils.d.ts +16 -0
  9. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -0
  10. package/dest/entrypoints/client/bundle/utils.js +30 -0
  11. package/dest/entrypoints/client/lazy/index.d.ts +6 -0
  12. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -0
  13. package/dest/entrypoints/client/lazy/index.js +5 -0
  14. package/dest/entrypoints/client/lazy/utils.d.ts +15 -0
  15. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -0
  16. package/dest/entrypoints/client/lazy/utils.js +29 -0
  17. package/dest/entrypoints/client/pxe_creation_options.d.ts +11 -0
  18. package/dest/entrypoints/client/pxe_creation_options.d.ts.map +1 -0
  19. package/dest/entrypoints/server/index.d.ts +7 -0
  20. package/dest/entrypoints/server/index.d.ts.map +1 -0
  21. package/dest/entrypoints/server/index.js +6 -0
  22. package/dest/{utils/create_pxe_service.d.ts → entrypoints/server/utils.d.ts} +4 -4
  23. package/dest/entrypoints/server/utils.d.ts.map +1 -0
  24. package/dest/{utils/create_pxe_service.js → entrypoints/server/utils.js} +5 -11
  25. package/dest/kernel_oracle/index.d.ts +2 -1
  26. package/dest/kernel_oracle/index.d.ts.map +1 -1
  27. package/dest/kernel_prover/kernel_prover.d.ts.map +1 -1
  28. package/dest/kernel_prover/kernel_prover.js +0 -24
  29. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +2 -2
  30. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +1 -1
  31. package/dest/note_decryption_utils/add_public_values_to_payload.js +3 -3
  32. package/dest/{pxe_data_provider → pxe_oracle_interface}/index.d.ts +17 -9
  33. package/dest/pxe_oracle_interface/index.d.ts.map +1 -0
  34. package/dest/{pxe_data_provider → pxe_oracle_interface}/index.js +104 -61
  35. package/dest/pxe_oracle_interface/tagging_utils.d.ts.map +1 -0
  36. package/dest/pxe_service/error_enriching.d.ts +3 -4
  37. package/dest/pxe_service/error_enriching.d.ts.map +1 -1
  38. package/dest/pxe_service/error_enriching.js +4 -4
  39. package/dest/pxe_service/pxe_service.d.ts +18 -14
  40. package/dest/pxe_service/pxe_service.d.ts.map +1 -1
  41. package/dest/pxe_service/pxe_service.js +118 -65
  42. package/dest/storage/address_data_provider/address_data_provider.d.ts +13 -0
  43. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -0
  44. package/dest/storage/address_data_provider/address_data_provider.js +50 -0
  45. package/dest/storage/address_data_provider/index.d.ts +2 -0
  46. package/dest/storage/address_data_provider/index.d.ts.map +1 -0
  47. package/dest/storage/address_data_provider/index.js +1 -0
  48. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +11 -0
  49. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +1 -0
  50. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +20 -0
  51. package/dest/storage/auth_witness_data_provider/index.d.ts +2 -0
  52. package/dest/storage/auth_witness_data_provider/index.d.ts.map +1 -0
  53. package/dest/storage/auth_witness_data_provider/index.js +1 -0
  54. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +16 -0
  55. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -0
  56. package/dest/storage/capsule_data_provider/capsule_data_provider.js +57 -0
  57. package/dest/storage/capsule_data_provider/index.d.ts +2 -0
  58. package/dest/storage/capsule_data_provider/index.d.ts.map +1 -0
  59. package/dest/storage/capsule_data_provider/index.js +1 -0
  60. package/dest/{contract_data_provider → storage/contract_data_provider}/contract_data_provider.d.ts +38 -33
  61. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -0
  62. package/dest/{contract_data_provider → storage/contract_data_provider}/contract_data_provider.js +87 -42
  63. package/dest/storage/contract_data_provider/index.d.ts.map +1 -0
  64. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -0
  65. package/dest/storage/data_provider.d.ts +4 -0
  66. package/dest/storage/data_provider.d.ts.map +1 -0
  67. package/dest/storage/data_provider.js +1 -0
  68. package/dest/storage/index.d.ts +10 -0
  69. package/dest/storage/index.d.ts.map +1 -0
  70. package/dest/storage/index.js +9 -0
  71. package/dest/storage/note_data_provider/index.d.ts +3 -0
  72. package/dest/storage/note_data_provider/index.d.ts.map +1 -0
  73. package/dest/storage/note_data_provider/index.js +2 -0
  74. package/dest/storage/note_data_provider/note_dao.d.ts.map +1 -0
  75. package/dest/storage/note_data_provider/note_data_provider.d.ts +20 -0
  76. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -0
  77. package/dest/storage/note_data_provider/note_data_provider.js +249 -0
  78. package/dest/storage/sync_data_provider/index.d.ts +2 -0
  79. package/dest/storage/sync_data_provider/index.d.ts.map +1 -0
  80. package/dest/storage/sync_data_provider/index.js +1 -0
  81. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +12 -0
  82. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +1 -0
  83. package/dest/storage/sync_data_provider/sync_data_provider.js +29 -0
  84. package/dest/storage/tagging_data_provider/index.d.ts +2 -0
  85. package/dest/storage/tagging_data_provider/index.d.ts.map +1 -0
  86. package/dest/storage/tagging_data_provider/index.js +1 -0
  87. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +18 -0
  88. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +1 -0
  89. package/dest/storage/tagging_data_provider/tagging_data_provider.js +65 -0
  90. package/dest/synchronizer/synchronizer.d.ts +7 -3
  91. package/dest/synchronizer/synchronizer.d.ts.map +1 -1
  92. package/dest/synchronizer/synchronizer.js +16 -11
  93. package/dest/test/pxe_test_suite.d.ts.map +1 -0
  94. package/dest/{pxe_service/test → test}/pxe_test_suite.js +2 -6
  95. package/package.json +19 -26
  96. package/src/bin/index.ts +1 -1
  97. package/src/config/index.ts +2 -0
  98. package/src/entrypoints/client/bundle/index.ts +5 -0
  99. package/src/entrypoints/client/bundle/utils.ts +58 -0
  100. package/src/entrypoints/client/lazy/index.ts +5 -0
  101. package/src/entrypoints/client/lazy/utils.ts +53 -0
  102. package/src/entrypoints/client/pxe_creation_options.ts +7 -0
  103. package/src/entrypoints/server/index.ts +6 -0
  104. package/src/{utils/create_pxe_service.ts → entrypoints/server/utils.ts} +7 -18
  105. package/src/kernel_oracle/index.ts +1 -1
  106. package/src/kernel_prover/kernel_prover.ts +0 -46
  107. package/src/note_decryption_utils/add_public_values_to_payload.ts +4 -4
  108. package/src/{pxe_data_provider → pxe_oracle_interface}/index.ts +128 -96
  109. package/src/pxe_service/error_enriching.ts +8 -6
  110. package/src/pxe_service/pxe_service.ts +155 -89
  111. package/src/storage/address_data_provider/address_data_provider.ts +71 -0
  112. package/src/storage/address_data_provider/index.ts +1 -0
  113. package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +34 -0
  114. package/src/storage/auth_witness_data_provider/index.ts +1 -0
  115. package/src/storage/capsule_data_provider/capsule_data_provider.ts +80 -0
  116. package/src/storage/capsule_data_provider/index.ts +1 -0
  117. package/src/{contract_data_provider → storage/contract_data_provider}/contract_data_provider.ts +128 -48
  118. package/src/storage/data_provider.ts +3 -0
  119. package/src/storage/index.ts +10 -0
  120. package/src/storage/note_data_provider/index.ts +2 -0
  121. package/src/storage/note_data_provider/note_data_provider.ts +345 -0
  122. package/src/storage/sync_data_provider/index.ts +1 -0
  123. package/src/storage/sync_data_provider/sync_data_provider.ts +40 -0
  124. package/src/storage/tagging_data_provider/index.ts +1 -0
  125. package/src/storage/tagging_data_provider/tagging_data_provider.ts +92 -0
  126. package/src/synchronizer/synchronizer.ts +15 -10
  127. package/src/{pxe_service/test → test}/pxe_test_suite.ts +2 -9
  128. package/dest/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  129. package/dest/contract_data_provider/index.d.ts.map +0 -1
  130. package/dest/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  131. package/dest/database/index.d.ts +0 -3
  132. package/dest/database/index.d.ts.map +0 -1
  133. package/dest/database/index.js +0 -2
  134. package/dest/database/interfaces/contract_artifact_db.d.ts +0 -20
  135. package/dest/database/interfaces/contract_artifact_db.d.ts.map +0 -1
  136. package/dest/database/interfaces/contract_artifact_db.js +0 -3
  137. package/dest/database/interfaces/contract_instance_db.d.ts +0 -20
  138. package/dest/database/interfaces/contract_instance_db.d.ts.map +0 -1
  139. package/dest/database/interfaces/contract_instance_db.js +0 -3
  140. package/dest/database/interfaces/index.d.ts +0 -4
  141. package/dest/database/interfaces/index.d.ts.map +0 -1
  142. package/dest/database/interfaces/pxe_database.d.ts +0 -211
  143. package/dest/database/interfaces/pxe_database.d.ts.map +0 -1
  144. package/dest/database/interfaces/pxe_database.js +0 -4
  145. package/dest/database/interfaces/pxe_database_test_suite.d.ts +0 -7
  146. package/dest/database/interfaces/pxe_database_test_suite.d.ts.map +0 -1
  147. package/dest/database/interfaces/pxe_database_test_suite.js +0 -557
  148. package/dest/database/kv_pxe_database.d.ts +0 -58
  149. package/dest/database/kv_pxe_database.d.ts.map +0 -1
  150. package/dest/database/kv_pxe_database.js +0 -480
  151. package/dest/database/note_dao.d.ts.map +0 -1
  152. package/dest/index.d.ts +0 -9
  153. package/dest/index.d.ts.map +0 -1
  154. package/dest/index.js +0 -8
  155. package/dest/pxe_data_provider/index.d.ts.map +0 -1
  156. package/dest/pxe_data_provider/tagging_utils.d.ts.map +0 -1
  157. package/dest/pxe_service/test/pxe_test_suite.d.ts.map +0 -1
  158. package/dest/utils/create_pxe_service.d.ts.map +0 -1
  159. package/src/database/index.ts +0 -2
  160. package/src/database/interfaces/contract_artifact_db.ts +0 -20
  161. package/src/database/interfaces/contract_instance_db.ts +0 -21
  162. package/src/database/interfaces/index.ts +0 -3
  163. package/src/database/interfaces/pxe_database.ts +0 -240
  164. package/src/database/interfaces/pxe_database_test_suite.ts +0 -558
  165. package/src/database/kv_pxe_database.ts +0 -670
  166. package/src/index.ts +0 -9
  167. /package/dest/{database/interfaces/index.js → entrypoints/client/pxe_creation_options.js} +0 -0
  168. /package/dest/{pxe_data_provider → pxe_oracle_interface}/tagging_utils.d.ts +0 -0
  169. /package/dest/{pxe_data_provider → pxe_oracle_interface}/tagging_utils.js +0 -0
  170. /package/dest/{contract_data_provider → storage/contract_data_provider}/index.d.ts +0 -0
  171. /package/dest/{contract_data_provider → storage/contract_data_provider}/index.js +0 -0
  172. /package/dest/{contract_data_provider → storage/contract_data_provider}/private_functions_tree.d.ts +0 -0
  173. /package/dest/{contract_data_provider → storage/contract_data_provider}/private_functions_tree.js +0 -0
  174. /package/dest/{database → storage/note_data_provider}/note_dao.d.ts +0 -0
  175. /package/dest/{database → storage/note_data_provider}/note_dao.js +0 -0
  176. /package/dest/{pxe_service/test → test}/pxe_test_suite.d.ts +0 -0
  177. /package/src/{pxe_data_provider → pxe_oracle_interface}/tagging_utils.ts +0 -0
  178. /package/src/{contract_data_provider → storage/contract_data_provider}/index.ts +0 -0
  179. /package/src/{contract_data_provider → storage/contract_data_provider}/private_functions_tree.ts +0 -0
  180. /package/src/{database → storage/note_data_provider}/note_dao.ts +0 -0
@@ -1,480 +0,0 @@
1
- import { toBufferBE } from '@aztec/foundation/bigint-buffer';
2
- import { Fr } from '@aztec/foundation/fields';
3
- import { toArray } from '@aztec/foundation/iterable';
4
- import { createDebugOnlyLogger } from '@aztec/foundation/log';
5
- import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
6
- import { contractArtifactFromBuffer, contractArtifactToBuffer } from '@aztec/stdlib/abi';
7
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
8
- import { CompleteAddress, SerializableContractInstance } from '@aztec/stdlib/contract';
9
- import { NoteStatus } from '@aztec/stdlib/note';
10
- import { MerkleTreeId } from '@aztec/stdlib/trees';
11
- import { BlockHeader } from '@aztec/stdlib/tx';
12
- import { NoteDao } from './note_dao.js';
13
- /**
14
- * A PXE database backed by LMDB.
15
- */ export class KVPxeDatabase {
16
- db;
17
- static SCHEMA_VERSION = 1;
18
- #synchronizedBlock;
19
- #completeAddresses;
20
- #completeAddressIndex;
21
- #addressBook;
22
- #authWitnesses;
23
- #notes;
24
- #nullifiedNotes;
25
- #nullifierToNoteId;
26
- #nullifiersByBlockNumber;
27
- #nullifiedNotesToScope;
28
- #nullifiedNotesByContract;
29
- #nullifiedNotesByStorageSlot;
30
- #nullifiedNotesByTxHash;
31
- #nullifiedNotesByAddressPoint;
32
- #nullifiedNotesByNullifier;
33
- #contractArtifacts;
34
- #contractInstances;
35
- #db;
36
- #scopes;
37
- #notesToScope;
38
- #notesByContractAndScope;
39
- #notesByStorageSlotAndScope;
40
- #notesByTxHashAndScope;
41
- #notesByAddressPointAndScope;
42
- // Stores the last index used for each tagging secret, taking direction into account
43
- // This is necessary to avoid reusing the same index for the same secret, which happens if
44
- // sender and recipient are the same
45
- #taggingSecretIndexesForSenders;
46
- #taggingSecretIndexesForRecipients;
47
- // Arbitrary data stored by contracts. Key is computed as `${contractAddress}:${key}`
48
- #capsules;
49
- debug;
50
- constructor(db){
51
- this.db = db;
52
- this.#db = db;
53
- this.#completeAddresses = db.openArray('complete_addresses');
54
- this.#completeAddressIndex = db.openMap('complete_address_index');
55
- this.#addressBook = db.openMap('address_book');
56
- this.#authWitnesses = db.openMap('auth_witnesses');
57
- this.#contractArtifacts = db.openMap('contract_artifacts');
58
- this.#contractInstances = db.openMap('contracts_instances');
59
- this.#synchronizedBlock = db.openSingleton('header');
60
- this.#notes = db.openMap('notes');
61
- this.#nullifiedNotes = db.openMap('nullified_notes');
62
- this.#nullifierToNoteId = db.openMap('nullifier_to_note');
63
- this.#nullifiersByBlockNumber = db.openMultiMap('nullifier_to_block_number');
64
- this.#nullifiedNotesToScope = db.openMultiMap('nullified_notes_to_scope');
65
- this.#nullifiedNotesByContract = db.openMultiMap('nullified_notes_by_contract');
66
- this.#nullifiedNotesByStorageSlot = db.openMultiMap('nullified_notes_by_storage_slot');
67
- this.#nullifiedNotesByTxHash = db.openMultiMap('nullified_notes_by_tx_hash');
68
- this.#nullifiedNotesByAddressPoint = db.openMultiMap('nullified_notes_by_address_point');
69
- this.#nullifiedNotesByNullifier = db.openMap('nullified_notes_by_nullifier');
70
- this.#scopes = db.openMap('scopes');
71
- this.#notesToScope = db.openMultiMap('notes_to_scope');
72
- this.#notesByContractAndScope = new Map();
73
- this.#notesByStorageSlotAndScope = new Map();
74
- this.#notesByTxHashAndScope = new Map();
75
- this.#notesByAddressPointAndScope = new Map();
76
- this.#taggingSecretIndexesForSenders = db.openMap('tagging_secret_indexes_for_senders');
77
- this.#taggingSecretIndexesForRecipients = db.openMap('tagging_secret_indexes_for_recipients');
78
- this.#capsules = db.openMap('capsules');
79
- this.debug = createDebugOnlyLogger('aztec:kv-pxe-database');
80
- }
81
- static async create(db) {
82
- const pxeDB = new KVPxeDatabase(db);
83
- for await (const scope of pxeDB.#scopes.keysAsync()){
84
- pxeDB.#notesByContractAndScope.set(scope, db.openMultiMap(`${scope}:notes_by_contract`));
85
- pxeDB.#notesByStorageSlotAndScope.set(scope, db.openMultiMap(`${scope}:notes_by_storage_slot`));
86
- pxeDB.#notesByTxHashAndScope.set(scope, db.openMultiMap(`${scope}:notes_by_tx_hash`));
87
- pxeDB.#notesByAddressPointAndScope.set(scope, db.openMultiMap(`${scope}:notes_by_address_point`));
88
- }
89
- return pxeDB;
90
- }
91
- async getContract(address) {
92
- const instance = await this.getContractInstance(address);
93
- const artifact = instance && await this.getContractArtifact(instance?.currentContractClassId);
94
- if (!instance || !artifact) {
95
- return undefined;
96
- }
97
- return {
98
- ...instance,
99
- ...artifact
100
- };
101
- }
102
- async addContractArtifact(id, contract) {
103
- const privateFunctions = contract.functions.filter((functionArtifact)=>functionArtifact.functionType === FunctionType.PRIVATE);
104
- const privateSelectors = await Promise.all(privateFunctions.map(async (privateFunctionArtifact)=>(await FunctionSelector.fromNameAndParameters(privateFunctionArtifact.name, privateFunctionArtifact.parameters)).toString()));
105
- if (privateSelectors.length !== new Set(privateSelectors).size) {
106
- throw new Error('Repeated function selectors of private functions');
107
- }
108
- await this.#contractArtifacts.set(id.toString(), contractArtifactToBuffer(contract));
109
- }
110
- async getContractArtifact(id) {
111
- const contract = await this.#contractArtifacts.getAsync(id.toString());
112
- // TODO(@spalladino): AztecAsyncMap lies and returns Uint8Arrays instead of Buffers, hence the extra Buffer.from.
113
- return contract && contractArtifactFromBuffer(Buffer.from(contract));
114
- }
115
- async addContractInstance(contract) {
116
- await this.#contractInstances.set(contract.address.toString(), new SerializableContractInstance(contract).toBuffer());
117
- }
118
- async getContractInstance(address) {
119
- const contract = await this.#contractInstances.getAsync(address.toString());
120
- return contract && SerializableContractInstance.fromBuffer(contract).withAddress(address);
121
- }
122
- async getContractsAddresses() {
123
- const keys = await toArray(this.#contractInstances.keysAsync());
124
- return keys.map(AztecAddress.fromString);
125
- }
126
- async addAuthWitness(messageHash, witness) {
127
- await this.#authWitnesses.set(messageHash.toString(), witness.map((w)=>w.toBuffer()));
128
- }
129
- async getAuthWitness(messageHash) {
130
- const witness = await this.#authWitnesses.getAsync(messageHash.toString());
131
- return Promise.resolve(witness?.map((w)=>Fr.fromBuffer(w)));
132
- }
133
- async addNote(note, scope) {
134
- await this.addNotes([
135
- note
136
- ], scope);
137
- }
138
- async addNotes(notes, scope = AztecAddress.ZERO) {
139
- if (!await this.#scopes.hasAsync(scope.toString())) {
140
- await this.#addScope(scope);
141
- }
142
- return this.db.transactionAsync(async ()=>{
143
- for (const dao of notes){
144
- // store notes by their index in the notes hash tree
145
- // this provides the uniqueness we need to store individual notes
146
- // and should also return notes in the order that they were created.
147
- // Had we stored them by their nullifier, they would be returned in random order
148
- const noteIndex = toBufferBE(dao.index, 32).toString('hex');
149
- await this.#notes.set(noteIndex, dao.toBuffer());
150
- await this.#notesToScope.set(noteIndex, scope.toString());
151
- await this.#nullifierToNoteId.set(dao.siloedNullifier.toString(), noteIndex);
152
- await this.#notesByContractAndScope.get(scope.toString()).set(dao.contractAddress.toString(), noteIndex);
153
- await this.#notesByStorageSlotAndScope.get(scope.toString()).set(dao.storageSlot.toString(), noteIndex);
154
- await this.#notesByTxHashAndScope.get(scope.toString()).set(dao.txHash.toString(), noteIndex);
155
- await this.#notesByAddressPointAndScope.get(scope.toString()).set(dao.addressPoint.toString(), noteIndex);
156
- }
157
- });
158
- }
159
- removeNotesAfter(blockNumber) {
160
- return this.db.transactionAsync(async ()=>{
161
- const notes = await toArray(this.#notes.valuesAsync());
162
- for (const note of notes){
163
- const noteDao = NoteDao.fromBuffer(note);
164
- if (noteDao.l2BlockNumber > blockNumber) {
165
- const noteIndex = toBufferBE(noteDao.index, 32).toString('hex');
166
- await this.#notes.delete(noteIndex);
167
- await this.#notesToScope.delete(noteIndex);
168
- await this.#nullifierToNoteId.delete(noteDao.siloedNullifier.toString());
169
- const scopes = await toArray(this.#scopes.keysAsync());
170
- for (const scope of scopes){
171
- await this.#notesByAddressPointAndScope.get(scope).deleteValue(noteDao.addressPoint.toString(), noteIndex);
172
- await this.#notesByTxHashAndScope.get(scope).deleteValue(noteDao.txHash.toString(), noteIndex);
173
- await this.#notesByContractAndScope.get(scope).deleteValue(noteDao.contractAddress.toString(), noteIndex);
174
- await this.#notesByStorageSlotAndScope.get(scope).deleteValue(noteDao.storageSlot.toString(), noteIndex);
175
- }
176
- }
177
- }
178
- });
179
- }
180
- async unnullifyNotesAfter(blockNumber) {
181
- const nullifiersToUndo = [];
182
- const currentBlockNumber = blockNumber + 1;
183
- const maxBlockNumber = await this.getBlockNumber() ?? currentBlockNumber;
184
- for(let i = currentBlockNumber; i <= maxBlockNumber; i++){
185
- nullifiersToUndo.push(...await toArray(this.#nullifiersByBlockNumber.getValuesAsync(i)));
186
- }
187
- const notesIndexesToReinsert = await Promise.all(nullifiersToUndo.map((nullifier)=>this.#nullifiedNotesByNullifier.getAsync(nullifier)));
188
- const notNullNoteIndexes = notesIndexesToReinsert.filter((noteIndex)=>noteIndex != undefined);
189
- const nullifiedNoteBuffers = await Promise.all(notNullNoteIndexes.map((noteIndex)=>this.#nullifiedNotes.getAsync(noteIndex)));
190
- const noteDaos = nullifiedNoteBuffers.filter((buffer)=>buffer != undefined).map((buffer)=>NoteDao.fromBuffer(buffer));
191
- await this.db.transactionAsync(async ()=>{
192
- for (const dao of noteDaos){
193
- const noteIndex = toBufferBE(dao.index, 32).toString('hex');
194
- await this.#notes.set(noteIndex, dao.toBuffer());
195
- await this.#nullifierToNoteId.set(dao.siloedNullifier.toString(), noteIndex);
196
- let scopes = await toArray(this.#nullifiedNotesToScope.getValuesAsync(noteIndex)) ?? [];
197
- if (scopes.length === 0) {
198
- scopes = [
199
- new AztecAddress(dao.addressPoint.x).toString()
200
- ];
201
- }
202
- for (const scope of scopes){
203
- await this.#notesByContractAndScope.get(scope.toString()).set(dao.contractAddress.toString(), noteIndex);
204
- await this.#notesByStorageSlotAndScope.get(scope.toString()).set(dao.storageSlot.toString(), noteIndex);
205
- await this.#notesByTxHashAndScope.get(scope.toString()).set(dao.txHash.toString(), noteIndex);
206
- await this.#notesByAddressPointAndScope.get(scope.toString()).set(dao.addressPoint.toString(), noteIndex);
207
- await this.#notesToScope.set(noteIndex, scope);
208
- }
209
- await this.#nullifiedNotes.delete(noteIndex);
210
- await this.#nullifiedNotesToScope.delete(noteIndex);
211
- await this.#nullifiersByBlockNumber.deleteValue(dao.l2BlockNumber, dao.siloedNullifier.toString());
212
- await this.#nullifiedNotesByContract.deleteValue(dao.contractAddress.toString(), noteIndex);
213
- await this.#nullifiedNotesByStorageSlot.deleteValue(dao.storageSlot.toString(), noteIndex);
214
- await this.#nullifiedNotesByTxHash.deleteValue(dao.txHash.toString(), noteIndex);
215
- await this.#nullifiedNotesByAddressPoint.deleteValue(dao.addressPoint.toString(), noteIndex);
216
- await this.#nullifiedNotesByNullifier.delete(dao.siloedNullifier.toString());
217
- }
218
- });
219
- }
220
- async getNotes(filter) {
221
- const publicKey = filter.owner ? await filter.owner.toAddressPoint() : undefined;
222
- filter.status = filter.status ?? NoteStatus.ACTIVE;
223
- const candidateNoteSources = [];
224
- filter.scopes ??= (await toArray(this.#scopes.keysAsync())).map((addressString)=>AztecAddress.fromString(addressString));
225
- const activeNoteIdsPerScope = [];
226
- for (const scope of new Set(filter.scopes)){
227
- const formattedScopeString = scope.toString();
228
- if (!await this.#scopes.hasAsync(formattedScopeString)) {
229
- throw new Error('Trying to get incoming notes of an scope that is not in the PXE database');
230
- }
231
- activeNoteIdsPerScope.push(publicKey ? await toArray(this.#notesByAddressPointAndScope.get(formattedScopeString).getValuesAsync(publicKey.toString())) : filter.txHash ? await toArray(this.#notesByTxHashAndScope.get(formattedScopeString).getValuesAsync(filter.txHash.toString())) : filter.contractAddress ? await toArray(this.#notesByContractAndScope.get(formattedScopeString).getValuesAsync(filter.contractAddress.toString())) : filter.storageSlot ? await toArray(this.#notesByStorageSlotAndScope.get(formattedScopeString).getValuesAsync(filter.storageSlot.toString())) : await toArray(this.#notesByAddressPointAndScope.get(formattedScopeString).valuesAsync()));
232
- }
233
- candidateNoteSources.push({
234
- ids: new Set(activeNoteIdsPerScope.flat()),
235
- notes: this.#notes
236
- });
237
- if (filter.status == NoteStatus.ACTIVE_OR_NULLIFIED) {
238
- candidateNoteSources.push({
239
- ids: publicKey ? await toArray(this.#nullifiedNotesByAddressPoint.getValuesAsync(publicKey.toString())) : filter.txHash ? await toArray(this.#nullifiedNotesByTxHash.getValuesAsync(filter.txHash.toString())) : filter.contractAddress ? await toArray(this.#nullifiedNotesByContract.getValuesAsync(filter.contractAddress.toString())) : filter.storageSlot ? await toArray(this.#nullifiedNotesByStorageSlot.getValuesAsync(filter.storageSlot.toString())) : await toArray(this.#nullifiedNotes.keysAsync()),
240
- notes: this.#nullifiedNotes
241
- });
242
- }
243
- const result = [];
244
- for (const { ids, notes } of candidateNoteSources){
245
- for (const id of ids){
246
- const serializedNote = await notes.getAsync(id);
247
- if (!serializedNote) {
248
- continue;
249
- }
250
- const note = NoteDao.fromBuffer(serializedNote);
251
- if (filter.contractAddress && !note.contractAddress.equals(filter.contractAddress)) {
252
- continue;
253
- }
254
- if (filter.txHash && !note.txHash.equals(filter.txHash)) {
255
- continue;
256
- }
257
- if (filter.storageSlot && !note.storageSlot.equals(filter.storageSlot)) {
258
- continue;
259
- }
260
- if (publicKey && !note.addressPoint.equals(publicKey)) {
261
- continue;
262
- }
263
- if (filter.siloedNullifier && !note.siloedNullifier.equals(filter.siloedNullifier)) {
264
- continue;
265
- }
266
- result.push(note);
267
- }
268
- }
269
- return result;
270
- }
271
- removeNullifiedNotes(nullifiers, accountAddressPoint) {
272
- if (nullifiers.length === 0) {
273
- return Promise.resolve([]);
274
- }
275
- return this.db.transactionAsync(async ()=>{
276
- const nullifiedNotes = [];
277
- for (const blockScopedNullifier of nullifiers){
278
- const { data: nullifier, l2BlockNumber: blockNumber } = blockScopedNullifier;
279
- const noteIndex = await this.#nullifierToNoteId.getAsync(nullifier.toString());
280
- if (!noteIndex) {
281
- continue;
282
- }
283
- const noteBuffer = noteIndex ? await this.#notes.getAsync(noteIndex) : undefined;
284
- if (!noteBuffer) {
285
- continue;
286
- }
287
- const noteScopes = await toArray(this.#notesToScope.getValuesAsync(noteIndex)) ?? [];
288
- const note = NoteDao.fromBuffer(noteBuffer);
289
- if (!note.addressPoint.equals(accountAddressPoint)) {
290
- continue;
291
- }
292
- nullifiedNotes.push(note);
293
- await this.#notes.delete(noteIndex);
294
- await this.#notesToScope.delete(noteIndex);
295
- const scopes = await toArray(this.#scopes.keysAsync());
296
- for (const scope of scopes){
297
- await this.#notesByAddressPointAndScope.get(scope).deleteValue(accountAddressPoint.toString(), noteIndex);
298
- await this.#notesByTxHashAndScope.get(scope).deleteValue(note.txHash.toString(), noteIndex);
299
- await this.#notesByContractAndScope.get(scope).deleteValue(note.contractAddress.toString(), noteIndex);
300
- await this.#notesByStorageSlotAndScope.get(scope).deleteValue(note.storageSlot.toString(), noteIndex);
301
- }
302
- if (noteScopes !== undefined) {
303
- for (const scope of noteScopes){
304
- await this.#nullifiedNotesToScope.set(noteIndex, scope);
305
- }
306
- }
307
- await this.#nullifiedNotes.set(noteIndex, note.toBuffer());
308
- await this.#nullifiersByBlockNumber.set(blockNumber, nullifier.toString());
309
- await this.#nullifiedNotesByContract.set(note.contractAddress.toString(), noteIndex);
310
- await this.#nullifiedNotesByStorageSlot.set(note.storageSlot.toString(), noteIndex);
311
- await this.#nullifiedNotesByTxHash.set(note.txHash.toString(), noteIndex);
312
- await this.#nullifiedNotesByAddressPoint.set(note.addressPoint.toString(), noteIndex);
313
- await this.#nullifiedNotesByNullifier.set(nullifier.toString(), noteIndex);
314
- await this.#nullifierToNoteId.delete(nullifier.toString());
315
- }
316
- return nullifiedNotes;
317
- });
318
- }
319
- async addNullifiedNote(note) {
320
- const noteIndex = toBufferBE(note.index, 32).toString('hex');
321
- await this.#nullifiedNotes.set(noteIndex, note.toBuffer());
322
- await this.#nullifiedNotesByContract.set(note.contractAddress.toString(), noteIndex);
323
- await this.#nullifiedNotesByStorageSlot.set(note.storageSlot.toString(), noteIndex);
324
- await this.#nullifiedNotesByTxHash.set(note.txHash.toString(), noteIndex);
325
- await this.#nullifiedNotesByAddressPoint.set(note.addressPoint.toString(), noteIndex);
326
- }
327
- async setHeader(header) {
328
- await this.#synchronizedBlock.set(header.toBuffer());
329
- }
330
- async getBlockNumber() {
331
- const headerBuffer = await this.#synchronizedBlock.getAsync();
332
- if (!headerBuffer) {
333
- return undefined;
334
- }
335
- return Number(BlockHeader.fromBuffer(headerBuffer).globalVariables.blockNumber.toBigInt());
336
- }
337
- async getBlockHeader() {
338
- const headerBuffer = await this.#synchronizedBlock.getAsync();
339
- if (!headerBuffer) {
340
- throw new Error(`Header not set`);
341
- }
342
- return BlockHeader.fromBuffer(headerBuffer);
343
- }
344
- async #addScope(scope) {
345
- const scopeString = scope.toString();
346
- if (await this.#scopes.hasAsync(scopeString)) {
347
- return false;
348
- }
349
- await this.#scopes.set(scopeString, true);
350
- this.#notesByContractAndScope.set(scopeString, this.#db.openMultiMap(`${scopeString}:notes_by_contract`));
351
- this.#notesByStorageSlotAndScope.set(scopeString, this.#db.openMultiMap(`${scopeString}:notes_by_storage_slot`));
352
- this.#notesByTxHashAndScope.set(scopeString, this.#db.openMultiMap(`${scopeString}:notes_by_tx_hash`));
353
- this.#notesByAddressPointAndScope.set(scopeString, this.#db.openMultiMap(`${scopeString}:notes_by_address_point`));
354
- return true;
355
- }
356
- addCompleteAddress(completeAddress) {
357
- return this.db.transactionAsync(async ()=>{
358
- await this.#addScope(completeAddress.address);
359
- const addressString = completeAddress.address.toString();
360
- const buffer = completeAddress.toBuffer();
361
- const existing = await this.#completeAddressIndex.getAsync(addressString);
362
- if (existing === undefined) {
363
- const index = await this.#completeAddresses.lengthAsync();
364
- await this.#completeAddresses.push(buffer);
365
- await this.#completeAddressIndex.set(addressString, index);
366
- return true;
367
- } else {
368
- const existingBuffer = await this.#completeAddresses.atAsync(existing);
369
- if (existingBuffer && Buffer.from(existingBuffer).equals(buffer)) {
370
- return false;
371
- }
372
- throw new Error(`Complete address with aztec address ${addressString} but different public key or partial key already exists in memory database`);
373
- }
374
- });
375
- }
376
- async #getCompleteAddress(address) {
377
- const index = await this.#completeAddressIndex.getAsync(address.toString());
378
- if (index === undefined) {
379
- return undefined;
380
- }
381
- const value = await this.#completeAddresses.atAsync(index);
382
- return value ? await CompleteAddress.fromBuffer(value) : undefined;
383
- }
384
- getCompleteAddress(account) {
385
- return this.#getCompleteAddress(account);
386
- }
387
- async getCompleteAddresses() {
388
- return await Promise.all((await toArray(this.#completeAddresses.valuesAsync())).map((v)=>CompleteAddress.fromBuffer(v)));
389
- }
390
- async addSenderAddress(address) {
391
- if (await this.#addressBook.hasAsync(address.toString())) {
392
- return false;
393
- }
394
- await this.#addressBook.set(address.toString(), true);
395
- return true;
396
- }
397
- async getSenderAddresses() {
398
- return (await toArray(this.#addressBook.keysAsync())).map(AztecAddress.fromString);
399
- }
400
- async removeSenderAddress(address) {
401
- if (!await this.#addressBook.hasAsync(address.toString())) {
402
- return false;
403
- }
404
- await this.#addressBook.delete(address.toString());
405
- return true;
406
- }
407
- async estimateSize() {
408
- const noteSize = (await this.getNotes({})).reduce((sum, note)=>sum + note.getSize(), 0);
409
- const authWitsSize = (await toArray(this.#authWitnesses.valuesAsync())).reduce((sum, value)=>sum + value.length * Fr.SIZE_IN_BYTES, 0);
410
- const addressesSize = await this.#completeAddresses.lengthAsync() * CompleteAddress.SIZE_IN_BYTES;
411
- const treeRootsSize = Object.keys(MerkleTreeId).length * Fr.SIZE_IN_BYTES;
412
- return noteSize + treeRootsSize + authWitsSize + addressesSize;
413
- }
414
- async setTaggingSecretsIndexesAsSender(indexedSecrets) {
415
- await this.#setTaggingSecretsIndexes(indexedSecrets, this.#taggingSecretIndexesForSenders);
416
- }
417
- async setTaggingSecretsIndexesAsRecipient(indexedSecrets) {
418
- await this.#setTaggingSecretsIndexes(indexedSecrets, this.#taggingSecretIndexesForRecipients);
419
- }
420
- async #setTaggingSecretsIndexes(indexedSecrets, storageMap) {
421
- await Promise.all(indexedSecrets.map((indexedSecret)=>storageMap.set(indexedSecret.appTaggingSecret.toString(), indexedSecret.index)));
422
- }
423
- async getTaggingSecretsIndexesAsRecipient(appTaggingSecrets) {
424
- return await this.#getTaggingSecretsIndexes(appTaggingSecrets, this.#taggingSecretIndexesForRecipients);
425
- }
426
- async getTaggingSecretsIndexesAsSender(appTaggingSecrets) {
427
- return await this.#getTaggingSecretsIndexes(appTaggingSecrets, this.#taggingSecretIndexesForSenders);
428
- }
429
- #getTaggingSecretsIndexes(appTaggingSecrets, storageMap) {
430
- return Promise.all(appTaggingSecrets.map(async (secret)=>await storageMap.getAsync(`${secret.toString()}`) ?? 0));
431
- }
432
- resetNoteSyncData() {
433
- return this.db.transactionAsync(async ()=>{
434
- const recipients = await toArray(this.#taggingSecretIndexesForRecipients.keysAsync());
435
- await Promise.all(recipients.map((recipient)=>this.#taggingSecretIndexesForRecipients.delete(recipient)));
436
- const senders = await toArray(this.#taggingSecretIndexesForSenders.keysAsync());
437
- await Promise.all(senders.map((sender)=>this.#taggingSecretIndexesForSenders.delete(sender)));
438
- });
439
- }
440
- async storeCapsule(contractAddress, slot, capsule) {
441
- await this.#capsules.set(dbSlotToKey(contractAddress, slot), Buffer.concat(capsule.map((value)=>value.toBuffer())));
442
- }
443
- async loadCapsule(contractAddress, slot) {
444
- const dataBuffer = await this.#capsules.getAsync(dbSlotToKey(contractAddress, slot));
445
- if (!dataBuffer) {
446
- this.debug(`Data not found for contract ${contractAddress.toString()} and slot ${slot.toString()}`);
447
- return null;
448
- }
449
- const capsule = [];
450
- for(let i = 0; i < dataBuffer.length; i += Fr.SIZE_IN_BYTES){
451
- capsule.push(Fr.fromBuffer(dataBuffer.subarray(i, i + Fr.SIZE_IN_BYTES)));
452
- }
453
- return capsule;
454
- }
455
- async deleteCapsule(contractAddress, slot) {
456
- await this.#capsules.delete(dbSlotToKey(contractAddress, slot));
457
- }
458
- async copyCapsule(contractAddress, srcSlot, dstSlot, numEntries) {
459
- // In order to support overlapping source and destination regions, we need to check the relative positions of source
460
- // and destination. If destination is ahead of source, then by the time we overwrite source elements using forward
461
- // indexes we'll have already read those. On the contrary, if source is ahead of destination we need to use backward
462
- // indexes to avoid reading elements that've been overwritten.
463
- const indexes = Array.from(Array(numEntries).keys());
464
- if (srcSlot.lt(dstSlot)) {
465
- indexes.reverse();
466
- }
467
- for (const i of indexes){
468
- const currentSrcSlot = dbSlotToKey(contractAddress, srcSlot.add(new Fr(i)));
469
- const currentDstSlot = dbSlotToKey(contractAddress, dstSlot.add(new Fr(i)));
470
- const toCopy = await this.#capsules.getAsync(currentSrcSlot);
471
- if (!toCopy) {
472
- throw new Error(`Attempted to copy empty slot ${currentSrcSlot} for contract ${contractAddress.toString()}`);
473
- }
474
- await this.#capsules.set(currentDstSlot, toCopy);
475
- }
476
- }
477
- }
478
- function dbSlotToKey(contractAddress, slot) {
479
- return `${contractAddress.toString()}:${slot.toString()}`;
480
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"note_dao.d.ts","sourceRoot":"","sources":["../../src/database/note_dao.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,EAAE,EAAS,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;;GAGG;AACH,qBAAa,OAAQ,YAAW,QAAQ;IAIpC,kFAAkF;IAC3E,IAAI,EAAE,IAAI;IACjB,8GAA8G;IACvG,eAAe,EAAE,YAAY;IACpC;;;SAGK;IACE,WAAW,EAAE,EAAE;IACtB,qFAAqF;IAC9E,KAAK,EAAE,EAAE;IAGhB;;;OAGG;IACI,QAAQ,EAAE,EAAE;IACnB;;;OAGG;IACI,eAAe,EAAE,EAAE;IAG1B;;OAEG;IACI,MAAM,EAAE,MAAM;IACrB;gBACY;IACL,aAAa,EAAE,MAAM;IAC5B;gBACY;IACL,WAAW,EAAE,MAAM;IAC1B,+EAA+E;IACxE,KAAK,EAAE,MAAM;IACpB,4EAA4E;IACrE,YAAY,EAAE,SAAS;IAE9B;;OAEG;IACI,UAAU,EAAE,YAAY;;IA3C/B,kFAAkF;IAC3E,IAAI,EAAE,IAAI;IACjB,8GAA8G;IACvG,eAAe,EAAE,YAAY;IACpC;;;SAGK;IACE,WAAW,EAAE,EAAE;IACtB,qFAAqF;IAC9E,KAAK,EAAE,EAAE;IAGhB;;;OAGG;IACI,QAAQ,EAAE,EAAE;IACnB;;;OAGG;IACI,eAAe,EAAE,EAAE;IAG1B;;OAEG;IACI,MAAM,EAAE,MAAM;IACrB;gBACY;IACL,aAAa,EAAE,MAAM;IAC5B;gBACY;IACL,WAAW,EAAE,MAAM;IAC1B,+EAA+E;IACxE,KAAK,EAAE,MAAM;IACpB,4EAA4E;IACrE,YAAY,EAAE,SAAS;IAE9B;;OAEG;IACI,UAAU,EAAE,YAAY;IAGjC,QAAQ,IAAI,MAAM;IAiBlB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAgC/C,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAK7B;;;OAGG;IACI,OAAO;WAMD,MAAM,CAAC,EAClB,IAAoB,EACpB,eAA2B,EAC3B,WAAyB,EACzB,KAAmB,EACnB,QAAsB,EACtB,eAA6B,EAC7B,MAAwB,EACxB,aAAgD,EAChD,WAAoC,EACpC,KAA8B,EAC9B,YAAwB,EACxB,UAAkC,GACnC,GAAE,OAAO,CAAC,OAAO,CAAM;CAgBzB"}
package/dest/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export * from './pxe_service/index.js';
2
- export { pxeTestSuite } from './pxe_service/test/pxe_test_suite.js';
3
- export * from './pxe_http/index.js';
4
- export * from './config/index.js';
5
- export * from './utils/create_pxe_service.js';
6
- export * from './database/index.js';
7
- export { PXEDataProvider } from './pxe_data_provider/index.js';
8
- export * from './contract_data_provider/index.js';
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC;AAE9C,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,cAAc,mCAAmC,CAAC"}
package/dest/index.js DELETED
@@ -1,8 +0,0 @@
1
- export * from './pxe_service/index.js';
2
- export { pxeTestSuite } from './pxe_service/test/pxe_test_suite.js';
3
- export * from './pxe_http/index.js';
4
- export * from './config/index.js';
5
- export * from './utils/create_pxe_service.js';
6
- export * from './database/index.js';
7
- export { PXEDataProvider } from './pxe_data_provider/index.js';
8
- export * from './contract_data_provider/index.js';
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pxe_data_provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAI9B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7G,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EACL,KAAK,gBAAgB,EAErB,gBAAgB,EAKjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAW,OAAO,EAAiB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,oBAA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,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGxG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tagging_utils.d.ts","sourceRoot":"","sources":["../../src/pxe_data_provider/tagging_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG1D,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,wBAAgB,oCAAoC,CAClD,iBAAiB,EAAE;IAAE,gBAAgB,EAAE,EAAE,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,EAAE,GAC3F,oBAAoB,EAAE,CAQxB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,qBAAqB,EAAE,oBAAoB,EAAE,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAQ3G"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"pxe_test_suite.d.ts","sourceRoot":"","sources":["../../../src/pxe_service/test/pxe_test_suite.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAS3D,eAAO,MAAM,YAAY,aAAc,MAAM,YAAY,MAAM,QAAQ,GAAG,CAAC,SAwG1E,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"create_pxe_service.d.ts","sourceRoot":"","sources":["../../src/utils/create_pxe_service.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,EACxB,YAAY,GAAE,MAAM,GAAG,OAAO,GAAG,SAAqB,EACtD,YAAY,CAAC,EAAE,mBAAmB,uBAwCnC"}
@@ -1,2 +0,0 @@
1
- export * from './kv_pxe_database.js';
2
- export * from './interfaces/index.js';
@@ -1,20 +0,0 @@
1
- import type { Fr } from '@aztec/foundation/fields';
2
- import type { ContractArtifact } from '@aztec/stdlib/abi';
3
-
4
- /**
5
- * PXE database for managing contract artifacts.
6
- */
7
- export interface ContractArtifactDatabase {
8
- /**
9
- * Adds a new contract artifact to the database or updates an existing one.
10
- * @param id - Id of the corresponding contract class.
11
- * @param contract - Contract artifact to add.
12
- * @throws - If there are duplicate private function selectors.
13
- */
14
- addContractArtifact(id: Fr, contract: ContractArtifact): Promise<void>;
15
- /**
16
- * Gets a contract artifact given its resulting contract class id.
17
- * @param id - Contract class id for the given artifact.
18
- */
19
- getContractArtifact(id: Fr): Promise<ContractArtifact | undefined>;
20
- }
@@ -1,21 +0,0 @@
1
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
- import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
-
4
- /**
5
- * PXE database for managing contract instances.
6
- */
7
- export interface ContractInstanceDatabase {
8
- /**
9
- * Adds a new contract to the db or updates an existing one.
10
- * @param contract - Contract to insert.
11
- */
12
- addContractInstance(contract: ContractInstanceWithAddress): Promise<void>;
13
- /**
14
- * Gets a contract given its address.
15
- * @param address - Address of the contract.
16
- */
17
- getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
18
-
19
- /** Returns the addresses all contract instances registered in the DB. */
20
- getContractsAddresses(): Promise<AztecAddress[]>;
21
- }
@@ -1,3 +0,0 @@
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';