@invisi-labs/sdk 1.1.7 → 1.2.1

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 (118) hide show
  1. package/README.md +5 -0
  2. package/dist/broadcaster-3KTB4JO2.cjs +21 -0
  3. package/dist/broadcaster-3KTB4JO2.cjs.map +1 -0
  4. package/dist/broadcaster-7ZKKSTZQ.js +21 -0
  5. package/dist/broadcaster-preparation-PJ263WBL.cjs +15 -0
  6. package/dist/broadcaster-preparation-PJ263WBL.cjs.map +1 -0
  7. package/dist/broadcaster-preparation-ZQAPZAUG.js +15 -0
  8. package/dist/broadcaster-preparation-ZQAPZAUG.js.map +1 -0
  9. package/dist/{chunk-LOU7AP2B.cjs → chunk-2URICDPW.cjs} +72 -33
  10. package/dist/chunk-2URICDPW.cjs.map +1 -0
  11. package/dist/chunk-3D24ABYR.js +86 -0
  12. package/dist/chunk-3D24ABYR.js.map +1 -0
  13. package/dist/chunk-3KTQQZOW.cjs +71 -0
  14. package/dist/chunk-3KTQQZOW.cjs.map +1 -0
  15. package/dist/chunk-4SDP53YQ.cjs +765 -0
  16. package/dist/chunk-4SDP53YQ.cjs.map +1 -0
  17. package/dist/{chunk-XHKQ2BO2.js → chunk-4VI6LYGH.js} +25 -2
  18. package/dist/chunk-4VI6LYGH.js.map +1 -0
  19. package/dist/chunk-BBSRP4MH.cjs +287 -0
  20. package/dist/chunk-BBSRP4MH.cjs.map +1 -0
  21. package/dist/chunk-DGMVGFKM.js +41 -0
  22. package/dist/chunk-DGMVGFKM.js.map +1 -0
  23. package/dist/chunk-DHQEB6JR.cjs +1616 -0
  24. package/dist/chunk-DHQEB6JR.cjs.map +1 -0
  25. package/dist/chunk-FKF67XE6.js +1616 -0
  26. package/dist/chunk-FKF67XE6.js.map +1 -0
  27. package/dist/chunk-GUD3LAUO.js +765 -0
  28. package/dist/chunk-GUD3LAUO.js.map +1 -0
  29. package/dist/chunk-HCB7RQ3S.cjs +79 -0
  30. package/dist/chunk-HCB7RQ3S.cjs.map +1 -0
  31. package/dist/{chunk-GTPUYPQL.js → chunk-HKGJXQVN.js} +69 -30
  32. package/dist/chunk-HKGJXQVN.js.map +1 -0
  33. package/dist/chunk-HLH5JZD4.js +287 -0
  34. package/dist/chunk-HLH5JZD4.js.map +1 -0
  35. package/dist/chunk-J6TZZVAM.cjs +230 -0
  36. package/dist/chunk-J6TZZVAM.cjs.map +1 -0
  37. package/dist/{chunk-7F7ZZW3L.cjs → chunk-LOR6PYH5.cjs} +25 -2
  38. package/dist/chunk-LOR6PYH5.cjs.map +1 -0
  39. package/dist/chunk-MA2QZEF5.cjs +399 -0
  40. package/dist/chunk-MA2QZEF5.cjs.map +1 -0
  41. package/dist/chunk-MI4IP4ZD.cjs +86 -0
  42. package/dist/chunk-MI4IP4ZD.cjs.map +1 -0
  43. package/dist/chunk-OCZLJKIA.cjs +41 -0
  44. package/dist/chunk-OCZLJKIA.cjs.map +1 -0
  45. package/dist/chunk-R5YAOJKB.js +71 -0
  46. package/dist/chunk-R5YAOJKB.js.map +1 -0
  47. package/dist/chunk-RY4M2CIQ.js +399 -0
  48. package/dist/chunk-RY4M2CIQ.js.map +1 -0
  49. package/dist/chunk-THMD5QO2.js +79 -0
  50. package/dist/chunk-THMD5QO2.js.map +1 -0
  51. package/dist/chunk-ZD2652WH.js +230 -0
  52. package/dist/chunk-ZD2652WH.js.map +1 -0
  53. package/dist/credit.cjs +1 -0
  54. package/dist/credit.cjs.map +1 -0
  55. package/dist/credit.d.cts +12 -0
  56. package/dist/credit.d.ts +12 -0
  57. package/dist/credit.js +1 -0
  58. package/dist/credit.js.map +1 -0
  59. package/dist/ethers.cjs +2 -2
  60. package/dist/ethers.cjs.map +1 -1
  61. package/dist/ethers.d.cts +15 -4
  62. package/dist/ethers.d.ts +15 -4
  63. package/dist/ethers.js +1 -1
  64. package/dist/index-CLhGwLxZ.d.cts +42 -0
  65. package/dist/index-Crp-ZFiM.d.ts +42 -0
  66. package/dist/index.cjs +69 -38
  67. package/dist/index.cjs.map +1 -1
  68. package/dist/index.d.cts +21 -14
  69. package/dist/index.d.ts +21 -14
  70. package/dist/index.js +64 -33
  71. package/dist/index.js.map +1 -1
  72. package/dist/note.cjs +11 -0
  73. package/dist/note.cjs.map +1 -0
  74. package/dist/note.d.cts +29 -0
  75. package/dist/note.d.ts +29 -0
  76. package/dist/note.js +11 -0
  77. package/dist/note.js.map +1 -0
  78. package/dist/{broadcaster-preparation-DMxxZ_1Q.d.cts → operation-bridge-CoECSxfi.d.cts} +130 -245
  79. package/dist/{broadcaster-preparation-DMxxZ_1Q.d.ts → operation-bridge-CoECSxfi.d.ts} +130 -245
  80. package/dist/preparation-HUBTVCZE.js +404 -0
  81. package/dist/preparation-HUBTVCZE.js.map +1 -0
  82. package/dist/preparation-QD3ZSYV5.cjs +404 -0
  83. package/dist/preparation-QD3ZSYV5.cjs.map +1 -0
  84. package/dist/provenance-preparation-43DN2WK7.cjs +16 -0
  85. package/dist/provenance-preparation-43DN2WK7.cjs.map +1 -0
  86. package/dist/provenance-preparation-HEZE4L5H.js +16 -0
  87. package/dist/provenance-preparation-HEZE4L5H.js.map +1 -0
  88. package/dist/provenance.cjs +59 -0
  89. package/dist/provenance.cjs.map +1 -0
  90. package/dist/provenance.d.cts +34 -0
  91. package/dist/provenance.d.ts +34 -0
  92. package/dist/provenance.js +59 -0
  93. package/dist/provenance.js.map +1 -0
  94. package/dist/{receipt-logs-m0-bhaxW.d.ts → receipt-logs-DQRJK0l8.d.cts} +84 -78
  95. package/dist/{receipt-logs-CvC951p7.d.cts → receipt-logs-fMR6Bwql.d.ts} +84 -78
  96. package/dist/session-support.cjs +28 -7
  97. package/dist/session-support.cjs.map +1 -1
  98. package/dist/session-support.d.cts +71 -39
  99. package/dist/session-support.d.ts +71 -39
  100. package/dist/session-support.js +58 -37
  101. package/dist/session-support.js.map +1 -1
  102. package/package.json +22 -6
  103. package/dist/broadcaster-preparation-RMWQFYNL.js +0 -11
  104. package/dist/broadcaster-preparation-UGOTO4SX.cjs +0 -11
  105. package/dist/broadcaster-preparation-UGOTO4SX.cjs.map +0 -1
  106. package/dist/chunk-7F7ZZW3L.cjs.map +0 -1
  107. package/dist/chunk-EHP5TBC6.js +0 -3565
  108. package/dist/chunk-EHP5TBC6.js.map +0 -1
  109. package/dist/chunk-GTPUYPQL.js.map +0 -1
  110. package/dist/chunk-ITTGBIG2.js +0 -1877
  111. package/dist/chunk-ITTGBIG2.js.map +0 -1
  112. package/dist/chunk-J2JH6HIG.cjs +0 -1877
  113. package/dist/chunk-J2JH6HIG.cjs.map +0 -1
  114. package/dist/chunk-LOU7AP2B.cjs.map +0 -1
  115. package/dist/chunk-RHNIHI4P.cjs +0 -3565
  116. package/dist/chunk-RHNIHI4P.cjs.map +0 -1
  117. package/dist/chunk-XHKQ2BO2.js.map +0 -1
  118. /package/dist/{broadcaster-preparation-RMWQFYNL.js.map → broadcaster-7ZKKSTZQ.js.map} +0 -0
