@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,99 +1,30 @@
1
- import { Note, CreditDeliveryState, ReceivingKeyLookup, Hex as Hex$2, Wallet, PublicWallet, AuthorizedStatement } from '@invisi-labs/core';
1
+ import { ProofSidecar, ManifestIdentity, Scope } from '@invisi-labs/protocol/provenance';
2
+ import { OfflineProver } from '@invisi-labs/prover/provenance-witness';
3
+ import * as _invisi_labs_rpc_provenance from '@invisi-labs/rpc/provenance';
4
+ import { ProvenanceClient } from '@invisi-labs/rpc/provenance';
5
+ import { Note, CreditDeliveryState, ReceivingKeyLookup, Wallet, CreditUpdateChanges, AuthorizedStatement } from '@invisi-labs/primitives';
2
6
  import * as _invisi_labs_prover from '@invisi-labs/prover';
3
- import { Hex, Prover, ProverOptions, AggregateMember, ProofBundle } from '@invisi-labs/prover';
7
+ import { Hex, Prover, NoteMembership, CreditMembership, ProverOptions, AggregateMember, ProofBundle } from '@invisi-labs/prover';
4
8
  import * as _invisi_labs_protocol from '@invisi-labs/protocol';
5
- import { FundingInput, TransactionContext, CanonicalBlock, NoteMembership, TransactRequestParams, CreditMembership, Protocol, ChainReader, ProtocolDataProvider, TokenProtocol } from '@invisi-labs/protocol';
6
- import * as ethers from 'ethers';
7
- import { Interface, Provider } from 'ethers';
8
- import { Hex as Hex$1, Delivery, Address, ShieldParams, ShieldOutput, CreateCreditParams, CreditDrawParams, CancelCreditParams, TopUpCreditParams, TransactRequest } from '@invisi-labs/protocol/contracts';
9
+ import { FundingInput, ChainReader, ProtocolDataProvider, TransactionContext, CanonicalBlock, TransactRequestParams } from '@invisi-labs/protocol';
10
+ import { SignedBroadcasterQuote, BroadcasterClient as BroadcasterClient$1, BroadcasterStatus, BroadcasterConfiguration } from '@invisi-labs/rpc/broadcaster';
11
+ import { Hex as Hex$1, Delivery, Address, ShieldParams, ShieldOutput, CreateCreditParams, CreditDrawParams, UpdateCreditParams, RevokeCreditParams, TransactRequest } from '@invisi-labs/protocol/contracts';
12
+ import { Provider } from 'ethers';
13
+ import { Protocol, TokenProtocol } from '@invisi-labs/rpc';
9
14
 
