@invisi-labs/sdk 1.1.4 → 1.1.6

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 (45) hide show
  1. package/dist/{operation-types-DIazgS2d.d.cts → NoteOutput-DRkVnwlx.d.cts} +140 -17
  2. package/dist/{operation-types-D7I405FX.d.ts → NoteOutput-DpDC6T2O.d.ts} +140 -17
  3. package/dist/broadcaster-preparation-QVL62KM6.js +128 -0
  4. package/dist/broadcaster-preparation-QVL62KM6.js.map +1 -0
  5. package/dist/{chunk-BE52B32Z.js → chunk-4SD3MW6N.js} +846 -1625
  6. package/dist/chunk-4SD3MW6N.js.map +1 -0
  7. package/dist/chunk-FL4TIGWW.js +1781 -0
  8. package/dist/chunk-FL4TIGWW.js.map +1 -0
  9. package/dist/{chunk-4HMM7ZKY.js → chunk-QC6TQR3R.js} +8 -8
  10. package/dist/chunk-QC6TQR3R.js.map +1 -0
  11. package/dist/ethers.cjs +7 -7
  12. package/dist/ethers.cjs.map +1 -1
  13. package/dist/ethers.d.cts +3 -3
  14. package/dist/ethers.d.ts +3 -3
  15. package/dist/ethers.js +1 -1
  16. package/dist/index.cjs +4520 -2902
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +273 -25
  19. package/dist/index.d.ts +273 -25
  20. package/dist/index.js +459 -52
  21. package/dist/index.js.map +1 -1
  22. package/dist/indexeddb.cjs +5812 -4570
  23. package/dist/indexeddb.cjs.map +1 -1
  24. package/dist/indexeddb.d.cts +2 -2
  25. package/dist/indexeddb.d.ts +2 -2
  26. package/dist/indexeddb.js +3 -2
  27. package/dist/indexeddb.js.map +1 -1
  28. package/dist/memory.cjs +5868 -4626
  29. package/dist/memory.cjs.map +1 -1
  30. package/dist/memory.d.cts +3 -3
  31. package/dist/memory.d.ts +3 -3
  32. package/dist/memory.js +3 -2
  33. package/dist/sqlite.cjs +5812 -4570
  34. package/dist/sqlite.cjs.map +1 -1
  35. package/dist/sqlite.d.cts +2 -2
  36. package/dist/sqlite.d.ts +2 -2
  37. package/dist/sqlite.js +3 -2
  38. package/dist/sqlite.js.map +1 -1
  39. package/dist/{state-AUnz7TG7.d.cts → state-C4HZFotm.d.cts} +1 -1
  40. package/dist/{state-AUnz7TG7.d.ts → state-C4HZFotm.d.ts} +1 -1
  41. package/dist/{store-BMN8kd0c.d.ts → store-8aBhnbGr.d.ts} +1 -1
  42. package/dist/{store-Cz75STRl.d.cts → store-YrbXb6CY.d.cts} +1 -1
  43. package/package.json +5 -5
  44. package/dist/chunk-4HMM7ZKY.js.map +0 -1
  45. package/dist/chunk-BE52B32Z.js.map +0 -1
@@ -1,427 +1,53 @@
1
1
  import {
2
- EthersChainReader
3
- } from "./chunk-4HMM7ZKY.js";
4
-
5
- // src/errors.ts
6
- import { MissingCapabilityError } from "@invisi-labs/core";
7
- var InvisiError = class extends Error {
8
- code;
9
- operation;
10
- address;
11
- outputIndex;
12
- field;
13
- capability;
14
- constructor(code, message, details = {}) {
15
- super(message, { cause: details.cause });
16
- this.name = "InvisiError";
17
- this.code = code;
18
- this.operation = details.operation;
19
- this.address = details.address;
20
- this.outputIndex = details.outputIndex;
21
- this.field = details.field;
22
- this.capability = details.capability;
23
- }
24
- };
25
- async function prepareWithErrors(operation, prepare) {
26
- try {
27
- return await prepare();
28
- } catch (cause) {
29
- if (cause instanceof InvisiError) {
30
- if (cause.operation) throw cause;
31
- throw new InvisiError(cause.code, cause.message, {
32
- operation,
33
- ...cause.address === void 0 ? {} : { address: cause.address },
34
- ...cause.outputIndex === void 0 ? {} : { outputIndex: cause.outputIndex },
35
- ...cause.field === void 0 ? {} : { field: cause.field },
36
- ...cause.capability === void 0 ? {} : { capability: cause.capability },
37
- cause: cause.cause
38
- });
39
- }
40
- throw new InvisiError(
41
- cause instanceof MissingCapabilityError ? "MISSING_CAPABILITY" : "PREPARATION_FAILED",
42
- cause instanceof Error ? cause.message : "Transaction preparation failed",
43
- {
44
- operation,
45
- cause,
46
- ...cause instanceof MissingCapabilityError ? { capability: cause.capability } : {}
47
- }
48
- );
49
- }
50
- }
51
-
52
- // src/session/state.ts
53
- function creditReservationKey(commitment) {
54
- return "credit:" + commitment;
55
- }
56
- function walletBalance(state, tokenAddress) {
57
- let confirmedKnown = 0n;
58
- let reserved = 0n;
59
- let unknown = !!state.invalidated;
60
- const records = Object.values(state.notes).filter(
61
- (r) => r.note.tokenAddress === BigInt(tokenAddress)
62
- );
63
- const points = records.map((record) => record.checkedThrough);
64
- let checkedThrough = null;
65
- if (records.length && points.every((point) => point !== void 0) && records.every((record) => record.spent !== "unknown")) {
66
- checkedThrough = points.reduce(
67
- (earliest, point) => point.number < earliest.number ? point : earliest
68
- );
69
- } else if (!records.length) {
70
- checkedThrough = state.observedThrough ?? null;
71
- }
72
- if (!records.length && !checkedThrough) {
73
- unknown = true;
74
- }
75
- for (const [id, record] of Object.entries(state.notes)) {
76
- if (record.note.tokenAddress !== BigInt(tokenAddress)) continue;
77
- if (record.spent !== "spent") {
78
- confirmedKnown += record.note.amount;
79
- if (record.spent === "unknown") {
80
- unknown = true;
81
- }
82
- if (state.reservations[id]) {
83
- reserved += record.note.amount;
84
- }
85
- }
86
- }
87
- return {
88
- tokenAddress,
89
- scope: { ...state.scope },
90
- checkedThrough: state.invalidated ? null : checkedThrough ? { ...checkedThrough } : null,
91
- confirmedKnown,
92
- reserved,
93
- availableKnown: unknown ? null : confirmedKnown - reserved,
94
- invalidated: !!state.invalidated
95
- };
96
- }
97
- function walletBalances(state) {
98
- const tokens = new Set(
99
- Object.values(state.notes).map(
100
- (r) => `0x${r.note.tokenAddress.toString(16).padStart(40, "0")}`
101
- )
102
- );
103
- return [...tokens].sort().map((token) => walletBalance(state, token));
104
- }
105
-
106
- // src/session/operation-protocol.ts
107
- import { creditPeriods } from "@invisi-labs/core";
2
+ TransactionPreparation,
3
+ authorizationRequest,
4
+ configureRecipientInfrastructure,
5
+ creditLeaf,
6
+ creditReservationKey,
7
+ encodeOperation,
8
+ exportBroadcasterIntent,
9
+ fundingTypedData,
10
+ inputFacts,
11
+ operationExpired,
12
+ operationSources,
13
+ prepareWithErrors,
14
+ publicProof,
15
+ requiresAuthorization,
16
+ statement,
17
+ verifyMembership,
18
+ walletBalance,
19
+ walletBalances,
20
+ witnessFor
21
+ } from "./chunk-FL4TIGWW.js";
108
22
  import {
109
- WitnessBuilder,
110
- buildCancelCreditCalldata,
111
- buildCreateCreditCalldata,
112
- buildCreditDrawCalldata,
113
- buildShieldCalldata,
114
- buildTopUpCreditCalldata,
115
- buildTransactCalldata,
116
- cancelCreditPublicInputs,
117
- createCreditPublicInputs,
118
- creditDrawPublicInputs,
119
- encodeAggregateFundingTypedData,
120
- encodeCreateCreditFundingTypedData,
121
- encodeShieldFundingTypedData,
122
- encodeTopUpCreditFundingTypedData,
123
- encodeTransactFundingTypedData,
124
- topUpCreditPublicInputs,
125
- transactUserPublicInputs
126
- } from "@invisi-labs/protocol";
127
- function requiresAuthorization(plan) {
128
- const ownerOnlyFullWithdrawal = !plan.credit && plan.inputs.length > 0 && plan.outputs.length === 0 && plan.params !== void 0 && plan.params.outputCommitments.length === 0 && (plan.funding.amount ?? 0n) === 0n && plan.fundingMode === "none" && BigInt(plan.params.withdrawalAddress) === BigInt(plan.scope.walletIdentity) && plan.params.withdrawalAmount === plan.inputs.reduce((sum, input) => sum + input.note.amount, 0n) && plan.inputs.every((input) => input.note.walletIdentity === plan.scope.walletIdentity);
129
- if (ownerOnlyFullWithdrawal) return false;
130
- return !!plan.credit || plan.inputs.length > 0;
131
- }
132
- function inputFacts(plan) {
133
- const credit = plan.credit;
134
- const noteNullifiers = plan.params?.nullifiers ?? credit?.creation?.nullifiers ?? [];
135
- let creditNullifiers = [];
136
- if (credit?.draw) {
137
- creditNullifiers = credit.draw.nullifiers;
138
- } else if (credit?.topUp) {
139
- creditNullifiers = [credit.topUp.creditNullifier];
140
- } else if (credit?.cancel) {
141
- creditNullifiers = [credit.cancel.nullifier];
142
- }
143
- if (noteNullifiers.length !== plan.inputs.length || creditNullifiers.length !== (credit?.inputs.length ?? 0)) {
144
- throw new Error("operation input statement count mismatch");
145
- }
146
- return [
147
- ...plan.inputs.map((input, index2) => ({
148
- key: input.commitment,
149
- reservationKey: input.commitment,
150
- nullifier: noteNullifiers[index2],
151
- kind: "notes"
152
- })),
153
- ...(credit?.inputs ?? []).map((input, index2) => ({
154
- key: input.commitment + ":" + input.role,
155
- reservationKey: creditReservationKey(input.commitment),
156
- nullifier: creditNullifiers[index2],
157
- kind: "credits"
158
- }))
159
- ];
160
- }
161
- function operationSources(plan) {
162
- const noteSources = plan.params?.sources;
163
- if (noteSources != null) return noteSources;
164
- const credit = plan.credit;
165
- if (credit?.topUp) {
166
- return [...credit.topUp.creation.sources, credit.topUp.creditSource];
167
- }
168
- if (credit?.creation) return credit.creation.sources;
169
- if (credit?.draw) return credit.draw.sources;
170
- if (credit?.cancel) return [credit.cancel.source];
171
- return [];
172
- }
173
- function statement(plan) {
174
- if (!plan.statement) throw new Error("operation has no proof statement");
175
- const credit = plan.credit;
176
- let words;
177
- if (credit?.topUp) {
178
- words = topUpCreditPublicInputs(
179
- plan.context,
180
- credit.topUp,
181
- credit.deliveries,
182
- plan.funding
183
- );
184
- } else if (credit?.creation) {
185
- words = createCreditPublicInputs(
186
- plan.context,
187
- credit.creation,
188
- credit.deliveries,
189
- plan.funding
190
- );
191
- } else if (credit?.draw) {
192
- words = creditDrawPublicInputs(plan.context, credit.draw, credit.deliveries);
193
- } else if (credit?.cancel) {
194
- words = cancelCreditPublicInputs(plan.context, credit.cancel);
195
- } else {
196
- words = transactUserPublicInputs(
197
- plan.context,
198
- plan.params,
199
- plan.outputs.map((output) => output.delivery),
200
- plan.funding
201
- );
202
- }
203
- const result = WitnessBuilder.statement(
204
- plan.statement.circuitName,
205
- words,
206
- plan.statement.target
207
- );
208
- if (JSON.stringify(result) !== JSON.stringify(plan.statement)) {
209
- throw new Error("frozen operation statement changed");
210
- }
211
- return result;
212
- }
213
- function authorizationRequest(plan) {
214
- let operation = "transact";
215
- if (plan.kind === "draw-credit") {
216
- operation = "credit-draw";
217
- } else if (plan.kind === "create-credit" || plan.kind === "top-up-credit" || plan.kind === "cancel-credit") {
218
- operation = plan.kind;
219
- }
220
- return {
221
- context: {
222
- chainId: plan.context.chainId,
223
- protocolAddress: BigInt(plan.context.protocolAddress)
224
- },
225
- operation,
226
- capacity: plan.capacity,
227
- words: statement(plan).expectedPublicInputs.slice(0, -2).map(BigInt)
228
- };
229
- }
230
- async function witnessFor(protocol, plan, authorization) {
231
- const builder = new WitnessBuilder(protocol);
232
- const credit = plan.credit;
233
- if (credit) {
234
- if (!authorization) throw new Error("private Credit wallet authorization required");
235
- if (credit.topUp) {
236
- return builder.topUpCredit({
237
- params: credit.topUp,
238
- deliveries: credit.deliveries,
239
- funding: plan.funding,
240
- inputs: plan.inputs,
241
- state: credit.outputs[0].state,
242
- ...plan.outputs[0] ? { change: plan.outputs[0].note } : {},
243
- previous: credit.inputs[0],
244
- authorization
245
- });
246
- }
247
- if (credit.creation) {
248
- return builder.createCredit({
249
- params: credit.creation,
250
- deliveries: credit.deliveries,
251
- funding: plan.funding,
252
- inputs: plan.inputs,
253
- state: credit.outputs[0].state,
254
- ...plan.outputs[0] ? { change: plan.outputs[0].note } : {},
255
- authorization
256
- });
257
- }
258
- if (credit.draw) {
259
- return builder.drawCredit({
260
- timestamp: plan.preparedAt.timestamp,
261
- params: credit.draw,
262
- deliveries: credit.deliveries,
263
- inputs: credit.inputs,
264
- amounts: credit.amounts,
265
- authorization
266
- });
267
- }
268
- if (credit.cancel) {
269
- return builder.cancelCredit({
270
- params: credit.cancel,
271
- input: credit.inputs[0],
272
- authorization
273
- });
274
- }
275
- throw new Error("unsupported Credit operation");
276
- }
277
- return builder.transact({
278
- params: plan.params,
279
- deliveries: plan.outputs.map((output) => output.delivery),
280
- funding: plan.funding,
281
- inputs: plan.inputs,
282
- outputs: plan.outputs.map((output) => output.note),
283
- ...authorization ? { authorization } : {},
284
- target: plan.statement.target
285
- });
286
- }
287
- async function encodeOperation(saved) {
288
- const plan = saved.plan;
289
- const credit = plan.credit;
290
- const caller = plan.fundingMode === "caller" ? plan.funding.payer : void 0;
291
- const common = { context: plan.context, proof: saved.proof?.proofHex ?? "0x" };
292
- const funded = { ...common, funding: plan.funding, ...caller ? { caller } : {} };
293
- let encoded;
294
- if (credit?.topUp) {
295
- encoded = buildTopUpCreditCalldata({
296
- ...funded,
297
- params: credit.topUp,
298
- deliveries: credit.deliveries
299
- });
300
- } else if (credit?.creation) {
301
- encoded = buildCreateCreditCalldata({
302
- ...funded,
303
- params: credit.creation,
304
- deliveries: credit.deliveries
305
- });
306
- } else if (credit?.draw) {
307
- encoded = buildCreditDrawCalldata({
308
- ...common,
309
- params: credit.draw,
310
- deliveries: credit.deliveries
311
- });
312
- } else if (credit?.cancel) {
313
- encoded = buildCancelCreditCalldata({ ...common, params: credit.cancel });
314
- } else if (plan.kind === "shield") {
315
- encoded = await buildShieldCalldata({
316
- ...funded,
317
- params: plan.shieldParams,
318
- outputs: plan.shieldOutputs,
319
- deliveries: plan.outputs.map((output) => output.delivery)
320
- });
321
- } else {
322
- encoded = buildTransactCalldata({
323
- ...funded,
324
- params: plan.params,
325
- deliveries: plan.outputs.map((output) => output.delivery)
326
- });
327
- }
328
- return { to: plan.context.protocolAddress, data: encoded.data, value: 0n };
329
- }
330
- async function fundingTypedData(saved) {
331
- const plan = saved.plan;
332
- const credit = plan.credit;
333
- if (credit?.topUp) {
334
- return encodeTopUpCreditFundingTypedData(
335
- plan.context,
336
- credit.topUp,
337
- credit.deliveries,
338
- plan.funding
339
- );
340
- }
341
- if (credit?.creation) {
342
- return encodeCreateCreditFundingTypedData(
343
- plan.context,
344
- credit.creation,
345
- credit.deliveries,
346
- plan.funding
347
- );
348
- }
349
- if (plan.kind === "shield") {
350
- return encodeShieldFundingTypedData({
351
- context: plan.context,
352
- params: plan.shieldParams,
353
- outputs: plan.shieldOutputs,
354
- deliveries: plan.outputs.map((output) => output.delivery),
355
- funding: plan.funding
356
- });
357
- }
358
- if (plan.statement?.target === "noir-recursive") {
359
- return encodeAggregateFundingTypedData(plan.context, {
360
- params: plan.params,
361
- deliveries: plan.outputs.map((output) => output.delivery),
362
- funding: plan.funding
363
- });
364
- }
365
- return encodeTransactFundingTypedData(
366
- plan.context,
367
- saved.proof.proofHex,
368
- plan.params,
369
- plan.outputs.map((output) => output.delivery),
370
- plan.funding
371
- );
372
- }
373
- function publicProof(bundle) {
374
- return {
375
- formatVersion: bundle.formatVersion,
376
- circuitName: bundle.circuitName,
377
- target: bundle.target,
378
- bbVersion: bundle.bbVersion,
379
- artifactSha256: bundle.artifactSha256,
380
- vkSha256: bundle.vkSha256,
381
- proofHex: bundle.proofHex,
382
- proofSha256: bundle.proofSha256,
383
- publicInputs: [...bundle.publicInputs]
384
- };
385
- }
386
- function operationExpired(plan, now) {
387
- if (now > plan.deadline) return true;
388
- const credit = plan.credit;
389
- if (credit?.topUp && now >= credit.topUp.previousExpiry) return true;
390
- if (credit?.creation && now >= credit.creation.expiry) return true;
391
- if (credit?.draw) {
392
- if (credit.draw.expiries.some((expiry) => now >= expiry)) return true;
393
- const prepared = creditPeriods(plan.preparedAt.timestamp), current2 = creditPeriods(now);
394
- if (prepared.currentDay !== current2.currentDay || prepared.currentMonth !== current2.currentMonth)
395
- return true;
396
- }
397
- return false;
398
- }
23
+ EthersChainReader
24
+ } from "./chunk-QC6TQR3R.js";
399
25
 
400
26
  // src/data/gas-benchmarks.json
