@dstorage-tech/dstorage-sdk 0.0.4

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 (106) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +530 -0
  3. package/dist/KeypairEncryptionAdapter-AE75YC4W-AOWNSH2M.mjs +9 -0
  4. package/dist/KeypairEncryptionAdapter-AE75YC4W-BAVHRNNJ.mjs +1 -0
  5. package/dist/KeypairEncryptionAdapter-AE75YC4W-BEYO4RUO.mjs +1 -0
  6. package/dist/KeypairEncryptionAdapter-AE75YC4W-VAOH6AAL.mjs +9 -0
  7. package/dist/KeypairEncryptionAdapter-XUKCLRFU-6ERIZN2M.mjs +1 -0
  8. package/dist/KeypairEncryptionAdapter-XUKCLRFU-AYDAZ2TZ.mjs +9 -0
  9. package/dist/KeypairEncryptionAdapter-XUKCLRFU-ERPYK5S4.mjs +8 -0
  10. package/dist/MnemonicEncryptionAdapter-J6IE5OKA-6DFVUVD6.mjs +1 -0
  11. package/dist/MnemonicEncryptionAdapter-J6IE5OKA-O5AJPX42.mjs +1 -0
  12. package/dist/MnemonicEncryptionAdapter-J6IE5OKA-SI6TBLTQ.mjs +9 -0
  13. package/dist/MnemonicEncryptionAdapter-J6IE5OKA-WEPFOTSJ.mjs +9 -0
  14. package/dist/MnemonicEncryptionAdapter-RCHUETBP-DZPBGQG6.mjs +8 -0
  15. package/dist/MnemonicEncryptionAdapter-RCHUETBP-ELAMJMMO.mjs +1 -0
  16. package/dist/MnemonicEncryptionAdapter-RCHUETBP-M7NHGSHO.mjs +9 -0
  17. package/dist/PasswordEncryptionAdapter-CWOXUGR4-2YZ64B4A.mjs +1 -0
  18. package/dist/PasswordEncryptionAdapter-CWOXUGR4-DCEGC2NX.mjs +1 -0
  19. package/dist/PasswordEncryptionAdapter-CWOXUGR4-QEGGYPFJ.mjs +13 -0
  20. package/dist/PasswordEncryptionAdapter-CWOXUGR4-ZYUBUYUI.mjs +13 -0
  21. package/dist/PasswordEncryptionAdapter-ECHND672-3DEFO6FP.mjs +13 -0
  22. package/dist/PasswordEncryptionAdapter-ECHND672-MUTHAMZY.mjs +12 -0
  23. package/dist/PasswordEncryptionAdapter-ECHND672-XVBPHPPT.mjs +1 -0
  24. package/dist/browser.d.mts +2418 -0
  25. package/dist/browser.mjs +5175 -0
  26. package/dist/chunk-25I6ZXUC.mjs +9403 -0
  27. package/dist/chunk-4X5K43JF.mjs +62 -0
  28. package/dist/chunk-4YMF57VY.mjs +1 -0
  29. package/dist/chunk-5MZ7FPPY.mjs +1 -0
  30. package/dist/chunk-5P4EW2YL.mjs +1 -0
  31. package/dist/chunk-5QOKJEH3.mjs +8 -0
  32. package/dist/chunk-5RW7SGA7.mjs +1 -0
  33. package/dist/chunk-62RSKZ6T.mjs +118 -0
  34. package/dist/chunk-6IAQVMSM.mjs +102 -0
  35. package/dist/chunk-BBJCQFWP.mjs +275 -0
  36. package/dist/chunk-BWLEAAFW.mjs +2599 -0
  37. package/dist/chunk-EYF3263P.mjs +2049 -0
  38. package/dist/chunk-FJ7LSZOW.mjs +5537 -0
  39. package/dist/chunk-GUYENY5N.mjs +1 -0
  40. package/dist/chunk-HDD6SUU4.mjs +276 -0
  41. package/dist/chunk-JMPRZK5D.mjs +62 -0
  42. package/dist/chunk-L5QD6GHB.mjs +101 -0
  43. package/dist/chunk-O37NHERH.mjs +17 -0
  44. package/dist/chunk-OLGVVM5Y.mjs +102 -0
  45. package/dist/chunk-PKHRAYFD.mjs +1 -0
  46. package/dist/chunk-PLAOCKSS.mjs +101 -0
  47. package/dist/chunk-QKA2DCR6.mjs +118 -0
  48. package/dist/chunk-RPSRFFXN.mjs +275 -0
  49. package/dist/chunk-TESUOXRJ.mjs +1 -0
  50. package/dist/chunk-TMLXCRJU.mjs +1 -0
  51. package/dist/chunk-TNRKN4LB.mjs +1 -0
  52. package/dist/chunk-TSZ37JDY.mjs +2596 -0
  53. package/dist/chunk-U3MS6KMF.mjs +1 -0
  54. package/dist/chunk-UBALMYIY.mjs +2049 -0
  55. package/dist/chunk-UDYXMII2.mjs +121 -0
  56. package/dist/chunk-UJCSKKID.mjs +30 -0
  57. package/dist/chunk-UOOF4V2Y.mjs +1 -0
  58. package/dist/chunk-VDZ7F7MP.mjs +1329 -0
  59. package/dist/chunk-X4LEBNK6.mjs +276 -0
  60. package/dist/chunk-Z2TH6U4C.mjs +3 -0
  61. package/dist/chunk-Z6DUAI5B.mjs +121 -0
  62. package/dist/chunk-ZEPZ4QDD.mjs +1 -0
  63. package/dist/chunk-ZGUY5EIR.mjs +1 -0
  64. package/dist/cjs-RMZ3L2IO.mjs +5 -0
  65. package/dist/contract-api-AO4RGPLT-4HRCMSCE.mjs +279 -0
  66. package/dist/contract-api-AO4RGPLT-ADH6ZDKC.mjs +279 -0
  67. package/dist/contract-api-AO4RGPLT-ENC72WCG.mjs +280 -0
  68. package/dist/contract-api-AO4RGPLT-PAMIPEI3.mjs +1 -0
  69. package/dist/contract-api-AO4RGPLT-W3RSVP5A.mjs +1 -0
  70. package/dist/contract-api-AO4RGPLT-WENYDV6I.mjs +1 -0
  71. package/dist/contract-api-TJ7JPHZA-6FUBJ6DS.mjs +279 -0
  72. package/dist/contract-api-TJ7JPHZA-ZWP3EH7D.mjs +279 -0
  73. package/dist/contracts/dataregistry/managed/keys/removeReference.prover +0 -0
  74. package/dist/contracts/dataregistry/managed/keys/removeReference.verifier +0 -0
  75. package/dist/contracts/dataregistry/managed/keys/storeReference.prover +0 -0
  76. package/dist/contracts/dataregistry/managed/keys/storeReference.verifier +0 -0
  77. package/dist/contracts/dataregistry/managed/keys/updateReference.prover +0 -0
  78. package/dist/contracts/dataregistry/managed/keys/updateReference.verifier +0 -0
  79. package/dist/contracts/dataregistry/managed/zkir/removeReference.bzkir +0 -0
  80. package/dist/contracts/dataregistry/managed/zkir/removeReference.zkir +138 -0
  81. package/dist/contracts/dataregistry/managed/zkir/storeReference.bzkir +0 -0
  82. package/dist/contracts/dataregistry/managed/zkir/storeReference.zkir +158 -0
  83. package/dist/contracts/dataregistry/managed/zkir/updateReference.bzkir +0 -0
  84. package/dist/contracts/dataregistry/managed/zkir/updateReference.zkir +190 -0
  85. package/dist/dataregistry-simulator-E6RTGGWT-5YEGBW7P.mjs +108 -0
  86. package/dist/dataregistry-simulator-E6RTGGWT-DJS4MHBD.mjs +109 -0
  87. package/dist/dataregistry-simulator-E6RTGGWT-QGCYR3VF.mjs +1 -0
  88. package/dist/dist-655VYUPJ.mjs +1 -0
  89. package/dist/dist-INTAFXQ7.mjs +65 -0
  90. package/dist/dist-MEZZWKP4.mjs +1 -0
  91. package/dist/dist-MOLWJ4Y7.mjs +64 -0
  92. package/dist/dist-UD4WRMYJ.mjs +65 -0
  93. package/dist/errors.d.mts +117 -0
  94. package/dist/errors.d.ts +117 -0
  95. package/dist/errors.js +2308 -0
  96. package/dist/errors.mjs +2278 -0
  97. package/dist/esm5-AGBDHMNS.mjs +1 -0
  98. package/dist/esm5-GFOBLUFI.mjs +350 -0
  99. package/dist/in-memory-private-state-NGOP37V7-DXWZE42Q.mjs +48 -0
  100. package/dist/in-memory-private-state-NGOP37V7-QXT3RUEH.mjs +49 -0
  101. package/dist/in-memory-private-state-NGOP37V7-XFJFNFCQ.mjs +1 -0
  102. package/dist/index.d.mts +2843 -0
  103. package/dist/index.d.ts +2843 -0
  104. package/dist/index.js +19639 -0
  105. package/dist/index.mjs +5177 -0
  106. package/package.json +87 -0
