@invisi-labs/protocol 1.1.6 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +5 -0
  2. package/dist/chunk-7SS2YSEF.js +199 -0
  3. package/dist/chunk-7SS2YSEF.js.map +1 -0
  4. package/dist/{chunk-BYJ4LXCJ.js → chunk-HHJLFLVJ.js} +616 -714
  5. package/dist/chunk-HHJLFLVJ.js.map +1 -0
  6. package/dist/chunk-MVQQD5W5.js +487 -0
  7. package/dist/chunk-MVQQD5W5.js.map +1 -0
  8. package/dist/chunk-Z2XPYNMC.js +446 -0
  9. package/dist/chunk-Z2XPYNMC.js.map +1 -0
  10. package/dist/contracts.cjs +615 -713
  11. package/dist/contracts.cjs.map +1 -1
  12. package/dist/contracts.d.cts +5 -5
  13. package/dist/contracts.d.ts +5 -5
  14. package/dist/contracts.js +1 -1
  15. package/dist/credit.cjs +3367 -0
  16. package/dist/credit.cjs.map +1 -0
  17. package/dist/credit.d.cts +252 -0
  18. package/dist/credit.d.ts +252 -0
  19. package/dist/credit.js +53 -0
  20. package/dist/credit.js.map +1 -0
  21. package/dist/index.cjs +4294 -4223
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +128 -933
  24. package/dist/index.d.ts +128 -933
  25. package/dist/index.js +2853 -3584
  26. package/dist/index.js.map +1 -1
  27. package/dist/note.cjs +3456 -0
  28. package/dist/note.cjs.map +1 -0
  29. package/dist/note.d.cts +232 -0
  30. package/dist/note.d.ts +232 -0
  31. package/dist/note.js +43 -0
  32. package/dist/note.js.map +1 -0
  33. package/dist/provenance.cjs +558 -0
  34. package/dist/provenance.cjs.map +1 -0
  35. package/dist/provenance.d.cts +188 -0
  36. package/dist/provenance.d.ts +188 -0
  37. package/dist/provenance.js +499 -0
  38. package/dist/provenance.js.map +1 -0
  39. package/dist/{types-BmUlasOg.d.cts → types-CUnFzl5S.d.cts} +530 -590
  40. package/dist/{types-BmUlasOg.d.ts → types-CUnFzl5S.d.ts} +530 -590
  41. package/dist/validation-8g0SQVE5.d.ts +235 -0
  42. package/dist/validation-MgURYiNF.d.cts +235 -0
  43. package/package.json +20 -5
  44. package/dist/chunk-BYJ4LXCJ.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,140 +1,15 @@
1
- import * as _invisi_labs_core from '@invisi-labs/core';
2
- import { Hex, Address, ReceivingKeyLookup, PublicWallet, CreditDeliveryState, AuthorizedStatement, Note } from '@invisi-labs/core';
3
- import { ContractRunner, Provider } from 'ethers';
4
- import { DeploymentContext, CanonicalBlock, ProtocolDeployment, ProtocolRpcClient } from '@invisi-labs/rpc';
5
- export { CanonicalBlock, DeploymentContext, Membership, ProtocolDataProvider, ProtocolDataStatus, ProtocolUpdateRange, ProtocolUpdates } from '@invisi-labs/rpc';
6
- import { F as FundingParams, D as Delivery, I as InputSource, C as CreateCreditParams, a as CancelCreditParams, b as CreditDrawParams, T as TopUpCreditParams, c as TransactRequest, S as ShieldParams, d as ShieldOutput, e as CrossTreeTransactParams } from './types-BmUlasOg.js';
7
- import { ProofTarget, CircuitName, ProofStatement, ProvingRequest } from '@invisi-labs/prover';
1
+ export { BuildCreateCreditCalldataParams, BuildCreditDrawCalldataParams, BuildRevokeCreditCalldataParams, BuildUpdateCreditCalldataParams, CREATE_CREDIT_FIELDS, CREDIT_DRAW_CAPACITIES, REVOKE_CREDIT_TYPES, authorizedCreditInputs, buildCreateCreditCalldata, buildCreditDrawCalldata, buildRevokeCreditCalldata, buildUpdateCreditCalldata, createCreditBaseInputs, createCreditPublicInputs, creditDrawBaseInputs, creditDrawPublicInputs, encodeCreateCreditTypedData, encodeCreditDrawTypedData, encodeCreditProof, encodeRevokeCreditTypedData, encodeUpdateCreditTypedData, selectCreditDrawCircuit, updateCreditBaseInputs, updateCreditPublicInputs, validateCreateCreditRequest, validateCreditDrawRequest, validateUpdateCreditRequest } from './credit.js';
2
+ import { TransactRequestParams } from './note.js';
3
+ export { AGGREGATE_ROUTES, AggregateMemberInput, AggregateRoute, BuildShieldCalldataParams, BuildTransactAggregateCalldataParams, BuildTransactCalldataParams, TRANSACT_CAPACITIES, TransactCapacity, aggregateMemberRequestHash, aggregatePublicInputs, buildShieldCalldata, buildTransactAggregateCalldata, buildTransactCalldata, encodeAggregateFundingTypedData, encodeShieldFundingTypedData, encodeTransactFundingTypedData, encodeTransactTypedData, normalizeTransactRequest, selectAggregateRoute, selectTransactCapacity, shieldFundingRequestHash, transactFundingRequestHash, transactPublicInputs, validateShieldRequest } from './note.js';
4
+ import { D as Delivery } from './types-CUnFzl5S.js';
5
+ import { T as TransactionContext, F as FundingInput, C as CanonicalBlock, D as DeploymentContext } from './validation-8g0SQVE5.js';
6
+ export { B as BroadcasterPage, a as BroadcasterQuery, E as EMPTY_FUNDING, b as EMPTY_PERMIT, c as FIELD_MODULUS, I as IndexedCreditAllocation, d as IndexedCreditRevocationBitmap, e as IndexedCreditState, M as Membership, P as ProtocolCreditCandidates, f as ProtocolCreditTransition, g as ProtocolCreditUpdates, h as ProtocolDataProvider, i as ProtocolDataStatus, j as ProtocolNoteOutput, k as ProtocolNoteUpdates, l as ProtocolTransactionCreditUpdates, m as ProtocolTransactionNoteUpdates, n as ProtocolUpdateRange, R as RegisteredBroadcaster, o as RegisteredReceivingAddress, Z as ZERO_ADDRESS, p as ZERO_WORD, q as checkDeadline, r as deliveriesHash, s as dense, t as envelope, u as field, v as fundingFields, w as getEIP712Domain, x as known, y as normalizeContext, z as normalizeFunding, A as normalizeOpaqueDelivery, G as normalizeSources, H as notes, J as pad, K as uint, L as validateFundingSubmission, N as word } from './validation-8g0SQVE5.js';
7
+ import * as _invisi_labs_primitives from '@invisi-labs/primitives';
8
+ import { Hex, Address, ReceivingKeyLookup } from '@invisi-labs/primitives';
9
+ import { ContractRunner } from 'ethers';
8
10
 