401
27
  var gas_benchmarks_default = [
402
28
  {
403
29
  formatVersion: 1,
404
- id: "protocol-42f2546-621cbef5f84a-prague-credit-real",
30
+ id: "protocol-044e2ee-bc51dde071f1-prague-credit-real",
405
31
  deployment: {
406
32
  chainId: "31337",
407
- protocolAddress: "0xEeD9be753bccbCB21463C49f0c56cC0E48bEcf3c",
408
- runtimeCodeHash: "0x80228a2080d224b4481fc5df24fe8ce080d4536c663b13ec7829ecf0ef46abbd",
33
+ protocolAddress: "0x8a276b1F407e1273EDFf65e2f6292ee18dA68DD9",
34
+ runtimeCodeHash: "0xf311c797d0296b13c1ef3f230bf4aadd621e38572f0c09a3f631b8edd0402ab4",
409
35
  tokenAddress: "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf"
410
36
  },
411
37
  source: {
412
- protocolCommit: "42f2546b62312e4c11e21b8e6b2ff6f72187d6a6",
413
- measuredAt: "2026-10-29T10:56:24.758Z",
38
+ protocolCommit: "044e2ee9aeb9ba0e3dbd0630247495189e0405d4",
39
+ measuredAt: "2026-11-05T09:54:05.044Z",
414
40
  chain: "Anvil 31337",
415
41
  hardfork: "prague",
416
42
  token: "MockERC20",
417
43
  verifier: "real",
418
44
  fingerprints: {
419
- protocolSourceSha256: "621cbef5f84a133ca96674a2dba39b21b5f9fbc022977d4d2ab296d9d6e685e0",
420
- dirtyDiffSha256: "eb2c41cca3802a47196181648397ec6f47fb2ba0efa8aa3800508d8d255fae3f",
421
- compiledArtifactsSha256: "c0e658d74fe49caeebf5ef9deadc1751d9e48add690f7e9ab478de7a00dab7e4",
422
- creditManifestSha256: "da819378af60471905cc902a43e464b58159e0c75bd46fb804ea9d34d8aa7ef6",
423
- userManifestSha256: "067b6c50e4bc4d9c19dd29f25352db88d189a5f49aed0ed603daa70760e699df",
424
- sdkSourceSha256: "37e1f82a447db741f46e1490b866ddf85718eab42c33d369cf5f5d2ec3a25c78"
45
+ protocolSourceSha256: "bc51dde071f1ac4616b3264305aeb2b04b52e0d13772625feed53fb5e8dae51b",
46
+ dirtyDiffSha256: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
47
+ compiledArtifactsSha256: "4900a39e94aeb31f686915bf8618efabf573b93365444db46a0bff3544741221",
48
+ creditManifestSha256: "c27ff83889c3082b4c918bd63e15437881f0a6f12ed7f130312e1140873679fb",
49
+ userManifestSha256: "9ef9d34d4459c2843d022712093216142e3eacdd1467d2382a6a68ad36c33b8f",
50
+ sdkSourceSha256: "0f2fe2deda57196d3736964c8e2caea6d4975d2c246cb6d11edbb6c4b5eeead6"
425
51
  },
426
52
  toolchain: {
427
53
  solidity: "0.8.38",
@@ -435,67 +61,67 @@ var gas_benchmarks_default = [
435
61
  runtimeContracts: {
436
62
  transact_user_slots14_direct_Verifier: {
437
63
  address: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
438
- runtimeCodeHash: "0xedab185b2b9fc7d98660db2cdc99fe30b9d1341dfe568172a1626e322d208f7e"
64
+ runtimeCodeHash: "0x42d1932097f18874242d98855b2fc167471ba84dd122ab3744996dd64320f675"
439
65
  },
440
66
  "transact_user_slots14-adapter": {
441
67
  address: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
442
- runtimeCodeHash: "0xe222cd9c142bc2b13e083e6fe66ea76c0e1e9a194715bfa57082b625c55d867f"
68
+ runtimeCodeHash: "0x876f0e43fc1d24475c0c63ee8c7907427d534b0c604f5985aacd28ee2c6d1b12"
443
69
  },
444
70
  transact_user_slots56_direct_Verifier: {
445
71
  address: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
446
- runtimeCodeHash: "0x8913eb7060f38234aca199c4a1007892f68e703de48b588c436b24faaeb23a53"
72
+ runtimeCodeHash: "0xefca4a7ee5382b0f2029571f6781f2ade7ac698906c32d3e49f10def631e7882"
447
73
  },
448
74
  "transact_user_slots56-adapter": {
449
75
  address: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
450
- runtimeCodeHash: "0x97c416d190da0b9b8111a5ee17367e8a702ba7884019bf724155ae629a783477"
76
+ runtimeCodeHash: "0x945680c4278b61c07bf07fa7637908e9a38ccd414c9330bf23b3c41119ea0de6"
451
77
  },
452
78
  transact_user_slots112_direct_Verifier: {
453
79
  address: "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
454
- runtimeCodeHash: "0x501a4791ff0c0a96465ab5e0d42d0ce763bbbb7fd8aebe21929de4d460e1b42c"
80
+ runtimeCodeHash: "0xfbf97cd940123ab3e81ce55283efb48b55ddaa95423fff4d0d648b248f4e196b"
455
81
  },
456
82
  "transact_user_slots112-adapter": {
457
83
  address: "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
458
- runtimeCodeHash: "0xf22ed8ea34a4011650a41c1b9f664b5259ea5a8d66a82d706dab9611a38c109f"
84
+ runtimeCodeHash: "0xac129aa749b7ece8c51ed68f4f0afcc82a1cbd7b2a01f5ff7ff7de1dcde21b1e"
459
85
  },
460
86
  transact_user_slots168_direct_Verifier: {
461
87
  address: "0x0165878A594ca255338adfa4d48449f69242Eb8F",
462
- runtimeCodeHash: "0xc22acdfa6f3e278ae46d194a1c50b905e4815fd7b61e39edb52334570670fdce"
88
+ runtimeCodeHash: "0x7ee9799d55001f74c8d88179dd0247b3de932516f975605ba248b52e7ba540c8"
463
89
  },
464
90
  "transact_user_slots168-adapter": {
465
91
  address: "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853",
466
- runtimeCodeHash: "0x05a318f54d93440a501b6fc6be88e4e76e89d72f1be8333553cb4a61f4f9a0d7"
92
+ runtimeCodeHash: "0x24b5ea6f436b90b3821bd0ea4872fb205c996fd74f1546bc1086d98b7ec5d87d"
467
93
  },
468
94
  transact_aggregate_14_4_Verifier: {
469
95
  address: "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6",
470
- runtimeCodeHash: "0x7a6f2bafe4c61a72a99a195e188f2f4a32900c0cc63cc132e33881d8199fd446"
96
+ runtimeCodeHash: "0xae41039ded63fa7777c99a2552ba603a3a4d9703d464079dff787dab6893ef24"
471
97
  },
472
98
  "transact_aggregate_14_4-adapter": {
473
99
  address: "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318",
474
- runtimeCodeHash: "0x15877da9940d5b8dd4868ffa92ded3b93d6092c3963ba9e18b50f1ea15d89898"
100
+ runtimeCodeHash: "0xf4e86e9b2001f5972ce00f7fcd5a01deb9bfe5d676e437e74135ee7036469ca3"
475
101
  },
476
102
  transact_aggregate_14_8_Verifier: {
477
103
  address: "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
478
- runtimeCodeHash: "0x5667d16b39973813a499375f6885a3082d7bfcd6e3c0f3548d7de3131cd285f3"
104
+ runtimeCodeHash: "0x089f476f56fb1003586b18c0b5a75f9d24c76d4804d84ea202005371eae333de"
479
105
  },
480
106
  "transact_aggregate_14_8-adapter": {
481
107
  address: "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
482
- runtimeCodeHash: "0x9d1a93c78edf7e81b4b6da10ab209b3fb009ed8355594f670559a67842d88cfc"
108
+ runtimeCodeHash: "0xc40142342902da65f45bb995724b129389e3505c283d7209a6c29bf27521c363"
483
109
  },
484
110
  transact_aggregate_14_12_Verifier: {
485
111
  address: "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0",
486
- runtimeCodeHash: "0xa4e67840a47182d4011d577981c2477bb4ab2bc36845bb136375f19f12c0800b"
112
+ runtimeCodeHash: "0xe0cba79e66fdb75dbc082ef0f938b07e4d38acce283b87869fe414083b3e08b0"
487
113
  },
488
114
  "transact_aggregate_14_12-adapter": {
489
115
  address: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
490
- runtimeCodeHash: "0x96a6e170aafc0af9d46232ba00206d950bba85e65962d43501bafb6d7f9fe61d"
116
+ runtimeCodeHash: "0x155bfc9367a6f3c96ac9b4d1dc1d0358a4046b584a9a1322a9582557ea691ff4"
491
117
  },
492
118
  create_credit_direct_Verifier: {
493
119
  address: "0x9A676e781A523b5d0C0e43731313A708CB607508",
494
- runtimeCodeHash: "0xbdc6450bf9ba01001082f345b8bd21006a4f75274f32d026cf6e14270e6d56e6"
120
+ runtimeCodeHash: "0xbc88c374cc3c0c1e2cdf8663cee4c960f3a3ba4b210e2c520ca111e56461b23a"
495
121
  },
496
122
  "create_credit-adapter": {
497
123
  address: "0x0B306BF915C4d645ff596e518fAf3F9669b97016",
498
- runtimeCodeHash: "0x3a95a22b32aef18ce053a7110056bbfbf13bb0b07932a49765ebb136528a4707"
124
+ runtimeCodeHash: "0xfd39446d56c189fbb35c0906e525433b6b9c63444c97b13990b7dd6f19bd38fc"
499
125
  },
500
126
  credit_draw_slots1_direct_Verifier: {
501
127
  address: "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
@@ -503,7 +129,7 @@ var gas_benchmarks_default = [
503
129
  },
504
130
  "credit_draw_slots1-adapter": {
505
131
  address: "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
506
- runtimeCodeHash: "0x28f25aeb97659fb9253ae67f2ff284789710bc59e1ed077ffc7a07b800cbfcc1"
132
+ runtimeCodeHash: "0x73a2af387b45cecf383b90f4cebb54b263f621a5038da947944c54f1089ba288"
507
133
  },
508
134
  credit_draw_slots12_direct_Verifier: {
509
135
  address: "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
@@ -511,7 +137,7 @@ var gas_benchmarks_default = [
511
137
  },
512
138
  "credit_draw_slots12-adapter": {
513
139
  address: "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
514
- runtimeCodeHash: "0x60d48a35279d318a0621e5f59b293f44074463b8002ce180b7e6a31b995ac195"
140
+ runtimeCodeHash: "0x63c200eae61218b865f3c8b418bf0887da7a70ebf41f55825e4750c36a1d1914"
515
141
  },
516
142
  credit_draw_slots50_direct_Verifier: {
517
143
  address: "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d",
@@ -519,7 +145,7 @@ var gas_benchmarks_default = [
519
145
  },
520
146
  "credit_draw_slots50-adapter": {
521
147
  address: "0x59b670e9fA9D0A427751Af201D676719a970857b",
522
- runtimeCodeHash: "0x468966de20e5c71cf7b6f3cda7fa7a76b5d80dc5ddf82119f441ea6a7c6c1e70"
148
+ runtimeCodeHash: "0x1716df69f1eb1c1db485bc3ba4a4ed5a1009275c9058a9e96b28ab3431a6c006"
523
149
  },
524
150
  credit_draw_slots120_direct_Verifier: {
525
151
  address: "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1",
@@ -527,79 +153,79 @@ var gas_benchmarks_default = [
527
153
  },
528
154
  "credit_draw_slots120-adapter": {
529
155
  address: "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44",
530
- runtimeCodeHash: "0xa91d585ce6037e703efb914205bf193881fde4f470d2fc63b615699b56175239"
156
+ runtimeCodeHash: "0x32d875eb4f4c27252fa958971b66e1fdff8c02adb007fea2bf31eee4b851a132"
531
157
  },
532
158
  credit_cancel_direct_Verifier: {
533
159
  address: "0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f",
534
- runtimeCodeHash: "0x182e86861a73f712071e40a6b8497b80c58c383eaa799182e7a50e39196399fd"
160
+ runtimeCodeHash: "0x4058133b7ecd31fe06749bfa3107ad0fbcdc9bf72d3b9cbf4dbd2b2f65be6d35"
535
161
  },
536
162
  "credit_cancel-adapter": {
537
163
  address: "0x4A679253410272dd5232B3Ff7cF5dbB88f295319",
538
- runtimeCodeHash: "0xea1f0f22445eed5a92c8d6990219059b7e241ad66c55a6d9ddef22a94a0f015f"
164
+ runtimeCodeHash: "0x0f570794fb4b7f15a791c59c760732d9f9408d1e3bea881ba7c5b76b36fb4e9b"
539
165
  },
540
166
  credit_top_up_direct_Verifier: {
541
167
  address: "0x7a2088a1bFc9d81c55368AE168C2C02570cB814F",
542
- runtimeCodeHash: "0xeeb42a2b6377ab305b713d1caf4ca96edb302c6d1e1007239e5c70091819c266"
168
+ runtimeCodeHash: "0x7ada3623c851a9cfba7863a75f4fa289d747040f1a822510eefecc53d70180cd"
543
169
  },
544
170
  "credit_top_up-adapter": {
545
171
  address: "0x09635F643e140090A9A8Dcd712eD6285858ceBef",
546
- runtimeCodeHash: "0xbcf35a1d0e6c16dd01b09f944889aa5917d358d986fe399a0343d06bbdedaa61"
172
+ runtimeCodeHash: "0x23bba4eca8306f4bc02ead10449775a359beeed2065ea8c84da4dc6b9e4dfc82"
547
173
  },
548
174
  PrivateTransferVerifierRegistry: {
549
175
  address: "0xc5a5C42992dECbae36851359345FE25997F5C42d",
550
- runtimeCodeHash: "0x678684af147cb42c872184b6e22c8439748139ae0c5885032941ab8832fcb142"
176
+ runtimeCodeHash: "0xbc74aacbc22d853cb50fe2041f20014e644fa8f83e06f51656b4667f1da164bc"
551
177
  },
552
178
  CrossTreeVerifierRegistry: {
553
179
  address: "0x67d269191c92Caf3cD7723F116c85e6E9bf55933",
554
- runtimeCodeHash: "0xa5ee16fc7ed9f982450e42a48365a93bfca784fa884adcb8695b557e921cb93b"
180
+ runtimeCodeHash: "0x818ce6a634a11cdd9913873d3a265254dda45b490431ad1636373237e2685ba1"
555
181
  },
556
182
  DualVerifierRouter: {
557
183
  address: "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
558
- runtimeCodeHash: "0xcc094ed6f1bcc9270c597f62b817e4fc0a54770f373320133c2836e5b07ef2cc"
184
+ runtimeCodeHash: "0xb3bdc1aa5a6e4eac85e3651615c7942c5565f0593d79bacccb19b5aa587548ca"
559
185
  },
560
186
  AtomicBatchOutputLib: {
561
187
  address: "0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690",
562
- runtimeCodeHash: "0x7c138c13e40b3ad0fee3b319d6c1580a21855cb5ecdda92571d530509d9b7316"
188
+ runtimeCodeHash: "0xef68c4a35a62fbbb4d0918f1612f0ffd9d250c9ceefd38e59e9c8ef042addb45"
563
189
  },
564
190
  FundingLib: {
565
191
  address: "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
566
- runtimeCodeHash: "0x898d13d6ec4123df85f21ee0f98678dcd9f9b9a60134f88e35c1ef1aaa0a45f9"
192
+ runtimeCodeHash: "0x36f4e6d20cf7ca1b221dad34bc34ed7b8540c0e774c594652048822272e6bb52"
567
193
  },
568
194
  PrivateTransferLib: {
569
195
  address: "0x9E545E3C0baAB3E08CdfD552C960A1050f373042",
570
- runtimeCodeHash: "0xfb18f2dd0a39af1b99ae35c25e2746cb5bc85c205e041db5f440671d84c82e5e"
196
+ runtimeCodeHash: "0x1e538d13c68b2a7a2f605466cd7c09c166b904476a6b5b372f8b9b45d9de9a62"
571
197
  },
572
198
  CrossTreeTransferLib: {
573
199
  address: "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
574
- runtimeCodeHash: "0x7b33a08f2feb9da462b951c95482cb2909796a85c0fde7cc9a6b65ff8b7ff253"
200
+ runtimeCodeHash: "0x9ec892d5a5d1c38e3218c7d38c74bd63034641cc458a195ec63c6a50f67ded25"
575
201
  },
576
202
  AggregateTransferLib: {
577
203
  address: "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8",
578
- runtimeCodeHash: "0xb3b4bd3a428f5c35712a57180f07b2249774d399ca87d4494929148ea26c5b99"
204
+ runtimeCodeHash: "0x2c01c84317448e4786e7a7b9c06f6f3b4990354f151ae6914cdb75d8b7ebe881"
579
205
  },
580
206
  CreateCreditLib: {
581
207
  address: "0x851356ae760d987E095750cCeb3bC6014560891C",
582
- runtimeCodeHash: "0xe37a4b7c129c4fba5615d25ed8b7e898e64a306c68f7e599ade911db98fe881c"
208
+ runtimeCodeHash: "0x8b28e626c6a0f41179880773a48681362a05e0eee12193d1641ae5bb625fe960"
583
209
  },
584
210
  CreditLifecycleLib: {
585
211
  address: "0xf5059a5D33d5853360D16C683c16e67980206f36",
586
- runtimeCodeHash: "0xf87a2227680efa7070071516587793e2e847c172b83261b8983c826f8a8c79bb"
212
+ runtimeCodeHash: "0xa177a7f1dfb69cf2d6eea899ef8170959587b8cb3c60559c3b2cecf62309bfc4"
587
213
  },
588
214
  ShieldLib: {
589
215
  address: "0x95401dc811bb5740090279Ba06cfA8fcF6113778",
590
- runtimeCodeHash: "0x371e57d8d324e44445a4ec30303b89a8bc98bbdbd03aeaa80faf0f821a65451d"
216
+ runtimeCodeHash: "0xfde7bbf1c02e17ab2d9fc9849fc282b29ac1db86378eec27f3a006d7484aa768"
591
217
  },
592
218
  InvisiFactory: {
593
219
  address: "0x998abeb3E57409262aE5b751f60747921B33613E",
594
- runtimeCodeHash: "0xc56e5a0b71f4a1f63576a6663efb62b17c0d7520b6885a8d3483a356e12edf9b"
220
+ runtimeCodeHash: "0x9055356390e48564adeca0065b12698a5d09451960af97ad2f5c2e450cb9c84c"
595
221
  },
596
222
  InvisiAddressRegistry: {
597
223
  address: "0x70e0bA845a1A0F2DA3359C97E0285013525FFC49",
598
224
  runtimeCodeHash: "0x007da3f4e888366ba0eed52cd511c4a369359291387ad19ca37e89eb395fce30"
599
225
  },
600
226
  InvisiProtocol: {
601
- address: "0xEeD9be753bccbCB21463C49f0c56cC0E48bEcf3c",
602
- runtimeCodeHash: "0x80228a2080d224b4481fc5df24fe8ce080d4536c663b13ec7829ecf0ef46abbd"
227
+ address: "0x8a276b1F407e1273EDFf65e2f6292ee18dA68DD9",
228
+ runtimeCodeHash: "0xf311c797d0296b13c1ef3f230bf4aadd621e38572f0c09a3f631b8edd0402ab4"
603
229
  },
604
230
  MockERC20: {
605
231
  address: "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf",
@@ -611,7 +237,7 @@ var gas_benchmarks_default = [
611
237
  "Solidity0.8.38 optimizer200 Prague; pinned BB6.0.0 real verifiers; every native proof independently verified",
612
238
  "one physical source tree and 123 existing leaves shared by every sample; top-up has two authenticated source groups; no rollover or screener",
613
239
  "funding/approvals/121 genuine Credit seeds/usage-seed draw/payout reset excluded from business gas",
614
- "each round restores identical token balances, exact caller allowance100, note cursor, nullifiers and baseline; spender payout starts zero",
240
+ "each round restores identical token balances, exact caller allowance100, note cursor, nullifiers and baseline; spender payout starts zero; broadcasterFee0",
615
241
  "complete receipt.gasUsed is measured, including verifier/calldata/logging/output insertion; memo0",
616
242
  "Prague local block gas limit500000000; measured transactions may be unmineable under lower network transaction/block limits",
617
243
  "observed three-sample ranges are neither a confidence interval nor a recommended transaction gas limit"
@@ -637,30 +263,30 @@ var gas_benchmarks_default = [
637
263
  circuit: {
638
264
  circuitName: "create_credit",
639
265
  target: "evm",
640
- artifactSha256: "3ed6cfdee4f5fd840f023580f76c208768777fea79737f2511377e5c55be0230",
641
- vkSha256: "56f663c6053be0d158a271022d200c732597efd3a2e0be48fe94549d0b1795e0"
266
+ artifactSha256: "16a41fd585d5f925e4e93fd6a308e1ca8c90ea287778871cb0d214f0d0e223ce",
267
+ vkSha256: "e8d3dc1f6922dbe1a0aa6016e65664be28d7005180ee943a4b237ac5518971bb"
642
268
  },
643
269
  samples: [
644
270
  {
645
- gasUsed: "1574696",
646
- transactionHash: "0x76112c532a1b5f24ad84fb83f91789ba4acd15ed9473ec9a0267cd5fe605448d",
271
+ gasUsed: "1577203",
272
+ transactionHash: "0xf0532b598b3e3716709ff7aab549f95775ac0587c2f7cd0203f1a07cc32b46fc",
647
273
  blockNumber: "172",
648
- blockHash: "0x0d91421e94947132a19f38ffdd76932c2d85add201de3d9189325ed3568125a7",
649
- calldataBytes: 11780
274
+ blockHash: "0x61f3ac4cb127a29dc679067666d91e3c123fda2fe8a149e46992d0581de6dbc6",
275
+ calldataBytes: 11844
650
276
  },
651
277
  {
652
- gasUsed: "1574576",
653
- transactionHash: "0x545f72d9d207329bfc69ef0d1e96470c614924d5e463d974cc001712bf619fd8",
278
+ gasUsed: "1577191",
279
+ transactionHash: "0xcd1718bea7c432458c18f4215c36fa95ad5da0242fad67f1daaa33344518ae05",
654
280
  blockNumber: "172",
655
- blockHash: "0x2053f97a2b2f3cf66e14da0ab9c1d7bd462d2d4f3ef2b13021aefcddedb71cf8",
656
- calldataBytes: 11780
281
+ blockHash: "0x08215dac6d5558f7ec753df9f66b3a03c7071b7c85b650ba170f621895ea53be",
282
+ calldataBytes: 11844
657
283
  },
658
284
  {
659
- gasUsed: "1574612",
660
- transactionHash: "0x880ec0c666068d0756fba39947dc5b211aeebb31f41bd1e1e54856b090f65d34",
285
+ gasUsed: "1577203",
286
+ transactionHash: "0xfd07f0fb37c58e302100fb533f946d8fae09514e53181666efc346313c758224",
661
287
  blockNumber: "172",
662
- blockHash: "0xbb86ed21379a917e9688a3c90364ae8fbe1ba633ac068360e0a82bf4d3113b6d",
663
- calldataBytes: 11780
288
+ blockHash: "0x5b1ac84931e9343276e5241088041bac0d07f1d7eced2b335eeccfe1a266d05d",
289
+ calldataBytes: 11844
664
290
  }
665
291
  ]
666
292
  },
@@ -683,30 +309,30 @@ var gas_benchmarks_default = [
683
309
  circuit: {
684
310
  circuitName: "create_credit",
685
311
  target: "evm",
686
- artifactSha256: "3ed6cfdee4f5fd840f023580f76c208768777fea79737f2511377e5c55be0230",
687
- vkSha256: "56f663c6053be0d158a271022d200c732597efd3a2e0be48fe94549d0b1795e0"
312
+ artifactSha256: "16a41fd585d5f925e4e93fd6a308e1ca8c90ea287778871cb0d214f0d0e223ce",
313
+ vkSha256: "e8d3dc1f6922dbe1a0aa6016e65664be28d7005180ee943a4b237ac5518971bb"
688
314
  },
689
315
  samples: [
690
316
  {
691
- gasUsed: "1671641",
692
- transactionHash: "0x24ca3f03681aeb188b48989d5eaf7dd264a8c32e828acd34ff1b44be74f17ea6",
317
+ gasUsed: "1673934",
318
+ transactionHash: "0x267c40c655eaf82407bd9dcf4413a0e3ee991a39e2bf9f28506eb761d8eaf8ea",
693
319
  blockNumber: "172",
694
- blockHash: "0xcdac07aa5d3ec187874dc1fc9be65503235289c7036ebe455feaf5161db42bb5",
695
- calldataBytes: 12132
320
+ blockHash: "0x137299123d2f9e8bae9f56f5f6e66f6020d41cc6e2397071458fb28abdc1d6b5",
321
+ calldataBytes: 12196
696
322
  },
697
323
  {
698
- gasUsed: "1671509",
699
- transactionHash: "0x31a7f69ab02effa5fdd2e02bd02fb7e715a54786813261113fd7c07a0d3ef549",
324
+ gasUsed: "1673898",
325
+ transactionHash: "0x967d376d819fb00d0d52fb28ca8b3c1fce10e7ac9ff0314772c8d367b51b2e52",
700
326
  blockNumber: "172",
701
- blockHash: "0xc78ca874aa22cc6b8ea19e12a2806ba448a0f844345450d3fedc9841ea71c3a8",
702
- calldataBytes: 12132
327
+ blockHash: "0x16992b27d6bec5d87d6f2488ea31ad232b48dc0fd2effb724e312ddf83dd84f8",
328
+ calldataBytes: 12196
703
329
  },
704
330
  {
705
- gasUsed: "1671485",
706
- transactionHash: "0xc5a30116885dcac8b3631c15847544cfeb91c46bde44c3765ac0ce42e3259157",
331
+ gasUsed: "1673994",
332
+ transactionHash: "0xd474a561f35e353f446d312aba4338011f6a1765e5019cd839498ade1b2c8ad4",
707
333
  blockNumber: "172",
708
- blockHash: "0x4a2c90ff972da4d37408567062779762efbb5790d4784d03842ee2c926c8c894",
709
- calldataBytes: 12132
334
+ blockHash: "0xdd2ff761b339b033dd11b462585cf747fdf97f6c304a66ddd1344d2421b790ae",
335
+ calldataBytes: 12196
710
336
  }
711
337
  ]
712
338
  },
@@ -734,24 +360,24 @@ var gas_benchmarks_default = [
734
360
  },
735
361
  samples: [
736
362
  {
737
- gasUsed: "1588303",
738
- transactionHash: "0x85c5180692470aa952aa13eb29ca0404d4f5b5192cb31475f90d03d78864895e",
363
+ gasUsed: "1587992",
364
+ transactionHash: "0x7eecfe45066881f2e3a39d4d016e5234793a3927056ec51e5772661a7b0b8bd2",
739
365
  blockNumber: "172",
740
- blockHash: "0xfe4876c0a2ebf05385a46562bca693b6df80da731fd9651117593916015dc38c",
366
+ blockHash: "0x4c6dd7f24673ec5e8f2bc6303827e3329f3b73d37043a638ed1bd4655282fa6a",
741
367
  calldataBytes: 11588
742
368
  },
743
369
  {
744
- gasUsed: "1588303",
745
- transactionHash: "0x61684313840623187ca1205b4b07b43a08038448524ee1a028c7e14050032682",
370
+ gasUsed: "1587992",
371
+ transactionHash: "0xb196e4ce260287d68a8ef8e072605f2cfb97e299e1ed3d8654ff33560a29a34d",
746
372
  blockNumber: "172",
747
- blockHash: "0x9726d31c10e6516e38e3f63c84fc4b9a8a161486d35e0d8d07e6829261a88fe7",
373
+ blockHash: "0x600aeaf1ca61fe7e4eb39dd8b618f696ba4b6a18a867232af62296c1fc7a24c0",
748
374
  calldataBytes: 11588
749
375
  },
750
376
  {
751
- gasUsed: "1588255",
752
- transactionHash: "0x0aa052fb8e356cc81dd73bcdae72f760937cd2e56bd4a3e8eb5878208b4f7596",
377
+ gasUsed: "1587848",
378
+ transactionHash: "0x14de44b3d363a129e8404c1e068d54098ccaf409bc0aaa142a962de94bc21825",
753
379
  blockNumber: "172",
754
- blockHash: "0x2c958cfba0627e18cd5cb47001b278628c305071929596e3335d770b92c1dc16",
380
+ blockHash: "0x5312304c773a695984e22ff3eb08c4ca6f022e6e6bc8d7706012846ce8ac4f7c",
755
381
  calldataBytes: 11588
756
382
  }
757
383
  ]
@@ -780,24 +406,24 @@ var gas_benchmarks_default = [
780
406
  },
781
407
  samples: [
782
408
  {
783
- gasUsed: "1042812",
784
- transactionHash: "0xb5d55729d975abdc92ca44c0b72e44a0d5841da8b23dc11b5bd31f46d88a341a",
409
+ gasUsed: "1043043",
410
+ transactionHash: "0xfc91b84385a2f69bc253f0f486aa171a4911edd3041647b3758b44c0102c7c2f",
785
411
  blockNumber: "172",
786
- blockHash: "0x8a6ddbe2f1630e1956485cac7984fb9cdc4fbb26b10522e158b38e2970ee4f3b",
412
+ blockHash: "0x96f83ea8e57ebf1b8572bfbcb6285b8a57c894be0e3134e0c2b24dc44262fb07",
787
413
  calldataBytes: 10372
788
414
  },
789
415
  {
790
- gasUsed: "1042824",
791
- transactionHash: "0xf64f3186fbf94fcbd9fb12426c714b4a8425599e1a7e5677866fae3d6873b7ae",
416
+ gasUsed: "1043043",
417
+ transactionHash: "0xddf613a92d05c1b80cf9074a0484fdbf3a2bfd94555b0d9c266fdfbe2661ed59",
792
418
  blockNumber: "172",
793
- blockHash: "0xd630c44d8ce96234ec836dd2178caac2a6d0bc2df5cf37df1534eb8896be48d3",
419
+ blockHash: "0x27b36ebdd105eeb91be849f002816030377ea2e892fb7e1462509aa7b8632e6f",
794
420
  calldataBytes: 10372
795
421
  },
796
422
  {
797
- gasUsed: "1042884",
798
- transactionHash: "0xdf634e809b87603a62292ef046fa5e84715561fa76ef121c768303dd779568f1",
423
+ gasUsed: "1043091",
424
+ transactionHash: "0x6df6942fafe1ef79c963b912206bd57443c90f9c8398e5529baf39d438a15b78",
799
425
  blockNumber: "172",
800
- blockHash: "0x09cad4a799360bdf825c3ad70fe374b7fe2df802f8ee37ccb7f26ffc49aa2a3a",
426
+ blockHash: "0x95af3836c6fe01edbc70bab01ba2e844d0e8fdf9e03884ea5a9d569fd585ee81",
801
427
  calldataBytes: 10372
802
428
  }
803
429
  ]
@@ -826,24 +452,24 @@ var gas_benchmarks_default = [
826
452
  },
827
453
  samples: [
828
454
  {
829
- gasUsed: "3102895",
830
- transactionHash: "0x699ba81f296f4af397a8dfaf96adf14d00d0f7dd69c0b09608641fc9b99fc28f",
455
+ gasUsed: "3099088",
456
+ transactionHash: "0x8a760b052eb9354ef7fd539ab21105ddec51feb6b4b9c51a73a139ac4f9bc1fe",
831
457
  blockNumber: "172",
832
- blockHash: "0x8d318f563f5563fa5c213617481089f75aab3a6e9d14818db107ac20a8c20ffb",
458
+ blockHash: "0x5f29a09258dbebafa6fa286c0a1d286bb54694df2e8bd7e7f0e1c9db26b53401",
833
459
  calldataBytes: 30276
834
460
  },
835
461
  {
836
- gasUsed: "3102871",
837
- transactionHash: "0xddfc1c6c505f6c54f4d9aabc96a02eb6b606182e8ad708a578eacd274d885dee",
462
+ gasUsed: "3099004",
463
+ transactionHash: "0x4af726505fdf1cdcb053d45cce369ff2a17a023b497b438206f232577f52a721",
838
464
  blockNumber: "172",
839
- blockHash: "0xcc7738fe329a608241615dc43b7d16e075eb62be202ea8aaf4ae27a5278bf438",
465
+ blockHash: "0x762f0616f93335375441b637c545c4691e7ba09fae40952a220ef00a67198a87",
840
466
  calldataBytes: 30276
841
467
  },
842
468
  {
843
- gasUsed: "3103171",
844
- transactionHash: "0x6efab6408d927e1877f1f6c33ecd285a128382f7d1dfe6e123927b035781c8aa",
469
+ gasUsed: "3099136",
470
+ transactionHash: "0xf27042c34b5e7c0e0bfc2e7c6c1e3dcd5b24c98b09c91ab73d156a2d0e474698",
845
471
  blockNumber: "172",
846
- blockHash: "0xcb4588df9ecdca0d353ccbd226e1d5d07f21e6dc93875e41cdd5f64568859f4d",
472
+ blockHash: "0xa7bde9fc7b6fe8e9a9082f4ae597f73608ad9ced3d670506b29584b2c67ab496",
847
473
  calldataBytes: 30276
848
474
  }
849
475
  ]
@@ -872,24 +498,24 @@ var gas_benchmarks_default = [
872
498
  },
873
499
  samples: [
874
500
  {
875
- gasUsed: "1536675",
876
- transactionHash: "0xc0d3eef8e6b0e90984d776a5e41bcdce1e0ca0bc6dc3a71616e4768e80c01546",
501
+ gasUsed: "1537560",
502
+ transactionHash: "0x6c78554a23c04c179a16a9da6c401f0097c02833d8e1c4a3cdeb79107c028333",
877
503
  blockNumber: "172",
878
- blockHash: "0x22dfac3d8e9913a6a1f2ff84faaece4ed59bfe1cb74e06a60131ff28cc6c2f9d",
504
+ blockHash: "0xf463ea49ed0328a93b53bc796ff2e0dd46201cd3fee06e6fff160dbb95fe0654",
879
505
  calldataBytes: 15684
880
506
  },
881
507
  {
882
- gasUsed: "1536675",
883
- transactionHash: "0x9879d86a1eaa550a6a6afaeeb0f5f07745d5dcd9caa07b660d7fb512911dc67e",
508
+ gasUsed: "1537620",
509
+ transactionHash: "0x8097a25c8c2ebced9bfa1baf39e128741e486ed5f7e23aed33ff03b280ac5a7f",
884
510
  blockNumber: "172",
885
- blockHash: "0xf88ba9f1b7a0c627338a61bbabe1c650bdfcd7fa1c56433d6853f492135b753d",
511
+ blockHash: "0xb121edc36419facbb33f4ca69021bcd71ab6f412664591edf040ac6558b44507",
886
512
  calldataBytes: 15684
887
513
  },
888
514
  {
889
- gasUsed: "1536711",
890
- transactionHash: "0xbd8f75a021a8ce8dc1900bd2d84d723acc6a64018844050a5aa2f8712cf7fd6b",
515
+ gasUsed: "1537560",
516
+ transactionHash: "0x0a8311777aa63d9239647a14da359672f126c7aa306148d6f44f19eff48dab29",
891
517
  blockNumber: "172",
892
- blockHash: "0xa55b539c2ea4e10ce9a9ee8e6de9cf1daa97263b51f32cfef8342c100b663b0f",
518
+ blockHash: "0x065a0f3dd444525a0bed28045e978e3ba74c820eda5ecc488d04e83f416ab4f0",
893
519
  calldataBytes: 15684
894
520
  }
895
521
  ]
@@ -918,24 +544,24 @@ var gas_benchmarks_default = [
918
544
  },
919
545
  samples: [
920
546
  {
921
- gasUsed: "8015473",
922
- transactionHash: "0x5dcc0fa08abaf5212424ac6f3e2f3bb8a0bd333f90ef6e421f8d3fe370ca1acf",
547
+ gasUsed: "7998858",
548
+ transactionHash: "0x35a5ff5940aa7939214f82471b8d73531c07b1fcaa543bf31b0f7c1c91db73e2",
923
549
  blockNumber: "172",
924
- blockHash: "0x3197c523dece3492226c5021f974e7c02db2e686265943d03a5550c6cb96a12e",
550
+ blockHash: "0x74175711e91a10d93a426d0ef778f12a15793ff5f8f9d8b397057e7cb4e27975",
925
551
  calldataBytes: 94276
926
552
  },
927
553
  {
928
- gasUsed: "8015449",
929
- transactionHash: "0x6a55f88551a45b3e118cde0607cfff1ef0b6ab15ad9472e838412d9ce714b42a",
554
+ gasUsed: "7998498",
555
+ transactionHash: "0x5e7a948f90e0d37a068d2904d5c1233b0ad6ecda632ef6968f4ec81daa3e932b",
930
556
  blockNumber: "172",
931
- blockHash: "0xea82c8962d45db8361bd67ed326806f21c511bd51550adc453d0c3e5cab3a7ae",
557
+ blockHash: "0x8b348e78bbce768f9b44d55c43017b08ae0720cf010b923d658e4150bc4bd41f",
932
558
  calldataBytes: 94276
933
559
  },
934
560
  {
935
- gasUsed: "8015149",
936
- transactionHash: "0x2cc8d474a92abe91f8025109a70cf1f9f081dbec43aa4a475ab9f33222cfc76b",
561
+ gasUsed: "7998498",
562
+ transactionHash: "0xf3d92e00b47c5d1c888f98c038b1dbac1986888fabbb40690762b0e9eea6b923",
937
563
  blockNumber: "172",
938
- blockHash: "0x4398f419da699ccca33867852d4975b5c461a40bb01cd5241a0e6dcacaeb78b3",
564
+ blockHash: "0x1ae727d66e31623abc741d7e5c62db4197c6238fc73a6c0984725b1dee43b9b0",
939
565
  calldataBytes: 94276
940
566
  }
941
567
  ]
@@ -964,24 +590,24 @@ var gas_benchmarks_default = [
964
590
  },
965
591
  samples: [
966
592
  {
967
- gasUsed: "3216708",
968
- transactionHash: "0x16933368d26ea1d7fbe69027c700671df832ad308944eeff42e7c2da40297b06",
593
+ gasUsed: "3220161",
594
+ transactionHash: "0xadd94db9328f43891fc6cb9c788415319c95a98bcd8b98e2a245d3ba07c1f20a",
969
595
  blockNumber: "172",
970
- blockHash: "0x0739a6f4188b8bdeae7bd5460960086d04adfea993d07d65b2b3630ad01b8cab",
596
+ blockHash: "0x257deb859f7a2c14ef38cb32797b6d0278b25ce2c7cd75ccf81f0c00a1b97250",
971
597
  calldataBytes: 33476
972
598
  },
973
599
  {
974
- gasUsed: "3216840",
975
- transactionHash: "0x45dc15a62b1661f54e167cf13b9693770370c926a8a7af959da7354e9bb4aa6e",
600
+ gasUsed: "3219933",
601
+ transactionHash: "0xe631bbd7681d42974d3b1b25f6e0c7602d32196253f6cee4dc67b5e87929132f",
976
602
  blockNumber: "172",
977
- blockHash: "0xf2e294db9af3b11814fed1dec358b8370ea28a99189211f883c9b0012349d677",
603
+ blockHash: "0xafee3915573a0316c9df0f1a56b7a4c4ff8652e74c3890f851ef351e7faedbf3",
978
604
  calldataBytes: 33476
979
605
  },
980
606
  {
981
- gasUsed: "3216744",
982
- transactionHash: "0x2c827753026ea421497534a01bcc2adaca866a7612f570dad3fcf18c660f8590",
607
+ gasUsed: "3219897",
608
+ transactionHash: "0xfb3807a266b2bfa971b87b3820b6eba6ab968f1028b1d77c9fbcb19177fb7319",
983
609
  blockNumber: "172",
984
- blockHash: "0x3ccd465528ff22e6d1955670220df3565899a16dd683f71c83c9810f2df420b4",
610
+ blockHash: "0xe6310300cca8b021fd969b27392eae58c21a9c15e071ff8836e42e6490265c0c",
985
611
  calldataBytes: 33476
986
612
  }
987
613
  ]
@@ -1010,24 +636,24 @@ var gas_benchmarks_default = [
1010
636
  },
1011
637
  samples: [
1012
638
  {
1013
- gasUsed: "17458512",
1014
- transactionHash: "0x84dd6bda5f3172a53e899051fd226dc5869edb796bd513a33e7f224bed13f4ae",
639
+ gasUsed: "17418369",
640
+ transactionHash: "0xfab5aadd357ae6105c153dcc98aee2df80a5b46bd911dab0bd457c5440c0e9bb",
1015
641
  blockNumber: "172",
1016
- blockHash: "0xfca82de1e112b92319185d8c3f0115e0aa339d0247ea65970eb0d37ba958b08e",
642
+ blockHash: "0xa277729db5ab154b10f2a0c6daa2540f66de7f81e05a289f2f057fef30e43275",
1017
643
  calldataBytes: 211140
1018
644
  },
1019
645
  {
1020
- gasUsed: "17458224",
1021
- transactionHash: "0xae26838942cf8b5499d43cb5e74681ae87aec77890a8eabddd692ff83830e013",
646
+ gasUsed: "17418537",
647
+ transactionHash: "0xa3d1311b426b88808cd9a5403ecd36c3aea806ac7e2089e6aa22eba7f82e80f6",
1022
648
  blockNumber: "172",
1023
- blockHash: "0x3e513447e0cfdbb682a95b7a719b0d300ec46b0ee22b518eaae7fb082f6436e7",
649
+ blockHash: "0x1abf2a9ae3d60f84947bce8449d3ee19e6542a14c6bb1dcde4d37c4df9ab6dfc",
1024
650
  calldataBytes: 211140
1025
651
  },
1026
652
  {
1027
- gasUsed: "17458524",
1028
- transactionHash: "0xeaa07e77fe958f4317e71b07ddb876482ae9c5172fd6d6cefaacc551dbbda7d5",
653
+ gasUsed: "17417949",
654
+ transactionHash: "0x6c7e3735c0d30d2b1897bbacd1a85d8534b714564c87449d1c66fb7b96aebf19",
1029
655
  blockNumber: "172",
1030
- blockHash: "0x12b34c1fd2e15480276052842157c2a6355acdd43d7bd01ae7511c3f39e0ecfc",
656
+ blockHash: "0x17bbc7923c075a1beaf345fbe768629d1c895a32835343640ecb5f7a48da18ab",
1031
657
  calldataBytes: 211140
1032
658
  }
1033
659
  ]
@@ -1056,24 +682,24 @@ var gas_benchmarks_default = [
1056
682
  },
1057
683
  samples: [
1058
684
  {
1059
- gasUsed: "6289576",
1060
- transactionHash: "0xbf11743f7edc5ed5ff334efc5e35634f45e48e4940d33ddd9c87d8fe444dafc5",
685
+ gasUsed: "6297541",
686
+ transactionHash: "0x0e8e80524d7c23a263ad9ed122bb61e5a1ab19285585ac402b7206d87abaf067",
1061
687
  blockNumber: "172",
1062
- blockHash: "0x774de17971107b73cab2cd20f26b60665f55a37b0cc1147166babf16743e34d5",
688
+ blockHash: "0x7ee829303eaaffc7823238e99e83304ccfd3ba349c64fecdee00b882fe39f854",
1063
689
  calldataBytes: 65220
1064
690
  },
1065
691
  {
1066
- gasUsed: "6289768",
1067
- transactionHash: "0x651bb13e0645ee8a08657db627f1072f5e964ddaff44f70f829440ed68488dea",
692
+ gasUsed: "6297661",
693
+ transactionHash: "0x98f2be383f19b1b17f86c6d365abe86655163b7846c29e5614667ab0e2823bc8",
1068
694
  blockNumber: "172",
1069
- blockHash: "0xa9795828565fb0ce65bda295073106b8bbdc110bb8317d269839d3db3e312d5b",
695
+ blockHash: "0x3738cef2d40552677299002974043a4355f37d1d76575ee52fc4fe6b6e0c33dd",
1070
696
  calldataBytes: 65220
1071
697
  },
1072
698
  {
1073
- gasUsed: "6289720",
1074
- transactionHash: "0x2a859d381cb4b50830971b1ffc9789b11569fc96147e130dae6fecd141f5ceb0",
699
+ gasUsed: "6297613",
700
+ transactionHash: "0xb574546b0aacd7d6910e25a2a749aad7f009ed725618763c6229ee7a99fd811e",
1075
701
  blockNumber: "172",
1076
- blockHash: "0x7d990830157bfeff8e5cbe580e9effe97faa7676c9957ce32891b76c83961430",
702
+ blockHash: "0x26a15b914134d2f5d5597d632328d368888f3d3076b486231345bb20a4749230",
1077
703
  calldataBytes: 65220
1078
704
  }
1079
705
  ]
@@ -1097,30 +723,30 @@ var gas_benchmarks_default = [
1097
723
  circuit: {
1098
724
  circuitName: "credit_top_up",
1099
725
  target: "evm",
1100
- artifactSha256: "2ffebd5753ec1b0c050204d4f97498765fe61ea01a793a9b2466c2f97536345c",
1101
- vkSha256: "40b02a9d2e7eb7b49daaac4b7760328537b7982fd5a225cc065bb74cd5ef44b3"
726
+ artifactSha256: "3004eea1c26ec8e33f8fc9ee171a3b6af250682efb607f7003ae58f8327998ab",
727
+ vkSha256: "b7f378a871a27649c3f7fd1af554c8f87d99bcf0780b21972e910212ed4e5a0d"
1102
728
  },
1103
729
  samples: [
1104
730
  {
1105
- gasUsed: "1711282",
1106
- transactionHash: "0x74d45084bb07bacabbced09ee6ef69d8632a22a4493be783c326c47e929ba0ed",
731
+ gasUsed: "1714625",
732
+ transactionHash: "0x5cebd593124a22bfeac5d22ea51735fedbf409f61e42abd1f398c1b907f4b192",
1107
733
  blockNumber: "172",
1108
- blockHash: "0x3503643f7081b52ae20d4754a0e9b11f52034ae48059f5b5298546c2570fa091",
1109
- calldataBytes: 12292
734
+ blockHash: "0x04b820b1ac7b4697cc16e2d29e5ba8b530906b6fa5e75da2b022b0a5851cf150",
735
+ calldataBytes: 12356
1110
736
  },
1111
737
  {
1112
- gasUsed: "1711282",
1113
- transactionHash: "0x4b5e2432d5571f6b56507b3ab995a8120560ba608959ff100f03b87873e72be6",
738
+ gasUsed: "1714697",
739
+ transactionHash: "0xd4506ce267c635552b112ee7d304d45433c34d938baf95a46241b88c33f7e57e",
1114
740
  blockNumber: "172",
1115
- blockHash: "0xca15dc309371a5aa9c7bc5bf1d65c5b325c71528ce7856ba68a118114124fccc",
1116
- calldataBytes: 12292
741
+ blockHash: "0xe7424e20b69104ccf5d407ceb8d72a8fbd3a73ea76fea15c59d8a6e9f0ff3909",
742
+ calldataBytes: 12356
1117
743
  },
1118
744
  {
1119
- gasUsed: "1711390",
1120
- transactionHash: "0x304f3740b64c80dcc5c894fb30af59080d96a11e08371096ae695cbc46ef2c8b",
745
+ gasUsed: "1714577",
746
+ transactionHash: "0xcf1af44b92f6fa4a46962ece6cbd9216db16438b0ce3320c78f62a59d8753875",
1121
747
  blockNumber: "172",
1122
- blockHash: "0x9671ed76d6b8e49a36ba229d3609289fcf70756f31277ac5fc0e3f08cd52304f",
1123
- calldataBytes: 12292
748
+ blockHash: "0x8a4e50a429190ed3f3d33c8863682d989bdf553cb5e0d961ebd9283f19b1aeea",
749
+ calldataBytes: 12356
1124
750
  }
1125
751
  ]
1126
752
  },
@@ -1143,30 +769,30 @@ var gas_benchmarks_default = [
1143
769
  circuit: {
1144
770
  circuitName: "credit_top_up",
1145
771
  target: "evm",
1146
- artifactSha256: "2ffebd5753ec1b0c050204d4f97498765fe61ea01a793a9b2466c2f97536345c",
1147
- vkSha256: "40b02a9d2e7eb7b49daaac4b7760328537b7982fd5a225cc065bb74cd5ef44b3"
772
+ artifactSha256: "3004eea1c26ec8e33f8fc9ee171a3b6af250682efb607f7003ae58f8327998ab",
773
+ vkSha256: "b7f378a871a27649c3f7fd1af554c8f87d99bcf0780b21972e910212ed4e5a0d"
1148
774
  },
1149
775
  samples: [
1150
776
  {
1151
- gasUsed: "1711318",
1152
- transactionHash: "0x65284df534b42631f8a592fb2a6efc16361a4cc122f1a8dd41418e7b950f48f1",
777
+ gasUsed: "1714697",
778
+ transactionHash: "0xa35c6efd60b27de672329ca9b8f05bb076f8d4e2505ee94a95387e097f9a967b",
1153
779
  blockNumber: "172",
1154
- blockHash: "0xf198242a1edf5b133961568c9165648c829729e7bfbbf57a1e148551c971b87c",
1155
- calldataBytes: 12292
780
+ blockHash: "0x1dd5c7d5206498ad08edcbaa5ba2002560008a6caff12383a14e3733718f0814",
781
+ calldataBytes: 12356
1156
782
  },
1157
783
  {
1158
- gasUsed: "1711438",
1159
- transactionHash: "0xcee89a81e598974798365c4ebada806fb51196ee602334b0fffdbb25da0afe25",
784
+ gasUsed: "1714637",
785
+ transactionHash: "0xf8d23c58fa9030fc891c27e45b9bd5905a8b0fe065b83803dbf0239441b64a72",
1160
786
  blockNumber: "172",
1161
- blockHash: "0xb506a6fb54cc2f91b803211ed955aac0203fba93e2428f8f52ec0d413c90af09",
1162
- calldataBytes: 12292
787
+ blockHash: "0xc30c6143900dad39d793dc13065fd9c8f1c2e4f77fd350f9a4b3c7eea930c840",
788
+ calldataBytes: 12356
1163
789
  },
1164
790
  {
1165
- gasUsed: "1711342",
1166
- transactionHash: "0x957de5c79f365c9b0510b9e125a662317494aad50cb446edceef6f678d561cc7",
791
+ gasUsed: "1714709",
792
+ transactionHash: "0xed72962263a722fcc0d8cb4218579d161dba700c490258c8b0e35a86c574b49e",
1167
793
  blockNumber: "172",
1168
- blockHash: "0xb1d5cffd6d6db58ade9d5e16d48b060b9ab2152415966dc809e7e70785472ab8",
1169
- calldataBytes: 12292
794
+ blockHash: "0x227f3f3fc06e7263168584b1e23d0f722a3255ec818570e76fd36ee4423efcfd",
795
+ calldataBytes: 12356
1170
796
  }
1171
797
  ]
1172
798
  },
@@ -1189,30 +815,30 @@ var gas_benchmarks_default = [
1189
815
  circuit: {
1190
816
  circuitName: "credit_cancel",
1191
817
  target: "evm",
1192
- artifactSha256: "b4459c2cf756d096e37291cf4d7cd129866b6d420b6d03c928f383b057112ccb",
1193
- vkSha256: "fc8ad196ef15f3328afcc8f01d867a3ebefd15451c2813948442fab1923b73b2"
818
+ artifactSha256: "6485609280fe5a3d44ca9f1865b29b44253b3d2cd49770d000e7bb7a3db8e65d",
819
+ vkSha256: "d74cf842d204cdf271c06a69482ddff11568e89630346b634d486205bec4bd9e"
1194
820
  },
1195
821
  samples: [
1196
822
  {
1197
- gasUsed: "985543",
1198
- transactionHash: "0x29ca63fbefcc5e92dbc86f67d6280993e567a5dd02ff3defd7f3251ce711865e",
823
+ gasUsed: "988734",
824
+ transactionHash: "0x6a029f228817b397197ad191ec2f4d8e17e004c5c93b58ffcf7ae0d83bb4661a",
1199
825
  blockNumber: "172",
1200
- blockHash: "0xecd7808fe9f7467af917069bd7a82ab0324e3cbab8dcad622b089d6e3eee9a58",
1201
- calldataBytes: 9540
826
+ blockHash: "0x2d0c2050a76696544b225b450634bf892e336157e5dbe41f1a821af8d0c2702e",
827
+ calldataBytes: 9604
1202
828
  },
1203
829
  {
1204
- gasUsed: "985795",
1205
- transactionHash: "0xaf8bca0769330f89b647363f99b752dbbe6fdbb8b1aae912224f6a3a59f40faa",
830
+ gasUsed: "988734",
831
+ transactionHash: "0xd9a72b12117c0a3f3905b567922ca326ae21be4447b5e85b4a7b4744be8c2046",
1206
832
  blockNumber: "172",
1207
- blockHash: "0x58e1358e02f189d57628fa7c504b87fb000fe60eb9f0a0c3c0e58dae876e64da",
1208
- calldataBytes: 9540
833
+ blockHash: "0x50f057b1b6c559b46df96c6eea7f22f40a11c39186e8869c819cdc343e56826b",
834
+ calldataBytes: 9604
1209
835
  },
1210
836
  {
1211
- gasUsed: "985711",
1212
- transactionHash: "0x2c911fd5a422f6f72f2a00b16872b7e46e182d39b8f5bfa9e3b2bf99d3155da7",
837
+ gasUsed: "988698",
838
+ transactionHash: "0x5d7aeb7e7089d3ab48d8e2bfe482d0c65caacb39779e3550118f49937f43f494",
1213
839
  blockNumber: "172",
1214
- blockHash: "0x9da571cbe63f52232261ee1527d5ed97a9e90e374b4fcda97d04feb25114d18e",
1215
- calldataBytes: 9540
840
+ blockHash: "0x58dd724ad5f1bca91a0b7bc69722f58890c02e0d205193ad2bb47960bced25d6",
841
+ calldataBytes: 9604
1216
842
  }
1217
843
  ]
1218
844
  }
@@ -1644,6 +1270,457 @@ var gas_benchmarks_default = [
1644
1270
  ]
1645
1271
  }
1646
1272
  ]
1273
+ },
1274
+ {
1275
+ formatVersion: 1,
1276
+ id: "protocol-044e2ee-bc51dde071f1-prague-credit-real-accrued-fees",
1277
+ deployment: {
1278
+ chainId: "31337",
1279
+ protocolAddress: "0x8a276b1F407e1273EDFf65e2f6292ee18dA68DD9",
1280
+ runtimeCodeHash: "0xf311c797d0296b13c1ef3f230bf4aadd621e38572f0c09a3f631b8edd0402ab4",
1281
+ tokenAddress: "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf"
1282
+ },
1283
+ source: {
1284
+ protocolCommit: "044e2ee9aeb9ba0e3dbd0630247495189e0405d4",
1285
+ measuredAt: "2026-11-05T10:18:51.134Z",
1286
+ chain: "Anvil 31337",
1287
+ hardfork: "prague",
1288
+ token: "MockERC20",
1289
+ verifier: "real",
1290
+ fingerprints: {
1291
+ protocolSourceSha256: "bc51dde071f1ac4616b3264305aeb2b04b52e0d13772625feed53fb5e8dae51b",
1292
+ dirtyDiffSha256: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
1293
+ compiledArtifactsSha256: "4900a39e94aeb31f686915bf8618efabf573b93365444db46a0bff3544741221",
1294
+ creditManifestSha256: "c27ff83889c3082b4c918bd63e15437881f0a6f12ed7f130312e1140873679fb",
1295
+ userManifestSha256: "9ef9d34d4459c2843d022712093216142e3eacdd1467d2382a6a68ad36c33b8f",
1296
+ sdkSourceSha256: "11b42d88482ab2b0ce8adf02a8fef00a667fc73e4cb5c926cd76da6181c5ce15"
1297
+ },
1298
+ toolchain: {
1299
+ solidity: "0.8.38",
1300
+ barretenberg: "6.0.0",
1301
+ noir: "1.0.0-rc.6",
1302
+ evmVersion: "prague",
1303
+ optimizerRuns: 200,
1304
+ anvil: "anvil Version: 1.8.6"
1305
+ },
1306
+ blockGasLimit: "500000000",
1307
+ runtimeContracts: {
1308
+ transact_user_slots14_direct_Verifier: {
1309
+ address: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
1310
+ runtimeCodeHash: "0x42d1932097f18874242d98855b2fc167471ba84dd122ab3744996dd64320f675"
1311
+ },
1312
+ "transact_user_slots14-adapter": {
1313
+ address: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
1314
+ runtimeCodeHash: "0x876f0e43fc1d24475c0c63ee8c7907427d534b0c604f5985aacd28ee2c6d1b12"
1315
+ },
1316
+ transact_user_slots56_direct_Verifier: {
1317
+ address: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
1318
+ runtimeCodeHash: "0xefca4a7ee5382b0f2029571f6781f2ade7ac698906c32d3e49f10def631e7882"
1319
+ },
1320
+ "transact_user_slots56-adapter": {
1321
+ address: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
1322
+ runtimeCodeHash: "0x945680c4278b61c07bf07fa7637908e9a38ccd414c9330bf23b3c41119ea0de6"
1323
+ },
1324
+ transact_user_slots112_direct_Verifier: {
1325
+ address: "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
1326
+ runtimeCodeHash: "0xfbf97cd940123ab3e81ce55283efb48b55ddaa95423fff4d0d648b248f4e196b"
1327
+ },
1328
+ "transact_user_slots112-adapter": {
1329
+ address: "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
1330
+ runtimeCodeHash: "0xac129aa749b7ece8c51ed68f4f0afcc82a1cbd7b2a01f5ff7ff7de1dcde21b1e"
1331
+ },
1332
+ transact_user_slots168_direct_Verifier: {
1333
+ address: "0x0165878A594ca255338adfa4d48449f69242Eb8F",
1334
+ runtimeCodeHash: "0x7ee9799d55001f74c8d88179dd0247b3de932516f975605ba248b52e7ba540c8"
1335
+ },
1336
+ "transact_user_slots168-adapter": {
1337
+ address: "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853",
1338
+ runtimeCodeHash: "0x24b5ea6f436b90b3821bd0ea4872fb205c996fd74f1546bc1086d98b7ec5d87d"
1339
+ },
1340
+ transact_aggregate_14_4_Verifier: {
1341
+ address: "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6",
1342
+ runtimeCodeHash: "0xae41039ded63fa7777c99a2552ba603a3a4d9703d464079dff787dab6893ef24"
1343
+ },
1344
+ "transact_aggregate_14_4-adapter": {
1345
+ address: "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318",
1346
+ runtimeCodeHash: "0xf4e86e9b2001f5972ce00f7fcd5a01deb9bfe5d676e437e74135ee7036469ca3"
1347
+ },
1348
+ transact_aggregate_14_8_Verifier: {
1349
+ address: "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
1350
+ runtimeCodeHash: "0x089f476f56fb1003586b18c0b5a75f9d24c76d4804d84ea202005371eae333de"
1351
+ },
1352
+ "transact_aggregate_14_8-adapter": {
1353
+ address: "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
1354
+ runtimeCodeHash: "0xc40142342902da65f45bb995724b129389e3505c283d7209a6c29bf27521c363"
1355
+ },
1356
+ transact_aggregate_14_12_Verifier: {
1357
+ address: "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0",
1358
+ runtimeCodeHash: "0xe0cba79e66fdb75dbc082ef0f938b07e4d38acce283b87869fe414083b3e08b0"
1359
+ },
1360
+ "transact_aggregate_14_12-adapter": {
1361
+ address: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
1362
+ runtimeCodeHash: "0x155bfc9367a6f3c96ac9b4d1dc1d0358a4046b584a9a1322a9582557ea691ff4"
1363
+ },
1364
+ create_credit_direct_Verifier: {
1365
+ address: "0x9A676e781A523b5d0C0e43731313A708CB607508",
1366
+ runtimeCodeHash: "0xbc88c374cc3c0c1e2cdf8663cee4c960f3a3ba4b210e2c520ca111e56461b23a"
1367
+ },
1368
+ "create_credit-adapter": {
1369
+ address: "0x0B306BF915C4d645ff596e518fAf3F9669b97016",
1370
+ runtimeCodeHash: "0xfd39446d56c189fbb35c0906e525433b6b9c63444c97b13990b7dd6f19bd38fc"
1371
+ },
1372
+ credit_draw_slots1_direct_Verifier: {
1373
+ address: "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
1374
+ runtimeCodeHash: "0x47be80e72c3a22ea044638f6004de8c3a0264d5a0d17189c01153cdabfd7bab6"
1375
+ },
1376
+ "credit_draw_slots1-adapter": {
1377
+ address: "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
1378
+ runtimeCodeHash: "0x73a2af387b45cecf383b90f4cebb54b263f621a5038da947944c54f1089ba288"
1379
+ },
1380
+ credit_draw_slots12_direct_Verifier: {
1381
+ address: "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
1382
+ runtimeCodeHash: "0x244d9ba22f5c736c2a5c42c466701e2a8ba7ae8108665133541026ea45d56e04"
1383
+ },
1384
+ "credit_draw_slots12-adapter": {
1385
+ address: "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
1386
+ runtimeCodeHash: "0x63c200eae61218b865f3c8b418bf0887da7a70ebf41f55825e4750c36a1d1914"
1387
+ },
1388
+ credit_draw_slots50_direct_Verifier: {
1389
+ address: "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d",
1390
+ runtimeCodeHash: "0x2ad5eb64bcfae34ef04111dd8f9c1ffc5fc8aa6c1ad3a65d8da78233f3390660"
1391
+ },
1392
+ "credit_draw_slots50-adapter": {
1393
+ address: "0x59b670e9fA9D0A427751Af201D676719a970857b",
1394
+ runtimeCodeHash: "0x1716df69f1eb1c1db485bc3ba4a4ed5a1009275c9058a9e96b28ab3431a6c006"
1395
+ },
1396
+ credit_draw_slots120_direct_Verifier: {
1397
+ address: "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1",
1398
+ runtimeCodeHash: "0x523b6d211618bbd33d708f8198b9f3daafc10e2fa7a6a857db5795ed748a24e4"
1399
+ },
1400
+ "credit_draw_slots120-adapter": {
1401
+ address: "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44",
1402
+ runtimeCodeHash: "0x32d875eb4f4c27252fa958971b66e1fdff8c02adb007fea2bf31eee4b851a132"
1403
+ },
1404
+ credit_cancel_direct_Verifier: {
1405
+ address: "0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f",
1406
+ runtimeCodeHash: "0x4058133b7ecd31fe06749bfa3107ad0fbcdc9bf72d3b9cbf4dbd2b2f65be6d35"
1407
+ },
1408
+ "credit_cancel-adapter": {
1409
+ address: "0x4A679253410272dd5232B3Ff7cF5dbB88f295319",
1410
+ runtimeCodeHash: "0x0f570794fb4b7f15a791c59c760732d9f9408d1e3bea881ba7c5b76b36fb4e9b"
1411
+ },
1412
+ credit_top_up_direct_Verifier: {
1413
+ address: "0x7a2088a1bFc9d81c55368AE168C2C02570cB814F",
1414
+ runtimeCodeHash: "0x7ada3623c851a9cfba7863a75f4fa289d747040f1a822510eefecc53d70180cd"
1415
+ },
1416
+ "credit_top_up-adapter": {
1417
+ address: "0x09635F643e140090A9A8Dcd712eD6285858ceBef",
1418
+ runtimeCodeHash: "0x23bba4eca8306f4bc02ead10449775a359beeed2065ea8c84da4dc6b9e4dfc82"
1419
+ },
1420
+ PrivateTransferVerifierRegistry: {
1421
+ address: "0xc5a5C42992dECbae36851359345FE25997F5C42d",
1422
+ runtimeCodeHash: "0xbc74aacbc22d853cb50fe2041f20014e644fa8f83e06f51656b4667f1da164bc"
1423
+ },
1424
+ CrossTreeVerifierRegistry: {
1425
+ address: "0x67d269191c92Caf3cD7723F116c85e6E9bf55933",
1426
+ runtimeCodeHash: "0x818ce6a634a11cdd9913873d3a265254dda45b490431ad1636373237e2685ba1"
1427
+ },
1428
+ DualVerifierRouter: {
1429
+ address: "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
1430
+ runtimeCodeHash: "0xb3bdc1aa5a6e4eac85e3651615c7942c5565f0593d79bacccb19b5aa587548ca"
1431
+ },
1432
+ AtomicBatchOutputLib: {
1433
+ address: "0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690",
1434
+ runtimeCodeHash: "0xef68c4a35a62fbbb4d0918f1612f0ffd9d250c9ceefd38e59e9c8ef042addb45"
1435
+ },
1436
+ FundingLib: {
1437
+ address: "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
1438
+ runtimeCodeHash: "0x36f4e6d20cf7ca1b221dad34bc34ed7b8540c0e774c594652048822272e6bb52"
1439
+ },
1440
+ PrivateTransferLib: {
1441
+ address: "0x9E545E3C0baAB3E08CdfD552C960A1050f373042",
1442
+ runtimeCodeHash: "0x1e538d13c68b2a7a2f605466cd7c09c166b904476a6b5b372f8b9b45d9de9a62"
1443
+ },
1444
+ CrossTreeTransferLib: {
1445
+ address: "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
1446
+ runtimeCodeHash: "0x9ec892d5a5d1c38e3218c7d38c74bd63034641cc458a195ec63c6a50f67ded25"
1447
+ },
1448
+ AggregateTransferLib: {
1449
+ address: "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8",
1450
+ runtimeCodeHash: "0x2c01c84317448e4786e7a7b9c06f6f3b4990354f151ae6914cdb75d8b7ebe881"
1451
+ },
1452
+ CreateCreditLib: {
1453
+ address: "0x851356ae760d987E095750cCeb3bC6014560891C",
1454
+ runtimeCodeHash: "0x8b28e626c6a0f41179880773a48681362a05e0eee12193d1641ae5bb625fe960"
1455
+ },
1456
+ CreditLifecycleLib: {
1457
+ address: "0xf5059a5D33d5853360D16C683c16e67980206f36",
1458
+ runtimeCodeHash: "0xa177a7f1dfb69cf2d6eea899ef8170959587b8cb3c60559c3b2cecf62309bfc4"
1459
+ },
1460
+ ShieldLib: {
1461
+ address: "0x95401dc811bb5740090279Ba06cfA8fcF6113778",
1462
+ runtimeCodeHash: "0xfde7bbf1c02e17ab2d9fc9849fc282b29ac1db86378eec27f3a006d7484aa768"
1463
+ },
1464
+ InvisiFactory: {
1465
+ address: "0x998abeb3E57409262aE5b751f60747921B33613E",
1466
+ runtimeCodeHash: "0x9055356390e48564adeca0065b12698a5d09451960af97ad2f5c2e450cb9c84c"
1467
+ },
1468
+ InvisiAddressRegistry: {
1469
+ address: "0x70e0bA845a1A0F2DA3359C97E0285013525FFC49",
1470
+ runtimeCodeHash: "0x007da3f4e888366ba0eed52cd511c4a369359291387ad19ca37e89eb395fce30"
1471
+ },
1472
+ InvisiProtocol: {
1473
+ address: "0x8a276b1F407e1273EDFf65e2f6292ee18dA68DD9",
1474
+ runtimeCodeHash: "0xf311c797d0296b13c1ef3f230bf4aadd621e38572f0c09a3f631b8edd0402ab4"
1475
+ },
1476
+ MockERC20: {
1477
+ address: "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf",
1478
+ runtimeCodeHash: "0xf7f676b5c54f6e94f82f0de65a0117468a0d915e8a79d150e74f76bd6d7f708b"
1479
+ }
1480
+ },
1481
+ assumptions: [
1482
+ "normal CREATE/Factory deployment and fresh registry; EIP170/EIP3860 unchanged; no code/storage injection",
1483
+ "Solidity0.8.38 optimizer200 Prague; pinned BB6.0.0 real verifiers; every native proof independently verified",
1484
+ "one physical source tree and 4 existing leaves shared by every sample; top-up has two authenticated source groups; no rollover or screener",
1485
+ "funding/approvals/2 genuine Credit seeds/usage-seed draw/payout reset excluded from business gas",
1486
+ "each round restores identical token balances, exact caller allowance105, note cursor, nullifiers and baseline; spender payout starts zero; broadcasterFee5",
1487
+ "complete receipt.gasUsed is measured, including verifier/calldata/logging/output insertion; memo0",
1488
+ "Prague local block gas limit500000000; measured transactions may be unmineable under lower network transaction/block limits",
1489
+ "observed three-sample ranges are neither a confidence interval nor a recommended transaction gas limit"
1490
+ ]
1491
+ },
1492
+ measurements: [
1493
+ {
1494
+ id: "create-credit-caller-0x0",
1495
+ shape: {
1496
+ kind: "create-credit",
1497
+ target: "evm",
1498
+ capacity: 10,
1499
+ noteInputs: 0,
1500
+ noteOutputs: 0,
1501
+ sourceTrees: 0,
1502
+ creditInputs: 0,
1503
+ creditOutputs: 1,
1504
+ creditRemainders: 0,
1505
+ funding: "caller",
1506
+ permit: false,
1507
+ deliveryBytes: 1132
1508
+ },
1509
+ circuit: {
1510
+ circuitName: "create_credit",
1511
+ target: "evm",
1512
+ artifactSha256: "16a41fd585d5f925e4e93fd6a308e1ca8c90ea287778871cb0d214f0d0e223ce",
1513
+ vkSha256: "e8d3dc1f6922dbe1a0aa6016e65664be28d7005180ee943a4b237ac5518971bb"
1514
+ },
1515
+ samples: [
1516
+ {
1517
+ gasUsed: "1591717",
1518
+ transactionHash: "0xd06c84a0fd796d0100870a9f1a17be8069677f0f304664d3670712740c8bdf62",
1519
+ blockNumber: "53",
1520
+ blockHash: "0x3d7c908964c165726e2ec0e921e61287864c7a5cb4677bd472f1d2d3b22c0d1b",
1521
+ calldataBytes: 11844
1522
+ },
1523
+ {
1524
+ gasUsed: "1591897",
1525
+ transactionHash: "0x9eb1f64a8aeffff70213ef442d8553fff10676770768b1f4ad37508cf354c11c",
1526
+ blockNumber: "53",
1527
+ blockHash: "0xe52bf98f68f306ce13761e3e985c04572d43ac09b0790db5c5217144d68c044d",
1528
+ calldataBytes: 11844
1529
+ },
1530
+ {
1531
+ gasUsed: "1591957",
1532
+ transactionHash: "0xb3ff21541b1acc1ced31459140c0016f2a5abc25a4723086e3012861d4a8f718",
1533
+ blockNumber: "53",
1534
+ blockHash: "0x681e28c2f26a020985e262c947b3732edaeeeff78f6d59d4957c188af53cfedc",
1535
+ calldataBytes: 11844
1536
+ }
1537
+ ]
1538
+ },
1539
+ {
1540
+ id: "create-credit-1x1",
1541
+ shape: {
1542
+ kind: "create-credit",
1543
+ target: "evm",
1544
+ capacity: 10,
1545
+ noteInputs: 1,
1546
+ noteOutputs: 1,
1547
+ sourceTrees: 1,
1548
+ creditInputs: 0,
1549
+ creditOutputs: 1,
1550
+ creditRemainders: 0,
1551
+ funding: "none",
1552
+ permit: false,
1553
+ deliveryBytes: 1360
1554
+ },
1555
+ circuit: {
1556
+ circuitName: "create_credit",
1557
+ target: "evm",
1558
+ artifactSha256: "16a41fd585d5f925e4e93fd6a308e1ca8c90ea287778871cb0d214f0d0e223ce",
1559
+ vkSha256: "e8d3dc1f6922dbe1a0aa6016e65664be28d7005180ee943a4b237ac5518971bb"
1560
+ },
1561
+ samples: [
1562
+ {
1563
+ gasUsed: "1631989",
1564
+ transactionHash: "0xf8acf0ee3e372c214ce5ef60d8e28b75ca3041a77d41d1e94acec78070572b5d",
1565
+ blockNumber: "53",
1566
+ blockHash: "0xd822acd15a4373e9c901579700c1f5e83810cf4a3760c99bd535196550f05676",
1567
+ calldataBytes: 12196
1568
+ },
1569
+ {
1570
+ gasUsed: "1632085",
1571
+ transactionHash: "0x5315adad09961f10a32d18b8337513347327b85475a5fccf2b700262e34660f0",
1572
+ blockNumber: "53",
1573
+ blockHash: "0xd8a5f0b8fe42d735c3e0107291afae3973e14bb8fcbff48ea3a30f65172022e8",
1574
+ calldataBytes: 12196
1575
+ },
1576
+ {
1577
+ gasUsed: "1632013",
1578
+ transactionHash: "0xbd92a3f189c9cdc991cb2843959d2d020ab3f1aeb48fdb0315147f204b9e4295",
1579
+ blockNumber: "53",
1580
+ blockHash: "0x77deffc18bfbc2cbc8e29c34b62b3be52984869cdcc73ccd245b03025d59797c",
1581
+ calldataBytes: 12196
1582
+ }
1583
+ ]
1584
+ },
1585
+ {
1586
+ id: "top-up-credit-1x1-unchanged-limits",
1587
+ shape: {
1588
+ kind: "top-up-credit",
1589
+ target: "evm",
1590
+ capacity: 10,
1591
+ noteInputs: 1,
1592
+ noteOutputs: 1,
1593
+ sourceTrees: 2,
1594
+ creditInputs: 1,
1595
+ creditOutputs: 1,
1596
+ creditRemainders: 0,
1597
+ funding: "none",
1598
+ permit: false,
1599
+ deliveryBytes: 1360
1600
+ },
1601
+ circuit: {
1602
+ circuitName: "credit_top_up",
1603
+ target: "evm",
1604
+ artifactSha256: "3004eea1c26ec8e33f8fc9ee171a3b6af250682efb607f7003ae58f8327998ab",
1605
+ vkSha256: "b7f378a871a27649c3f7fd1af554c8f87d99bcf0780b21972e910212ed4e5a0d"
1606
+ },
1607
+ samples: [
1608
+ {
1609
+ gasUsed: "1672668",
1610
+ transactionHash: "0x7a0ce3262fedebbd2b7c919f37fe0beb0b34d89a8a71223f13e9946c04131e21",
1611
+ blockNumber: "53",
1612
+ blockHash: "0x34c561de8fae1ca6230391e9dfe98187cf68bc30b51b4c7338083e4d5349dbff",
1613
+ calldataBytes: 12356
1614
+ },
1615
+ {
1616
+ gasUsed: "1672824",
1617
+ transactionHash: "0xf27e9d4e588253646168e8db8bc187e5483dbb0ddc147728c29e06f2ab397349",
1618
+ blockNumber: "53",
1619
+ blockHash: "0xae2cd77d442ba1d55b436388eeded196dcd8735152c0c56dee8830f0ddd457c9",
1620
+ calldataBytes: 12356
1621
+ },
1622
+ {
1623
+ gasUsed: "1672824",
1624
+ transactionHash: "0xd0633554a0a357d450e49fadecdfb61f39410a2b77969a445a00d7796c088f8a",
1625
+ blockNumber: "53",
1626
+ blockHash: "0x4851b2333dcb118bd2ca4c6e1332736d32d074e90096e6d144ea4d4262a01124",
1627
+ calldataBytes: 12356
1628
+ }
1629
+ ]
1630
+ },
1631
+ {
1632
+ id: "top-up-credit-1x1-changed-limits",
1633
+ shape: {
1634
+ kind: "top-up-credit",
1635
+ target: "evm",
1636
+ capacity: 10,
1637
+ noteInputs: 1,
1638
+ noteOutputs: 1,
1639
+ sourceTrees: 2,
1640
+ creditInputs: 1,
1641
+ creditOutputs: 1,
1642
+ creditRemainders: 0,
1643
+ funding: "none",
1644
+ permit: false,
1645
+ deliveryBytes: 1360
1646
+ },
1647
+ circuit: {
1648
+ circuitName: "credit_top_up",
1649
+ target: "evm",
1650
+ artifactSha256: "3004eea1c26ec8e33f8fc9ee171a3b6af250682efb607f7003ae58f8327998ab",
1651
+ vkSha256: "b7f378a871a27649c3f7fd1af554c8f87d99bcf0780b21972e910212ed4e5a0d"
1652
+ },
1653
+ samples: [
1654
+ {
1655
+ gasUsed: "1672824",
1656
+ transactionHash: "0x7dcd2f549ac253a1db6bf1956a0ae4f7116258cefa4d6468635694cc0cb310d6",
1657
+ blockNumber: "53",
1658
+ blockHash: "0x1b318287c6f265fae88233ea20e7a881723fd01f48ff86941323ad0e465f4757",
1659
+ calldataBytes: 12356
1660
+ },
1661
+ {
1662
+ gasUsed: "1672824",
1663
+ transactionHash: "0x71b6d1de440b578539ca0045c74ee688dbd9ed1971cb19d12fc9256d46d3a6bd",
1664
+ blockNumber: "53",
1665
+ blockHash: "0x4a9cf7f534d3136b7042447671dd14663bfecce06bb1d432570871de0800995f",
1666
+ calldataBytes: 12356
1667
+ },
1668
+ {
1669
+ gasUsed: "1672812",
1670
+ transactionHash: "0x781a4f563c1f9d17ec5228f49dd32942622e2090b7cefabf718e575ec1159697",
1671
+ blockNumber: "53",
1672
+ blockHash: "0xb7f060617081dd56a3a4fa723a2308ef008da493417dffe3d31b130dfb0f3e64",
1673
+ calldataBytes: 12356
1674
+ }
1675
+ ]
1676
+ },
1677
+ {
1678
+ id: "cancel-credit-1",
1679
+ shape: {
1680
+ kind: "cancel-credit",
1681
+ target: "evm",
1682
+ capacity: 1,
1683
+ noteInputs: 0,
1684
+ noteOutputs: 0,
1685
+ sourceTrees: 1,
1686
+ creditInputs: 1,
1687
+ creditOutputs: 0,
1688
+ creditRemainders: 0,
1689
+ funding: "none",
1690
+ permit: false,
1691
+ deliveryBytes: 0
1692
+ },
1693
+ circuit: {
1694
+ circuitName: "credit_cancel",
1695
+ target: "evm",
1696
+ artifactSha256: "6485609280fe5a3d44ca9f1865b29b44253b3d2cd49770d000e7bb7a3db8e65d",
1697
+ vkSha256: "d74cf842d204cdf271c06a69482ddff11568e89630346b634d486205bec4bd9e"
1698
+ },
1699
+ samples: [
1700
+ {
1701
+ gasUsed: "1013031",
1702
+ transactionHash: "0x14678b9811132c703f7593ee8e4c1dcaf478e11cf4ca06615cf432c9866b3bc3",
1703
+ blockNumber: "53",
1704
+ blockHash: "0x433f2aa3603339fcb28150f0fa6cc45f696cd04808fca1edb0798d674d6488f6",
1705
+ calldataBytes: 9604
1706
+ },
1707
+ {
1708
+ gasUsed: "1012983",
1709
+ transactionHash: "0xa4be323a92ee04c57343c79997480fd32cbb6982641c8982504337f634e5d19b",
1710
+ blockNumber: "53",
1711
+ blockHash: "0x7e283b15e8f895ddc75e93041590b0fc7ade0833405e2fa2b349b63649b244d6",
1712
+ calldataBytes: 9604
1713
+ },
1714
+ {
1715
+ gasUsed: "1013043",
1716
+ transactionHash: "0x4795ce2a29ea83ea3d44a92624fbd52ab370e6140404d94ecff0e5dee9c04e65",
1717
+ blockNumber: "53",
1718
+ blockHash: "0x90c7422c05e18142fe87c610e13eca9379055d4086019e46d4cacab875959a42",
1719
+ calldataBytes: 9604
1720
+ }
1721
+ ]
1722
+ }
1723
+ ]
1647
1724
  }
1648
1725
  ];
1649
1726
 
@@ -2052,7 +2129,7 @@ function extractDeliveryCandidates(logs, context, confirmedThrough) {
2052
2129
  check(inserted, "delivery has no matching canonical insertion");
2053
2130
  if (commitment !== void 0)
2054
2131
  check(hash(commitment) === inserted, "delivery commitment conflicts with insertion");
2055
- const delivery = normalizeOpaqueDelivery(wire);
2132
+ const delivery = normalizeOpaqueDelivery(wire, { allowEmpty: role === "funds" });
2056
2133
  check(
2057
2134
  typeof token === "string" && isAddress(token) && BigInt(token) !== 0n,
2058
2135
  "invalid event token"
@@ -2113,13 +2190,13 @@ function extractDeliveryCandidates(logs, context, confirmedThrough) {
2113
2190
  const length = Number.parseInt(packed.slice(offset, offset + 4), 16);
2114
2191
  offset += 4;
2115
2192
  check(
2116
- length >= 1 && length <= MAX_CIPHERTEXT_BYTES && offset + length * 2 + 136 <= packed.length,
2193
+ length <= MAX_CIPHERTEXT_BYTES && offset + length * 2 + (length === 0 ? 0 : 136) <= packed.length,
2117
2194
  "invalid packed delivery length"
2118
2195
  );
2119
2196
  const ciphertext = `0x${packed.slice(offset, offset + length * 2)}`;
2120
2197
  offset += length * 2;
2121
- const clue = `0x${packed.slice(offset, offset + 136)}`;
2122
- offset += 136;
2198
+ const clue = length === 0 ? "0x" : `0x${packed.slice(offset, offset + 136)}`;
2199
+ if (length !== 0) offset += 136;
2123
2200
  add(log, tree, start + i, c, "funds", { ciphertext, clue }, tokens[i]);
2124
2201
  });
2125
2202
  check(offset === packed.length, "trailing packed delivery bytes");
@@ -2148,7 +2225,7 @@ function extractDeliveryCandidates(logs, context, confirmedThrough) {
2148
2225
  }
2149
2226
  async function decryptCandidates(logs, options) {
2150
2227
  contextCheck(options.context);
2151
- decodeAddress(ReceivingAddress.fromIdentity(options.viewing.walletIdentity).toString());
2228
+ decodeAddress(ReceivingAddress.fromIdentity(options.viewing.ownerAddress).toString());
2152
2229
  check(
2153
2230
  !logs.some(
2154
2231
  (log) => log.address.toLowerCase() === options.context.protocolAddress.toLowerCase() && log.removed
@@ -2180,6 +2257,7 @@ async function decryptCandidates(logs, options) {
2180
2257
  };
2181
2258
  try {
2182
2259
  if (role === "funds") {
2260
+ if (delivery.ciphertext === "0x") continue;
2183
2261
  const note = await options.viewing.decryptNote(delivery.ciphertext, context);
2184
2262
  notes.push({ ...positionData, note });
2185
2263
  } else {
@@ -2325,7 +2403,7 @@ function scopeKey(scope) {
2325
2403
  for (const address2 of [scope.protocolAddress])
2326
2404
  if (!/^0x[0-9a-fA-F]{40}$/.test(address2) || BigInt(address2) === 0n)
2327
2405
  throw new Error("invalid scope deployment");
2328
- if (!/^0x[0-9a-fA-F]{40}$/.test(scope.walletIdentity) || BigInt(scope.walletIdentity) <= 0n || BigInt(scope.walletIdentity) >= 1n << 160n)
2406
+ if (!/^0x[0-9a-fA-F]{40}$/.test(scope.ownerAddress) || BigInt(scope.ownerAddress) <= 0n || BigInt(scope.ownerAddress) >= 1n << 160n)
2329
2407
  throw new Error("invalid scope wallet");
2330
2408
  return bytesToHex(
2331
2409
  sha256(
@@ -2334,7 +2412,7 @@ function scopeKey(scope) {
2334
2412
  scope.namespace,
2335
2413
  scope.chainId.toString(),
2336
2414
  scope.protocolAddress.toLowerCase(),
2337
- scope.walletIdentity.toLowerCase()
2415
+ scope.ownerAddress.toLowerCase()
2338
2416
  ])
2339
2417
  )
2340
2418
  )
@@ -2361,14 +2439,14 @@ function validateState(state, scope, revision) {
2361
2439
  if (!field || typeof field !== "object" || Array.isArray(field))
2362
2440
  throw new Error("invalid wallet state records");
2363
2441
  for (const record of Object.values(state.notes)) {
2364
- if (typeof record.note.tokenAddress !== "bigint" || record.note.tokenAddress <= 0n || record.note.tokenAddress >= 1n << 160n || record.note.chainId !== scope.chainId || record.note.protocolAddress !== BigInt(scope.protocolAddress) || record.note.walletIdentity.toLowerCase() !== scope.walletIdentity.toLowerCase() || typeof record.note.amount !== "bigint" || record.note.amount <= 0n || record.note.amount >= 1n << 128n)
2442
+ if (typeof record.note.tokenAddress !== "bigint" || record.note.tokenAddress <= 0n || record.note.tokenAddress >= 1n << 160n || record.note.chainId !== scope.chainId || record.note.protocolAddress !== BigInt(scope.protocolAddress) || record.note.ownerAddress.toLowerCase() !== scope.ownerAddress.toLowerCase() || typeof record.note.amount !== "bigint" || record.note.amount <= 0n || record.note.amount >= 1n << 128n)
2365
2443
  throw new Error("invalid stored note context or amount");
2366
2444
  if (!["unspent", "unknown", "spent"].includes(record.spent))
2367
2445
  throw new Error("invalid spent state");
2368
2446
  }
2369
2447
  for (const record of Object.values(state.credits)) {
2370
2448
  const note = normalizeCreditDeliveryState(record.state).note;
2371
- if (note.chainId !== scope.chainId || note.protocolAddress !== BigInt(scope.protocolAddress) || !["owner", "spender"].includes(record.role) || (record.role === "owner" ? note.ownerWalletIdentity : note.spenderWalletIdentity).toLowerCase() !== scope.walletIdentity.toLowerCase() || !["unspent", "unknown", "spent"].includes(record.spent))
2449
+ if (note.chainId !== scope.chainId || note.protocolAddress !== BigInt(scope.protocolAddress) || !["owner", "spender"].includes(record.role) || (record.role === "owner" ? note.ownerWalletIdentity : note.spenderWalletIdentity).toLowerCase() !== scope.ownerAddress.toLowerCase() || !["unspent", "unknown", "spent"].includes(record.spent))
2372
2450
  throw new Error("invalid stored Credit context or role");
2373
2451
  }
2374
2452
  for (const record of [...Object.values(state.notes), ...Object.values(state.credits)]) {
@@ -2449,11 +2527,11 @@ import { Signature, SigningKey, getBytes as getBytes2, concat, verifyTypedData }
2449
2527
  import {
2450
2528
  computeWalletAuthorizationDigest,
2451
2529
  AuthorizedStatement,
2452
- computeWalletIdentity,
2530
+ computeOwnerAddress,
2453
2531
  createSigningRequest,
2454
2532
  walletAuthorizationTypedData
2455
2533
  } from "@invisi-labs/core";
2456
- import { WitnessBuilder as WitnessBuilder2 } from "@invisi-labs/protocol";
2534
+ import { WitnessBuilder } from "@invisi-labs/protocol";
2457
2535
 
2458
2536
  // src/session/proof-integrity.ts
2459
2537
  import { getBytes } from "ethers";
@@ -2468,7 +2546,7 @@ function sameStatement(proof, expected) {
2468
2546
  "proof release/target mismatch"
2469
2547
  );
2470
2548
  check3(
2471
- proof.publicInputs.length === expected.expectedPublicInputs.length && proof.publicInputs.every((word3, i) => word3 === expected.expectedPublicInputs[i]),
2549
+ proof.publicInputs.length === expected.expectedPublicInputs.length && proof.publicInputs.every((word2, i) => word2 === expected.expectedPublicInputs[i]),
2472
2550
  "proof public statement mismatch"
2473
2551
  );
2474
2552
  check3(
@@ -2479,12 +2557,12 @@ function sameStatement(proof, expected) {
2479
2557
 
2480
2558
  // src/session/operation-execution.ts
2481
2559
  async function authorizeOperation(plan, provider) {
2482
- if (provider.walletIdentity !== plan.scope.walletIdentity)
2560
+ if (provider.ownerAddress !== plan.scope.ownerAddress)
2483
2561
  throw new Error("wallet authorization capability mismatch");
2484
2562
  const request = authorizationRequest(plan);
2485
2563
  const digest = computeWalletAuthorizationDigest(request);
2486
2564
  const signed = await provider.authorize(structuredClone(request));
2487
- if (signed.walletIdentity !== plan.scope.walletIdentity || signed.digest !== digest)
2565
+ if (signed.ownerAddress !== plan.scope.ownerAddress || signed.digest !== digest)
2488
2566
  throw new Error("wallet authorization statement mismatch");
2489
2567
  return signed;
2490
2568
  }
@@ -2501,7 +2579,7 @@ async function proveOperation(protocol, plan, authorization, prover, options) {
2501
2579
  throw new Error("aggregate execution requires a 14-slot transfer");
2502
2580
  }
2503
2581
  if (plan.kind === "transfer") {
2504
- plan.statement = WitnessBuilder2.statement(
2582
+ plan.statement = WitnessBuilder.statement(
2505
2583
  frozen.circuitName,
2506
2584
  frozen.expectedPublicInputs,
2507
2585
  execution === "aggregate" ? "noir-recursive" : "evm"
@@ -2542,11 +2620,11 @@ async function acceptWalletSignature(plan, signature) {
2542
2620
  try {
2543
2621
  const signed = Signature.from(signature);
2544
2622
  const publicKey = getBytes2(SigningKey.recoverPublicKey(digest, signed));
2545
- const owner = await computeWalletIdentity(publicKey);
2546
- if (owner.toLowerCase() !== plan.scope.walletIdentity.toLowerCase()) {
2623
+ const owner = await computeOwnerAddress(publicKey);
2624
+ if (owner.toLowerCase() !== plan.scope.ownerAddress.toLowerCase()) {
2547
2625
  throw new Error("wallet signature identity mismatch");
2548
2626
  }
2549
- return new AuthorizedStatement(plan.scope.walletIdentity, digest, {
2627
+ return new AuthorizedStatement(plan.scope.ownerAddress, digest, {
2550
2628
  public_key_x: Array.from(publicKey.slice(1, 33)),
2551
2629
  public_key_y: Array.from(publicKey.slice(33)),
2552
2630
  signature: Array.from(getBytes2(concat([signed.r, signed.s])))
@@ -2617,15 +2695,48 @@ async function verifyFundingSignature(request, payer, signature, verifier) {
2617
2695
  }
2618
2696
 
2619
2697
  // src/session/operation-preview.ts
2698
+ import { normalizeFunding } from "@invisi-labs/protocol";
2620
2699
  function operationPreview(plan, status) {
2621
2700
  const p = plan;
2701
+ const fee = p.params ?? p.shieldParams ?? p.credit?.creation ?? p.credit?.cancel;
2702
+ const funding = normalizeFunding(p.funding);
2622
2703
  return {
2623
2704
  id: p.id,
2624
2705
  kind: p.kind,
2625
2706
  status,
2626
2707
  context: { ...p.context },
2627
2708
  inputs: inputFacts(p).length,
2709
+ inputDetails: [
2710
+ ...p.inputs.map((input) => ({
2711
+ kind: "notes",
2712
+ commitment: input.commitment,
2713
+ amount: input.note.amount,
2714
+ owner: input.note.ownerAddress,
2715
+ treeId: input.treeId,
2716
+ leafIndex: input.leafIndex
2717
+ })),
2718
+ ...(p.credit?.inputs ?? []).map((input) => ({
2719
+ kind: "credits",
2720
+ commitment: input.commitment,
2721
+ amount: input.state.note.amount,
2722
+ owner: input.state.note.ownerWalletIdentity,
2723
+ spender: input.state.note.spenderWalletIdentity,
2724
+ expiry: input.state.note.expiry,
2725
+ role: input.role,
2726
+ treeId: input.treeId,
2727
+ leafIndex: input.leafIndex
2728
+ }))
2729
+ ],
2730
+ funding: {
2731
+ payer: funding.payer,
2732
+ amount: funding.amount,
2733
+ authorization: p.fundingMode,
2734
+ sigNonce: funding.sigNonce,
2735
+ deadline: funding.deadline,
2736
+ permit: { deadline: funding.permit.deadline }
2737
+ },
2628
2738
  creditOutputs: p.credit?.outputs.map((output) => ({
2739
+ commitment: output.commitment,
2629
2740
  amount: output.state.note.amount,
2630
2741
  expiry: output.state.note.expiry,
2631
2742
  owner: output.state.note.ownerWalletIdentity,
@@ -2634,15 +2745,18 @@ function operationPreview(plan, status) {
2634
2745
  spenderPayout: output.state.note.spenderPayout
2635
2746
  })),
2636
2747
  outputs: p.outputs.map((output) => ({
2748
+ commitment: output.commitment,
2637
2749
  to: output.address,
2638
- amount: output.note.amount,
2750
+ amount: output.amount,
2639
2751
  change: output.change
2640
2752
  })),
2641
2753
  capacity: p.capacity,
2642
2754
  deadline: p.deadline,
2755
+ feeRecipient: fee?.feeRecipient,
2756
+ feeAmount: fee?.feeAmount ?? 0n,
2643
2757
  fundingAmount: p.funding.amount ?? 0n,
2644
2758
  fundingPayer: p.funding.payer,
2645
- withdrawalAmount: p.params?.withdrawalAmount ?? p.credit?.draw?.totalAmount ?? p.credit?.cancel?.amount ?? 0n,
2759
+ withdrawalAmount: p.params?.withdrawalAmount ?? p.credit?.draw?.totalAmount ?? (p.credit?.cancel ? p.credit.cancel.amount - (p.credit.cancel.feeAmount ?? 0n) : void 0) ?? 0n,
2646
2760
  withdrawalAddress: p.params?.withdrawalAddress ?? p.credit?.draw?.spender ?? p.credit?.cancel?.owner,
2647
2761
  permissions: {
2648
2762
  walletAuthorization: requiresAuthorization(p),
@@ -2653,8 +2767,8 @@ function operationPreview(plan, status) {
2653
2767
  }
2654
2768
 
2655
2769
  // src/session/Operation.ts
2656
- import { MissingCapabilityError as MissingCapabilityError2 } from "@invisi-labs/core";
2657
- import { normalizeFunding } from "@invisi-labs/protocol";
2770
+ import { MissingCapabilityError } from "@invisi-labs/core";
2771
+ import { normalizeFunding as normalizeFunding2 } from "@invisi-labs/protocol";
2658
2772
 
2659
2773
  // src/session/operation-confirmation.ts
2660
2774
  import { computeCreditNullifier } from "@invisi-labs/core";
@@ -2662,7 +2776,7 @@ import { computeCreditNullifier } from "@invisi-labs/core";
2662
2776
  // src/session/aggregate-receipt.ts
2663
2777
  import { Interface as Interface2 } from "ethers";
2664
2778
  import { invisiProtocolAbi as invisiProtocolAbi2 } from "@invisi-labs/protocol/contracts";
2665
- import { buildTransactCalldata as buildTransactCalldata2 } from "@invisi-labs/protocol";
2779
+ import { buildTransactCalldata } from "@invisi-labs/protocol";
2666
2780
  var aggregateAbi = invisiProtocolAbi2.filter(
2667
2781
  (item) => item.type === "function" && item.name === "transact" && item.inputs.length === 2 && item.inputs[1]?.type === "tuple[]"
2668
2782
  );
@@ -2690,7 +2804,7 @@ function matchesAggregateTransaction(saved, transaction) {
2690
2804
  });
2691
2805
  if (decoded.name !== "transact" || !Array.isArray(requests) || ![4, 8, 12].includes(requests.length))
2692
2806
  return false;
2693
- const canonical2 = (request) => buildTransactCalldata2({
2807
+ const canonical2 = (request) => buildTransactCalldata({
2694
2808
  context: { ...plan.context, tokenAddress: request.params.token },
2695
2809
  proof: "0x00",
2696
2810
  params: request.params,
@@ -2698,7 +2812,7 @@ function matchesAggregateTransaction(saved, transaction) {
2698
2812
  funding: request.funding,
2699
2813
  caller: transaction.from
2700
2814
  }).data.toLowerCase();
2701
- const expected = buildTransactCalldata2({
2815
+ const expected = buildTransactCalldata({
2702
2816
  context: plan.context,
2703
2817
  proof: "0x00",
2704
2818
  params: plan.params,
@@ -2712,46 +2826,6 @@ function matchesAggregateTransaction(saved, transaction) {
2712
2826
  }
2713
2827
  }
2714
2828
 
2715
- // src/session/credit-values.ts
2716
- import {
2717
- computeCreditCommitment,
2718
- computeCreditSharedKeyHash
2719
- } from "@invisi-labs/core";
2720
- async function creditLeaf(state) {
2721
- const n = state.note;
2722
- return computeCreditCommitment(
2723
- n.chainId,
2724
- n.spenderWalletIdentity,
2725
- n.ownerWalletIdentity,
2726
- n.spenderPayout,
2727
- n.ownerPayout,
2728
- n.tokenAddress,
2729
- n.amount,
2730
- n.nonce,
2731
- n.expiry,
2732
- await computeCreditSharedKeyHash(n.creditSharedKey),
2733
- n
2734
- );
2735
- }
2736
-
2737
- // src/session/membership.ts
2738
- import { FIELD_MODULUS as FIELD_MODULUS2, poseidonHash } from "@invisi-labs/core";
2739
- async function verifyMembership(reader, context, block, input, proof) {
2740
- if (proof.block.hash !== block.hash || proof.block.number !== block.number || proof.leaf !== input.commitment || proof.treeId !== input.treeId || proof.leafIndex !== input.leafIndex || proof.path.length !== 16 || !Number.isInteger(input.leafIndex) || input.leafIndex < 0 || input.leafIndex >= 65536 || !await reader.isKnownRoot(context, input.treeId, proof.root, block))
2741
- throw new Error("membership context/root mismatch");
2742
- let root = BigInt(input.commitment);
2743
- for (let i = 0; i < 16; i++) {
2744
- const sibling = proof.path[i];
2745
- if (typeof sibling !== "bigint" || sibling < 0n || sibling >= FIELD_MODULUS2)
2746
- throw new Error("noncanonical membership path");
2747
- root = BigInt(
2748
- await poseidonHash(input.leafIndex >> i & 1 ? [sibling, root] : [root, sibling])
2749
- );
2750
- }
2751
- if (root !== BigInt(proof.root))
2752
- throw new Error("membership path does not produce canonical root");
2753
- }
2754
-
2755
2829
  // src/session/receipts.ts
2756
2830
  function canonical(value) {
2757
2831
  return JSON.stringify(value, (_, item) => {
@@ -2975,7 +3049,7 @@ async function confirmOperation(runtime, id, generation, hash2, signal) {
2975
3049
  (value) => value.role === "funds" && value.commitment === output.commitment
2976
3050
  );
2977
3051
  check4(candidate, "confirmed output is missing from canonical receipt");
2978
- if (output.note.walletIdentity !== scope.walletIdentity) {
3052
+ if (!output.note || output.note.ownerAddress !== scope.ownerAddress) {
2979
3053
  continue;
2980
3054
  }
2981
3055
  const input = {
@@ -2999,7 +3073,7 @@ async function confirmOperation(runtime, id, generation, hash2, signal) {
2999
3073
  for (const output of plan.credit?.outputs ?? []) {
3000
3074
  const n = output.state.note;
3001
3075
  for (const role of ["owner", "spender"]) {
3002
- if ((role === "owner" ? n.ownerWalletIdentity : n.spenderWalletIdentity) !== scope.walletIdentity) {
3076
+ if ((role === "owner" ? n.ownerWalletIdentity : n.spenderWalletIdentity) !== scope.ownerAddress) {
3003
3077
  continue;
3004
3078
  }
3005
3079
  const candidate = candidates.find(
@@ -3265,11 +3339,72 @@ var Operation = class _Operation {
3265
3339
  if (result.#saved.call) {
3266
3340
  const expected = await result.encode(result.#saved);
3267
3341
  check5(
3268
- expected.to === result.#saved.call.to && expected.value === result.#saved.call.value && expected.data === result.#saved.call.data,
3269
- "recovered transaction differs from frozen operation"
3342
+ expected.to === result.#saved.call.to && expected.value === result.#saved.call.value && expected.data === result.#saved.call.data,
3343
+ "recovered transaction differs from frozen operation"
3344
+ );
3345
+ }
3346
+ return result;
3347
+ }
3348
+ /** Public non-sendable intent for a firm quote before wallet authorization. */
3349
+ async exportBroadcasterIntent() {
3350
+ check5(
3351
+ ["prepared", "authorized"].includes(this.status),
3352
+ "quote intent requires a prepared operation"
3353
+ );
3354
+ return exportBroadcasterIntent(this.#saved.plan);
3355
+ }
3356
+ broadcasterQuote() {
3357
+ return this.#saved.broadcasterQuote ? structuredClone(this.#saved.broadcasterQuote) : void 0;
3358
+ }
3359
+ async withBroadcaster(client, options) {
3360
+ check5(this.status === "prepared", "broadcaster must attach before signing");
3361
+ const { prepareIntent, prepareBroadcasterPlan } = await import("./broadcaster-preparation-QVL62KM6.js");
3362
+ const runtime = this.#runtime;
3363
+ const reprepare = (intent) => prepareIntent(
3364
+ {
3365
+ options: runtime.options,
3366
+ scope: runtime.scope,
3367
+ reader: runtime.reader,
3368
+ readInventory: async () => {
3369
+ const state = await runtime.store.readSnapshot(runtime.scope);
3370
+ for (const [key, owner] of Object.entries(state.reservations))
3371
+ if (owner === this.id) delete state.reservations[key];
3372
+ return state;
3373
+ },
3374
+ complete: async (plan) => plan
3375
+ },
3376
+ intent
3377
+ );
3378
+ const selected = await prepareBroadcasterPlan(this.#saved.plan, reprepare, client, options);
3379
+ const saved = await runtime.store.transaction(runtime.scope, (state) => {
3380
+ const record = state.operations[this.id];
3381
+ const old = record?.payload;
3382
+ check5(
3383
+ record?.status === "prepared" && old?.generation === this.#saved.generation && !old.claim && !old.externalized,
3384
+ "stale operation or active worker"
3270
3385
  );
3271
- }
3272
- return result;
3386
+ check5(!state.invalidated, "wallet state requires canonical resync");
3387
+ const nextPlan = { ...selected.plan, id: this.id };
3388
+ const facts = inputFacts(nextPlan);
3389
+ for (const fact of facts)
3390
+ check5(
3391
+ state[fact.kind][fact.key]?.spent === "unspent" && (!state.reservations[fact.reservationKey] || state.reservations[fact.reservationKey] === this.id),
3392
+ "input unavailable or already reserved"
3393
+ );
3394
+ for (const [key, owner] of Object.entries(state.reservations))
3395
+ if (owner === this.id) delete state.reservations[key];
3396
+ for (const fact of facts) state.reservations[fact.reservationKey] = this.id;
3397
+ const next = {
3398
+ plan: nextPlan,
3399
+ broadcasterQuote: selected.quote,
3400
+ generation: old.generation + 1
3401
+ };
3402
+ record.payload = next;
3403
+ record.inputs = facts.map((fact) => fact.reservationKey);
3404
+ record.deadline = nextPlan.deadline;
3405
+ return structuredClone(next);
3406
+ });
3407
+ return new _Operation(runtime, saved, "prepared");
3273
3408
  }
3274
3409
  get id() {
3275
3410
  return this.#saved.plan.id;
@@ -3422,7 +3557,7 @@ var Operation = class _Operation {
3422
3557
  );
3423
3558
  const provider = this.#runtime.authorization();
3424
3559
  check5(
3425
- provider.walletIdentity === this.#runtime.scope.walletIdentity,
3560
+ provider.ownerAddress === this.#runtime.scope.ownerAddress,
3426
3561
  "wallet authorization capability mismatch"
3427
3562
  );
3428
3563
  return this.stage(
@@ -3437,6 +3572,10 @@ var Operation = class _Operation {
3437
3572
  }
3438
3573
  async prove(suppliedOptions = {}) {
3439
3574
  const options = { ...suppliedOptions };
3575
+ check5(
3576
+ !this.#saved.broadcasterQuote || options.execution !== "aggregate",
3577
+ "a broadcaster quote requires direct execution"
3578
+ );
3440
3579
  const plan = this.#saved.plan;
3441
3580
  check5(plan.kind !== "shield", "shield requires no proof");
3442
3581
  if (requiresAuthorization(plan)) {
@@ -3447,7 +3586,7 @@ var Operation = class _Operation {
3447
3586
  }
3448
3587
  const prover = this.#runtime.options.prover;
3449
3588
  if (!prover) {
3450
- throw new MissingCapabilityError2("prover");
3589
+ throw new MissingCapabilityError("prover");
3451
3590
  }
3452
3591
  return this.stage(
3453
3592
  "proof",
@@ -3481,7 +3620,7 @@ var Operation = class _Operation {
3481
3620
  check5(p.kind === "shield" || this.#saved.proof, "proof must precede funding authorization");
3482
3621
  const signer = this.#runtime.options.fundingSigner;
3483
3622
  if (!signer) {
3484
- throw new MissingCapabilityError2("EVM funding signer");
3623
+ throw new MissingCapabilityError("EVM funding signer");
3485
3624
  }
3486
3625
  check5(
3487
3626
  signer.address.toLowerCase() === p.funding.payer.toLowerCase(),
@@ -3583,7 +3722,7 @@ var Operation = class _Operation {
3583
3722
  request: {
3584
3723
  params: structuredClone(plan.params),
3585
3724
  deliveries: plan.outputs.map((output) => structuredClone(output.delivery)),
3586
- funding: normalizeFunding(plan.funding)
3725
+ funding: normalizeFunding2(plan.funding)
3587
3726
  }
3588
3727
  };
3589
3728
  });
@@ -3689,10 +3828,10 @@ function walletHistory(state, options = {}) {
3689
3828
  ...record.transactionHash ? { transactionHash: record.transactionHash } : {},
3690
3829
  outputs: plan.outputs.map((output) => ({
3691
3830
  to: output.address,
3692
- amount: output.note.amount,
3831
+ amount: output.amount,
3693
3832
  change: output.change,
3694
3833
  commitment: output.commitment,
3695
- payload: Uint8Array.from(output.note.payload ?? [])
3834
+ payload: Uint8Array.from(output.note?.payload ?? [])
3696
3835
  }))
3697
3836
  });
3698
3837
  }
@@ -3729,938 +3868,20 @@ function walletHistory(state, options = {}) {
3729
3868
  }
3730
3869
 
3731
3870
  // src/session/WalletSession.ts
3732
- import { getAddress as getAddress4 } from "ethers";
3733
- import { MissingCapabilityError as MissingCapabilityError5 } from "@invisi-labs/core";
3734
-
3735
- // src/session/transaction-preparation.ts
3736
- import { getAddress as getAddress3 } from "ethers";
3737
- import {
3738
- normalizeTransactRequest,
3739
- transactUserPublicInputs as transactUserPublicInputs2,
3740
- WitnessBuilder as WitnessBuilder4,
3741
- ZERO_ADDRESS
3742
- } from "@invisi-labs/protocol";
3743
-
3744
- // src/resolve-recipient.ts
3745
- import {
3746
- MissingCapabilityError as MissingCapabilityError3,
3747
- ReceivingAddress as ReceivingAddress2
3748
- } from "@invisi-labs/core";
3749
- async function resolveRecipient(address2, lookup, details = {}) {
3750
- const context = { ...details, address: address2 };
3751
- let recipient;
3752
- try {
3753
- recipient = ReceivingAddress2.parse(address2);
3754
- } catch (cause) {
3755
- throw new InvisiError("INVALID_RECIPIENT", "Invalid recipient address", {
3756
- ...context,
3757
- cause
3758
- });
3759
- }
3760
- if (recipient.kind === "long") return recipient;
3761
- if (!lookup) {
3762
- throw new InvisiError("MISSING_CAPABILITY", "Missing registry lookup capability", {
3763
- ...context,
3764
- capability: "registry lookup"
3765
- });
3766
- }
3767
- let keys;
3768
- try {
3769
- keys = await lookup(recipient.walletIdentity);
3770
- } catch (cause) {
3771
- if (cause instanceof MissingCapabilityError3) {
3772
- throw new InvisiError("MISSING_CAPABILITY", cause.message, {
3773
- ...context,
3774
- cause,
3775
- capability: cause.capability
3776
- });
3777
- }
3778
- throw new InvisiError("RECIPIENT_LOOKUP_FAILED", "Recipient registry lookup failed", {
3779
- ...context,
3780
- cause
3781
- });
3782
- }
3783
- if (keys == null) {
3784
- throw new InvisiError(
3785
- "EVM_ADDRESS_NOT_REGISTERED",
3786
- "EVM address has no registered receiving keys",
3787
- context
3788
- );
3789
- }
3790
- try {
3791
- return ReceivingAddress2.from({
3792
- walletIdentity: recipient.walletIdentity,
3793
- viewingPublicKey: keys.viewingPublicKey,
3794
- clueKey: keys.clueKey
3795
- });
3796
- } catch (cause) {
3797
- throw new InvisiError(
3798
- "RECIPIENT_LOOKUP_FAILED",
3799
- "Registry returned invalid receiving keys",
3800
- { ...context, cause }
3801
- );
3802
- }
3803
- }
3804
-
3805
- // src/session/prepare-common.ts
3806
- import { getAddress, hexlify } from "ethers";
3807
- import {
3808
- MissingCapabilityError as MissingCapabilityError4,
3809
- computeNoteCommitment,
3810
- computeNoteIdentity,
3811
- createClue,
3812
- encryptPrivateTransferNote,
3813
- generateNonce
3814
- } from "@invisi-labs/core";
3815
- import {
3816
- normalizeFunding as normalizeFunding2
3817
- } from "@invisi-labs/protocol";
3818
-
3819
- // src/session/selection.ts
3820
- function selectNotes(notes, target, reserved) {
3821
- if (typeof target !== "bigint" || target < 0n)
3822
- throw new Error("selection target must be a nonnegative amount");
3823
- if (target === 0n) return [];
3824
- const eligible = notes.filter(
3825
- (note) => note.spent === "unspent" && !reserved.has(note.commitment)
3826
- );
3827
- for (const record of eligible)
3828
- if (typeof record.note.amount !== "bigint" || record.note.amount <= 0n || record.note.amount >= 1n << 128n)
3829
- throw new Error("invalid verified note amount");
3830
- eligible.sort(
3831
- (a, b) => a.note.amount > b.note.amount ? -1 : a.note.amount < b.note.amount ? 1 : a.treeId < b.treeId ? -1 : a.treeId > b.treeId ? 1 : a.leafIndex - b.leafIndex || a.commitment.localeCompare(b.commitment)
3832
- );
3833
- const selected = [];
3834
- let total = 0n;
3835
- for (const record of eligible) {
3836
- selected.push(structuredClone(record));
3837
- total += record.note.amount;
3838
- if (total >= target) return selected;
3839
- }
3840
- throw new Error("insufficient verified available funds");
3841
- }
3842
-
3843
- // src/session/prepare-common.ts
3844
- function positiveAmount(value, bits = 128) {
3845
- if (typeof value !== "bigint" || value <= 0n || value >= 1n << BigInt(bits)) {
3846
- throw new Error(`amount must be a positive uint${bits}`);
3847
- }
3848
- return value;
3849
- }
3850
- function copyApplicationPayload(value) {
3851
- if (value === void 0) return new Uint8Array();
3852
- if (!(value instanceof Uint8Array)) throw new TypeError("payload must be Uint8Array");
3853
- return Uint8Array.from(value);
3854
- }
3855
- function positiveOutputAmount(payment, outputIndex) {
3856
- try {
3857
- return positiveAmount(payment.amount);
3858
- } catch (cause) {
3859
- throw new InvisiError(
3860
- "PREPARATION_FAILED",
3861
- cause instanceof Error ? cause.message : "Invalid output amount",
3862
- {
3863
- address: payment.to,
3864
- field: "amount",
3865
- ...outputIndex === void 0 ? {} : { outputIndex },
3866
- cause
3867
- }
3868
- );
3869
- }
3870
- }
3871
- var Preparation = class {
3872
- constructor(runtime) {
3873
- this.runtime = runtime;
3874
- }
3875
- #roots = /* @__PURE__ */ new Map();
3876
- async frame(requested) {
3877
- const { reader, options } = this.runtime;
3878
- await options.protocol.validateDeployment(reader);
3879
- const block = await reader.getBlock(await reader.getLatestBlockNumber());
3880
- const deadline = requested ?? block.timestamp + (options.transactionTTL ?? 300n);
3881
- if (typeof deadline !== "bigint" || deadline < block.timestamp || deadline >= 1n << 64n) {
3882
- throw new Error("invalid transaction deadline");
3883
- }
3884
- const state = await this.runtime.readInventory();
3885
- if (state.invalidated) {
3886
- throw new Error("wallet requires canonical resync");
3887
- }
3888
- for (const point of [state.observedThrough]) {
3889
- if (point && (await reader.getBlock(point.number)).hash !== point.hash) {
3890
- throw new Error("canonical wallet checkpoint changed; resync required");
3891
- }
3892
- }
3893
- return {
3894
- context: {
3895
- ...options.protocol.context,
3896
- now: block.timestamp,
3897
- timestamp: block.timestamp
3898
- },
3899
- block,
3900
- deadline
3901
- };
3902
- }
3903
- async assertBlock(frame) {
3904
- if ((await this.runtime.reader.getBlock(frame.block.number)).hash !== frame.block.hash) {
3905
- throw new Error("canonical block changed while preparing");
3906
- }
3907
- }
3908
- async funding(source, frame) {
3909
- if (!source) {
3910
- return { funding: {}, fundingMode: "none" };
3911
- }
3912
- positiveAmount(source.amount);
3913
- const payer = getAddress(source.payer);
3914
- const mode = source.authorization ?? "signature";
3915
- if (BigInt(payer) === 0n) {
3916
- throw new Error("funding payer must be nonzero");
3917
- }
3918
- if (mode !== "signature" && mode !== "caller") {
3919
- throw new Error("invalid funding authorization mode");
3920
- }
3921
- if (mode === "caller" && (source.sigNonce || source.deadline)) {
3922
- throw new Error("caller funding uses zero nonce/deadline");
3923
- }
3924
- const funding = normalizeFunding2({
3925
- payer,
3926
- amount: source.amount,
3927
- sigNonce: mode === "caller" ? 0n : source.sigNonce ?? await this.runtime.reader.getFundingNonce(
3928
- frame.context,
3929
- payer,
3930
- frame.block
3931
- ),
3932
- deadline: mode === "caller" ? 0n : source.deadline ?? frame.deadline,
3933
- ...source.permit ? { permit: structuredClone(source.permit) } : {}
3934
- });
3935
- if (mode === "signature" && funding.deadline < frame.block.timestamp) {
3936
- throw new Error("funding authorization deadline has expired");
3937
- }
3938
- return { funding, fundingMode: mode };
3939
- }
3940
- async output(payment, context, change = false, outputIndex) {
3941
- try {
3942
- positiveOutputAmount(payment, outputIndex);
3943
- const recipient = await resolveRecipient(
3944
- payment.to,
3945
- this.runtime.options.addressResolver,
3946
- {
3947
- field: change ? "changeAddress" : "to",
3948
- ...outputIndex === void 0 ? {} : { outputIndex }
3949
- }
3950
- );
3951
- const nonce = generateNonce();
3952
- const identity = await computeNoteIdentity(BigInt(recipient.walletIdentity), nonce);
3953
- const keys = recipient.getReceivingKeys();
3954
- const note = {
3955
- chainId: context.chainId,
3956
- protocolAddress: BigInt(context.protocolAddress),
3957
- tokenAddress: BigInt(context.tokenAddress),
3958
- walletIdentity: recipient.walletIdentity,
3959
- amount: payment.amount,
3960
- payload: copyApplicationPayload(payment.payload),
3961
- nonce
3962
- };
3963
- const commitment = await computeNoteCommitment(
3964
- context.chainId,
3965
- identity,
3966
- note.tokenAddress,
3967
- note.amount
3968
- );
3969
- return {
3970
- note,
3971
- commitment,
3972
- identity,
3973
- address: payment.to,
3974
- change,
3975
- delivery: {
3976
- ciphertext: hexlify(
3977
- await encryptPrivateTransferNote(keys.viewingPublicKey, note, {
3978
- chainId: context.chainId,
3979
- protocolAddress: note.protocolAddress,
3980
- outputCommitment: commitment
3981
- })
3982
- ),
3983
- clue: hexlify(createClue(keys.clueKey))
3984
- }
3985
- };
3986
- } catch (cause) {
3987
- if (cause instanceof InvisiError) throw cause;
3988
- throw new InvisiError(
3989
- "PREPARATION_FAILED",
3990
- cause instanceof Error ? cause.message : "Output preparation failed",
3991
- {
3992
- address: payment.to,
3993
- field: change ? "changeAddress" : "to",
3994
- ...outputIndex === void 0 ? {} : { outputIndex },
3995
- cause
3996
- }
3997
- );
3998
- }
3999
- }
4000
- async membership(input, frame) {
4001
- const { options, reader } = this.runtime;
4002
- if (!options.protocolRpc)
4003
- throw new MissingCapabilityError4("Protocol RPC membership provider");
4004
- const root = this.#roots.get(input.treeId);
4005
- const proof = await options.protocolRpc.getMembership(
4006
- frame.context,
4007
- {
4008
- ...input,
4009
- ...root ? { root } : {}
4010
- },
4011
- frame.block
4012
- );
4013
- if (root && proof.root !== root)
4014
- throw new Error("membership provider changed the pinned source root");
4015
- await verifyMembership(reader, frame.context, frame.block, input, proof);
4016
- this.#roots.set(input.treeId, proof.root);
4017
- return { ...proof, path: [...proof.path] };
4018
- }
4019
- async selectFunds(target, frame, maxInputs = 168) {
4020
- const { scope, options, reader } = this.runtime;
4021
- const state = await this.runtime.readInventory();
4022
- if (state.invalidated) {
4023
- throw new Error("wallet requires canonical resync");
4024
- }
4025
- const need = target > 0n ? target : 0n;
4026
- const nullifier = options.wallet.exportNullifier();
4027
- const reserved = new Set(Object.keys(state.reservations));
4028
- const eligible = Object.values(state.notes).filter(
4029
- (note) => note.note.tokenAddress === BigInt(frame.context.tokenAddress) && note.spent === "unspent" && !reserved.has(note.commitment)
4030
- );
4031
- const byId = new Map(eligible.map((note) => [note.commitment, note]));
4032
- const choices = this.runtime.inputSelection ? [...this.runtime.inputSelection] : this.runtime.explicitInputs ? eligible.map((note) => note.commitment) : need > 0n && options.coinSelector ? await options.coinSelector.select(storedCandidates(eligible), need) : selectNotes(eligible, need, reserved).map((note) => note.commitment);
4033
- if (!Array.isArray(choices) || new Set(choices).size !== choices.length || choices.some((id) => !byId.has(id))) {
4034
- throw new Error("invalid or duplicate coin selection");
4035
- }
4036
- const selected = choices.map((id) => structuredClone(byId.get(id)));
4037
- const amount = selected.reduce((sum, input) => sum + input.note.amount, 0n);
4038
- if (amount < need) {
4039
- throw new Error("coin selection has insufficient verified funds");
4040
- }
4041
- if (selected.length > maxInputs || amount >= 1n << 135n) {
4042
- throw new Error("coin selection exceeds transaction capacity");
4043
- }
4044
- const inputs = [];
4045
- const sources = /* @__PURE__ */ new Map();
4046
- const nullifiers = [];
4047
- for (const input of selected) {
4048
- const note = input.note;
4049
- const c = frame.context;
4050
- if (note.walletIdentity !== scope.walletIdentity || note.chainId !== c.chainId || note.protocolAddress !== BigInt(c.protocolAddress) || note.tokenAddress !== BigInt(c.tokenAddress) || await computeNoteCommitment(
4051
- c.chainId,
4052
- await computeNoteIdentity(BigInt(note.walletIdentity), note.nonce),
4053
- note.tokenAddress,
4054
- note.amount
4055
- ) !== input.commitment) {
4056
- throw new Error("selected input preimage/context mismatch");
4057
- }
4058
- const proof = await this.membership(input, frame);
4059
- const path = [...proof.path];
4060
- const root = proof.root;
4061
- if (sources.has(input.treeId) && sources.get(input.treeId) !== root) {
4062
- throw new Error("source roots do not share a canonical snapshot");
4063
- }
4064
- sources.set(input.treeId, root);
4065
- inputs.push({
4066
- note,
4067
- commitment: input.commitment,
4068
- treeId: input.treeId,
4069
- leafIndex: input.leafIndex,
4070
- path
4071
- });
4072
- nullifiers.push(
4073
- await nullifier.compute(c.chainId, input.commitment, input.note.nonce)
4074
- );
4075
- }
4076
- await this.assertUnspent(nullifiers, frame);
4077
- return {
4078
- inputs,
4079
- sources: [...sources].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([treeId, merkleRoot]) => ({ treeId, merkleRoot })),
4080
- nullifiers,
4081
- amount
4082
- };
4083
- }
4084
- async assertUnspent(nullifiers, frame) {
4085
- if (nullifiers.length) {
4086
- const spent = await this.runtime.reader.isSpent(frame.context, nullifiers, frame.block);
4087
- if (spent.length !== nullifiers.length || spent.some((value) => value !== false)) {
4088
- throw new Error("selected input spent or invalid spent-state response");
4089
- }
4090
- }
4091
- }
4092
- };
4093
- function storedCandidates(inputs) {
4094
- const records = inputs.filter(
4095
- (input) => "blockNumber" in input && typeof input.blockNumber === "bigint" && "blockHash" in input && typeof input.blockHash === "string"
4096
- );
4097
- if (records.length !== inputs.length)
4098
- throw new Error("custom coin selection requires stored receipt metadata");
4099
- return structuredClone(records);
4100
- }
4101
-
4102
- // src/session/prepare-credit.ts
4103
- import { getAddress as getAddress2, hexlify as hexlify2, toBeHex } from "ethers";
4104
- import {
4105
- FIELD_MODULUS as FIELD_MODULUS3,
4106
- normalizeCreditPolicy,
4107
- applyCreditDrawUsage,
4108
- computeCreditNullifier as computeCreditNullifier2,
4109
- computeCreditRecoveryPad,
4110
- createClue as createClue2,
4111
- deriveRemainderNonce,
4112
- encryptCreditNote,
4113
- generateCreditSharedKey,
4114
- generateNonce as generateNonce2,
4115
- normalizeCreditDeliveryState as normalizeCreditDeliveryState2
4116
- } from "@invisi-labs/core";
4117
- import {
4118
- WitnessBuilder as WitnessBuilder3,
4119
- cancelCreditPublicInputs as cancelCreditPublicInputs2,
4120
- createCreditPublicInputs as createCreditPublicInputs2,
4121
- creditDrawPublicInputs as creditDrawPublicInputs2,
4122
- selectCreditDrawCircuit,
4123
- topUpCreditPublicInputs as topUpCreditPublicInputs2,
4124
- word as word2
4125
- } from "@invisi-labs/protocol";
4126
- var EMPTY = { ciphertext: "0x", clue: "0x" };
4127
- var CreditPreparation = class {
4128
- constructor(runtime) {
4129
- this.runtime = runtime;
4130
- this.#prepare = new Preparation(runtime);
4131
- }
4132
- #prepare;
4133
- expiry(value, frame) {
4134
- if (typeof value !== "bigint" || value <= frame.block.timestamp || value >= 1n << 64n) {
4135
- throw new Error("Credit expiry must be a future uint64 timestamp");
4136
- }
4137
- return value;
4138
- }
4139
- async seal(input, frame) {
4140
- const state = normalizeCreditDeliveryState2(input);
4141
- const commitment = await creditLeaf(state);
4142
- const context = {
4143
- chainId: frame.context.chainId,
4144
- protocolAddress: BigInt(frame.context.protocolAddress),
4145
- outputCommitment: commitment
4146
- };
4147
- const deliveries = await Promise.all(
4148
- ["owner", "spender"].map(async (role) => {
4149
- const keys = role === "owner" ? state.ownerReceivingKeys : state.spenderReceivingKeys;
4150
- return {
4151
- ciphertext: hexlify2(
4152
- await encryptCreditNote(keys.viewingPublicKey, state, { ...context, role })
4153
- ),
4154
- clue: hexlify2(createClue2(keys.clueKey))
4155
- };
4156
- })
4157
- );
4158
- return { state, commitment, deliveries };
4159
- }
4160
- async input(commitment, role, frame) {
4161
- const stored = (await this.runtime.readInventory()).credits[commitment + ":" + role];
4162
- if (!stored || stored.spent !== "unspent" || stored.role !== role) {
4163
- throw new Error(`confirmed unspent ${role} Credit is unavailable`);
4164
- }
4165
- const state = normalizeCreditDeliveryState2(stored.state);
4166
- const n = state.note;
4167
- if ((role === "owner" ? n.ownerWalletIdentity : n.spenderWalletIdentity) !== this.runtime.scope.walletIdentity || n.chainId !== frame.context.chainId || n.protocolAddress !== BigInt(frame.context.protocolAddress) || n.tokenAddress !== BigInt(frame.context.tokenAddress) || await creditLeaf(state) !== commitment) {
4168
- throw new Error("Credit role, commitment or deployment mismatch");
4169
- }
4170
- const proof = await this.#prepare.membership(stored, frame);
4171
- const path = [...proof.path];
4172
- const nullifier = await computeCreditNullifier2(n.chainId, n.creditSharedKey, commitment);
4173
- await this.#prepare.assertUnspent([nullifier], frame);
4174
- return {
4175
- input: {
4176
- state,
4177
- commitment,
4178
- role,
4179
- treeId: stored.treeId,
4180
- leafIndex: stored.leafIndex,
4181
- path
4182
- },
4183
- nullifier,
4184
- source: {
4185
- treeId: stored.treeId,
4186
- merkleRoot: proof.root
4187
- }
4188
- };
4189
- }
4190
- base(frame, kind) {
4191
- return {
4192
- version: 1,
4193
- id: crypto.randomUUID(),
4194
- kind,
4195
- context: frame.context,
4196
- scope: this.runtime.scope,
4197
- preparedAt: frame.block,
4198
- deadline: frame.deadline,
4199
- outputs: [],
4200
- inputs: [],
4201
- funding: {},
4202
- fundingMode: "none"
4203
- };
4204
- }
4205
- async create(options) {
4206
- positiveAmount(options.amount, 126);
4207
- const frame = await this.#prepare.frame(options.deadline);
4208
- const expiry = this.expiry(options.expiry, frame);
4209
- const spender = await resolveRecipient(
4210
- options.spender,
4211
- this.runtime.options.addressResolver,
4212
- { field: "spender" }
4213
- );
4214
- const owner = await resolveRecipient(
4215
- this.runtime.options.wallet.getReceivingAddress().toString(),
4216
- this.runtime.options.addressResolver,
4217
- { field: "wallet" }
4218
- );
4219
- const ownerPayout = getAddress2(owner.walletIdentity);
4220
- const spenderPayout = getAddress2(spender.walletIdentity);
4221
- if (BigInt(ownerPayout) === 0n || BigInt(spenderPayout) === 0n) {
4222
- throw new Error("Credit payouts must be nonzero");
4223
- }
4224
- const output = await this.seal(
4225
- {
4226
- note: {
4227
- chainId: frame.context.chainId,
4228
- protocolAddress: BigInt(frame.context.protocolAddress),
4229
- tokenAddress: BigInt(frame.context.tokenAddress),
4230
- ownerWalletIdentity: this.runtime.scope.walletIdentity,
4231
- spenderWalletIdentity: spender.walletIdentity,
4232
- ownerPayout: BigInt(ownerPayout),
4233
- spenderPayout: BigInt(spenderPayout),
4234
- ...normalizeCreditPolicy({
4235
- singleLimit: options.singleLimit ?? 0n,
4236
- dailyLimit: options.dailyLimit ?? 0n,
4237
- monthlyLimit: options.monthlyLimit ?? 0n
4238
- }),
4239
- amount: options.amount,
4240
- payload: copyApplicationPayload(options.payload),
4241
- expiry,
4242
- nonce: generateNonce2(),
4243
- creditSharedKey: generateCreditSharedKey()
4244
- },
4245
- ownerReceivingKeys: owner.getReceivingKeys(),
4246
- spenderReceivingKeys: spender.getReceivingKeys()
4247
- },
4248
- frame
4249
- );
4250
- return this.creation(
4251
- this.base(frame, "create-credit"),
4252
- output,
4253
- options.amount,
4254
- options.funding,
4255
- frame
4256
- );
4257
- }
4258
- async creation(plan, output, delta, fundingSource, frame, previous) {
4259
- const funding = await this.#prepare.funding(fundingSource, frame);
4260
- const selected = await this.#prepare.selectFunds(
4261
- delta - (funding.funding.amount ?? 0n),
4262
- frame,
4263
- 10
4264
- );
4265
- const change = selected.amount + (funding.funding.amount ?? 0n) - delta;
4266
- plan.inputs = selected.inputs;
4267
- Object.assign(plan, funding);
4268
- if (change > 0n) {
4269
- plan.outputs.push(
4270
- await this.#prepare.output(
4271
- {
4272
- to: this.runtime.changeAddress ?? this.runtime.options.wallet.getReceivingAddress().toString(),
4273
- amount: change
4274
- },
4275
- frame.context,
4276
- true
4277
- )
4278
- );
4279
- }
4280
- const creation = {
4281
- token: frame.context.tokenAddress,
4282
- sources: selected.sources,
4283
- nullifiers: selected.nullifiers,
4284
- creditCommitment: output.commitment,
4285
- changeCommitment: plan.outputs[0]?.commitment ?? word2(0n),
4286
- owner: getAddress2(toBeHex(output.state.note.ownerPayout, 20)),
4287
- expiry: output.state.note.expiry,
4288
- deadline: frame.deadline
4289
- };
4290
- const deliveries = [...output.deliveries, plan.outputs[0]?.delivery ?? { ...EMPTY }];
4291
- plan.capacity = 10;
4292
- plan.credit = {
4293
- inputs: previous ? [previous.input] : [],
4294
- outputs: [output],
4295
- deliveries,
4296
- creation
4297
- };
4298
- if (previous) {
4299
- plan.credit.topUp = {
4300
- creation,
4301
- creditSource: previous.source,
4302
- creditNullifier: previous.nullifier,
4303
- previousExpiry: previous.input.state.note.expiry
4304
- };
4305
- plan.statement = WitnessBuilder3.statement(
4306
- "credit_top_up",
4307
- topUpCreditPublicInputs2(frame.context, plan.credit.topUp, deliveries, plan.funding)
4308
- );
4309
- } else {
4310
- plan.statement = WitnessBuilder3.statement(
4311
- "create_credit",
4312
- createCreditPublicInputs2(frame.context, creation, deliveries, plan.funding)
4313
- );
4314
- }
4315
- await this.#prepare.assertBlock(frame);
4316
- return this.runtime.complete(plan);
4317
- }
4318
- async topUp(options) {
4319
- positiveAmount(options.additionalAmount, 126);
4320
- const frame = await this.#prepare.frame(options.deadline);
4321
- const previous = await this.input(options.credit, "owner", frame);
4322
- const old = previous.input.state;
4323
- if (old.note.expiry <= frame.block.timestamp) {
4324
- throw new Error("previous Credit has expired");
4325
- }
4326
- const expiry = this.expiry(options.expiry ?? old.note.expiry, frame);
4327
- if (expiry < old.note.expiry) {
4328
- throw new Error("Credit expiry must not decrease");
4329
- }
4330
- const amount = positiveAmount(old.note.amount + options.additionalAmount, 126);
4331
- const output = await this.seal(
4332
- {
4333
- ...old,
4334
- note: {
4335
- ...old.note,
4336
- singleLimit: options.singleLimit ?? old.note.singleLimit ?? 0n,
4337
- dailyLimit: options.dailyLimit ?? old.note.dailyLimit ?? 0n,
4338
- monthlyLimit: options.monthlyLimit ?? old.note.monthlyLimit ?? 0n,
4339
- amount,
4340
- expiry,
4341
- nonce: generateNonce2(),
4342
- payload: copyApplicationPayload(
4343
- options.payload === void 0 ? old.note.payload : options.payload
4344
- )
4345
- }
4346
- },
4347
- frame
4348
- );
4349
- return this.creation(
4350
- this.base(frame, "top-up-credit"),
4351
- output,
4352
- options.additionalAmount,
4353
- options.funding,
4354
- frame,
4355
- previous
4356
- );
4357
- }
4358
- async draw(options) {
4359
- const frame = await this.#prepare.frame(options.deadline);
4360
- const profile = selectCreditDrawCircuit(options.credits.length);
4361
- if (new Set(options.credits.map((value) => value.credit)).size !== options.credits.length) {
4362
- throw new Error("duplicate Credit input");
4363
- }
4364
- const members = await Promise.all(
4365
- options.credits.map((value) => this.input(value.credit, "spender", frame))
4366
- );
4367
- const payout = members[0].input.state.note.spenderPayout;
4368
- const sources = /* @__PURE__ */ new Map();
4369
- const outputs = [];
4370
- const deliveries = [];
4371
- const recoveryAmounts = [];
4372
- const remainders = [];
4373
- const amounts = [];
4374
- for (const [i, member] of members.entries()) {
4375
- const state = member.input.state;
4376
- const n = state.note;
4377
- const amount = positiveAmount(options.credits[i].amount, 126);
4378
- if (n.spenderPayout !== payout) {
4379
- throw new Error(
4380
- "Credit draw requires separate groups for different public payouts; one call must be atomic"
4381
- );
4382
- }
4383
- this.expiry(n.expiry, frame);
4384
- if (amount > n.amount) {
4385
- throw new Error("Credit draw exceeds remaining amount");
4386
- }
4387
- if (sources.has(member.source.treeId) && sources.get(member.source.treeId) !== member.source.merkleRoot) {
4388
- throw new Error("Credit source root mismatch");
4389
- }
4390
- sources.set(member.source.treeId, member.source.merkleRoot);
4391
- amounts.push(amount);
4392
- const usage = applyCreditDrawUsage(n, amount, frame.block.timestamp);
4393
- const remaining = n.amount - amount;
4394
- if (remaining === 0n) {
4395
- remainders.push(word2(0n));
4396
- recoveryAmounts.push(word2(0n));
4397
- deliveries.push({ ...EMPTY }, { ...EMPTY });
4398
- continue;
4399
- }
4400
- const args = [
4401
- n.chainId,
4402
- n.protocolAddress,
4403
- n.tokenAddress,
4404
- BigInt(member.nullifier),
4405
- n.creditSharedKey
4406
- ];
4407
- const output = await this.seal(
4408
- {
4409
- ...state,
4410
- note: {
4411
- ...n,
4412
- ...usage,
4413
- amount: remaining,
4414
- payload: copyApplicationPayload(
4415
- options.credits[i].payload === void 0 ? n.payload : options.credits[i].payload
4416
- ),
4417
- nonce: await deriveRemainderNonce(...args)
4418
- }
4419
- },
4420
- frame
4421
- );
4422
- outputs.push(output);
4423
- remainders.push(output.commitment);
4424
- recoveryAmounts.push(
4425
- word2((remaining + await computeCreditRecoveryPad(...args)) % FIELD_MODULUS3)
4426
- );
4427
- deliveries.push(...output.deliveries);
4428
- }
4429
- const plan = this.base(frame, "draw-credit");
4430
- const params = {
4431
- token: frame.context.tokenAddress,
4432
- sources: [...sources].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([treeId, merkleRoot]) => ({ treeId, merkleRoot })),
4433
- nullifiers: members.map((member) => member.nullifier),
4434
- remainderCommitments: remainders,
4435
- expiries: members.map((member) => member.input.state.note.expiry),
4436
- recoveryAmounts,
4437
- spender: getAddress2(toBeHex(payout, 20)),
4438
- totalAmount: amounts.reduce((sum, amount) => sum + amount, 0n),
4439
- deadline: frame.deadline
4440
- };
4441
- plan.capacity = profile.maxSize;
4442
- plan.credit = {
4443
- inputs: members.map((member) => member.input),
4444
- outputs,
4445
- deliveries,
4446
- draw: params,
4447
- amounts
4448
- };
4449
- plan.statement = WitnessBuilder3.statement(
4450
- profile.name,
4451
- creditDrawPublicInputs2(frame.context, params, deliveries)
4452
- );
4453
- await this.#prepare.assertBlock(frame);
4454
- return this.runtime.complete(plan);
4455
- }
4456
- async cancel(options) {
4457
- const frame = await this.#prepare.frame(options.deadline);
4458
- const previous = await this.input(options.credit, "owner", frame);
4459
- const n = previous.input.state.note;
4460
- const plan = this.base(frame, "cancel-credit");
4461
- const params = {
4462
- token: frame.context.tokenAddress,
4463
- source: previous.source,
4464
- nullifier: previous.nullifier,
4465
- owner: getAddress2(toBeHex(n.ownerPayout, 20)),
4466
- amount: n.amount,
4467
- deadline: frame.deadline
4468
- };
4469
- plan.capacity = 1;
4470
- plan.credit = { inputs: [previous.input], outputs: [], deliveries: [], cancel: params };
4471
- plan.statement = WitnessBuilder3.statement(
4472
- "credit_cancel",
4473
- cancelCreditPublicInputs2(frame.context, params)
4474
- );
4475
- await this.#prepare.assertBlock(frame);
4476
- return this.runtime.complete(plan);
4477
- }
4478
- };
4479
-
4480
- // src/session/transaction-preparation.ts
4481
- var TransactionPreparation = class {
4482
- constructor(context) {
4483
- this.context = context;
4484
- }
4485
- runtime(tokenAddress) {
4486
- if (getAddress3(tokenAddress) !== getAddress3(this.context.options.protocol.context.tokenAddress))
4487
- throw new Error("preparation token mismatch");
4488
- return this.context;
4489
- }
4490
- get scope() {
4491
- return this.context.scope;
4492
- }
4493
- async prepareTransfer(options) {
4494
- if (Object.hasOwn(options, "target") || Object.hasOwn(options, "execution")) {
4495
- throw new Error(
4496
- "prepareTransfer accepts no target or execution; choose execution in prove()"
4497
- );
4498
- }
4499
- const copied = structuredClone(options);
4500
- const runtime = this.runtime(copied.tokenAddress);
4501
- if (copied.commitments !== void 0 && copied.commitments.length === 0)
4502
- throw new Error("empty explicit input selection");
4503
- const preparation = new Preparation({
4504
- ...runtime,
4505
- ...copied.commitments !== void 0 ? { inputSelection: copied.commitments } : {}
4506
- });
4507
- const frame = await preparation.frame(copied.deadline);
4508
- if (copied.outputs.length > 168) throw new Error("transfer supports at most 168 outputs");
4509
- let withdrawalAddress = ZERO_ADDRESS;
4510
- let withdrawalAmount = 0n;
4511
- if (copied.withdrawal !== void 0) {
4512
- withdrawalAddress = getAddress3(copied.withdrawal.to);
4513
- positiveAmount(copied.withdrawal.amount);
4514
- if (BigInt(withdrawalAddress) === 0n)
4515
- throw new Error("withdrawal destination must be nonzero");
4516
- withdrawalAmount = copied.withdrawal.amount;
4517
- }
4518
- if (copied.outputs.length === 0 && withdrawalAmount === 0n)
4519
- throw new Error("transfer requires a private output or public withdrawal");
4520
- const total = copied.outputs.reduce(
4521
- (sum, output, index2) => sum + positiveOutputAmount(output, index2),
4522
- withdrawalAmount
4523
- );
4524
- const funding = await preparation.funding(copied.funding, frame);
4525
- return this.funds(
4526
- copied.outputs,
4527
- total,
4528
- withdrawalAddress,
4529
- withdrawalAmount,
4530
- frame,
4531
- funding,
4532
- preparation
4533
- );
4534
- }
4535
- async funds(payments, total, withdrawalAddress, withdrawalAmount, frame, funding, preparation) {
4536
- if (total >= 1n << 135n) {
4537
- throw new Error("transaction sum exceeds uint135");
4538
- }
4539
- const { context, block, deadline } = frame;
4540
- const selection = await preparation.selectFunds(
4541
- total - (funding.funding.amount ?? 0n),
4542
- frame
4543
- );
4544
- const outputs = await Promise.all(
4545
- payments.map((payment, index2) => preparation.output(payment, context, false, index2))
4546
- );
4547
- const change = selection.amount + (funding.funding.amount ?? 0n) - total;
4548
- if (change > 0n) {
4549
- outputs.push(
4550
- await preparation.output(
4551
- {
4552
- to: this.context.changeAddress ?? this.context.options.wallet.getReceivingAddress().toString(),
4553
- amount: change
4554
- },
4555
- context,
4556
- true
4557
- )
4558
- );
4559
- }
4560
- const params = {
4561
- token: context.tokenAddress,
4562
- sources: selection.sources,
4563
- nullifiers: selection.nullifiers,
4564
- outputCommitments: outputs.map((output) => output.commitment),
4565
- withdrawalAddress,
4566
- withdrawalAmount,
4567
- deadline
4568
- };
4569
- const deliveries = outputs.map((output) => output.delivery);
4570
- const normalized = normalizeTransactRequest(context, params, deliveries, funding.funding);
4571
- const statement2 = WitnessBuilder4.statement(
4572
- `transact_user_slots${normalized.capacity}`,
4573
- transactUserPublicInputs2(context, params, deliveries, funding.funding),
4574
- "evm"
4575
- );
4576
- await preparation.assertBlock(frame);
4577
- return preparation.runtime.complete({
4578
- version: 1,
4579
- id: crypto.randomUUID(),
4580
- kind: "transfer",
4581
- context,
4582
- scope: this.scope,
4583
- preparedAt: block,
4584
- deadline,
4585
- outputs,
4586
- inputs: selection.inputs,
4587
- ...funding,
4588
- params,
4589
- capacity: normalized.capacity,
4590
- statement: statement2
4591
- });
4592
- }
4593
- async prepareShield(options) {
4594
- const copied = structuredClone(options);
4595
- const preparation = new Preparation(this.runtime(copied.tokenAddress));
4596
- const frame = await preparation.frame(copied.deadline);
4597
- const funding = await preparation.funding(copied.funding, frame);
4598
- if (copied.outputs.length < 1 || copied.outputs.length > 10) {
4599
- throw new Error("shield requires 1..10 outputs");
4600
- }
4601
- const outputs = await Promise.all(
4602
- copied.outputs.map(
4603
- (output, index2) => preparation.output(output, frame.context, false, index2)
4604
- )
4605
- );
4606
- if (outputs.reduce((sum, output) => sum + output.note.amount, 0n) !== (funding.funding.amount ?? 0n)) {
4607
- throw new Error("shield funding must equal output total");
4608
- }
4609
- await preparation.assertBlock(frame);
4610
- return preparation.runtime.complete({
4611
- version: 1,
4612
- id: crypto.randomUUID(),
4613
- kind: "shield",
4614
- context: frame.context,
4615
- scope: this.scope,
4616
- preparedAt: frame.block,
4617
- deadline: frame.deadline,
4618
- outputs,
4619
- inputs: [],
4620
- ...funding,
4621
- shieldParams: {
4622
- token: frame.context.tokenAddress,
4623
- outputCommitments: outputs.map((output) => output.commitment),
4624
- deadline: frame.deadline
4625
- },
4626
- shieldOutputs: outputs.map((output) => ({
4627
- identity: output.identity,
4628
- amount: output.note.amount
4629
- }))
4630
- });
4631
- }
4632
- prepareCreateCredit(options) {
4633
- return new CreditPreparation(this.runtime(options.tokenAddress)).create(
4634
- structuredClone(options)
4635
- );
4636
- }
4637
- prepareDrawCredit(options) {
4638
- return new CreditPreparation(this.runtime(options.tokenAddress)).draw(
4639
- structuredClone(options)
4640
- );
4641
- }
4642
- prepareTopUpCredit(options) {
4643
- return new CreditPreparation(this.runtime(options.tokenAddress)).topUp(
4644
- structuredClone(options)
4645
- );
4646
- }
4647
- prepareCancelCredit(options) {
4648
- return new CreditPreparation(this.runtime(options.tokenAddress)).cancel(
4649
- structuredClone(options)
4650
- );
4651
- }
4652
- };
3871
+ import { getAddress } from "ethers";
3872
+ import { MissingCapabilityError as MissingCapabilityError2 } from "@invisi-labs/core";
4653
3873
 
4654
3874
  // src/session/refresh.ts
3875
+ import { MAX_UPDATE_BLOCKS } from "@invisi-labs/rpc";
4655
3876
  async function refreshWallet(runtime, options) {
4656
3877
  const { signal } = options;
4657
3878
  try {
4658
3879
  signal?.throwIfAborted();
4659
3880
  if (typeof options.fromBlock !== "bigint" || options.fromBlock < runtime.fromBlock)
4660
3881
  throw new Error("refresh range precedes deployment");
4661
- const pageSize = options.pageSize ?? 100;
4662
- if (!Number.isInteger(pageSize) || pageSize < 1 || pageSize > 100)
4663
- throw new Error("refresh page size must be 1..100");
3882
+ const pageSize = options.pageSize ?? MAX_UPDATE_BLOCKS;
3883
+ if (!Number.isInteger(pageSize) || pageSize < 1 || pageSize > MAX_UPDATE_BLOCKS)
3884
+ throw new Error(`refresh page size must be 1..${MAX_UPDATE_BLOCKS}`);
4664
3885
  const status = await runtime.provider.getStatus(runtime.context, {
4665
3886
  ...signal ? { signal } : {}
4666
3887
  });
@@ -4685,6 +3906,10 @@ async function refreshWallet(runtime, options) {
4685
3906
  });
4686
3907
  if (page.block.number !== (end < toBlock ? end : toBlock))
4687
3908
  throw new Error("Protocol RPC returned the wrong page anchor");
3909
+ signal?.throwIfAborted();
3910
+ if (page.transactionHashes.length === 0 && (result || from + BigInt(pageSize) <= toBlock))
3911
+ continue;
3912
+ const firstApplication = result === void 0;
4688
3913
  result = await runtime.apply(
4689
3914
  {
4690
3915
  context: runtime.context,
@@ -4693,7 +3918,7 @@ async function refreshWallet(runtime, options) {
4693
3918
  },
4694
3919
  {
4695
3920
  ...signal ? { signal } : {},
4696
- ...from === options.fromBlock && options.reset ? { reset: true } : {}
3921
+ ...firstApplication && options.reset ? { reset: true } : {}
4697
3922
  }
4698
3923
  );
4699
3924
  notes += result.notes;
@@ -4710,9 +3935,9 @@ import { NullifierCapability } from "@invisi-labs/core";
4710
3935
 
4711
3936
  // src/session/inventory.ts
4712
3937
  import {
4713
- computeCreditCommitment as computeCreditCommitment2,
4714
- computeCreditNullifier as computeCreditNullifier3,
4715
- computeCreditSharedKeyHash as computeCreditSharedKeyHash2,
3938
+ computeCreditCommitment,
3939
+ computeCreditNullifier as computeCreditNullifier2,
3940
+ computeCreditSharedKeyHash,
4716
3941
  recoverCreditRemainder
4717
3942
  } from "@invisi-labs/core";
4718
3943
  var CanonicalConflict = class extends Error {
@@ -4766,10 +3991,10 @@ var InventoryProcessor = class {
4766
3991
  }
4767
3992
  async creditNullifier(state) {
4768
3993
  const n = state.note;
4769
- return computeCreditNullifier3(
3994
+ return computeCreditNullifier2(
4770
3995
  n.chainId,
4771
3996
  n.creditSharedKey,
4772
- await computeCreditCommitment2(
3997
+ await computeCreditCommitment(
4773
3998
  n.chainId,
4774
3999
  n.spenderWalletIdentity,
4775
4000
  n.ownerWalletIdentity,
@@ -4779,7 +4004,7 @@ var InventoryProcessor = class {
4779
4004
  n.amount,
4780
4005
  n.nonce,
4781
4006
  n.expiry,
4782
- await computeCreditSharedKeyHash2(n.creditSharedKey),
4007
+ await computeCreditSharedKeyHash(n.creditSharedKey),
4783
4008
  n
4784
4009
  )
4785
4010
  );
@@ -4942,7 +4167,7 @@ var WalletUpdater = class extends InventoryProcessor {
4942
4167
  super(options);
4943
4168
  this.#options = { ...options };
4944
4169
  check7(
4945
- options.viewing.walletIdentity === options.scope.walletIdentity,
4170
+ options.viewing.ownerAddress === options.scope.ownerAddress,
4946
4171
  "viewing capability wallet mismatch"
4947
4172
  );
4948
4173
  }
@@ -4951,7 +4176,7 @@ var WalletUpdater = class extends InventoryProcessor {
4951
4176
  }
4952
4177
  async run(batch, options) {
4953
4178
  const { reader, protocol, scope, store, viewing } = this.#options;
4954
- const nullifier = NullifierCapability.fromIdentity(scope.walletIdentity);
4179
+ const nullifier = NullifierCapability.fromIdentity(scope.ownerAddress);
4955
4180
  const { signal, reset } = options;
4956
4181
  signal?.throwIfAborted();
4957
4182
  const context = protocol.context;
@@ -5158,6 +4383,11 @@ var WalletSession = class {
5158
4383
  scope;
5159
4384
  protocol;
5160
4385
  constructor(options) {
4386
+ if ("addressLookup" in options || "addressResolver" in options)
4387
+ throw new TypeError(
4388
+ "Recipient lookup belongs to each EVM output; caller resolver injection is not supported"
4389
+ );
4390
+ options = configureRecipientInfrastructure(options);
5161
4391
  if ("ciphertextCodecs" in options || "envelopeVersion" in options) {
5162
4392
  throw new Error(
5163
4393
  "SDK envelope versions are fixed; encode application payload bytes externally"
@@ -5190,7 +4420,7 @@ var WalletSession = class {
5190
4420
  this.scope = Object.freeze({
5191
4421
  namespace: options.namespace ?? "default",
5192
4422
  ...options.protocol.context,
5193
- walletIdentity: options.wallet.walletIdentity
4423
+ ownerAddress: options.wallet.ownerAddress
5194
4424
  });
5195
4425
  scopeKey(this.scope);
5196
4426
  Object.freeze(this);
@@ -5198,7 +4428,7 @@ var WalletSession = class {
5198
4428
  /** Delegate sending to ethers; managed operations additionally retain the resulting hash. */
5199
4429
  async sendTransaction(input, options = {}) {
5200
4430
  const signer = this.#options.signer;
5201
- if (!signer) throw new MissingCapabilityError5("ethers signer");
4431
+ if (!signer) throw new MissingCapabilityError2("ethers signer");
5202
4432
  const operation = input instanceof Operation ? input : void 0;
5203
4433
  if (operation && this.#sending.has(operation.id))
5204
4434
  throw new Error("operation is already being sent by this session");
@@ -5206,12 +4436,12 @@ var WalletSession = class {
5206
4436
  const overrides = { ...options };
5207
4437
  const plain = operation ? void 0 : { ...input };
5208
4438
  try {
5209
- if (!signer.provider) throw new MissingCapabilityError5("connected ethers signer");
4439
+ if (!signer.provider) throw new MissingCapabilityError2("connected ethers signer");
5210
4440
  if ((await signer.provider.getNetwork()).chainId !== this.protocol.context.chainId) {
5211
4441
  throw new Error("signer-provider session chain mismatch");
5212
4442
  }
5213
4443
  if (operation) {
5214
- if (!this.#options.store) throw new MissingCapabilityError5("wallet store");
4444
+ if (!this.#options.store) throw new MissingCapabilityError2("wallet store");
5215
4445
  const state = await this.#options.store.readSnapshot(this.scope);
5216
4446
  if (!state.operations[operation.id])
5217
4447
  throw new Error("operation does not belong to this wallet session");
@@ -5242,10 +4472,10 @@ var WalletSession = class {
5242
4472
  runtime(tokenAddress) {
5243
4473
  const options = this.#options;
5244
4474
  if (!options.store) {
5245
- throw new MissingCapabilityError5("wallet store");
4475
+ throw new MissingCapabilityError2("wallet store");
5246
4476
  }
5247
4477
  if (!options.chainReader) {
5248
- throw new MissingCapabilityError5("chain reader");
4478
+ throw new MissingCapabilityError2("chain reader");
5249
4479
  }
5250
4480
  return {
5251
4481
  options: { ...options, protocol: options.protocol.forToken(tokenAddress) },
@@ -5255,7 +4485,7 @@ var WalletSession = class {
5255
4485
  authorization: () => {
5256
4486
  if (options.authorization) return options.authorization;
5257
4487
  if (options.wallet instanceof Wallet) return options.wallet.exportAuthorization();
5258
- throw new MissingCapabilityError5("wallet authorization");
4488
+ throw new MissingCapabilityError2("wallet authorization");
5259
4489
  }
5260
4490
  };
5261
4491
  }
@@ -5263,9 +4493,9 @@ var WalletSession = class {
5263
4493
  if (this.#updater) return this.#updater;
5264
4494
  const options = this.#options;
5265
4495
  if (!options.store || !options.chainReader || !options.protocolRpc)
5266
- throw new MissingCapabilityError5("wallet store, chain reader and Protocol RPC");
4496
+ throw new MissingCapabilityError2("wallet store, chain reader and Protocol RPC");
5267
4497
  const viewing = options.viewing ?? (options.wallet instanceof Wallet ? options.wallet.getViewer() : void 0);
5268
- if (!viewing) throw new MissingCapabilityError5("viewing");
4498
+ if (!viewing) throw new MissingCapabilityError2("viewing");
5269
4499
  const receivingAddress = options.wallet.getReceivingAddress();
5270
4500
  const receivingKeys = receivingAddress.kind === "long" ? receivingAddress.getReceivingKeys() : void 0;
5271
4501
  this.#updater = new WalletUpdater({
@@ -5288,9 +4518,9 @@ var WalletSession = class {
5288
4518
  }
5289
4519
  /** Detached history for wallet UI; construction records do not imply chain success. */
5290
4520
  async getHistory(options = {}) {
5291
- const tokenAddress = options.tokenAddress ? getAddress4(options.tokenAddress) : void 0;
4521
+ const tokenAddress = options.tokenAddress ? getAddress(options.tokenAddress) : void 0;
5292
4522
  const store = this.#options.store;
5293
- if (!store) throw new MissingCapabilityError5("wallet store");
4523
+ if (!store) throw new MissingCapabilityError2("wallet store");
5294
4524
  return walletHistory(
5295
4525
  await store.readSnapshot(this.scope),
5296
4526
  tokenAddress ? { tokenAddress } : {}
@@ -5299,16 +4529,16 @@ var WalletSession = class {
5299
4529
  async balance(tokenAddress) {
5300
4530
  const store = this.#options.store;
5301
4531
  if (!store) {
5302
- throw new MissingCapabilityError5("wallet store");
4532
+ throw new MissingCapabilityError2("wallet store");
5303
4533
  }
5304
- return walletBalance(await store.readSnapshot(this.scope), getAddress4(tokenAddress));
4534
+ return walletBalance(await store.readSnapshot(this.scope), getAddress(tokenAddress));
5305
4535
  }
5306
4536
  /** Pull explicitly selected indexed pages; no chain scanning or public tree reconstruction. */
5307
4537
  async refresh(options) {
5308
4538
  const provider = this.#options.protocolRpc;
5309
4539
  const reader = this.#options.chainReader;
5310
- if (!reader) throw new MissingCapabilityError5("chain reader");
5311
- if (!provider) throw new MissingCapabilityError5("Protocol RPC");
4540
+ if (!reader) throw new MissingCapabilityError2("chain reader");
4541
+ if (!provider) throw new MissingCapabilityError2("Protocol RPC");
5312
4542
  const updater = this.updater();
5313
4543
  const request = {
5314
4544
  ...options,
@@ -5385,14 +4615,14 @@ var WalletSession = class {
5385
4615
  }
5386
4616
  async resume(operationId) {
5387
4617
  const store = this.#options.store;
5388
- if (!store) throw new MissingCapabilityError5("wallet store");
4618
+ if (!store) throw new MissingCapabilityError2("wallet store");
5389
4619
  const state = await store.readSnapshot(this.scope);
5390
4620
  const saved = state.operations[operationId]?.payload;
5391
4621
  if (!saved?.plan) throw new Error("operation not found");
5392
4622
  return Operation.resume(this.runtime(saved.plan.context.tokenAddress), operationId);
5393
4623
  }
5394
4624
  toJSON() {
5395
- return { walletSession: true, walletIdentity: this.scope.walletIdentity };
4625
+ return { walletSession: true, ownerAddress: this.scope.ownerAddress };
5396
4626
  }
5397
4627
  [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
5398
4628
  return this.toJSON();
@@ -5457,13 +4687,6 @@ var MemoryWalletStore = class extends TransactionalWalletStore {
5457
4687
  };
5458
4688
 
5459
4689
  export {
5460
- InvisiError,
5461
- prepareWithErrors,
5462
- walletBalance,
5463
- requiresAuthorization,
5464
- statement,
5465
- encodeOperation,
5466
- publicProof,
5467
4690
  copyGasBenchmarks,
5468
4691
  defineGasBenchmarks,
5469
4692
  estimateGasReference,
@@ -5474,8 +4697,6 @@ export {
5474
4697
  fundingSigningRequest,
5475
4698
  acceptFundingSignature,
5476
4699
  operationPreview,
5477
- positiveAmount,
5478
- TransactionPreparation,
5479
4700
  serializeState,
5480
4701
  deserializeState,
5481
4702
  readProtocolLogs,
@@ -5487,4 +4708,4 @@ export {
5487
4708
  WalletSession,
5488
4709
  MemoryWalletStore
5489
4710
  };
5490
- //# sourceMappingURL=chunk-BE52B32Z.js.map
4711
+ //# sourceMappingURL=chunk-4SD3MW6N.js.map