@invisi-labs/sdk 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{NoteOutput-DRkVnwlx.d.cts → broadcaster-preparation-DMxxZ_1Q.d.cts} +309 -120
- package/dist/{NoteOutput-DpDC6T2O.d.ts → broadcaster-preparation-DMxxZ_1Q.d.ts} +309 -120
- package/dist/broadcaster-preparation-RMWQFYNL.js +11 -0
- package/dist/broadcaster-preparation-UGOTO4SX.cjs +11 -0
- package/dist/broadcaster-preparation-UGOTO4SX.cjs.map +1 -0
- package/dist/chunk-7F7ZZW3L.cjs +374 -0
- package/dist/chunk-7F7ZZW3L.cjs.map +1 -0
- package/dist/{chunk-4SD3MW6N.js → chunk-EHP5TBC6.js} +1347 -2493
- package/dist/chunk-EHP5TBC6.js.map +1 -0
- package/dist/{broadcaster-preparation-QVL62KM6.js → chunk-GTPUYPQL.js} +6 -6
- package/dist/chunk-GTPUYPQL.js.map +1 -0
- package/dist/{chunk-FL4TIGWW.js → chunk-ITTGBIG2.js} +617 -521
- package/dist/chunk-ITTGBIG2.js.map +1 -0
- package/dist/chunk-J2JH6HIG.cjs +1877 -0
- package/dist/chunk-J2JH6HIG.cjs.map +1 -0
- package/dist/chunk-LOU7AP2B.cjs +128 -0
- package/dist/chunk-LOU7AP2B.cjs.map +1 -0
- package/dist/chunk-RHNIHI4P.cjs +3565 -0
- package/dist/chunk-RHNIHI4P.cjs.map +1 -0
- package/dist/{chunk-QC6TQR3R.js → chunk-XHKQ2BO2.js} +12 -12
- package/dist/chunk-XHKQ2BO2.js.map +1 -0
- package/dist/ethers.cjs +11 -385
- package/dist/ethers.cjs.map +1 -1
- package/dist/ethers.d.cts +3 -4
- package/dist/ethers.d.ts +3 -4
- package/dist/ethers.js +1 -1
- package/dist/index.cjs +451 -7845
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -702
- package/dist/index.d.ts +72 -702
- package/dist/index.js +374 -862
- package/dist/index.js.map +1 -1
- package/dist/receipt-logs-CvC951p7.d.cts +318 -0
- package/dist/receipt-logs-m0-bhaxW.d.ts +318 -0
- package/dist/session-support.cjs +168 -0
- package/dist/session-support.cjs.map +1 -0
- package/dist/session-support.d.cts +252 -0
- package/dist/session-support.d.ts +252 -0
- package/dist/session-support.js +168 -0
- package/dist/session-support.js.map +1 -0
- package/package.json +10 -20
- package/dist/broadcaster-preparation-QVL62KM6.js.map +0 -1
- package/dist/chunk-4SD3MW6N.js.map +0 -1
- package/dist/chunk-FL4TIGWW.js.map +0 -1
- package/dist/chunk-QC6TQR3R.js.map +0 -1
- package/dist/indexeddb.cjs +0 -6878
- package/dist/indexeddb.cjs.map +0 -1
- package/dist/indexeddb.d.cts +0 -20
- package/dist/indexeddb.d.ts +0 -20
- package/dist/indexeddb.js +0 -71
- package/dist/indexeddb.js.map +0 -1
- package/dist/memory.cjs +0 -6886
- package/dist/memory.cjs.map +0 -1
- package/dist/memory.d.cts +0 -12
- package/dist/memory.d.ts +0 -12
- package/dist/memory.js +0 -11
- package/dist/sqlite.cjs +0 -6862
- package/dist/sqlite.cjs.map +0 -1
- package/dist/sqlite.d.cts +0 -28
- package/dist/sqlite.d.ts +0 -28
- package/dist/sqlite.js +0 -55
- package/dist/sqlite.js.map +0 -1
- package/dist/state-C4HZFotm.d.cts +0 -78
- package/dist/state-C4HZFotm.d.ts +0 -78
- package/dist/store-8aBhnbGr.d.ts +0 -42
- package/dist/store-YrbXb6CY.d.cts +0 -42
- /package/dist/{memory.js.map → broadcaster-preparation-RMWQFYNL.js.map} +0 -0
|
@@ -1,39 +1,223 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Address, Hex as Hex$1, Delivery, ShieldParams, ShieldOutput, CreateCreditParams, CreditDrawParams, CancelCreditParams, TopUpCreditParams, TransactRequest } from '@invisi-labs/protocol/contracts';
|
|
3
|
-
import { c as StoredNote, W as WalletScope, b as WalletStore } from './state-C4HZFotm.cjs';
|
|
4
|
-
import { FundingInput, TransactionContext, CanonicalBlock, NoteMembership, TransactRequestParams, CreditMembership, Protocol, ChainReader, ProtocolDataProvider, TokenProtocol } from '@invisi-labs/protocol';
|
|
5
|
-
import { Signer, Provider } from 'ethers';
|
|
1
|
+
import { Note, CreditDeliveryState, ReceivingKeyLookup, Hex as Hex$2, Wallet, PublicWallet, AuthorizedStatement } from '@invisi-labs/core';
|
|
6
2
|
import * as _invisi_labs_prover from '@invisi-labs/prover';
|
|
7
|
-
import { Prover, ProverOptions, AggregateMember } from '@invisi-labs/prover';
|
|
3
|
+
import { Hex, Prover, ProverOptions, AggregateMember, ProofBundle } from '@invisi-labs/prover';
|
|
4
|
+
import * as _invisi_labs_protocol from '@invisi-labs/protocol';
|
|
5
|
+
import { FundingInput, TransactionContext, CanonicalBlock, NoteMembership, TransactRequestParams, CreditMembership, Protocol, ChainReader, ProtocolDataProvider, TokenProtocol } from '@invisi-labs/protocol';
|
|
6
|
+
import * as ethers from 'ethers';
|
|
7
|
+
import { Interface, Provider } from 'ethers';
|
|
8
|
+
import { Hex as Hex$1, Delivery, Address, ShieldParams, ShieldOutput, CreateCreditParams, CreditDrawParams, CancelCreditParams, TopUpCreditParams, TransactRequest } from '@invisi-labs/protocol/contracts';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
declare const broadcasterQuoteTypes: {
|
|
11
|
+
Quote: {
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
interface BroadcasterQuote {
|
|
17
|
+
token: string;
|
|
18
|
+
feeRecipient: string;
|
|
19
|
+
feeAmount: string;
|
|
20
|
+
deadline: string;
|
|
21
|
+
maxGas: string;
|
|
22
|
+
requestHash: string;
|
|
23
|
+
}
|
|
24
|
+
interface SignedBroadcasterQuote {
|
|
25
|
+
quote: BroadcasterQuote;
|
|
26
|
+
signature: string;
|
|
27
|
+
context?: {
|
|
28
|
+
chainId: bigint;
|
|
29
|
+
protocol: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
interface BroadcasterTrust {
|
|
33
|
+
chainId: bigint;
|
|
34
|
+
protocol: string;
|
|
35
|
+
signer: string;
|
|
36
|
+
}
|
|
37
|
+
declare function broadcasterQuoteDomain(trust: BroadcasterTrust): {
|
|
38
|
+
name: string;
|
|
39
|
+
version: string;
|
|
40
|
+
chainId: bigint;
|
|
41
|
+
verifyingContract: string;
|
|
42
|
+
};
|
|
43
|
+
declare const broadcasterTransactInterface: Interface;
|
|
44
|
+
/** Decode a canonical supported direct public intent. Draw, registry and aggregates are excluded. */
|
|
45
|
+
declare function decodeBroadcasterIntent(data: string): {
|
|
46
|
+
fragment: ethers.FunctionFragment;
|
|
47
|
+
method: string;
|
|
48
|
+
args: ethers.Result;
|
|
49
|
+
proof: string;
|
|
50
|
+
request: {
|
|
51
|
+
params: any;
|
|
52
|
+
funding: any;
|
|
53
|
+
deliveries: any;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
/** Domain-separated final public intent: omit only proof bytes and funding.signature. */
|
|
57
|
+
declare function broadcasterRequestHash(data: string): string;
|
|
58
|
+
declare function verifyBroadcasterQuote(signed: SignedBroadcasterQuote, trust: BroadcasterTrust, data: string, now?: bigint): BroadcasterQuote;
|
|
59
|
+
interface BroadcasterStatus {
|
|
60
|
+
id: string;
|
|
61
|
+
state: "pending" | "submitted" | "confirmed" | "reverted" | "uncertain";
|
|
62
|
+
transactionHash?: string;
|
|
63
|
+
}
|
|
64
|
+
type BroadcasterTransport = (request: {
|
|
65
|
+
jsonrpc: "2.0";
|
|
66
|
+
id: number;
|
|
67
|
+
method: string;
|
|
68
|
+
params: unknown;
|
|
69
|
+
}) => Promise<unknown>;
|
|
70
|
+
interface BroadcasterConfiguration {
|
|
71
|
+
endpoint: string;
|
|
72
|
+
quoteSigner: string;
|
|
73
|
+
feeRecipient: string;
|
|
74
|
+
}
|
|
75
|
+
declare class BroadcasterClient {
|
|
76
|
+
readonly configuration: Readonly<BroadcasterConfiguration>;
|
|
77
|
+
readonly url: string;
|
|
78
|
+
readonly transport: BroadcasterTransport;
|
|
79
|
+
private requestId;
|
|
80
|
+
constructor(configuration: BroadcasterConfiguration, transport?: BroadcasterTransport);
|
|
81
|
+
private call;
|
|
82
|
+
fee(token: string, data?: string): Promise<{
|
|
83
|
+
feeRecipient: string;
|
|
84
|
+
feeAmount: string;
|
|
85
|
+
maxGas: string;
|
|
86
|
+
}>;
|
|
87
|
+
quote(data: string, context: {
|
|
88
|
+
chainId: bigint;
|
|
89
|
+
protocol: string;
|
|
90
|
+
}): Promise<SignedBroadcasterQuote>;
|
|
91
|
+
submit(data: string, signed: SignedBroadcasterQuote, idempotencyKey: string): Promise<BroadcasterStatus>;
|
|
92
|
+
status(id: string): Promise<BroadcasterStatus>;
|
|
93
|
+
}
|
|
94
|
+
declare class BroadcasterRpcError extends Error {
|
|
95
|
+
readonly code: number;
|
|
96
|
+
constructor(code: number, message: string);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
interface WalletScope {
|
|
100
|
+
namespace: string;
|
|
101
|
+
chainId: bigint;
|
|
102
|
+
protocolAddress: Hex;
|
|
103
|
+
ownerAddress: Hex;
|
|
104
|
+
}
|
|
105
|
+
declare function creditReservationKey(commitment: string): string;
|
|
106
|
+
interface Checkpoint {
|
|
107
|
+
number: bigint;
|
|
108
|
+
hash: Hex;
|
|
109
|
+
}
|
|
110
|
+
type SpentState = "unknown" | "unspent" | "spent";
|
|
111
|
+
interface ReceiptPosition {
|
|
112
|
+
commitment: Hex;
|
|
113
|
+
treeId: bigint;
|
|
114
|
+
leafIndex: number;
|
|
115
|
+
blockNumber: bigint;
|
|
116
|
+
blockHash: Hex;
|
|
117
|
+
transactionHash?: Hex;
|
|
118
|
+
}
|
|
119
|
+
interface NoteRecord extends ReceiptPosition {
|
|
120
|
+
note: Note;
|
|
121
|
+
spent: SpentState;
|
|
122
|
+
checkedThrough?: Checkpoint;
|
|
123
|
+
}
|
|
124
|
+
interface CreditRecord extends ReceiptPosition {
|
|
125
|
+
receivingKeySource?: {
|
|
126
|
+
kind: "draw" | "top-up";
|
|
127
|
+
commitment: Hex;
|
|
128
|
+
};
|
|
129
|
+
state: CreditDeliveryState;
|
|
130
|
+
role: "owner" | "spender";
|
|
131
|
+
spent: SpentState;
|
|
132
|
+
checkedThrough?: Checkpoint;
|
|
133
|
+
}
|
|
134
|
+
type OperationStatus = "prepared" | "authorized" | "proved" | "ready" | "submitted" | "confirmed" | "failed" | "expired" | "uncertain" | "reorged";
|
|
135
|
+
|
|
136
|
+
/** Minimal input count by descending amount, with deterministic tree/position/commitment ties. */
|
|
137
|
+
type SelectableNote = Pick<NoteRecord, "note" | "commitment" | "treeId" | "leafIndex" | "spent">;
|
|
138
|
+
|
|
139
|
+
type AddressLookup = "chain" | "protocol-rpc";
|
|
140
|
+
/** Capture deployment pins before a Protocol is bound to an operation's token. */
|
|
141
|
+
declare function configureRecipientInfrastructure<T extends TransactionInfrastructure>(options: T): T;
|
|
142
|
+
/** Internal lookup plumbing; public APIs never accept resolver functions. */
|
|
143
|
+
declare function recipientLookup(options: object, source?: AddressLookup): ReceivingKeyLookup;
|
|
144
|
+
|
|
145
|
+
interface NoteOutputContext {
|
|
146
|
+
chainId: bigint;
|
|
147
|
+
protocolAddress: Hex$1;
|
|
148
|
+
tokenAddress: Hex$1;
|
|
149
|
+
}
|
|
150
|
+
type NoteOutputRecipient = {
|
|
151
|
+
type: "evm";
|
|
152
|
+
address: string;
|
|
153
|
+
envelope?: boolean;
|
|
154
|
+
addressLookup?: AddressLookup;
|
|
155
|
+
nonce?: bigint | undefined;
|
|
15
156
|
} | {
|
|
16
|
-
|
|
17
|
-
|
|
157
|
+
type: "invisi";
|
|
158
|
+
address: string;
|
|
159
|
+
nonce?: bigint | undefined;
|
|
18
160
|
} | {
|
|
19
|
-
|
|
20
|
-
|
|
161
|
+
type: "identity";
|
|
162
|
+
identity: Hex$1;
|
|
163
|
+
};
|
|
164
|
+
type EncryptedRecipient = {
|
|
165
|
+
type: "evm";
|
|
166
|
+
address: string;
|
|
167
|
+
envelope?: true;
|
|
168
|
+
addressLookup?: AddressLookup;
|
|
169
|
+
nonce?: bigint | undefined;
|
|
21
170
|
} | {
|
|
22
|
-
|
|
23
|
-
|
|
171
|
+
type: "invisi";
|
|
172
|
+
address: string;
|
|
173
|
+
nonce?: bigint | undefined;
|
|
24
174
|
};
|
|
25
|
-
type
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
175
|
+
type PaymentRequest = NoteOutputContext & {
|
|
176
|
+
amount: bigint;
|
|
177
|
+
} & ({
|
|
178
|
+
recipient: EncryptedRecipient;
|
|
179
|
+
payload?: Uint8Array;
|
|
180
|
+
} | {
|
|
181
|
+
recipient: {
|
|
182
|
+
type: "evm";
|
|
183
|
+
address: string;
|
|
184
|
+
envelope: false;
|
|
185
|
+
addressLookup?: AddressLookup;
|
|
186
|
+
nonce?: bigint | undefined;
|
|
187
|
+
} | {
|
|
188
|
+
type: "identity";
|
|
189
|
+
identity: Hex$1;
|
|
190
|
+
};
|
|
191
|
+
payload?: never;
|
|
192
|
+
});
|
|
193
|
+
/** Local payment choices; these never rewrite the encoded request. */
|
|
194
|
+
interface NoteOutputExecutionOptions {
|
|
195
|
+
nonce?: bigint;
|
|
196
|
+
addressLookup?: AddressLookup;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** Immutable output statement and optional recoverable opening. */
|
|
200
|
+
declare class NoteOutput {
|
|
201
|
+
readonly to: string;
|
|
202
|
+
readonly ipp: string;
|
|
203
|
+
readonly amount: bigint;
|
|
204
|
+
readonly identity: Hex$1;
|
|
205
|
+
readonly commitment: Hex$1;
|
|
206
|
+
readonly deliveryFingerprint: Hex$1;
|
|
207
|
+
/** Encrypted EVM delivery is resolved by preparation; the original offline intent stays pending. */
|
|
208
|
+
readonly deliveryPending: boolean;
|
|
209
|
+
readonly context: NoteOutputContext;
|
|
210
|
+
readonly recipient: NoteOutputRecipient;
|
|
211
|
+
readonly nonce: bigint | undefined;
|
|
212
|
+
readonly payload: Uint8Array;
|
|
213
|
+
readonly preparedOutput: PreparedOutput;
|
|
214
|
+
private constructor();
|
|
215
|
+
/** Private offline delivery data; does not assert that the output has been mined. */
|
|
216
|
+
exportPaymentNote(): string;
|
|
217
|
+
static create(input: PaymentRequest | string, execution?: NoteOutputExecutionOptions): Promise<NoteOutput>;
|
|
218
|
+
assertCommitment(expectedHex: Hex$1): void;
|
|
219
|
+
get note(): Note | undefined;
|
|
220
|
+
get delivery(): Delivery;
|
|
37
221
|
}
|
|
38
222
|
|
|
39
223
|
interface GasBenchmarkShape {
|
|
@@ -52,9 +236,9 @@ interface GasBenchmarkShape {
|
|
|
52
236
|
}
|
|
53
237
|
interface GasBenchmarkDeployment {
|
|
54
238
|
chainId: string;
|
|
55
|
-
protocolAddress: Hex;
|
|
56
|
-
runtimeCodeHash: Hex | null;
|
|
57
|
-
tokenAddress: Hex;
|
|
239
|
+
protocolAddress: Hex$2;
|
|
240
|
+
runtimeCodeHash: Hex$2 | null;
|
|
241
|
+
tokenAddress: Hex$2;
|
|
58
242
|
}
|
|
59
243
|
interface GasBenchmarkCircuit {
|
|
60
244
|
circuitName: string;
|
|
@@ -64,9 +248,9 @@ interface GasBenchmarkCircuit {
|
|
|
64
248
|
}
|
|
65
249
|
interface GasBenchmarkSample {
|
|
66
250
|
gasUsed: string;
|
|
67
|
-
transactionHash: Hex;
|
|
251
|
+
transactionHash: Hex$2;
|
|
68
252
|
blockNumber: string;
|
|
69
|
-
blockHash: Hex;
|
|
253
|
+
blockHash: Hex$2;
|
|
70
254
|
calldataBytes: number;
|
|
71
255
|
}
|
|
72
256
|
interface GasBenchmarkProfile {
|
|
@@ -93,8 +277,8 @@ interface GasBenchmarkProfile {
|
|
|
93
277
|
};
|
|
94
278
|
blockGasLimit?: string;
|
|
95
279
|
runtimeContracts?: Record<string, {
|
|
96
|
-
address: Hex;
|
|
97
|
-
runtimeCodeHash: Hex;
|
|
280
|
+
address: Hex$2;
|
|
281
|
+
runtimeCodeHash: Hex$2;
|
|
98
282
|
}>;
|
|
99
283
|
measuredAt: string;
|
|
100
284
|
chain: string;
|
|
@@ -110,15 +294,37 @@ interface GasBenchmarkProfile {
|
|
|
110
294
|
samples: GasBenchmarkSample[];
|
|
111
295
|
}>;
|
|
112
296
|
}
|
|
113
|
-
|
|
114
|
-
|
|
297
|
+
interface GasEstimateRequest {
|
|
298
|
+
deployment: GasBenchmarkDeployment;
|
|
299
|
+
shape: GasBenchmarkShape;
|
|
300
|
+
circuit: GasBenchmarkCircuit | null;
|
|
301
|
+
}
|
|
302
|
+
type BenchmarkGasEstimate = {
|
|
303
|
+
source: "benchmark";
|
|
304
|
+
request: GasEstimateRequest;
|
|
305
|
+
} & ({
|
|
306
|
+
available: false;
|
|
307
|
+
reason: "deployment-not-covered" | "shape-not-covered" | "recursive-member-only";
|
|
308
|
+
} | {
|
|
309
|
+
available: true;
|
|
310
|
+
gasUnits: bigint;
|
|
311
|
+
range: {
|
|
312
|
+
min: bigint;
|
|
313
|
+
max: bigint;
|
|
314
|
+
kind: "observed";
|
|
315
|
+
};
|
|
316
|
+
samples: number;
|
|
317
|
+
profileId: string;
|
|
318
|
+
measurementId: string;
|
|
319
|
+
evidence: GasBenchmarkProfile["source"];
|
|
320
|
+
});
|
|
115
321
|
/** Pre-proof reference only; ethers must estimate the final transaction independently. */
|
|
116
322
|
interface GasReference {
|
|
117
323
|
gasUnits: bigint;
|
|
118
324
|
}
|
|
119
325
|
|
|
120
326
|
interface CoinSelector {
|
|
121
|
-
select(candidates: readonly
|
|
327
|
+
select(candidates: readonly NoteRecord[], requiredAmount: bigint): readonly Hex$1[] | Promise<readonly Hex$1[]>;
|
|
122
328
|
}
|
|
123
329
|
interface FundingTypedData {
|
|
124
330
|
domain: Record<string, unknown>;
|
|
@@ -288,111 +494,94 @@ interface OperationPlan {
|
|
|
288
494
|
credit?: CreditPlan;
|
|
289
495
|
statement?: _invisi_labs_prover.ProofStatement;
|
|
290
496
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
497
|
+
interface SavedOperation {
|
|
498
|
+
plan: OperationPlan;
|
|
499
|
+
broadcasterQuote?: SignedBroadcasterQuote;
|
|
500
|
+
proof?: ProofBundle;
|
|
501
|
+
call?: _invisi_labs_protocol.TransactionCall;
|
|
502
|
+
externalized?: boolean;
|
|
503
|
+
generation: number;
|
|
504
|
+
claim?: {
|
|
505
|
+
stage: string;
|
|
506
|
+
token: string;
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
interface TransactionInfrastructure {
|
|
294
510
|
gasBenchmarks?: readonly GasBenchmarkProfile[];
|
|
295
|
-
/** Optional ethers gas/funding signer; distinct from the Invisi wallet authority. */
|
|
296
|
-
signer?: Signer;
|
|
297
|
-
viewing?: Pick<ViewingCapability, "ownerAddress" | "decryptNote" | "decryptCredit">;
|
|
298
511
|
wallet: Wallet | PublicWallet;
|
|
299
512
|
protocol: Protocol;
|
|
300
|
-
namespace?: string;
|
|
301
|
-
store?: WalletStore;
|
|
302
513
|
chainReader?: ChainReader;
|
|
303
514
|
protocolRpc?: ProtocolDataProvider;
|
|
304
|
-
authorization?: WalletAuthorizationProvider;
|
|
305
515
|
prover?: Prover;
|
|
306
|
-
fundingSigner?: FundingSigner;
|
|
307
516
|
fundingVerifier?: FundingAuthorizationVerifier;
|
|
308
517
|
/** Optional ethers provider used by per-output direct-chain receiving-key lookup. */
|
|
309
518
|
provider?: Provider;
|
|
310
519
|
coinSelector?: CoinSelector;
|
|
311
520
|
transactionTTL?: bigint;
|
|
312
521
|
}
|
|
313
|
-
interface
|
|
314
|
-
options: Omit<
|
|
522
|
+
interface TransactionRuntime {
|
|
523
|
+
options: Omit<TransactionInfrastructure, "protocol"> & {
|
|
315
524
|
protocol: TokenProtocol;
|
|
316
525
|
};
|
|
317
526
|
scope: WalletScope;
|
|
318
|
-
store: WalletStore;
|
|
319
527
|
reader: ChainReader;
|
|
320
|
-
|
|
528
|
+
}
|
|
529
|
+
interface LocalOperationSecrets {
|
|
530
|
+
authorization?: AuthorizedStatement;
|
|
321
531
|
}
|
|
322
532
|
interface OperationAggregateMember extends AggregateMember {
|
|
323
533
|
context: TransactionContext;
|
|
324
534
|
request: TransactRequest;
|
|
325
535
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
536
|
+
/** Data required while preparing an operation; it does not own persistence or reservations. */
|
|
537
|
+
interface PreparationRuntime<Result> extends TransactionRuntime {
|
|
538
|
+
readInventory(): Promise<PreparationInventory>;
|
|
539
|
+
complete(plan: OperationPlan): Promise<Result>;
|
|
540
|
+
explicitInputs?: boolean;
|
|
541
|
+
inputSelection?: readonly Hex$1[];
|
|
542
|
+
changeAddress?: string;
|
|
333
543
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
544
|
+
interface PreparationInventory {
|
|
545
|
+
reservations: Record<string, string>;
|
|
546
|
+
invalidated?: string;
|
|
547
|
+
observedThrough?: Checkpoint;
|
|
548
|
+
notes: Record<string, SelectableNote>;
|
|
549
|
+
credits: Record<string, Pick<CreditRecord, "state" | "commitment" | "treeId" | "leafIndex" | "role" | "spent">>;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
type PreparationIntent = {
|
|
553
|
+
kind: "transfer";
|
|
554
|
+
options: TransferPreparation;
|
|
340
555
|
} | {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
nonce?: bigint | undefined;
|
|
556
|
+
kind: "shield";
|
|
557
|
+
options: ShieldPreparation;
|
|
344
558
|
} | {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
};
|
|
348
|
-
type EncryptedRecipient = {
|
|
349
|
-
type: "evm";
|
|
350
|
-
address: string;
|
|
351
|
-
envelope?: true;
|
|
352
|
-
addressLookup?: AddressLookup;
|
|
353
|
-
nonce?: bigint | undefined;
|
|
559
|
+
kind: "create-credit";
|
|
560
|
+
options: CreateCreditPreparation;
|
|
354
561
|
} | {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
nonce?: bigint | undefined;
|
|
358
|
-
};
|
|
359
|
-
type NoteOutputOptions = NoteOutputContext & {
|
|
360
|
-
amount: bigint;
|
|
361
|
-
} & ({
|
|
362
|
-
recipient: EncryptedRecipient;
|
|
363
|
-
payload?: Uint8Array;
|
|
562
|
+
kind: "top-up-credit";
|
|
563
|
+
options: TopUpCreditPreparation;
|
|
364
564
|
} | {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
readonly amount: bigint;
|
|
381
|
-
readonly identity: Hex$1;
|
|
382
|
-
readonly commitment: Hex$1;
|
|
383
|
-
readonly deliveryFingerprint: Hex$1;
|
|
384
|
-
/** Encrypted EVM delivery is resolved by preparation; the original offline intent stays pending. */
|
|
385
|
-
readonly deliveryPending: boolean;
|
|
386
|
-
readonly context: NoteOutputContext;
|
|
387
|
-
readonly recipient: NoteOutputRecipient;
|
|
388
|
-
readonly nonce: bigint | undefined;
|
|
389
|
-
readonly payload: Uint8Array;
|
|
390
|
-
readonly preparedOutput: PreparedOutput;
|
|
391
|
-
private constructor();
|
|
392
|
-
static create(options: NoteOutputOptions): Promise<NoteOutput>;
|
|
393
|
-
assertCommitment(expectedHex: Hex$1): void;
|
|
394
|
-
get note(): Note | undefined;
|
|
395
|
-
get delivery(): Delivery;
|
|
565
|
+
kind: "cancel-credit";
|
|
566
|
+
options: CancelCreditPreparation;
|
|
567
|
+
};
|
|
568
|
+
type BroadcasterFeeSource = "public-funding" | "private-inputs" | "payout";
|
|
569
|
+
interface WithBroadcasterOptions {
|
|
570
|
+
maxFeeAmount: bigint;
|
|
571
|
+
feeSource?: BroadcasterFeeSource;
|
|
572
|
+
maxAttempts?: number;
|
|
573
|
+
/** Optional app-owned permit signing, requested once for the final gross funding amount. */
|
|
574
|
+
fundingPermit?: (request: {
|
|
575
|
+
payer: `0x${string}`;
|
|
576
|
+
amount: bigint;
|
|
577
|
+
tokenAddress: `0x${string}`;
|
|
578
|
+
protocolAddress: `0x${string}`;
|
|
579
|
+
}) => Promise<NonNullable<TransferPreparation["funding"]>["permit"]>;
|
|
396
580
|
}
|
|
581
|
+
declare function prepareIntent(runtime: PreparationRuntime<OperationPlan>, intent: PreparationIntent): Promise<OperationPlan>;
|
|
582
|
+
declare function prepareBroadcasterPlan(plan: OperationPlan, reprepare: (intent: PreparationIntent) => Promise<OperationPlan>, client: BroadcasterClient, options: WithBroadcasterOptions): Promise<{
|
|
583
|
+
plan: OperationPlan;
|
|
584
|
+
quote: SignedBroadcasterQuote;
|
|
585
|
+
}>;
|
|
397
586
|
|
|
398
|
-
export { type
|
|
587
|
+
export { type LocalOperationSecrets as $, broadcasterTransactInterface as A, BroadcasterClient as B, type CancelCreditPreparation as C, type DrawCreditPreparation as D, decodeBroadcasterIntent as E, type FundingAuthorizationVerifier as F, type GasBenchmarkCircuit as G, verifyBroadcasterQuote as H, type GasEstimateRequest as I, type OperationPlan as J, type BenchmarkGasEstimate as K, type SavedOperation as L, type TransactionRuntime as M, NoteOutput as N, type OperationAggregateMember as O, type PaymentRequest as P, type OperationStatus as Q, type PreparationRuntime as R, type ShieldPreparation as S, type TopUpCreditPreparation as T, type TransactionInfrastructure as U, type AddressLookup as V, type WithBroadcasterOptions as W, type Checkpoint as X, type CoinSelector as Y, type CreditPlan as Z, type CreditRecord as _, type BroadcasterConfiguration as a, type NoteRecord as a0, type PreparationIntent as a1, type PreparationInventory as a2, type PreparedCreditInput as a3, type PreparedCreditOutput as a4, type PreparedOutput as a5, type ReceiptPosition as a6, type SpentState as a7, type WalletScope as a8, configureRecipientInfrastructure as a9, creditReservationKey as aa, prepareBroadcasterPlan as ab, prepareIntent as ac, recipientLookup as ad, type BroadcasterFeeSource as b, type BroadcasterQuote as c, BroadcasterRpcError as d, type BroadcasterStatus as e, type BroadcasterTransport as f, type BroadcasterTrust as g, type CreateCreditPreparation as h, type FundingSigner as i, type FundingSource as j, type FundingTypedData as k, type GasBenchmarkDeployment as l, type GasBenchmarkProfile as m, type GasBenchmarkSample as n, type GasBenchmarkShape as o, type GasReference as p, type NoteOutputContext as q, type NoteOutputExecutionOptions as r, type NoteOutputRecipient as s, type SignedBroadcasterQuote as t, type TransactionExecution as u, type TransactionProveOptions as v, type TransferPreparation as w, broadcasterQuoteDomain as x, broadcasterQuoteTypes as y, broadcasterRequestHash as z };
|