9
- interface RegistryContext {
10
- chainId: bigint;
11
- registryAddress: Address;
12
- /** Optional explicit wall-clock value in seconds. Equality with deadline is valid. */
13
- now?: bigint;
14
- }
15
- interface RegistryReceivingKeys {
16
- viewingPublicKey: Hex;
17
- clueKey: Hex;
18
- }
19
- interface AddressRegistration {
20
- /** Nonzero EVM owner: 20 bytes or canonical zero-padded bytes32. */
21
- ownerAddress: Hex;
22
- keys: RegistryReceivingKeys;
23
- /** The current registry nonce expected for this operation. */
24
- nonce: bigint;
25
- deadline: bigint;
26
- }
27
- interface RegistrationOptions {
28
- update?: boolean;
29
- /** Check a separately obtained current nonce before authorizing or encoding. */
30
- expectedNonce?: bigint;
31
- }
32
- interface RegistrationCalldata {
33
- to: Address;
34
- callData: Hex;
35
- value: 0n;
36
- }
37
- /** Standard registry EIP-712 data, independent of private WalletAuthorization. */
38
- declare function registrationTypedData(context: RegistryContext, registration: AddressRegistration, options?: RegistrationOptions): {
39
- domain: {
40
- name: string;
41
- version: string;
42
- chainId: bigint;
43
- verifyingContract: `0x${string}`;
44
- };
45
- primaryType: string;
46
- types: {
47
- [x: string]: {
48
- name: string;
49
- type: string;
50
- }[];
51
- };
52
- message: {
53
- nonce: bigint;
54
- deadline: bigint;
55
- viewingPublicKey: Hex;
56
- clueKey: Hex;
57
- walletIdentity: string;
58
- };
59
- };
60
- declare function registrationDigest(context: RegistryContext, registration: AddressRegistration, options?: RegistrationOptions): Hex;
61
- /** Encode an owner call (empty signature) or an EIP-712 / ERC-1271 authorized relay. */
62
- declare function buildRegistrationCalldata(context: RegistryContext, registration: AddressRegistration, signature: Hex, options?: RegistrationOptions): RegistrationCalldata;
63
- /** Ethers runner used for registry contract reads. */
64
- type RegistryReadClient = ContractRunner;
65
- /** One receivingKeysOf query per short address; RPC failures propagate unchanged. */
66
- declare function createRegistryReceivingKeyLookup(client: RegistryReadClient, registryAddress: Address): ReceivingKeyLookup;
67
-
68
- interface TransactionContext extends DeploymentContext {
69
- tokenAddress: Address;
70
- now?: bigint;
71
- /** Explicit chain timestamp used to bind Credit draw UTC periods. */
72
- timestamp?: bigint;
73
- }
74
- declare const FIELD_MODULUS = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
75
- declare const ZERO_ADDRESS: "0x0000000000000000000000000000000000000000";
76
- declare const ZERO_WORD: Hex;
77
- declare const EMPTY_PERMIT: {
78
- readonly deadline: 0n;
79
- readonly v: 0;
80
- readonly r: `0x${string}`;
81
- readonly s: `0x${string}`;
82
- };
83
- declare const EMPTY_FUNDING: FundingParams;
84
- type FundingInput = Partial<Omit<FundingParams, "permit">> & {
85
- permit?: FundingParams["permit"];
86
- };
87
- declare function uint(v: bigint | number | string, bits: number, name?: string): bigint;
88
- declare function field(v: bigint | string, name?: string): bigint;
89
- declare const word: (v: bigint | string) => Hex;
90
- declare function dense<T>(v: readonly T[], name: string): readonly T[];
91
- declare function known(v: object, keys: readonly string[], name?: string): void;
92
- declare function notes(v: readonly Hex[], name: string): `0x${string}`[];
93
- declare function envelope(v: Hex, length: number, version?: number, maximum?: number): Hex;
94
- declare function normalizeContext(c: TransactionContext): {
95
- chainId: bigint;
96
- protocolAddress: Hex;
97
- tokenAddress: Hex;
98
- now?: bigint;
99
- /** Explicit chain timestamp used to bind Credit draw UTC periods. */
100
- timestamp?: bigint;
101
- };
102
- declare function checkDeadline(c: TransactionContext, value: bigint): bigint;
103
- declare function normalizeSources(sources: readonly InputSource[], inputCount: number, capacity: number): {
104
- treeId: bigint;
105
- merkleRoot: `0x${string}`;
106
- }[];
107
- declare const pad: (v: readonly bigint[], n: number) => bigint[];
108
- /** Receipt/transport validation must not reject unrelated future wallet codecs. */
109
- declare function normalizeOpaqueDelivery(value: Delivery, options?: {
110
- empty?: boolean;
111
- allowEmpty?: boolean;
112
- }): Delivery;
113
- declare const deliveriesHash: (v: readonly Delivery[]) => Hex;
114
- declare function normalizeFunding(input?: FundingInput): FundingParams;
115
- declare function validateFundingSubmission(f: FundingParams, caller?: Address, now?: bigint): void;
116
- declare const getEIP712Domain: (c: TransactionContext) => {
117
- name: string;
118
- version: string;
119
- chainId: bigint;
120
- verifyingContract: Hex;
121
- };
122
- declare const fundingFields: readonly [{
123
- readonly name: "requestHash";
124
- readonly type: "bytes32";
125
- }, {
126
- readonly name: "payer";
127
- readonly type: "address";
128
- }, {
129
- readonly name: "amount";
130
- readonly type: "uint256";
131
- }, {
132
- readonly name: "sigNonce";
133
- readonly type: "uint256";
134
- }, {
135
- readonly name: "deadline";
136
- readonly type: "uint256";
137
- }];
11
+ /** Full active user-circuit public inputs: business statement followed by EIP-712 digest limbs. */
12
+ declare function transactUserPublicInputs(c: TransactionContext, p: TransactRequestParams, cs: readonly Delivery[], f?: FundingInput): `0x${string}`[];
138
13
 
