@invisi-labs/sdk 1.1.6 → 1.1.7

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 (67) hide show
  1. package/dist/{NoteOutput-DRkVnwlx.d.cts → broadcaster-preparation-DMxxZ_1Q.d.cts} +309 -120
  2. package/dist/{NoteOutput-DpDC6T2O.d.ts → broadcaster-preparation-DMxxZ_1Q.d.ts} +309 -120
  3. package/dist/broadcaster-preparation-RMWQFYNL.js +11 -0
  4. package/dist/broadcaster-preparation-UGOTO4SX.cjs +11 -0
  5. package/dist/broadcaster-preparation-UGOTO4SX.cjs.map +1 -0
  6. package/dist/chunk-7F7ZZW3L.cjs +374 -0
  7. package/dist/chunk-7F7ZZW3L.cjs.map +1 -0
  8. package/dist/{chunk-4SD3MW6N.js → chunk-EHP5TBC6.js} +1347 -2493
  9. package/dist/chunk-EHP5TBC6.js.map +1 -0
  10. package/dist/{broadcaster-preparation-QVL62KM6.js → chunk-GTPUYPQL.js} +6 -6
  11. package/dist/chunk-GTPUYPQL.js.map +1 -0
  12. package/dist/{chunk-FL4TIGWW.js → chunk-ITTGBIG2.js} +617 -521
  13. package/dist/chunk-ITTGBIG2.js.map +1 -0
  14. package/dist/chunk-J2JH6HIG.cjs +1877 -0
  15. package/dist/chunk-J2JH6HIG.cjs.map +1 -0
  16. package/dist/chunk-LOU7AP2B.cjs +128 -0
  17. package/dist/chunk-LOU7AP2B.cjs.map +1 -0
  18. package/dist/chunk-RHNIHI4P.cjs +3565 -0
  19. package/dist/chunk-RHNIHI4P.cjs.map +1 -0
  20. package/dist/{chunk-QC6TQR3R.js → chunk-XHKQ2BO2.js} +12 -12
  21. package/dist/chunk-XHKQ2BO2.js.map +1 -0
  22. package/dist/ethers.cjs +11 -385
  23. package/dist/ethers.cjs.map +1 -1
  24. package/dist/ethers.d.cts +3 -4
  25. package/dist/ethers.d.ts +3 -4
  26. package/dist/ethers.js +1 -1
  27. package/dist/index.cjs +451 -7845
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +72 -702
  30. package/dist/index.d.ts +72 -702
  31. package/dist/index.js +374 -862
  32. package/dist/index.js.map +1 -1
  33. package/dist/receipt-logs-CvC951p7.d.cts +318 -0
  34. package/dist/receipt-logs-m0-bhaxW.d.ts +318 -0
  35. package/dist/session-support.cjs +168 -0
  36. package/dist/session-support.cjs.map +1 -0
  37. package/dist/session-support.d.cts +252 -0
  38. package/dist/session-support.d.ts +252 -0
  39. package/dist/session-support.js +168 -0
  40. package/dist/session-support.js.map +1 -0
  41. package/package.json +10 -20
  42. package/dist/broadcaster-preparation-QVL62KM6.js.map +0 -1
  43. package/dist/chunk-4SD3MW6N.js.map +0 -1
  44. package/dist/chunk-FL4TIGWW.js.map +0 -1
  45. package/dist/chunk-QC6TQR3R.js.map +0 -1
  46. package/dist/indexeddb.cjs +0 -6878
  47. package/dist/indexeddb.cjs.map +0 -1
  48. package/dist/indexeddb.d.cts +0 -20
  49. package/dist/indexeddb.d.ts +0 -20
  50. package/dist/indexeddb.js +0 -71
  51. package/dist/indexeddb.js.map +0 -1
  52. package/dist/memory.cjs +0 -6886
  53. package/dist/memory.cjs.map +0 -1
  54. package/dist/memory.d.cts +0 -12
  55. package/dist/memory.d.ts +0 -12
  56. package/dist/memory.js +0 -11
  57. package/dist/sqlite.cjs +0 -6862
  58. package/dist/sqlite.cjs.map +0 -1
  59. package/dist/sqlite.d.cts +0 -28
  60. package/dist/sqlite.d.ts +0 -28
  61. package/dist/sqlite.js +0 -55
  62. package/dist/sqlite.js.map +0 -1
  63. package/dist/state-C4HZFotm.d.cts +0 -78
  64. package/dist/state-C4HZFotm.d.ts +0 -78
  65. package/dist/store-8aBhnbGr.d.ts +0 -42
  66. package/dist/store-YrbXb6CY.d.cts +0 -42
  67. /package/dist/{memory.js.map → broadcaster-preparation-RMWQFYNL.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,318 +1,17 @@
1
- import { O as OperationRuntime, P as PreparationIntent, a as OperationPlan, W as WithBroadcasterOptions, G as GasReference, T as TransactionProveOptions, b as OperationAggregateMember, C as CancelCreditPreparation, c as CreateCreditPreparation, D as DrawCreditPreparation, S as ShieldPreparation, d as TopUpCreditPreparation, e as TransferPreparation, f as WalletSessionOptions, g as WalletSessionInfrastructure } from './NoteOutput-DpDC6T2O.js';
2
- export { B as BroadcasterFeeSource, h as CoinSelector, F as FundingAuthorizationVerifier, i as FundingSigner, j as FundingSource, k as FundingTypedData, l as GasBenchmarkCircuit, m as GasBenchmarkDeployment, n as GasBenchmarkProfile, o as GasBenchmarkSample, p as GasBenchmarkShape, N as NoteOutput, q as NoteOutputContext, r as NoteOutputOptions, s as NoteOutputRecipient, t as TransactionExecution, u as defineGasBenchmarks } from './NoteOutput-DpDC6T2O.js';
3
- import * as _invisi_labs_core from '@invisi-labs/core';
4
- import { CreditDeliveryState, PublicWallet, Note, DisclosureOutput, Disclosure, DisclosureResult, ViewingCapability } from '@invisi-labs/core';
1
+ import { DisclosureOutput, Disclosure, DisclosureResult, Wallet } from '@invisi-labs/core';
5
2
  export { Address, CreditDataV1, CreditDeliveryState, CreditNote, CreditOpening, CreditPolicy, Detector, Disclosure, DisclosureExport, DisclosureOutput, DisclosureResult, FundsDataV1, Hex, MAX_MEMO_BYTES, Memo, MissingCapabilityError, Note, NullifierCapability, PublicWallet, ReceivingKeys, SigningRequest, ViewingCapability, Wallet, WalletAuthorization, WalletAuthorizationProvider, computeCreditNullifier, creditPeriods, creditV1, decodeDeliveryHeader, decodeMemoText, encodeMemo, fundsV1 } from '@invisi-labs/core';
6
- import * as ethers from 'ethers';
7
- import { Interface, Provider, TransactionRequest, TransactionResponse } from 'ethers';
8
3
  import * as _invisi_labs_protocol from '@invisi-labs/protocol';
9
- import { TransactionCall, Protocol as Protocol$1, CanonicalBlock, ChainReader, TokenProtocol, RegistrationPreparation, RegistrationOperation, AddressRegistry as AddressRegistry$1, CanonicalReceipt } from '@invisi-labs/protocol';
4
+ import { CanonicalBlock, ChainReader, TokenProtocol, Protocol as Protocol$1, AddressRegistry as AddressRegistry$1, RegistrationPreparation, TransactionCall, Membership } from '@invisi-labs/protocol';
10
5
  export { AddressRegistryOptions, CanonicalBlock, CanonicalReceipt, ChainReader, FactoryReader, Membership, ProtocolDataProvider, ProtocolDataStatus, ProtocolOptions, ProtocolUpdateRange, ProtocolUpdates, RegistrationOperation, RegistryContext, RegistryReader, TokenProtocol, TokenProtocolOptions, TransactionCall, TransactionContext } from '@invisi-labs/protocol';
11
- import { Prover, ProofBundle } from '@invisi-labs/prover';
12
6
  export { AggregateMember, AggregatorCapability, ProofBundle, ProofStatement, Prover, ProverOptions } from '@invisi-labs/prover';
13
- import { O as OperationStatus, B as BalanceSnapshot, R as ReceiptPosition, S as SpentState, C as Checkpoint, W as WalletScope, a as WalletState } from './state-C4HZFotm.js';
14
- export { b as WalletStore, w as walletBalance } from './state-C4HZFotm.js';
7
+ import { N as NoteInput } from './receipt-logs-m0-bhaxW.js';
8
+ export { C as CreditInput, D as DeliveryEventLog, a as DiscoveredCredit, b as DiscoveredNote, E as ExplicitCancelCreditPreparation, c as ExplicitCreateCreditPreparation, d as ExplicitDrawCreditPreparation, e as ExplicitShieldPreparation, f as ExplicitTopUpCreditPreparation, g as ExplicitTransferPreparation, I as Invisi, h as InvisiError, i as InvisiErrorCode, j as InvisiErrorDetails, k as InvisiOptions, P as PreparedTransaction, R as RegistrationPreparationOptions, T as TransactionIdentity, l as TransactionOutput, m as decryptCandidates, n as defineGasBenchmarks, r as readProtocolLogs } from './receipt-logs-m0-bhaxW.js';
15
9
  import { Hex, Address } from '@invisi-labs/protocol/contracts';
10
+ import { Provider } from 'ethers';
11
+ import { B as BroadcasterClient, P as PaymentRequest } from './broadcaster-preparation-DMxxZ_1Q.js';
12
+ export { a as BroadcasterConfiguration, b as BroadcasterFeeSource, c as BroadcasterQuote, d as BroadcasterRpcError, e as BroadcasterStatus, f as BroadcasterTransport, g as BroadcasterTrust, C as CancelCreditPreparation, h as CreateCreditPreparation, D as DrawCreditPreparation, F as FundingAuthorizationVerifier, i as FundingSigner, j as FundingSource, k as FundingTypedData, G as GasBenchmarkCircuit, l as GasBenchmarkDeployment, m as GasBenchmarkProfile, n as GasBenchmarkSample, o as GasBenchmarkShape, p as GasReference, N as NoteOutput, q as NoteOutputContext, r as NoteOutputExecutionOptions, s as NoteOutputRecipient, O as OperationAggregateMember, S as ShieldPreparation, t as SignedBroadcasterQuote, T as TopUpCreditPreparation, u as TransactionExecution, v as TransactionProveOptions, w as TransferPreparation, W as WithBroadcasterOptions, x as broadcasterQuoteDomain, y as broadcasterQuoteTypes, z as broadcasterRequestHash, A as broadcasterTransactInterface, E as decodeBroadcasterIntent, H as verifyBroadcasterQuote } from './broadcaster-preparation-DMxxZ_1Q.js';
16
13
  import { ProtocolRpcClient as ProtocolRpcClient$1 } from '@invisi-labs/rpc';
17
14
  export { MAX_UPDATE_BLOCKS, ProtocolCreditTransition, ProtocolDeployment, ProtocolOutput, ProtocolRpcChain, ProtocolRpcClientOptions, ProtocolRpcConnectionOptions, ProtocolRpcError, ProtocolRpcReader, ProtocolTransactionUpdates, RegisteredReceivingAddress } from '@invisi-labs/rpc';
18
- import { W as WalletRecordCodec } from './store-8aBhnbGr.js';
19
-
20
- declare const broadcasterQuoteTypes: {
21
- Quote: {
22
- name: string;
23
- type: string;
24
- }[];
25
- };
26
- interface BroadcasterQuote {
27
- token: string;
28
- feeRecipient: string;
29
- feeAmount: string;
30
- deadline: string;
31
- maxGas: string;
32
- requestHash: string;
33
- }
34
- interface SignedBroadcasterQuote {
35
- quote: BroadcasterQuote;
36
- signature: string;
37
- context?: {
38
- chainId: bigint;
39
- protocol: string;
40
- };
41
- }
42
- interface BroadcasterTrust {
43
- chainId: bigint;
44
- protocol: string;
45
- signer: string;
46
- }
47
- declare function broadcasterQuoteDomain(trust: BroadcasterTrust): {
48
- name: string;
49
- version: string;
50
- chainId: bigint;
51
- verifyingContract: string;
52
- };
53
- declare const broadcasterTransactInterface: Interface;
54
- /** Decode a canonical supported direct public intent. Draw, registry and aggregates are excluded. */
55
- declare function decodeBroadcasterIntent(data: string): {
56
- fragment: ethers.FunctionFragment;
57
- method: string;
58
- args: ethers.Result;
59
- proof: string;
60
- request: {
61
- params: any;
62
- funding: any;
63
- deliveries: any;
64
- };
65
- };
66
- /** Domain-separated final public intent: omit only proof bytes and funding.signature. */
67
- declare function broadcasterRequestHash(data: string): string;
68
- declare function verifyBroadcasterQuote(signed: SignedBroadcasterQuote, trust: BroadcasterTrust, data: string, now?: bigint): BroadcasterQuote;
69
- interface BroadcasterStatus {
70
- id: string;
71
- state: "pending" | "submitted" | "confirmed" | "reverted" | "uncertain";
72
- transactionHash?: string;
73
- }
74
- type BroadcasterTransport = (request: {
75
- jsonrpc: "2.0";
76
- id: number;
77
- method: string;
78
- params: unknown;
79
- }) => Promise<unknown>;
80
- interface BroadcasterConfiguration {
81
- endpoint: string;
82
- quoteSigner: string;
83
- feeRecipient: string;
84
- }
85
- declare class BroadcasterClient {
86
- readonly configuration: Readonly<BroadcasterConfiguration>;
87
- readonly url: string;
88
- readonly transport: BroadcasterTransport;
89
- private requestId;
90
- constructor(configuration: BroadcasterConfiguration, transport?: BroadcasterTransport);
91
- private call;
92
- fee(token: string, data?: string): Promise<{
93
- feeRecipient: string;
94
- feeAmount: string;
95
- maxGas: string;
96
- }>;
97
- quote(data: string, context: {
98
- chainId: bigint;
99
- protocol: string;
100
- }): Promise<SignedBroadcasterQuote>;
101
- submit(data: string, signed: SignedBroadcasterQuote, idempotencyKey: string): Promise<BroadcasterStatus>;
102
- status(id: string): Promise<BroadcasterStatus>;
103
- }
104
- declare class BroadcasterRpcError extends Error {
105
- readonly code: number;
106
- constructor(code: number, message: string);
107
- }
108
-
109
- /** Stable codes returned by public SDK prepare* methods; inspect details instead of matching messages. */
110
- type InvisiErrorCode =
111
- /**
112
- * Other preparation failure, such as invalid amounts, expired deadlines,
113
- * or conflicting registration state. Inspect message and cause.
114
- */
115
- "PREPARATION_FAILED"
116
- /**
117
- * Required infrastructure or permissions were not supplied.
118
- * The capability field identifies what is missing.
119
- */
120
- | "MISSING_CAPABILITY"
121
- /**
122
- * The recipient string is not a valid full 0i address or nonzero EVM owner address.
123
- * No registration lookup is attempted for this invalid string.
124
- */
125
- | "INVALID_RECIPIENT"
126
- /**
127
- * A successful lookup found no receiving keys for this short 0x owner
128
- * at the queried state. Indexed data may lag behind the latest chain state.
129
- * Full 0i addresses contain receiving keys and do not require registration.
130
- */
131
- | "EVM_ADDRESS_NOT_REGISTERED"
132
- /**
133
- * Recipient lookup failed or returned invalid keys. Inspect cause.
134
- * Registration status is unknown; this does not mean the owner is unregistered.
135
- */
136
- | "RECIPIENT_LOOKUP_FAILED";
137
- interface InvisiErrorDetails {
138
- operation?: string;
139
- address?: string;
140
- /** Zero-based index into the caller's outputs array, excluding automatic change. */
141
- outputIndex?: number;
142
- field?: string;
143
- capability?: string;
144
- cause?: unknown;
145
- }
146
- /** Stable application-facing preparation failure with the original cause. */
147
- declare class InvisiError extends Error {
148
- readonly code: InvisiErrorCode;
149
- readonly operation: string | undefined;
150
- readonly address: string | undefined;
151
- readonly outputIndex: number | undefined;
152
- readonly field: string | undefined;
153
- readonly capability: string | undefined;
154
- constructor(code: InvisiErrorCode, message: string, details?: InvisiErrorDetails);
155
- }
156
-
157
- type Runtime = Omit<OperationRuntime, "store" | "authorization"> & {
158
- reprepare?: (intent: PreparationIntent) => Promise<OperationPlan>;
159
- };
160
- /** An immutable, local transaction handle. No wallet inventory, reservations or persistence. */
161
- declare class PreparedTransaction {
162
- #private;
163
- readonly status: OperationStatus;
164
- private constructor();
165
- static prepare(runtime: Runtime, plan: OperationPlan): PreparedTransaction;
166
- broadcasterQuote(): SignedBroadcasterQuote | undefined;
167
- withBroadcaster(client: BroadcasterClient, options: WithBroadcasterOptions): Promise<PreparedTransaction>;
168
- get id(): string;
169
- get kind(): "shield" | "transfer" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
170
- estimateGas(): GasReference;
171
- preview(): {
172
- id: string;
173
- kind: "shield" | "transfer" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
174
- status: OperationStatus;
175
- context: {
176
- tokenAddress: _invisi_labs_core.Address;
177
- now?: bigint;
178
- timestamp?: bigint;
179
- chainId: bigint;
180
- protocolAddress: _invisi_labs_core.Address;
181
- };
182
- inputs: number;
183
- inputDetails: ({
184
- kind: "notes";
185
- commitment: `0x${string}`;
186
- amount: bigint;
187
- owner: `0x${string}`;
188
- treeId: bigint;
189
- leafIndex: number;
190
- } | {
191
- kind: "credits";
192
- commitment: `0x${string}`;
193
- amount: bigint;
194
- owner: `0x${string}`;
195
- spender: `0x${string}`;
196
- expiry: bigint;
197
- role: "owner" | "spender";
198
- treeId: bigint;
199
- leafIndex: number;
200
- })[];
201
- funding: {
202
- payer: `0x${string}`;
203
- amount: bigint;
204
- authorization: "signature" | "none" | "caller";
205
- sigNonce: bigint;
206
- deadline: bigint;
207
- permit: {
208
- deadline: bigint;
209
- };
210
- };
211
- creditOutputs: {
212
- commitment: `0x${string}`;
213
- amount: bigint;
214
- expiry: bigint;
215
- owner: `0x${string}`;
216
- spender: `0x${string}`;
217
- ownerPayout: bigint;
218
- spenderPayout: bigint;
219
- }[] | undefined;
220
- outputs: {
221
- commitment: `0x${string}`;
222
- to: string;
223
- amount: bigint;
224
- change: boolean;
225
- }[];
226
- capacity: number | undefined;
227
- deadline: bigint;
228
- feeRecipient: `0x${string}` | undefined;
229
- feeAmount: bigint;
230
- fundingAmount: bigint;
231
- fundingPayer: `0x${string}` | undefined;
232
- withdrawalAmount: bigint;
233
- withdrawalAddress: `0x${string}` | undefined;
234
- permissions: {
235
- walletAuthorization: boolean;
236
- proof: boolean;
237
- fundingAuthorization: boolean;
238
- };
239
- };
240
- /** Obtain a firm quote before signing. This intent contains no private inputs or witness. */
241
- exportBroadcasterIntent(): Promise<{
242
- sendable: false;
243
- data: _invisi_labs_core.Hex;
244
- }>;
245
- private current;
246
- private stage;
247
- /** Public EIP-712 request; signing transport and key custody belong to the caller. */
248
- exportWalletAuthorization(options?: {
249
- signal?: AbortSignal;
250
- }): Promise<_invisi_labs_core.SigningRequest>;
251
- /** Attach an external EOA signature, retaining its witness only at the private proving boundary. */
252
- withWalletSignature(signature: string, options?: {
253
- signal?: AbortSignal;
254
- }): Promise<PreparedTransaction>;
255
- /** Export only after proving when the funding authorization binds an actual proof hash. */
256
- exportFundingAuthorization(options?: {
257
- signal?: AbortSignal;
258
- }): Promise<_invisi_labs_core.SigningRequest>;
259
- /** Verify an external signature against this handle's own frozen operation. */
260
- withFundingSignature(signature: string, options?: {
261
- signal?: AbortSignal;
262
- }): Promise<PreparedTransaction>;
263
- prove(options?: TransactionProveOptions): Promise<PreparedTransaction>;
264
- prove(backend: Prover, options?: TransactionProveOptions): Promise<PreparedTransaction>;
265
- private encode;
266
- /** Shield caller funding needs no wallet signing or proof; this step only encodes its frozen request. */
267
- ready(): Promise<PreparedTransaction>;
268
- exportTransaction(): Promise<TransactionCall>;
269
- exportProof(): ProofBundle;
270
- exportAggregateMember(): OperationAggregateMember;
271
- toJSON(): {
272
- transaction: boolean;
273
- id: string;
274
- kind: "shield" | "transfer" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
275
- status: OperationStatus;
276
- };
277
- }
278
-
279
- interface NoteInput {
280
- note: Note;
281
- commitment: Hex;
282
- treeId: bigint;
283
- leafIndex: number;
284
- }
285
- interface CreditInput {
286
- state: CreditDeliveryState;
287
- commitment: Hex;
288
- treeId: bigint;
289
- leafIndex: number;
290
- role: "owner" | "spender";
291
- }
292
- interface TransactionIdentity {
293
- wallet: PublicWallet & {
294
- getViewer?: never;
295
- getDetector?: never;
296
- exportAuthorization?: never;
297
- };
298
- protocol: Protocol$1;
299
- }
300
- interface ExplicitFunds {
301
- inputs: readonly NoteInput[];
302
- changeAddress?: string;
303
- }
304
- type ExplicitTransferPreparation = TransactionIdentity & TransferPreparation & ExplicitFunds;
305
- type ExplicitShieldPreparation = TransactionIdentity & ShieldPreparation;
306
- type ExplicitCreateCreditPreparation = TransactionIdentity & CreateCreditPreparation & ExplicitFunds;
307
- type ExplicitDrawCreditPreparation = TransactionIdentity & DrawCreditPreparation & {
308
- creditInputs: readonly CreditInput[];
309
- };
310
- type ExplicitTopUpCreditPreparation = TransactionIdentity & TopUpCreditPreparation & ExplicitFunds & {
311
- creditInputs: readonly CreditInput[];
312
- };
313
- type ExplicitCancelCreditPreparation = TransactionIdentity & CancelCreditPreparation & {
314
- creditInputs: readonly CreditInput[];
315
- };
316
15
 
317
16
  interface DisclosureReference {
318
17
  transactionHash: Hex;
@@ -359,378 +58,9 @@ declare class DisclosureVerifier {
359
58
  };
360
59
  }
361
60
 
362
- /** Immutable operation handle. No private plan, witness, or transaction is logged implicitly. */
363
- declare class Operation {
364
- #private;
365
- readonly status: OperationStatus;
366
- private constructor();
367
- static prepare(runtime: OperationRuntime, plan: OperationPlan): Promise<Operation>;
368
- static resume(runtime: OperationRuntime, id: string): Promise<Operation>;
369
- /** Public non-sendable intent for a firm quote before wallet authorization. */
370
- exportBroadcasterIntent(): Promise<{
371
- sendable: false;
372
- data: Hex;
373
- }>;
374
- broadcasterQuote(): SignedBroadcasterQuote | undefined;
375
- withBroadcaster(client: BroadcasterClient, options: WithBroadcasterOptions): Promise<Operation>;
376
- get id(): string;
377
- get kind(): OperationPlan["kind"];
378
- estimateGas(): GasReference;
379
- preview(): {
380
- id: string;
381
- kind: "shield" | "transfer" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
382
- status: OperationStatus;
383
- context: {
384
- tokenAddress: _invisi_labs_core.Address;
385
- now?: bigint;
386
- timestamp?: bigint;
387
- chainId: bigint;
388
- protocolAddress: _invisi_labs_core.Address;
389
- };
390
- inputs: number;
391
- inputDetails: ({
392
- kind: "notes";
393
- commitment: `0x${string}`;
394
- amount: bigint;
395
- owner: `0x${string}`;
396
- treeId: bigint;
397
- leafIndex: number;
398
- } | {
399
- kind: "credits";
400
- commitment: `0x${string}`;
401
- amount: bigint;
402
- owner: `0x${string}`;
403
- spender: `0x${string}`;
404
- expiry: bigint;
405
- role: "owner" | "spender";
406
- treeId: bigint;
407
- leafIndex: number;
408
- })[];
409
- funding: {
410
- payer: `0x${string}`;
411
- amount: bigint;
412
- authorization: "signature" | "none" | "caller";
413
- sigNonce: bigint;
414
- deadline: bigint;
415
- permit: {
416
- deadline: bigint;
417
- };
418
- };
419
- creditOutputs: {
420
- commitment: `0x${string}`;
421
- amount: bigint;
422
- expiry: bigint;
423
- owner: `0x${string}`;
424
- spender: `0x${string}`;
425
- ownerPayout: bigint;
426
- spenderPayout: bigint;
427
- }[] | undefined;
428
- outputs: {
429
- commitment: `0x${string}`;
430
- to: string;
431
- amount: bigint;
432
- change: boolean;
433
- }[];
434
- capacity: number | undefined;
435
- deadline: bigint;
436
- feeRecipient: `0x${string}` | undefined;
437
- feeAmount: bigint;
438
- fundingAmount: bigint;
439
- fundingPayer: `0x${string}` | undefined;
440
- withdrawalAmount: bigint;
441
- withdrawalAddress: `0x${string}` | undefined;
442
- permissions: {
443
- walletAuthorization: boolean;
444
- proof: boolean;
445
- fundingAuthorization: boolean;
446
- };
447
- };
448
- private current;
449
- private stage;
450
- private signingCurrent;
451
- /** Public EIP-712 request; signing transport and key custody belong to the caller. */
452
- exportWalletAuthorization(options?: {
453
- signal?: AbortSignal;
454
- }): Promise<_invisi_labs_core.SigningRequest>;
455
- /** Attach an external EOA signature, retaining its witness only at the private proving boundary. */
456
- withWalletSignature(signature: string, options?: {
457
- signal?: AbortSignal;
458
- }): Promise<Operation>;
459
- /** Export only after proving when the funding authorization binds an actual proof hash. */
460
- exportFundingAuthorization(options?: {
461
- signal?: AbortSignal;
462
- }): Promise<_invisi_labs_core.SigningRequest>;
463
- /** Verify an external signature against this handle's own frozen operation. */
464
- withFundingSignature(signature: string, options?: {
465
- signal?: AbortSignal;
466
- }): Promise<Operation>;
467
- authorize(options?: {
468
- signal?: AbortSignal;
469
- }): Promise<Operation>;
470
- prove(suppliedOptions?: TransactionProveOptions): Promise<Operation>;
471
- private encode;
472
- authorizeFunding(options?: {
473
- signal?: AbortSignal;
474
- }): Promise<Operation>;
475
- /** Shield caller funding needs no wallet signing or proof; this step only encodes its frozen request. */
476
- ready(): Promise<Operation>;
477
- private validateExport;
478
- exportTransaction(options?: {
479
- signal?: AbortSignal;
480
- }): Promise<TransactionCall>;
481
- exportAggregateMember(): Promise<OperationAggregateMember>;
482
- abandon(): Promise<Operation>;
483
- /** Record an application-owned signed/broadcast transaction. This never sends or waits. */
484
- trackTransaction(transactionHash: string): Promise<Operation>;
485
- reconcile(options?: {
486
- transactionHash?: Hex;
487
- signal?: AbortSignal;
488
- }): Promise<Operation>;
489
- toJSON(): {
490
- id: string;
491
- kind: "shield" | "transfer" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
492
- status: OperationStatus;
493
- };
494
- }
495
-
496
- interface DiscoveryContext {
497
- chainId: bigint;
498
- protocolAddress: Address;
499
- }
500
- /** Decoded logs from complete canonical transaction receipts, including insertion logs. */
501
- interface DeliveryEventLog {
502
- address: string;
503
- eventName: string;
504
- args?: Record<string, unknown>;
505
- blockNumber?: bigint | null;
506
- blockHash?: Hex | null;
507
- transactionHash?: Hex | null;
508
- logIndex?: number | null;
509
- removed?: boolean;
510
- }
511
- interface DeliveryCandidate {
512
- tokenAddress: Address;
513
- treeId: bigint;
514
- leafIndex: number;
515
- commitment: Hex;
516
- role: "funds" | "owner" | "spender";
517
- delivery: {
518
- ciphertext: Hex;
519
- clue: Hex;
520
- };
521
- blockNumber: bigint;
522
- blockHash: Hex;
523
- transactionHash: Hex;
524
- }
525
- interface DiscoveredNote extends Omit<DeliveryCandidate, "delivery" | "role"> {
526
- note: Note;
527
- }
528
- interface DiscoveredCredit extends Omit<DeliveryCandidate, "delivery"> {
529
- role: "owner" | "spender";
530
- state: CreditDeliveryState;
531
- }
532
- /** Authenticate private deliveries from a single batch of canonical receipts. */
533
- declare function decryptCandidates(logs: readonly DeliveryEventLog[], options: {
534
- context: DiscoveryContext;
535
- viewing: Pick<ViewingCapability, "ownerAddress" | "decryptNote" | "decryptCredit">;
536
- confirmedThrough: bigint;
537
- }): Promise<{
538
- notes: DiscoveredNote[];
539
- credits: DiscoveredCredit[];
540
- }>;
541
-
542
- interface RefreshResult {
543
- block: CanonicalBlock;
544
- notes: number;
545
- credits: number;
546
- balances: BalanceSnapshot[];
547
- }
548
- interface RefreshOptions {
549
- /** Explicit history range; retain the returned block to request the next page later. */
550
- fromBlock: bigint;
551
- /** Defaults to the Protocol RPC's indexed head, independently checked against Chain RPC. */
552
- toBlock?: bigint;
553
- /** Explicit permission to delegate detection; never provide a viewing or spending key. */
554
- detectionKey?: Uint8Array;
555
- /** Defaults to MAX_UPDATE_BLOCKS (10000 blocks) per service request. Reduce this on high-volume deployments. */
556
- pageSize?: number;
557
- signal?: AbortSignal;
558
- /** Rebuild private inventory from these pages while retaining uncertain operations. */
559
- reset?: boolean;
560
- }
561
-
562
- declare function operationPreview(plan: OperationPlan, status: OperationStatus): {
563
- id: string;
564
- kind: "shield" | "transfer" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
565
- status: OperationStatus;
566
- context: {
567
- tokenAddress: _invisi_labs_core.Address;
568
- now?: bigint;
569
- timestamp?: bigint;
570
- chainId: bigint;
571
- protocolAddress: _invisi_labs_core.Address;
572
- };
573
- inputs: number;
574
- inputDetails: ({
575
- kind: "notes";
576
- commitment: `0x${string}`;
577
- amount: bigint;
578
- owner: `0x${string}`;
579
- treeId: bigint;
580
- leafIndex: number;
581
- } | {
582
- kind: "credits";
583
- commitment: `0x${string}`;
584
- amount: bigint;
585
- owner: `0x${string}`;
586
- spender: `0x${string}`;
587
- expiry: bigint;
588
- role: "owner" | "spender";
589
- treeId: bigint;
590
- leafIndex: number;
591
- })[];
592
- funding: {
593
- payer: `0x${string}`;
594
- amount: bigint;
595
- authorization: "signature" | "none" | "caller";
596
- sigNonce: bigint;
597
- deadline: bigint;
598
- permit: {
599
- deadline: bigint;
600
- };
601
- };
602
- creditOutputs: {
603
- commitment: `0x${string}`;
604
- amount: bigint;
605
- expiry: bigint;
606
- owner: `0x${string}`;
607
- spender: `0x${string}`;
608
- ownerPayout: bigint;
609
- spenderPayout: bigint;
610
- }[] | undefined;
611
- outputs: {
612
- commitment: `0x${string}`;
613
- to: string;
614
- amount: bigint;
615
- change: boolean;
616
- }[];
617
- capacity: number | undefined;
618
- deadline: bigint;
619
- feeRecipient: `0x${string}` | undefined;
620
- feeAmount: bigint;
621
- fundingAmount: bigint;
622
- fundingPayer: `0x${string}` | undefined;
623
- withdrawalAmount: bigint;
624
- withdrawalAddress: `0x${string}` | undefined;
625
- permissions: {
626
- walletAuthorization: boolean;
627
- proof: boolean;
628
- fundingAuthorization: boolean;
629
- };
630
- };
631
-
632
- /** Private application data. Never send this view to public analytics. */
633
- interface OutgoingHistoryEntry extends Omit<ReturnType<typeof operationPreview>, "outputs"> {
634
- preparedAt: {
635
- number: bigint;
636
- hash: Hex;
637
- timestamp: bigint;
638
- };
639
- transactionHash?: Hex;
640
- outputs: {
641
- to: string;
642
- amount: bigint;
643
- change: boolean;
644
- commitment: Hex;
645
- payload: Uint8Array;
646
- }[];
647
- }
648
- interface IncomingHistoryEntry extends ReceiptPosition {
649
- tokenAddress: Hex;
650
- amount: bigint;
651
- payload: Uint8Array;
652
- spent: SpentState;
653
- }
654
- interface WalletHistory {
655
- revision: number;
656
- checkedThrough: Checkpoint | null;
657
- invalidated: boolean;
658
- /** Local construction records; not proof of a mined payment or funding identity. */
659
- outgoing: OutgoingHistoryEntry[];
660
- /** Authenticated incoming funds outputs, including already consumed ones. */
661
- incoming: IncomingHistoryEntry[];
662
- }
663
- interface HistoryOptions {
664
- tokenAddress?: Hex;
665
- }
666
-
667
- /** Native ethers transaction options; the exported business call and session chain remain fixed. */
668
- type SessionTransactionOptions = Omit<TransactionRequest, "to" | "from" | "data" | "value" | "chainId">;
669
- /** Wallet state and operations, with infrastructure and permissions explicitly injected. */
670
- declare class WalletSession {
671
- #private;
672
- readonly scope: WalletScope;
673
- readonly protocol: Protocol$1;
674
- constructor(options: WalletSessionOptions);
675
- sendTransaction(call: TransactionCall, options?: SessionTransactionOptions): Promise<TransactionResponse>;
676
- sendTransaction(operation: Operation, options?: SessionTransactionOptions): Promise<TransactionResponse>;
677
- private runtime;
678
- private updater;
679
- /** Local session commits only. Host applications own cross-tab/store subscriptions. */
680
- subscribe(listener: () => void): () => void;
681
- /** Detached history for wallet UI; construction records do not imply chain success. */
682
- getHistory(options?: HistoryOptions): Promise<WalletHistory>;
683
- balance(tokenAddress: `0x${string}`): Promise<BalanceSnapshot>;
684
- /** Pull explicitly selected indexed pages; no chain scanning or public tree reconstruction. */
685
- refresh(options: RefreshOptions): Promise<RefreshResult>;
686
- private preparation;
687
- prepareTransfer(options: TransferPreparation): Promise<Operation>;
688
- prepareShield(options: ShieldPreparation): Promise<Operation>;
689
- prepareCreateCredit(options: CreateCreditPreparation): Promise<Operation>;
690
- prepareDrawCredit(options: DrawCreditPreparation): Promise<Operation>;
691
- prepareTopUpCredit(options: TopUpCreditPreparation): Promise<Operation>;
692
- prepareCancelCredit(options: CancelCreditPreparation): Promise<Operation>;
693
- resume(operationId: string): Promise<Operation>;
694
- toJSON(): {
695
- walletSession: boolean;
696
- ownerAddress: `0x${string}`;
697
- };
698
- }
699
-
700
- /** Compose independent Chain RPC and indexed Protocol RPC with local wallet capabilities. */
701
- type InvisiInfrastructure = Omit<WalletSessionInfrastructure, "wallet" | "protocol" | "namespace" | "viewing" | "authorization" | "chainReader" | "signer" | "fundingSigner"> & {
702
- provider?: Provider;
703
- chainReader?: ChainReader;
704
- };
705
- type InvisiOptions = InvisiInfrastructure;
706
- /** Public wallet and registry-specific inputs; signing remains external. */
707
- type RegistrationPreparationOptions = Pick<RegistrationPreparation, "update" | "deadline"> & Pick<TransactionIdentity, "wallet">;
708
- /** Owner address and session permissions; shared infrastructure belongs to InvisiOptions. */
709
- type ConnectionOptions = Pick<WalletSessionOptions, "wallet" | "protocol" | "namespace" | "viewing" | "authorization" | "signer" | "fundingSigner">;
710
- /** A neutral composition entry point; every resolved instance owns an independent session. */
711
- declare class Invisi {
712
- #private;
713
- constructor(options?: InvisiOptions);
714
- connect(options: ConnectionOptions): Promise<WalletSession>;
715
- private resolve;
716
- /** Discover the selected chain's registry and prepare an independent signing request. */
717
- prepareRegistration(options: RegistrationPreparationOptions): Promise<RegistrationOperation>;
718
- private assertPublicIdentity;
719
- private resolveExplicit;
720
- prepareTransfer(options: ExplicitTransferPreparation): Promise<PreparedTransaction>;
721
- prepareShield(options: ExplicitShieldPreparation): Promise<PreparedTransaction>;
722
- prepareCreateCredit(options: ExplicitCreateCreditPreparation): Promise<PreparedTransaction>;
723
- prepareDrawCredit(options: ExplicitDrawCreditPreparation): Promise<PreparedTransaction>;
724
- prepareTopUpCredit(options: ExplicitTopUpCreditPreparation): Promise<PreparedTransaction>;
725
- prepareCancelCredit(options: ExplicitCancelCreditPreparation): Promise<PreparedTransaction>;
726
- toJSON(): {
727
- invisi: boolean;
728
- };
729
- }
730
-
731
61
  /** Deployment operations and token-compatible broadcaster discovery. */
732
62
  declare class Protocol extends Protocol$1 {
733
- static fromRpc(rpc: Pick<ProtocolRpcClient$1, "getDeployment"> & Partial<Pick<ProtocolRpcClient$1, "getBroadcasters">>, provider: Provider, options?: {
63
+ static fromRpc(rpc: Pick<ProtocolRpcClient$1, "getDeployment"> & Partial<Pick<ProtocolRpcClient$1, "getBroadcasters" | "withReader">>, provider: Provider, options?: {
734
64
  signal?: AbortSignal;
735
65
  }): Promise<Protocol>;
736
66
  /** Returns enabled services that answer a token fee probe; final quotes are checked by prepared. */
@@ -739,11 +69,6 @@ declare class Protocol extends Protocol$1 {
739
69
  }): Promise<BroadcasterClient[]>;
740
70
  }
741
71
 
742
- /** Protocol RPC transport with ethers provider integration for independent chain checks. */
743
- declare class ProtocolRpcClient extends ProtocolRpcClient$1 {
744
- withProvider(provider: Provider): ProtocolRpcClient$1;
745
- }
746
-
747
72
  /** Registry operations accept the application's existing ethers provider. */
748
73
  declare class AddressRegistry extends AddressRegistry$1 {
749
74
  prepareRegistration(options: RegistrationPreparation | (Omit<RegistrationPreparation, "reader"> & {
@@ -788,27 +113,72 @@ declare class BroadcasterRegistry {
788
113
  }): Promise<RegisteredBroadcaster[]>;
789
114
  }
790
115
 
791
- /** Caller-owned, nonextractable AES-GCM key. The SDK does not persist the key. */
792
- declare class EncryptedWalletCodec implements WalletRecordCodec {
116
+ /** Protocol RPC transport with ethers provider integration for independent chain checks. */
117
+ declare class ProtocolRpcClient extends ProtocolRpcClient$1 {
118
+ withProvider(provider: Provider): ProtocolRpcClient$1;
119
+ }
120
+
121
+ /** Encode only the request, never the current output nonce or local registry lookup choice. */
122
+ declare function encodePaymentRequest(request: PaymentRequest): string;
123
+ /** Decode a canonical Note request offline, with exact resource and byte-layout checks. */
124
+ declare function decodePaymentRequest(encoded: string): PaymentRequest;
125
+
126
+ /** Complete opening of one funds Note. Never contains wallet keys or application payload. */
127
+ interface PaymentNoteData {
128
+ chainId: bigint;
129
+ protocolAddress: Hex;
130
+ tokenAddress: Hex;
131
+ amount: bigint;
132
+ ownerAddress: Hex;
133
+ nonce: bigint;
134
+ commitment: Hex;
135
+ }
136
+
137
+ /** Supply connections for manually constructed Protocols; fromRpc connections are reused. */
138
+ type PaymentNoteVerificationOptions = {
139
+ protocolRpc: Pick<ProtocolRpcClient$1, "withReader">;
140
+ confirmations?: number;
141
+ } & ({
142
+ provider: Provider;
143
+ chainReader?: never;
144
+ } | {
145
+ chainReader: ChainReader;
146
+ provider?: never;
147
+ });
148
+ type PaymentNoteVerificationSettings = {
149
+ confirmations?: number;
150
+ };
151
+
152
+ declare class VerifiedPaymentNote {
793
153
  #private;
154
+ constructor(token: symbol, membership: Membership, checkedAt: CanonicalBlock);
155
+ get membership(): Membership;
156
+ get checkedAt(): CanonicalBlock;
157
+ }
158
+ declare class SpendablePaymentNote extends VerifiedPaymentNote {
159
+ #private;
160
+ constructor(token: symbol, input: NoteInput, membership: Membership, checkedAt: CanonicalBlock, spendabilityCheckedAt: CanonicalBlock);
161
+ get spendabilityCheckedAt(): CanonicalBlock;
162
+ toInput(): NoteInput;
163
+ }
164
+ /** A validated Note opening, independent of an indexed wallet store. */
165
+ declare class PaymentNote implements PaymentNoteData {
166
+ readonly chainId: bigint;
167
+ readonly protocolAddress: PaymentNoteData["protocolAddress"];
168
+ readonly tokenAddress: PaymentNoteData["tokenAddress"];
169
+ readonly amount: bigint;
170
+ readonly ownerAddress: PaymentNoteData["ownerAddress"];
171
+ readonly nonce: bigint;
172
+ readonly commitment: PaymentNoteData["commitment"];
173
+ readonly ipn: string;
794
174
  private constructor();
795
- static fromKey(key: CryptoKey): EncryptedWalletCodec;
796
- static fromBytes(key: Uint8Array): Promise<EncryptedWalletCodec>;
797
- private aad;
798
- encode(state: WalletState, context: {
799
- key: string;
800
- revision: number;
801
- }): Promise<Uint8Array>;
802
- decode(data: Uint8Array, context: {
803
- key: string;
804
- revision: number;
805
- }): Promise<WalletState>;
806
- toJSON(): {
807
- walletRecordCodec: string;
808
- };
175
+ static from(ipn: string): Promise<PaymentNote>;
176
+ verify(protocol: Protocol$1, options?: PaymentNoteVerificationOptions | PaymentNoteVerificationSettings): Promise<VerifiedPaymentNote>;
177
+ verifySpendable(protocol: Protocol$1, wallet: Wallet, options?: PaymentNoteVerificationOptions | PaymentNoteVerificationSettings): Promise<SpendablePaymentNote>;
178
+ private data;
809
179
  }
810
180
 
811
- /** Decode independently fetched canonical receipt bytes, never normalized service events. */
812
- declare function readProtocolLogs(receipt: CanonicalReceipt, protocolAddress: Address): DeliveryEventLog[];
181
+ declare function encodePaymentNote(value: PaymentNoteData): string;
182
+ declare function decodePaymentNote(encoded: string): PaymentNoteData;
813
183
 
814
- export { AddressRegistry, BalanceSnapshot, BroadcasterClient, type BroadcasterConfiguration, type BroadcasterQuote, type BroadcasterRegistration, BroadcasterRegistry, type BroadcasterRegistryOptions, BroadcasterRpcError, type BroadcasterStatus, type BroadcasterTransport, type BroadcasterTrust, CancelCreditPreparation, type ConnectionOptions, CreateCreditPreparation, type CreditInput, type DeliveryEventLog, type DisclosureEvidence, type DisclosureReader, type DisclosureReference, DisclosureVerifier, type DisclosureVerifierOptions, type DiscoveredCredit, type DiscoveredNote, DrawCreditPreparation, EncryptedWalletCodec, type ExplicitCancelCreditPreparation, type ExplicitCreateCreditPreparation, type ExplicitDrawCreditPreparation, type ExplicitShieldPreparation, type ExplicitTopUpCreditPreparation, type ExplicitTransferPreparation, GasReference, type HistoryOptions, type IncomingHistoryEntry, Invisi, InvisiError, type InvisiErrorCode, type InvisiErrorDetails, type InvisiOptions, type NoteInput, Operation, OperationAggregateMember, OperationStatus, type OutgoingHistoryEntry, PreparedTransaction, Protocol, ProtocolRpcClient, type RefreshOptions, type RefreshResult, type RegisteredBroadcaster, type RegistrationPreparationOptions, type SessionTransactionOptions, ShieldPreparation, type SignedBroadcasterQuote, TopUpCreditPreparation, type TransactionIdentity, TransactionProveOptions, TransferPreparation, type VerifiedDisclosure, type WalletHistory, WalletScope, WalletSession, WalletSessionOptions, WalletState, WithBroadcasterOptions, broadcasterQuoteDomain, broadcasterQuoteTypes, broadcasterRequestHash, broadcasterTransactInterface, decodeBroadcasterIntent, decryptCandidates, readProtocolLogs, verifyBroadcasterQuote };
184
+ export { AddressRegistry, BroadcasterClient, type BroadcasterRegistration, BroadcasterRegistry, type BroadcasterRegistryOptions, type DisclosureEvidence, type DisclosureReader, type DisclosureReference, DisclosureVerifier, type DisclosureVerifierOptions, NoteInput, PaymentNote, type PaymentNoteData, type PaymentNoteVerificationOptions, type PaymentNoteVerificationSettings, PaymentRequest, Protocol, ProtocolRpcClient, type RegisteredBroadcaster, SpendablePaymentNote, type VerifiedDisclosure, VerifiedPaymentNote, decodePaymentNote, decodePaymentRequest, encodePaymentNote, encodePaymentRequest };