@invisi-labs/sdk 1.1.3 → 1.1.5
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.
- package/dist/{chunk-FSQYZO66.js → chunk-BE52B32Z.js} +608 -196
- package/dist/chunk-BE52B32Z.js.map +1 -0
- package/dist/ethers.d.cts +2 -2
- package/dist/ethers.d.ts +2 -2
- package/dist/index.cjs +910 -421
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +240 -39
- package/dist/index.d.ts +240 -39
- package/dist/index.js +247 -131
- package/dist/index.js.map +1 -1
- package/dist/indexeddb.cjs +645 -242
- package/dist/indexeddb.cjs.map +1 -1
- package/dist/indexeddb.d.cts +2 -2
- package/dist/indexeddb.d.ts +2 -2
- package/dist/indexeddb.js +1 -1
- package/dist/memory.cjs +645 -242
- package/dist/memory.cjs.map +1 -1
- package/dist/memory.d.cts +3 -3
- package/dist/memory.d.ts +3 -3
- package/dist/memory.js +1 -1
- package/dist/{gas-estimation-BU3or4AH.d.ts → operation-types-D7I405FX.d.ts} +122 -118
- package/dist/{gas-estimation-C1OEgFFJ.d.cts → operation-types-DIazgS2d.d.cts} +122 -118
- package/dist/sqlite.cjs +645 -242
- package/dist/sqlite.cjs.map +1 -1
- package/dist/sqlite.d.cts +2 -2
- package/dist/sqlite.d.ts +2 -2
- package/dist/sqlite.js +1 -1
- package/dist/{state-DHl6j33x.d.cts → state-AUnz7TG7.d.cts} +3 -1
- package/dist/{state-DHl6j33x.d.ts → state-AUnz7TG7.d.ts} +3 -1
- package/dist/{store-Dlol1q1s.d.ts → store-BMN8kd0c.d.ts} +1 -1
- package/dist/{store-1zgwa--h.d.cts → store-Cz75STRl.d.cts} +1 -1
- package/package.json +5 -5
- package/dist/chunk-FSQYZO66.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,70 @@
|
|
|
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';
|
|
1
3
|
import * as _invisi_labs_core from '@invisi-labs/core';
|
|
2
|
-
import {
|
|
3
|
-
export { Address, CreditDeliveryState, CreditNote, CreditOpening, CreditPolicy, Detector, Disclosure, DisclosureExport, DisclosureOutput, DisclosureResult, Hex, MAX_MEMO_BYTES, Memo, MissingCapabilityError, Note, NullifierCapability, ReceivingKeys, ViewingCapability, Wallet, WalletAuthorization, WalletAuthorizationProvider, decodeMemoText, encodeMemo } from '@invisi-labs/core';
|
|
4
|
-
import { O as OperationRuntime, a as OperationPlan, G as GasReference, F as FundingSigner, b as OperationAggregateMember, C as CancelCreditPreparation, c as CreateCreditPreparation, D as DrawCreditPreparation, S as ShieldPreparation, d as SweepPreparation, T as TopUpCreditPreparation, e as TransferPreparation, W as WithdrawalPreparation, f as WalletSessionOptions } from './gas-estimation-BU3or4AH.js';
|
|
5
|
-
export { g as CoinSelector, h as FundingAuthorizationVerifier, i as FundingSource, j as FundingTypedData, k as GasBenchmarkCircuit, l as GasBenchmarkDeployment, m as GasBenchmarkProfile, n as GasBenchmarkSample, o as GasBenchmarkShape, p as defineGasBenchmarks } from './gas-estimation-BU3or4AH.js';
|
|
4
|
+
import { CreditDeliveryState, PublicWallet, Note, DisclosureOutput, Disclosure, DisclosureResult, ViewingCapability } from '@invisi-labs/core';
|
|
5
|
+
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
6
|
import * as _invisi_labs_protocol from '@invisi-labs/protocol';
|
|
7
|
-
import { TransactionCall, Protocol, CanonicalBlock, ChainReader, TokenProtocol, AddressRegistry as AddressRegistry$1,
|
|
7
|
+
import { TransactionCall, Protocol, CanonicalBlock, ChainReader, TokenProtocol, RegistrationPreparation, RegistrationOperation, AddressRegistry as AddressRegistry$1, CanonicalReceipt } from '@invisi-labs/protocol';
|
|
8
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 {
|
|
9
|
+
import { Prover, ProofBundle } from '@invisi-labs/prover';
|
|
10
10
|
export { AggregateMember, AggregatorCapability, ProofBundle, ProofStatement, Prover, ProverOptions } from '@invisi-labs/prover';
|
|
11
|
-
import { O as OperationStatus, B as BalanceSnapshot, W as WalletScope, a as WalletState } from './state-
|
|
12
|
-
export { b as WalletStore, w as walletBalance } from './state-
|
|
13
|
-
import { Hex } from '@invisi-labs/protocol/contracts';
|
|
14
|
-
import { Provider, TransactionRequest, TransactionResponse
|
|
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';
|
|
13
|
+
import { Hex, Address } from '@invisi-labs/protocol/contracts';
|
|
14
|
+
import { Provider, TransactionRequest, TransactionResponse } from 'ethers';
|
|
15
15
|
import { ProtocolRpcClient as ProtocolRpcClient$1 } from '@invisi-labs/rpc';
|
|
16
|
-
export { ProtocolDeployment, ProtocolRpcChain, ProtocolRpcClientOptions, ProtocolRpcConnectionOptions, ProtocolRpcError, ProtocolRpcReader } from '@invisi-labs/rpc';
|
|
17
|
-
import { W as WalletRecordCodec } from './store-
|
|
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
18
|
|
|
19
|
-
|
|
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">;
|
|
20
68
|
/** An immutable, local transaction handle. No wallet inventory, reservations or persistence. */
|
|
21
69
|
declare class PreparedTransaction {
|
|
22
70
|
#private;
|
|
@@ -24,11 +72,11 @@ declare class PreparedTransaction {
|
|
|
24
72
|
private constructor();
|
|
25
73
|
static prepare(runtime: Runtime, plan: OperationPlan): PreparedTransaction;
|
|
26
74
|
get id(): string;
|
|
27
|
-
get kind(): "shield" | "
|
|
75
|
+
get kind(): "shield" | "create-credit" | "cancel-credit" | "top-up-credit" | "transfer" | "draw-credit";
|
|
28
76
|
estimateGas(): GasReference;
|
|
29
77
|
preview(): {
|
|
30
78
|
id: string;
|
|
31
|
-
kind: "shield" | "
|
|
79
|
+
kind: "shield" | "create-credit" | "cancel-credit" | "top-up-credit" | "transfer" | "draw-credit";
|
|
32
80
|
status: OperationStatus;
|
|
33
81
|
context: {
|
|
34
82
|
tokenAddress: _invisi_labs_core.Address;
|
|
@@ -65,21 +113,25 @@ declare class PreparedTransaction {
|
|
|
65
113
|
};
|
|
66
114
|
private current;
|
|
67
115
|
private stage;
|
|
68
|
-
|
|
116
|
+
/** Public EIP-712 request; signing transport and key custody belong to the caller. */
|
|
117
|
+
exportWalletAuthorization(options?: {
|
|
69
118
|
signal?: AbortSignal;
|
|
70
|
-
}): Promise<
|
|
71
|
-
|
|
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?: {
|
|
72
122
|
signal?: AbortSignal;
|
|
73
123
|
}): Promise<PreparedTransaction>;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
private encode;
|
|
77
|
-
authorizeFunding(options?: {
|
|
124
|
+
/** Export only after proving when the funding authorization binds an actual proof hash. */
|
|
125
|
+
exportFundingAuthorization(options?: {
|
|
78
126
|
signal?: AbortSignal;
|
|
79
|
-
}): Promise<
|
|
80
|
-
|
|
127
|
+
}): Promise<_invisi_labs_core.SigningRequest>;
|
|
128
|
+
/** Verify an external signature against this handle's own frozen operation. */
|
|
129
|
+
withFundingSignature(signature: string, options?: {
|
|
81
130
|
signal?: AbortSignal;
|
|
82
131
|
}): Promise<PreparedTransaction>;
|
|
132
|
+
prove(options?: TransactionProveOptions): Promise<PreparedTransaction>;
|
|
133
|
+
prove(backend: Prover, options?: TransactionProveOptions): Promise<PreparedTransaction>;
|
|
134
|
+
private encode;
|
|
83
135
|
/** Shield caller funding needs no wallet signing or proof; this step only encodes its frozen request. */
|
|
84
136
|
ready(): Promise<PreparedTransaction>;
|
|
85
137
|
exportTransaction(): Promise<TransactionCall>;
|
|
@@ -88,7 +140,7 @@ declare class PreparedTransaction {
|
|
|
88
140
|
toJSON(): {
|
|
89
141
|
transaction: boolean;
|
|
90
142
|
id: string;
|
|
91
|
-
kind: "shield" | "
|
|
143
|
+
kind: "shield" | "create-credit" | "cancel-credit" | "top-up-credit" | "transfer" | "draw-credit";
|
|
92
144
|
status: OperationStatus;
|
|
93
145
|
};
|
|
94
146
|
}
|
|
@@ -107,7 +159,11 @@ interface CreditInput {
|
|
|
107
159
|
role: "owner" | "spender";
|
|
108
160
|
}
|
|
109
161
|
interface TransactionIdentity {
|
|
110
|
-
wallet:
|
|
162
|
+
wallet: PublicWallet & {
|
|
163
|
+
getViewer?: never;
|
|
164
|
+
getDetector?: never;
|
|
165
|
+
exportAuthorization?: never;
|
|
166
|
+
};
|
|
111
167
|
protocol: Protocol;
|
|
112
168
|
}
|
|
113
169
|
interface ExplicitFunds {
|
|
@@ -115,8 +171,6 @@ interface ExplicitFunds {
|
|
|
115
171
|
changeAddress?: string;
|
|
116
172
|
}
|
|
117
173
|
type ExplicitTransferPreparation = TransactionIdentity & TransferPreparation & ExplicitFunds;
|
|
118
|
-
type ExplicitWithdrawalPreparation = TransactionIdentity & WithdrawalPreparation & ExplicitFunds;
|
|
119
|
-
type ExplicitSweepPreparation = TransactionIdentity & SweepPreparation & ExplicitFunds;
|
|
120
174
|
type ExplicitShieldPreparation = TransactionIdentity & ShieldPreparation;
|
|
121
175
|
type ExplicitCreateCreditPreparation = TransactionIdentity & CreateCreditPreparation & ExplicitFunds;
|
|
122
176
|
type ExplicitDrawCreditPreparation = TransactionIdentity & DrawCreditPreparation & {
|
|
@@ -186,7 +240,7 @@ declare class Operation {
|
|
|
186
240
|
estimateGas(): GasReference;
|
|
187
241
|
preview(): {
|
|
188
242
|
id: string;
|
|
189
|
-
kind: "shield" | "
|
|
243
|
+
kind: "shield" | "create-credit" | "cancel-credit" | "top-up-credit" | "transfer" | "draw-credit";
|
|
190
244
|
status: OperationStatus;
|
|
191
245
|
context: {
|
|
192
246
|
tokenAddress: _invisi_labs_core.Address;
|
|
@@ -223,10 +277,27 @@ declare class Operation {
|
|
|
223
277
|
};
|
|
224
278
|
private current;
|
|
225
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?: {
|
|
291
|
+
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>;
|
|
226
297
|
authorize(options?: {
|
|
227
298
|
signal?: AbortSignal;
|
|
228
299
|
}): Promise<Operation>;
|
|
229
|
-
prove(
|
|
300
|
+
prove(suppliedOptions?: TransactionProveOptions): Promise<Operation>;
|
|
230
301
|
private encode;
|
|
231
302
|
authorizeFunding(options?: {
|
|
232
303
|
signal?: AbortSignal;
|
|
@@ -247,11 +318,57 @@ declare class Operation {
|
|
|
247
318
|
}): Promise<Operation>;
|
|
248
319
|
toJSON(): {
|
|
249
320
|
id: string;
|
|
250
|
-
kind: "shield" | "
|
|
321
|
+
kind: "shield" | "create-credit" | "cancel-credit" | "top-up-credit" | "transfer" | "draw-credit";
|
|
251
322
|
status: OperationStatus;
|
|
252
323
|
};
|
|
253
324
|
}
|
|
254
325
|
|
|
326
|
+
interface DiscoveryContext {
|
|
327
|
+
chainId: bigint;
|
|
328
|
+
protocolAddress: Address;
|
|
329
|
+
}
|
|
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;
|
|
340
|
+
}
|
|
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;
|
|
354
|
+
}
|
|
355
|
+
interface DiscoveredNote extends Omit<DeliveryCandidate, "delivery" | "role"> {
|
|
356
|
+
note: Note;
|
|
357
|
+
}
|
|
358
|
+
interface DiscoveredCredit extends Omit<DeliveryCandidate, "delivery"> {
|
|
359
|
+
role: "owner" | "spender";
|
|
360
|
+
state: CreditDeliveryState;
|
|
361
|
+
}
|
|
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
|
+
|
|
255
372
|
interface RefreshResult {
|
|
256
373
|
block: CanonicalBlock;
|
|
257
374
|
notes: number;
|
|
@@ -272,6 +389,79 @@ interface RefreshOptions {
|
|
|
272
389
|
reset?: boolean;
|
|
273
390
|
}
|
|
274
391
|
|
|
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
|
+
};
|
|
429
|
+
|
|
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 {
|
|
447
|
+
tokenAddress: Hex;
|
|
448
|
+
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
|
+
|
|
275
465
|
/** Native ethers transaction options; the exported business call and session chain remain fixed. */
|
|
276
466
|
type SessionTransactionOptions = Omit<TransactionRequest, "to" | "from" | "data" | "value" | "chainId">;
|
|
277
467
|
/** Wallet state and operations, with infrastructure and permissions explicitly injected. */
|
|
@@ -284,13 +474,15 @@ declare class WalletSession {
|
|
|
284
474
|
sendTransaction(operation: Operation, options?: SessionTransactionOptions): Promise<TransactionResponse>;
|
|
285
475
|
private runtime;
|
|
286
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>;
|
|
287
481
|
balance(tokenAddress: `0x${string}`): Promise<BalanceSnapshot>;
|
|
288
482
|
/** Pull explicitly selected indexed pages; no chain scanning or public tree reconstruction. */
|
|
289
483
|
refresh(options: RefreshOptions): Promise<RefreshResult>;
|
|
290
484
|
private preparation;
|
|
291
485
|
prepareTransfer(options: TransferPreparation): Promise<Operation>;
|
|
292
|
-
prepareWithdraw(options: WithdrawalPreparation): Promise<Operation>;
|
|
293
|
-
prepareSweep(options: SweepPreparation): Promise<Operation>;
|
|
294
486
|
prepareShield(options: ShieldPreparation): Promise<Operation>;
|
|
295
487
|
prepareCreateCredit(options: CreateCreditPreparation): Promise<Operation>;
|
|
296
488
|
prepareDrawCredit(options: DrawCreditPreparation): Promise<Operation>;
|
|
@@ -304,22 +496,28 @@ declare class WalletSession {
|
|
|
304
496
|
}
|
|
305
497
|
|
|
306
498
|
/** Compose independent Chain RPC and indexed Protocol RPC with local wallet capabilities. */
|
|
307
|
-
type
|
|
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";
|
|
308
502
|
provider?: Provider;
|
|
309
|
-
signer?: Signer;
|
|
310
503
|
chainReader?: ChainReader;
|
|
311
504
|
};
|
|
505
|
+
type InvisiOptions = InvisiInfrastructure;
|
|
506
|
+
/** Public wallet and registry-specific inputs; signing remains external. */
|
|
507
|
+
type RegistrationPreparationOptions = Pick<RegistrationPreparation, "update" | "deadline"> & Pick<TransactionIdentity, "wallet">;
|
|
312
508
|
/** Wallet identity and session permissions; shared infrastructure belongs to InvisiOptions. */
|
|
313
|
-
type ConnectionOptions = Pick<WalletSessionOptions, "wallet" | "protocol" | "namespace" | "viewing" | "authorization">;
|
|
509
|
+
type ConnectionOptions = Pick<WalletSessionOptions, "wallet" | "protocol" | "namespace" | "viewing" | "authorization" | "signer" | "fundingSigner">;
|
|
314
510
|
/** A neutral composition entry point; every resolved instance owns an independent session. */
|
|
315
511
|
declare class Invisi {
|
|
316
512
|
#private;
|
|
317
513
|
constructor(options?: InvisiOptions);
|
|
318
514
|
connect(options: ConnectionOptions): Promise<WalletSession>;
|
|
319
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;
|
|
320
520
|
prepareTransfer(options: ExplicitTransferPreparation): Promise<PreparedTransaction>;
|
|
321
|
-
prepareWithdraw(options: ExplicitWithdrawalPreparation): Promise<PreparedTransaction>;
|
|
322
|
-
prepareSweep(options: ExplicitSweepPreparation): Promise<PreparedTransaction>;
|
|
323
521
|
prepareShield(options: ExplicitShieldPreparation): Promise<PreparedTransaction>;
|
|
324
522
|
prepareCreateCredit(options: ExplicitCreateCreditPreparation): Promise<PreparedTransaction>;
|
|
325
523
|
prepareDrawCredit(options: ExplicitDrawCreditPreparation): Promise<PreparedTransaction>;
|
|
@@ -362,4 +560,7 @@ declare class EncryptedWalletCodec implements WalletRecordCodec {
|
|
|
362
560
|
};
|
|
363
561
|
}
|
|
364
562
|
|
|
365
|
-
|
|
563
|
+
/** Decode independently fetched canonical receipt bytes, never normalized service events. */
|
|
564
|
+
declare function readProtocolLogs(receipt: CanonicalReceipt, protocolAddress: Address): DeliveryEventLog[];
|
|
565
|
+
|
|
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 };
|