@invisi-labs/sdk 1.1.5 → 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 (68) hide show
  1. package/dist/broadcaster-preparation-DMxxZ_1Q.d.cts +587 -0
  2. package/dist/broadcaster-preparation-DMxxZ_1Q.d.ts +587 -0
  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-EHP5TBC6.js +3565 -0
  9. package/dist/chunk-EHP5TBC6.js.map +1 -0
  10. package/dist/chunk-GTPUYPQL.js +128 -0
  11. package/dist/chunk-GTPUYPQL.js.map +1 -0
  12. package/dist/chunk-ITTGBIG2.js +1877 -0
  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-4HMM7ZKY.js → chunk-XHKQ2BO2.js} +19 -19
  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 +4 -5
  25. package/dist/ethers.d.ts +4 -5
  26. package/dist/ethers.js +1 -1
  27. package/dist/index.cjs +441 -6217
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +109 -491
  30. package/dist/index.d.ts +109 -491
  31. package/dist/index.js +518 -599
  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/chunk-4HMM7ZKY.js.map +0 -1
  43. package/dist/chunk-BE52B32Z.js +0 -5490
  44. package/dist/chunk-BE52B32Z.js.map +0 -1
  45. package/dist/indexeddb.cjs +0 -5636
  46. package/dist/indexeddb.cjs.map +0 -1
  47. package/dist/indexeddb.d.cts +0 -20
  48. package/dist/indexeddb.d.ts +0 -20
  49. package/dist/indexeddb.js +0 -70
  50. package/dist/indexeddb.js.map +0 -1
  51. package/dist/memory.cjs +0 -5644
  52. package/dist/memory.cjs.map +0 -1
  53. package/dist/memory.d.cts +0 -12
  54. package/dist/memory.d.ts +0 -12
  55. package/dist/memory.js +0 -10
  56. package/dist/operation-types-D7I405FX.d.ts +0 -275
  57. package/dist/operation-types-DIazgS2d.d.cts +0 -275
  58. package/dist/sqlite.cjs +0 -5620
  59. package/dist/sqlite.cjs.map +0 -1
  60. package/dist/sqlite.d.cts +0 -28
  61. package/dist/sqlite.d.ts +0 -28
  62. package/dist/sqlite.js +0 -54
  63. package/dist/sqlite.js.map +0 -1
  64. package/dist/state-AUnz7TG7.d.cts +0 -78
  65. package/dist/state-AUnz7TG7.d.ts +0 -78
  66. package/dist/store-BMN8kd0c.d.ts +0 -42
  67. package/dist/store-Cz75STRl.d.cts +0 -42
  68. /package/dist/{memory.js.map → broadcaster-preparation-RMWQFYNL.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,187 +1,17 @@
1
- import { O as OperationRuntime, a as OperationPlan, 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, W as WalletSessionOptions, f as WalletSessionInfrastructure } from './operation-types-D7I405FX.js';
2
- export { g as CoinSelector, F as FundingAuthorizationVerifier, h as FundingSigner, i as FundingSource, j as FundingTypedData, k as GasBenchmarkCircuit, l as GasBenchmarkDeployment, m as GasBenchmarkProfile, n as GasBenchmarkSample, o as GasBenchmarkShape, P as PaymentOutput, p as TransactionExecution, q as defineGasBenchmarks } from './operation-types-D7I405FX.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
3
  import * as _invisi_labs_protocol from '@invisi-labs/protocol';
7
- import { TransactionCall, Protocol, CanonicalBlock, ChainReader, TokenProtocol, RegistrationPreparation, RegistrationOperation, AddressRegistry as AddressRegistry$1, CanonicalReceipt } from '@invisi-labs/protocol';
8
- export { AddressRegistryOptions, CanonicalBlock, CanonicalReceipt, ChainReader, FactoryReader, Membership, Protocol, ProtocolDataProvider, ProtocolDataStatus, ProtocolOptions, ProtocolUpdateRange, ProtocolUpdates, RegistrationOperation, RegistryContext, RegistryReader, TokenProtocol, TokenProtocolOptions, TransactionCall, TransactionContext } from '@invisi-labs/protocol';
9
- import { Prover, ProofBundle } from '@invisi-labs/prover';
4
+ import { CanonicalBlock, ChainReader, TokenProtocol, Protocol as Protocol$1, AddressRegistry as AddressRegistry$1, RegistrationPreparation, TransactionCall, Membership } from '@invisi-labs/protocol';
5
+ export { AddressRegistryOptions, CanonicalBlock, CanonicalReceipt, ChainReader, FactoryReader, Membership, ProtocolDataProvider, ProtocolDataStatus, ProtocolOptions, ProtocolUpdateRange, ProtocolUpdates, RegistrationOperation, RegistryContext, RegistryReader, TokenProtocol, TokenProtocolOptions, TransactionCall, TransactionContext } from '@invisi-labs/protocol';
10
6
  export { AggregateMember, AggregatorCapability, ProofBundle, ProofStatement, Prover, ProverOptions } from '@invisi-labs/prover';
11
- import { O as OperationStatus, B as BalanceSnapshot, R as ReceiptPosition, S as SpentState, C as Checkpoint, W as WalletScope, a as WalletState } from './state-AUnz7TG7.js';
12
- export { b as WalletStore, w as walletBalance } from './state-AUnz7TG7.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';
13
9
  import { Hex, Address } from '@invisi-labs/protocol/contracts';
14
- import { Provider, TransactionRequest, TransactionResponse } from 'ethers';
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';
15
13
  import { ProtocolRpcClient as ProtocolRpcClient$1 } from '@invisi-labs/rpc';
16
- export { ProtocolCreditTransition, ProtocolDeployment, ProtocolOutput, ProtocolRpcChain, ProtocolRpcClientOptions, ProtocolRpcConnectionOptions, ProtocolRpcError, ProtocolRpcReader, ProtocolTransactionUpdates, RegisteredReceivingAddress } from '@invisi-labs/rpc';
17
- import { W as WalletRecordCodec } from './store-BMN8kd0c.js';
18
-
19
- /** Stable codes returned by public SDK prepare* methods; inspect details instead of matching messages. */
20
- type InvisiErrorCode =
21
- /**
22
- * Other preparation failure, such as invalid amounts, expired deadlines,
23
- * or conflicting registration state. Inspect message and cause.
24
- */
25
- "PREPARATION_FAILED"
26
- /**
27
- * Required infrastructure or permissions were not supplied.
28
- * The capability field identifies what is missing.
29
- */
30
- | "MISSING_CAPABILITY"
31
- /**
32
- * The recipient string is not a valid full 0i address or nonzero EVM owner address.
33
- * No registration lookup is attempted for this invalid string.
34
- */
35
- | "INVALID_RECIPIENT"
36
- /**
37
- * A successful lookup found no receiving keys for this short 0x owner
38
- * at the queried state. Indexed data may lag behind the latest chain state.
39
- * Full 0i addresses contain receiving keys and do not require registration.
40
- */
41
- | "EVM_ADDRESS_NOT_REGISTERED"
42
- /**
43
- * Recipient lookup failed or returned invalid keys. Inspect cause.
44
- * Registration status is unknown; this does not mean the owner is unregistered.
45
- */
46
- | "RECIPIENT_LOOKUP_FAILED";
47
- interface InvisiErrorDetails {
48
- operation?: string;
49
- address?: string;
50
- /** Zero-based index into the caller's outputs array, excluding automatic change. */
51
- outputIndex?: number;
52
- field?: string;
53
- capability?: string;
54
- cause?: unknown;
55
- }
56
- /** Stable application-facing preparation failure with the original cause. */
57
- declare class InvisiError extends Error {
58
- readonly code: InvisiErrorCode;
59
- readonly operation: string | undefined;
60
- readonly address: string | undefined;
61
- readonly outputIndex: number | undefined;
62
- readonly field: string | undefined;
63
- readonly capability: string | undefined;
64
- constructor(code: InvisiErrorCode, message: string, details?: InvisiErrorDetails);
65
- }
66
-
67
- type Runtime = Omit<OperationRuntime, "store" | "authorization">;
68
- /** An immutable, local transaction handle. No wallet inventory, reservations or persistence. */
69
- declare class PreparedTransaction {
70
- #private;
71
- readonly status: OperationStatus;
72
- private constructor();
73
- static prepare(runtime: Runtime, plan: OperationPlan): PreparedTransaction;
74
- get id(): string;
75
- get kind(): "shield" | "create-credit" | "cancel-credit" | "top-up-credit" | "transfer" | "draw-credit";
76
- estimateGas(): GasReference;
77
- preview(): {
78
- id: string;
79
- kind: "shield" | "create-credit" | "cancel-credit" | "top-up-credit" | "transfer" | "draw-credit";
80
- status: OperationStatus;
81
- context: {
82
- tokenAddress: _invisi_labs_core.Address;
83
- now?: bigint;
84
- timestamp?: bigint;
85
- chainId: bigint;
86
- protocolAddress: _invisi_labs_core.Address;
87
- };
88
- inputs: number;
89
- creditOutputs: {
90
- amount: bigint;
91
- expiry: bigint;
92
- owner: `0x${string}`;
93
- spender: `0x${string}`;
94
- ownerPayout: bigint;
95
- spenderPayout: bigint;
96
- }[] | undefined;
97
- outputs: {
98
- to: string;
99
- amount: bigint;
100
- change: boolean;
101
- }[];
102
- capacity: number | undefined;
103
- deadline: bigint;
104
- fundingAmount: bigint;
105
- fundingPayer: `0x${string}` | undefined;
106
- withdrawalAmount: bigint;
107
- withdrawalAddress: `0x${string}` | undefined;
108
- permissions: {
109
- walletAuthorization: boolean;
110
- proof: boolean;
111
- fundingAuthorization: boolean;
112
- };
113
- };
114
- private current;
115
- private stage;
116
- /** Public EIP-712 request; signing transport and key custody belong to the caller. */
117
- exportWalletAuthorization(options?: {
118
- signal?: AbortSignal;
119
- }): Promise<_invisi_labs_core.SigningRequest>;
120
- /** Attach an external EOA signature, retaining its witness only at the private proving boundary. */
121
- withWalletSignature(signature: string, options?: {
122
- signal?: AbortSignal;
123
- }): Promise<PreparedTransaction>;
124
- /** Export only after proving when the funding authorization binds an actual proof hash. */
125
- exportFundingAuthorization(options?: {
126
- signal?: AbortSignal;
127
- }): Promise<_invisi_labs_core.SigningRequest>;
128
- /** Verify an external signature against this handle's own frozen operation. */
129
- withFundingSignature(signature: string, options?: {
130
- signal?: AbortSignal;
131
- }): Promise<PreparedTransaction>;
132
- prove(options?: TransactionProveOptions): Promise<PreparedTransaction>;
133
- prove(backend: Prover, options?: TransactionProveOptions): Promise<PreparedTransaction>;
134
- private encode;
135
- /** Shield caller funding needs no wallet signing or proof; this step only encodes its frozen request. */
136
- ready(): Promise<PreparedTransaction>;
137
- exportTransaction(): Promise<TransactionCall>;
138
- exportProof(): ProofBundle;
139
- exportAggregateMember(): OperationAggregateMember;
140
- toJSON(): {
141
- transaction: boolean;
142
- id: string;
143
- kind: "shield" | "create-credit" | "cancel-credit" | "top-up-credit" | "transfer" | "draw-credit";
144
- status: OperationStatus;
145
- };
146
- }
147
-
148
- interface NoteInput {
149
- note: Note;
150
- commitment: Hex;
151
- treeId: bigint;
152
- leafIndex: number;
153
- }
154
- interface CreditInput {
155
- state: CreditDeliveryState;
156
- commitment: Hex;
157
- treeId: bigint;
158
- leafIndex: number;
159
- role: "owner" | "spender";
160
- }
161
- interface TransactionIdentity {
162
- wallet: PublicWallet & {
163
- getViewer?: never;
164
- getDetector?: never;
165
- exportAuthorization?: never;
166
- };
167
- protocol: Protocol;
168
- }
169
- interface ExplicitFunds {
170
- inputs: readonly NoteInput[];
171
- changeAddress?: string;
172
- }
173
- type ExplicitTransferPreparation = TransactionIdentity & TransferPreparation & ExplicitFunds;
174
- type ExplicitShieldPreparation = TransactionIdentity & ShieldPreparation;
175
- type ExplicitCreateCreditPreparation = TransactionIdentity & CreateCreditPreparation & ExplicitFunds;
176
- type ExplicitDrawCreditPreparation = TransactionIdentity & DrawCreditPreparation & {
177
- creditInputs: readonly CreditInput[];
178
- };
179
- type ExplicitTopUpCreditPreparation = TransactionIdentity & TopUpCreditPreparation & ExplicitFunds & {
180
- creditInputs: readonly CreditInput[];
181
- };
182
- type ExplicitCancelCreditPreparation = TransactionIdentity & CancelCreditPreparation & {
183
- creditInputs: readonly CreditInput[];
184
- };
14
+ export { MAX_UPDATE_BLOCKS, ProtocolCreditTransition, ProtocolDeployment, ProtocolOutput, ProtocolRpcChain, ProtocolRpcClientOptions, ProtocolRpcConnectionOptions, ProtocolRpcError, ProtocolRpcReader, ProtocolTransactionUpdates, RegisteredReceivingAddress } from '@invisi-labs/rpc';
185
15
 
186
16
  interface DisclosureReference {
187
17
  transactionHash: Hex;
@@ -228,339 +58,127 @@ declare class DisclosureVerifier {
228
58
  };
229
59
  }
230
60
 
231
- /** Immutable operation handle. No private plan, witness, or transaction is logged implicitly. */
232
- declare class Operation {
233
- #private;
234
- readonly status: OperationStatus;
235
- private constructor();
236
- static prepare(runtime: OperationRuntime, plan: OperationPlan): Promise<Operation>;
237
- static resume(runtime: OperationRuntime, id: string): Promise<Operation>;
238
- get id(): string;
239
- get kind(): OperationPlan["kind"];
240
- estimateGas(): GasReference;
241
- preview(): {
242
- id: string;
243
- kind: "shield" | "create-credit" | "cancel-credit" | "top-up-credit" | "transfer" | "draw-credit";
244
- status: OperationStatus;
245
- context: {
246
- tokenAddress: _invisi_labs_core.Address;
247
- now?: bigint;
248
- timestamp?: bigint;
249
- chainId: bigint;
250
- protocolAddress: _invisi_labs_core.Address;
251
- };
252
- inputs: number;
253
- creditOutputs: {
254
- amount: bigint;
255
- expiry: bigint;
256
- owner: `0x${string}`;
257
- spender: `0x${string}`;
258
- ownerPayout: bigint;
259
- spenderPayout: bigint;
260
- }[] | undefined;
261
- outputs: {
262
- to: string;
263
- amount: bigint;
264
- change: boolean;
265
- }[];
266
- capacity: number | undefined;
267
- deadline: bigint;
268
- fundingAmount: bigint;
269
- fundingPayer: `0x${string}` | undefined;
270
- withdrawalAmount: bigint;
271
- withdrawalAddress: `0x${string}` | undefined;
272
- permissions: {
273
- walletAuthorization: boolean;
274
- proof: boolean;
275
- fundingAuthorization: boolean;
276
- };
277
- };
278
- private current;
279
- private stage;
280
- private signingCurrent;
281
- /** Public EIP-712 request; signing transport and key custody belong to the caller. */
282
- exportWalletAuthorization(options?: {
283
- signal?: AbortSignal;
284
- }): Promise<_invisi_labs_core.SigningRequest>;
285
- /** Attach an external EOA signature, retaining its witness only at the private proving boundary. */
286
- withWalletSignature(signature: string, options?: {
287
- signal?: AbortSignal;
288
- }): Promise<Operation>;
289
- /** Export only after proving when the funding authorization binds an actual proof hash. */
290
- exportFundingAuthorization(options?: {
61
+ /** Deployment operations and token-compatible broadcaster discovery. */
62
+ declare class Protocol extends Protocol$1 {
63
+ static fromRpc(rpc: Pick<ProtocolRpcClient$1, "getDeployment"> & Partial<Pick<ProtocolRpcClient$1, "getBroadcasters" | "withReader">>, provider: Provider, options?: {
291
64
  signal?: AbortSignal;
292
- }): Promise<_invisi_labs_core.SigningRequest>;
293
- /** Verify an external signature against this handle's own frozen operation. */
294
- withFundingSignature(signature: string, options?: {
295
- signal?: AbortSignal;
296
- }): Promise<Operation>;
297
- authorize(options?: {
298
- signal?: AbortSignal;
299
- }): Promise<Operation>;
300
- prove(suppliedOptions?: TransactionProveOptions): Promise<Operation>;
301
- private encode;
302
- authorizeFunding(options?: {
303
- signal?: AbortSignal;
304
- }): Promise<Operation>;
305
- /** Shield caller funding needs no wallet signing or proof; this step only encodes its frozen request. */
306
- ready(): Promise<Operation>;
307
- private validateExport;
308
- exportTransaction(options?: {
309
- signal?: AbortSignal;
310
- }): Promise<TransactionCall>;
311
- exportAggregateMember(): Promise<OperationAggregateMember>;
312
- abandon(): Promise<Operation>;
313
- /** Record an application-owned signed/broadcast transaction. This never sends or waits. */
314
- trackTransaction(transactionHash: string): Promise<Operation>;
315
- reconcile(options?: {
316
- transactionHash?: Hex;
317
- signal?: AbortSignal;
318
- }): Promise<Operation>;
319
- toJSON(): {
320
- id: string;
321
- kind: "shield" | "create-credit" | "cancel-credit" | "top-up-credit" | "transfer" | "draw-credit";
322
- status: OperationStatus;
323
- };
65
+ }): Promise<Protocol>;
66
+ /** Returns enabled services that answer a token fee probe; final quotes are checked by prepared. */
67
+ getBroadcasters(options: {
68
+ tokenAddress: string;
69
+ }): Promise<BroadcasterClient[]>;
324
70
  }
325
71
 
326
- interface DiscoveryContext {
327
- chainId: bigint;
328
- protocolAddress: Address;
72
+ /** Registry operations accept the application's existing ethers provider. */
73
+ declare class AddressRegistry extends AddressRegistry$1 {
74
+ prepareRegistration(options: RegistrationPreparation | (Omit<RegistrationPreparation, "reader"> & {
75
+ provider: Provider;
76
+ })): Promise<_invisi_labs_protocol.RegistrationOperation>;
329
77
  }
330
- /** Decoded logs from complete canonical transaction receipts, including insertion logs. */
331
- interface DeliveryEventLog {
332
- address: string;
333
- eventName: string;
334
- args?: Record<string, unknown>;
335
- blockNumber?: bigint | null;
336
- blockHash?: Hex | null;
337
- transactionHash?: Hex | null;
338
- logIndex?: number | null;
339
- removed?: boolean;
78
+
79
+ interface BroadcasterRegistration {
80
+ endpoint: string;
81
+ metadataURI?: string;
82
+ quoteSigner: Address;
83
+ feeRecipient: Address;
340
84
  }
341
- interface DeliveryCandidate {
342
- tokenAddress: Address;
343
- treeId: bigint;
344
- leafIndex: number;
345
- commitment: Hex;
346
- role: "funds" | "owner" | "spender";
347
- delivery: {
348
- ciphertext: Hex;
349
- clue: Hex;
350
- };
351
- blockNumber: bigint;
352
- blockHash: Hex;
353
- transactionHash: Hex;
85
+ interface RegisteredBroadcaster extends Required<BroadcasterRegistration> {
86
+ operator: Address;
87
+ enabled: boolean;
354
88
  }
355
- interface DiscoveredNote extends Omit<DeliveryCandidate, "delivery" | "role"> {
356
- note: Note;
89
+ interface BroadcasterRegistryOptions {
90
+ provider: Provider;
91
+ address: Address;
92
+ chainId: bigint;
93
+ fromBlock: number;
94
+ runtimeCodeHash: string;
95
+ /** Maximum blocks per getLogs request. Defaults to 2,000. */
96
+ blockRange?: number;
357
97
  }
358
- interface DiscoveredCredit extends Omit<DeliveryCandidate, "delivery"> {
359
- role: "owner" | "spender";
360
- state: CreditDeliveryState;
98
+ /** Optional on-chain discovery. Registry entries do not authorize spending or endorse operators. */
99
+ declare class BroadcasterRegistry {
100
+ #private;
101
+ readonly address: Address;
102
+ constructor(options: BroadcasterRegistryOptions);
103
+ prepareRegistration(registration: BroadcasterRegistration): TransactionCall;
104
+ prepareAvailability(enabled: boolean): TransactionCall;
105
+ private call;
106
+ private validate;
107
+ get(operator: Address): Promise<RegisteredBroadcaster>;
108
+ private read;
109
+ /** Discover event operators, then read their latest entry; disabled services remain explicit. */
110
+ discover(options?: {
111
+ toBlock?: number;
112
+ signal?: AbortSignal;
113
+ }): Promise<RegisteredBroadcaster[]>;
361
114
  }
362
- /** Authenticate private deliveries from a single batch of canonical receipts. */
363
- declare function decryptCandidates(logs: readonly DeliveryEventLog[], options: {
364
- context: DiscoveryContext;
365
- viewing: Pick<ViewingCapability, "walletIdentity" | "decryptNote" | "decryptCredit">;
366
- confirmedThrough: bigint;
367
- }): Promise<{
368
- notes: DiscoveredNote[];
369
- credits: DiscoveredCredit[];
370
- }>;
371
115
 
372
- interface RefreshResult {
373
- block: CanonicalBlock;
374
- notes: number;
375
- credits: number;
376
- balances: BalanceSnapshot[];
377
- }
378
- interface RefreshOptions {
379
- /** Explicit history range; retain the returned block to request the next page later. */
380
- fromBlock: bigint;
381
- /** Defaults to the Protocol RPC's indexed head, independently checked against Chain RPC. */
382
- toBlock?: bigint;
383
- /** Explicit permission to delegate detection; never provide a viewing or spending key. */
384
- detectionKey?: Uint8Array;
385
- /** At most 100 blocks per service request. Reduce this on high-volume deployments. */
386
- pageSize?: number;
387
- signal?: AbortSignal;
388
- /** Rebuild private inventory from these pages while retaining uncertain operations. */
389
- reset?: boolean;
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;
390
119
  }
391
120
 
392
- declare function operationPreview(plan: OperationPlan, status: OperationStatus): {
393
- id: string;
394
- kind: "shield" | "create-credit" | "cancel-credit" | "top-up-credit" | "transfer" | "draw-credit";
395
- status: OperationStatus;
396
- context: {
397
- tokenAddress: _invisi_labs_core.Address;
398
- now?: bigint;
399
- timestamp?: bigint;
400
- chainId: bigint;
401
- protocolAddress: _invisi_labs_core.Address;
402
- };
403
- inputs: number;
404
- creditOutputs: {
405
- amount: bigint;
406
- expiry: bigint;
407
- owner: `0x${string}`;
408
- spender: `0x${string}`;
409
- ownerPayout: bigint;
410
- spenderPayout: bigint;
411
- }[] | undefined;
412
- outputs: {
413
- to: string;
414
- amount: bigint;
415
- change: boolean;
416
- }[];
417
- capacity: number | undefined;
418
- deadline: bigint;
419
- fundingAmount: bigint;
420
- fundingPayer: `0x${string}` | undefined;
421
- withdrawalAmount: bigint;
422
- withdrawalAddress: `0x${string}` | undefined;
423
- permissions: {
424
- walletAuthorization: boolean;
425
- proof: boolean;
426
- fundingAuthorization: boolean;
427
- };
428
- };
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;
429
125
 
430
- /** Private application data. Never send this view to public analytics. */
431
- interface OutgoingHistoryEntry extends Omit<ReturnType<typeof operationPreview>, "outputs"> {
432
- preparedAt: {
433
- number: bigint;
434
- hash: Hex;
435
- timestamp: bigint;
436
- };
437
- transactionHash?: Hex;
438
- outputs: {
439
- to: string;
440
- amount: bigint;
441
- change: boolean;
442
- commitment: Hex;
443
- payload: Uint8Array;
444
- }[];
445
- }
446
- interface IncomingHistoryEntry extends ReceiptPosition {
126
+ /** Complete opening of one funds Note. Never contains wallet keys or application payload. */
127
+ interface PaymentNoteData {
128
+ chainId: bigint;
129
+ protocolAddress: Hex;
447
130
  tokenAddress: Hex;
448
131
  amount: bigint;
449
- payload: Uint8Array;
450
- spent: SpentState;
451
- }
452
- interface WalletHistory {
453
- revision: number;
454
- checkedThrough: Checkpoint | null;
455
- invalidated: boolean;
456
- /** Local construction records; not proof of a mined payment or funding identity. */
457
- outgoing: OutgoingHistoryEntry[];
458
- /** Authenticated incoming funds outputs, including already consumed ones. */
459
- incoming: IncomingHistoryEntry[];
460
- }
461
- interface HistoryOptions {
462
- tokenAddress?: Hex;
463
- }
464
-
465
- /** Native ethers transaction options; the exported business call and session chain remain fixed. */
466
- type SessionTransactionOptions = Omit<TransactionRequest, "to" | "from" | "data" | "value" | "chainId">;
467
- /** Wallet state and operations, with infrastructure and permissions explicitly injected. */
468
- declare class WalletSession {
469
- #private;
470
- readonly scope: WalletScope;
471
- readonly protocol: Protocol;
472
- constructor(options: WalletSessionOptions);
473
- sendTransaction(call: TransactionCall, options?: SessionTransactionOptions): Promise<TransactionResponse>;
474
- sendTransaction(operation: Operation, options?: SessionTransactionOptions): Promise<TransactionResponse>;
475
- private runtime;
476
- private updater;
477
- /** Local session commits only. Host applications own cross-tab/store subscriptions. */
478
- subscribe(listener: () => void): () => void;
479
- /** Detached history for wallet UI; construction records do not imply chain success. */
480
- getHistory(options?: HistoryOptions): Promise<WalletHistory>;
481
- balance(tokenAddress: `0x${string}`): Promise<BalanceSnapshot>;
482
- /** Pull explicitly selected indexed pages; no chain scanning or public tree reconstruction. */
483
- refresh(options: RefreshOptions): Promise<RefreshResult>;
484
- private preparation;
485
- prepareTransfer(options: TransferPreparation): Promise<Operation>;
486
- prepareShield(options: ShieldPreparation): Promise<Operation>;
487
- prepareCreateCredit(options: CreateCreditPreparation): Promise<Operation>;
488
- prepareDrawCredit(options: DrawCreditPreparation): Promise<Operation>;
489
- prepareTopUpCredit(options: TopUpCreditPreparation): Promise<Operation>;
490
- prepareCancelCredit(options: CancelCreditPreparation): Promise<Operation>;
491
- resume(operationId: string): Promise<Operation>;
492
- toJSON(): {
493
- walletSession: boolean;
494
- walletIdentity: `0x${string}`;
495
- };
132
+ ownerAddress: Hex;
133
+ nonce: bigint;
134
+ commitment: Hex;
496
135
  }
497
136
 
498
- /** Compose independent Chain RPC and indexed Protocol RPC with local wallet capabilities. */
499
- type InvisiInfrastructure = Omit<WalletSessionInfrastructure, "wallet" | "protocol" | "namespace" | "viewing" | "authorization" | "chainReader" | "signer" | "fundingSigner"> & {
500
- /** Recipient discovery source; defaults to protocol-rpc. An explicit addressResolver takes precedence. */
501
- addressLookup?: "chain" | "protocol-rpc";
502
- provider?: Provider;
503
- chainReader?: ChainReader;
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;
504
150
  };
505
- type InvisiOptions = InvisiInfrastructure;
506
- /** Public wallet and registry-specific inputs; signing remains external. */
507
- type RegistrationPreparationOptions = Pick<RegistrationPreparation, "update" | "deadline"> & Pick<TransactionIdentity, "wallet">;
508
- /** Wallet identity and session permissions; shared infrastructure belongs to InvisiOptions. */
509
- type ConnectionOptions = Pick<WalletSessionOptions, "wallet" | "protocol" | "namespace" | "viewing" | "authorization" | "signer" | "fundingSigner">;
510
- /** A neutral composition entry point; every resolved instance owns an independent session. */
511
- declare class Invisi {
512
- #private;
513
- constructor(options?: InvisiOptions);
514
- connect(options: ConnectionOptions): Promise<WalletSession>;
515
- private resolve;
516
- /** Discover the selected chain's registry and prepare an independent signing request. */
517
- prepareRegistration(options: RegistrationPreparationOptions): Promise<RegistrationOperation>;
518
- private assertPublicIdentity;
519
- private resolveExplicit;
520
- prepareTransfer(options: ExplicitTransferPreparation): Promise<PreparedTransaction>;
521
- prepareShield(options: ExplicitShieldPreparation): Promise<PreparedTransaction>;
522
- prepareCreateCredit(options: ExplicitCreateCreditPreparation): Promise<PreparedTransaction>;
523
- prepareDrawCredit(options: ExplicitDrawCreditPreparation): Promise<PreparedTransaction>;
524
- prepareTopUpCredit(options: ExplicitTopUpCreditPreparation): Promise<PreparedTransaction>;
525
- prepareCancelCredit(options: ExplicitCancelCreditPreparation): Promise<PreparedTransaction>;
526
- toJSON(): {
527
- invisi: boolean;
528
- };
529
- }
530
151
 
531
- /** Protocol RPC transport with ethers provider integration for independent chain checks. */
532
- declare class ProtocolRpcClient extends ProtocolRpcClient$1 {
533
- withProvider(provider: Provider): ProtocolRpcClient$1;
534
- }
535
-
536
- /** Registry operations accept the application's existing ethers provider. */
537
- declare class AddressRegistry extends AddressRegistry$1 {
538
- prepareRegistration(options: RegistrationPreparation | (Omit<RegistrationPreparation, "reader"> & {
539
- provider: Provider;
540
- })): Promise<_invisi_labs_protocol.RegistrationOperation>;
152
+ declare class VerifiedPaymentNote {
153
+ #private;
154
+ constructor(token: symbol, membership: Membership, checkedAt: CanonicalBlock);
155
+ get membership(): Membership;
156
+ get checkedAt(): CanonicalBlock;
541
157
  }
542
-
543
- /** Caller-owned, nonextractable AES-GCM key. The SDK does not persist the key. */
544
- declare class EncryptedWalletCodec implements WalletRecordCodec {
158
+ declare class SpendablePaymentNote extends VerifiedPaymentNote {
545
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;
546
174
  private constructor();
547
- static fromKey(key: CryptoKey): EncryptedWalletCodec;
548
- static fromBytes(key: Uint8Array): Promise<EncryptedWalletCodec>;
549
- private aad;
550
- encode(state: WalletState, context: {
551
- key: string;
552
- revision: number;
553
- }): Promise<Uint8Array>;
554
- decode(data: Uint8Array, context: {
555
- key: string;
556
- revision: number;
557
- }): Promise<WalletState>;
558
- toJSON(): {
559
- walletRecordCodec: string;
560
- };
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;
561
179
  }
562
180
 
563
- /** Decode independently fetched canonical receipt bytes, never normalized service events. */
564
- declare function readProtocolLogs(receipt: CanonicalReceipt, protocolAddress: Address): DeliveryEventLog[];
181
+ declare function encodePaymentNote(value: PaymentNoteData): string;
182
+ declare function decodePaymentNote(encoded: string): PaymentNoteData;
565
183
 
566
- export { AddressRegistry, BalanceSnapshot, 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, ProtocolRpcClient, type RefreshOptions, type RefreshResult, type RegistrationPreparationOptions, type SessionTransactionOptions, ShieldPreparation, TopUpCreditPreparation, type TransactionIdentity, TransactionProveOptions, TransferPreparation, type VerifiedDisclosure, type WalletHistory, WalletScope, WalletSession, WalletSessionOptions, WalletState, decryptCandidates, readProtocolLogs };
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 };