@@ -0,0 +1,1329 @@
1
+ import {
2
+ __publicField
3
+ } from "./chunk-5QOKJEH3.mjs";
4
+
5
+ // ../chain/dist/chunk-I3XXA2G7.mjs
6
+ import * as __compactRuntime from "@midnight-ntwrk/compact-runtime";
7
+ import { CompiledContract } from "@midnight-ntwrk/compact-js";
8
+ __compactRuntime.checkRuntimeVersion("0.16.0");
9
+ var _descriptor_0 = new __compactRuntime.CompactTypeBytes(32);
10
+ var _descriptor_1 = __compactRuntime.CompactTypeOpaqueString;
11
+ var _descriptor_2 = new __compactRuntime.CompactTypeUnsignedInteger(18446744073709551615n, 8);
12
+ var _ReferenceEntry_0 = class {
13
+ alignment() {
14
+ return _descriptor_1.alignment().concat(_descriptor_1.alignment().concat(_descriptor_1.alignment().concat(_descriptor_1.alignment().concat(_descriptor_2.alignment().concat(_descriptor_1.alignment().concat(_descriptor_0.alignment().concat(_descriptor_0.alignment())))))));
15
+ }
16
+ fromValue(value_0) {
17
+ return {
18
+ storageId: _descriptor_1.fromValue(value_0),
19
+ encryptionScheme: _descriptor_1.fromValue(value_0),
20
+ storageProvider: _descriptor_1.fromValue(value_0),
21
+ metadata: _descriptor_1.fromValue(value_0),
22
+ writtenAt: _descriptor_2.fromValue(value_0),
23
+ keyEnvelope: _descriptor_1.fromValue(value_0),
24
+ ownerCommitment: _descriptor_0.fromValue(value_0),
25
+ contentHash: _descriptor_0.fromValue(value_0)
26
+ };
27
+ }
28
+ toValue(value_0) {
29
+ return _descriptor_1.toValue(value_0.storageId).concat(_descriptor_1.toValue(value_0.encryptionScheme).concat(_descriptor_1.toValue(value_0.storageProvider).concat(_descriptor_1.toValue(value_0.metadata).concat(_descriptor_2.toValue(value_0.writtenAt).concat(_descriptor_1.toValue(value_0.keyEnvelope).concat(_descriptor_0.toValue(value_0.ownerCommitment).concat(_descriptor_0.toValue(value_0.contentHash))))))));
30
+ }
31
+ };
32
+ var _descriptor_3 = new _ReferenceEntry_0();
33
+ var _descriptor_4 = __compactRuntime.CompactTypeBoolean;
34
+ var _ContractAddress_0 = class {
35
+ alignment() {
36
+ return _descriptor_0.alignment();
37
+ }
38
+ fromValue(value_0) {
39
+ return {
40
+ bytes: _descriptor_0.fromValue(value_0)
41
+ };
42
+ }
43
+ toValue(value_0) {
44
+ return _descriptor_0.toValue(value_0.bytes);
45
+ }
46
+ };
47
+ var _descriptor_5 = new _ContractAddress_0();
48
+ var _descriptor_6 = new __compactRuntime.CompactTypeUnsignedInteger(65535n, 2);
49
+ var _descriptor_7 = new __compactRuntime.CompactTypeVector(4, _descriptor_0);
50
+ var _descriptor_8 = new __compactRuntime.CompactTypeVector(3, _descriptor_0);
51
+ var _Either_0 = class {
52
+ alignment() {
53
+ return _descriptor_4.alignment().concat(_descriptor_0.alignment().concat(_descriptor_0.alignment()));
54
+ }
55
+ fromValue(value_0) {
56
+ return {
57
+ is_left: _descriptor_4.fromValue(value_0),
58
+ left: _descriptor_0.fromValue(value_0),
59
+ right: _descriptor_0.fromValue(value_0)
60
+ };
61
+ }
62
+ toValue(value_0) {
63
+ return _descriptor_4.toValue(value_0.is_left).concat(_descriptor_0.toValue(value_0.left).concat(_descriptor_0.toValue(value_0.right)));
64
+ }
65
+ };
66
+ var _descriptor_9 = new _Either_0();
67
+ var _descriptor_10 = new __compactRuntime.CompactTypeUnsignedInteger(340282366920938463463374607431768211455n, 16);
68
+ var _descriptor_11 = new __compactRuntime.CompactTypeUnsignedInteger(255n, 1);
69
+ var Contract = class {
70
+ constructor(...args_0) {
71
+ __publicField(this, "witnesses");
72
+ if (args_0.length !== 1) {
73
+ throw new __compactRuntime.CompactError(`Contract constructor: expected 1 argument, received ${args_0.length}`);
74
+ }
75
+ const witnesses_0 = args_0[0];
76
+ if (typeof witnesses_0 !== "object") {
77
+ throw new __compactRuntime.CompactError("first (witnesses) argument to Contract constructor is not an object");
78
+ }
79
+ if (typeof witnesses_0.ownerSecret !== "function") {
80
+ throw new __compactRuntime.CompactError("first (witnesses) argument to Contract constructor does not contain a function-valued field named ownerSecret");
81
+ }
82
+ if (typeof witnesses_0.newOwnerSecret !== "function") {
83
+ throw new __compactRuntime.CompactError("first (witnesses) argument to Contract constructor does not contain a function-valued field named newOwnerSecret");
84
+ }
85
+ this.witnesses = witnesses_0;
86
+ this.circuits = {
87
+ deriveRefId(context, ...args_1) {
88
+ return { result: pureCircuits.deriveRefId(...args_1), context };
89
+ },
90
+ storeReference: (...args_1) => {
91
+ if (args_1.length !== 8) {
92
+ throw new __compactRuntime.CompactError(`storeReference: expected 8 arguments (as invoked from Typescript), received ${args_1.length}`);
93
+ }
94
+ const contextOrig_0 = args_1[0];
95
+ const storageId_0 = args_1[1];
96
+ const encryptionScheme_0 = args_1[2];
97
+ const storageProvider_0 = args_1[3];
98
+ const metadata_0 = args_1[4];
99
+ const writtenAt_0 = args_1[5];
100
+ const keyEnvelope_0 = args_1[6];
101
+ const contentHash_0 = args_1[7];
102
+ if (!(typeof contextOrig_0 === "object" && contextOrig_0.currentQueryContext != void 0)) {
103
+ __compactRuntime.typeError(
104
+ "storeReference",
105
+ "argument 1 (as invoked from Typescript)",
106
+ "DataRegistry.compact line 184 char 1",
107
+ "CircuitContext",
108
+ contextOrig_0
109
+ );
110
+ }
111
+ if (!(typeof writtenAt_0 === "bigint" && writtenAt_0 >= 0n && writtenAt_0 <= 18446744073709551615n)) {
112
+ __compactRuntime.typeError(
113
+ "storeReference",
114
+ "argument 5 (argument 6 as invoked from Typescript)",
115
+ "DataRegistry.compact line 184 char 1",
116
+ "Uint<0..18446744073709551616>",
117
+ writtenAt_0
118
+ );
119
+ }
120
+ if (!(contentHash_0.buffer instanceof ArrayBuffer && contentHash_0.BYTES_PER_ELEMENT === 1 && contentHash_0.length === 32)) {
121
+ __compactRuntime.typeError(
122
+ "storeReference",
123
+ "argument 7 (argument 8 as invoked from Typescript)",
124
+ "DataRegistry.compact line 184 char 1",
125
+ "Bytes<32>",
126
+ contentHash_0
127
+ );
128
+ }
129
+ const context = { ...contextOrig_0, gasCost: __compactRuntime.emptyRunningCost() };
130
+ const partialProofData = {
131
+ input: {
132
+ value: _descriptor_1.toValue(storageId_0).concat(_descriptor_1.toValue(encryptionScheme_0).concat(_descriptor_1.toValue(storageProvider_0).concat(_descriptor_1.toValue(metadata_0).concat(_descriptor_2.toValue(writtenAt_0).concat(_descriptor_1.toValue(keyEnvelope_0).concat(_descriptor_0.toValue(contentHash_0))))))),
133
+ alignment: _descriptor_1.alignment().concat(_descriptor_1.alignment().concat(_descriptor_1.alignment().concat(_descriptor_1.alignment().concat(_descriptor_2.alignment().concat(_descriptor_1.alignment().concat(_descriptor_0.alignment()))))))
134
+ },
135
+ output: void 0,
136
+ publicTranscript: [],
137
+ privateTranscriptOutputs: []
138
+ };
139
+ const result_0 = this._storeReference_0(
140
+ context,
141
+ partialProofData,
142
+ storageId_0,
143
+ encryptionScheme_0,
144
+ storageProvider_0,
145
+ metadata_0,
146
+ writtenAt_0,
147
+ keyEnvelope_0,
148
+ contentHash_0
149
+ );
150
+ partialProofData.output = { value: _descriptor_0.toValue(result_0), alignment: _descriptor_0.alignment() };
151
+ return { result: result_0, context, proofData: partialProofData, gasCost: context.gasCost };
152
+ },
153
+ removeReference: (...args_1) => {
154
+ if (args_1.length !== 2) {
155
+ throw new __compactRuntime.CompactError(`removeReference: expected 2 arguments (as invoked from Typescript), received ${args_1.length}`);
156
+ }
157
+ const contextOrig_0 = args_1[0];
158
+ const refId_0 = args_1[1];
159
+ if (!(typeof contextOrig_0 === "object" && contextOrig_0.currentQueryContext != void 0)) {
160
+ __compactRuntime.typeError(
161
+ "removeReference",
162
+ "argument 1 (as invoked from Typescript)",
163
+ "DataRegistry.compact line 224 char 1",
164
+ "CircuitContext",
165
+ contextOrig_0
166
+ );
167
+ }
168
+ if (!(refId_0.buffer instanceof ArrayBuffer && refId_0.BYTES_PER_ELEMENT === 1 && refId_0.length === 32)) {
169
+ __compactRuntime.typeError(
170
+ "removeReference",
171
+ "argument 1 (argument 2 as invoked from Typescript)",
172
+ "DataRegistry.compact line 224 char 1",
173
+ "Bytes<32>",
174
+ refId_0
175
+ );
176
+ }
177
+ const context = { ...contextOrig_0, gasCost: __compactRuntime.emptyRunningCost() };
178
+ const partialProofData = {
179
+ input: {
180
+ value: _descriptor_0.toValue(refId_0),
181
+ alignment: _descriptor_0.alignment()
182
+ },
183
+ output: void 0,
184
+ publicTranscript: [],
185
+ privateTranscriptOutputs: []
186
+ };
187
+ const result_0 = this._removeReference_0(
188
+ context,
189
+ partialProofData,
190
+ refId_0
191
+ );
192
+ partialProofData.output = { value: [], alignment: [] };
193
+ return { result: result_0, context, proofData: partialProofData, gasCost: context.gasCost };
194
+ },
195
+ updateReference: (...args_1) => {
196
+ if (args_1.length !== 9) {
197
+ throw new __compactRuntime.CompactError(`updateReference: expected 9 arguments (as invoked from Typescript), received ${args_1.length}`);
198
+ }
199
+ const contextOrig_0 = args_1[0];
200
+ const refId_0 = args_1[1];
201
+ const storageId_0 = args_1[2];
202
+ const encryptionScheme_0 = args_1[3];
203
+ const storageProvider_0 = args_1[4];
204
+ const metadata_0 = args_1[5];
205
+ const writtenAt_0 = args_1[6];
206
+ const keyEnvelope_0 = args_1[7];
207
+ const contentHash_0 = args_1[8];
208
+ if (!(typeof contextOrig_0 === "object" && contextOrig_0.currentQueryContext != void 0)) {
209
+ __compactRuntime.typeError(
210
+ "updateReference",
211
+ "argument 1 (as invoked from Typescript)",
212
+ "DataRegistry.compact line 251 char 1",
213
+ "CircuitContext",
214
+ contextOrig_0
215
+ );
216
+ }
217
+ if (!(refId_0.buffer instanceof ArrayBuffer && refId_0.BYTES_PER_ELEMENT === 1 && refId_0.length === 32)) {
218
+ __compactRuntime.typeError(
219
+ "updateReference",
220
+ "argument 1 (argument 2 as invoked from Typescript)",
221
+ "DataRegistry.compact line 251 char 1",
222
+ "Bytes<32>",
223
+ refId_0
224
+ );
225
+ }
226
+ if (!(typeof writtenAt_0 === "bigint" && writtenAt_0 >= 0n && writtenAt_0 <= 18446744073709551615n)) {
227
+ __compactRuntime.typeError(
228
+ "updateReference",
229
+ "argument 6 (argument 7 as invoked from Typescript)",
230
+ "DataRegistry.compact line 251 char 1",
231
+ "Uint<0..18446744073709551616>",
232
+ writtenAt_0
233
+ );
234
+ }
235
+ if (!(contentHash_0.buffer instanceof ArrayBuffer && contentHash_0.BYTES_PER_ELEMENT === 1 && contentHash_0.length === 32)) {
236
+ __compactRuntime.typeError(
237
+ "updateReference",
238
+ "argument 8 (argument 9 as invoked from Typescript)",
239
+ "DataRegistry.compact line 251 char 1",
240
+ "Bytes<32>",
241
+ contentHash_0
242
+ );
243
+ }
244
+ const context = { ...contextOrig_0, gasCost: __compactRuntime.emptyRunningCost() };
245
+ const partialProofData = {
246
+ input: {
247
+ value: _descriptor_0.toValue(refId_0).concat(_descriptor_1.toValue(storageId_0).concat(_descriptor_1.toValue(encryptionScheme_0).concat(_descriptor_1.toValue(storageProvider_0).concat(_descriptor_1.toValue(metadata_0).concat(_descriptor_2.toValue(writtenAt_0).concat(_descriptor_1.toValue(keyEnvelope_0).concat(_descriptor_0.toValue(contentHash_0)))))))),
248
+ alignment: _descriptor_0.alignment().concat(_descriptor_1.alignment().concat(_descriptor_1.alignment().concat(_descriptor_1.alignment().concat(_descriptor_1.alignment().concat(_descriptor_2.alignment().concat(_descriptor_1.alignment().concat(_descriptor_0.alignment())))))))
249
+ },
250
+ output: void 0,
251
+ publicTranscript: [],
252
+ privateTranscriptOutputs: []
253
+ };
254
+ const result_0 = this._updateReference_0(
255
+ context,
256
+ partialProofData,
257
+ refId_0,
258
+ storageId_0,
259
+ encryptionScheme_0,
260
+ storageProvider_0,
261
+ metadata_0,
262
+ writtenAt_0,
263
+ keyEnvelope_0,
264
+ contentHash_0
265
+ );
266
+ partialProofData.output = { value: [], alignment: [] };
267
+ return { result: result_0, context, proofData: partialProofData, gasCost: context.gasCost };
268
+ }
269
+ };
270
+ this.impureCircuits = {
271
+ storeReference: this.circuits.storeReference,
272
+ removeReference: this.circuits.removeReference,
273
+ updateReference: this.circuits.updateReference
274
+ };
275
+ this.provableCircuits = {
276
+ storeReference: this.circuits.storeReference,
277
+ removeReference: this.circuits.removeReference,
278
+ updateReference: this.circuits.updateReference
279
+ };
280
+ }
281
+ initialState(...args_0) {
282
+ if (args_0.length !== 1) {
283
+ throw new __compactRuntime.CompactError(`Contract state constructor: expected 1 argument (as invoked from Typescript), received ${args_0.length}`);
284
+ }
285
+ const constructorContext_0 = args_0[0];
286
+ if (typeof constructorContext_0 !== "object") {
287
+ throw new __compactRuntime.CompactError(`Contract state constructor: expected 'constructorContext' in argument 1 (as invoked from Typescript) to be an object`);
288
+ }
289
+ if (!("initialPrivateState" in constructorContext_0)) {
290
+ throw new __compactRuntime.CompactError(`Contract state constructor: expected 'initialPrivateState' in argument 1 (as invoked from Typescript)`);
291
+ }
292
+ if (!("initialZswapLocalState" in constructorContext_0)) {
293
+ throw new __compactRuntime.CompactError(`Contract state constructor: expected 'initialZswapLocalState' in argument 1 (as invoked from Typescript)`);
294
+ }
295
+ if (typeof constructorContext_0.initialZswapLocalState !== "object") {
296
+ throw new __compactRuntime.CompactError(`Contract state constructor: expected 'initialZswapLocalState' in argument 1 (as invoked from Typescript) to be an object`);
297
+ }
298
+ const state_0 = new __compactRuntime.ContractState();
299
+ let stateValue_0 = __compactRuntime.StateValue.newArray();
300
+ stateValue_0 = stateValue_0.arrayPush(__compactRuntime.StateValue.newNull());
301
+ stateValue_0 = stateValue_0.arrayPush(__compactRuntime.StateValue.newNull());
302
+ stateValue_0 = stateValue_0.arrayPush(__compactRuntime.StateValue.newNull());
303
+ state_0.data = new __compactRuntime.ChargedState(stateValue_0);
304
+ state_0.setOperation("storeReference", new __compactRuntime.ContractOperation());
305
+ state_0.setOperation("removeReference", new __compactRuntime.ContractOperation());
306
+ state_0.setOperation("updateReference", new __compactRuntime.ContractOperation());
307
+ const context = __compactRuntime.createCircuitContext(__compactRuntime.dummyContractAddress(), constructorContext_0.initialZswapLocalState.coinPublicKey, state_0.data, constructorContext_0.initialPrivateState);
308
+ const partialProofData = {
309
+ input: { value: [], alignment: [] },
310
+ output: void 0,
311
+ publicTranscript: [],
312
+ privateTranscriptOutputs: []
313
+ };
314
+ __compactRuntime.queryLedgerState(
315
+ context,
316
+ partialProofData,
317
+ [
318
+ { push: {
319
+ storage: false,
320
+ value: __compactRuntime.StateValue.newCell({
321
+ value: _descriptor_11.toValue(0n),
322
+ alignment: _descriptor_11.alignment()
323
+ }).encode()
324
+ } },
325
+ { push: {
326
+ storage: true,
327
+ value: __compactRuntime.StateValue.newMap(
328
+ new __compactRuntime.StateMap()
329
+ ).encode()
330
+ } },
331
+ { ins: { cached: false, n: 1 } }
332
+ ]
333
+ );
334
+ __compactRuntime.queryLedgerState(
335
+ context,
336
+ partialProofData,
337
+ [
338
+ { push: {
339
+ storage: false,
340
+ value: __compactRuntime.StateValue.newCell({
341
+ value: _descriptor_11.toValue(1n),
342
+ alignment: _descriptor_11.alignment()
343
+ }).encode()
344
+ } },
345
+ { push: {
346
+ storage: true,
347
+ value: __compactRuntime.StateValue.newCell({
348
+ value: _descriptor_2.toValue(0n),
349
+ alignment: _descriptor_2.alignment()
350
+ }).encode()
351
+ } },
352
+ { ins: { cached: false, n: 1 } }
353
+ ]
354
+ );
355
+ __compactRuntime.queryLedgerState(
356
+ context,
357
+ partialProofData,
358
+ [
359
+ { push: {
360
+ storage: false,
361
+ value: __compactRuntime.StateValue.newCell({
362
+ value: _descriptor_11.toValue(2n),
363
+ alignment: _descriptor_11.alignment()
364
+ }).encode()
365
+ } },
366
+ { push: {
367
+ storage: true,
368
+ value: __compactRuntime.StateValue.newCell({
369
+ value: _descriptor_6.toValue(0n),
370
+ alignment: _descriptor_6.alignment()
371
+ }).encode()
372
+ } },
373
+ { ins: { cached: false, n: 1 } }
374
+ ]
375
+ );
376
+ const tmp_0 = 1n;
377
+ __compactRuntime.queryLedgerState(
378
+ context,
379
+ partialProofData,
380
+ [
381
+ { idx: {
382
+ cached: false,
383
+ pushPath: true,
384
+ path: [
385
+ {
386
+ tag: "value",
387
+ value: {
388
+ value: _descriptor_11.toValue(1n),
389
+ alignment: _descriptor_11.alignment()
390
+ }
391
+ }
392
+ ]
393
+ } },
394
+ { addi: { immediate: parseInt(__compactRuntime.valueToBigInt(
395
+ {
396
+ value: _descriptor_6.toValue(tmp_0),
397
+ alignment: _descriptor_6.alignment()
398
+ }.value
399
+ )) } },
400
+ { ins: { cached: true, n: 1 } }
401
+ ]
402
+ );
403
+ const tmp_1 = 0n;
404
+ __compactRuntime.queryLedgerState(
405
+ context,
406
+ partialProofData,
407
+ [
408
+ { push: {
409
+ storage: false,
410
+ value: __compactRuntime.StateValue.newCell({
411
+ value: _descriptor_11.toValue(2n),
412
+ alignment: _descriptor_11.alignment()
413
+ }).encode()
414
+ } },
415
+ { push: {
416
+ storage: true,
417
+ value: __compactRuntime.StateValue.newCell({
418
+ value: _descriptor_6.toValue(tmp_1),
419
+ alignment: _descriptor_6.alignment()
420
+ }).encode()
421
+ } },
422
+ { ins: { cached: false, n: 1 } }
423
+ ]
424
+ );
425
+ state_0.data = new __compactRuntime.ChargedState(context.currentQueryContext.state.state);
426
+ return {
427
+ currentContractState: state_0,
428
+ currentPrivateState: context.currentPrivateState,
429
+ currentZswapLocalState: context.currentZswapLocalState
430
+ };
431
+ }
432
+ _persistentHash_0(value_0) {
433
+ const result_0 = __compactRuntime.persistentHash(_descriptor_8, value_0);
434
+ return result_0;
435
+ }
436
+ _persistentHash_1(value_0) {
437
+ const result_0 = __compactRuntime.persistentHash(_descriptor_7, value_0);
438
+ return result_0;
439
+ }
440
+ _ownerSecret_0(context, partialProofData) {
441
+ const witnessContext_0 = __compactRuntime.createWitnessContext(ledger(context.currentQueryContext.state), context.currentPrivateState, context.currentQueryContext.address);
442
+ const [nextPrivateState_0, result_0] = this.witnesses.ownerSecret(witnessContext_0);
443
+ context.currentPrivateState = nextPrivateState_0;
444
+ if (!(result_0.buffer instanceof ArrayBuffer && result_0.BYTES_PER_ELEMENT === 1 && result_0.length === 32)) {
445
+ __compactRuntime.typeError(
446
+ "ownerSecret",
447
+ "return value",
448
+ "DataRegistry.compact line 26 char 1",
449
+ "Bytes<32>",
450
+ result_0
451
+ );
452
+ }
453
+ partialProofData.privateTranscriptOutputs.push({
454
+ value: _descriptor_0.toValue(result_0),
455
+ alignment: _descriptor_0.alignment()
456
+ });
457
+ return result_0;
458
+ }
459
+ _newOwnerSecret_0(context, partialProofData) {
460
+ const witnessContext_0 = __compactRuntime.createWitnessContext(ledger(context.currentQueryContext.state), context.currentPrivateState, context.currentQueryContext.address);
461
+ const [nextPrivateState_0, result_0] = this.witnesses.newOwnerSecret(witnessContext_0);
462
+ context.currentPrivateState = nextPrivateState_0;
463
+ if (!(result_0.buffer instanceof ArrayBuffer && result_0.BYTES_PER_ELEMENT === 1 && result_0.length === 32)) {
464
+ __compactRuntime.typeError(
465
+ "newOwnerSecret",
466
+ "return value",
467
+ "DataRegistry.compact line 28 char 1",
468
+ "Bytes<32>",
469
+ result_0
470
+ );
471
+ }
472
+ partialProofData.privateTranscriptOutputs.push({
473
+ value: _descriptor_0.toValue(result_0),
474
+ alignment: _descriptor_0.alignment()
475
+ });
476
+ return result_0;
477
+ }
478
+ _computeOwnerCommitment_0(secret_0, nonce_0, instanceSalt_0) {
479
+ return this._persistentHash_1([
480
+ new Uint8Array([100, 115, 116, 111, 114, 97, 103, 101, 58, 111, 119, 110, 101, 114, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
481
+ secret_0,
482
+ nonce_0,
483
+ instanceSalt_0
484
+ ]);
485
+ }
486
+ _deriveRefId_0(refCounter_0, instanceSalt_0) {
487
+ return this._persistentHash_0([
488
+ new Uint8Array([100, 115, 116, 111, 114, 97, 103, 101, 58, 114, 101, 102, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
489
+ refCounter_0,
490
+ instanceSalt_0
491
+ ]);
492
+ }
493
+ _validatedOwnerCommitment_0(context, partialProofData, refId_0) {
494
+ const secret_0 = this._ownerSecret_0(context, partialProofData);
495
+ __compactRuntime.assert(
496
+ !this._equal_0(
497
+ secret_0,
498
+ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
499
+ ),
500
+ "ownerSecret must not be zero"
501
+ );
502
+ return this._computeOwnerCommitment_0(
503
+ secret_0,
504
+ refId_0,
505
+ _descriptor_5.fromValue(__compactRuntime.queryLedgerState(
506
+ context,
507
+ partialProofData,
508
+ [
509
+ { dup: { n: 2 } },
510
+ { idx: {
511
+ cached: true,
512
+ pushPath: false,
513
+ path: [
514
+ {
515
+ tag: "value",
516
+ value: {
517
+ value: _descriptor_11.toValue(0n),
518
+ alignment: _descriptor_11.alignment()
519
+ }
520
+ }
521
+ ]
522
+ } },
523
+ { popeq: {
524
+ cached: true,
525
+ result: void 0
526
+ } }
527
+ ]
528
+ ).value).bytes
529
+ );
530
+ }
531
+ _validatedNewOwnerCommitment_0(context, partialProofData, refId_0) {
532
+ const secret_0 = this._newOwnerSecret_0(context, partialProofData);
533
+ __compactRuntime.assert(
534
+ !this._equal_1(
535
+ secret_0,
536
+ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
537
+ ),
538
+ "newOwnerSecret must not be zero"
539
+ );
540
+ return this._computeOwnerCommitment_0(
541
+ secret_0,
542
+ refId_0,
543
+ _descriptor_5.fromValue(__compactRuntime.queryLedgerState(
544
+ context,
545
+ partialProofData,
546
+ [
547
+ { dup: { n: 2 } },
548
+ { idx: {
549
+ cached: true,
550
+ pushPath: false,
551
+ path: [
552
+ {
553
+ tag: "value",
554
+ value: {
555
+ value: _descriptor_11.toValue(0n),
556
+ alignment: _descriptor_11.alignment()
557
+ }
558
+ }
559
+ ]
560
+ } },
561
+ { popeq: {
562
+ cached: true,
563
+ result: void 0
564
+ } }
565
+ ]
566
+ ).value).bytes
567
+ );
568
+ }
569
+ _storeReference_0(context, partialProofData, storageId_0, encryptionScheme_0, storageProvider_0, metadata_0, writtenAt_0, keyEnvelope_0, contentHash_0) {
570
+ const refId_0 = this._deriveRefId_0(
571
+ __compactRuntime.convertFieldToBytes(
572
+ 32,
573
+ _descriptor_2.fromValue(__compactRuntime.queryLedgerState(
574
+ context,
575
+ partialProofData,
576
+ [
577
+ { dup: { n: 0 } },
578
+ { idx: {
579
+ cached: false,
580
+ pushPath: false,
581
+ path: [
582
+ {
583
+ tag: "value",
584
+ value: {
585
+ value: _descriptor_11.toValue(1n),
586
+ alignment: _descriptor_11.alignment()
587
+ }
588
+ }
589
+ ]
590
+ } },
591
+ { popeq: {
592
+ cached: true,
593
+ result: void 0
594
+ } }
595
+ ]
596
+ ).value),
597
+ "DataRegistry.compact line 193 char 29"
598
+ ),
599
+ _descriptor_5.fromValue(__compactRuntime.queryLedgerState(
600
+ context,
601
+ partialProofData,
602
+ [
603
+ { dup: { n: 2 } },
604
+ { idx: {
605
+ cached: true,
606
+ pushPath: false,
607
+ path: [
608
+ {
609
+ tag: "value",
610
+ value: {
611
+ value: _descriptor_11.toValue(0n),
612
+ alignment: _descriptor_11.alignment()
613
+ }
614
+ }
615
+ ]
616
+ } },
617
+ { popeq: {
618
+ cached: true,
619
+ result: void 0
620
+ } }
621
+ ]
622
+ ).value).bytes
623
+ );
624
+ __compactRuntime.assert(
625
+ !_descriptor_4.fromValue(__compactRuntime.queryLedgerState(
626
+ context,
627
+ partialProofData,
628
+ [
629
+ { dup: { n: 0 } },
630
+ { idx: {
631
+ cached: false,
632
+ pushPath: false,
633
+ path: [
634
+ {
635
+ tag: "value",
636
+ value: {
637
+ value: _descriptor_11.toValue(0n),
638
+ alignment: _descriptor_11.alignment()
639
+ }
640
+ }
641
+ ]
642
+ } },
643
+ { push: {
644
+ storage: false,
645
+ value: __compactRuntime.StateValue.newCell({
646
+ value: _descriptor_0.toValue(refId_0),
647
+ alignment: _descriptor_0.alignment()
648
+ }).encode()
649
+ } },
650
+ "member",
651
+ { popeq: {
652
+ cached: true,
653
+ result: void 0
654
+ } }
655
+ ]
656
+ ).value),
657
+ "Reference already stored"
658
+ );
659
+ const ownerCommitment_0 = this._validatedOwnerCommitment_0(
660
+ context,
661
+ partialProofData,
662
+ refId_0
663
+ );
664
+ const entry_0 = {
665
+ storageId: storageId_0,
666
+ encryptionScheme: encryptionScheme_0,
667
+ storageProvider: storageProvider_0,
668
+ metadata: metadata_0,
669
+ writtenAt: writtenAt_0,
670
+ keyEnvelope: keyEnvelope_0,
671
+ ownerCommitment: ownerCommitment_0,
672
+ contentHash: contentHash_0
673
+ };
674
+ __compactRuntime.queryLedgerState(
675
+ context,
676
+ partialProofData,
677
+ [
678
+ { idx: {
679
+ cached: false,
680
+ pushPath: true,
681
+ path: [
682
+ {
683
+ tag: "value",
684
+ value: {
685
+ value: _descriptor_11.toValue(0n),
686
+ alignment: _descriptor_11.alignment()
687
+ }
688
+ }
689
+ ]
690
+ } },
691
+ { push: {
692
+ storage: false,
693
+ value: __compactRuntime.StateValue.newCell({
694
+ value: _descriptor_0.toValue(refId_0),
695
+ alignment: _descriptor_0.alignment()
696
+ }).encode()
697
+ } },
698
+ { push: {
699
+ storage: true,
700
+ value: __compactRuntime.StateValue.newCell({
701
+ value: _descriptor_3.toValue(entry_0),
702
+ alignment: _descriptor_3.alignment()
703
+ }).encode()
704
+ } },
705
+ { ins: { cached: false, n: 1 } },
706
+ { ins: { cached: true, n: 1 } }
707
+ ]
708
+ );
709
+ const tmp_0 = 1n;
710
+ __compactRuntime.queryLedgerState(
711
+ context,
712
+ partialProofData,
713
+ [
714
+ { idx: {
715
+ cached: false,
716
+ pushPath: true,
717
+ path: [
718
+ {
719
+ tag: "value",
720
+ value: {
721
+ value: _descriptor_11.toValue(1n),
722
+ alignment: _descriptor_11.alignment()
723
+ }
724
+ }
725
+ ]
726
+ } },
727
+ { addi: { immediate: parseInt(__compactRuntime.valueToBigInt(
728
+ {
729
+ value: _descriptor_6.toValue(tmp_0),
730
+ alignment: _descriptor_6.alignment()
731
+ }.value
732
+ )) } },
733
+ { ins: { cached: true, n: 1 } }
734
+ ]
735
+ );
736
+ return refId_0;
737
+ }
738
+ _removeReference_0(context, partialProofData, refId_0) {
739
+ __compactRuntime.assert(
740
+ _descriptor_4.fromValue(__compactRuntime.queryLedgerState(
741
+ context,
742
+ partialProofData,
743
+ [
744
+ { dup: { n: 0 } },
745
+ { idx: {
746
+ cached: false,
747
+ pushPath: false,
748
+ path: [
749
+ {
750
+ tag: "value",
751
+ value: {
752
+ value: _descriptor_11.toValue(0n),
753
+ alignment: _descriptor_11.alignment()
754
+ }
755
+ }
756
+ ]
757
+ } },
758
+ { push: {
759
+ storage: false,
760
+ value: __compactRuntime.StateValue.newCell({
761
+ value: _descriptor_0.toValue(refId_0),
762
+ alignment: _descriptor_0.alignment()
763
+ }).encode()
764
+ } },
765
+ "member",
766
+ { popeq: {
767
+ cached: true,
768
+ result: void 0
769
+ } }
770
+ ]
771
+ ).value),
772
+ "Reference not found"
773
+ );
774
+ const entry_0 = _descriptor_3.fromValue(__compactRuntime.queryLedgerState(
775
+ context,
776
+ partialProofData,
777
+ [
778
+ { dup: { n: 0 } },
779
+ { idx: {
780
+ cached: false,
781
+ pushPath: false,
782
+ path: [
783
+ {
784
+ tag: "value",
785
+ value: {
786
+ value: _descriptor_11.toValue(0n),
787
+ alignment: _descriptor_11.alignment()
788
+ }
789
+ }
790
+ ]
791
+ } },
792
+ { idx: {
793
+ cached: false,
794
+ pushPath: false,
795
+ path: [
796
+ {
797
+ tag: "value",
798
+ value: {
799
+ value: _descriptor_0.toValue(refId_0),
800
+ alignment: _descriptor_0.alignment()
801
+ }
802
+ }
803
+ ]
804
+ } },
805
+ { popeq: {
806
+ cached: false,
807
+ result: void 0
808
+ } }
809
+ ]
810
+ ).value);
811
+ const ownerCommitment_0 = this._validatedOwnerCommitment_0(
812
+ context,
813
+ partialProofData,
814
+ refId_0
815
+ );
816
+ __compactRuntime.assert(
817
+ this._equal_2(
818
+ entry_0.ownerCommitment,
819
+ ownerCommitment_0
820
+ ),
821
+ "Not the owner"
822
+ );
823
+ __compactRuntime.queryLedgerState(
824
+ context,
825
+ partialProofData,
826
+ [
827
+ { idx: {
828
+ cached: false,
829
+ pushPath: true,
830
+ path: [
831
+ {
832
+ tag: "value",
833
+ value: {
834
+ value: _descriptor_11.toValue(0n),
835
+ alignment: _descriptor_11.alignment()
836
+ }
837
+ }
838
+ ]
839
+ } },
840
+ { push: {
841
+ storage: false,
842
+ value: __compactRuntime.StateValue.newCell({
843
+ value: _descriptor_0.toValue(refId_0),
844
+ alignment: _descriptor_0.alignment()
845
+ }).encode()
846
+ } },
847
+ { rem: { cached: false } },
848
+ { ins: { cached: true, n: 1 } }
849
+ ]
850
+ );
851
+ return [];
852
+ }
853
+ _updateReference_0(context, partialProofData, refId_0, storageId_0, encryptionScheme_0, storageProvider_0, metadata_0, writtenAt_0, keyEnvelope_0, contentHash_0) {
854
+ __compactRuntime.assert(
855
+ _descriptor_4.fromValue(__compactRuntime.queryLedgerState(
856
+ context,
857
+ partialProofData,
858
+ [
859
+ { dup: { n: 0 } },
860
+ { idx: {
861
+ cached: false,
862
+ pushPath: false,
863
+ path: [
864
+ {
865
+ tag: "value",
866
+ value: {
867
+ value: _descriptor_11.toValue(0n),
868
+ alignment: _descriptor_11.alignment()
869
+ }
870
+ }
871
+ ]
872
+ } },
873
+ { push: {
874
+ storage: false,
875
+ value: __compactRuntime.StateValue.newCell({
876
+ value: _descriptor_0.toValue(refId_0),
877
+ alignment: _descriptor_0.alignment()
878
+ }).encode()
879
+ } },
880
+ "member",
881
+ { popeq: {
882
+ cached: true,
883
+ result: void 0
884
+ } }
885
+ ]
886
+ ).value),
887
+ "Reference not found"
888
+ );
889
+ const entry_0 = _descriptor_3.fromValue(__compactRuntime.queryLedgerState(
890
+ context,
891
+ partialProofData,
892
+ [
893
+ { dup: { n: 0 } },
894
+ { idx: {
895
+ cached: false,
896
+ pushPath: false,
897
+ path: [
898
+ {
899
+ tag: "value",
900
+ value: {
901
+ value: _descriptor_11.toValue(0n),
902
+ alignment: _descriptor_11.alignment()
903
+ }
904
+ }
905
+ ]
906
+ } },
907
+ { idx: {
908
+ cached: false,
909
+ pushPath: false,
910
+ path: [
911
+ {
912
+ tag: "value",
913
+ value: {
914
+ value: _descriptor_0.toValue(refId_0),
915
+ alignment: _descriptor_0.alignment()
916
+ }
917
+ }
918
+ ]
919
+ } },
920
+ { popeq: {
921
+ cached: false,
922
+ result: void 0
923
+ } }
924
+ ]
925
+ ).value);
926
+ const currentOwnerCommitment_0 = this._validatedOwnerCommitment_0(
927
+ context,
928
+ partialProofData,
929
+ refId_0
930
+ );
931
+ __compactRuntime.assert(
932
+ this._equal_3(
933
+ entry_0.ownerCommitment,
934
+ currentOwnerCommitment_0
935
+ ),
936
+ "Not the owner"
937
+ );
938
+ const ownerCommitment_0 = this._validatedNewOwnerCommitment_0(
939
+ context,
940
+ partialProofData,
941
+ refId_0
942
+ );
943
+ const updatedEntry_0 = {
944
+ storageId: storageId_0,
945
+ encryptionScheme: encryptionScheme_0,
946
+ storageProvider: storageProvider_0,
947
+ metadata: metadata_0,
948
+ writtenAt: writtenAt_0,
949
+ keyEnvelope: keyEnvelope_0,
950
+ ownerCommitment: ownerCommitment_0,
951
+ contentHash: contentHash_0
952
+ };
953
+ __compactRuntime.queryLedgerState(
954
+ context,
955
+ partialProofData,
956
+ [
957
+ { idx: {
958
+ cached: false,
959
+ pushPath: true,
960
+ path: [
961
+ {
962
+ tag: "value",
963
+ value: {
964
+ value: _descriptor_11.toValue(0n),
965
+ alignment: _descriptor_11.alignment()
966
+ }
967
+ }
968
+ ]
969
+ } },
970
+ { push: {
971
+ storage: false,
972
+ value: __compactRuntime.StateValue.newCell({
973
+ value: _descriptor_0.toValue(refId_0),
974
+ alignment: _descriptor_0.alignment()
975
+ }).encode()
976
+ } },
977
+ { push: {
978
+ storage: true,
979
+ value: __compactRuntime.StateValue.newCell({
980
+ value: _descriptor_3.toValue(updatedEntry_0),
981
+ alignment: _descriptor_3.alignment()
982
+ }).encode()
983
+ } },
984
+ { ins: { cached: false, n: 1 } },
985
+ { ins: { cached: true, n: 1 } }
986
+ ]
987
+ );
988
+ return [];
989
+ }
990
+ _equal_0(x0, y0) {
991
+ if (!x0.every((x, i) => y0[i] === x)) {
992
+ return false;
993
+ }
994
+ return true;
995
+ }
996
+ _equal_1(x0, y0) {
997
+ if (!x0.every((x, i) => y0[i] === x)) {
998
+ return false;
999
+ }
1000
+ return true;
1001
+ }
1002
+ _equal_2(x0, y0) {
1003
+ if (!x0.every((x, i) => y0[i] === x)) {
1004
+ return false;
1005
+ }
1006
+ return true;
1007
+ }
1008
+ _equal_3(x0, y0) {
1009
+ if (!x0.every((x, i) => y0[i] === x)) {
1010
+ return false;
1011
+ }
1012
+ return true;
1013
+ }
1014
+ };
1015
+ function ledger(stateOrChargedState) {
1016
+ const state = stateOrChargedState instanceof __compactRuntime.StateValue ? stateOrChargedState : stateOrChargedState.state;
1017
+ const chargedState = stateOrChargedState instanceof __compactRuntime.StateValue ? new __compactRuntime.ChargedState(stateOrChargedState) : stateOrChargedState;
1018
+ const context = {
1019
+ currentQueryContext: new __compactRuntime.QueryContext(chargedState, __compactRuntime.dummyContractAddress()),
1020
+ costModel: __compactRuntime.CostModel.initialCostModel()
1021
+ };
1022
+ const partialProofData = {
1023
+ input: { value: [], alignment: [] },
1024
+ output: void 0,
1025
+ publicTranscript: [],
1026
+ privateTranscriptOutputs: []
1027
+ };
1028
+ return {
1029
+ references: {
1030
+ isEmpty(...args_0) {
1031
+ if (args_0.length !== 0) {
1032
+ throw new __compactRuntime.CompactError(`isEmpty: expected 0 arguments, received ${args_0.length}`);
1033
+ }
1034
+ return _descriptor_4.fromValue(__compactRuntime.queryLedgerState(
1035
+ context,
1036
+ partialProofData,
1037
+ [
1038
+ { dup: { n: 0 } },
1039
+ { idx: {
1040
+ cached: false,
1041
+ pushPath: false,
1042
+ path: [
1043
+ {
1044
+ tag: "value",
1045
+ value: {
1046
+ value: _descriptor_11.toValue(0n),
1047
+ alignment: _descriptor_11.alignment()
1048
+ }
1049
+ }
1050
+ ]
1051
+ } },
1052
+ "size",
1053
+ { push: {
1054
+ storage: false,
1055
+ value: __compactRuntime.StateValue.newCell({
1056
+ value: _descriptor_2.toValue(0n),
1057
+ alignment: _descriptor_2.alignment()
1058
+ }).encode()
1059
+ } },
1060
+ "eq",
1061
+ { popeq: {
1062
+ cached: true,
1063
+ result: void 0
1064
+ } }
1065
+ ]
1066
+ ).value);
1067
+ },
1068
+ size(...args_0) {
1069
+ if (args_0.length !== 0) {
1070
+ throw new __compactRuntime.CompactError(`size: expected 0 arguments, received ${args_0.length}`);
1071
+ }
1072
+ return _descriptor_2.fromValue(__compactRuntime.queryLedgerState(
1073
+ context,
1074
+ partialProofData,
1075
+ [
1076
+ { dup: { n: 0 } },
1077
+ { idx: {
1078
+ cached: false,
1079
+ pushPath: false,
1080
+ path: [
1081
+ {
1082
+ tag: "value",
1083
+ value: {
1084
+ value: _descriptor_11.toValue(0n),
1085
+ alignment: _descriptor_11.alignment()
1086
+ }
1087
+ }
1088
+ ]
1089
+ } },
1090
+ "size",
1091
+ { popeq: {
1092
+ cached: true,
1093
+ result: void 0
1094
+ } }
1095
+ ]
1096
+ ).value);
1097
+ },
1098
+ member(...args_0) {
1099
+ if (args_0.length !== 1) {
1100
+ throw new __compactRuntime.CompactError(`member: expected 1 argument, received ${args_0.length}`);
1101
+ }
1102
+ const key_0 = args_0[0];
1103
+ if (!(key_0.buffer instanceof ArrayBuffer && key_0.BYTES_PER_ELEMENT === 1 && key_0.length === 32)) {
1104
+ __compactRuntime.typeError(
1105
+ "member",
1106
+ "argument 1",
1107
+ "DataRegistry.compact line 80 char 1",
1108
+ "Bytes<32>",
1109
+ key_0
1110
+ );
1111
+ }
1112
+ return _descriptor_4.fromValue(__compactRuntime.queryLedgerState(
1113
+ context,
1114
+ partialProofData,
1115
+ [
1116
+ { dup: { n: 0 } },
1117
+ { idx: {
1118
+ cached: false,
1119
+ pushPath: false,
1120
+ path: [
1121
+ {
1122
+ tag: "value",
1123
+ value: {
1124
+ value: _descriptor_11.toValue(0n),
1125
+ alignment: _descriptor_11.alignment()
1126
+ }
1127
+ }
1128
+ ]
1129
+ } },
1130
+ { push: {
1131
+ storage: false,
1132
+ value: __compactRuntime.StateValue.newCell({
1133
+ value: _descriptor_0.toValue(key_0),
1134
+ alignment: _descriptor_0.alignment()
1135
+ }).encode()
1136
+ } },
1137
+ "member",
1138
+ { popeq: {
1139
+ cached: true,
1140
+ result: void 0
1141
+ } }
1142
+ ]
1143
+ ).value);
1144
+ },
1145
+ lookup(...args_0) {
1146
+ if (args_0.length !== 1) {
1147
+ throw new __compactRuntime.CompactError(`lookup: expected 1 argument, received ${args_0.length}`);
1148
+ }
1149
+ const key_0 = args_0[0];
1150
+ if (!(key_0.buffer instanceof ArrayBuffer && key_0.BYTES_PER_ELEMENT === 1 && key_0.length === 32)) {
1151
+ __compactRuntime.typeError(
1152
+ "lookup",
1153
+ "argument 1",
1154
+ "DataRegistry.compact line 80 char 1",
1155
+ "Bytes<32>",
1156
+ key_0
1157
+ );
1158
+ }
1159
+ return _descriptor_3.fromValue(__compactRuntime.queryLedgerState(
1160
+ context,
1161
+ partialProofData,
1162
+ [
1163
+ { dup: { n: 0 } },
1164
+ { idx: {
1165
+ cached: false,
1166
+ pushPath: false,
1167
+ path: [
1168
+ {
1169
+ tag: "value",
1170
+ value: {
1171
+ value: _descriptor_11.toValue(0n),
1172
+ alignment: _descriptor_11.alignment()
1173
+ }
1174
+ }
1175
+ ]
1176
+ } },
1177
+ { idx: {
1178
+ cached: false,
1179
+ pushPath: false,
1180
+ path: [
1181
+ {
1182
+ tag: "value",
1183
+ value: {
1184
+ value: _descriptor_0.toValue(key_0),
1185
+ alignment: _descriptor_0.alignment()
1186
+ }
1187
+ }
1188
+ ]
1189
+ } },
1190
+ { popeq: {
1191
+ cached: false,
1192
+ result: void 0
1193
+ } }
1194
+ ]
1195
+ ).value);
1196
+ },
1197
+ [Symbol.iterator](...args_0) {
1198
+ if (args_0.length !== 0) {
1199
+ throw new __compactRuntime.CompactError(`iter: expected 0 arguments, received ${args_0.length}`);
1200
+ }
1201
+ const self_0 = state.asArray()[0];
1202
+ return self_0.asMap().keys().map((key) => {
1203
+ const value = self_0.asMap().get(key).asCell();
1204
+ return [_descriptor_0.fromValue(key.value), _descriptor_3.fromValue(value.value)];
1205
+ })[Symbol.iterator]();
1206
+ }
1207
+ },
1208
+ get refCounter() {
1209
+ return _descriptor_2.fromValue(__compactRuntime.queryLedgerState(
1210
+ context,
1211
+ partialProofData,
1212
+ [
1213
+ { dup: { n: 0 } },
1214
+ { idx: {
1215
+ cached: false,
1216
+ pushPath: false,
1217
+ path: [
1218
+ {
1219
+ tag: "value",
1220
+ value: {
1221
+ value: _descriptor_11.toValue(1n),
1222
+ alignment: _descriptor_11.alignment()
1223
+ }
1224
+ }
1225
+ ]
1226
+ } },
1227
+ { popeq: {
1228
+ cached: true,
1229
+ result: void 0
1230
+ } }
1231
+ ]
1232
+ ).value);
1233
+ },
1234
+ get contractVersion() {
1235
+ return _descriptor_6.fromValue(__compactRuntime.queryLedgerState(
1236
+ context,
1237
+ partialProofData,
1238
+ [
1239
+ { dup: { n: 0 } },
1240
+ { idx: {
1241
+ cached: false,
1242
+ pushPath: false,
1243
+ path: [
1244
+ {
1245
+ tag: "value",
1246
+ value: {
1247
+ value: _descriptor_11.toValue(2n),
1248
+ alignment: _descriptor_11.alignment()
1249
+ }
1250
+ }
1251
+ ]
1252
+ } },
1253
+ { popeq: {
1254
+ cached: false,
1255
+ result: void 0
1256
+ } }
1257
+ ]
1258
+ ).value);
1259
+ }
1260
+ };
1261
+ }
1262
+ var _emptyContext = {
1263
+ currentQueryContext: new __compactRuntime.QueryContext(new __compactRuntime.ContractState().data, __compactRuntime.dummyContractAddress())
1264
+ };
1265
+ var _dummyContract = new Contract({
1266
+ ownerSecret: (...args) => void 0,
1267
+ newOwnerSecret: (...args) => void 0
1268
+ });
1269
+ var pureCircuits = {
1270
+ deriveRefId: (...args_0) => {
1271
+ if (args_0.length !== 2) {
1272
+ throw new __compactRuntime.CompactError(`deriveRefId: expected 2 arguments (as invoked from Typescript), received ${args_0.length}`);
1273
+ }
1274
+ const refCounter_0 = args_0[0];
1275
+ const instanceSalt_0 = args_0[1];
1276
+ if (!(refCounter_0.buffer instanceof ArrayBuffer && refCounter_0.BYTES_PER_ELEMENT === 1 && refCounter_0.length === 32)) {
1277
+ __compactRuntime.typeError(
1278
+ "deriveRefId",
1279
+ "argument 1",
1280
+ "DataRegistry.compact line 149 char 1",
1281
+ "Bytes<32>",
1282
+ refCounter_0
1283
+ );
1284
+ }
1285
+ if (!(instanceSalt_0.buffer instanceof ArrayBuffer && instanceSalt_0.BYTES_PER_ELEMENT === 1 && instanceSalt_0.length === 32)) {
1286
+ __compactRuntime.typeError(
1287
+ "deriveRefId",
1288
+ "argument 2",
1289
+ "DataRegistry.compact line 149 char 1",
1290
+ "Bytes<32>",
1291
+ instanceSalt_0
1292
+ );
1293
+ }
1294
+ return _dummyContract._deriveRefId_0(refCounter_0, instanceSalt_0);
1295
+ }
1296
+ };
1297
+ var witnesses = {
1298
+ ownerSecret: (context) => {
1299
+ const privateState = context.privateState;
1300
+ if (!privateState.ownerSecret) {
1301
+ throw new Error(
1302
+ "[dStorage/midnight] ownerSecret is not set in private state. The SDK must call privateStateProvider.set() with ownerSecret before proof generation."
1303
+ );
1304
+ }
1305
+ return [privateState, privateState.ownerSecret];
1306
+ },
1307
+ newOwnerSecret: (context) => {
1308
+ const privateState = context.privateState;
1309
+ if (!privateState.newOwnerSecret) {
1310
+ throw new Error(
1311
+ "[dStorage/midnight] newOwnerSecret is not set in private state. The SDK must call privateStateProvider.set() with newOwnerSecret before proof generation."
1312
+ );
1313
+ }
1314
+ return [privateState, privateState.newOwnerSecret];
1315
+ }
1316
+ };
1317
+ var createDataRegistryPrivateState = () => ({});
1318
+ var CompiledDataRegistryContract = CompiledContract.make(
1319
+ "DataRegistry",
1320
+ Contract
1321
+ ).pipe(CompiledContract.withWitnesses(witnesses));
1322
+
1323
+ export {
1324
+ Contract,
1325
+ ledger,
1326
+ witnesses,
1327
+ createDataRegistryPrivateState,
1328
+ CompiledDataRegistryContract
1329
+ };