139
14
  interface ProtocolLog {
140
15
  address: Address;
@@ -150,6 +25,11 @@ interface CanonicalReceipt {
150
25
  status?: "success" | "reverted";
151
26
  }
152
27
  interface ChainReader {
28
+ getCreditAllocation?(context: DeploymentContext, owner: Address, token: Address, block: CanonicalBlock): Promise<{
29
+ shard: bigint;
30
+ slot: number;
31
+ }>;
32
+ getCreditRevocationBitmap?(context: DeploymentContext, owner: Address, token: Address, shard: bigint, word: number, block: CanonicalBlock): Promise<bigint>;
153
33
  getChainId(): Promise<bigint>;
154
34
  /** Required when a selected deployment includes a receiving-key registry. */
155
35
  getProtocolAddressRegistry?(address: Address): Promise<Address>;
@@ -178,735 +58,64 @@ interface FactoryReader {
178
58
  getInstanceFactory(instance: Address): Promise<Address>;
179
59
  }
180
60
 
181
- interface RegistryReader extends Pick<ChainReader, "getChainId" | "getCode" | "getBlock" | "getLatestBlockNumber" | "getTransaction" | "getReceipt"> {
182
- /** Validate arbitrary ERC-1271 bytes for a contract owner; transport errors propagate. */
183
- isValidRegistrationSignature?(owner: Address, digest: Hex, signature: Hex): Promise<boolean>;
184
- getRegistryNonce(context: RegistryContext, ownerAddress: Hex, block: CanonicalBlock): Promise<bigint>;
185
- }
186
- interface RegistrationPreparation {
187
- wallet: PublicWallet;
188
- reader: RegistryReader;
189
- deadline?: bigint;
190
- update?: boolean;
191
- }
192
- type RegistrationStatus = "prepared" | "ready" | "submitted" | "confirmed" | "uncertain" | "failed" | "expired" | "reorged";
193
- declare class RegistrationOperation {
194
- #private;
195
- readonly status: RegistrationStatus;
196
- private constructor();
197
- static prepare(registry: AddressRegistry, options: RegistrationPreparation): Promise<RegistrationOperation>;
198
- get id(): string;
199
- preview(): {
200
- update: boolean;
201
- ownerAddress: Hex;
202
- keys: RegistryReceivingKeys;
203
- nonce: bigint;
204
- deadline: bigint;
205
- id: string;
206
- status: RegistrationStatus;
207
- chainId: bigint;
208
- registryAddress: `0x${string}`;
209
- };
210
- /** Export portable EIP-712 data for external signing. */
211
- exportRegistrationAuthorization(options?: {
212
- signal?: AbortSignal;
213
- }): Promise<_invisi_labs_core.SigningRequest>;
214
- /** Validate and attach an independently obtained EOA or ERC-1271 signature. */
215
- withSignature(signature: string, options?: {
216
- signal?: AbortSignal;
217
- }): Promise<RegistrationOperation>;
218
- /** Empty signatures require the transaction sender to be the wallet owner. */
219
- authorizeDirect(): Promise<RegistrationOperation>;
220
- typedData(): {
221
- domain: {
222
- name: string;
223
- version: string;
224
- chainId: bigint;
225
- verifyingContract: `0x${string}`;
226
- };
227
- primaryType: string;
228
- types: {
229
- [x: string]: {
230
- name: string;
231
- type: string;
232
- }[];
233
- };
234
- message: {
235
- nonce: bigint;
236
- deadline: bigint;
237
- viewingPublicKey: Hex;
238
- clueKey: Hex;
239
- walletIdentity: string;
240
- };
241
- };
242
- private call;
243
- exportTransaction(): Promise<TransactionCall>;
244
- private validateFreshness;
245
- /** Associate a signed/broadcast transaction; ethers owns sending and receipt waiting. */
246
- trackTransaction(transactionHash: string): RegistrationOperation;
247
- reconcile(options?: {
248
- transactionHash?: Hex;
249
- signal?: AbortSignal;
250
- }): Promise<RegistrationOperation>;
251
- toJSON(): {
252
- id: string;
253
- kind: string;
254
- status: RegistrationStatus;
255
- };
256
- }
257
-
258
- interface AddressRegistryOptions {
259
- lookup?: ReceivingKeyLookup;
260
- expectedRuntimeCodeHash?: Hex;
261
- }
262
- /** Independent registry deployment and nonce domain, selected by the application. */
263
- declare class AddressRegistry {
264
- #private;
265
- readonly context: Readonly<RegistryContext>;
266
- readonly expectedRuntimeCodeHash: Hex | undefined;
267
- constructor(context: RegistryContext, options?: AddressRegistryOptions);
268
- validateDeployment(reader: Pick<RegistryReader, "getChainId" | "getCode">): Promise<void>;
269
- prepareRegistration(options: RegistrationPreparation): Promise<RegistrationOperation>;
270
- resolve(address: string): Promise<string>;
271
- typedData(registration: AddressRegistration, options?: RegistrationOptions): {
272
- domain: {
273
- name: string;
274
- version: string;
275
- chainId: bigint;
276
- verifyingContract: `0x${string}`;
277
- };
278
- primaryType: string;
279
- types: {
280
- [x: string]: {
281
- name: string;
282
- type: string;
283
- }[];
284
- };
285
- message: {
286
- nonce: bigint;
287
- deadline: bigint;
288
- viewingPublicKey: Hex;
289
- clueKey: Hex;
290
- walletIdentity: string;
291
- };
292
- };
293
- digest(registration: AddressRegistration, options?: RegistrationOptions): `0x${string}`;
294
- buildCall(registration: AddressRegistration, signature: `0x${string}`, options?: RegistrationOptions): RegistrationCalldata;
295
- }
296
-
297
- declare const CREATE_CREDIT_FIELDS: readonly ["token", "sources", "nullifiers", "creditCommitment", "changeCommitment", "owner", "expiry", "deadline", "feeRecipient", "feeAmount"];
298
- /** Public checks cannot establish ownership or conservation: those are enforced by the proof. */
299
- declare function validateCreateCreditRequest(c: TransactionContext, p: CreateCreditParams, cs: readonly Delivery[], funding?: FundingInput): {
300
- sources: {
301
- treeId: bigint;
302
- merkleRoot: `0x${string}`;
303
- }[];
304
- nullifiers: `0x${string}`[];
305
- actualCount: number;
306
- sourceCount: number;
307
- creditCommitment: `0x${string}`;
308
- changeCommitment: `0x${string}`;
309
- owner: `0x${string}`;
310
- expiry: bigint;
311
- deadline: bigint;
312
- deliveries: Delivery[];
313
- funding: FundingParams;
314
- feeRecipient: `0x${string}`;
315
- feeAmount: bigint;
316
- chainId: bigint;
317
- protocolAddress: Hex;
318
- tokenAddress: Hex;
319
- now?: bigint;
320
- timestamp?: bigint;
321
- };
322
- declare function createCreditBaseInputs(c: TransactionContext, p: CreateCreditParams, cs: readonly Delivery[], f?: FundingInput): `0x${string}`[];
323
- declare function createCreditPublicInputs(c: TransactionContext, p: CreateCreditParams, deliveries: readonly Delivery[], funding?: FundingInput): `0x${string}`[];
324
- declare function createCreditRequestHash(p: CreateCreditParams, cs: readonly Delivery[], f?: FundingInput): Hex;
325
- declare function encodeCreateCreditTypedData(c: TransactionContext, p: CreateCreditParams, deliveries: readonly Delivery[], funding?: FundingInput): {
326
- domain: {
327
- name: string;
328
- version: string;
329
- chainId: bigint;
330
- verifyingContract: `0x${string}`;
331
- };
332
- types: {
333
- readonly WalletAuthorization: readonly [{
334
- readonly name: "operation";
335
- readonly type: "bytes32";
336
- }, {
337
- readonly name: "statementHash";
338
- readonly type: "bytes32";
339
- }];
340
- };
341
- primaryType: "WalletAuthorization";
342
- message: {
343
- operation: `0x${string}`;
344
- statementHash: `0x${string}`;
345
- };
346
- };
347
- declare function encodeCreateCreditFundingTypedData(c: TransactionContext, p: CreateCreditParams, cs: readonly Delivery[], f: FundingInput): {
348
- domain: {
349
- name: string;
350
- version: string;
351
- chainId: bigint;
352
- verifyingContract: Hex;
353
- };
354
- primaryType: "FundTransact";
355
- types: {
356
- FundTransact: readonly [{
357
- readonly name: "requestHash";
358
- readonly type: "bytes32";
359
- }, {
360
- readonly name: "payer";
361
- readonly type: "address";
362
- }, {
363
- readonly name: "amount";
364
- readonly type: "uint256";
365
- }, {
366
- readonly name: "sigNonce";
367
- readonly type: "uint256";
368
- }, {
369
- readonly name: "deadline";
370
- readonly type: "uint256";
371
- }];
372
- };
373
- message: {
374
- requestHash: `0x${string}`;
375
- payer: `0x${string}`;
376
- amount: bigint;
377
- sigNonce: bigint;
378
- deadline: bigint;
379
- };
380
- };
381
- interface BuildCreateCreditCalldataParams {
382
- context: TransactionContext;
383
- proof: Hex;
384
- params: CreateCreditParams;
385
- deliveries: readonly Delivery[];
386
- funding?: FundingInput;
387
- caller?: Address;
388
- }
389
- declare function buildCreateCreditCalldata(p: BuildCreateCreditCalldataParams): {
390
- data: Hex;
391
- approveAmount: bigint;
392
- };
393
- /** Frame a raw direct proof from the proving backend for the Credit verifier adapter. */
394
- declare function encodeCreditProof(proof: Hex): Hex;
395
-
396
- declare const CREDIT_DRAW_CAPACITIES: readonly [1, 12, 50, 120];
397
- declare function selectCreditDrawCircuit(count: number): {
398
- name: string;
399
- maxSize: 1 | 12 | 50 | 120;
400
- publicInputCount: number;
401
- totalBits: number;
402
- };
403
- declare function validateCreditDrawRequest(c: TransactionContext, p: CreditDrawParams, cs: readonly Delivery[]): {
404
- sources: {
405
- treeId: bigint;
406
- merkleRoot: `0x${string}`;
407
- }[];
408
- nullifiers: `0x${string}`[];
409
- remainderCommitments: `0x${string}`[];
410
- recoveryAmounts: `0x${string}`[];
411
- expiries: bigint[];
412
- spender: `0x${string}`;
413
- totalAmount: bigint;
414
- deadline: bigint;
415
- deliveries: Delivery[];
416
- profile: {
417
- name: string;
418
- maxSize: 1 | 12 | 50 | 120;
419
- publicInputCount: number;
420
- totalBits: number;
421
- };
422
- periods: {
423
- currentDay: bigint;
424
- currentMonth: bigint;
425
- };
426
- chainId: bigint;
427
- protocolAddress: Hex;
428
- tokenAddress: Hex;
429
- now?: bigint;
430
- timestamp?: bigint;
431
- };
432
- declare function creditDrawBaseInputs(c: TransactionContext, p: CreditDrawParams, cs: readonly Delivery[]): `0x${string}`[];
433
- declare function validateCancelCreditRequest(c: TransactionContext, p: CancelCreditParams): {
434
- source: {
435
- treeId: bigint;
436
- merkleRoot: `0x${string}`;
437
- };
438
- nullifier: `0x${string}`;
439
- owner: `0x${string}`;
440
- amount: bigint;
441
- deadline: bigint;
442
- feeRecipient: `0x${string}`;
443
- feeAmount: bigint;
61
+ interface RegistryContext {
444
62
  chainId: bigint;
445
- protocolAddress: Hex;
446
- tokenAddress: Hex;
63
+ registryAddress: Address;
64
+ /** Optional explicit wall-clock value in seconds. Equality with deadline is valid. */
447
65
  now?: bigint;
448
- timestamp?: bigint;
449
- };
450
- declare function cancelCreditBaseInputs(c: TransactionContext, p: CancelCreditParams): `0x${string}`[];
451
- declare function validateTopUpCreditRequest(c: TransactionContext, p: TopUpCreditParams, cs: readonly Delivery[], funding?: FundingInput): {
452
- creation: {
453
- sources: {
454
- treeId: bigint;
455
- merkleRoot: `0x${string}`;
456
- }[];
457
- nullifiers: `0x${string}`[];
458
- actualCount: number;
459
- sourceCount: number;
460
- creditCommitment: `0x${string}`;
461
- changeCommitment: `0x${string}`;
462
- owner: `0x${string}`;
463
- expiry: bigint;
464
- deadline: bigint;
465
- deliveries: Delivery[];
466
- funding: FundingParams;
467
- feeRecipient: `0x${string}`;
468
- feeAmount: bigint;
469
- chainId: bigint;
470
- protocolAddress: Hex;
471
- tokenAddress: Hex;
472
- now?: bigint;
473
- timestamp?: bigint;
474
- };
475
- creditSource: {
476
- treeId: bigint;
477
- merkleRoot: `0x${string}`;
478
- };
479
- creditNullifier: `0x${string}`;
480
- previousExpiry: bigint;
481
- };
482
- declare function topUpCreditBaseInputs(c: TransactionContext, p: TopUpCreditParams, cs: readonly Delivery[], f?: FundingInput): `0x${string}`[];
483
- declare function cancelCreditRequestHash(p: CancelCreditParams): Hex;
484
- declare function topUpCreditRequestHash(p: TopUpCreditParams, cs: readonly Delivery[], f?: FundingInput): Hex;
485
- declare function encodeCancelCreditTypedData(c: TransactionContext, p: CancelCreditParams): {
486
- domain: {
487
- name: string;
488
- version: string;
489
- chainId: bigint;
490
- verifyingContract: `0x${string}`;
491
- };
492
- types: {
493
- readonly WalletAuthorization: readonly [{
494
- readonly name: "operation";
495
- readonly type: "bytes32";
496
- }, {
497
- readonly name: "statementHash";
498
- readonly type: "bytes32";
499
- }];
500
- };
501
- primaryType: "WalletAuthorization";
502
- message: {
503
- operation: `0x${string}`;
504
- statementHash: `0x${string}`;
505
- };
506
- };
507
- declare function encodeTopUpCreditTypedData(c: TransactionContext, p: TopUpCreditParams, deliveries: readonly Delivery[], funding?: FundingInput): {
508
- domain: {
509
- name: string;
510
- version: string;
511
- chainId: bigint;
512
- verifyingContract: `0x${string}`;
513
- };
514
- types: {
515
- readonly WalletAuthorization: readonly [{
516
- readonly name: "operation";
517
- readonly type: "bytes32";
518
- }, {
519
- readonly name: "statementHash";
520
- readonly type: "bytes32";
521
- }];
522
- };
523
- primaryType: "WalletAuthorization";
524
- message: {
525
- operation: `0x${string}`;
526
- statementHash: `0x${string}`;
527
- };
528
- };
529
- declare function encodeCreditDrawTypedData(c: TransactionContext, p: CreditDrawParams, deliveries: readonly Delivery[]): {
530
- domain: {
531
- name: string;
532
- version: string;
533
- chainId: bigint;
534
- verifyingContract: `0x${string}`;
535
- };
536
- types: {
537
- readonly WalletAuthorization: readonly [{
538
- readonly name: "operation";
539
- readonly type: "bytes32";
540
- }, {
541
- readonly name: "statementHash";
542
- readonly type: "bytes32";
543
- }];
544
- };
545
- primaryType: "WalletAuthorization";
546
- message: {
547
- operation: `0x${string}`;
548
- statementHash: `0x${string}`;
549
- };
550
- };
551
- declare function creditDrawPublicInputs(c: TransactionContext, p: CreditDrawParams, deliveries: readonly Delivery[]): `0x${string}`[];
552
- declare function cancelCreditPublicInputs(c: TransactionContext, p: CancelCreditParams): `0x${string}`[];
553
- declare function topUpCreditPublicInputs(c: TransactionContext, p: TopUpCreditParams, deliveries: readonly Delivery[], funding?: FundingInput): `0x${string}`[];
554
- declare function encodeTopUpCreditFundingTypedData(c: TransactionContext, p: TopUpCreditParams, cs: readonly Delivery[], f: FundingInput): {
555
- domain: {
556
- name: string;
557
- version: string;
558
- chainId: bigint;
559
- verifyingContract: Hex;
560
- };
561
- primaryType: "FundTransact";
562
- types: {
563
- FundTransact: readonly [{
564
- readonly name: "requestHash";
565
- readonly type: "bytes32";
566
- }, {
567
- readonly name: "payer";
568
- readonly type: "address";
569
- }, {
570
- readonly name: "amount";
571
- readonly type: "uint256";
572
- }, {
573
- readonly name: "sigNonce";
574
- readonly type: "uint256";
575
- }, {
576
- readonly name: "deadline";
577
- readonly type: "uint256";
578
- }];
579
- };
580
- message: {
581
- requestHash: `0x${string}`;
582
- payer: `0x${string}`;
583
- amount: bigint;
584
- sigNonce: bigint;
585
- deadline: bigint;
586
- };
587
- };
588
- interface BuildCreditDrawCalldataParams {
589
- context: TransactionContext;
590
- proof: Hex;
591
- params: CreditDrawParams;
592
- deliveries: readonly Delivery[];
593
66
  }
594
- declare function buildCreditDrawCalldata(p: BuildCreditDrawCalldataParams): {
595
- data: Hex;
596
- nullifiers: readonly `0x${string}`[];
597
- totalAmount: bigint;
598
- };
599
- interface BuildCancelCreditCalldataParams {
600
- context: TransactionContext;
601
- proof: Hex;
602
- params: CancelCreditParams;
603
- }
604
- declare function buildCancelCreditCalldata(p: BuildCancelCreditCalldataParams): {
605
- data: Hex;
606
- };
607
- interface BuildTopUpCreditCalldataParams {
608
- context: TransactionContext;
609
- proof: Hex;
610
- params: TopUpCreditParams;
611
- deliveries: readonly Delivery[];
612
- funding?: FundingInput;
613
- caller?: Address;
67
+ interface RegistryReceivingKeys {
68
+ viewingPublicKey: Hex;
69
+ clueKey: Hex;
614
70
  }
615
- declare function buildTopUpCreditCalldata(p: BuildTopUpCreditCalldataParams): {
616
- data: Hex;
617
- approveAmount: bigint;
618
- };
619
-
620
- declare const TRANSACT_CAPACITIES: readonly [14, 56, 112, 168];
621
- type TransactCapacity = (typeof TRANSACT_CAPACITIES)[number];
622
- declare function selectTransactCapacity(inputs: number, outputs: number): TransactCapacity;
623
- type TransactRequestParams = CrossTreeTransactParams;
624
- declare function normalizeTransactRequest(c: TransactionContext, p: TransactRequestParams, cs: readonly Delivery[], funding?: FundingInput): {
625
- capacity: 14 | 56 | 112 | 168;
626
- sources: {
627
- treeId: bigint;
628
- merkleRoot: `0x${string}`;
629
- }[];
630
- nullifiers: `0x${string}`[];
631
- outputCommitments: `0x${string}`[];
632
- inputCount: number;
633
- outputCount: number;
634
- sourceCount: number;
635
- inputTreeIds: bigint[];
636
- merkleRoots: bigint[];
637
- slotValues: bigint[];
638
- deliveries: Delivery[];
639
- deliveriesHash: `0x${string}`;
640
- withdrawalAddress: `0x${string}`;
641
- withdrawalAmount: bigint;
642
- feeRecipient: `0x${string}`;
643
- feeAmount: bigint;
71
+ interface AddressRegistration {
72
+ /** Nonzero EVM owner: 20 bytes or canonical zero-padded bytes32. */
73
+ ownerAddress: Hex;
74
+ keys: RegistryReceivingKeys;
75
+ /** The current registry nonce expected for this operation. */
76
+ nonce: bigint;
644
77
  deadline: bigint;
645
- depositAmount: bigint;
646
- depositPayer: `0x${string}`;
647
- funding: FundingParams;
648
- chainId: bigint;
649
- protocolAddress: Hex;
650
- tokenAddress: Hex;
651
- now?: bigint;
652
- timestamp?: bigint;
653
- };
654
- declare function transactPublicInputs(c: TransactionContext, p: TransactRequestParams, cs: readonly Delivery[], f?: FundingInput): `0x${string}`[];
655
- declare function encodeTransactTypedData(c: TransactionContext, p: TransactRequestParams, deliveries: readonly Delivery[], f?: FundingInput): {
656
- domain: {
657
- name: string;
658
- version: string;
659
- chainId: bigint;
660
- verifyingContract: `0x${string}`;
661
- };
662
- types: {
663
- readonly WalletAuthorization: readonly [{
664
- readonly name: "operation";
665
- readonly type: "bytes32";
666
- }, {
667
- readonly name: "statementHash";
668
- readonly type: "bytes32";
669
- }];
670
- };
671
- primaryType: "WalletAuthorization";
672
- message: {
673
- operation: `0x${string}`;
674
- statementHash: `0x${string}`;
675
- };
676
- };
677
- declare function transactFundingRequestHash(proof: Hex, p: TransactRequestParams, cs: readonly Delivery[]): `0x${string}`;
678
- declare function encodeTransactFundingTypedData(c: TransactionContext, proof: Hex, p: TransactRequestParams, cs: readonly Delivery[], funding: FundingInput): {
679
- domain: {
680
- name: string;
681
- version: string;
682
- chainId: bigint;
683
- verifyingContract: Hex;
684
- };
685
- primaryType: "FundTransact";
686
- types: {
687
- FundTransact: readonly [{
688
- readonly name: "requestHash";
689
- readonly type: "bytes32";
690
- }, {
691
- readonly name: "payer";
692
- readonly type: "address";
693
- }, {
694
- readonly name: "amount";
695
- readonly type: "uint256";
696
- }, {
697
- readonly name: "sigNonce";
698
- readonly type: "uint256";
699
- }, {
700
- readonly name: "deadline";
701
- readonly type: "uint256";
702
- }];
703
- };
704
- message: {
705
- requestHash: `0x${string}`;
706
- payer: `0x${string}`;
707
- amount: bigint;
708
- sigNonce: bigint;
709
- deadline: bigint;
710
- };
711
- };
712
- interface BuildTransactCalldataParams {
713
- context: TransactionContext;
714
- proof: Hex;
715
- params: TransactRequestParams;
716
- deliveries: readonly Delivery[];
717
- funding?: FundingInput;
718
- caller?: Address;
719
78
  }
720
- declare function buildTransactCalldata(p: BuildTransactCalldataParams): {
721
- data: `0x${string}`;
722
- capacity: 14 | 56 | 112 | 168;
723
- approveAmount: bigint;
724
- };
725
- interface BuildTransactAggregateCalldataParams {
726
- context: DeploymentContext & {
727
- now?: bigint;
728
- };
729
- proof: Hex;
730
- requests: readonly TransactRequest[];
731
- caller?: Address;
79
+ interface RegistrationOptions {
80
+ update?: boolean;
81
+ /** Check a separately obtained current nonce before authorizing or encoding. */
82
+ expectedNonce?: bigint;
732
83
  }
733
- declare function buildTransactAggregateCalldata(p: BuildTransactAggregateCalldataParams): {
734
- data: Hex;
735
- capacity: 14;
736
- };
737
- interface BuildShieldCalldataParams {
738
- context: TransactionContext;
739
- params: ShieldParams;
740
- outputs: readonly ShieldOutput[];
741
- deliveries: readonly Delivery[];
742
- funding: FundingInput;
743
- caller?: Address;
84
+ interface RegistrationCalldata {
85
+ to: Address;
86
+ callData: Hex;
87
+ value: 0n;
744
88
  }
745
- declare function validateShieldRequest(p: BuildShieldCalldataParams): Promise<FundingParams>;
746
- declare function shieldFundingRequestHash(params: ShieldParams, outputs: readonly ShieldOutput[], cs: readonly Delivery[]): Hex;
747
- declare function encodeShieldFundingTypedData(p: BuildShieldCalldataParams): Promise<{
748
- domain: {
749
- name: string;
750
- version: string;
751
- chainId: bigint;
752
- verifyingContract: Hex;
753
- };
754
- primaryType: "FundShield";
755
- types: {
756
- FundShield: readonly [{
757
- readonly name: "requestHash";
758
- readonly type: "bytes32";
759
- }, {
760
- readonly name: "payer";
761
- readonly type: "address";
762
- }, {
763
- readonly name: "amount";
764
- readonly type: "uint256";
765
- }, {
766
- readonly name: "sigNonce";
767
- readonly type: "uint256";
768
- }, {
769
- readonly name: "deadline";
770
- readonly type: "uint256";
771
- }];
772
- };
773
- message: {
774
- requestHash: `0x${string}`;
775
- payer: `0x${string}`;
776
- amount: bigint;
777
- sigNonce: bigint;
778
- deadline: bigint;
779
- };
780
- }>;
781
- declare function buildShieldCalldata(p: BuildShieldCalldataParams): Promise<{
782
- data: Hex;
783
- approveAmount: bigint;
784
- }>;
785
- /** Full active user-circuit public inputs: business statement followed by EIP-712 digest limbs. */
786
- declare function transactUserPublicInputs(c: TransactionContext, p: TransactRequestParams, cs: readonly Delivery[], f?: FundingInput): `0x${string}`[];
787
- type AggregateMemberInput = Pick<TransactRequest, "params" | "deliveries"> & {
788
- funding?: FundingInput;
789
- };
790
- /** Atomic aggregate funding binds the member statement rather than the aggregate proof bytes. */
791
- declare function aggregateMemberRequestHash(c: TransactionContext, r: AggregateMemberInput): Hex;
792
- /** Router adapter business words (58 per member), not the aggregate circuit statement. */
793
- declare function aggregatePublicInputs(c: TransactionContext, requests: readonly AggregateMemberInput[]): `0x${string}`[];
794
- declare function encodeAggregateFundingTypedData(c: TransactionContext, r: AggregateMemberInput): {
89
+ /** Standard registry EIP-712 data, independent of private WalletAuthorization. */
90
+ declare function registrationTypedData(context: RegistryContext, registration: AddressRegistration, options?: RegistrationOptions): {
795
91
  domain: {
796
92
  name: string;
797
93
  version: string;
798
94
  chainId: bigint;
799
- verifyingContract: Hex;
95
+ verifyingContract: `0x${string}`;
800
96
  };
801
- primaryType: "FundTransact";
97
+ primaryType: string;
802
98
  types: {
803
- FundTransact: readonly [{
804
- readonly name: "requestHash";
805
- readonly type: "bytes32";
806
- }, {
807
- readonly name: "payer";
808
- readonly type: "address";
809
- }, {
810
- readonly name: "amount";
811
- readonly type: "uint256";
812
- }, {
813
- readonly name: "sigNonce";
814
- readonly type: "uint256";
815
- }, {
816
- readonly name: "deadline";
817
- readonly type: "uint256";
818
- }];
99
+ [x: string]: {
100
+ name: string;
101
+ type: string;
102
+ }[];
819
103
  };
820
104
  message: {
821
- requestHash: `0x${string}`;
822
- payer: `0x${string}`;
823
- amount: bigint;
824
- sigNonce: bigint;
105
+ nonce: bigint;
825
106
  deadline: bigint;
107
+ viewingPublicKey: Hex;
108
+ clueKey: Hex;
109
+ walletIdentity: string;
826
110
  };
827
111
  };
828
-
829
- interface TokenProtocolOptions {
830
- expectedRuntimeCodeHash?: Hex;
831
- }
832
- /** A token-specific operation binding within a multi-token deployment. Pure builders never sign or submit. */
833
- declare class TokenProtocol {
834
- readonly context: Readonly<TransactionContext>;
835
- readonly expectedRuntimeCodeHash: Hex | undefined;
836
- constructor(context: TransactionContext, options?: TokenProtocolOptions);
837
- validateDeployment(reader: Pick<ChainReader, "getChainId" | "getCode">, options?: {
838
- requireRuntimeProfile?: boolean;
839
- }): Promise<void>;
840
- transact(request: Omit<BuildTransactCalldataParams, "context">): {
841
- data: `0x${string}`;
842
- capacity: 14 | 56 | 112 | 168;
843
- approveAmount: bigint;
844
- to: `0x${string}`;
845
- value: bigint;
846
- };
847
- aggregate(request: Omit<BuildTransactAggregateCalldataParams, "context">): {
848
- data: Hex;
849
- capacity: 14;
850
- to: `0x${string}`;
851
- value: bigint;
852
- };
853
- shield(request: Omit<BuildShieldCalldataParams, "context">): Promise<{
854
- data: Hex;
855
- approveAmount: bigint;
856
- to: `0x${string}`;
857
- value: bigint;
858
- }>;
859
- createCredit(request: Omit<BuildCreateCreditCalldataParams, "context">): {
860
- data: Hex;
861
- approveAmount: bigint;
862
- to: `0x${string}`;
863
- value: bigint;
864
- };
865
- drawCredit(request: Omit<BuildCreditDrawCalldataParams, "context">): {
866
- data: Hex;
867
- nullifiers: readonly `0x${string}`[];
868
- totalAmount: bigint;
869
- to: `0x${string}`;
870
- value: bigint;
871
- };
872
- cancelCredit(request: Omit<BuildCancelCreditCalldataParams, "context">): {
873
- data: Hex;
874
- to: `0x${string}`;
875
- value: bigint;
876
- };
877
- topUpCredit(request: Omit<BuildTopUpCreditCalldataParams, "context">): {
878
- data: Hex;
879
- approveAmount: bigint;
880
- to: `0x${string}`;
881
- value: bigint;
882
- };
883
- }
884
-
885
- interface ProtocolOptions {
886
- deployment: ProtocolDeployment;
887
- }
888
- /** A multi-token deployment. Asset support is always read from the chain. */
889
- declare class Protocol {
890
- readonly deployment: Readonly<ProtocolDeployment>;
891
- readonly context: Readonly<DeploymentContext>;
892
- constructor(options: ProtocolOptions);
893
- /** Load the selected deployment and verify its contract against Chain RPC before returning. */
894
- static fromRpc(rpc: Pick<ProtocolRpcClient, "getDeployment">, provider: Provider, options?: {
895
- signal?: AbortSignal;
896
- }): Promise<Protocol>;
897
- validateDeployment(connection: Provider | (Pick<ChainReader, "getChainId" | "getCode"> & {
898
- getProtocolVersion?(address: Address): Promise<bigint>;
899
- getProtocolAddressRegistry?(address: Address): Promise<Address>;
900
- })): Promise<void>;
901
- aggregate(request: Omit<BuildTransactAggregateCalldataParams, "context">): {
902
- data: Hex;
903
- capacity: 14;
904
- to: `0x${string}`;
905
- value: bigint;
906
- };
907
- /** Build an operation context for one asset within this same deployment. */
908
- forToken(tokenAddress: Address): TokenProtocol;
909
- }
112
+ declare function registrationDigest(context: RegistryContext, registration: AddressRegistration, options?: RegistrationOptions): Hex;
113
+ /** Encode an owner call (empty signature) or an EIP-712 / ERC-1271 authorized relay. */
114
+ declare function buildRegistrationCalldata(context: RegistryContext, registration: AddressRegistration, signature: Hex, options?: RegistrationOptions): RegistrationCalldata;
115
+ /** Ethers runner used for registry contract reads. */
116
+ type RegistryReadClient = ContractRunner;
117
+ /** One receivingKeysOf query per short address; RPC failures propagate unchanged. */
118
+ declare function createRegistryReceivingKeyLookup(client: RegistryReadClient, registryAddress: Address): ReceivingKeyLookup;
910
119
 
911
120
  interface VerifyNoteCommitmentParams {
912
121
  ownerAddress: `0x${string}`;
@@ -915,96 +124,14 @@ interface VerifyNoteCommitmentParams {
915
124
  nonce: `0x${string}`;
916
125
  noteCommitment: `0x${string}`;
917
126
  chainId: bigint;
127
+ protocolAddress: `0x${string}`;
918
128
  }
919
129
  declare function verifyNoteCommitment(params: VerifyNoteCommitmentParams): Promise<boolean>;
920
- interface VerifyCreditCommitmentParams extends Partial<_invisi_labs_core.CreditPolicy> {
921
- chainId: bigint;
922
- spenderWalletIdentity: `0x${string}`;
923
- ownerWalletIdentity: `0x${string}`;
924
- spenderPayout: `0x${string}`;
925
- ownerPayout: `0x${string}`;
926
- tokenAddress: `0x${string}`;
927
- amount: bigint;
928
- nonce: bigint;
929
- expiry: bigint;
930
- creditSharedKey: bigint;
931
- /** Server-returned value to verify against the locally recomputed commitment. */
130
+ interface VerifyCreditCommitmentParams {
131
+ state: _invisi_labs_primitives.CreditState;
932
132
  creditCommitment: `0x${string}`;
933
133
  }
934
- /**
935
- * Hashes the received shared key locally, recomputes the Credit leaf and compares it to the
936
- * server-returned value. A mismatch means the server folded a wrong nonce
937
- * (or other parameter) — the caller MUST abort and not create a Credit.
938
- */
939
- declare function verifyCreditCommitment(params: VerifyCreditCommitmentParams): Promise<boolean>;
940
-
941
- interface NoteMembership {
942
- note: Note;
943
- treeId: bigint;
944
- leafIndex: number;
945
- path: readonly bigint[];
946
- }
947
- interface CreditMembership {
948
- state: CreditDeliveryState;
949
- treeId: bigint;
950
- leafIndex: number;
951
- path: readonly bigint[];
952
- }
953
- interface TransactWitnessParams extends Omit<BuildTransactCalldataParams, "proof" | "context"> {
954
- inputs: readonly NoteMembership[];
955
- outputs: readonly (Note | {
956
- identity: Hex;
957
- amount: bigint;
958
- note?: Note;
959
- })[];
960
- authorization?: AuthorizedStatement;
961
- target?: ProofTarget;
962
- }
963
- interface CreateCreditWitnessParams {
964
- params: CreateCreditParams;
965
- deliveries: readonly Delivery[];
966
- funding?: FundingInput;
967
- inputs: readonly NoteMembership[];
968
- state: CreditDeliveryState;
969
- change?: Note;
970
- authorization: AuthorizedStatement;
971
- }
972
- interface DrawCreditWitnessParams {
973
- /** Explicit chain timestamp used to prepare this signed statement. */
974
- timestamp: bigint;
975
- params: CreditDrawParams;
976
- deliveries: readonly Delivery[];
977
- inputs: readonly CreditMembership[];
978
- amounts: readonly bigint[];
979
- authorization: AuthorizedStatement;
980
- }
981
- interface CancelCreditWitnessParams {
982
- params: CancelCreditParams;
983
- input: CreditMembership;
984
- authorization: AuthorizedStatement;
985
- }
986
- interface TopUpCreditWitnessParams extends Omit<CreateCreditWitnessParams, "params"> {
987
- params: TopUpCreditParams;
988
- previous: CreditMembership;
989
- }
990
- /** Local typed assembly for authenticated circuit releases; no network or backend selection. */
991
- declare class WitnessBuilder {
992
- #private;
993
- constructor(protocol: TokenProtocol);
994
- static statement(circuitName: CircuitName, expectedPublicInputs: readonly Hex[], target?: ProofTarget): ProofStatement;
995
- private context;
996
- private authority;
997
- private membership;
998
- private noteLeaf;
999
- private creditLeaf;
1000
- private noteInputs;
1001
- transact(p: TransactWitnessParams): Promise<ProvingRequest>;
1002
- private creation;
1003
- createCredit(p: CreateCreditWitnessParams): Promise<ProvingRequest>;
1004
- cancelCredit(p: CancelCreditWitnessParams): Promise<ProvingRequest>;
1005
- drawCredit(p: DrawCreditWitnessParams): Promise<ProvingRequest>;
1006
- topUpCredit(p: TopUpCreditWitnessParams): Promise<ProvingRequest>;
1007
- }
134
+ declare function verifyCreditCommitment(p: VerifyCreditCommitmentParams): Promise<boolean>;
1008
135
 
1009
136
  /**
1010
137
  * Query the selected factory. The caller still verifies the returned deployment profile.
@@ -1012,4 +139,72 @@ declare class WitnessBuilder {
1012
139
  */
1013
140
  declare function resolveInstanceAddress(client: ContractRunner, factoryAddress: `0x${string}`, salt: `0x${string}`): Promise<`0x${string}`>;
1014
141
 
1015
- export { type AddressRegistration, AddressRegistry, type AddressRegistryOptions, type AggregateMemberInput, type BuildCancelCreditCalldataParams, type BuildCreateCreditCalldataParams, type BuildCreditDrawCalldataParams, type BuildShieldCalldataParams, type BuildTopUpCreditCalldataParams, type BuildTransactAggregateCalldataParams, type BuildTransactCalldataParams, CREATE_CREDIT_FIELDS, CREDIT_DRAW_CAPACITIES, type CancelCreditWitnessParams, type CanonicalReceipt, type ChainReader, type CreateCreditWitnessParams, type CreditMembership, type DrawCreditWitnessParams, EMPTY_FUNDING, EMPTY_PERMIT, FIELD_MODULUS, type FactoryReader, type FundingInput, type NoteMembership, Protocol, type ProtocolLog, type ProtocolOptions, type RegistrationCalldata, RegistrationOperation, type RegistrationOptions, type RegistrationPreparation, type RegistrationStatus, type RegistryContext, type RegistryReadClient, type RegistryReader, type RegistryReceivingKeys, TRANSACT_CAPACITIES, TokenProtocol, type TokenProtocolOptions, type TopUpCreditWitnessParams, type TransactCapacity, type TransactRequestParams, type TransactWitnessParams, type TransactionCall, type TransactionContext, type VerifyCreditCommitmentParams, type VerifyNoteCommitmentParams, WitnessBuilder, ZERO_ADDRESS, ZERO_WORD, aggregateMemberRequestHash, aggregatePublicInputs, buildCancelCreditCalldata, buildCreateCreditCalldata, buildCreditDrawCalldata, buildRegistrationCalldata, buildShieldCalldata, buildTopUpCreditCalldata, buildTransactAggregateCalldata, buildTransactCalldata, cancelCreditBaseInputs, cancelCreditPublicInputs, cancelCreditRequestHash, checkDeadline, createCreditBaseInputs, createCreditPublicInputs, createCreditRequestHash, createRegistryReceivingKeyLookup, creditDrawBaseInputs, creditDrawPublicInputs, deliveriesHash, dense, encodeAggregateFundingTypedData, encodeCancelCreditTypedData, encodeCreateCreditFundingTypedData, encodeCreateCreditTypedData, encodeCreditDrawTypedData, encodeCreditProof, encodeShieldFundingTypedData, encodeTopUpCreditFundingTypedData, encodeTopUpCreditTypedData, encodeTransactFundingTypedData, encodeTransactTypedData, envelope, field, fundingFields, getEIP712Domain, known, normalizeContext, normalizeFunding, normalizeOpaqueDelivery, normalizeSources, normalizeTransactRequest, notes, pad, registrationDigest, registrationTypedData, resolveInstanceAddress, selectCreditDrawCircuit, selectTransactCapacity, shieldFundingRequestHash, topUpCreditBaseInputs, topUpCreditPublicInputs, topUpCreditRequestHash, transactFundingRequestHash, transactPublicInputs, transactUserPublicInputs, uint, validateCancelCreditRequest, validateCreateCreditRequest, validateCreditDrawRequest, validateFundingSubmission, validateShieldRequest, validateTopUpCreditRequest, verifyCreditCommitment, verifyNoteCommitment, word };
142
+ /** Canonical optional public fee. Omitting both fields explicitly selects zero fee. */
143
+ declare function normalizeFee(p: {
144
+ feeRecipient?: Address;
145
+ feeAmount?: bigint;
146
+ }): {
147
+ feeRecipient: `0x${string}`;
148
+ feeAmount: bigint;
149
+ };
150
+
151
+ declare const CIRCUIT_RELEASE: {
152
+ readonly note: {
153
+ readonly version: 4;
154
+ readonly formatVersion: 7;
155
+ readonly aggregateFormatVersion: 10;
156
+ };
157
+ readonly credit: {
158
+ readonly version: 7;
159
+ readonly formatVersion: 8;
160
+ readonly manifestSha256: "c84fe8b0817f722428d9f888c0e38f2b1b48f15b670e74a75e8dd84776b14d66";
161
+ };
162
+ };
163
+
164
+ type DocumentedReleaseIdentity = {
165
+ creditManifestVersion: number;
166
+ creditFormatVersion: number;
167
+ creditManifestSha256?: string;
168
+ } | {
169
+ userManifestVersion: number;
170
+ userFormatVersion: number;
171
+ };
172
+ type DocumentedGasShape = Readonly<Record<string, string | number | boolean>>;
173
+ type DocumentedGasReference = {
174
+ source: "documented-reference";
175
+ available: false;
176
+ reason: "shape-not-covered" | "release-not-covered";
177
+ } | {
178
+ source: "documented-reference";
179
+ available: true;
180
+ gasUnits: bigint;
181
+ statistic: "median";
182
+ sampleCount: number;
183
+ referenceId: string;
184
+ document: string;
185
+ sourceSha256: string;
186
+ docsCommit: string;
187
+ conditions: string;
188
+ assumptions: readonly string[];
189
+ releaseIdentity: DocumentedReleaseIdentity;
190
+ };
191
+ /** Exact documented workload lookup. This is neither a transaction gas limit nor an RPC estimate. */
192
+ declare function getDocumentedGasReference(query: DocumentedGasShape): DocumentedGasReference;
193
+
194
+ /** Runtime identity and indexing start for one deployed contract. */
195
+ interface ContractDeployment {
196
+ readonly address: Address;
197
+ readonly runtimeCodeHash: Hex;
198
+ readonly fromBlock: bigint;
199
+ }
200
+ /** A deployment record supplied by the selected service or its publisher. */
201
+ interface ProtocolDeployment {
202
+ readonly chainId: bigint;
203
+ readonly protocol: Readonly<ContractDeployment>;
204
+ readonly registry?: Readonly<ContractDeployment>;
205
+ readonly broadcasterRegistry?: Readonly<ContractDeployment>;
206
+ }
207
+ /** Validate and snapshot an object or JSON record. This does not authenticate its source. */
208
+ declare function defineDeployment(value: unknown): Readonly<ProtocolDeployment>;
209
+
210
+ export { type AddressRegistration, CIRCUIT_RELEASE, CanonicalBlock, type CanonicalReceipt, type ChainReader, type ContractDeployment, DeploymentContext, type DocumentedGasReference, type DocumentedGasShape, type DocumentedReleaseIdentity, type FactoryReader, FundingInput, type ProtocolDeployment, type ProtocolLog, type RegistrationCalldata, type RegistrationOptions, type RegistryContext, type RegistryReadClient, type RegistryReceivingKeys, TransactRequestParams, type TransactionCall, TransactionContext, type VerifyCreditCommitmentParams, type VerifyNoteCommitmentParams, buildRegistrationCalldata, createRegistryReceivingKeyLookup, defineDeployment, getDocumentedGasReference, normalizeFee, registrationDigest, registrationTypedData, resolveInstanceAddress, transactUserPublicInputs, verifyCreditCommitment, verifyNoteCommitment };