10
- declare const broadcasterQuoteTypes: {
11
- Quote: {
12
- name: string;
13
- type: string;
14
- }[];
15
- };
16
- interface BroadcasterQuote {
17
- token: string;
18
- feeRecipient: string;
19
- feeAmount: string;
20
- deadline: string;
21
- maxGas: string;
22
- requestHash: string;
23
- }
24
- interface SignedBroadcasterQuote {
25
- quote: BroadcasterQuote;
26
- signature: string;
27
- context?: {
28
- chainId: bigint;
29
- protocol: string;
30
- };
31
- }
32
- interface BroadcasterTrust {
33
- chainId: bigint;
34
- protocol: string;
35
- signer: string;
36
- }
37
- declare function broadcasterQuoteDomain(trust: BroadcasterTrust): {
38
- name: string;
39
- version: string;
40
- chainId: bigint;
41
- verifyingContract: string;
42
- };
43
- declare const broadcasterTransactInterface: Interface;
44
- /** Decode a canonical supported direct public intent. Draw, registry and aggregates are excluded. */
45
- declare function decodeBroadcasterIntent(data: string): {
46
- fragment: ethers.FunctionFragment;
47
- method: string;
48
- args: ethers.Result;
49
- proof: string;
50
- request: {
51
- params: any;
52
- funding: any;
53
- deliveries: any;
15
+ /** Public recovery packet; persist encrypted Note openings separately if reproof is needed. */
16
+ interface ProvenanceProof {
17
+ format: "invisi-provenance-submission-v1";
18
+ data: string;
19
+ context: {
20
+ chainId: string;
21
+ protocolAddress: string;
22
+ tokenAddress: string;
54
23
  };
55
- };
56
- /** Domain-separated final public intent: omit only proof bytes and funding.signature. */
57
- declare function broadcasterRequestHash(data: string): string;
58
- declare function verifyBroadcasterQuote(signed: SignedBroadcasterQuote, trust: BroadcasterTrust, data: string, now?: bigint): BroadcasterQuote;
59
- interface BroadcasterStatus {
60
- id: string;
61
- state: "pending" | "submitted" | "confirmed" | "reverted" | "uncertain";
62
- transactionHash?: string;
63
- }
64
- type BroadcasterTransport = (request: {
65
- jsonrpc: "2.0";
66
- id: number;
67
- method: string;
68
- params: unknown;
69
- }) => Promise<unknown>;
70
- interface BroadcasterConfiguration {
71
- endpoint: string;
72
- quoteSigner: string;
73
- feeRecipient: string;
74
- }
75
- declare class BroadcasterClient {
76
- readonly configuration: Readonly<BroadcasterConfiguration>;
77
- readonly url: string;
78
- readonly transport: BroadcasterTransport;
79
- private requestId;
80
- constructor(configuration: BroadcasterConfiguration, transport?: BroadcasterTransport);
81
- private call;
82
- fee(token: string, data?: string): Promise<{
83
- feeRecipient: string;
84
- feeAmount: string;
85
- maxGas: string;
86
- }>;
87
- quote(data: string, context: {
88
- chainId: bigint;
89
- protocol: string;
90
- }): Promise<SignedBroadcasterQuote>;
91
- submit(data: string, signed: SignedBroadcasterQuote, idempotencyKey: string): Promise<BroadcasterStatus>;
92
- status(id: string): Promise<BroadcasterStatus>;
93
- }
94
- declare class BroadcasterRpcError extends Error {
95
- readonly code: number;
96
- constructor(code: number, message: string);
24
+ mainCircuitCapacity: number;
25
+ publicInputs: string[];
26
+ operationDigest: string;
27
+ sidecars: ProofSidecar[];
97
28
  }
98
29
 
99
30
  interface WalletScope {
@@ -123,9 +54,10 @@ interface NoteRecord extends ReceiptPosition {
123
54
  }
124
55
  interface CreditRecord extends ReceiptPosition {
125
56
  receivingKeySource?: {
126
- kind: "draw" | "top-up";
57
+ kind: "draw" | "update";
127
58
  commitment: Hex;
128
59
  };
60
+ revoked?: boolean;
129
61
  state: CreditDeliveryState;
130
62
  role: "owner" | "spender";
131
63
  spent: SpentState;
@@ -136,6 +68,51 @@ type OperationStatus = "prepared" | "authorized" | "proved" | "ready" | "submitt
136
68
  /** Minimal input count by descending amount, with deterministic tree/position/commitment ties. */
137
69
  type SelectableNote = Pick<NoteRecord, "note" | "commitment" | "treeId" | "leafIndex" | "spent">;
138
70
 
71
+ type PreparationIntent = {
72
+ kind: "transfer";
73
+ options: TransferPreparation;
74
+ } | {
75
+ kind: "shield";
76
+ options: ShieldPreparation;
77
+ } | {
78
+ kind: "create-credit";
79
+ options: CreateCreditPreparation;
80
+ } | {
81
+ kind: "draw-credit";
82
+ options: DrawCreditPreparation;
83
+ } | {
84
+ kind: "update-credit";
85
+ options: UpdateCreditPreparation;
86
+ } | {
87
+ kind: "revoke-credit";
88
+ options: RevokeCreditPreparation;
89
+ };
90
+ type BroadcasterFeeSource = "public-funding" | "private-inputs";
91
+ interface BroadcasterQuoteOptions {
92
+ maxFeeAmount: bigint;
93
+ feeSource?: BroadcasterFeeSource;
94
+ maxAttempts?: number;
95
+ /** Optional app-owned permit signing, requested once for the final gross funding amount. */
96
+ fundingPermit?: (request: {
97
+ payer: `0x${string}`;
98
+ amount: bigint;
99
+ tokenAddress: `0x${string}`;
100
+ protocolAddress: `0x${string}`;
101
+ }) => Promise<NonNullable<TransferPreparation["funding"]>["permit"]>;
102
+ }
103
+ declare function prepareIntent(runtime: PreparationRuntime<OperationPlan>, intent: PreparationIntent): Promise<OperationPlan>;
104
+ declare function prepareBroadcasterPlan(plan: OperationPlan, reprepare: (intent: PreparationIntent) => Promise<OperationPlan>, client: BroadcasterClient, options: BroadcasterQuoteOptions): Promise<{
105
+ plan: OperationPlan;
106
+ quote: SignedBroadcasterQuote;
107
+ broadcasterBinding: NonNullable<SavedOperation["broadcasterBinding"]>;
108
+ }>;
109
+
110
+ /** Application-level quote and submission conveniences over the public RPC client. */
111
+ declare class BroadcasterClient extends BroadcasterClient$1 {
112
+ quote<T extends BroadcasterTransaction>(transaction: T, options: BroadcasterQuoteOptions): Promise<T>;
113
+ submit(transaction: BroadcasterTransaction): Promise<BroadcasterStatus>;
114
+ }
115
+
139
116
  type AddressLookup = "chain" | "protocol-rpc";
140
117
  /** Capture deployment pins before a Protocol is bound to an operation's token. */
141
118
  declare function configureRecipientInfrastructure<T extends TransactionInfrastructure>(options: T): T;
@@ -220,109 +197,6 @@ declare class NoteOutput {
220
197
  get delivery(): Delivery;
221
198
  }
222
199
 
223
- interface GasBenchmarkShape {
224
- kind: OperationPlan["kind"];
225
- target: string;
226
- capacity: number;
227
- noteInputs: number;
228
- noteOutputs: number;
229
- sourceTrees: number;
230
- creditInputs: number;
231
- creditOutputs: number;
232
- creditRemainders: number;
233
- funding: "none" | "caller" | "signature";
234
- permit: boolean;
235
- deliveryBytes: number;
236
- }
237
- interface GasBenchmarkDeployment {
238
- chainId: string;
239
- protocolAddress: Hex$2;
240
- runtimeCodeHash: Hex$2 | null;
241
- tokenAddress: Hex$2;
242
- }
243
- interface GasBenchmarkCircuit {
244
- circuitName: string;
245
- target: string;
246
- artifactSha256: string;
247
- vkSha256: string;
248
- }
249
- interface GasBenchmarkSample {
250
- gasUsed: string;
251
- transactionHash: Hex$2;
252
- blockNumber: string;
253
- blockHash: Hex$2;
254
- calldataBytes: number;
255
- }
256
- interface GasBenchmarkProfile {
257
- formatVersion: 1;
258
- id: string;
259
- deployment: GasBenchmarkDeployment;
260
- source: {
261
- protocolCommit: string;
262
- fingerprints?: {
263
- protocolSourceSha256: string;
264
- dirtyDiffSha256: string;
265
- compiledArtifactsSha256: string;
266
- creditManifestSha256: string;
267
- userManifestSha256: string;
268
- sdkSourceSha256: string;
269
- };
270
- toolchain?: {
271
- solidity: string;
272
- barretenberg: string;
273
- noir: string;
274
- evmVersion: string;
275
- optimizerRuns: number;
276
- anvil: string;
277
- };
278
- blockGasLimit?: string;
279
- runtimeContracts?: Record<string, {
280
- address: Hex$2;
281
- runtimeCodeHash: Hex$2;
282
- }>;
283
- measuredAt: string;
284
- chain: string;
285
- hardfork: string;
286
- token: string;
287
- verifier: "real";
288
- assumptions: string[];
289
- };
290
- measurements: Array<{
291
- id: string;
292
- shape: GasBenchmarkShape;
293
- circuit: GasBenchmarkCircuit | null;
294
- samples: GasBenchmarkSample[];
295
- }>;
296
- }
297
- interface GasEstimateRequest {
298
- deployment: GasBenchmarkDeployment;
299
- shape: GasBenchmarkShape;
300
- circuit: GasBenchmarkCircuit | null;
301
- }
302
- type BenchmarkGasEstimate = {
303
- source: "benchmark";
304
- request: GasEstimateRequest;
305
- } & ({
306
- available: false;
307
- reason: "deployment-not-covered" | "shape-not-covered" | "recursive-member-only";
308
- } | {
309
- available: true;
310
- gasUnits: bigint;
311
- range: {
312
- min: bigint;
313
- max: bigint;
314
- kind: "observed";
315
- };
316
- samples: number;
317
- profileId: string;
318
- measurementId: string;
319
- evidence: GasBenchmarkProfile["source"];
320
- });
321
- /** Pre-proof reference only; ethers must estimate the final transaction independently. */
322
- interface GasReference {
323
- gasUnits: bigint;
324
- }
325
-
326
200
  interface CoinSelector {
327
201
  select(candidates: readonly NoteRecord[], requiredAmount: bigint): readonly Hex$1[] | Promise<readonly Hex$1[]>;
328
202
  }
@@ -405,52 +279,59 @@ interface CreateCreditPreparation {
405
279
  recipient: Address;
406
280
  amount: bigint;
407
281
  };
408
- /** Version-specific application data. Omission uses built-in v1 with no data. */
409
282
  payload?: Uint8Array;
410
283
  singleLimit?: bigint;
411
284
  dailyLimit?: bigint;
412
285
  monthlyLimit?: bigint;
286
+ availableCredit?: bigint;
287
+ unlimited?: boolean;
413
288
  tokenAddress: Address;
414
289
  spender: string;
415
- amount: bigint;
416
290
  expiry: bigint;
417
- funding?: FundingSource;
418
291
  deadline?: bigint;
419
292
  }
420
293
  interface DrawCreditPreparation {
294
+ fee?: {
295
+ recipient: Address;
296
+ amount: bigint;
297
+ };
421
298
  tokenAddress: Address;
422
299
  credits: readonly {
423
300
  credit: Hex$1;
424
301
  amount: bigint;
425
302
  payload?: Uint8Array;
426
303
  }[];
304
+ recipient: string;
305
+ payload?: Uint8Array;
427
306
  deadline?: bigint;
428
307
  }
429
- interface TopUpCreditPreparation {
308
+ interface UpdateCreditPreparation {
430
309
  fee?: {
431
310
  recipient: Address;
432
311
  amount: bigint;
433
312
  };
434
- /** Version-specific application data. Omission uses built-in v1 with no data. */
435
313
  payload?: Uint8Array;
436
- /** Omission inherits the previous limit; zero disables it without clearing usage. */
437
314
  singleLimit?: bigint;
438
315
  dailyLimit?: bigint;
439
316
  monthlyLimit?: bigint;
317
+ increaseAvailableCredit?: bigint;
318
+ decreaseAvailableCredit?: bigint;
319
+ unlimited?: boolean;
440
320
  tokenAddress: Address;
441
321
  credit: Hex$1;
442
- additionalAmount: bigint;
443
322
  expiry?: bigint;
444
- funding?: FundingSource;
445
323
  deadline?: bigint;
446
324
  }
447
- interface CancelCreditPreparation {
325
+ interface RevokeCreditPreparation {
448
326
  fee?: {
449
327
  recipient: Address;
450
328
  amount: bigint;
451
329
  };
452
330
  tokenAddress: Address;
453
- credit: Hex$1;
331
+ owner?: Address;
332
+ shard: bigint;
333
+ slot: bigint;
334
+ caller?: Address;
454
335
  deadline?: bigint;
455
336
  }
456
337
  interface PreparedCreditOutput {
@@ -468,15 +349,18 @@ interface CreditPlan {
468
349
  deliveries: Delivery[];
469
350
  creation?: CreateCreditParams;
470
351
  draw?: CreditDrawParams;
471
- cancel?: CancelCreditParams;
472
- topUp?: TopUpCreditParams;
352
+ update?: UpdateCreditParams;
353
+ updateChanges?: CreditUpdateChanges;
354
+ revocation?: RevokeCreditParams;
355
+ revocationSignature?: Hex$1;
356
+ revocationCaller?: Hex$1;
473
357
  amounts?: bigint[];
474
358
  }
475
359
  interface OperationPlan {
476
360
  intent?: PreparationIntent;
477
361
  version: 1;
478
362
  id: string;
479
- kind: "transfer" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
363
+ kind: "transfer" | "shield" | "create-credit" | "draw-credit" | "update-credit" | "revoke-credit";
480
364
  context: TransactionContext;
481
365
  scope: WalletScope;
482
366
  preparedAt: CanonicalBlock;
@@ -496,6 +380,13 @@ interface OperationPlan {
496
380
  }
497
381
  interface SavedOperation {
498
382
  plan: OperationPlan;
383
+ provenance?: ProvenanceProof;
384
+ broadcasterBinding?: {
385
+ configuration: BroadcasterConfiguration;
386
+ intentHash: string;
387
+ };
388
+ broadcasterSubmissionId?: string;
389
+ broadcasterAttempted?: boolean;
499
390
  broadcasterQuote?: SignedBroadcasterQuote;
500
391
  proof?: ProofBundle;
501
392
  call?: _invisi_labs_protocol.TransactionCall;
@@ -507,8 +398,9 @@ interface SavedOperation {
507
398
  };
508
399
  }
509
400
  interface TransactionInfrastructure {
510
- gasBenchmarks?: readonly GasBenchmarkProfile[];
511
- wallet: Wallet | PublicWallet;
401
+ provenanceClient?: _invisi_labs_rpc_provenance.ProvenanceClient;
402
+ provenance?: PreparedProvenanceCapability;
403
+ wallet: Wallet;
512
404
  protocol: Protocol;
513
405
  chainReader?: ChainReader;
514
406
  protocolRpc?: ProtocolDataProvider;
@@ -549,39 +441,32 @@ interface PreparationInventory {
549
441
  credits: Record<string, Pick<CreditRecord, "state" | "commitment" | "treeId" | "leafIndex" | "role" | "spent">>;
550
442
  }
551
443
 
552
- type PreparationIntent = {
553
- kind: "transfer";
554
- options: TransferPreparation;
555
- } | {
556
- kind: "shield";
557
- options: ShieldPreparation;
558
- } | {
559
- kind: "create-credit";
560
- options: CreateCreditPreparation;
561
- } | {
562
- kind: "top-up-credit";
563
- options: TopUpCreditPreparation;
564
- } | {
565
- kind: "cancel-credit";
566
- options: CancelCreditPreparation;
567
- };
568
- type BroadcasterFeeSource = "public-funding" | "private-inputs" | "payout";
569
- interface WithBroadcasterOptions {
570
- maxFeeAmount: bigint;
571
- feeSource?: BroadcasterFeeSource;
572
- maxAttempts?: number;
573
- /** Optional app-owned permit signing, requested once for the final gross funding amount. */
574
- fundingPermit?: (request: {
575
- payer: `0x${string}`;
576
- amount: bigint;
577
- tokenAddress: `0x${string}`;
578
- protocolAddress: `0x${string}`;
579
- }) => Promise<NonNullable<TransferPreparation["funding"]>["permit"]>;
580
- }
581
- declare function prepareIntent(runtime: PreparationRuntime<OperationPlan>, intent: PreparationIntent): Promise<OperationPlan>;
582
- declare function prepareBroadcasterPlan(plan: OperationPlan, reprepare: (intent: PreparationIntent) => Promise<OperationPlan>, client: BroadcasterClient, options: WithBroadcasterOptions): Promise<{
583
- plan: OperationPlan;
584
- quote: SignedBroadcasterQuote;
444
+ interface PreparedProvenanceCapability {
445
+ client: ProvenanceClient;
446
+ manifest: ManifestIdentity;
447
+ prover: OfflineProver;
448
+ maxRootPages?: number;
449
+ maxLeaves?: number;
450
+ }
451
+ declare function prepareProvenance(plan: OperationPlan, runtime: TransactionRuntime): Promise<{
452
+ operationDigest: string;
453
+ sidecars: ProofSidecar[];
585
454
  }>;
455
+ declare function provePreparedProvenance(saved: SavedOperation, runtime: TransactionRuntime, capability?: PreparedProvenanceCapability, reprove?: boolean): Promise<ProvenanceProof>;
456
+ declare function validateBroadcastEnvelope(saved: SavedOperation, client: BroadcasterClient): void;
457
+ declare function validatePreparedBroadcast(saved: SavedOperation, client: BroadcasterClient, runtime: TransactionRuntime): Promise<void>;
458
+
459
+ interface BroadcasterTransaction {
460
+ readonly id: string;
461
+ readonly status: string;
462
+ }
463
+ interface Hooks<T extends BroadcasterTransaction> {
464
+ quote(client: BroadcasterClient, options: BroadcasterQuoteOptions): Promise<T>;
465
+ submit(client: BroadcasterClient): Promise<BroadcasterStatus>;
466
+ provenanceContext(): Promise<Scope>;
467
+ readProvenance(): Promise<ProvenanceProof | undefined>;
468
+ proveProvenance(capability: PreparedProvenanceCapability, reprove?: boolean): Promise<ProvenanceProof>;
469
+ }
470
+ declare function bindBroadcasterOperation<T extends BroadcasterTransaction>(target: T, hooks: Hooks<T>): void;
586
471
 
587
- export { type LocalOperationSecrets as $, broadcasterTransactInterface as A, BroadcasterClient as B, type CancelCreditPreparation as C, type DrawCreditPreparation as D, decodeBroadcasterIntent as E, type FundingAuthorizationVerifier as F, type GasBenchmarkCircuit as G, verifyBroadcasterQuote as H, type GasEstimateRequest as I, type OperationPlan as J, type BenchmarkGasEstimate as K, type SavedOperation as L, type TransactionRuntime as M, NoteOutput as N, type OperationAggregateMember as O, type PaymentRequest as P, type OperationStatus as Q, type PreparationRuntime as R, type ShieldPreparation as S, type TopUpCreditPreparation as T, type TransactionInfrastructure as U, type AddressLookup as V, type WithBroadcasterOptions as W, type Checkpoint as X, type CoinSelector as Y, type CreditPlan as Z, type CreditRecord as _, type BroadcasterConfiguration as a, type NoteRecord as a0, type PreparationIntent as a1, type PreparationInventory as a2, type PreparedCreditInput as a3, type PreparedCreditOutput as a4, type PreparedOutput as a5, type ReceiptPosition as a6, type SpentState as a7, type WalletScope as a8, configureRecipientInfrastructure as a9, creditReservationKey as aa, prepareBroadcasterPlan as ab, prepareIntent as ac, recipientLookup as ad, type BroadcasterFeeSource as b, type BroadcasterQuote as c, BroadcasterRpcError as d, type BroadcasterStatus as e, type BroadcasterTransport as f, type BroadcasterTrust as g, type CreateCreditPreparation as h, type FundingSigner as i, type FundingSource as j, type FundingTypedData as k, type GasBenchmarkDeployment as l, type GasBenchmarkProfile as m, type GasBenchmarkSample as n, type GasBenchmarkShape as o, type GasReference as p, type NoteOutputContext as q, type NoteOutputExecutionOptions as r, type NoteOutputRecipient as s, type SignedBroadcasterQuote as t, type TransactionExecution as u, type TransactionProveOptions as v, type TransferPreparation as w, broadcasterQuoteDomain as x, broadcasterQuoteTypes as y, broadcasterRequestHash as z };
472
+ export { validateBroadcastEnvelope as $, type AddressLookup as A, type BroadcasterTransaction as B, type CreateCreditPreparation as C, type DrawCreditPreparation as D, type PreparedCreditInput as E, type FundingSigner as F, type PreparedCreditOutput as G, type PreparedOutput as H, type ReceiptPosition as I, type SpentState as J, bindBroadcasterOperation as K, type LocalOperationSecrets as L, configureRecipientInfrastructure as M, NoteOutput as N, type OperationStatus as O, type ProvenanceProof as P, creditReservationKey as Q, type RevokeCreditPreparation as R, type ShieldPreparation as S, type TransactionRuntime as T, type UpdateCreditPreparation as U, prepareBroadcasterPlan as V, type WalletScope as W, prepareIntent as X, prepareProvenance as Y, provePreparedProvenance as Z, recipientLookup as _, type PreparedProvenanceCapability as a, validatePreparedBroadcast as a0, type FundingTypedData as b, type FundingAuthorizationVerifier as c, type PreparationIntent as d, type OperationPlan as e, type TransactionProveOptions as f, type OperationAggregateMember as g, type TransactionInfrastructure as h, BroadcasterClient as i, type PaymentRequest as j, type BroadcasterFeeSource as k, type BroadcasterQuoteOptions as l, type FundingSource as m, type NoteOutputContext as n, type NoteOutputExecutionOptions as o, type NoteOutputRecipient as p, type TransactionExecution as q, type TransferPreparation as r, type SavedOperation as s, type PreparationRuntime as t, type Checkpoint as u, type CoinSelector as v, type CreditPlan as w, type CreditRecord as x, type NoteRecord as y, type PreparationInventory as z };