@invisi-labs/sdk 1.1.5 → 1.1.6
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/{operation-types-DIazgS2d.d.cts → NoteOutput-DRkVnwlx.d.cts} +140 -17
- package/dist/{operation-types-D7I405FX.d.ts → NoteOutput-DpDC6T2O.d.ts} +140 -17
- package/dist/broadcaster-preparation-QVL62KM6.js +128 -0
- package/dist/broadcaster-preparation-QVL62KM6.js.map +1 -0
- package/dist/{chunk-BE52B32Z.js → chunk-4SD3MW6N.js} +846 -1625
- package/dist/chunk-4SD3MW6N.js.map +1 -0
- package/dist/chunk-FL4TIGWW.js +1781 -0
- package/dist/chunk-FL4TIGWW.js.map +1 -0
- package/dist/{chunk-4HMM7ZKY.js → chunk-QC6TQR3R.js} +8 -8
- package/dist/chunk-QC6TQR3R.js.map +1 -0
- package/dist/ethers.cjs +7 -7
- package/dist/ethers.cjs.map +1 -1
- package/dist/ethers.d.cts +3 -3
- package/dist/ethers.d.ts +3 -3
- package/dist/ethers.js +1 -1
- package/dist/index.cjs +4520 -2902
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +273 -25
- package/dist/index.d.ts +273 -25
- package/dist/index.js +459 -52
- package/dist/index.js.map +1 -1
- package/dist/indexeddb.cjs +5812 -4570
- 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 +3 -2
- package/dist/indexeddb.js.map +1 -1
- package/dist/memory.cjs +5868 -4626
- 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 +3 -2
- package/dist/sqlite.cjs +5812 -4570
- 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 +3 -2
- package/dist/sqlite.js.map +1 -1
- package/dist/{state-AUnz7TG7.d.cts → state-C4HZFotm.d.cts} +1 -1
- package/dist/{state-AUnz7TG7.d.ts → state-C4HZFotm.d.ts} +1 -1
- package/dist/{store-BMN8kd0c.d.ts → store-8aBhnbGr.d.ts} +1 -1
- package/dist/{store-Cz75STRl.d.cts → store-YrbXb6CY.d.cts} +1 -1
- package/package.json +5 -5
- package/dist/chunk-4HMM7ZKY.js.map +0 -1
- package/dist/chunk-BE52B32Z.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,20 +1,110 @@
|
|
|
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,
|
|
2
|
-
export {
|
|
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-DRkVnwlx.cjs';
|
|
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-DRkVnwlx.cjs';
|
|
3
3
|
import * as _invisi_labs_core from '@invisi-labs/core';
|
|
4
4
|
import { CreditDeliveryState, PublicWallet, Note, DisclosureOutput, Disclosure, DisclosureResult, ViewingCapability } from '@invisi-labs/core';
|
|
5
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
|
+
import * as ethers from 'ethers';
|
|
7
|
+
import { Interface, Provider, TransactionRequest, TransactionResponse } from 'ethers';
|
|
6
8
|
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,
|
|
9
|
+
import { TransactionCall, Protocol as Protocol$1, CanonicalBlock, ChainReader, TokenProtocol, RegistrationPreparation, RegistrationOperation, AddressRegistry as AddressRegistry$1, CanonicalReceipt } from '@invisi-labs/protocol';
|
|
10
|
+
export { AddressRegistryOptions, CanonicalBlock, CanonicalReceipt, ChainReader, FactoryReader, Membership, ProtocolDataProvider, ProtocolDataStatus, ProtocolOptions, ProtocolUpdateRange, ProtocolUpdates, RegistrationOperation, RegistryContext, RegistryReader, TokenProtocol, TokenProtocolOptions, TransactionCall, TransactionContext } from '@invisi-labs/protocol';
|
|
9
11
|
import { Prover, ProofBundle } from '@invisi-labs/prover';
|
|
10
12
|
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-
|
|
12
|
-
export { b as WalletStore, w as walletBalance } from './state-
|
|
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.cjs';
|
|
14
|
+
export { b as WalletStore, w as walletBalance } from './state-C4HZFotm.cjs';
|
|
13
15
|
import { Hex, Address } from '@invisi-labs/protocol/contracts';
|
|
14
|
-
import { Provider, TransactionRequest, TransactionResponse } from 'ethers';
|
|
15
16
|
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-
|
|
17
|
+
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-YrbXb6CY.cjs';
|
|
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
|
+
}
|
|
18
108
|
|
|
19
109
|
/** Stable codes returned by public SDK prepare* methods; inspect details instead of matching messages. */
|
|
20
110
|
type InvisiErrorCode =
|
|
@@ -64,19 +154,23 @@ declare class InvisiError extends Error {
|
|
|
64
154
|
constructor(code: InvisiErrorCode, message: string, details?: InvisiErrorDetails);
|
|
65
155
|
}
|
|
66
156
|
|
|
67
|
-
type Runtime = Omit<OperationRuntime, "store" | "authorization"
|
|
157
|
+
type Runtime = Omit<OperationRuntime, "store" | "authorization"> & {
|
|
158
|
+
reprepare?: (intent: PreparationIntent) => Promise<OperationPlan>;
|
|
159
|
+
};
|
|
68
160
|
/** An immutable, local transaction handle. No wallet inventory, reservations or persistence. */
|
|
69
161
|
declare class PreparedTransaction {
|
|
70
162
|
#private;
|
|
71
163
|
readonly status: OperationStatus;
|
|
72
164
|
private constructor();
|
|
73
165
|
static prepare(runtime: Runtime, plan: OperationPlan): PreparedTransaction;
|
|
166
|
+
broadcasterQuote(): SignedBroadcasterQuote | undefined;
|
|
167
|
+
withBroadcaster(client: BroadcasterClient, options: WithBroadcasterOptions): Promise<PreparedTransaction>;
|
|
74
168
|
get id(): string;
|
|
75
|
-
get kind(): "shield" | "create-credit" | "
|
|
169
|
+
get kind(): "shield" | "transfer" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
76
170
|
estimateGas(): GasReference;
|
|
77
171
|
preview(): {
|
|
78
172
|
id: string;
|
|
79
|
-
kind: "shield" | "create-credit" | "
|
|
173
|
+
kind: "shield" | "transfer" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
80
174
|
status: OperationStatus;
|
|
81
175
|
context: {
|
|
82
176
|
tokenAddress: _invisi_labs_core.Address;
|
|
@@ -86,7 +180,36 @@ declare class PreparedTransaction {
|
|
|
86
180
|
protocolAddress: _invisi_labs_core.Address;
|
|
87
181
|
};
|
|
88
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
|
+
};
|
|
89
211
|
creditOutputs: {
|
|
212
|
+
commitment: `0x${string}`;
|
|
90
213
|
amount: bigint;
|
|
91
214
|
expiry: bigint;
|
|
92
215
|
owner: `0x${string}`;
|
|
@@ -95,12 +218,15 @@ declare class PreparedTransaction {
|
|
|
95
218
|
spenderPayout: bigint;
|
|
96
219
|
}[] | undefined;
|
|
97
220
|
outputs: {
|
|
221
|
+
commitment: `0x${string}`;
|
|
98
222
|
to: string;
|
|
99
223
|
amount: bigint;
|
|
100
224
|
change: boolean;
|
|
101
225
|
}[];
|
|
102
226
|
capacity: number | undefined;
|
|
103
227
|
deadline: bigint;
|
|
228
|
+
feeRecipient: `0x${string}` | undefined;
|
|
229
|
+
feeAmount: bigint;
|
|
104
230
|
fundingAmount: bigint;
|
|
105
231
|
fundingPayer: `0x${string}` | undefined;
|
|
106
232
|
withdrawalAmount: bigint;
|
|
@@ -111,6 +237,11 @@ declare class PreparedTransaction {
|
|
|
111
237
|
fundingAuthorization: boolean;
|
|
112
238
|
};
|
|
113
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
|
+
}>;
|
|
114
245
|
private current;
|
|
115
246
|
private stage;
|
|
116
247
|
/** Public EIP-712 request; signing transport and key custody belong to the caller. */
|
|
@@ -140,7 +271,7 @@ declare class PreparedTransaction {
|
|
|
140
271
|
toJSON(): {
|
|
141
272
|
transaction: boolean;
|
|
142
273
|
id: string;
|
|
143
|
-
kind: "shield" | "create-credit" | "
|
|
274
|
+
kind: "shield" | "transfer" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
144
275
|
status: OperationStatus;
|
|
145
276
|
};
|
|
146
277
|
}
|
|
@@ -164,7 +295,7 @@ interface TransactionIdentity {
|
|
|
164
295
|
getDetector?: never;
|
|
165
296
|
exportAuthorization?: never;
|
|
166
297
|
};
|
|
167
|
-
protocol: Protocol;
|
|
298
|
+
protocol: Protocol$1;
|
|
168
299
|
}
|
|
169
300
|
interface ExplicitFunds {
|
|
170
301
|
inputs: readonly NoteInput[];
|
|
@@ -235,12 +366,19 @@ declare class Operation {
|
|
|
235
366
|
private constructor();
|
|
236
367
|
static prepare(runtime: OperationRuntime, plan: OperationPlan): Promise<Operation>;
|
|
237
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>;
|
|
238
376
|
get id(): string;
|
|
239
377
|
get kind(): OperationPlan["kind"];
|
|
240
378
|
estimateGas(): GasReference;
|
|
241
379
|
preview(): {
|
|
242
380
|
id: string;
|
|
243
|
-
kind: "shield" | "create-credit" | "
|
|
381
|
+
kind: "shield" | "transfer" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
244
382
|
status: OperationStatus;
|
|
245
383
|
context: {
|
|
246
384
|
tokenAddress: _invisi_labs_core.Address;
|
|
@@ -250,7 +388,36 @@ declare class Operation {
|
|
|
250
388
|
protocolAddress: _invisi_labs_core.Address;
|
|
251
389
|
};
|
|
252
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
|
+
};
|
|
253
419
|
creditOutputs: {
|
|
420
|
+
commitment: `0x${string}`;
|
|
254
421
|
amount: bigint;
|
|
255
422
|
expiry: bigint;
|
|
256
423
|
owner: `0x${string}`;
|
|
@@ -259,12 +426,15 @@ declare class Operation {
|
|
|
259
426
|
spenderPayout: bigint;
|
|
260
427
|
}[] | undefined;
|
|
261
428
|
outputs: {
|
|
429
|
+
commitment: `0x${string}`;
|
|
262
430
|
to: string;
|
|
263
431
|
amount: bigint;
|
|
264
432
|
change: boolean;
|
|
265
433
|
}[];
|
|
266
434
|
capacity: number | undefined;
|
|
267
435
|
deadline: bigint;
|
|
436
|
+
feeRecipient: `0x${string}` | undefined;
|
|
437
|
+
feeAmount: bigint;
|
|
268
438
|
fundingAmount: bigint;
|
|
269
439
|
fundingPayer: `0x${string}` | undefined;
|
|
270
440
|
withdrawalAmount: bigint;
|
|
@@ -318,7 +488,7 @@ declare class Operation {
|
|
|
318
488
|
}): Promise<Operation>;
|
|
319
489
|
toJSON(): {
|
|
320
490
|
id: string;
|
|
321
|
-
kind: "shield" | "create-credit" | "
|
|
491
|
+
kind: "shield" | "transfer" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
322
492
|
status: OperationStatus;
|
|
323
493
|
};
|
|
324
494
|
}
|
|
@@ -362,7 +532,7 @@ interface DiscoveredCredit extends Omit<DeliveryCandidate, "delivery"> {
|
|
|
362
532
|
/** Authenticate private deliveries from a single batch of canonical receipts. */
|
|
363
533
|
declare function decryptCandidates(logs: readonly DeliveryEventLog[], options: {
|
|
364
534
|
context: DiscoveryContext;
|
|
365
|
-
viewing: Pick<ViewingCapability, "
|
|
535
|
+
viewing: Pick<ViewingCapability, "ownerAddress" | "decryptNote" | "decryptCredit">;
|
|
366
536
|
confirmedThrough: bigint;
|
|
367
537
|
}): Promise<{
|
|
368
538
|
notes: DiscoveredNote[];
|
|
@@ -382,7 +552,7 @@ interface RefreshOptions {
|
|
|
382
552
|
toBlock?: bigint;
|
|
383
553
|
/** Explicit permission to delegate detection; never provide a viewing or spending key. */
|
|
384
554
|
detectionKey?: Uint8Array;
|
|
385
|
-
/**
|
|
555
|
+
/** Defaults to MAX_UPDATE_BLOCKS (10000 blocks) per service request. Reduce this on high-volume deployments. */
|
|
386
556
|
pageSize?: number;
|
|
387
557
|
signal?: AbortSignal;
|
|
388
558
|
/** Rebuild private inventory from these pages while retaining uncertain operations. */
|
|
@@ -391,7 +561,7 @@ interface RefreshOptions {
|
|
|
391
561
|
|
|
392
562
|
declare function operationPreview(plan: OperationPlan, status: OperationStatus): {
|
|
393
563
|
id: string;
|
|
394
|
-
kind: "shield" | "create-credit" | "
|
|
564
|
+
kind: "shield" | "transfer" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
395
565
|
status: OperationStatus;
|
|
396
566
|
context: {
|
|
397
567
|
tokenAddress: _invisi_labs_core.Address;
|
|
@@ -401,7 +571,36 @@ declare function operationPreview(plan: OperationPlan, status: OperationStatus):
|
|
|
401
571
|
protocolAddress: _invisi_labs_core.Address;
|
|
402
572
|
};
|
|
403
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
|
+
};
|
|
404
602
|
creditOutputs: {
|
|
603
|
+
commitment: `0x${string}`;
|
|
405
604
|
amount: bigint;
|
|
406
605
|
expiry: bigint;
|
|
407
606
|
owner: `0x${string}`;
|
|
@@ -410,12 +609,15 @@ declare function operationPreview(plan: OperationPlan, status: OperationStatus):
|
|
|
410
609
|
spenderPayout: bigint;
|
|
411
610
|
}[] | undefined;
|
|
412
611
|
outputs: {
|
|
612
|
+
commitment: `0x${string}`;
|
|
413
613
|
to: string;
|
|
414
614
|
amount: bigint;
|
|
415
615
|
change: boolean;
|
|
416
616
|
}[];
|
|
417
617
|
capacity: number | undefined;
|
|
418
618
|
deadline: bigint;
|
|
619
|
+
feeRecipient: `0x${string}` | undefined;
|
|
620
|
+
feeAmount: bigint;
|
|
419
621
|
fundingAmount: bigint;
|
|
420
622
|
fundingPayer: `0x${string}` | undefined;
|
|
421
623
|
withdrawalAmount: bigint;
|
|
@@ -468,7 +670,7 @@ type SessionTransactionOptions = Omit<TransactionRequest, "to" | "from" | "data"
|
|
|
468
670
|
declare class WalletSession {
|
|
469
671
|
#private;
|
|
470
672
|
readonly scope: WalletScope;
|
|
471
|
-
readonly protocol: Protocol;
|
|
673
|
+
readonly protocol: Protocol$1;
|
|
472
674
|
constructor(options: WalletSessionOptions);
|
|
473
675
|
sendTransaction(call: TransactionCall, options?: SessionTransactionOptions): Promise<TransactionResponse>;
|
|
474
676
|
sendTransaction(operation: Operation, options?: SessionTransactionOptions): Promise<TransactionResponse>;
|
|
@@ -491,21 +693,19 @@ declare class WalletSession {
|
|
|
491
693
|
resume(operationId: string): Promise<Operation>;
|
|
492
694
|
toJSON(): {
|
|
493
695
|
walletSession: boolean;
|
|
494
|
-
|
|
696
|
+
ownerAddress: `0x${string}`;
|
|
495
697
|
};
|
|
496
698
|
}
|
|
497
699
|
|
|
498
700
|
/** Compose independent Chain RPC and indexed Protocol RPC with local wallet capabilities. */
|
|
499
701
|
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
702
|
provider?: Provider;
|
|
503
703
|
chainReader?: ChainReader;
|
|
504
704
|
};
|
|
505
705
|
type InvisiOptions = InvisiInfrastructure;
|
|
506
706
|
/** Public wallet and registry-specific inputs; signing remains external. */
|
|
507
707
|
type RegistrationPreparationOptions = Pick<RegistrationPreparation, "update" | "deadline"> & Pick<TransactionIdentity, "wallet">;
|
|
508
|
-
/**
|
|
708
|
+
/** Owner address and session permissions; shared infrastructure belongs to InvisiOptions. */
|
|
509
709
|
type ConnectionOptions = Pick<WalletSessionOptions, "wallet" | "protocol" | "namespace" | "viewing" | "authorization" | "signer" | "fundingSigner">;
|
|
510
710
|
/** A neutral composition entry point; every resolved instance owns an independent session. */
|
|
511
711
|
declare class Invisi {
|
|
@@ -528,6 +728,17 @@ declare class Invisi {
|
|
|
528
728
|
};
|
|
529
729
|
}
|
|
530
730
|
|
|
731
|
+
/** Deployment operations and token-compatible broadcaster discovery. */
|
|
732
|
+
declare class Protocol extends Protocol$1 {
|
|
733
|
+
static fromRpc(rpc: Pick<ProtocolRpcClient$1, "getDeployment"> & Partial<Pick<ProtocolRpcClient$1, "getBroadcasters">>, provider: Provider, options?: {
|
|
734
|
+
signal?: AbortSignal;
|
|
735
|
+
}): Promise<Protocol>;
|
|
736
|
+
/** Returns enabled services that answer a token fee probe; final quotes are checked by prepared. */
|
|
737
|
+
getBroadcasters(options: {
|
|
738
|
+
tokenAddress: string;
|
|
739
|
+
}): Promise<BroadcasterClient[]>;
|
|
740
|
+
}
|
|
741
|
+
|
|
531
742
|
/** Protocol RPC transport with ethers provider integration for independent chain checks. */
|
|
532
743
|
declare class ProtocolRpcClient extends ProtocolRpcClient$1 {
|
|
533
744
|
withProvider(provider: Provider): ProtocolRpcClient$1;
|
|
@@ -540,6 +751,43 @@ declare class AddressRegistry extends AddressRegistry$1 {
|
|
|
540
751
|
})): Promise<_invisi_labs_protocol.RegistrationOperation>;
|
|
541
752
|
}
|
|
542
753
|
|
|
754
|
+
interface BroadcasterRegistration {
|
|
755
|
+
endpoint: string;
|
|
756
|
+
metadataURI?: string;
|
|
757
|
+
quoteSigner: Address;
|
|
758
|
+
feeRecipient: Address;
|
|
759
|
+
}
|
|
760
|
+
interface RegisteredBroadcaster extends Required<BroadcasterRegistration> {
|
|
761
|
+
operator: Address;
|
|
762
|
+
enabled: boolean;
|
|
763
|
+
}
|
|
764
|
+
interface BroadcasterRegistryOptions {
|
|
765
|
+
provider: Provider;
|
|
766
|
+
address: Address;
|
|
767
|
+
chainId: bigint;
|
|
768
|
+
fromBlock: number;
|
|
769
|
+
runtimeCodeHash: string;
|
|
770
|
+
/** Maximum blocks per getLogs request. Defaults to 2,000. */
|
|
771
|
+
blockRange?: number;
|
|
772
|
+
}
|
|
773
|
+
/** Optional on-chain discovery. Registry entries do not authorize spending or endorse operators. */
|
|
774
|
+
declare class BroadcasterRegistry {
|
|
775
|
+
#private;
|
|
776
|
+
readonly address: Address;
|
|
777
|
+
constructor(options: BroadcasterRegistryOptions);
|
|
778
|
+
prepareRegistration(registration: BroadcasterRegistration): TransactionCall;
|
|
779
|
+
prepareAvailability(enabled: boolean): TransactionCall;
|
|
780
|
+
private call;
|
|
781
|
+
private validate;
|
|
782
|
+
get(operator: Address): Promise<RegisteredBroadcaster>;
|
|
783
|
+
private read;
|
|
784
|
+
/** Discover event operators, then read their latest entry; disabled services remain explicit. */
|
|
785
|
+
discover(options?: {
|
|
786
|
+
toBlock?: number;
|
|
787
|
+
signal?: AbortSignal;
|
|
788
|
+
}): Promise<RegisteredBroadcaster[]>;
|
|
789
|
+
}
|
|
790
|
+
|
|
543
791
|
/** Caller-owned, nonextractable AES-GCM key. The SDK does not persist the key. */
|
|
544
792
|
declare class EncryptedWalletCodec implements WalletRecordCodec {
|
|
545
793
|
#private;
|
|
@@ -563,4 +811,4 @@ declare class EncryptedWalletCodec implements WalletRecordCodec {
|
|
|
563
811
|
/** Decode independently fetched canonical receipt bytes, never normalized service events. */
|
|
564
812
|
declare function readProtocolLogs(receipt: CanonicalReceipt, protocolAddress: Address): DeliveryEventLog[];
|
|
565
813
|
|
|
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 };
|
|
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 };
|