@@ -1,3565 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
- var _chunkJ2JH6HIGcjs = require('./chunk-J2JH6HIG.cjs');
12
-
13
-
14
-
15
- var _chunk7F7ZZW3Lcjs = require('./chunk-7F7ZZW3L.cjs');
16
-
17
- // src/transactions/records.ts
18
- function creditReservationKey(commitment) {
19
- return "credit:" + commitment;
20
- }
21
-
22
- // src/transactions/preparation/inputs.ts
23
- function inputFacts(plan) {
24
- const credit = plan.credit;
25
- const noteNullifiers = _nullishCoalesce(_nullishCoalesce(_optionalChain([plan, 'access', _2 => _2.params, 'optionalAccess', _3 => _3.nullifiers]), () => ( _optionalChain([credit, 'optionalAccess', _4 => _4.creation, 'optionalAccess', _5 => _5.nullifiers]))), () => ( []));
26
- let creditNullifiers = [];
27
- if (_optionalChain([credit, 'optionalAccess', _6 => _6.draw])) {
28
- creditNullifiers = credit.draw.nullifiers;
29
- } else if (_optionalChain([credit, 'optionalAccess', _7 => _7.topUp])) {
30
- creditNullifiers = [credit.topUp.creditNullifier];
31
- } else if (_optionalChain([credit, 'optionalAccess', _8 => _8.cancel])) {
32
- creditNullifiers = [credit.cancel.nullifier];
33
- }
34
- if (noteNullifiers.length !== plan.inputs.length || creditNullifiers.length !== (_nullishCoalesce(_optionalChain([credit, 'optionalAccess', _9 => _9.inputs, 'access', _10 => _10.length]), () => ( 0)))) {
35
- throw new Error("operation input statement count mismatch");
36
- }
37
- return [
38
- ...plan.inputs.map((input, index2) => ({
39
- key: input.commitment,
40
- reservationKey: input.commitment,
41
- nullifier: noteNullifiers[index2],
42
- kind: "notes"
43
- })),
44
- ...(_nullishCoalesce(_optionalChain([credit, 'optionalAccess', _11 => _11.inputs]), () => ( []))).map((input, index2) => ({
45
- key: input.commitment + ":" + input.role,
46
- reservationKey: creditReservationKey(input.commitment),
47
- nullifier: creditNullifiers[index2],
48
- kind: "credits"
49
- }))
50
- ];
51
- }
52
- function operationSources(plan) {
53
- const noteSources = _optionalChain([plan, 'access', _12 => _12.params, 'optionalAccess', _13 => _13.sources]);
54
- if (noteSources != null) return noteSources;
55
- const credit = plan.credit;
56
- if (_optionalChain([credit, 'optionalAccess', _14 => _14.topUp])) {
57
- return [...credit.topUp.creation.sources, credit.topUp.creditSource];
58
- }
59
- if (_optionalChain([credit, 'optionalAccess', _15 => _15.creation])) return credit.creation.sources;
60
- if (_optionalChain([credit, 'optionalAccess', _16 => _16.draw])) return credit.draw.sources;
61
- if (_optionalChain([credit, 'optionalAccess', _17 => _17.cancel])) return [credit.cancel.source];
62
- return [];
63
- }
64
-
65
- // src/gas/data/gas-benchmarks.json
66
- var gas_benchmarks_default = [
67
- {
68
- formatVersion: 1,
69
- id: "protocol-044e2ee-bc51dde071f1-prague-credit-real",
70
- deployment: {
71
- chainId: "31337",
72
- protocolAddress: "0x8a276b1F407e1273EDFf65e2f6292ee18dA68DD9",
73
- runtimeCodeHash: "0xf311c797d0296b13c1ef3f230bf4aadd621e38572f0c09a3f631b8edd0402ab4",
74
- tokenAddress: "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf"
75
- },
76
- source: {
77
- protocolCommit: "044e2ee9aeb9ba0e3dbd0630247495189e0405d4",
78
- measuredAt: "2026-11-05T09:54:05.044Z",
79
- chain: "Anvil 31337",
80
- hardfork: "prague",
81
- token: "MockERC20",
82
- verifier: "real",
83
- fingerprints: {
84
- protocolSourceSha256: "bc51dde071f1ac4616b3264305aeb2b04b52e0d13772625feed53fb5e8dae51b",
85
- dirtyDiffSha256: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
86
- compiledArtifactsSha256: "4900a39e94aeb31f686915bf8618efabf573b93365444db46a0bff3544741221",
87
- creditManifestSha256: "c27ff83889c3082b4c918bd63e15437881f0a6f12ed7f130312e1140873679fb",
88
- userManifestSha256: "9ef9d34d4459c2843d022712093216142e3eacdd1467d2382a6a68ad36c33b8f",
89
- sdkSourceSha256: "0f2fe2deda57196d3736964c8e2caea6d4975d2c246cb6d11edbb6c4b5eeead6"
90
- },
91
- toolchain: {
92
- solidity: "0.8.38",
93
- barretenberg: "6.0.0",
94
- noir: "1.0.0-rc.6",
95
- evmVersion: "prague",
96
- optimizerRuns: 200,
97
- anvil: "anvil Version: 1.8.6"
98
- },
99
- blockGasLimit: "500000000",
100
- runtimeContracts: {
101
- transact_user_slots14_direct_Verifier: {
102
- address: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
103
- runtimeCodeHash: "0x42d1932097f18874242d98855b2fc167471ba84dd122ab3744996dd64320f675"
104
- },
105
- "transact_user_slots14-adapter": {
106
- address: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
107
- runtimeCodeHash: "0x876f0e43fc1d24475c0c63ee8c7907427d534b0c604f5985aacd28ee2c6d1b12"
108
- },
109
- transact_user_slots56_direct_Verifier: {
110
- address: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
111
- runtimeCodeHash: "0xefca4a7ee5382b0f2029571f6781f2ade7ac698906c32d3e49f10def631e7882"
112
- },
113
- "transact_user_slots56-adapter": {
114
- address: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
115
- runtimeCodeHash: "0x945680c4278b61c07bf07fa7637908e9a38ccd414c9330bf23b3c41119ea0de6"
116
- },
117
- transact_user_slots112_direct_Verifier: {
118
- address: "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
119
- runtimeCodeHash: "0xfbf97cd940123ab3e81ce55283efb48b55ddaa95423fff4d0d648b248f4e196b"
120
- },
121
- "transact_user_slots112-adapter": {
122
- address: "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
123
- runtimeCodeHash: "0xac129aa749b7ece8c51ed68f4f0afcc82a1cbd7b2a01f5ff7ff7de1dcde21b1e"
124
- },
125
- transact_user_slots168_direct_Verifier: {
126
- address: "0x0165878A594ca255338adfa4d48449f69242Eb8F",
127
- runtimeCodeHash: "0x7ee9799d55001f74c8d88179dd0247b3de932516f975605ba248b52e7ba540c8"
128
- },
129
- "transact_user_slots168-adapter": {
130
- address: "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853",
131
- runtimeCodeHash: "0x24b5ea6f436b90b3821bd0ea4872fb205c996fd74f1546bc1086d98b7ec5d87d"
132
- },
133
- transact_aggregate_14_4_Verifier: {
134
- address: "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6",
135
- runtimeCodeHash: "0xae41039ded63fa7777c99a2552ba603a3a4d9703d464079dff787dab6893ef24"
136
- },
137
- "transact_aggregate_14_4-adapter": {
138
- address: "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318",
139
- runtimeCodeHash: "0xf4e86e9b2001f5972ce00f7fcd5a01deb9bfe5d676e437e74135ee7036469ca3"
140
- },
141
- transact_aggregate_14_8_Verifier: {
142
- address: "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
143
- runtimeCodeHash: "0x089f476f56fb1003586b18c0b5a75f9d24c76d4804d84ea202005371eae333de"
144
- },
145
- "transact_aggregate_14_8-adapter": {
146
- address: "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
147
- runtimeCodeHash: "0xc40142342902da65f45bb995724b129389e3505c283d7209a6c29bf27521c363"
148
- },
149
- transact_aggregate_14_12_Verifier: {
150
- address: "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0",
151
- runtimeCodeHash: "0xe0cba79e66fdb75dbc082ef0f938b07e4d38acce283b87869fe414083b3e08b0"
152
- },
153
- "transact_aggregate_14_12-adapter": {
154
- address: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
155
- runtimeCodeHash: "0x155bfc9367a6f3c96ac9b4d1dc1d0358a4046b584a9a1322a9582557ea691ff4"
156
- },
157
- create_credit_direct_Verifier: {
158
- address: "0x9A676e781A523b5d0C0e43731313A708CB607508",
159
- runtimeCodeHash: "0xbc88c374cc3c0c1e2cdf8663cee4c960f3a3ba4b210e2c520ca111e56461b23a"
160
- },
161
- "create_credit-adapter": {
162
- address: "0x0B306BF915C4d645ff596e518fAf3F9669b97016",
163
- runtimeCodeHash: "0xfd39446d56c189fbb35c0906e525433b6b9c63444c97b13990b7dd6f19bd38fc"
164
- },
165
- credit_draw_slots1_direct_Verifier: {
166
- address: "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
167
- runtimeCodeHash: "0x47be80e72c3a22ea044638f6004de8c3a0264d5a0d17189c01153cdabfd7bab6"
168
- },
169
- "credit_draw_slots1-adapter": {
170
- address: "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
171
- runtimeCodeHash: "0x73a2af387b45cecf383b90f4cebb54b263f621a5038da947944c54f1089ba288"
172
- },
173
- credit_draw_slots12_direct_Verifier: {
174
- address: "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
175
- runtimeCodeHash: "0x244d9ba22f5c736c2a5c42c466701e2a8ba7ae8108665133541026ea45d56e04"
176
- },
177
- "credit_draw_slots12-adapter": {
178
- address: "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
179
- runtimeCodeHash: "0x63c200eae61218b865f3c8b418bf0887da7a70ebf41f55825e4750c36a1d1914"
180
- },
181
- credit_draw_slots50_direct_Verifier: {
182
- address: "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d",
183
- runtimeCodeHash: "0x2ad5eb64bcfae34ef04111dd8f9c1ffc5fc8aa6c1ad3a65d8da78233f3390660"
184
- },
185
- "credit_draw_slots50-adapter": {
186
- address: "0x59b670e9fA9D0A427751Af201D676719a970857b",
187
- runtimeCodeHash: "0x1716df69f1eb1c1db485bc3ba4a4ed5a1009275c9058a9e96b28ab3431a6c006"
188
- },
189
- credit_draw_slots120_direct_Verifier: {
190
- address: "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1",
191
- runtimeCodeHash: "0x523b6d211618bbd33d708f8198b9f3daafc10e2fa7a6a857db5795ed748a24e4"
192
- },
193
- "credit_draw_slots120-adapter": {
194
- address: "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44",
195
- runtimeCodeHash: "0x32d875eb4f4c27252fa958971b66e1fdff8c02adb007fea2bf31eee4b851a132"
196
- },
197
- credit_cancel_direct_Verifier: {
198
- address: "0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f",
199
- runtimeCodeHash: "0x4058133b7ecd31fe06749bfa3107ad0fbcdc9bf72d3b9cbf4dbd2b2f65be6d35"
200
- },
201
- "credit_cancel-adapter": {
202
- address: "0x4A679253410272dd5232B3Ff7cF5dbB88f295319",
203
- runtimeCodeHash: "0x0f570794fb4b7f15a791c59c760732d9f9408d1e3bea881ba7c5b76b36fb4e9b"
204
- },
205
- credit_top_up_direct_Verifier: {
206
- address: "0x7a2088a1bFc9d81c55368AE168C2C02570cB814F",
207
- runtimeCodeHash: "0x7ada3623c851a9cfba7863a75f4fa289d747040f1a822510eefecc53d70180cd"
208
- },
209
- "credit_top_up-adapter": {
210
- address: "0x09635F643e140090A9A8Dcd712eD6285858ceBef",
211
- runtimeCodeHash: "0x23bba4eca8306f4bc02ead10449775a359beeed2065ea8c84da4dc6b9e4dfc82"
212
- },
213
- PrivateTransferVerifierRegistry: {
214
- address: "0xc5a5C42992dECbae36851359345FE25997F5C42d",
215
- runtimeCodeHash: "0xbc74aacbc22d853cb50fe2041f20014e644fa8f83e06f51656b4667f1da164bc"
216
- },
217
- CrossTreeVerifierRegistry: {
218
- address: "0x67d269191c92Caf3cD7723F116c85e6E9bf55933",
219
- runtimeCodeHash: "0x818ce6a634a11cdd9913873d3a265254dda45b490431ad1636373237e2685ba1"
220
- },
221
- DualVerifierRouter: {
222
- address: "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
223
- runtimeCodeHash: "0xb3bdc1aa5a6e4eac85e3651615c7942c5565f0593d79bacccb19b5aa587548ca"
224
- },
225
- AtomicBatchOutputLib: {
226
- address: "0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690",
227
- runtimeCodeHash: "0xef68c4a35a62fbbb4d0918f1612f0ffd9d250c9ceefd38e59e9c8ef042addb45"
228
- },
229
- FundingLib: {
230
- address: "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
231
- runtimeCodeHash: "0x36f4e6d20cf7ca1b221dad34bc34ed7b8540c0e774c594652048822272e6bb52"
232
- },
233
- PrivateTransferLib: {
234
- address: "0x9E545E3C0baAB3E08CdfD552C960A1050f373042",
235
- runtimeCodeHash: "0x1e538d13c68b2a7a2f605466cd7c09c166b904476a6b5b372f8b9b45d9de9a62"
236
- },
237
- CrossTreeTransferLib: {
238
- address: "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
239
- runtimeCodeHash: "0x9ec892d5a5d1c38e3218c7d38c74bd63034641cc458a195ec63c6a50f67ded25"
240
- },
241
- AggregateTransferLib: {
242
- address: "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8",
243
- runtimeCodeHash: "0x2c01c84317448e4786e7a7b9c06f6f3b4990354f151ae6914cdb75d8b7ebe881"
244
- },
245
- CreateCreditLib: {
246
- address: "0x851356ae760d987E095750cCeb3bC6014560891C",
247
- runtimeCodeHash: "0x8b28e626c6a0f41179880773a48681362a05e0eee12193d1641ae5bb625fe960"
248
- },
249
- CreditLifecycleLib: {
250
- address: "0xf5059a5D33d5853360D16C683c16e67980206f36",
251
- runtimeCodeHash: "0xa177a7f1dfb69cf2d6eea899ef8170959587b8cb3c60559c3b2cecf62309bfc4"
252
- },
253
- ShieldLib: {
254
- address: "0x95401dc811bb5740090279Ba06cfA8fcF6113778",
255
- runtimeCodeHash: "0xfde7bbf1c02e17ab2d9fc9849fc282b29ac1db86378eec27f3a006d7484aa768"
256
- },
257
- InvisiFactory: {
258
- address: "0x998abeb3E57409262aE5b751f60747921B33613E",
259
- runtimeCodeHash: "0x9055356390e48564adeca0065b12698a5d09451960af97ad2f5c2e450cb9c84c"
260
- },
261
- InvisiAddressRegistry: {
262
- address: "0x70e0bA845a1A0F2DA3359C97E0285013525FFC49",
263
- runtimeCodeHash: "0x007da3f4e888366ba0eed52cd511c4a369359291387ad19ca37e89eb395fce30"
264
- },
265
- InvisiProtocol: {
266
- address: "0x8a276b1F407e1273EDFf65e2f6292ee18dA68DD9",
267
- runtimeCodeHash: "0xf311c797d0296b13c1ef3f230bf4aadd621e38572f0c09a3f631b8edd0402ab4"
268
- },
269
- MockERC20: {
270
- address: "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf",
271
- runtimeCodeHash: "0xf7f676b5c54f6e94f82f0de65a0117468a0d915e8a79d150e74f76bd6d7f708b"
272
- }
273
- },
274
- assumptions: [
275
- "normal CREATE/Factory deployment and fresh registry; EIP170/EIP3860 unchanged; no code/storage injection",
276
- "Solidity0.8.38 optimizer200 Prague; pinned BB6.0.0 real verifiers; every native proof independently verified",
277
- "one physical source tree and 123 existing leaves shared by every sample; top-up has two authenticated source groups; no rollover or screener",
278
- "funding/approvals/121 genuine Credit seeds/usage-seed draw/payout reset excluded from business gas",
279
- "each round restores identical token balances, exact caller allowance100, note cursor, nullifiers and baseline; spender payout starts zero; broadcasterFee0",
280
- "complete receipt.gasUsed is measured, including verifier/calldata/logging/output insertion; memo0",
281
- "Prague local block gas limit500000000; measured transactions may be unmineable under lower network transaction/block limits",
282
- "observed three-sample ranges are neither a confidence interval nor a recommended transaction gas limit"
283
- ]
284
- },
285
- measurements: [
286
- {
287
- id: "create-credit-caller-0x0",
288
- shape: {
289
- kind: "create-credit",
290
- target: "evm",
291
- capacity: 10,
292
- noteInputs: 0,
293
- noteOutputs: 0,
294
- sourceTrees: 0,
295
- creditInputs: 0,
296
- creditOutputs: 1,
297
- creditRemainders: 0,
298
- funding: "caller",
299
- permit: false,
300
- deliveryBytes: 1132
301
- },
302
- circuit: {
303
- circuitName: "create_credit",
304
- target: "evm",
305
- artifactSha256: "16a41fd585d5f925e4e93fd6a308e1ca8c90ea287778871cb0d214f0d0e223ce",
306
- vkSha256: "e8d3dc1f6922dbe1a0aa6016e65664be28d7005180ee943a4b237ac5518971bb"
307
- },
308
- samples: [
309
- {
310
- gasUsed: "1577203",
311
- transactionHash: "0xf0532b598b3e3716709ff7aab549f95775ac0587c2f7cd0203f1a07cc32b46fc",
312
- blockNumber: "172",
313
- blockHash: "0x61f3ac4cb127a29dc679067666d91e3c123fda2fe8a149e46992d0581de6dbc6",
314
- calldataBytes: 11844
315
- },
316
- {
317
- gasUsed: "1577191",
318
- transactionHash: "0xcd1718bea7c432458c18f4215c36fa95ad5da0242fad67f1daaa33344518ae05",
319
- blockNumber: "172",
320
- blockHash: "0x08215dac6d5558f7ec753df9f66b3a03c7071b7c85b650ba170f621895ea53be",
321
- calldataBytes: 11844
322
- },
323
- {
324
- gasUsed: "1577203",
325
- transactionHash: "0xfd07f0fb37c58e302100fb533f946d8fae09514e53181666efc346313c758224",
326
- blockNumber: "172",
327
- blockHash: "0x5b1ac84931e9343276e5241088041bac0d07f1d7eced2b335eeccfe1a266d05d",
328
- calldataBytes: 11844
329
- }
330
- ]
331
- },
332
- {
333
- id: "create-credit-1x1",
334
- shape: {
335
- kind: "create-credit",
336
- target: "evm",
337
- capacity: 10,
338
- noteInputs: 1,
339
- noteOutputs: 1,
340
- sourceTrees: 1,
341
- creditInputs: 0,
342
- creditOutputs: 1,
343
- creditRemainders: 0,
344
- funding: "none",
345
- permit: false,
346
- deliveryBytes: 1360
347
- },
348
- circuit: {
349
- circuitName: "create_credit",
350
- target: "evm",
351
- artifactSha256: "16a41fd585d5f925e4e93fd6a308e1ca8c90ea287778871cb0d214f0d0e223ce",
352
- vkSha256: "e8d3dc1f6922dbe1a0aa6016e65664be28d7005180ee943a4b237ac5518971bb"
353
- },
354
- samples: [
355
- {
356
- gasUsed: "1673934",
357
- transactionHash: "0x267c40c655eaf82407bd9dcf4413a0e3ee991a39e2bf9f28506eb761d8eaf8ea",
358
- blockNumber: "172",
359
- blockHash: "0x137299123d2f9e8bae9f56f5f6e66f6020d41cc6e2397071458fb28abdc1d6b5",
360
- calldataBytes: 12196
361
- },
362
- {
363
- gasUsed: "1673898",
364
- transactionHash: "0x967d376d819fb00d0d52fb28ca8b3c1fce10e7ac9ff0314772c8d367b51b2e52",
365
- blockNumber: "172",
366
- blockHash: "0x16992b27d6bec5d87d6f2488ea31ad232b48dc0fd2effb724e312ddf83dd84f8",
367
- calldataBytes: 12196
368
- },
369
- {
370
- gasUsed: "1673994",
371
- transactionHash: "0xd474a561f35e353f446d312aba4338011f6a1765e5019cd839498ade1b2c8ad4",
372
- blockNumber: "172",
373
- blockHash: "0xdd2ff761b339b033dd11b462585cf747fdf97f6c304a66ddd1344d2421b790ae",
374
- calldataBytes: 12196
375
- }
376
- ]
377
- },
378
- {
379
- id: "draw-credit-1-partial",
380
- shape: {
381
- kind: "draw-credit",
382
- target: "evm",
383
- capacity: 1,
384
- noteInputs: 0,
385
- noteOutputs: 0,
386
- sourceTrees: 1,
387
- creditInputs: 1,
388
- creditOutputs: 1,
389
- creditRemainders: 1,
390
- funding: "none",
391
- permit: false,
392
- deliveryBytes: 1132
393
- },
394
- circuit: {
395
- circuitName: "credit_draw_slots1",
396
- target: "evm",
397
- artifactSha256: "4542b227e0552b45c302f1dace21cadeba4962c96244e021472f1f7531cff8d1",
398
- vkSha256: "43c051a2bedf9454c12e70b10156361e414944823ba23e80662c16c7ced0a2ce"
399
- },
400
- samples: [
401
- {
402
- gasUsed: "1587992",
403
- transactionHash: "0x7eecfe45066881f2e3a39d4d016e5234793a3927056ec51e5772661a7b0b8bd2",
404
- blockNumber: "172",
405
- blockHash: "0x4c6dd7f24673ec5e8f2bc6303827e3329f3b73d37043a638ed1bd4655282fa6a",
406
- calldataBytes: 11588
407
- },
408
- {
409
- gasUsed: "1587992",
410
- transactionHash: "0xb196e4ce260287d68a8ef8e072605f2cfb97e299e1ed3d8654ff33560a29a34d",
411
- blockNumber: "172",
412
- blockHash: "0x600aeaf1ca61fe7e4eb39dd8b618f696ba4b6a18a867232af62296c1fc7a24c0",
413
- calldataBytes: 11588
414
- },
415
- {
416
- gasUsed: "1587848",
417
- transactionHash: "0x14de44b3d363a129e8404c1e068d54098ccaf409bc0aaa142a962de94bc21825",
418
- blockNumber: "172",
419
- blockHash: "0x5312304c773a695984e22ff3eb08c4ca6f022e6e6bc8d7706012846ce8ac4f7c",
420
- calldataBytes: 11588
421
- }
422
- ]
423
- },
424
- {
425
- id: "draw-credit-1-full",
426
- shape: {
427
- kind: "draw-credit",
428
- target: "evm",
429
- capacity: 1,
430
- noteInputs: 0,
431
- noteOutputs: 0,
432
- sourceTrees: 1,
433
- creditInputs: 1,
434
- creditOutputs: 0,
435
- creditRemainders: 0,
436
- funding: "none",
437
- permit: false,
438
- deliveryBytes: 0
439
- },
440
- circuit: {
441
- circuitName: "credit_draw_slots1",
442
- target: "evm",
443
- artifactSha256: "4542b227e0552b45c302f1dace21cadeba4962c96244e021472f1f7531cff8d1",
444
- vkSha256: "43c051a2bedf9454c12e70b10156361e414944823ba23e80662c16c7ced0a2ce"
445
- },
446
- samples: [
447
- {
448
- gasUsed: "1043043",
449
- transactionHash: "0xfc91b84385a2f69bc253f0f486aa171a4911edd3041647b3758b44c0102c7c2f",
450
- blockNumber: "172",
451
- blockHash: "0x96f83ea8e57ebf1b8572bfbcb6285b8a57c894be0e3134e0c2b24dc44262fb07",
452
- calldataBytes: 10372
453
- },
454
- {
455
- gasUsed: "1043043",
456
- transactionHash: "0xddf613a92d05c1b80cf9074a0484fdbf3a2bfd94555b0d9c266fdfbe2661ed59",
457
- blockNumber: "172",
458
- blockHash: "0x27b36ebdd105eeb91be849f002816030377ea2e892fb7e1462509aa7b8632e6f",
459
- calldataBytes: 10372
460
- },
461
- {
462
- gasUsed: "1043091",
463
- transactionHash: "0x6df6942fafe1ef79c963b912206bd57443c90f9c8398e5529baf39d438a15b78",
464
- blockNumber: "172",
465
- blockHash: "0x95af3836c6fe01edbc70bab01ba2e844d0e8fdf9e03884ea5a9d569fd585ee81",
466
- calldataBytes: 10372
467
- }
468
- ]
469
- },
470
- {
471
- id: "draw-credit-12-partial",
472
- shape: {
473
- kind: "draw-credit",
474
- target: "evm",
475
- capacity: 12,
476
- noteInputs: 0,
477
- noteOutputs: 0,
478
- sourceTrees: 1,
479
- creditInputs: 12,
480
- creditOutputs: 12,
481
- creditRemainders: 12,
482
- funding: "none",
483
- permit: false,
484
- deliveryBytes: 13584
485
- },
486
- circuit: {
487
- circuitName: "credit_draw_slots12",
488
- target: "evm",
489
- artifactSha256: "dd72b0867fc3be7cd90de263bd2d0892075cb18eb4f6dd671b13111710f10369",
490
- vkSha256: "5e31d771e6294993736078596d9c69f21fe7595eda50e3cce6d7406b65cf1443"
491
- },
492
- samples: [
493
- {
494
- gasUsed: "3099088",
495
- transactionHash: "0x8a760b052eb9354ef7fd539ab21105ddec51feb6b4b9c51a73a139ac4f9bc1fe",
496
- blockNumber: "172",
497
- blockHash: "0x5f29a09258dbebafa6fa286c0a1d286bb54694df2e8bd7e7f0e1c9db26b53401",
498
- calldataBytes: 30276
499
- },
500
- {
501
- gasUsed: "3099004",
502
- transactionHash: "0x4af726505fdf1cdcb053d45cce369ff2a17a023b497b438206f232577f52a721",
503
- blockNumber: "172",
504
- blockHash: "0x762f0616f93335375441b637c545c4691e7ba09fae40952a220ef00a67198a87",
505
- calldataBytes: 30276
506
- },
507
- {
508
- gasUsed: "3099136",
509
- transactionHash: "0xf27042c34b5e7c0e0bfc2e7c6c1e3dcd5b24c98b09c91ab73d156a2d0e474698",
510
- blockNumber: "172",
511
- blockHash: "0xa7bde9fc7b6fe8e9a9082f4ae597f73608ad9ced3d670506b29584b2c67ab496",
512
- calldataBytes: 30276
513
- }
514
- ]
515
- },
516
- {
517
- id: "draw-credit-12-full",
518
- shape: {
519
- kind: "draw-credit",
520
- target: "evm",
521
- capacity: 12,
522
- noteInputs: 0,
523
- noteOutputs: 0,
524
- sourceTrees: 1,
525
- creditInputs: 12,
526
- creditOutputs: 0,
527
- creditRemainders: 0,
528
- funding: "none",
529
- permit: false,
530
- deliveryBytes: 0
531
- },
532
- circuit: {
533
- circuitName: "credit_draw_slots12",
534
- target: "evm",
535
- artifactSha256: "dd72b0867fc3be7cd90de263bd2d0892075cb18eb4f6dd671b13111710f10369",
536
- vkSha256: "5e31d771e6294993736078596d9c69f21fe7595eda50e3cce6d7406b65cf1443"
537
- },
538
- samples: [
539
- {
540
- gasUsed: "1537560",
541
- transactionHash: "0x6c78554a23c04c179a16a9da6c401f0097c02833d8e1c4a3cdeb79107c028333",
542
- blockNumber: "172",
543
- blockHash: "0xf463ea49ed0328a93b53bc796ff2e0dd46201cd3fee06e6fff160dbb95fe0654",
544
- calldataBytes: 15684
545
- },
546
- {
547
- gasUsed: "1537620",
548
- transactionHash: "0x8097a25c8c2ebced9bfa1baf39e128741e486ed5f7e23aed33ff03b280ac5a7f",
549
- blockNumber: "172",
550
- blockHash: "0xb121edc36419facbb33f4ca69021bcd71ab6f412664591edf040ac6558b44507",
551
- calldataBytes: 15684
552
- },
553
- {
554
- gasUsed: "1537560",
555
- transactionHash: "0x0a8311777aa63d9239647a14da359672f126c7aa306148d6f44f19eff48dab29",
556
- blockNumber: "172",
557
- blockHash: "0x065a0f3dd444525a0bed28045e978e3ba74c820eda5ecc488d04e83f416ab4f0",
558
- calldataBytes: 15684
559
- }
560
- ]
561
- },
562
- {
563
- id: "draw-credit-50-partial",
564
- shape: {
565
- kind: "draw-credit",
566
- target: "evm",
567
- capacity: 50,
568
- noteInputs: 0,
569
- noteOutputs: 0,
570
- sourceTrees: 1,
571
- creditInputs: 50,
572
- creditOutputs: 50,
573
- creditRemainders: 50,
574
- funding: "none",
575
- permit: false,
576
- deliveryBytes: 56600
577
- },
578
- circuit: {
579
- circuitName: "credit_draw_slots50",
580
- target: "evm",
581
- artifactSha256: "09c7469866748b4c0c4bbf2b040844771948a170999f6dc7a38fe5c0ecda4054",
582
- vkSha256: "7b613225b6f32a077011d4196c356e836d22dcd116efe687fde53144fbd8db9f"
583
- },
584
- samples: [
585
- {
586
- gasUsed: "7998858",
587
- transactionHash: "0x35a5ff5940aa7939214f82471b8d73531c07b1fcaa543bf31b0f7c1c91db73e2",
588
- blockNumber: "172",
589
- blockHash: "0x74175711e91a10d93a426d0ef778f12a15793ff5f8f9d8b397057e7cb4e27975",
590
- calldataBytes: 94276
591
- },
592
- {
593
- gasUsed: "7998498",
594
- transactionHash: "0x5e7a948f90e0d37a068d2904d5c1233b0ad6ecda632ef6968f4ec81daa3e932b",
595
- blockNumber: "172",
596
- blockHash: "0x8b348e78bbce768f9b44d55c43017b08ae0720cf010b923d658e4150bc4bd41f",
597
- calldataBytes: 94276
598
- },
599
- {
600
- gasUsed: "7998498",
601
- transactionHash: "0xf3d92e00b47c5d1c888f98c038b1dbac1986888fabbb40690762b0e9eea6b923",
602
- blockNumber: "172",
603
- blockHash: "0x1ae727d66e31623abc741d7e5c62db4197c6238fc73a6c0984725b1dee43b9b0",
604
- calldataBytes: 94276
605
- }
606
- ]
607
- },
608
- {
609
- id: "draw-credit-50-full",
610
- shape: {
611
- kind: "draw-credit",
612
- target: "evm",
613
- capacity: 50,
614
- noteInputs: 0,
615
- noteOutputs: 0,
616
- sourceTrees: 1,
617
- creditInputs: 50,
618
- creditOutputs: 0,
619
- creditRemainders: 0,
620
- funding: "none",
621
- permit: false,
622
- deliveryBytes: 0
623
- },
624
- circuit: {
625
- circuitName: "credit_draw_slots50",
626
- target: "evm",
627
- artifactSha256: "09c7469866748b4c0c4bbf2b040844771948a170999f6dc7a38fe5c0ecda4054",
628
- vkSha256: "7b613225b6f32a077011d4196c356e836d22dcd116efe687fde53144fbd8db9f"
629
- },
630
- samples: [
631
- {
632
- gasUsed: "3220161",
633
- transactionHash: "0xadd94db9328f43891fc6cb9c788415319c95a98bcd8b98e2a245d3ba07c1f20a",
634
- blockNumber: "172",
635
- blockHash: "0x257deb859f7a2c14ef38cb32797b6d0278b25ce2c7cd75ccf81f0c00a1b97250",
636
- calldataBytes: 33476
637
- },
638
- {
639
- gasUsed: "3219933",
640
- transactionHash: "0xe631bbd7681d42974d3b1b25f6e0c7602d32196253f6cee4dc67b5e87929132f",
641
- blockNumber: "172",
642
- blockHash: "0xafee3915573a0316c9df0f1a56b7a4c4ff8652e74c3890f851ef351e7faedbf3",
643
- calldataBytes: 33476
644
- },
645
- {
646
- gasUsed: "3219897",
647
- transactionHash: "0xfb3807a266b2bfa971b87b3820b6eba6ab968f1028b1d77c9fbcb19177fb7319",
648
- blockNumber: "172",
649
- blockHash: "0xe6310300cca8b021fd969b27392eae58c21a9c15e071ff8836e42e6490265c0c",
650
- calldataBytes: 33476
651
- }
652
- ]
653
- },
654
- {
655
- id: "draw-credit-120-partial",
656
- shape: {
657
- kind: "draw-credit",
658
- target: "evm",
659
- capacity: 120,
660
- noteInputs: 0,
661
- noteOutputs: 0,
662
- sourceTrees: 1,
663
- creditInputs: 120,
664
- creditOutputs: 120,
665
- creditRemainders: 120,
666
- funding: "none",
667
- permit: false,
668
- deliveryBytes: 135840
669
- },
670
- circuit: {
671
- circuitName: "credit_draw_slots120",
672
- target: "evm",
673
- artifactSha256: "6ccd0366a669c50fd5da875c3eae194fe8aa4c36d35a5f9ebfd64636ea599b48",
674
- vkSha256: "d715848afc5c1ecdfcef5ed5026865abef5040a3bc232fd65330a5ffee8475fb"
675
- },
676
- samples: [
677
- {
678
- gasUsed: "17418369",
679
- transactionHash: "0xfab5aadd357ae6105c153dcc98aee2df80a5b46bd911dab0bd457c5440c0e9bb",
680
- blockNumber: "172",
681
- blockHash: "0xa277729db5ab154b10f2a0c6daa2540f66de7f81e05a289f2f057fef30e43275",
682
- calldataBytes: 211140
683
- },
684
- {
685
- gasUsed: "17418537",
686
- transactionHash: "0xa3d1311b426b88808cd9a5403ecd36c3aea806ac7e2089e6aa22eba7f82e80f6",
687
- blockNumber: "172",
688
- blockHash: "0x1abf2a9ae3d60f84947bce8449d3ee19e6542a14c6bb1dcde4d37c4df9ab6dfc",
689
- calldataBytes: 211140
690
- },
691
- {
692
- gasUsed: "17417949",
693
- transactionHash: "0x6c7e3735c0d30d2b1897bbacd1a85d8534b714564c87449d1c66fb7b96aebf19",
694
- blockNumber: "172",
695
- blockHash: "0x17bbc7923c075a1beaf345fbe768629d1c895a32835343640ecb5f7a48da18ab",
696
- calldataBytes: 211140
697
- }
698
- ]
699
- },
700
- {
701
- id: "draw-credit-120-full",
702
- shape: {
703
- kind: "draw-credit",
704
- target: "evm",
705
- capacity: 120,
706
- noteInputs: 0,
707
- noteOutputs: 0,
708
- sourceTrees: 1,
709
- creditInputs: 120,
710
- creditOutputs: 0,
711
- creditRemainders: 0,
712
- funding: "none",
713
- permit: false,
714
- deliveryBytes: 0
715
- },
716
- circuit: {
717
- circuitName: "credit_draw_slots120",
718
- target: "evm",
719
- artifactSha256: "6ccd0366a669c50fd5da875c3eae194fe8aa4c36d35a5f9ebfd64636ea599b48",
720
- vkSha256: "d715848afc5c1ecdfcef5ed5026865abef5040a3bc232fd65330a5ffee8475fb"
721
- },
722
- samples: [
723
- {
724
- gasUsed: "6297541",
725
- transactionHash: "0x0e8e80524d7c23a263ad9ed122bb61e5a1ab19285585ac402b7206d87abaf067",
726
- blockNumber: "172",
727
- blockHash: "0x7ee829303eaaffc7823238e99e83304ccfd3ba349c64fecdee00b882fe39f854",
728
- calldataBytes: 65220
729
- },
730
- {
731
- gasUsed: "6297661",
732
- transactionHash: "0x98f2be383f19b1b17f86c6d365abe86655163b7846c29e5614667ab0e2823bc8",
733
- blockNumber: "172",
734
- blockHash: "0x3738cef2d40552677299002974043a4355f37d1d76575ee52fc4fe6b6e0c33dd",
735
- calldataBytes: 65220
736
- },
737
- {
738
- gasUsed: "6297613",
739
- transactionHash: "0xb574546b0aacd7d6910e25a2a749aad7f009ed725618763c6229ee7a99fd811e",
740
- blockNumber: "172",
741
- blockHash: "0x26a15b914134d2f5d5597d632328d368888f3d3076b486231345bb20a4749230",
742
- calldataBytes: 65220
743
- }
744
- ]
745
- },
746
- {
747
- id: "top-up-credit-1x1-unchanged-limits",
748
- shape: {
749
- kind: "top-up-credit",
750
- target: "evm",
751
- capacity: 10,
752
- noteInputs: 1,
753
- noteOutputs: 1,
754
- sourceTrees: 2,
755
- creditInputs: 1,
756
- creditOutputs: 1,
757
- creditRemainders: 0,
758
- funding: "none",
759
- permit: false,
760
- deliveryBytes: 1360
761
- },
762
- circuit: {
763
- circuitName: "credit_top_up",
764
- target: "evm",
765
- artifactSha256: "3004eea1c26ec8e33f8fc9ee171a3b6af250682efb607f7003ae58f8327998ab",
766
- vkSha256: "b7f378a871a27649c3f7fd1af554c8f87d99bcf0780b21972e910212ed4e5a0d"
767
- },
768
- samples: [
769
- {
770
- gasUsed: "1714625",
771
- transactionHash: "0x5cebd593124a22bfeac5d22ea51735fedbf409f61e42abd1f398c1b907f4b192",
772
- blockNumber: "172",
773
- blockHash: "0x04b820b1ac7b4697cc16e2d29e5ba8b530906b6fa5e75da2b022b0a5851cf150",
774
- calldataBytes: 12356
775
- },
776
- {
777
- gasUsed: "1714697",
778
- transactionHash: "0xd4506ce267c635552b112ee7d304d45433c34d938baf95a46241b88c33f7e57e",
779
- blockNumber: "172",
780
- blockHash: "0xe7424e20b69104ccf5d407ceb8d72a8fbd3a73ea76fea15c59d8a6e9f0ff3909",
781
- calldataBytes: 12356
782
- },
783
- {
784
- gasUsed: "1714577",
785
- transactionHash: "0xcf1af44b92f6fa4a46962ece6cbd9216db16438b0ce3320c78f62a59d8753875",
786
- blockNumber: "172",
787
- blockHash: "0x8a4e50a429190ed3f3d33c8863682d989bdf553cb5e0d961ebd9283f19b1aeea",
788
- calldataBytes: 12356
789
- }
790
- ]
791
- },
792
- {
793
- id: "top-up-credit-1x1-changed-limits",
794
- shape: {
795
- kind: "top-up-credit",
796
- target: "evm",
797
- capacity: 10,
798
- noteInputs: 1,
799
- noteOutputs: 1,
800
- sourceTrees: 2,
801
- creditInputs: 1,
802
- creditOutputs: 1,
803
- creditRemainders: 0,
804
- funding: "none",
805
- permit: false,
806
- deliveryBytes: 1360
807
- },
808
- circuit: {
809
- circuitName: "credit_top_up",
810
- target: "evm",
811
- artifactSha256: "3004eea1c26ec8e33f8fc9ee171a3b6af250682efb607f7003ae58f8327998ab",
812
- vkSha256: "b7f378a871a27649c3f7fd1af554c8f87d99bcf0780b21972e910212ed4e5a0d"
813
- },
814
- samples: [
815
- {
816
- gasUsed: "1714697",
817
- transactionHash: "0xa35c6efd60b27de672329ca9b8f05bb076f8d4e2505ee94a95387e097f9a967b",
818
- blockNumber: "172",
819
- blockHash: "0x1dd5c7d5206498ad08edcbaa5ba2002560008a6caff12383a14e3733718f0814",
820
- calldataBytes: 12356
821
- },
822
- {
823
- gasUsed: "1714637",
824
- transactionHash: "0xf8d23c58fa9030fc891c27e45b9bd5905a8b0fe065b83803dbf0239441b64a72",
825
- blockNumber: "172",
826
- blockHash: "0xc30c6143900dad39d793dc13065fd9c8f1c2e4f77fd350f9a4b3c7eea930c840",
827
- calldataBytes: 12356
828
- },
829
- {
830
- gasUsed: "1714709",
831
- transactionHash: "0xed72962263a722fcc0d8cb4218579d161dba700c490258c8b0e35a86c574b49e",
832
- blockNumber: "172",
833
- blockHash: "0x227f3f3fc06e7263168584b1e23d0f722a3255ec818570e76fd36ee4423efcfd",
834
- calldataBytes: 12356
835
- }
836
- ]
837
- },
838
- {
839
- id: "cancel-credit-1",
840
- shape: {
841
- kind: "cancel-credit",
842
- target: "evm",
843
- capacity: 1,
844
- noteInputs: 0,
845
- noteOutputs: 0,
846
- sourceTrees: 1,
847
- creditInputs: 1,
848
- creditOutputs: 0,
849
- creditRemainders: 0,
850
- funding: "none",
851
- permit: false,
852
- deliveryBytes: 0
853
- },
854
- circuit: {
855
- circuitName: "credit_cancel",
856
- target: "evm",
857
- artifactSha256: "6485609280fe5a3d44ca9f1865b29b44253b3d2cd49770d000e7bb7a3db8e65d",
858
- vkSha256: "d74cf842d204cdf271c06a69482ddff11568e89630346b634d486205bec4bd9e"
859
- },
860
- samples: [
861
- {
862
- gasUsed: "988734",
863
- transactionHash: "0x6a029f228817b397197ad191ec2f4d8e17e004c5c93b58ffcf7ae0d83bb4661a",
864
- blockNumber: "172",
865
- blockHash: "0x2d0c2050a76696544b225b450634bf892e336157e5dbe41f1a821af8d0c2702e",
866
- calldataBytes: 9604
867
- },
868
- {
869
- gasUsed: "988734",
870
- transactionHash: "0xd9a72b12117c0a3f3905b567922ca326ae21be4447b5e85b4a7b4744be8c2046",
871
- blockNumber: "172",
872
- blockHash: "0x50f057b1b6c559b46df96c6eea7f22f40a11c39186e8869c819cdc343e56826b",
873
- calldataBytes: 9604
874
- },
875
- {
876
- gasUsed: "988698",
877
- transactionHash: "0x5d7aeb7e7089d3ab48d8e2bfe482d0c65caacb39779e3550118f49937f43f494",
878
- blockNumber: "172",
879
- blockHash: "0x58dd724ad5f1bca91a0b7bc69722f58890c02e0d205193ad2bb47960bced25d6",
880
- calldataBytes: 9604
881
- }
882
- ]
883
- }
884
- ]
885
- },
886
- {
887
- formatVersion: 1,
888
- id: "protocol-92ef274-osaka-real",
889
- deployment: {
890
- chainId: "31337",
891
- protocolAddress: "0x8870C63A18a9480C7de9B860b849fD293832856D",
892
- runtimeCodeHash: "0x604572c0da90ea139b774cd0d2962a2972fac46e0556c7cec6f6f9aac5deef14",
893
- tokenAddress: "0x4826533B4897376654Bb4d4AD88B7faFD0C98528"
894
- },
895
- source: {
896
- protocolCommit: "92ef274c6b36d783507699a33ee20e52192c83c7",
897
- measuredAt: "2026-10-27T08:42:15.991Z",
898
- chain: "Anvil 31337",
899
- hardfork: "osaka",
900
- token: "MockERC20",
901
- verifier: "real",
902
- assumptions: [
903
- "normal CREATE/Factory deployment; no code or storage injection",
904
- "Solidity 0.8.27 optimizer 200; real BB 5.2.1 verifiers",
905
- "one source tree; two existing leaves; no rollover or screener",
906
- "funding/approval setup excluded; complete transaction receipt gas included",
907
- "exact allowance for caller funding; configured benchmark payout balances",
908
- "observed local samples, not a confidence interval or gas limit"
909
- ]
910
- },
911
- measurements: [
912
- {
913
- id: "shield-1",
914
- shape: {
915
- kind: "shield",
916
- target: "evm",
917
- capacity: 0,
918
- noteInputs: 0,
919
- noteOutputs: 1,
920
- sourceTrees: 0,
921
- creditInputs: 0,
922
- creditOutputs: 0,
923
- creditRemainders: 0,
924
- funding: "caller",
925
- permit: false,
926
- deliveryBytes: 226
927
- },
928
- circuit: null,
929
- samples: [
930
- {
931
- gasUsed: "649286",
932
- transactionHash: "0xcc299d1780ada9a69b1d9f0f3d06a165db15fccbd2b7ff407834f02f5d563a18",
933
- blockNumber: "50",
934
- blockHash: "0xbcb868e781a20588d2fa099a4d7f87c1600044a2e5ec1e369e384d7a5f22f00a",
935
- calldataBytes: 1156
936
- },
937
- {
938
- gasUsed: "649322",
939
- transactionHash: "0x95139dff109725989f0769e3e6fb9bd3e7e1bf581fd475f14e822875eb90fda4",
940
- blockNumber: "50",
941
- blockHash: "0x7ace353fea4fc8c856c0fd45521d200b02619921977709ff4f910e0ff41c06fe",
942
- calldataBytes: 1156
943
- },
944
- {
945
- gasUsed: "649322",
946
- transactionHash: "0xef578bb38dc8ff8bfd47d2e76e3ab4273019ea9a385f5d2fd99add32ceaecb58",
947
- blockNumber: "50",
948
- blockHash: "0xded817f8ef89637e2443e3b626c0837f184ca134fe753be913d5570554c649a6",
949
- calldataBytes: 1156
950
- }
951
- ]
952
- },
953
- {
954
- id: "shield-2",
955
- shape: {
956
- kind: "shield",
957
- target: "evm",
958
- capacity: 0,
959
- noteInputs: 0,
960
- noteOutputs: 2,
961
- sourceTrees: 0,
962
- creditInputs: 0,
963
- creditOutputs: 0,
964
- creditRemainders: 0,
965
- funding: "caller",
966
- permit: false,
967
- deliveryBytes: 452
968
- },
969
- circuit: null,
970
- samples: [
971
- {
972
- gasUsed: "757063",
973
- transactionHash: "0x024e2dfbd6f50c368e2a4aa347e3029de668f4ebd36b80227aa003bb7ac21c74",
974
- blockNumber: "50",
975
- blockHash: "0x8ed63973c158d706ac54bb646626e4f0db5777b4bd56d179b94503af6c417c50",
976
- calldataBytes: 1668
977
- },
978
- {
979
- gasUsed: "757063",
980
- transactionHash: "0x898d852ab28f68adac4d30b160a3dbfee33fa7ca875f70df9eb7763b6b1cd1f0",
981
- blockNumber: "50",
982
- blockHash: "0x9bb6810de38193933a9f26fa03d3d9bad1ca0151ff5e04544c56520e09da3043",
983
- calldataBytes: 1668
984
- },
985
- {
986
- gasUsed: "757039",
987
- transactionHash: "0x8ff9720e3197aab2d741fbd8d0fa2969203ea8cd051d9649d1e5eb890bcc2be3",
988
- blockNumber: "50",
989
- blockHash: "0x8604c75eb6363aaae774276e638f5b749aae1f8f815eb99ab1183137eef5730e",
990
- calldataBytes: 1668
991
- }
992
- ]
993
- },
994
- {
995
- id: "shield-10",
996
- shape: {
997
- kind: "shield",
998
- target: "evm",
999
- capacity: 0,
1000
- noteInputs: 0,
1001
- noteOutputs: 10,
1002
- sourceTrees: 0,
1003
- creditInputs: 0,
1004
- creditOutputs: 0,
1005
- creditRemainders: 0,
1006
- funding: "caller",
1007
- permit: false,
1008
- deliveryBytes: 2260
1009
- },
1010
- circuit: null,
1011
- samples: [
1012
- {
1013
- gasUsed: "1692143",
1014
- transactionHash: "0x6c13db8bd8a8599daf5034e56712abefbf406982fafe7647b6d22291ba4199ed",
1015
- blockNumber: "50",
1016
- blockHash: "0x1ab2ae514f408a79e0c40ca10cee74b2e23d7c8a5f24641b8eea3e1cf58ce700",
1017
- calldataBytes: 5764
1018
- },
1019
- {
1020
- gasUsed: "1692083",
1021
- transactionHash: "0x5e476c9d3838b782a51332af9bf5c372d29fc411c2168a7af619c52bd5309c7b",
1022
- blockNumber: "50",
1023
- blockHash: "0x9c62bc72fc90f990c6711b48865ff922a1856ae05c4fef61dad5f4da7d948401",
1024
- calldataBytes: 5764
1025
- },
1026
- {
1027
- gasUsed: "1692203",
1028
- transactionHash: "0x0092e2d9160fad95279cde586fc6c79c713244f55db8a2060a5abab9d98c176a",
1029
- blockNumber: "50",
1030
- blockHash: "0xac1bf780b4cc05b4dcc7ee5d741c049ba99ab4af9bdcd25104add730c2a14152",
1031
- calldataBytes: 5764
1032
- }
1033
- ]
1034
- },
1035
- {
1036
- id: "transfer-1x2",
1037
- shape: {
1038
- kind: "transfer",
1039
- target: "evm",
1040
- capacity: 14,
1041
- noteInputs: 1,
1042
- noteOutputs: 2,
1043
- sourceTrees: 1,
1044
- creditInputs: 0,
1045
- creditOutputs: 0,
1046
- creditRemainders: 0,
1047
- funding: "none",
1048
- permit: false,
1049
- deliveryBytes: 452
1050
- },
1051
- circuit: {
1052
- circuitName: "transact_user_slots14",
1053
- target: "evm",
1054
- artifactSha256: "2a6a20839e90b88b1ecd629f59a01821bad3ee11dbe04db1fd9cdce7a3de0e84",
1055
- vkSha256: "ffe0e1a4e690792ecb4eb1fc1acc9ff60f13d3b5af03cfc6ae6d6bf26e99bdea"
1056
- },
1057
- samples: [
1058
- {
1059
- gasUsed: "1617516",
1060
- transactionHash: "0xf49ea3d31cc1346472172e2dee84f9360f60a3fe948a3ef6e87f727af6d42f0d",
1061
- blockNumber: "49",
1062
- blockHash: "0xf59c57e63ec2f03abc36d28f273b0af5290184dc97197df740b23d79a851a887",
1063
- calldataBytes: 11012
1064
- },
1065
- {
1066
- gasUsed: "1617516",
1067
- transactionHash: "0xf8d11286f1f2a4db006ff6b06900c47d0fbf685984499e1e5d4aea49478ba8e5",
1068
- blockNumber: "49",
1069
- blockHash: "0xeb5a800190be3534c9e2675c97ac56d0e0be8adef55f60bd32d375776a7d150c",
1070
- calldataBytes: 11012
1071
- },
1072
- {
1073
- gasUsed: "1617504",
1074
- transactionHash: "0x8939fcea97079a3c5118b9e94325455e2ad1cdb47310ae499a277272654b3eb6",
1075
- blockNumber: "49",
1076
- blockHash: "0xecffefb593e2fec5d5827cfd39d0cc4d0efb67dbff6f8dbbd0d2db2439a80cf9",
1077
- calldataBytes: 11012
1078
- }
1079
- ]
1080
- },
1081
- {
1082
- id: "transfer-1x14",
1083
- shape: {
1084
- kind: "transfer",
1085
- target: "evm",
1086
- capacity: 56,
1087
- noteInputs: 1,
1088
- noteOutputs: 14,
1089
- sourceTrees: 1,
1090
- creditInputs: 0,
1091
- creditOutputs: 0,
1092
- creditRemainders: 0,
1093
- funding: "none",
1094
- permit: false,
1095
- deliveryBytes: 3164
1096
- },
1097
- circuit: {
1098
- circuitName: "transact_user_slots56",
1099
- target: "evm",
1100
- artifactSha256: "ba83ec2f177d16fa88ea04bc54f2e99920f1ac195cdb05b88b9b3bbc245fd953",
1101
- vkSha256: "6ad5d3aff0c72a632fb19895658af093a6a92478a9994985e838a71e61237720"
1102
- },
1103
- samples: [
1104
- {
1105
- gasUsed: "2489010",
1106
- transactionHash: "0x053557acea930a869d6469c91e9bc015d0893607a6ab18d2af684986f7074676",
1107
- blockNumber: "49",
1108
- blockHash: "0x734873097eb5e4cb66bfc2cdb61fac6753b53a4b9450fb22895281100af3aaf3",
1109
- calldataBytes: 17156
1110
- },
1111
- {
1112
- gasUsed: "2489106",
1113
- transactionHash: "0xb3990edb994011775e275bc1eb38c527b7206a2bfadf510e8aa53e260f3594b8",
1114
- blockNumber: "49",
1115
- blockHash: "0xf8cb019ebb0ecd0ec5d6634198292883c63fe93a7c65c34f9f3120c6cc54f1cf",
1116
- calldataBytes: 17156
1117
- },
1118
- {
1119
- gasUsed: "2489094",
1120
- transactionHash: "0xc97079019567ff8a79d285421351ee4bc48d14092a0e12ff634151719e991088",
1121
- blockNumber: "49",
1122
- blockHash: "0x5a6947839165c8961eeeb9190331415c40366a78b4a6a5771e7b8954dbb8b3c7",
1123
- calldataBytes: 17156
1124
- }
1125
- ]
1126
- },
1127
- {
1128
- id: "transfer-1x56",
1129
- shape: {
1130
- kind: "transfer",
1131
- target: "evm",
1132
- capacity: 112,
1133
- noteInputs: 1,
1134
- noteOutputs: 56,
1135
- sourceTrees: 1,
1136
- creditInputs: 0,
1137
- creditOutputs: 0,
1138
- creditRemainders: 0,
1139
- funding: "none",
1140
- permit: false,
1141
- deliveryBytes: 12656
1142
- },
1143
- circuit: {
1144
- circuitName: "transact_user_slots112",
1145
- target: "evm",
1146
- artifactSha256: "713b78469b6e97711122210f8497942120c1c9d66d3604bc184566c4eba59cc3",
1147
- vkSha256: "d6a46e297949c28b9a62fd9aef1f202870fdca97b8bfb15beefd27b9e9f3d86e"
1148
- },
1149
- samples: [
1150
- {
1151
- gasUsed: "5389227",
1152
- transactionHash: "0xb820d3c358724c1d64422017f232d074e4ff1ffaf1b1ce5ee719409427cf2208",
1153
- blockNumber: "49",
1154
- blockHash: "0x474bd1e52457801d1a596a9f23aeb6d365a17be028ee0c8cf8fd4758eaa1106b",
1155
- calldataBytes: 36356
1156
- },
1157
- {
1158
- gasUsed: "5389095",
1159
- transactionHash: "0x16514d8cf1136d7a7f40591859e2ea2d256af66520498e1fc81eb28837db600d",
1160
- blockNumber: "49",
1161
- blockHash: "0x42314a0d6eb9e765869e1b66b279444c78f919d2c28aed544d9fa7ac3bd2acb4",
1162
- calldataBytes: 36356
1163
- },
1164
- {
1165
- gasUsed: "5389203",
1166
- transactionHash: "0xee69d565a7eafb60ad7a47afe80a49d4fa40b50660669d9141e7dc6f4c3dbe0d",
1167
- blockNumber: "49",
1168
- blockHash: "0x0dcdada663ee04dd63e06fcdb79dacc5623201d29b687f63deede2b4762a994e",
1169
- calldataBytes: 36356
1170
- }
1171
- ]
1172
- },
1173
- {
1174
- id: "transfer-1x112",
1175
- shape: {
1176
- kind: "transfer",
1177
- target: "evm",
1178
- capacity: 168,
1179
- noteInputs: 1,
1180
- noteOutputs: 112,
1181
- sourceTrees: 1,
1182
- creditInputs: 0,
1183
- creditOutputs: 0,
1184
- creditRemainders: 0,
1185
- funding: "none",
1186
- permit: false,
1187
- deliveryBytes: 25312
1188
- },
1189
- circuit: {
1190
- circuitName: "transact_user_slots168",
1191
- target: "evm",
1192
- artifactSha256: "f7b3b1384e961367702f544299ca3521d8205fac31b7691c45ff84325d5a31c3",
1193
- vkSha256: "e00181533d7e35d2307570528f9e7f8f88e2909b6ae338d93373b608dea96881"
1194
- },
1195
- samples: [
1196
- {
1197
- gasUsed: "9139842",
1198
- transactionHash: "0x09951c4e00b868b6660429d187a482004646e4c84ef341d3b98352c249db6a06",
1199
- blockNumber: "49",
1200
- blockHash: "0xba9da3c08189335acff1eb33554f5f12475e4a6510324cf6ec9eadf340ce15d2",
1201
- calldataBytes: 61444
1202
- },
1203
- {
1204
- gasUsed: "9139650",
1205
- transactionHash: "0xb06f69d1c6e5406758918d5d296ab889bab4c3814f616cc581ad312cc7ebb2f3",
1206
- blockNumber: "49",
1207
- blockHash: "0x5516a76b4b366f2e539a67bb848b7d232c3e6f328d34ca5bd3dba43a14c316bf",
1208
- calldataBytes: 61444
1209
- },
1210
- {
1211
- gasUsed: "9139530",
1212
- transactionHash: "0x116c4875b7712b7cb51cdb0fcb6e66a95733dca272aa272bc0b1fd265edbe26c",
1213
- blockNumber: "49",
1214
- blockHash: "0xd36340fddd1eace21b73f785c6589bf73b07bef782f2e78a5e3d3d828b0b607c",
1215
- calldataBytes: 61444
1216
- }
1217
- ]
1218
- },
1219
- {
1220
- id: "withdraw-1x1",
1221
- shape: {
1222
- kind: "withdraw",
1223
- target: "evm",
1224
- capacity: 14,
1225
- noteInputs: 1,
1226
- noteOutputs: 1,
1227
- sourceTrees: 1,
1228
- creditInputs: 0,
1229
- creditOutputs: 0,
1230
- creditRemainders: 0,
1231
- funding: "none",
1232
- permit: false,
1233
- deliveryBytes: 226
1234
- },
1235
- circuit: {
1236
- circuitName: "transact_user_slots14",
1237
- target: "evm",
1238
- artifactSha256: "2a6a20839e90b88b1ecd629f59a01821bad3ee11dbe04db1fd9cdce7a3de0e84",
1239
- vkSha256: "ffe0e1a4e690792ecb4eb1fc1acc9ff60f13d3b5af03cfc6ae6d6bf26e99bdea"
1240
- },
1241
- samples: [
1242
- {
1243
- gasUsed: "1597571",
1244
- transactionHash: "0x326892d32146e0bc36b396fd3973151a629312df68ed25a4ffbb6a3da23ba274",
1245
- blockNumber: "49",
1246
- blockHash: "0x3e0f326cba3dd019b86431b4c22145758a7f10c121a696a81a094746b04495b5",
1247
- calldataBytes: 10564
1248
- },
1249
- {
1250
- gasUsed: "1597715",
1251
- transactionHash: "0x2e3a15157ac9c07e4717bbd4641481ce3bc0068d26157752815b6ec6b30acdd0",
1252
- blockNumber: "49",
1253
- blockHash: "0xab7fceac97d55e8702d1202b98d3a05c4b1e0f71e51b6d88d7e80e91cc338596",
1254
- calldataBytes: 10564
1255
- },
1256
- {
1257
- gasUsed: "1597595",
1258
- transactionHash: "0x5052e94a67520c43416cdcb60a1365a126560861173d0eef46bcbf0a566fe947",
1259
- blockNumber: "49",
1260
- blockHash: "0x9a64cf76b646b5a07b72fcc61266e87f17365fec891701c331982a93e5ba9b89",
1261
- calldataBytes: 10564
1262
- }
1263
- ]
1264
- },
1265
- {
1266
- id: "sweep-1x0",
1267
- shape: {
1268
- kind: "sweep",
1269
- target: "evm",
1270
- capacity: 14,
1271
- noteInputs: 1,
1272
- noteOutputs: 0,
1273
- sourceTrees: 1,
1274
- creditInputs: 0,
1275
- creditOutputs: 0,
1276
- creditRemainders: 0,
1277
- funding: "none",
1278
- permit: false,
1279
- deliveryBytes: 0
1280
- },
1281
- circuit: {
1282
- circuitName: "transact_user_slots14",
1283
- target: "evm",
1284
- artifactSha256: "2a6a20839e90b88b1ecd629f59a01821bad3ee11dbe04db1fd9cdce7a3de0e84",
1285
- vkSha256: "ffe0e1a4e690792ecb4eb1fc1acc9ff60f13d3b5af03cfc6ae6d6bf26e99bdea"
1286
- },
1287
- samples: [
1288
- {
1289
- gasUsed: "1069308",
1290
- transactionHash: "0xb1ab469d05ca5f49659f54a332cc172892dcce37e475342fbf52fa9cfb4d3927",
1291
- blockNumber: "49",
1292
- blockHash: "0xe5b04579149987198801f1ca19ab771d5262de2aaf9861a6c962d50d1c6baef0",
1293
- calldataBytes: 10116
1294
- },
1295
- {
1296
- gasUsed: "1069284",
1297
- transactionHash: "0xd6adee997f7e1e19e3918f913f6ee48d94df69c09ed74e333325023089e7f6df",
1298
- blockNumber: "49",
1299
- blockHash: "0xcb225566f8f1ea6ae8da30158b8f1aef03d50fa4ea352a00aa42b7f41a05d63c",
1300
- calldataBytes: 10116
1301
- },
1302
- {
1303
- gasUsed: "1069308",
1304
- transactionHash: "0xe06dd7f3a2718bc9a9412c2d6f505960ce225b2e5fe6c1c66bb5b0e8f427006f",
1305
- blockNumber: "49",
1306
- blockHash: "0x37a08c5918892e1c19df017c746ab0ede03c1bb195c3be593d70c1f9de91897e",
1307
- calldataBytes: 10116
1308
- }
1309
- ]
1310
- }
1311
- ]
1312
- },
1313
- {
1314
- formatVersion: 1,
1315
- id: "protocol-044e2ee-bc51dde071f1-prague-credit-real-accrued-fees",
1316
- deployment: {
1317
- chainId: "31337",
1318
- protocolAddress: "0x8a276b1F407e1273EDFf65e2f6292ee18dA68DD9",
1319
- runtimeCodeHash: "0xf311c797d0296b13c1ef3f230bf4aadd621e38572f0c09a3f631b8edd0402ab4",
1320
- tokenAddress: "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf"
1321
- },
1322
- source: {
1323
- protocolCommit: "044e2ee9aeb9ba0e3dbd0630247495189e0405d4",
1324
- measuredAt: "2026-11-05T10:18:51.134Z",
1325
- chain: "Anvil 31337",
1326
- hardfork: "prague",
1327
- token: "MockERC20",
1328
- verifier: "real",
1329
- fingerprints: {
1330
- protocolSourceSha256: "bc51dde071f1ac4616b3264305aeb2b04b52e0d13772625feed53fb5e8dae51b",
1331
- dirtyDiffSha256: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
1332
- compiledArtifactsSha256: "4900a39e94aeb31f686915bf8618efabf573b93365444db46a0bff3544741221",
1333
- creditManifestSha256: "c27ff83889c3082b4c918bd63e15437881f0a6f12ed7f130312e1140873679fb",
1334
- userManifestSha256: "9ef9d34d4459c2843d022712093216142e3eacdd1467d2382a6a68ad36c33b8f",
1335
- sdkSourceSha256: "11b42d88482ab2b0ce8adf02a8fef00a667fc73e4cb5c926cd76da6181c5ce15"
1336
- },
1337
- toolchain: {
1338
- solidity: "0.8.38",
1339
- barretenberg: "6.0.0",
1340
- noir: "1.0.0-rc.6",
1341
- evmVersion: "prague",
1342
- optimizerRuns: 200,
1343
- anvil: "anvil Version: 1.8.6"
1344
- },
1345
- blockGasLimit: "500000000",
1346
- runtimeContracts: {
1347
- transact_user_slots14_direct_Verifier: {
1348
- address: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
1349
- runtimeCodeHash: "0x42d1932097f18874242d98855b2fc167471ba84dd122ab3744996dd64320f675"
1350
- },
1351
- "transact_user_slots14-adapter": {
1352
- address: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
1353
- runtimeCodeHash: "0x876f0e43fc1d24475c0c63ee8c7907427d534b0c604f5985aacd28ee2c6d1b12"
1354
- },
1355
- transact_user_slots56_direct_Verifier: {
1356
- address: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
1357
- runtimeCodeHash: "0xefca4a7ee5382b0f2029571f6781f2ade7ac698906c32d3e49f10def631e7882"
1358
- },
1359
- "transact_user_slots56-adapter": {
1360
- address: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
1361
- runtimeCodeHash: "0x945680c4278b61c07bf07fa7637908e9a38ccd414c9330bf23b3c41119ea0de6"
1362
- },
1363
- transact_user_slots112_direct_Verifier: {
1364
- address: "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
1365
- runtimeCodeHash: "0xfbf97cd940123ab3e81ce55283efb48b55ddaa95423fff4d0d648b248f4e196b"
1366
- },
1367
- "transact_user_slots112-adapter": {
1368
- address: "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
1369
- runtimeCodeHash: "0xac129aa749b7ece8c51ed68f4f0afcc82a1cbd7b2a01f5ff7ff7de1dcde21b1e"
1370
- },
1371
- transact_user_slots168_direct_Verifier: {
1372
- address: "0x0165878A594ca255338adfa4d48449f69242Eb8F",
1373
- runtimeCodeHash: "0x7ee9799d55001f74c8d88179dd0247b3de932516f975605ba248b52e7ba540c8"
1374
- },
1375
- "transact_user_slots168-adapter": {
1376
- address: "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853",
1377
- runtimeCodeHash: "0x24b5ea6f436b90b3821bd0ea4872fb205c996fd74f1546bc1086d98b7ec5d87d"
1378
- },
1379
- transact_aggregate_14_4_Verifier: {
1380
- address: "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6",
1381
- runtimeCodeHash: "0xae41039ded63fa7777c99a2552ba603a3a4d9703d464079dff787dab6893ef24"
1382
- },
1383
- "transact_aggregate_14_4-adapter": {
1384
- address: "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318",
1385
- runtimeCodeHash: "0xf4e86e9b2001f5972ce00f7fcd5a01deb9bfe5d676e437e74135ee7036469ca3"
1386
- },
1387
- transact_aggregate_14_8_Verifier: {
1388
- address: "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
1389
- runtimeCodeHash: "0x089f476f56fb1003586b18c0b5a75f9d24c76d4804d84ea202005371eae333de"
1390
- },
1391
- "transact_aggregate_14_8-adapter": {
1392
- address: "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
1393
- runtimeCodeHash: "0xc40142342902da65f45bb995724b129389e3505c283d7209a6c29bf27521c363"
1394
- },
1395
- transact_aggregate_14_12_Verifier: {
1396
- address: "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0",
1397
- runtimeCodeHash: "0xe0cba79e66fdb75dbc082ef0f938b07e4d38acce283b87869fe414083b3e08b0"
1398
- },
1399
- "transact_aggregate_14_12-adapter": {
1400
- address: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
1401
- runtimeCodeHash: "0x155bfc9367a6f3c96ac9b4d1dc1d0358a4046b584a9a1322a9582557ea691ff4"
1402
- },
1403
- create_credit_direct_Verifier: {
1404
- address: "0x9A676e781A523b5d0C0e43731313A708CB607508",
1405
- runtimeCodeHash: "0xbc88c374cc3c0c1e2cdf8663cee4c960f3a3ba4b210e2c520ca111e56461b23a"
1406
- },
1407
- "create_credit-adapter": {
1408
- address: "0x0B306BF915C4d645ff596e518fAf3F9669b97016",
1409
- runtimeCodeHash: "0xfd39446d56c189fbb35c0906e525433b6b9c63444c97b13990b7dd6f19bd38fc"
1410
- },
1411
- credit_draw_slots1_direct_Verifier: {
1412
- address: "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
1413
- runtimeCodeHash: "0x47be80e72c3a22ea044638f6004de8c3a0264d5a0d17189c01153cdabfd7bab6"
1414
- },
1415
- "credit_draw_slots1-adapter": {
1416
- address: "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
1417
- runtimeCodeHash: "0x73a2af387b45cecf383b90f4cebb54b263f621a5038da947944c54f1089ba288"
1418
- },
1419
- credit_draw_slots12_direct_Verifier: {
1420
- address: "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
1421
- runtimeCodeHash: "0x244d9ba22f5c736c2a5c42c466701e2a8ba7ae8108665133541026ea45d56e04"
1422
- },
1423
- "credit_draw_slots12-adapter": {
1424
- address: "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
1425
- runtimeCodeHash: "0x63c200eae61218b865f3c8b418bf0887da7a70ebf41f55825e4750c36a1d1914"
1426
- },
1427
- credit_draw_slots50_direct_Verifier: {
1428
- address: "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d",
1429
- runtimeCodeHash: "0x2ad5eb64bcfae34ef04111dd8f9c1ffc5fc8aa6c1ad3a65d8da78233f3390660"
1430
- },
1431
- "credit_draw_slots50-adapter": {
1432
- address: "0x59b670e9fA9D0A427751Af201D676719a970857b",
1433
- runtimeCodeHash: "0x1716df69f1eb1c1db485bc3ba4a4ed5a1009275c9058a9e96b28ab3431a6c006"
1434
- },
1435
- credit_draw_slots120_direct_Verifier: {
1436
- address: "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1",
1437
- runtimeCodeHash: "0x523b6d211618bbd33d708f8198b9f3daafc10e2fa7a6a857db5795ed748a24e4"
1438
- },
1439
- "credit_draw_slots120-adapter": {
1440
- address: "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44",
1441
- runtimeCodeHash: "0x32d875eb4f4c27252fa958971b66e1fdff8c02adb007fea2bf31eee4b851a132"
1442
- },
1443
- credit_cancel_direct_Verifier: {
1444
- address: "0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f",
1445
- runtimeCodeHash: "0x4058133b7ecd31fe06749bfa3107ad0fbcdc9bf72d3b9cbf4dbd2b2f65be6d35"
1446
- },
1447
- "credit_cancel-adapter": {
1448
- address: "0x4A679253410272dd5232B3Ff7cF5dbB88f295319",
1449
- runtimeCodeHash: "0x0f570794fb4b7f15a791c59c760732d9f9408d1e3bea881ba7c5b76b36fb4e9b"
1450
- },
1451
- credit_top_up_direct_Verifier: {
1452
- address: "0x7a2088a1bFc9d81c55368AE168C2C02570cB814F",
1453
- runtimeCodeHash: "0x7ada3623c851a9cfba7863a75f4fa289d747040f1a822510eefecc53d70180cd"
1454
- },
1455
- "credit_top_up-adapter": {
1456
- address: "0x09635F643e140090A9A8Dcd712eD6285858ceBef",
1457
- runtimeCodeHash: "0x23bba4eca8306f4bc02ead10449775a359beeed2065ea8c84da4dc6b9e4dfc82"
1458
- },
1459
- PrivateTransferVerifierRegistry: {
1460
- address: "0xc5a5C42992dECbae36851359345FE25997F5C42d",
1461
- runtimeCodeHash: "0xbc74aacbc22d853cb50fe2041f20014e644fa8f83e06f51656b4667f1da164bc"
1462
- },
1463
- CrossTreeVerifierRegistry: {
1464
- address: "0x67d269191c92Caf3cD7723F116c85e6E9bf55933",
1465
- runtimeCodeHash: "0x818ce6a634a11cdd9913873d3a265254dda45b490431ad1636373237e2685ba1"
1466
- },
1467
- DualVerifierRouter: {
1468
- address: "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
1469
- runtimeCodeHash: "0xb3bdc1aa5a6e4eac85e3651615c7942c5565f0593d79bacccb19b5aa587548ca"
1470
- },
1471
- AtomicBatchOutputLib: {
1472
- address: "0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690",
1473
- runtimeCodeHash: "0xef68c4a35a62fbbb4d0918f1612f0ffd9d250c9ceefd38e59e9c8ef042addb45"
1474
- },
1475
- FundingLib: {
1476
- address: "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
1477
- runtimeCodeHash: "0x36f4e6d20cf7ca1b221dad34bc34ed7b8540c0e774c594652048822272e6bb52"
1478
- },
1479
- PrivateTransferLib: {
1480
- address: "0x9E545E3C0baAB3E08CdfD552C960A1050f373042",
1481
- runtimeCodeHash: "0x1e538d13c68b2a7a2f605466cd7c09c166b904476a6b5b372f8b9b45d9de9a62"
1482
- },
1483
- CrossTreeTransferLib: {
1484
- address: "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
1485
- runtimeCodeHash: "0x9ec892d5a5d1c38e3218c7d38c74bd63034641cc458a195ec63c6a50f67ded25"
1486
- },
1487
- AggregateTransferLib: {
1488
- address: "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8",
1489
- runtimeCodeHash: "0x2c01c84317448e4786e7a7b9c06f6f3b4990354f151ae6914cdb75d8b7ebe881"
1490
- },
1491
- CreateCreditLib: {
1492
- address: "0x851356ae760d987E095750cCeb3bC6014560891C",
1493
- runtimeCodeHash: "0x8b28e626c6a0f41179880773a48681362a05e0eee12193d1641ae5bb625fe960"
1494
- },
1495
- CreditLifecycleLib: {
1496
- address: "0xf5059a5D33d5853360D16C683c16e67980206f36",
1497
- runtimeCodeHash: "0xa177a7f1dfb69cf2d6eea899ef8170959587b8cb3c60559c3b2cecf62309bfc4"
1498
- },
1499
- ShieldLib: {
1500
- address: "0x95401dc811bb5740090279Ba06cfA8fcF6113778",
1501
- runtimeCodeHash: "0xfde7bbf1c02e17ab2d9fc9849fc282b29ac1db86378eec27f3a006d7484aa768"
1502
- },
1503
- InvisiFactory: {
1504
- address: "0x998abeb3E57409262aE5b751f60747921B33613E",
1505
- runtimeCodeHash: "0x9055356390e48564adeca0065b12698a5d09451960af97ad2f5c2e450cb9c84c"
1506
- },
1507
- InvisiAddressRegistry: {
1508
- address: "0x70e0bA845a1A0F2DA3359C97E0285013525FFC49",
1509
- runtimeCodeHash: "0x007da3f4e888366ba0eed52cd511c4a369359291387ad19ca37e89eb395fce30"
1510
- },
1511
- InvisiProtocol: {
1512
- address: "0x8a276b1F407e1273EDFf65e2f6292ee18dA68DD9",
1513
- runtimeCodeHash: "0xf311c797d0296b13c1ef3f230bf4aadd621e38572f0c09a3f631b8edd0402ab4"
1514
- },
1515
- MockERC20: {
1516
- address: "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf",
1517
- runtimeCodeHash: "0xf7f676b5c54f6e94f82f0de65a0117468a0d915e8a79d150e74f76bd6d7f708b"
1518
- }
1519
- },
1520
- assumptions: [
1521
- "normal CREATE/Factory deployment and fresh registry; EIP170/EIP3860 unchanged; no code/storage injection",
1522
- "Solidity0.8.38 optimizer200 Prague; pinned BB6.0.0 real verifiers; every native proof independently verified",
1523
- "one physical source tree and 4 existing leaves shared by every sample; top-up has two authenticated source groups; no rollover or screener",
1524
- "funding/approvals/2 genuine Credit seeds/usage-seed draw/payout reset excluded from business gas",
1525
- "each round restores identical token balances, exact caller allowance105, note cursor, nullifiers and baseline; spender payout starts zero; broadcasterFee5",
1526
- "complete receipt.gasUsed is measured, including verifier/calldata/logging/output insertion; memo0",
1527
- "Prague local block gas limit500000000; measured transactions may be unmineable under lower network transaction/block limits",
1528
- "observed three-sample ranges are neither a confidence interval nor a recommended transaction gas limit"
1529
- ]
1530
- },
1531
- measurements: [
1532
- {
1533
- id: "create-credit-caller-0x0",
1534
- shape: {
1535
- kind: "create-credit",
1536
- target: "evm",
1537
- capacity: 10,
1538
- noteInputs: 0,
1539
- noteOutputs: 0,
1540
- sourceTrees: 0,
1541
- creditInputs: 0,
1542
- creditOutputs: 1,
1543
- creditRemainders: 0,
1544
- funding: "caller",
1545
- permit: false,
1546
- deliveryBytes: 1132
1547
- },
1548
- circuit: {
1549
- circuitName: "create_credit",
1550
- target: "evm",
1551
- artifactSha256: "16a41fd585d5f925e4e93fd6a308e1ca8c90ea287778871cb0d214f0d0e223ce",
1552
- vkSha256: "e8d3dc1f6922dbe1a0aa6016e65664be28d7005180ee943a4b237ac5518971bb"
1553
- },
1554
- samples: [
1555
- {
1556
- gasUsed: "1591717",
1557
- transactionHash: "0xd06c84a0fd796d0100870a9f1a17be8069677f0f304664d3670712740c8bdf62",
1558
- blockNumber: "53",
1559
- blockHash: "0x3d7c908964c165726e2ec0e921e61287864c7a5cb4677bd472f1d2d3b22c0d1b",
1560
- calldataBytes: 11844
1561
- },
1562
- {
1563
- gasUsed: "1591897",
1564
- transactionHash: "0x9eb1f64a8aeffff70213ef442d8553fff10676770768b1f4ad37508cf354c11c",
1565
- blockNumber: "53",
1566
- blockHash: "0xe52bf98f68f306ce13761e3e985c04572d43ac09b0790db5c5217144d68c044d",
1567
- calldataBytes: 11844
1568
- },
1569
- {
1570
- gasUsed: "1591957",
1571
- transactionHash: "0xb3ff21541b1acc1ced31459140c0016f2a5abc25a4723086e3012861d4a8f718",
1572
- blockNumber: "53",
1573
- blockHash: "0x681e28c2f26a020985e262c947b3732edaeeeff78f6d59d4957c188af53cfedc",
1574
- calldataBytes: 11844
1575
- }
1576
- ]
1577
- },
1578
- {
1579
- id: "create-credit-1x1",
1580
- shape: {
1581
- kind: "create-credit",
1582
- target: "evm",
1583
- capacity: 10,
1584
- noteInputs: 1,
1585
- noteOutputs: 1,
1586
- sourceTrees: 1,
1587
- creditInputs: 0,
1588
- creditOutputs: 1,
1589
- creditRemainders: 0,
1590
- funding: "none",
1591
- permit: false,
1592
- deliveryBytes: 1360
1593
- },
1594
- circuit: {
1595
- circuitName: "create_credit",
1596
- target: "evm",
1597
- artifactSha256: "16a41fd585d5f925e4e93fd6a308e1ca8c90ea287778871cb0d214f0d0e223ce",
1598
- vkSha256: "e8d3dc1f6922dbe1a0aa6016e65664be28d7005180ee943a4b237ac5518971bb"
1599
- },
1600
- samples: [
1601
- {
1602
- gasUsed: "1631989",
1603
- transactionHash: "0xf8acf0ee3e372c214ce5ef60d8e28b75ca3041a77d41d1e94acec78070572b5d",
1604
- blockNumber: "53",
1605
- blockHash: "0xd822acd15a4373e9c901579700c1f5e83810cf4a3760c99bd535196550f05676",
1606
- calldataBytes: 12196
1607
- },
1608
- {
1609
- gasUsed: "1632085",
1610
- transactionHash: "0x5315adad09961f10a32d18b8337513347327b85475a5fccf2b700262e34660f0",
1611
- blockNumber: "53",
1612
- blockHash: "0xd8a5f0b8fe42d735c3e0107291afae3973e14bb8fcbff48ea3a30f65172022e8",
1613
- calldataBytes: 12196
1614
- },
1615
- {
1616
- gasUsed: "1632013",
1617
- transactionHash: "0xbd92a3f189c9cdc991cb2843959d2d020ab3f1aeb48fdb0315147f204b9e4295",
1618
- blockNumber: "53",
1619
- blockHash: "0x77deffc18bfbc2cbc8e29c34b62b3be52984869cdcc73ccd245b03025d59797c",
1620
- calldataBytes: 12196
1621
- }
1622
- ]
1623
- },
1624
- {
1625
- id: "top-up-credit-1x1-unchanged-limits",
1626
- shape: {
1627
- kind: "top-up-credit",
1628
- target: "evm",
1629
- capacity: 10,
1630
- noteInputs: 1,
1631
- noteOutputs: 1,
1632
- sourceTrees: 2,
1633
- creditInputs: 1,
1634
- creditOutputs: 1,
1635
- creditRemainders: 0,
1636
- funding: "none",
1637
- permit: false,
1638
- deliveryBytes: 1360
1639
- },
1640
- circuit: {
1641
- circuitName: "credit_top_up",
1642
- target: "evm",
1643
- artifactSha256: "3004eea1c26ec8e33f8fc9ee171a3b6af250682efb607f7003ae58f8327998ab",
1644
- vkSha256: "b7f378a871a27649c3f7fd1af554c8f87d99bcf0780b21972e910212ed4e5a0d"
1645
- },
1646
- samples: [
1647
- {
1648
- gasUsed: "1672668",
1649
- transactionHash: "0x7a0ce3262fedebbd2b7c919f37fe0beb0b34d89a8a71223f13e9946c04131e21",
1650
- blockNumber: "53",
1651
- blockHash: "0x34c561de8fae1ca6230391e9dfe98187cf68bc30b51b4c7338083e4d5349dbff",
1652
- calldataBytes: 12356
1653
- },
1654
- {
1655
- gasUsed: "1672824",
1656
- transactionHash: "0xf27e9d4e588253646168e8db8bc187e5483dbb0ddc147728c29e06f2ab397349",
1657
- blockNumber: "53",
1658
- blockHash: "0xae2cd77d442ba1d55b436388eeded196dcd8735152c0c56dee8830f0ddd457c9",
1659
- calldataBytes: 12356
1660
- },
1661
- {
1662
- gasUsed: "1672824",
1663
- transactionHash: "0xd0633554a0a357d450e49fadecdfb61f39410a2b77969a445a00d7796c088f8a",
1664
- blockNumber: "53",
1665
- blockHash: "0x4851b2333dcb118bd2ca4c6e1332736d32d074e90096e6d144ea4d4262a01124",
1666
- calldataBytes: 12356
1667
- }
1668
- ]
1669
- },
1670
- {
1671
- id: "top-up-credit-1x1-changed-limits",
1672
- shape: {
1673
- kind: "top-up-credit",
1674
- target: "evm",
1675
- capacity: 10,
1676
- noteInputs: 1,
1677
- noteOutputs: 1,
1678
- sourceTrees: 2,
1679
- creditInputs: 1,
1680
- creditOutputs: 1,
1681
- creditRemainders: 0,
1682
- funding: "none",
1683
- permit: false,
1684
- deliveryBytes: 1360
1685
- },
1686
- circuit: {
1687
- circuitName: "credit_top_up",
1688
- target: "evm",
1689
- artifactSha256: "3004eea1c26ec8e33f8fc9ee171a3b6af250682efb607f7003ae58f8327998ab",
1690
- vkSha256: "b7f378a871a27649c3f7fd1af554c8f87d99bcf0780b21972e910212ed4e5a0d"
1691
- },
1692
- samples: [
1693
- {
1694
- gasUsed: "1672824",
1695
- transactionHash: "0x7dcd2f549ac253a1db6bf1956a0ae4f7116258cefa4d6468635694cc0cb310d6",
1696
- blockNumber: "53",
1697
- blockHash: "0x1b318287c6f265fae88233ea20e7a881723fd01f48ff86941323ad0e465f4757",
1698
- calldataBytes: 12356
1699
- },
1700
- {
1701
- gasUsed: "1672824",
1702
- transactionHash: "0x71b6d1de440b578539ca0045c74ee688dbd9ed1971cb19d12fc9256d46d3a6bd",
1703
- blockNumber: "53",
1704
- blockHash: "0x4a9cf7f534d3136b7042447671dd14663bfecce06bb1d432570871de0800995f",
1705
- calldataBytes: 12356
1706
- },
1707
- {
1708
- gasUsed: "1672812",
1709
- transactionHash: "0x781a4f563c1f9d17ec5228f49dd32942622e2090b7cefabf718e575ec1159697",
1710
- blockNumber: "53",
1711
- blockHash: "0xb7f060617081dd56a3a4fa723a2308ef008da493417dffe3d31b130dfb0f3e64",
1712
- calldataBytes: 12356
1713
- }
1714
- ]
1715
- },
1716
- {
1717
- id: "cancel-credit-1",
1718
- shape: {
1719
- kind: "cancel-credit",
1720
- target: "evm",
1721
- capacity: 1,
1722
- noteInputs: 0,
1723
- noteOutputs: 0,
1724
- sourceTrees: 1,
1725
- creditInputs: 1,
1726
- creditOutputs: 0,
1727
- creditRemainders: 0,
1728
- funding: "none",
1729
- permit: false,
1730
- deliveryBytes: 0
1731
- },
1732
- circuit: {
1733
- circuitName: "credit_cancel",
1734
- target: "evm",
1735
- artifactSha256: "6485609280fe5a3d44ca9f1865b29b44253b3d2cd49770d000e7bb7a3db8e65d",
1736
- vkSha256: "d74cf842d204cdf271c06a69482ddff11568e89630346b634d486205bec4bd9e"
1737
- },
1738
- samples: [
1739
- {
1740
- gasUsed: "1013031",
1741
- transactionHash: "0x14678b9811132c703f7593ee8e4c1dcaf478e11cf4ca06615cf432c9866b3bc3",
1742
- blockNumber: "53",
1743
- blockHash: "0x433f2aa3603339fcb28150f0fa6cc45f696cd04808fca1edb0798d674d6488f6",
1744
- calldataBytes: 9604
1745
- },
1746
- {
1747
- gasUsed: "1012983",
1748
- transactionHash: "0xa4be323a92ee04c57343c79997480fd32cbb6982641c8982504337f634e5d19b",
1749
- blockNumber: "53",
1750
- blockHash: "0x7e283b15e8f895ddc75e93041590b0fc7ade0833405e2fa2b349b63649b244d6",
1751
- calldataBytes: 9604
1752
- },
1753
- {
1754
- gasUsed: "1013043",
1755
- transactionHash: "0x4795ce2a29ea83ea3d44a92624fbd52ab370e6140404d94ecff0e5dee9c04e65",
1756
- blockNumber: "53",
1757
- blockHash: "0x90c7422c05e18142fe87c610e13eca9379055d4086019e46d4cacab875959a42",
1758
- calldataBytes: 9604
1759
- }
1760
- ]
1761
- }
1762
- ]
1763
- }
1764
- ];
1765
-
1766
- // src/gas/profiles.ts
1767
- var word = /^0x[0-9a-fA-F]{64}$/;
1768
- var address = /^0x[0-9a-fA-F]{40}$/;
1769
- var decimal = /^(0|[1-9][0-9]*)$/;
1770
- var shapeKeys = [
1771
- "kind",
1772
- "target",
1773
- "capacity",
1774
- "noteInputs",
1775
- "noteOutputs",
1776
- "sourceTrees",
1777
- "creditInputs",
1778
- "creditOutputs",
1779
- "creditRemainders",
1780
- "funding",
1781
- "permit",
1782
- "deliveryBytes"
1783
- ];
1784
- function copyGasBenchmarks(profiles) {
1785
- const copy = structuredClone([...profiles]);
1786
- for (const p of copy) {
1787
- if (p.formatVersion !== 1 || !p.id || !decimal.test(p.deployment.chainId) || !address.test(p.deployment.protocolAddress) || !address.test(p.deployment.tokenAddress) || !p.deployment.runtimeCodeHash || !word.test(p.deployment.runtimeCodeHash) || p.source.verifier !== "real" || !/^[0-9a-f]{40}$/i.test(p.source.protocolCommit) || !p.source.measuredAt || !Array.isArray(p.source.assumptions) || !p.source.assumptions.every((assumption) => typeof assumption === "string") || !p.measurements.length)
1788
- throw new Error("invalid gas benchmark profile");
1789
- if (p.source.fingerprints && ![
1790
- "protocolSourceSha256",
1791
- "dirtyDiffSha256",
1792
- "compiledArtifactsSha256",
1793
- "creditManifestSha256",
1794
- "userManifestSha256",
1795
- "sdkSourceSha256"
1796
- ].every((key) => {
1797
- const v = p.source.fingerprints[key];
1798
- return typeof v === "string" && /^[a-f0-9]{64}$/i.test(v);
1799
- }))
1800
- throw new Error("invalid benchmark source fingerprint");
1801
- if (p.source.blockGasLimit !== void 0 && (!decimal.test(p.source.blockGasLimit) || BigInt(p.source.blockGasLimit) <= 0n))
1802
- throw new Error("invalid benchmark block gas limit");
1803
- if (p.source.runtimeContracts && !Object.values(p.source.runtimeContracts).every(
1804
- (v) => address.test(v.address) && word.test(v.runtimeCodeHash)
1805
- ))
1806
- throw new Error("invalid benchmark runtime identity");
1807
- if (p.source.toolchain && (!["solidity", "barretenberg", "noir", "evmVersion", "anvil"].every((key) => {
1808
- const v = p.source.toolchain[key];
1809
- return typeof v === "string" && v.length > 0;
1810
- }) || !Number.isSafeInteger(p.source.toolchain.optimizerRuns) || p.source.toolchain.optimizerRuns < 0))
1811
- throw new Error("invalid benchmark toolchain");
1812
- for (const m of p.measurements) {
1813
- if (!m.id || !m.samples.length || !["none", "caller", "signature"].includes(m.shape.funding) || typeof m.shape.permit !== "boolean")
1814
- throw new Error("invalid gas benchmark measurement");
1815
- for (const key of shapeKeys) {
1816
- const value = m.shape[key];
1817
- if (!["kind", "target", "funding", "permit"].includes(key) && (!Number.isSafeInteger(value) || Number(value) < 0))
1818
- throw new Error("invalid gas benchmark shape");
1819
- }
1820
- if (m.circuit && (![m.circuit.artifactSha256, m.circuit.vkSha256].every(
1821
- (hash2) => /^[a-f0-9]{64}$/i.test(hash2)
1822
- ) || !m.circuit.circuitName || !m.circuit.target))
1823
- throw new Error("invalid gas benchmark circuit identity");
1824
- const hashes = /* @__PURE__ */ new Set();
1825
- for (const sample of m.samples) {
1826
- if (typeof sample.gasUsed !== "string" || !decimal.test(sample.gasUsed) || BigInt(sample.gasUsed) <= 0n || !word.test(sample.transactionHash) || !word.test(sample.blockHash) || !decimal.test(sample.blockNumber) || !Number.isSafeInteger(sample.calldataBytes) || sample.calldataBytes < 0 || hashes.has(sample.transactionHash.toLowerCase()))
1827
- throw new Error("invalid gas benchmark receipt");
1828
- hashes.add(sample.transactionHash.toLowerCase());
1829
- }
1830
- }
1831
- }
1832
- return copy;
1833
- }
1834
- function defineGasBenchmarks(input) {
1835
- if (!Array.isArray(input)) throw new Error("invalid gas benchmark catalog");
1836
- try {
1837
- return copyGasBenchmarks(input);
1838
- } catch (e) {
1839
- throw new Error("invalid gas benchmark catalog");
1840
- }
1841
- }
1842
- var defaultProfiles = defineGasBenchmarks(gas_benchmarks_default);
1843
- function sameDeployment(a, b) {
1844
- return a.chainId === b.chainId && a.protocolAddress.toLowerCase() === b.protocolAddress.toLowerCase() && a.tokenAddress.toLowerCase() === b.tokenAddress.toLowerCase() && _optionalChain([a, 'access', _18 => _18.runtimeCodeHash, 'optionalAccess', _19 => _19.toLowerCase, 'call', _20 => _20()]) === _optionalChain([b, 'access', _21 => _21.runtimeCodeHash, 'optionalAccess', _22 => _22.toLowerCase, 'call', _23 => _23()]);
1845
- }
1846
- function sameCircuit(a, b) {
1847
- return a === null ? b === null : b !== null && a.circuitName === b.circuitName && a.target === b.target && a.artifactSha256.toLowerCase() === b.artifactSha256.toLowerCase() && a.vkSha256.toLowerCase() === b.vkSha256.toLowerCase();
1848
- }
1849
-
1850
- // src/gas/shape.ts
1851
- function estimateShapeGas(request, profiles = defaultProfiles) {
1852
- if (request.shape.target === "noir-recursive") {
1853
- throw new Error(
1854
- "Estimate gas for the complete aggregate, not an individual recursive member"
1855
- );
1856
- }
1857
- const measurements = profiles.flatMap((profile) => profile.measurements);
1858
- const matching = measurements.filter(
1859
- (measurement) => measurement.shape.kind === request.shape.kind && measurement.shape.target === request.shape.target && sameCircuit(measurement.circuit, request.circuit)
1860
- );
1861
- const exact = matching.filter(
1862
- (measurement) => shapeKeys.every((key) => measurement.shape[key] === request.shape[key])
1863
- );
1864
- if (exact.length) {
1865
- const means = exact.map((m) => {
1866
- const count = BigInt(m.samples.length);
1867
- return (m.samples.reduce((sum, s) => sum + BigInt(s.gasUsed), 0n) + count - 1n) / count;
1868
- });
1869
- return { gasUnits: means.reduce((max, v) => v > max ? v : max) };
1870
- }
1871
- if (["create-credit", "draw-credit", "top-up-credit", "cancel-credit"].includes(
1872
- request.shape.kind
1873
- ) && !matching.length)
1874
- throw new Error("No current Credit gas reference for this artifact and verification key");
1875
- const candidates = matching.length ? matching : measurements.filter(
1876
- (measurement) => measurement.shape.kind === request.shape.kind && measurement.shape.target === request.shape.target
1877
- );
1878
- if (!candidates.length) throw new Error("No gas reference for this operation kind and target");
1879
- const dimensions = [
1880
- "noteInputs",
1881
- "noteOutputs",
1882
- "sourceTrees",
1883
- "creditInputs",
1884
- "creditOutputs",
1885
- "creditRemainders",
1886
- "deliveryBytes",
1887
- ...!matching.length ? ["capacity"] : []
1888
- ];
1889
- const groups = /* @__PURE__ */ new Map();
1890
- for (const candidate of candidates) {
1891
- const key = JSON.stringify([
1892
- shapeKeys.map((k) => candidate.shape[k]),
1893
- _optionalChain([candidate, 'access', _24 => _24.circuit, 'optionalAccess', _25 => _25.circuitName]),
1894
- _optionalChain([candidate, 'access', _26 => _26.circuit, 'optionalAccess', _27 => _27.target]),
1895
- _optionalChain([candidate, 'access', _28 => _28.circuit, 'optionalAccess', _29 => _29.artifactSha256, 'access', _30 => _30.toLowerCase, 'call', _31 => _31()]),
1896
- _optionalChain([candidate, 'access', _32 => _32.circuit, 'optionalAccess', _33 => _33.vkSha256, 'access', _34 => _34.toLowerCase, 'call', _35 => _35()])
1897
- ]);
1898
- const previous = groups.get(key);
1899
- groups.set(
1900
- key,
1901
- previous ? { ...candidate, samples: [...previous.samples, ...candidate.samples] } : candidate
1902
- );
1903
- }
1904
- const estimates = [...groups.values()].map((measurement) => {
1905
- let numerator = 1n;
1906
- let denominator = 1n;
1907
- for (const key of dimensions) {
1908
- const current = BigInt(request.shape[key]) + 1n;
1909
- const baseline = BigInt(measurement.shape[key]) + 1n;
1910
- if (current * denominator > numerator * baseline) {
1911
- numerator = current;
1912
- denominator = baseline;
1913
- }
1914
- }
1915
- let gas = measurement.samples.reduce(
1916
- (max, sample) => BigInt(sample.gasUsed) > max ? BigInt(sample.gasUsed) : max,
1917
- 0n
1918
- );
1919
- gas = (gas * numerator + denominator - 1n) / denominator;
1920
- if (request.shape.funding === "signature" && measurement.shape.funding !== "signature")
1921
- gas *= 2n;
1922
- if (request.shape.permit && !measurement.shape.permit) gas *= 2n;
1923
- return gas;
1924
- });
1925
- return { gasUnits: estimates.reduce((min, gas) => gas < min ? gas : min) };
1926
- }
1927
-
1928
- // src/gas/gas-estimation.ts
1929
- function estimateBenchmarkGas(plan, protocol, profiles) {
1930
- const credit = plan.credit;
1931
- const deliveries = _nullishCoalesce(_optionalChain([credit, 'optionalAccess', _36 => _36.deliveries]), () => ( plan.outputs.map((out) => out.delivery)));
1932
- const request = {
1933
- deployment: {
1934
- chainId: plan.context.chainId.toString(),
1935
- protocolAddress: plan.context.protocolAddress,
1936
- runtimeCodeHash: _nullishCoalesce(protocol.expectedRuntimeCodeHash, () => ( null)),
1937
- tokenAddress: plan.context.tokenAddress
1938
- },
1939
- shape: {
1940
- kind: plan.kind,
1941
- target: _nullishCoalesce(_optionalChain([plan, 'access', _37 => _37.statement, 'optionalAccess', _38 => _38.target]), () => ( "evm")),
1942
- capacity: _nullishCoalesce(plan.capacity, () => ( 0)),
1943
- noteInputs: plan.inputs.length,
1944
- noteOutputs: plan.outputs.length,
1945
- sourceTrees: operationSources(plan).length,
1946
- creditInputs: _nullishCoalesce(_optionalChain([credit, 'optionalAccess', _39 => _39.inputs, 'access', _40 => _40.length]), () => ( 0)),
1947
- creditOutputs: _nullishCoalesce(_optionalChain([credit, 'optionalAccess', _41 => _41.outputs, 'access', _42 => _42.length]), () => ( 0)),
1948
- creditRemainders: _nullishCoalesce(_optionalChain([credit, 'optionalAccess', _43 => _43.draw, 'optionalAccess', _44 => _44.remainderCommitments, 'access', _45 => _45.filter, 'call', _46 => _46((hash2) => BigInt(hash2) !== 0n), 'access', _47 => _47.length]), () => ( 0)),
1949
- funding: plan.fundingMode,
1950
- permit: (_nullishCoalesce(_optionalChain([plan, 'access', _48 => _48.funding, 'access', _49 => _49.permit, 'optionalAccess', _50 => _50.deadline]), () => ( 0n))) !== 0n,
1951
- deliveryBytes: deliveries.reduce(
1952
- (sum, d) => sum + (d.ciphertext.length - 2) / 2 + (d.clue.length - 2) / 2,
1953
- 0
1954
- )
1955
- },
1956
- circuit: plan.statement ? {
1957
- circuitName: plan.statement.circuitName,
1958
- target: plan.statement.target,
1959
- artifactSha256: plan.statement.artifactSha256,
1960
- vkSha256: plan.statement.vkSha256
1961
- } : null
1962
- };
1963
- const base = { source: "benchmark", request };
1964
- if (request.shape.target === "noir-recursive")
1965
- return { ...base, available: false, reason: "recursive-member-only" };
1966
- const candidates = (_nullishCoalesce(profiles, () => ( defaultProfiles))).filter(
1967
- (p) => sameDeployment(p.deployment, request.deployment)
1968
- );
1969
- if (!request.deployment.runtimeCodeHash || !candidates.length)
1970
- return { ...base, available: false, reason: "deployment-not-covered" };
1971
- const exact = candidates.flatMap(
1972
- (profile) => profile.measurements.filter(
1973
- (m) => shapeKeys.every((key) => m.shape[key] === request.shape[key]) && sameCircuit(m.circuit, request.circuit)
1974
- ).map((measurement) => ({ profile, measurement }))
1975
- );
1976
- const mean = (measurement) => {
1977
- const count = BigInt(measurement.samples.length);
1978
- return (measurement.samples.reduce((sum, s) => sum + BigInt(s.gasUsed), 0n) + count - 1n) / count;
1979
- };
1980
- exact.sort(
1981
- (a, b) => mean(a.measurement) > mean(b.measurement) ? -1 : mean(a.measurement) < mean(b.measurement) ? 1 : a.measurement.id.localeCompare(b.measurement.id)
1982
- );
1983
- if (exact.length) {
1984
- const { profile, measurement } = exact[0];
1985
- const gas = measurement.samples.map((sample) => BigInt(sample.gasUsed));
1986
- const count = BigInt(gas.length);
1987
- return {
1988
- ...base,
1989
- available: true,
1990
- gasUnits: (gas.reduce((sum, value) => sum + value, 0n) + count - 1n) / count,
1991
- range: {
1992
- min: gas.reduce((a, b) => a < b ? a : b),
1993
- max: gas.reduce((a, b) => a > b ? a : b),
1994
- kind: "observed"
1995
- },
1996
- samples: gas.length,
1997
- profileId: profile.id,
1998
- measurementId: measurement.id,
1999
- evidence: structuredClone(profile.source)
2000
- };
2001
- }
2002
- return { ...base, available: false, reason: "shape-not-covered" };
2003
- }
2004
- function estimateGasReference(plan, protocol, profiles) {
2005
- const reference = estimateBenchmarkGas(plan, protocol, profiles);
2006
- if (reference.available) return { gasUnits: reference.gasUnits };
2007
- return estimateShapeGas(reference.request);
2008
- }
2009
-
2010
- // src/protocol/AddressRegistry.ts
2011
- var _protocol = require('@invisi-labs/protocol');
2012
- var AddressRegistry = class extends _protocol.AddressRegistry {
2013
- prepareRegistration(options) {
2014
- return _chunkJ2JH6HIGcjs.prepareWithErrors.call(void 0, "prepareRegistration", async () => {
2015
- if ("provider" in options) {
2016
- const { provider, ...preparation } = options;
2017
- return super.prepareRegistration({
2018
- ...preparation,
2019
- reader: new (0, _chunk7F7ZZW3Lcjs.EthersChainReader)(provider)
2020
- });
2021
- }
2022
- return super.prepareRegistration(options);
2023
- });
2024
- }
2025
- };
2026
-
2027
- // src/notes/TransactionOutput.ts
2028
- var TransactionOutput = class {
2029
- #output;
2030
- constructor(output) {
2031
- this.#output = structuredClone(output);
2032
- Object.freeze(this);
2033
- }
2034
- get context() {
2035
- return structuredClone(this.#output.context);
2036
- }
2037
- get recipient() {
2038
- return structuredClone(this.#output.recipient);
2039
- }
2040
- get amount() {
2041
- return this.#output.amount;
2042
- }
2043
- get commitment() {
2044
- return this.#output.commitment;
2045
- }
2046
- get identity() {
2047
- return this.#output.identity;
2048
- }
2049
- get nonce() {
2050
- return _optionalChain([this, 'access', _51 => _51.#output, 'access', _52 => _52.note, 'optionalAccess', _53 => _53.nonce]);
2051
- }
2052
- get change() {
2053
- return this.#output.change;
2054
- }
2055
- exportPaymentNote() {
2056
- return _chunkJ2JH6HIGcjs.exportPaymentNote.call(void 0, this.#output);
2057
- }
2058
- };
2059
-
2060
- // src/transactions/proving/proof.ts
2061
- function publicProof(bundle) {
2062
- return {
2063
- formatVersion: bundle.formatVersion,
2064
- circuitName: bundle.circuitName,
2065
- target: bundle.target,
2066
- bbVersion: bundle.bbVersion,
2067
- artifactSha256: bundle.artifactSha256,
2068
- vkSha256: bundle.vkSha256,
2069
- proofHex: bundle.proofHex,
2070
- proofSha256: bundle.proofSha256,
2071
- publicInputs: [...bundle.publicInputs]
2072
- };
2073
- }
2074
-
2075
- // src/transactions/proving/proof-integrity.ts
2076
- var _sha256 = require('@noble/hashes/sha256');
2077
- var _utils = require('@noble/hashes/utils');
2078
- var _ethers = require('ethers');
2079
- function check(ok, message) {
2080
- if (!ok) throw new Error(message);
2081
- }
2082
- function sameStatement(proof, expected) {
2083
- check(
2084
- proof.formatVersion === 1 && proof.bbVersion === "6.0.0" && proof.circuitName === expected.circuitName && proof.target === expected.target && proof.artifactSha256 === expected.artifactSha256 && proof.vkSha256 === expected.vkSha256,
2085
- "proof release/target mismatch"
2086
- );
2087
- check(
2088
- proof.publicInputs.length === expected.expectedPublicInputs.length && proof.publicInputs.every((word2, i) => word2 === expected.expectedPublicInputs[i]),
2089
- "proof public statement mismatch"
2090
- );
2091
- check(
2092
- /^0x(?:[a-fA-F0-9]{2})+$/.test(proof.proofHex) && _utils.bytesToHex.call(void 0, _sha256.sha256.call(void 0, _ethers.getBytes.call(void 0, proof.proofHex))) === proof.proofSha256,
2093
- "proof integrity mismatch"
2094
- );
2095
- }
2096
-
2097
- // src/transactions/execution/calldata.ts
2098
-
2099
-
2100
-
2101
-
2102
-
2103
-
2104
-
2105
-
2106
- async function encodeOperation(saved) {
2107
- const plan = saved.plan;
2108
- const credit = plan.credit;
2109
- const caller = plan.fundingMode === "caller" ? plan.funding.payer : void 0;
2110
- const common = { context: plan.context, proof: _nullishCoalesce(_optionalChain([saved, 'access', _54 => _54.proof, 'optionalAccess', _55 => _55.proofHex]), () => ( "0x")) };
2111
- const funded = { ...common, funding: plan.funding, ...caller ? { caller } : {} };
2112
- let encoded;
2113
- if (_optionalChain([credit, 'optionalAccess', _56 => _56.topUp])) {
2114
- encoded = _protocol.buildTopUpCreditCalldata.call(void 0, {
2115
- ...funded,
2116
- params: credit.topUp,
2117
- deliveries: credit.deliveries
2118
- });
2119
- } else if (_optionalChain([credit, 'optionalAccess', _57 => _57.creation])) {
2120
- encoded = _protocol.buildCreateCreditCalldata.call(void 0, {
2121
- ...funded,
2122
- params: credit.creation,
2123
- deliveries: credit.deliveries
2124
- });
2125
- } else if (_optionalChain([credit, 'optionalAccess', _58 => _58.draw])) {
2126
- encoded = _protocol.buildCreditDrawCalldata.call(void 0, {
2127
- ...common,
2128
- params: credit.draw,
2129
- deliveries: credit.deliveries
2130
- });
2131
- } else if (_optionalChain([credit, 'optionalAccess', _59 => _59.cancel])) {
2132
- encoded = _protocol.buildCancelCreditCalldata.call(void 0, { ...common, params: credit.cancel });
2133
- } else if (plan.kind === "shield") {
2134
- encoded = await _protocol.buildShieldCalldata.call(void 0, {
2135
- ...funded,
2136
- params: plan.shieldParams,
2137
- outputs: plan.shieldOutputs,
2138
- deliveries: plan.outputs.map((output) => output.delivery)
2139
- });
2140
- } else {
2141
- encoded = _protocol.buildTransactCalldata.call(void 0, {
2142
- ...funded,
2143
- params: plan.params,
2144
- deliveries: plan.outputs.map((output) => output.delivery)
2145
- });
2146
- }
2147
- return { to: plan.context.protocolAddress, data: encoded.data, value: 0n };
2148
- }
2149
-
2150
- // src/transactions/proving/witness.ts
2151
-
2152
- async function witnessFor(protocol, plan, authorization) {
2153
- const builder = new (0, _protocol.WitnessBuilder)(protocol);
2154
- const credit = plan.credit;
2155
- if (credit) {
2156
- if (!authorization) throw new Error("private Credit wallet authorization required");
2157
- if (credit.topUp) {
2158
- return builder.topUpCredit({
2159
- params: credit.topUp,
2160
- deliveries: credit.deliveries,
2161
- funding: plan.funding,
2162
- inputs: plan.inputs,
2163
- state: credit.outputs[0].state,
2164
- ...plan.outputs[0] ? { change: plan.outputs[0].note } : {},
2165
- previous: credit.inputs[0],
2166
- authorization
2167
- });
2168
- }
2169
- if (credit.creation) {
2170
- return builder.createCredit({
2171
- params: credit.creation,
2172
- deliveries: credit.deliveries,
2173
- funding: plan.funding,
2174
- inputs: plan.inputs,
2175
- state: credit.outputs[0].state,
2176
- ...plan.outputs[0] ? { change: plan.outputs[0].note } : {},
2177
- authorization
2178
- });
2179
- }
2180
- if (credit.draw) {
2181
- return builder.drawCredit({
2182
- timestamp: plan.preparedAt.timestamp,
2183
- params: credit.draw,
2184
- deliveries: credit.deliveries,
2185
- inputs: credit.inputs,
2186
- amounts: credit.amounts,
2187
- authorization
2188
- });
2189
- }
2190
- if (credit.cancel) {
2191
- return builder.cancelCredit({
2192
- params: credit.cancel,
2193
- input: credit.inputs[0],
2194
- authorization
2195
- });
2196
- }
2197
- throw new Error("unsupported Credit operation");
2198
- }
2199
- return builder.transact({
2200
- params: plan.params,
2201
- deliveries: plan.outputs.map((output) => output.delivery),
2202
- funding: plan.funding,
2203
- inputs: plan.inputs,
2204
- outputs: plan.outputs.map((output) => ({
2205
- identity: output.identity,
2206
- amount: output.amount,
2207
- ...output.note ? { note: output.note } : {}
2208
- })),
2209
- ...authorization ? { authorization } : {},
2210
- target: plan.statement.target
2211
- });
2212
- }
2213
-
2214
- // src/transactions/signing/funding.ts
2215
-
2216
-
2217
-
2218
-
2219
-
2220
-
2221
-
2222
- async function fundingTypedData(saved) {
2223
- const plan = saved.plan;
2224
- const credit = plan.credit;
2225
- if (_optionalChain([credit, 'optionalAccess', _60 => _60.topUp])) {
2226
- return _protocol.encodeTopUpCreditFundingTypedData.call(void 0,
2227
- plan.context,
2228
- credit.topUp,
2229
- credit.deliveries,
2230
- plan.funding
2231
- );
2232
- }
2233
- if (_optionalChain([credit, 'optionalAccess', _61 => _61.creation])) {
2234
- return _protocol.encodeCreateCreditFundingTypedData.call(void 0,
2235
- plan.context,
2236
- credit.creation,
2237
- credit.deliveries,
2238
- plan.funding
2239
- );
2240
- }
2241
- if (plan.kind === "shield") {
2242
- return _protocol.encodeShieldFundingTypedData.call(void 0, {
2243
- context: plan.context,
2244
- params: plan.shieldParams,
2245
- outputs: plan.shieldOutputs,
2246
- deliveries: plan.outputs.map((output) => output.delivery),
2247
- funding: plan.funding
2248
- });
2249
- }
2250
- if (_optionalChain([plan, 'access', _62 => _62.statement, 'optionalAccess', _63 => _63.target]) === "noir-recursive") {
2251
- return _protocol.encodeAggregateFundingTypedData.call(void 0, plan.context, {
2252
- params: plan.params,
2253
- deliveries: plan.outputs.map((output) => output.delivery),
2254
- funding: plan.funding
2255
- });
2256
- }
2257
- return _protocol.encodeTransactFundingTypedData.call(void 0,
2258
- plan.context,
2259
- saved.proof.proofHex,
2260
- plan.params,
2261
- plan.outputs.map((output) => output.delivery),
2262
- plan.funding
2263
- );
2264
- }
2265
-
2266
- // src/transactions/execution/operation-execution.ts
2267
-
2268
-
2269
-
2270
-
2271
-
2272
-
2273
- var _core = require('@invisi-labs/core');
2274
-
2275
-
2276
- async function authorizeOperation(plan, provider) {
2277
- if (provider.ownerAddress !== plan.scope.ownerAddress)
2278
- throw new Error("wallet authorization capability mismatch");
2279
- const request = _chunkJ2JH6HIGcjs.authorizationRequest.call(void 0, plan);
2280
- const digest = _core.computeWalletAuthorizationDigest.call(void 0, request);
2281
- const signed = await provider.authorize(structuredClone(request));
2282
- if (signed.ownerAddress !== plan.scope.ownerAddress || signed.digest !== digest)
2283
- throw new Error("wallet authorization statement mismatch");
2284
- return signed;
2285
- }
2286
- async function proveOperation(protocol, plan, authorization, prover, options) {
2287
- if (Object.hasOwn(options, "target")) {
2288
- throw new Error("prove accepts execution, not a backend target");
2289
- }
2290
- const { execution = "single", ...proverOptions } = options;
2291
- if (execution !== "single" && execution !== "aggregate") {
2292
- throw new Error("execution must be single or aggregate");
2293
- }
2294
- const frozen = _chunkJ2JH6HIGcjs.statement.call(void 0, plan);
2295
- if (execution === "aggregate" && (plan.kind !== "transfer" || plan.capacity !== 14)) {
2296
- throw new Error("aggregate execution requires a 14-slot transfer");
2297
- }
2298
- if (plan.kind === "transfer") {
2299
- plan.statement = _protocol.WitnessBuilder.statement(
2300
- frozen.circuitName,
2301
- frozen.expectedPublicInputs,
2302
- execution === "aggregate" ? "noir-recursive" : "evm"
2303
- );
2304
- }
2305
- const request = await witnessFor(protocol, plan, authorization);
2306
- if (JSON.stringify({ ...request, witness: void 0 }) !== JSON.stringify(plan.statement))
2307
- throw new Error("prepared proof statement changed");
2308
- try {
2309
- const proof = publicProof(await prover.prove(request, proverOptions));
2310
- sameStatement(proof, plan.statement);
2311
- if (await prover.verify(
2312
- structuredClone(proof),
2313
- structuredClone(plan.statement),
2314
- proverOptions
2315
- ) !== true)
2316
- throw new Error("proof verification failed");
2317
- return proof;
2318
- } catch (e2) {
2319
- _optionalChain([options, 'access', _64 => _64.signal, 'optionalAccess', _65 => _65.throwIfAborted, 'call', _66 => _66()]);
2320
- throw new Error("operation proof generation or verification failed");
2321
- }
2322
- }
2323
- async function signOperationFunding(saved, signer, verifier) {
2324
- const payer = saved.plan.funding.payer;
2325
- if (signer.address.toLowerCase() !== payer.toLowerCase())
2326
- throw new Error("funding signer is not the payer");
2327
- const typed = await fundingTypedData(saved);
2328
- const signature = await signer.signTypedData(structuredClone(typed));
2329
- return verifyFundingSignature(typed, payer, signature, verifier);
2330
- }
2331
- function walletSigningRequest(plan) {
2332
- return _core.createSigningRequest.call(void 0, _core.walletAuthorizationTypedData.call(void 0, _chunkJ2JH6HIGcjs.authorizationRequest.call(void 0, plan)));
2333
- }
2334
- async function acceptWalletSignature(plan, signature) {
2335
- const request = _chunkJ2JH6HIGcjs.authorizationRequest.call(void 0, plan);
2336
- const digest = _core.computeWalletAuthorizationDigest.call(void 0, request);
2337
- try {
2338
- const signed = _ethers.Signature.from(signature);
2339
- const publicKey = _ethers.getBytes.call(void 0, _ethers.SigningKey.recoverPublicKey(digest, signed));
2340
- const owner = await _core.computeOwnerAddress.call(void 0, publicKey);
2341
- if (owner.toLowerCase() !== plan.scope.ownerAddress.toLowerCase()) {
2342
- throw new Error("wallet signature identity mismatch");
2343
- }
2344
- return new (0, _core.AuthorizedStatement)(plan.scope.ownerAddress, digest, {
2345
- public_key_x: Array.from(publicKey.slice(1, 33)),
2346
- public_key_y: Array.from(publicKey.slice(33)),
2347
- signature: Array.from(_ethers.getBytes.call(void 0, _ethers.concat.call(void 0, [signed.r, signed.s])))
2348
- });
2349
- } catch (e3) {
2350
- throw new Error("invalid wallet authorization signature");
2351
- }
2352
- }
2353
- async function fundingSigningRequest(saved, runtime) {
2354
- const plan = saved.plan;
2355
- if (plan.fundingMode !== "signature") {
2356
- throw new Error("operation does not require a funding signature");
2357
- }
2358
- if (plan.kind !== "shield" && !saved.proof) {
2359
- throw new Error("proof must precede funding authorization");
2360
- }
2361
- await runtime.options.protocol.validateDeployment(runtime.reader);
2362
- const block = await runtime.reader.getBlock(await runtime.reader.getLatestBlockNumber());
2363
- if (block.timestamp > plan.deadline || block.timestamp > (_nullishCoalesce(plan.funding.deadline, () => ( 0n)))) {
2364
- throw new Error("funding authorization expired");
2365
- }
2366
- if (await runtime.reader.getFundingNonce(plan.context, plan.funding.payer, block) !== plan.funding.sigNonce) {
2367
- throw new Error("funding nonce changed; prepare again");
2368
- }
2369
- const request = _core.createSigningRequest.call(void 0, await fundingTypedData(saved));
2370
- if ((await runtime.reader.getBlock(block.number)).hash !== block.hash) {
2371
- throw new Error("canonical funding block changed");
2372
- }
2373
- return request;
2374
- }
2375
- async function acceptFundingSignature(saved, signature, runtime) {
2376
- if (!/^0x(?:[a-fA-F0-9]{2})+$/.test(signature)) {
2377
- throw new Error("invalid EVM funding signature");
2378
- }
2379
- const request = await fundingSigningRequest(saved, runtime);
2380
- return verifyFundingSignature(
2381
- request,
2382
- saved.plan.funding.payer,
2383
- signature,
2384
- runtime.options.fundingVerifier
2385
- );
2386
- }
2387
- async function verifyFundingSignature(request, payer, signature, verifier) {
2388
- if (!/^0x(?:[a-fA-F0-9]{2})+$/.test(signature)) {
2389
- throw new Error("invalid EVM funding signature");
2390
- }
2391
- const types = Object.fromEntries(
2392
- Object.entries(request.types).map(([name, fields]) => [name, [...fields]])
2393
- );
2394
- let validEOA = false;
2395
- try {
2396
- validEOA = _ethers.verifyTypedData.call(void 0, request.domain, types, request.message, signature).toLowerCase() === payer.toLowerCase();
2397
- if (validEOA) {
2398
- signature = _ethers.Signature.from(signature).serialized;
2399
- }
2400
- } catch (e4) {
2401
- validEOA = false;
2402
- }
2403
- const valid = verifier ? await verifier.verifyTypedData({
2404
- ...structuredClone(request),
2405
- address: payer,
2406
- signature
2407
- }) : validEOA;
2408
- if (valid !== true) {
2409
- throw new Error("invalid EVM funding signature");
2410
- }
2411
- return signature;
2412
- }
2413
-
2414
- // src/transactions/execution/operation-preview.ts
2415
-
2416
- function operationPreview(plan, status) {
2417
- const p = plan;
2418
- const fee = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(p.params, () => ( p.shieldParams)), () => ( _optionalChain([p, 'access', _67 => _67.credit, 'optionalAccess', _68 => _68.creation]))), () => ( _optionalChain([p, 'access', _69 => _69.credit, 'optionalAccess', _70 => _70.cancel])));
2419
- const funding = _protocol.normalizeFunding.call(void 0, p.funding);
2420
- return {
2421
- id: p.id,
2422
- kind: p.kind,
2423
- status,
2424
- context: { ...p.context },
2425
- inputs: inputFacts(p).length,
2426
- inputDetails: [
2427
- ...p.inputs.map((input) => ({
2428
- kind: "notes",
2429
- commitment: input.commitment,
2430
- amount: input.note.amount,
2431
- owner: input.note.ownerAddress,
2432
- treeId: input.treeId,
2433
- leafIndex: input.leafIndex
2434
- })),
2435
- ...(_nullishCoalesce(_optionalChain([p, 'access', _71 => _71.credit, 'optionalAccess', _72 => _72.inputs]), () => ( []))).map((input) => ({
2436
- kind: "credits",
2437
- commitment: input.commitment,
2438
- amount: input.state.note.amount,
2439
- owner: input.state.note.ownerWalletIdentity,
2440
- spender: input.state.note.spenderWalletIdentity,
2441
- expiry: input.state.note.expiry,
2442
- role: input.role,
2443
- treeId: input.treeId,
2444
- leafIndex: input.leafIndex
2445
- }))
2446
- ],
2447
- funding: {
2448
- payer: funding.payer,
2449
- amount: funding.amount,
2450
- authorization: p.fundingMode,
2451
- sigNonce: funding.sigNonce,
2452
- deadline: funding.deadline,
2453
- permit: { deadline: funding.permit.deadline }
2454
- },
2455
- creditOutputs: _optionalChain([p, 'access', _73 => _73.credit, 'optionalAccess', _74 => _74.outputs, 'access', _75 => _75.map, 'call', _76 => _76((output) => ({
2456
- commitment: output.commitment,
2457
- amount: output.state.note.amount,
2458
- expiry: output.state.note.expiry,
2459
- owner: output.state.note.ownerWalletIdentity,
2460
- spender: output.state.note.spenderWalletIdentity,
2461
- ownerPayout: output.state.note.ownerPayout,
2462
- spenderPayout: output.state.note.spenderPayout
2463
- }))]),
2464
- outputs: p.outputs.map((output) => ({
2465
- commitment: output.commitment,
2466
- to: output.address,
2467
- amount: output.amount,
2468
- change: output.change
2469
- })),
2470
- capacity: p.capacity,
2471
- deadline: p.deadline,
2472
- feeRecipient: _optionalChain([fee, 'optionalAccess', _77 => _77.feeRecipient]),
2473
- feeAmount: _nullishCoalesce(_optionalChain([fee, 'optionalAccess', _78 => _78.feeAmount]), () => ( 0n)),
2474
- fundingAmount: _nullishCoalesce(p.funding.amount, () => ( 0n)),
2475
- fundingPayer: p.funding.payer,
2476
- withdrawalAmount: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([p, 'access', _79 => _79.params, 'optionalAccess', _80 => _80.withdrawalAmount]), () => ( _optionalChain([p, 'access', _81 => _81.credit, 'optionalAccess', _82 => _82.draw, 'optionalAccess', _83 => _83.totalAmount]))), () => ( (_optionalChain([p, 'access', _84 => _84.credit, 'optionalAccess', _85 => _85.cancel]) ? p.credit.cancel.amount - (_nullishCoalesce(p.credit.cancel.feeAmount, () => ( 0n))) : void 0))), () => ( 0n)),
2477
- withdrawalAddress: _nullishCoalesce(_nullishCoalesce(_optionalChain([p, 'access', _86 => _86.params, 'optionalAccess', _87 => _87.withdrawalAddress]), () => ( _optionalChain([p, 'access', _88 => _88.credit, 'optionalAccess', _89 => _89.draw, 'optionalAccess', _90 => _90.spender]))), () => ( _optionalChain([p, 'access', _91 => _91.credit, 'optionalAccess', _92 => _92.cancel, 'optionalAccess', _93 => _93.owner]))),
2478
- permissions: {
2479
- walletAuthorization: _chunkJ2JH6HIGcjs.requiresAuthorization.call(void 0, p),
2480
- proof: p.kind !== "shield",
2481
- fundingAuthorization: p.fundingMode === "signature"
2482
- }
2483
- };
2484
- }
2485
-
2486
- // src/transactions/execution/PreparedTransaction.ts
2487
-
2488
-
2489
- function check2(ok, message) {
2490
- if (!ok) throw new Error(message);
2491
- }
2492
- var PreparedTransaction = class _PreparedTransaction {
2493
- #runtime;
2494
- #saved;
2495
- #authorization;
2496
- #lifecycle;
2497
-
2498
- constructor(runtime, saved, status, lifecycle, authorization) {
2499
- this.#runtime = runtime;
2500
- this.#saved = structuredClone(saved);
2501
- this.#lifecycle = lifecycle;
2502
- this.#authorization = authorization;
2503
- this.status = status;
2504
- Object.freeze(this);
2505
- }
2506
- static prepare(runtime, plan) {
2507
- return new _PreparedTransaction(
2508
- runtime,
2509
- { plan: structuredClone(plan), generation: 0 },
2510
- "prepared",
2511
- { generation: 0, busy: false }
2512
- );
2513
- }
2514
- broadcasterQuote() {
2515
- return this.#saved.broadcasterQuote ? structuredClone(this.#saved.broadcasterQuote) : void 0;
2516
- }
2517
- async withBroadcaster(client, options) {
2518
- this.current();
2519
- check2(
2520
- this.status === "prepared" && this.#runtime.reprepare,
2521
- "broadcaster must attach to an unsigned prepared transaction"
2522
- );
2523
- const { prepareBroadcasterPlan } = await Promise.resolve().then(() => _interopRequireWildcard(require("./broadcaster-preparation-UGOTO4SX.cjs")));
2524
- const selected = await prepareBroadcasterPlan(
2525
- this.#saved.plan,
2526
- this.#runtime.reprepare,
2527
- client,
2528
- options
2529
- );
2530
- return new _PreparedTransaction(
2531
- this.#runtime,
2532
- { plan: selected.plan, broadcasterQuote: selected.quote, generation: 0 },
2533
- "prepared",
2534
- { generation: 0, busy: false }
2535
- );
2536
- }
2537
- get id() {
2538
- return this.#saved.plan.id;
2539
- }
2540
- get kind() {
2541
- return this.#saved.plan.kind;
2542
- }
2543
- estimateGas() {
2544
- return estimateGasReference(
2545
- this.#saved.plan,
2546
- this.#runtime.options.protocol,
2547
- this.#runtime.options.gasBenchmarks
2548
- );
2549
- }
2550
- /** Final Note outputs, including change; Credit outputs are not exported as IPN. */
2551
- getOutputs() {
2552
- return Object.freeze(
2553
- this.#saved.plan.outputs.map((output) => new TransactionOutput(output))
2554
- );
2555
- }
2556
- preview() {
2557
- return operationPreview(this.#saved.plan, this.status);
2558
- }
2559
- /** Obtain a firm quote before signing. This intent contains no private inputs or witness. */
2560
- async exportBroadcasterIntent() {
2561
- this.current();
2562
- check2(
2563
- ["prepared", "authorized"].includes(this.status),
2564
- "quote intent requires a prepared transaction"
2565
- );
2566
- return _chunkJ2JH6HIGcjs.exportBroadcasterIntent.call(void 0, this.#saved.plan);
2567
- }
2568
- current() {
2569
- check2(
2570
- !this.#lifecycle.busy && this.#lifecycle.generation === this.#saved.generation,
2571
- "stale transaction handle or active worker"
2572
- );
2573
- }
2574
- async stage(stage, allowed, work, signal) {
2575
- _optionalChain([signal, 'optionalAccess', _94 => _94.throwIfAborted, 'call', _95 => _95()]);
2576
- this.current();
2577
- check2(allowed.includes(this.status), `invalid transaction stage for ${stage}`);
2578
- this.#lifecycle.busy = true;
2579
- const saved = structuredClone(this.#saved);
2580
- try {
2581
- const next = await work(saved);
2582
- _optionalChain([signal, 'optionalAccess', _96 => _96.throwIfAborted, 'call', _97 => _97()]);
2583
- saved.generation++;
2584
- this.#lifecycle.generation = saved.generation;
2585
- return new _PreparedTransaction(
2586
- this.#runtime,
2587
- saved,
2588
- next.status,
2589
- this.#lifecycle,
2590
- _nullishCoalesce(next.authorization, () => ( this.#authorization))
2591
- );
2592
- } finally {
2593
- this.#lifecycle.busy = false;
2594
- }
2595
- }
2596
- /** Public EIP-712 request; signing transport and key custody belong to the caller. */
2597
- async exportWalletAuthorization(options = {}) {
2598
- _optionalChain([options, 'access', _98 => _98.signal, 'optionalAccess', _99 => _99.throwIfAborted, 'call', _100 => _100()]);
2599
- this.current();
2600
- check2(
2601
- _chunkJ2JH6HIGcjs.requiresAuthorization.call(void 0, this.#saved.plan),
2602
- "operation does not require wallet authorization"
2603
- );
2604
- check2(
2605
- ["prepared", "authorized"].includes(this.status),
2606
- "operation is not awaiting wallet authorization"
2607
- );
2608
- return walletSigningRequest(this.#saved.plan);
2609
- }
2610
- /** Attach an external EOA signature, retaining its witness only at the private proving boundary. */
2611
- async withWalletSignature(signature, options = {}) {
2612
- _optionalChain([options, 'access', _101 => _101.signal, 'optionalAccess', _102 => _102.throwIfAborted, 'call', _103 => _103()]);
2613
- this.current();
2614
- check2(
2615
- _chunkJ2JH6HIGcjs.requiresAuthorization.call(void 0, this.#saved.plan),
2616
- "operation does not require wallet authorization"
2617
- );
2618
- check2(
2619
- ["prepared", "authorized"].includes(this.status),
2620
- "operation is not awaiting wallet authorization"
2621
- );
2622
- const authorization = await acceptWalletSignature(this.#saved.plan, signature);
2623
- return this.stage(
2624
- "wallet authorization",
2625
- ["prepared", "authorized"],
2626
- async () => ({ status: "authorized", authorization }),
2627
- options.signal
2628
- );
2629
- }
2630
- /** Export only after proving when the funding authorization binds an actual proof hash. */
2631
- async exportFundingAuthorization(options = {}) {
2632
- _optionalChain([options, 'access', _104 => _104.signal, 'optionalAccess', _105 => _105.throwIfAborted, 'call', _106 => _106()]);
2633
- this.current();
2634
- check2(
2635
- this.status === (this.kind === "shield" ? "prepared" : "proved"),
2636
- "operation is not awaiting funding authorization or proof"
2637
- );
2638
- const request = await fundingSigningRequest(this.#saved, this.#runtime);
2639
- _optionalChain([options, 'access', _107 => _107.signal, 'optionalAccess', _108 => _108.throwIfAborted, 'call', _109 => _109()]);
2640
- this.current();
2641
- return request;
2642
- }
2643
- /** Verify an external signature against this handle's own frozen operation. */
2644
- async withFundingSignature(signature, options = {}) {
2645
- _optionalChain([options, 'access', _110 => _110.signal, 'optionalAccess', _111 => _111.throwIfAborted, 'call', _112 => _112()]);
2646
- this.current();
2647
- check2(
2648
- this.status === (this.kind === "shield" ? "prepared" : "proved"),
2649
- "operation is not awaiting funding authorization or proof"
2650
- );
2651
- const verified = await acceptFundingSignature(this.#saved, signature, this.#runtime);
2652
- return this.stage(
2653
- "funding authorization",
2654
- this.kind === "shield" ? ["prepared"] : ["proved"],
2655
- async (saved) => {
2656
- saved.plan.funding.signature = verified;
2657
- if (_optionalChain([saved, 'access', _113 => _113.plan, 'access', _114 => _114.statement, 'optionalAccess', _115 => _115.target]) !== "noir-recursive") {
2658
- saved.call = await this.encode(saved);
2659
- }
2660
- return { status: "ready" };
2661
- },
2662
- options.signal
2663
- );
2664
- }
2665
- async prove(backendOrOptions = {}, suppliedOptions = {}) {
2666
- const options = { ..."prove" in backendOrOptions ? suppliedOptions : backendOrOptions };
2667
- check2(
2668
- !this.#saved.broadcasterQuote || options.execution !== "aggregate",
2669
- "a broadcaster quote requires direct execution"
2670
- );
2671
- const plan = this.#saved.plan;
2672
- check2(plan.kind !== "shield", "shield requires no proof");
2673
- if (_chunkJ2JH6HIGcjs.requiresAuthorization.call(void 0, plan)) {
2674
- check2(
2675
- this.#authorization,
2676
- "local wallet authorization required; authorize again after recovery"
2677
- );
2678
- }
2679
- const prover = "prove" in backendOrOptions ? backendOrOptions : this.#runtime.options.prover;
2680
- if (!prover) {
2681
- throw new (0, _core.MissingCapabilityError)("prover");
2682
- }
2683
- return this.stage(
2684
- "proof",
2685
- _chunkJ2JH6HIGcjs.requiresAuthorization.call(void 0, plan) ? ["authorized"] : ["prepared"],
2686
- async (saved) => {
2687
- const p = saved.plan;
2688
- saved.proof = await proveOperation(
2689
- this.#runtime.options.protocol,
2690
- p,
2691
- this.#authorization,
2692
- prover,
2693
- options
2694
- );
2695
- if (p.fundingMode === "signature") {
2696
- return { status: "proved" };
2697
- }
2698
- if (_optionalChain([p, 'access', _116 => _116.statement, 'optionalAccess', _117 => _117.target]) !== "noir-recursive") {
2699
- saved.call = await this.encode(saved);
2700
- }
2701
- return { status: "ready" };
2702
- },
2703
- options.signal
2704
- );
2705
- }
2706
- encode(saved) {
2707
- return encodeOperation(saved);
2708
- }
2709
- /** Shield caller funding needs no wallet signing or proof; this step only encodes its frozen request. */
2710
- async ready() {
2711
- check2(
2712
- this.kind === "shield" && this.#saved.plan.fundingMode === "caller",
2713
- "operation needs authorization or proof first"
2714
- );
2715
- return this.stage("encoding", ["prepared"], async (saved) => {
2716
- saved.call = await this.encode(saved);
2717
- return { status: "ready" };
2718
- });
2719
- }
2720
- async exportTransaction() {
2721
- this.current();
2722
- check2(
2723
- _optionalChain([this, 'access', _118 => _118.#saved, 'access', _119 => _119.plan, 'access', _120 => _120.statement, 'optionalAccess', _121 => _121.target]) !== "noir-recursive",
2724
- "recursive operations must be exported as aggregate members"
2725
- );
2726
- check2(this.status === "ready" && this.#saved.call, "transaction is not ready");
2727
- return structuredClone(this.#saved.call);
2728
- }
2729
- exportProof() {
2730
- this.current();
2731
- check2(this.#saved.proof, "transaction has no proof");
2732
- return publicProof(this.#saved.proof);
2733
- }
2734
- exportAggregateMember() {
2735
- this.current();
2736
- const saved = this.#saved, plan = saved.plan;
2737
- check2(
2738
- this.status === "ready" && plan.params && saved.proof && _optionalChain([plan, 'access', _122 => _122.statement, 'optionalAccess', _123 => _123.target]) === "noir-recursive" && plan.statement.circuitName === "transact_user_slots14",
2739
- "ready recursive slots14 transaction required"
2740
- );
2741
- sameStatement(saved.proof, _chunkJ2JH6HIGcjs.statement.call(void 0, plan));
2742
- check2(
2743
- saved.proof.proofHex.length === 2 + 458 * 64,
2744
- "recursive member proof must have 458 fields"
2745
- );
2746
- return {
2747
- bundle: publicProof(saved.proof),
2748
- statement: structuredClone(plan.statement),
2749
- context: { ...plan.context },
2750
- request: {
2751
- params: structuredClone(plan.params),
2752
- deliveries: plan.outputs.map((output) => structuredClone(output.delivery)),
2753
- funding: _protocol.normalizeFunding.call(void 0, plan.funding)
2754
- }
2755
- };
2756
- }
2757
- toJSON() {
2758
- return { transaction: true, id: this.id, kind: this.kind, status: this.status };
2759
- }
2760
- [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
2761
- return this.toJSON();
2762
- }
2763
- };
2764
-
2765
- // src/client/infrastructure.ts
2766
-
2767
- var _rpc = require('@invisi-labs/rpc');
2768
- function configureTransactionInfrastructure(options) {
2769
- const { provider } = options;
2770
- const reader = _nullishCoalesce(options.chainReader, () => ( (provider ? new (0, _chunk7F7ZZW3Lcjs.EthersChainReader)(provider) : void 0)));
2771
- const protocolRpc = options.protocolRpc instanceof _rpc.ProtocolRpcClient && reader ? options.protocolRpc.withReader(reader) : options.protocolRpc;
2772
- const fundingVerifier = _nullishCoalesce(options.fundingVerifier, () => ( (provider ? new (0, _chunk7F7ZZW3Lcjs.EthersFundingVerifier)(provider, options.protocol.context.chainId) : void 0)));
2773
- return _chunkJ2JH6HIGcjs.configureRecipientInfrastructure.call(void 0, {
2774
- ...options,
2775
- ...reader ? { chainReader: reader } : {},
2776
- ...protocolRpc ? { protocolRpc } : {},
2777
- ...fundingVerifier ? { fundingVerifier } : {}
2778
- });
2779
- }
2780
- async function validateTransactionInfrastructure(options) {
2781
- if (!options.chainReader) throw new (0, _core.MissingCapabilityError)("chain reader");
2782
- if (options.provider && (await options.provider.getNetwork()).chainId !== options.protocol.context.chainId)
2783
- throw new Error("provider deployment chain mismatch");
2784
- await options.protocol.validateDeployment(options.chainReader);
2785
- }
2786
-
2787
- // src/client/Invisi.ts
2788
-
2789
-
2790
-
2791
- // src/transactions/preparation/explicit-preparation.ts
2792
-
2793
- function explicitPreparation(options, data, tokenAddress) {
2794
- if (!options.chainReader) throw new Error("chain reader required");
2795
- const inputs = structuredClone(_nullishCoalesce(data.inputs, () => ( [])));
2796
- const credits = structuredClone(_nullishCoalesce(data.creditInputs, () => ( [])));
2797
- const inventory = { notes: {}, credits: {}, reservations: {} };
2798
- const context = options.protocol.context;
2799
- function position2(input) {
2800
- if (typeof input.treeId !== "bigint" || input.treeId < 0n || input.treeId >= 1n << 256n || !Number.isInteger(input.leafIndex) || input.leafIndex < 0 || input.leafIndex >= 65536)
2801
- throw new Error("invalid explicit input position");
2802
- }
2803
- for (const input of inputs) {
2804
- position2(input);
2805
- _chunkJ2JH6HIGcjs.positiveAmount.call(void 0, input.note.amount);
2806
- if (inventory.notes[input.commitment]) throw new Error("duplicate explicit note input");
2807
- if (input.note.chainId !== context.chainId || input.note.protocolAddress !== BigInt(context.protocolAddress) || input.note.ownerAddress !== options.wallet.ownerAddress)
2808
- throw new Error("explicit note identity or deployment mismatch");
2809
- inventory.notes[input.commitment] = { ...input, spent: "unspent" };
2810
- }
2811
- for (const input of credits) {
2812
- position2(input);
2813
- if (input.role !== "owner" && input.role !== "spender")
2814
- throw new Error("invalid explicit Credit role");
2815
- const key = input.commitment + ":" + input.role;
2816
- if (inventory.credits[key]) throw new Error("duplicate explicit Credit input");
2817
- inventory.credits[key] = { ...input, spent: "unspent" };
2818
- }
2819
- const scope = {
2820
- ...context,
2821
- namespace: "explicit",
2822
- ownerAddress: options.wallet.ownerAddress
2823
- };
2824
- const capabilities = options;
2825
- if (inputs.some((input) => input.note.tokenAddress !== BigInt(_ethers.getAddress.call(void 0, tokenAddress))))
2826
- throw new Error("explicit note token mismatch");
2827
- const runtime = {
2828
- options: { ...capabilities, protocol: options.protocol.forToken(tokenAddress) },
2829
- reader: options.chainReader,
2830
- scope
2831
- };
2832
- const reprepare = (intent) => Promise.resolve().then(() => _interopRequireWildcard(require("./broadcaster-preparation-UGOTO4SX.cjs"))).then(
2833
- ({ prepareIntent }) => prepareIntent(
2834
- {
2835
- ...runtime,
2836
- explicitInputs: true,
2837
- ...data.changeAddress ? { changeAddress: data.changeAddress } : {},
2838
- readInventory: async () => structuredClone(inventory),
2839
- complete: async (plan) => plan
2840
- },
2841
- intent
2842
- )
2843
- );
2844
- return new (0, _chunkJ2JH6HIGcjs.TransactionPreparation)({
2845
- ...runtime,
2846
- explicitInputs: true,
2847
- ...data.changeAddress ? { changeAddress: data.changeAddress } : {},
2848
- readInventory: async () => structuredClone(inventory),
2849
- complete: async (plan) => PreparedTransaction.prepare({ ...runtime, reprepare }, plan)
2850
- });
2851
- }
2852
-
2853
- // src/client/Invisi.ts
2854
- var Invisi = class {
2855
- #options;
2856
- constructor(options = {}) {
2857
- if ("addressLookup" in options || "addressResolver" in options)
2858
- throw new TypeError(
2859
- "Recipient lookup belongs to each EVM output; caller resolver injection is not supported"
2860
- );
2861
- if ("ciphertextCodecs" in options || "envelopeVersion" in options) {
2862
- throw new Error(
2863
- "SDK envelope versions are fixed; encode application payload bytes externally"
2864
- );
2865
- }
2866
- if ("signer" in options || "fundingSigner" in options) {
2867
- throw new Error(
2868
- "Invisi does not accept signer defaults; export a signing request and attach the external signature"
2869
- );
2870
- }
2871
- for (const key of [
2872
- "store",
2873
- "viewing",
2874
- "authorization",
2875
- "namespace",
2876
- "coinSelector",
2877
- "wallet",
2878
- "protocol"
2879
- ]) {
2880
- if (key in options)
2881
- throw new TypeError(`Wallet state and permissions belong to WalletSession: ${key}`);
2882
- }
2883
- this.#options = {
2884
- ...options,
2885
- ...options.gasBenchmarks ? { gasBenchmarks: copyGasBenchmarks(options.gasBenchmarks) } : {}
2886
- };
2887
- Object.freeze(this);
2888
- }
2889
- /** A detached snapshot of shared infrastructure; wallet permissions and persistence stay external. */
2890
- getInfrastructure() {
2891
- return Object.freeze({
2892
- ...this.#options,
2893
- ...this.#options.gasBenchmarks ? { gasBenchmarks: copyGasBenchmarks(this.#options.gasBenchmarks) } : {}
2894
- });
2895
- }
2896
- async resolve(options) {
2897
- const runtime = configureTransactionInfrastructure({
2898
- ...this.getInfrastructure(),
2899
- ...options
2900
- });
2901
- await validateTransactionInfrastructure(runtime);
2902
- return runtime;
2903
- }
2904
- /** Discover the selected chain's registry and prepare an independent signing request. */
2905
- async prepareRegistration(options) {
2906
- return _chunkJ2JH6HIGcjs.prepareWithErrors.call(void 0, "prepareRegistration", async () => {
2907
- for (const key of Object.keys(options)) {
2908
- if (!["wallet", "update", "deadline"].includes(key)) {
2909
- throw new Error(`Unknown registration option: ${key}`);
2910
- }
2911
- }
2912
- this.assertPublicIdentity(options);
2913
- const selected = { ...options };
2914
- const { provider, protocolRpc } = this.#options;
2915
- if (!provider) throw new (0, _core.MissingCapabilityError)("ethers provider");
2916
- if (!(protocolRpc instanceof _rpc.ProtocolRpcClient)) {
2917
- throw new (0, _core.MissingCapabilityError)("Protocol RPC deployment discovery");
2918
- }
2919
- const chainId = (await provider.getNetwork()).chainId;
2920
- const deployment = await protocolRpc.getDeployment(chainId);
2921
- if (!deployment.registry) {
2922
- throw new (0, _core.MissingCapabilityError)("receiving-key registry deployment");
2923
- }
2924
- const registry = new AddressRegistry(
2925
- { chainId, registryAddress: deployment.registry.address },
2926
- { expectedRuntimeCodeHash: deployment.registry.runtimeCodeHash }
2927
- );
2928
- return registry.prepareRegistration({ ...selected, provider });
2929
- });
2930
- }
2931
- assertPublicIdentity(options) {
2932
- const { wallet } = options;
2933
- if (!(wallet instanceof _core.PublicWallet) || ["getViewer", "getDetector", "exportAuthorization"].some((key) => key in wallet)) {
2934
- throw new Error(
2935
- "Independent preparation requires a PublicWallet without private capabilities"
2936
- );
2937
- }
2938
- for (const key of ["authorization", "signer", "fundingSigner", "viewing"]) {
2939
- if (key in options)
2940
- throw new Error(`Independent preparation does not accept capability: ${key}`);
2941
- }
2942
- }
2943
- resolveExplicit(options) {
2944
- this.assertPublicIdentity(options);
2945
- return this.resolve({ wallet: options.wallet, protocol: options.protocol });
2946
- }
2947
- async prepareTransfer(options) {
2948
- return _chunkJ2JH6HIGcjs.prepareWithErrors.call(void 0, "prepareTransfer", async () => {
2949
- const { wallet, protocol, ...input } = options;
2950
- const request = structuredClone(input);
2951
- const runtime = await this.resolveExplicit(options);
2952
- const preparation = explicitPreparation(runtime, request, request.tokenAddress);
2953
- return preparation.prepareTransfer(request);
2954
- });
2955
- }
2956
- async prepareShield(options) {
2957
- return _chunkJ2JH6HIGcjs.prepareWithErrors.call(void 0, "prepareShield", async () => {
2958
- const { wallet, protocol, ...input } = options;
2959
- const request = structuredClone(input);
2960
- const runtime = await this.resolveExplicit(options);
2961
- const preparation = explicitPreparation(runtime, {}, request.tokenAddress);
2962
- return preparation.prepareShield(request);
2963
- });
2964
- }
2965
- async prepareCreateCredit(options) {
2966
- return _chunkJ2JH6HIGcjs.prepareWithErrors.call(void 0, "prepareCreateCredit", async () => {
2967
- const { wallet, protocol, ...input } = options;
2968
- const request = structuredClone(input);
2969
- const runtime = await this.resolveExplicit(options);
2970
- const preparation = explicitPreparation(runtime, request, request.tokenAddress);
2971
- return preparation.prepareCreateCredit(request);
2972
- });
2973
- }
2974
- async prepareDrawCredit(options) {
2975
- return _chunkJ2JH6HIGcjs.prepareWithErrors.call(void 0, "prepareDrawCredit", async () => {
2976
- const { wallet, protocol, ...input } = options;
2977
- const request = structuredClone(input);
2978
- const runtime = await this.resolveExplicit(options);
2979
- const preparation = explicitPreparation(runtime, request, request.tokenAddress);
2980
- return preparation.prepareDrawCredit(request);
2981
- });
2982
- }
2983
- async prepareTopUpCredit(options) {
2984
- return _chunkJ2JH6HIGcjs.prepareWithErrors.call(void 0, "prepareTopUpCredit", async () => {
2985
- const { wallet, protocol, ...input } = options;
2986
- const request = structuredClone(input);
2987
- const runtime = await this.resolveExplicit(options);
2988
- const preparation = explicitPreparation(runtime, request, request.tokenAddress);
2989
- return preparation.prepareTopUpCredit(request);
2990
- });
2991
- }
2992
- async prepareCancelCredit(options) {
2993
- return _chunkJ2JH6HIGcjs.prepareWithErrors.call(void 0, "prepareCancelCredit", async () => {
2994
- const { wallet, protocol, ...input } = options;
2995
- const request = structuredClone(input);
2996
- const runtime = await this.resolveExplicit(options);
2997
- const preparation = explicitPreparation(runtime, request, request.tokenAddress);
2998
- return preparation.prepareCancelCredit(request);
2999
- });
3000
- }
3001
- toJSON() {
3002
- return { invisi: true };
3003
- }
3004
- [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
3005
- return this.toJSON();
3006
- }
3007
- };
3008
-
3009
- // src/discovery/protocol-events.ts
3010
- var _contracts = require('@invisi-labs/protocol/contracts');
3011
-
3012
- var protocolInterface = new (0, _ethers.Interface)(_contracts.invisiProtocolAbi);
3013
- function decodeProtocolEvent(log) {
3014
- const decoded = protocolInterface.parseLog(log);
3015
- if (!decoded) throw new Error("Unknown protocol receipt event");
3016
- const encoded = protocolInterface.encodeEventLog(decoded.fragment, decoded.args);
3017
- if (encoded.data.toLowerCase() !== log.data.toLowerCase() || encoded.topics.length !== log.topics.length || encoded.topics.some(
3018
- (topic, index2) => topic.toLowerCase() !== log.topics[index2].toLowerCase()
3019
- ))
3020
- throw new Error("Noncanonical protocol receipt event");
3021
- const args = decoded.args.toObject(true);
3022
- for (const key of [
3023
- "tokens",
3024
- "commitments",
3025
- "nullifiers",
3026
- "outputCommitments",
3027
- "leafIndices",
3028
- "remainderLeafIndices"
3029
- ]) {
3030
- const values = decoded.args.getValue(key);
3031
- if (values) args[key] = values.toArray(true);
3032
- }
3033
- for (const key of ["sources", "deliveries"]) {
3034
- const values = decoded.args.getValue(key);
3035
- if (values) args[key] = values.map((value) => value.toObject(true));
3036
- }
3037
- const params = decoded.args.getValue("params");
3038
- if (params) {
3039
- const source = _nullishCoalesce(params.getValue("creation"), () => ( params));
3040
- const target = params.getValue("creation") ? args.params.creation : args.params;
3041
- for (const key of ["nullifiers", "remainderCommitments", "expiries", "recoveryAmounts"]) {
3042
- const values = source.getValue(key);
3043
- if (values) target[key] = values.toArray(true);
3044
- }
3045
- const sources = source.getValue("sources");
3046
- if (sources) target.sources = sources.map((value) => value.toObject(true));
3047
- }
3048
- return { eventName: decoded.name, args };
3049
- }
3050
-
3051
- // src/discovery/receipt-logs.ts
3052
- function readProtocolLogs(receipt, protocolAddress) {
3053
- if (receipt.status !== "success" || !/^0x[0-9a-fA-F]{64}$/.test(receipt.transactionHash) || typeof receipt.block.number !== "bigint" || receipt.block.number < 0n || !/^0x[0-9a-fA-F]{64}$/.test(receipt.block.hash))
3054
- throw new Error("Invalid canonical protocol receipt");
3055
- const seen = /* @__PURE__ */ new Set();
3056
- return receipt.logs.filter((log) => log.address.toLowerCase() === protocolAddress.toLowerCase()).map((log) => {
3057
- if (log.transactionHash.toLowerCase() !== receipt.transactionHash.toLowerCase() || !Number.isSafeInteger(log.logIndex) || log.logIndex < 0 || seen.has(log.logIndex))
3058
- throw new Error("Invalid canonical receipt log identity");
3059
- seen.add(log.logIndex);
3060
- const decoded = decodeProtocolEvent(log);
3061
- return {
3062
- address: log.address,
3063
- eventName: decoded.eventName,
3064
- args: decoded.args,
3065
- blockNumber: receipt.block.number,
3066
- blockHash: receipt.block.hash,
3067
- transactionHash: receipt.transactionHash.toLowerCase(),
3068
- logIndex: log.logIndex,
3069
- removed: false
3070
- };
3071
- }).sort((a, b) => a.logIndex - b.logIndex);
3072
- }
3073
-
3074
- // src/discovery/discovery.ts
3075
-
3076
-
3077
-
3078
-
3079
-
3080
-
3081
-
3082
- var EVENTS = /* @__PURE__ */ new Set([
3083
- "CommitmentsInserted",
3084
- "BatchOutputs",
3085
- "Shield",
3086
- "Transact",
3087
- "CrossTreeTransact",
3088
- "CreditCreated",
3089
- "CreditDraw",
3090
- "CreditToppedUp",
3091
- "CreditCancelled"
3092
- ]);
3093
- function check3(ok, message) {
3094
- if (!ok) throw new Error(message);
3095
- }
3096
- function object(value) {
3097
- check3(value && typeof value === "object" && !Array.isArray(value), "invalid event object");
3098
- return value;
3099
- }
3100
- function array(value) {
3101
- check3(Array.isArray(value), "invalid event array");
3102
- check3(
3103
- Array.from({ length: value.length }, (_, i) => i in value).every(Boolean),
3104
- "sparse event array"
3105
- );
3106
- return value;
3107
- }
3108
- function integer(value) {
3109
- check3(
3110
- typeof value === "bigint" || typeof value === "number" && Number.isSafeInteger(value),
3111
- "invalid event integer"
3112
- );
3113
- const n = BigInt(value);
3114
- check3(n >= 0n, "negative event integer");
3115
- return n;
3116
- }
3117
- function index(value) {
3118
- const n = integer(value);
3119
- check3(n < 65536n, "invalid event leaf index");
3120
- return Number(n);
3121
- }
3122
- function hash(value) {
3123
- check3(typeof value === "string" && /^0x[0-9a-fA-F]{64}$/.test(value), "invalid event hash");
3124
- return value.toLowerCase();
3125
- }
3126
- function contextCheck(context) {
3127
- check3(context.chainId >= 0n && context.chainId < 1n << 64n, "invalid discovery chain");
3128
- check3(
3129
- _ethers.isAddress.call(void 0, context.protocolAddress) && BigInt(context.protocolAddress) !== 0n,
3130
- "invalid discovery instance/token"
3131
- );
3132
- }
3133
- var position = (tree, at) => `${tree}:${at}`;
3134
- function extractDeliveryCandidates(logs, context, confirmedThrough) {
3135
- contextCheck(context);
3136
- check3(confirmedThrough >= 0n, "invalid confirmed height");
3137
- const relevant = logs.filter(
3138
- (log) => log.address.toLowerCase() === context.protocolAddress.toLowerCase() && EVENTS.has(log.eventName)
3139
- );
3140
- const insertions = /* @__PURE__ */ new Map();
3141
- const metadata = (log) => {
3142
- check3(!log.removed, "discovery resync required after reorg");
3143
- check3(
3144
- typeof log.blockNumber === "bigint" && log.blockNumber >= 0n && log.blockNumber <= confirmedThrough,
3145
- "event is not confirmed"
3146
- );
3147
- check3(Number.isSafeInteger(log.logIndex) && log.logIndex >= 0, "invalid log position");
3148
- return {
3149
- blockNumber: log.blockNumber,
3150
- blockHash: hash(log.blockHash),
3151
- transactionHash: hash(log.transactionHash)
3152
- };
3153
- };
3154
- const insertionKey = (log, tree, at) => `${hash(log.transactionHash)}:${position(tree, at)}`;
3155
- for (const log of relevant) {
3156
- metadata(log);
3157
- if (log.eventName !== "CommitmentsInserted" && log.eventName !== "BatchOutputs") continue;
3158
- const a = object(log.args), tree = integer(a.treeId), start = index(a.startLeafIndex), leaves = array(a.commitments);
3159
- check3(tree > 0n && tree < 1n << 64n, "invalid insertion tree");
3160
- check3(start + leaves.length <= 65536, "insertion exceeds tree capacity");
3161
- for (const [i, leaf] of leaves.entries()) {
3162
- const key = insertionKey(log, tree, start + i), value = hash(leaf), previous = insertions.get(key);
3163
- check3(!previous || previous === value, "conflicting insertion events");
3164
- insertions.set(key, value);
3165
- }
3166
- }
3167
- const results = /* @__PURE__ */ new Map();
3168
- const add = (log, tree, at, commitment, role, wire, token = _nullishCoalesce(_nullishCoalesce(_optionalChain([log, 'access', _124 => _124.args, 'optionalAccess', _125 => _125.token]), () => ( _optionalChain([log, 'access', _126 => _126.args, 'optionalAccess', _127 => _127.params, 'optionalAccess', _128 => _128.token]))), () => ( _optionalChain([log, 'access', _129 => _129.args, 'optionalAccess', _130 => _130.params, 'optionalAccess', _131 => _131.creation, 'optionalAccess', _132 => _132.token])))) => {
3169
- check3(tree > 0n && tree < 1n << 64n, "invalid output tree");
3170
- const inserted = insertions.get(insertionKey(log, tree, at));
3171
- check3(inserted, "delivery has no matching canonical insertion");
3172
- if (commitment !== void 0)
3173
- check3(hash(commitment) === inserted, "delivery commitment conflicts with insertion");
3174
- const delivery = _protocol.normalizeOpaqueDelivery.call(void 0, wire, { allowEmpty: role === "funds" });
3175
- check3(
3176
- typeof token === "string" && _ethers.isAddress.call(void 0, token) && BigInt(token) !== 0n,
3177
- "invalid event token"
3178
- );
3179
- const value = {
3180
- tokenAddress: token,
3181
- treeId: tree,
3182
- leafIndex: at,
3183
- commitment: inserted,
3184
- role,
3185
- delivery,
3186
- ...metadata(log)
3187
- };
3188
- const key = `${insertionKey(log, tree, at)}:${role}`, previous = results.get(key);
3189
- check3(
3190
- !previous || previous.tokenAddress.toLowerCase() === token.toLowerCase() && previous.delivery.ciphertext === delivery.ciphertext && previous.delivery.clue === delivery.clue && previous.blockHash === value.blockHash,
3191
- "conflicting delivery events"
3192
- );
3193
- results.set(key, value);
3194
- };
3195
- const creation = (log, a, fields) => {
3196
- const tree = integer(a.outputTreeId), leaves = array(a.leafIndices), ds = array(a.deliveries);
3197
- const change = hash(fields.changeCommitment), hasChange = BigInt(change) !== 0n;
3198
- check3(
3199
- ds.length === 3 && leaves.length === (hasChange ? 2 : 1),
3200
- "invalid Credit creation delivery slots"
3201
- );
3202
- add(log, tree, index(leaves[0]), fields.creditCommitment, "owner", ds[0]);
3203
- add(log, tree, index(leaves[0]), fields.creditCommitment, "spender", ds[1]);
3204
- if (hasChange) add(log, tree, index(leaves[1]), change, "funds", ds[2]);
3205
- else _protocol.normalizeOpaqueDelivery.call(void 0, ds[2], { empty: true });
3206
- };
3207
- for (const log of relevant) {
3208
- const a = object(log.args);
3209
- if (log.eventName === "Shield") {
3210
- const ds = array(a.deliveries), tree = integer(a.treeId), start = index(a.startLeafIndex);
3211
- check3(start + ds.length <= 65536, "shield exceeds tree capacity");
3212
- ds.forEach((d, i) => add(log, tree, start + i, void 0, "funds", d));
3213
- } else if (log.eventName === "Transact" || log.eventName === "CrossTreeTransact") {
3214
- const cs = array(a.outputCommitments), ds = array(a.deliveries), leaves = array(a.leafIndices), tree = integer(a.outputTreeId);
3215
- check3(
3216
- cs.length === ds.length && cs.length === leaves.length,
3217
- "invalid transact delivery slots"
3218
- );
3219
- cs.forEach((c, i) => add(log, tree, index(leaves[i]), c, "funds", ds[i]));
3220
- } else if (log.eventName === "BatchOutputs") {
3221
- const tokens = array(a.tokens);
3222
- const cs = array(a.commitments), tree = integer(a.treeId), start = index(a.startLeafIndex), packed = a.packedDeliveries;
3223
- check3(
3224
- typeof packed === "string" && /^0x(?:[0-9a-fA-F]{2})*$/.test(packed),
3225
- "invalid packed deliveries"
3226
- );
3227
- check3(tokens.length === cs.length, "batch token count mismatch");
3228
- check3(start + cs.length <= 65536, "batch exceeds tree capacity");
3229
- let offset = 2;
3230
- cs.forEach((c, i) => {
3231
- check3(offset + 4 <= packed.length, "truncated delivery length prefix");
3232
- const length = Number.parseInt(packed.slice(offset, offset + 4), 16);
3233
- offset += 4;
3234
- check3(
3235
- length <= _core.MAX_CIPHERTEXT_BYTES && offset + length * 2 + (length === 0 ? 0 : 136) <= packed.length,
3236
- "invalid packed delivery length"
3237
- );
3238
- const ciphertext = `0x${packed.slice(offset, offset + length * 2)}`;
3239
- offset += length * 2;
3240
- const clue = length === 0 ? "0x" : `0x${packed.slice(offset, offset + 136)}`;
3241
- if (length !== 0) offset += 136;
3242
- add(log, tree, start + i, c, "funds", { ciphertext, clue }, tokens[i]);
3243
- });
3244
- check3(offset === packed.length, "trailing packed delivery bytes");
3245
- } else if (log.eventName === "CreditCreated") creation(log, a, a);
3246
- else if (log.eventName === "CreditToppedUp")
3247
- creation(log, a, object(object(a.params).creation));
3248
- else if (log.eventName === "CreditDraw") {
3249
- const p = object(a.params), cs = array(p.remainderCommitments), ds = array(a.deliveries), leaves = array(a.remainderLeafIndices), tree = integer(a.outputTreeId);
3250
- check3(
3251
- ds.length === 2 * cs.length && leaves.length === cs.length,
3252
- "invalid draw delivery slots"
3253
- );
3254
- cs.forEach((c, i) => {
3255
- if (BigInt(hash(c)) === 0n) {
3256
- check3(integer(leaves[i]) === 0n, "absent remainder has nonzero position");
3257
- _protocol.normalizeOpaqueDelivery.call(void 0, ds[2 * i], { empty: true });
3258
- _protocol.normalizeOpaqueDelivery.call(void 0, ds[2 * i + 1], { empty: true });
3259
- } else {
3260
- add(log, tree, index(leaves[i]), c, "owner", ds[2 * i]);
3261
- add(log, tree, index(leaves[i]), c, "spender", ds[2 * i + 1]);
3262
- }
3263
- });
3264
- }
3265
- }
3266
- return [...results.values()];
3267
- }
3268
- async function decryptCandidates(logs, options) {
3269
- contextCheck(options.context);
3270
- _core.decodeAddress.call(void 0, _core.ReceivingAddress.fromIdentity(options.viewing.ownerAddress).toString());
3271
- check3(
3272
- !logs.some(
3273
- (log) => log.address.toLowerCase() === options.context.protocolAddress.toLowerCase() && log.removed
3274
- ),
3275
- "discovery resync required after reorg"
3276
- );
3277
- const candidates = extractDeliveryCandidates(logs, options.context, options.confirmedThrough);
3278
- const positions = /* @__PURE__ */ new Map();
3279
- const unique = /* @__PURE__ */ new Map();
3280
- for (const candidate of candidates) {
3281
- const key = position(candidate.treeId, candidate.leafIndex);
3282
- const previous = positions.get(key);
3283
- check3(
3284
- !previous || previous.commitment === candidate.commitment && previous.blockHash === candidate.blockHash && previous.transactionHash === candidate.transactionHash && previous.tokenAddress.toLowerCase() === candidate.tokenAddress.toLowerCase(),
3285
- "conflicting canonical position"
3286
- );
3287
- positions.set(key, candidate);
3288
- unique.set(`${key}:${candidate.role}`, candidate);
3289
- }
3290
- const notes = [];
3291
- const credits = [];
3292
- for (const candidate of unique.values()) {
3293
- const { delivery, role, ...positionData } = candidate;
3294
- const context = {
3295
- chainId: options.context.chainId,
3296
- protocolAddress: BigInt(options.context.protocolAddress),
3297
- tokenAddress: BigInt(candidate.tokenAddress),
3298
- outputCommitment: candidate.commitment
3299
- };
3300
- try {
3301
- if (role === "funds") {
3302
- if (delivery.ciphertext === "0x") continue;
3303
- const note = await options.viewing.decryptNote(delivery.ciphertext, context);
3304
- notes.push({ ...positionData, note });
3305
- } else {
3306
- const state = await options.viewing.decryptCredit(delivery.ciphertext, {
3307
- ...context,
3308
- role
3309
- });
3310
- credits.push({ ...positionData, role, state });
3311
- }
3312
- } catch (e5) {
3313
- }
3314
- }
3315
- return { notes, credits };
3316
- }
3317
-
3318
- // src/broadcaster/index.ts
3319
-
3320
-
3321
- var broadcasterQuoteTypes = {
3322
- Quote: [
3323
- { name: "token", type: "address" },
3324
- { name: "feeRecipient", type: "address" },
3325
- { name: "feeAmount", type: "uint256" },
3326
- { name: "deadline", type: "uint256" },
3327
- { name: "maxGas", type: "uint256" },
3328
- { name: "requestHash", type: "bytes32" }
3329
- ]
3330
- };
3331
- function broadcasterQuoteDomain(trust) {
3332
- return {
3333
- name: "InvisiBroadcaster",
3334
- version: "1",
3335
- chainId: trust.chainId,
3336
- verifyingContract: _ethers.getAddress.call(void 0, trust.protocol)
3337
- };
3338
- }
3339
- var supportedMethods = ["transact", "shield", "createCredit", "topUpCredit", "cancelCredit"];
3340
- var intentAbi = _contracts.invisiProtocolAbi.filter(
3341
- (item) => item.type === "function" && supportedMethods.includes(item.name) && (item.name !== "transact" || _optionalChain([item, 'access', _133 => _133.inputs, 'access', _134 => _134[1], 'optionalAccess', _135 => _135.type]) === "tuple")
3342
- );
3343
- var broadcasterTransactInterface = new (0, _ethers.Interface)(intentAbi);
3344
- function decodeBroadcasterIntent(data) {
3345
- const parsed = broadcasterTransactInterface.parseTransaction({ data });
3346
- if (!parsed || !supportedMethods.includes(parsed.name))
3347
- throw new Error("unsupported broadcaster method");
3348
- const fragment = parsed.fragment;
3349
- const decoded = parsed.args;
3350
- if (broadcasterTransactInterface.encodeFunctionData(fragment, decoded).toLowerCase() !== data.toLowerCase())
3351
- throw new Error("noncanonical broadcaster calldata");
3352
- const method = parsed.name;
3353
- const raw = method === "transact" ? decoded[1] : void 0;
3354
- const params = _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _136 => _136.params]), () => ( (method === "shield" ? decoded[0] : method === "topUpCredit" ? decoded[1].creation : decoded[1])));
3355
- const funding = _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _137 => _137.funding]), () => ( (method === "shield" ? decoded[3] : ["createCredit", "topUpCredit"].includes(method) ? decoded[3] : void 0)));
3356
- const deliveries = _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _138 => _138.deliveries]), () => ( (method === "shield" ? decoded[2] : ["createCredit", "topUpCredit"].includes(method) ? decoded[2] : [])));
3357
- return {
3358
- fragment,
3359
- method,
3360
- args: decoded,
3361
- proof: method === "shield" ? "0x" : decoded[0],
3362
- request: { params, funding, deliveries }
3363
- };
3364
- }
3365
- function broadcasterRequestHash(data) {
3366
- const { fragment, method, args } = decodeBroadcasterIntent(data);
3367
- const copy = (value) => Array.isArray(value) ? value.map(copy) : value;
3368
- const canonical = copy(args);
3369
- if (method !== "shield") canonical[0] = "0x";
3370
- if (method === "transact") canonical[1][2][4] = "0x";
3371
- else if (method !== "cancelCredit") canonical[3][4] = "0x";
3372
- const calldata = broadcasterTransactInterface.encodeFunctionData(fragment, canonical);
3373
- return _ethers.keccak256.call(void 0,
3374
- _ethers.AbiCoder.defaultAbiCoder().encode(
3375
- ["string", "string", "bytes"],
3376
- ["InvisiBroadcasterIntentV1", method, calldata]
3377
- )
3378
- );
3379
- }
3380
- function verifyBroadcasterQuote(signed, trust, data, now = BigInt(Math.floor(Date.now() / 1e3))) {
3381
- const { quote } = signed;
3382
- const { request } = decodeBroadcasterIntent(data);
3383
- const p = request.params;
3384
- if (quote.requestHash !== broadcasterRequestHash(data) || _ethers.getAddress.call(void 0, quote.token) !== _ethers.getAddress.call(void 0, p.token) || _ethers.getAddress.call(void 0, quote.feeRecipient) !== _ethers.getAddress.call(void 0, p.feeRecipient) || BigInt(quote.feeAmount) !== p.feeAmount || BigInt(quote.deadline) > p.deadline || BigInt(quote.deadline) < now || BigInt(quote.maxGas) <= 0n || BigInt(quote.feeAmount) <= 0n || BigInt(quote.feeAmount) >= 1n << 128n)
3385
- throw new Error("quote does not match final intent or bounds");
3386
- if (_ethers.getAddress.call(void 0,
3387
- _ethers.verifyTypedData.call(void 0,
3388
- broadcasterQuoteDomain(trust),
3389
- broadcasterQuoteTypes,
3390
- quote,
3391
- signed.signature
3392
- )
3393
- ) !== _ethers.getAddress.call(void 0, trust.signer))
3394
- throw new Error("untrusted quote signature");
3395
- return quote;
3396
- }
3397
- function checkedStatus(value, id) {
3398
- const status = value;
3399
- if (!status || status.id !== id || !["pending", "submitted", "confirmed", "reverted", "uncertain"].includes(status.state) || status.transactionHash !== void 0 && !/^0x[0-9a-fA-F]{64}$/.test(status.transactionHash))
3400
- throw new Error("invalid broadcaster status");
3401
- return status;
3402
- }
3403
- var BroadcasterClient = (_class = class {
3404
-
3405
-
3406
-
3407
- __init() {this.requestId = 0}
3408
- constructor(configuration, transport) {;_class.prototype.__init.call(this);
3409
- this.configuration = Object.freeze({
3410
- endpoint: configuration.endpoint,
3411
- quoteSigner: _ethers.getAddress.call(void 0, configuration.quoteSigner),
3412
- feeRecipient: _ethers.getAddress.call(void 0, configuration.feeRecipient)
3413
- });
3414
- if (BigInt(this.configuration.quoteSigner) === 0n || BigInt(this.configuration.feeRecipient) === 0n)
3415
- throw new Error("invalid broadcaster configuration");
3416
- this.url = configuration.endpoint;
3417
- const base = new URL(this.url);
3418
- if (base.protocol !== "https:" || base.username || base.password)
3419
- throw new Error("broadcaster requires HTTPS");
3420
- this.transport = _nullishCoalesce(transport, () => ( (async (request) => {
3421
- const response = await fetch(base, {
3422
- redirect: "error",
3423
- method: "POST",
3424
- body: JSON.stringify(request),
3425
- headers: { "content-type": "application/json" },
3426
- signal: AbortSignal.timeout(3e4)
3427
- });
3428
- if (!response.ok) throw new Error(`Broadcaster HTTP ${response.status}`);
3429
- if (!response.body) throw new Error("empty broadcaster response");
3430
- const reader = response.body.getReader();
3431
- const chunks = [];
3432
- let size = 0;
3433
- try {
3434
- while (true) {
3435
- const result = await reader.read();
3436
- if (result.done) break;
3437
- size += result.value.length;
3438
- if (size > 65536) throw new Error("broadcaster response too large");
3439
- chunks.push(result.value);
3440
- }
3441
- } finally {
3442
- await reader.cancel();
3443
- }
3444
- const bytes = new Uint8Array(size);
3445
- let offset = 0;
3446
- for (const chunk of chunks) {
3447
- bytes.set(chunk, offset);
3448
- offset += chunk.length;
3449
- }
3450
- return JSON.parse(new TextDecoder().decode(bytes));
3451
- })));
3452
- }
3453
- async call(method, params) {
3454
- const id = ++this.requestId;
3455
- const response = await this.transport({
3456
- jsonrpc: "2.0",
3457
- id,
3458
- method,
3459
- params: [params]
3460
- });
3461
- if (!response || response.jsonrpc !== "2.0" || response.id !== id || Object.hasOwn(response, "result") === Object.hasOwn(response, "error"))
3462
- throw new Error("invalid broadcaster JSON-RPC response");
3463
- if (response.error) {
3464
- if (!Number.isInteger(response.error.code) || typeof response.error.message !== "string")
3465
- throw new Error("invalid broadcaster JSON-RPC error");
3466
- throw new BroadcasterRpcError(response.error.code, response.error.message);
3467
- }
3468
- return response.result;
3469
- }
3470
- async fee(token, data) {
3471
- const fee = await this.call("broadcaster_getFee", {
3472
- token: _ethers.getAddress.call(void 0, token),
3473
- ...data ? { data } : {}
3474
- });
3475
- if (!fee || _ethers.getAddress.call(void 0, fee.feeRecipient) !== this.configuration.feeRecipient || !/^\d+$/.test(fee.feeAmount) || BigInt(fee.feeAmount) <= 0n || BigInt(fee.feeAmount) >= 1n << 128n || !/^\d+$/.test(fee.maxGas) || BigInt(fee.maxGas) <= 0n)
3476
- throw new Error("invalid broadcaster fee");
3477
- return fee;
3478
- }
3479
- async quote(data, context) {
3480
- const signed = await this.call("broadcaster_getQuote", {
3481
- data
3482
- });
3483
- verifyBroadcasterQuote(
3484
- signed,
3485
- { ...context, signer: this.configuration.quoteSigner },
3486
- data
3487
- );
3488
- if (_ethers.getAddress.call(void 0, signed.quote.feeRecipient) !== this.configuration.feeRecipient)
3489
- throw new Error("unregistered fee recipient");
3490
- return { quote: signed.quote, signature: signed.signature, context: { ...context } };
3491
- }
3492
- async submit(data, signed, idempotencyKey) {
3493
- if (!signed.context) throw new Error("missing verified quote context");
3494
- verifyBroadcasterQuote(
3495
- signed,
3496
- { ...signed.context, signer: this.configuration.quoteSigner },
3497
- data,
3498
- 0n
3499
- );
3500
- if (_ethers.getAddress.call(void 0, signed.quote.feeRecipient) !== this.configuration.feeRecipient)
3501
- throw new Error("unregistered fee recipient");
3502
- return checkedStatus(
3503
- await this.call("broadcaster_submitTransaction", {
3504
- data,
3505
- quote: signed.quote,
3506
- signature: signed.signature,
3507
- idempotencyKey
3508
- }),
3509
- idempotencyKey
3510
- );
3511
- }
3512
- async status(id) {
3513
- return checkedStatus(await this.call("broadcaster_getTransactionStatus", { id }), id);
3514
- }
3515
- }, _class);
3516
- var BroadcasterRpcError = class extends Error {
3517
- constructor(code, message) {
3518
- super(message);
3519
- this.code = code;
3520
- this.name = "BroadcasterRpcError";
3521
- }
3522
- };
3523
-
3524
-
3525
-
3526
-
3527
-
3528
-
3529
-
3530
-
3531
-
3532
-
3533
-
3534
-
3535
-
3536
-
3537
-
3538
-
3539
-
3540
-
3541
-
3542
-
3543
-
3544
-
3545
-
3546
-
3547
-
3548
-
3549
-
3550
-
3551
-
3552
-
3553
-
3554
-
3555
-
3556
-
3557
-
3558
-
3559
-
3560
-
3561
-
3562
-
3563
-
3564
- exports.creditReservationKey = creditReservationKey; exports.inputFacts = inputFacts; exports.operationSources = operationSources; exports.copyGasBenchmarks = copyGasBenchmarks; exports.defineGasBenchmarks = defineGasBenchmarks; exports.estimateShapeGas = estimateShapeGas; exports.estimateBenchmarkGas = estimateBenchmarkGas; exports.estimateGasReference = estimateGasReference; exports.AddressRegistry = AddressRegistry; exports.TransactionOutput = TransactionOutput; exports.publicProof = publicProof; exports.sameStatement = sameStatement; exports.encodeOperation = encodeOperation; exports.witnessFor = witnessFor; exports.fundingTypedData = fundingTypedData; exports.authorizeOperation = authorizeOperation; exports.proveOperation = proveOperation; exports.signOperationFunding = signOperationFunding; exports.walletSigningRequest = walletSigningRequest; exports.acceptWalletSignature = acceptWalletSignature; exports.fundingSigningRequest = fundingSigningRequest; exports.acceptFundingSignature = acceptFundingSignature; exports.operationPreview = operationPreview; exports.PreparedTransaction = PreparedTransaction; exports.configureTransactionInfrastructure = configureTransactionInfrastructure; exports.validateTransactionInfrastructure = validateTransactionInfrastructure; exports.Invisi = Invisi; exports.decodeProtocolEvent = decodeProtocolEvent; exports.readProtocolLogs = readProtocolLogs; exports.extractDeliveryCandidates = extractDeliveryCandidates; exports.decryptCandidates = decryptCandidates; exports.broadcasterQuoteTypes = broadcasterQuoteTypes; exports.broadcasterQuoteDomain = broadcasterQuoteDomain; exports.broadcasterTransactInterface = broadcasterTransactInterface; exports.decodeBroadcasterIntent = decodeBroadcasterIntent; exports.broadcasterRequestHash = broadcasterRequestHash; exports.verifyBroadcasterQuote = verifyBroadcasterQuote; exports.BroadcasterClient = BroadcasterClient; exports.BroadcasterRpcError = BroadcasterRpcError;
3565
- //# sourceMappingURL=chunk-RHNIHI4P.cjs.map