@invisi-labs/protocol 1.1.7 → 1.2.0
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/README.md +5 -0
- package/dist/chunk-7SS2YSEF.js +199 -0
- package/dist/chunk-7SS2YSEF.js.map +1 -0
- package/dist/{chunk-BYJ4LXCJ.js → chunk-HHJLFLVJ.js} +616 -714
- package/dist/chunk-HHJLFLVJ.js.map +1 -0
- package/dist/chunk-MVQQD5W5.js +487 -0
- package/dist/chunk-MVQQD5W5.js.map +1 -0
- package/dist/chunk-Z2XPYNMC.js +446 -0
- package/dist/chunk-Z2XPYNMC.js.map +1 -0
- package/dist/contracts.cjs +615 -713
- package/dist/contracts.cjs.map +1 -1
- package/dist/contracts.d.cts +5 -5
- package/dist/contracts.d.ts +5 -5
- package/dist/contracts.js +1 -1
- package/dist/credit.cjs +3367 -0
- package/dist/credit.cjs.map +1 -0
- package/dist/credit.d.cts +252 -0
- package/dist/credit.d.ts +252 -0
- package/dist/credit.js +53 -0
- package/dist/credit.js.map +1 -0
- package/dist/index.cjs +6054 -6053
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +89 -893
- package/dist/index.d.ts +89 -893
- package/dist/index.js +2956 -3762
- package/dist/index.js.map +1 -1
- package/dist/note.cjs +3456 -0
- package/dist/note.cjs.map +1 -0
- package/dist/note.d.cts +232 -0
- package/dist/note.d.ts +232 -0
- package/dist/note.js +43 -0
- package/dist/note.js.map +1 -0
- package/dist/provenance.cjs +558 -0
- package/dist/provenance.cjs.map +1 -0
- package/dist/provenance.d.cts +188 -0
- package/dist/provenance.d.ts +188 -0
- package/dist/provenance.js +499 -0
- package/dist/provenance.js.map +1 -0
- package/dist/{types-Bvakbfeb.d.cts → types-CUnFzl5S.d.cts} +530 -590
- package/dist/{types-Bvakbfeb.d.ts → types-CUnFzl5S.d.ts} +530 -590
- package/dist/validation-8g0SQVE5.d.ts +235 -0
- package/dist/validation-MgURYiNF.d.cts +235 -0
- package/package.json +20 -5
- package/dist/chunk-BYJ4LXCJ.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,557 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
import
|
|
1
|
+
export { BuildCreateCreditCalldataParams, BuildCreditDrawCalldataParams, BuildRevokeCreditCalldataParams, BuildUpdateCreditCalldataParams, CREATE_CREDIT_FIELDS, CREDIT_DRAW_CAPACITIES, REVOKE_CREDIT_TYPES, authorizedCreditInputs, buildCreateCreditCalldata, buildCreditDrawCalldata, buildRevokeCreditCalldata, buildUpdateCreditCalldata, createCreditBaseInputs, createCreditPublicInputs, creditDrawBaseInputs, creditDrawPublicInputs, encodeCreateCreditTypedData, encodeCreditDrawTypedData, encodeCreditProof, encodeRevokeCreditTypedData, encodeUpdateCreditTypedData, selectCreditDrawCircuit, updateCreditBaseInputs, updateCreditPublicInputs, validateCreateCreditRequest, validateCreditDrawRequest, validateUpdateCreditRequest } from './credit.js';
|
|
2
|
+
import { TransactRequestParams } from './note.js';
|
|
3
|
+
export { AGGREGATE_ROUTES, AggregateMemberInput, AggregateRoute, BuildShieldCalldataParams, BuildTransactAggregateCalldataParams, BuildTransactCalldataParams, TRANSACT_CAPACITIES, TransactCapacity, aggregateMemberRequestHash, aggregatePublicInputs, buildShieldCalldata, buildTransactAggregateCalldata, buildTransactCalldata, encodeAggregateFundingTypedData, encodeShieldFundingTypedData, encodeTransactFundingTypedData, encodeTransactTypedData, normalizeTransactRequest, selectAggregateRoute, selectTransactCapacity, shieldFundingRequestHash, transactFundingRequestHash, transactPublicInputs, validateShieldRequest } from './note.js';
|
|
4
|
+
import { D as Delivery } from './types-CUnFzl5S.js';
|
|
5
|
+
import { T as TransactionContext, F as FundingInput, C as CanonicalBlock, D as DeploymentContext } from './validation-8g0SQVE5.js';
|
|
6
|
+
export { B as BroadcasterPage, a as BroadcasterQuery, E as EMPTY_FUNDING, b as EMPTY_PERMIT, c as FIELD_MODULUS, I as IndexedCreditAllocation, d as IndexedCreditRevocationBitmap, e as IndexedCreditState, M as Membership, P as ProtocolCreditCandidates, f as ProtocolCreditTransition, g as ProtocolCreditUpdates, h as ProtocolDataProvider, i as ProtocolDataStatus, j as ProtocolNoteOutput, k as ProtocolNoteUpdates, l as ProtocolTransactionCreditUpdates, m as ProtocolTransactionNoteUpdates, n as ProtocolUpdateRange, R as RegisteredBroadcaster, o as RegisteredReceivingAddress, Z as ZERO_ADDRESS, p as ZERO_WORD, q as checkDeadline, r as deliveriesHash, s as dense, t as envelope, u as field, v as fundingFields, w as getEIP712Domain, x as known, y as normalizeContext, z as normalizeFunding, A as normalizeOpaqueDelivery, G as normalizeSources, H as notes, J as pad, K as uint, L as validateFundingSubmission, N as word } from './validation-8g0SQVE5.js';
|
|
7
|
+
import * as _invisi_labs_primitives from '@invisi-labs/primitives';
|
|
8
|
+
import { Hex, Address, ReceivingKeyLookup } from '@invisi-labs/primitives';
|
|
9
|
+
import { ContractRunner } from 'ethers';
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
now?: bigint;
|
|
12
|
-
/** Explicit chain timestamp used to bind Credit draw UTC periods. */
|
|
13
|
-
timestamp?: bigint;
|
|
14
|
-
}
|
|
15
|
-
declare const FIELD_MODULUS = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
|
|
16
|
-
declare const ZERO_ADDRESS: "0x0000000000000000000000000000000000000000";
|
|
17
|
-
declare const ZERO_WORD: Hex;
|
|
18
|
-
declare const EMPTY_PERMIT: {
|
|
19
|
-
readonly deadline: 0n;
|
|
20
|
-
readonly v: 0;
|
|
21
|
-
readonly r: `0x${string}`;
|
|
22
|
-
readonly s: `0x${string}`;
|
|
23
|
-
};
|
|
24
|
-
declare const EMPTY_FUNDING: FundingParams;
|
|
25
|
-
type FundingInput = Partial<Omit<FundingParams, "permit">> & {
|
|
26
|
-
permit?: FundingParams["permit"];
|
|
27
|
-
};
|
|
28
|
-
declare function uint(v: bigint | number | string, bits: number, name?: string): bigint;
|
|
29
|
-
declare function field(v: bigint | string, name?: string): bigint;
|
|
30
|
-
declare const word: (v: bigint | string) => Hex;
|
|
31
|
-
declare function dense<T>(v: readonly T[], name: string): readonly T[];
|
|
32
|
-
declare function known(v: object, keys: readonly string[], name?: string): void;
|
|
33
|
-
declare function notes(v: readonly Hex[], name: string): `0x${string}`[];
|
|
34
|
-
declare function envelope(v: Hex, length: number, version?: number, maximum?: number): Hex;
|
|
35
|
-
declare function normalizeContext(c: TransactionContext): {
|
|
36
|
-
chainId: bigint;
|
|
37
|
-
protocolAddress: Hex;
|
|
38
|
-
tokenAddress: Hex;
|
|
39
|
-
now?: bigint;
|
|
40
|
-
/** Explicit chain timestamp used to bind Credit draw UTC periods. */
|
|
41
|
-
timestamp?: bigint;
|
|
42
|
-
};
|
|
43
|
-
declare function checkDeadline(c: TransactionContext, value: bigint): bigint;
|
|
44
|
-
declare function normalizeSources(sources: readonly InputSource[], inputCount: number, capacity: number): {
|
|
45
|
-
treeId: bigint;
|
|
46
|
-
merkleRoot: `0x${string}`;
|
|
47
|
-
}[];
|
|
48
|
-
declare const pad: (v: readonly bigint[], n: number) => bigint[];
|
|
49
|
-
/** Receipt/transport validation must not reject unrelated future wallet codecs. */
|
|
50
|
-
declare function normalizeOpaqueDelivery(value: Delivery, options?: {
|
|
51
|
-
empty?: boolean;
|
|
52
|
-
allowEmpty?: boolean;
|
|
53
|
-
}): Delivery;
|
|
54
|
-
declare const deliveriesHash: (v: readonly Delivery[]) => Hex;
|
|
55
|
-
declare function normalizeFunding(input?: FundingInput): FundingParams;
|
|
56
|
-
declare function validateFundingSubmission(f: FundingParams, caller?: Address, now?: bigint): void;
|
|
57
|
-
declare const getEIP712Domain: (c: TransactionContext) => {
|
|
58
|
-
name: string;
|
|
59
|
-
version: string;
|
|
60
|
-
chainId: bigint;
|
|
61
|
-
verifyingContract: Hex;
|
|
62
|
-
};
|
|
63
|
-
declare const fundingFields: readonly [{
|
|
64
|
-
readonly name: "requestHash";
|
|
65
|
-
readonly type: "bytes32";
|
|
66
|
-
}, {
|
|
67
|
-
readonly name: "payer";
|
|
68
|
-
readonly type: "address";
|
|
69
|
-
}, {
|
|
70
|
-
readonly name: "amount";
|
|
71
|
-
readonly type: "uint256";
|
|
72
|
-
}, {
|
|
73
|
-
readonly name: "sigNonce";
|
|
74
|
-
readonly type: "uint256";
|
|
75
|
-
}, {
|
|
76
|
-
readonly name: "deadline";
|
|
77
|
-
readonly type: "uint256";
|
|
78
|
-
}];
|
|
79
|
-
|
|
80
|
-
declare const CREATE_CREDIT_FIELDS: readonly ["token", "sources", "nullifiers", "creditCommitment", "changeCommitment", "owner", "expiry", "deadline", "feeRecipient", "feeAmount"];
|
|
81
|
-
/** Public checks cannot establish ownership or conservation: those are enforced by the proof. */
|
|
82
|
-
declare function validateCreateCreditRequest(c: TransactionContext, p: CreateCreditParams, cs: readonly Delivery[], funding?: FundingInput): {
|
|
83
|
-
sources: {
|
|
84
|
-
treeId: bigint;
|
|
85
|
-
merkleRoot: `0x${string}`;
|
|
86
|
-
}[];
|
|
87
|
-
nullifiers: `0x${string}`[];
|
|
88
|
-
actualCount: number;
|
|
89
|
-
sourceCount: number;
|
|
90
|
-
creditCommitment: `0x${string}`;
|
|
91
|
-
changeCommitment: `0x${string}`;
|
|
92
|
-
owner: `0x${string}`;
|
|
93
|
-
expiry: bigint;
|
|
94
|
-
deadline: bigint;
|
|
95
|
-
deliveries: Delivery[];
|
|
96
|
-
funding: FundingParams;
|
|
97
|
-
feeRecipient: `0x${string}`;
|
|
98
|
-
feeAmount: bigint;
|
|
99
|
-
chainId: bigint;
|
|
100
|
-
protocolAddress: Hex;
|
|
101
|
-
tokenAddress: Hex;
|
|
102
|
-
now?: bigint;
|
|
103
|
-
timestamp?: bigint;
|
|
104
|
-
};
|
|
105
|
-
declare function createCreditBaseInputs(c: TransactionContext, p: CreateCreditParams, cs: readonly Delivery[], f?: FundingInput): `0x${string}`[];
|
|
106
|
-
declare function createCreditPublicInputs(c: TransactionContext, p: CreateCreditParams, deliveries: readonly Delivery[], funding?: FundingInput): `0x${string}`[];
|
|
107
|
-
declare function createCreditRequestHash(p: CreateCreditParams, cs: readonly Delivery[], f?: FundingInput): Hex;
|
|
108
|
-
declare function encodeCreateCreditTypedData(c: TransactionContext, p: CreateCreditParams, deliveries: readonly Delivery[], funding?: FundingInput): {
|
|
109
|
-
domain: {
|
|
110
|
-
name: string;
|
|
111
|
-
version: string;
|
|
112
|
-
chainId: bigint;
|
|
113
|
-
verifyingContract: `0x${string}`;
|
|
114
|
-
};
|
|
115
|
-
types: {
|
|
116
|
-
readonly WalletAuthorization: readonly [{
|
|
117
|
-
readonly name: "operation";
|
|
118
|
-
readonly type: "bytes32";
|
|
119
|
-
}, {
|
|
120
|
-
readonly name: "statementHash";
|
|
121
|
-
readonly type: "bytes32";
|
|
122
|
-
}];
|
|
123
|
-
};
|
|
124
|
-
primaryType: "WalletAuthorization";
|
|
125
|
-
message: {
|
|
126
|
-
operation: `0x${string}`;
|
|
127
|
-
statementHash: `0x${string}`;
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
declare function encodeCreateCreditFundingTypedData(c: TransactionContext, p: CreateCreditParams, cs: readonly Delivery[], f: FundingInput): {
|
|
131
|
-
domain: {
|
|
132
|
-
name: string;
|
|
133
|
-
version: string;
|
|
134
|
-
chainId: bigint;
|
|
135
|
-
verifyingContract: Hex;
|
|
136
|
-
};
|
|
137
|
-
primaryType: "FundTransact";
|
|
138
|
-
types: {
|
|
139
|
-
FundTransact: readonly [{
|
|
140
|
-
readonly name: "requestHash";
|
|
141
|
-
readonly type: "bytes32";
|
|
142
|
-
}, {
|
|
143
|
-
readonly name: "payer";
|
|
144
|
-
readonly type: "address";
|
|
145
|
-
}, {
|
|
146
|
-
readonly name: "amount";
|
|
147
|
-
readonly type: "uint256";
|
|
148
|
-
}, {
|
|
149
|
-
readonly name: "sigNonce";
|
|
150
|
-
readonly type: "uint256";
|
|
151
|
-
}, {
|
|
152
|
-
readonly name: "deadline";
|
|
153
|
-
readonly type: "uint256";
|
|
154
|
-
}];
|
|
155
|
-
};
|
|
156
|
-
message: {
|
|
157
|
-
requestHash: `0x${string}`;
|
|
158
|
-
payer: `0x${string}`;
|
|
159
|
-
amount: bigint;
|
|
160
|
-
sigNonce: bigint;
|
|
161
|
-
deadline: bigint;
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
interface BuildCreateCreditCalldataParams {
|
|
165
|
-
context: TransactionContext;
|
|
166
|
-
proof: Hex;
|
|
167
|
-
params: CreateCreditParams;
|
|
168
|
-
deliveries: readonly Delivery[];
|
|
169
|
-
funding?: FundingInput;
|
|
170
|
-
caller?: Address;
|
|
171
|
-
}
|
|
172
|
-
declare function buildCreateCreditCalldata(p: BuildCreateCreditCalldataParams): {
|
|
173
|
-
data: Hex;
|
|
174
|
-
approveAmount: bigint;
|
|
175
|
-
};
|
|
176
|
-
/** Frame a raw direct proof from the proving backend for the Credit verifier adapter. */
|
|
177
|
-
declare function encodeCreditProof(proof: Hex): Hex;
|
|
178
|
-
|
|
179
|
-
declare const CREDIT_DRAW_CAPACITIES: readonly [1, 12, 50, 120];
|
|
180
|
-
declare function selectCreditDrawCircuit(count: number): {
|
|
181
|
-
name: string;
|
|
182
|
-
maxSize: 1 | 12 | 50 | 120;
|
|
183
|
-
publicInputCount: number;
|
|
184
|
-
totalBits: number;
|
|
185
|
-
};
|
|
186
|
-
declare function validateCreditDrawRequest(c: TransactionContext, p: CreditDrawParams, cs: readonly Delivery[]): {
|
|
187
|
-
sources: {
|
|
188
|
-
treeId: bigint;
|
|
189
|
-
merkleRoot: `0x${string}`;
|
|
190
|
-
}[];
|
|
191
|
-
nullifiers: `0x${string}`[];
|
|
192
|
-
remainderCommitments: `0x${string}`[];
|
|
193
|
-
recoveryAmounts: `0x${string}`[];
|
|
194
|
-
expiries: bigint[];
|
|
195
|
-
spender: `0x${string}`;
|
|
196
|
-
totalAmount: bigint;
|
|
197
|
-
deadline: bigint;
|
|
198
|
-
deliveries: Delivery[];
|
|
199
|
-
profile: {
|
|
200
|
-
name: string;
|
|
201
|
-
maxSize: 1 | 12 | 50 | 120;
|
|
202
|
-
publicInputCount: number;
|
|
203
|
-
totalBits: number;
|
|
204
|
-
};
|
|
205
|
-
periods: {
|
|
206
|
-
currentDay: bigint;
|
|
207
|
-
currentMonth: bigint;
|
|
208
|
-
};
|
|
209
|
-
chainId: bigint;
|
|
210
|
-
protocolAddress: Hex;
|
|
211
|
-
tokenAddress: Hex;
|
|
212
|
-
now?: bigint;
|
|
213
|
-
timestamp?: bigint;
|
|
214
|
-
};
|
|
215
|
-
declare function creditDrawBaseInputs(c: TransactionContext, p: CreditDrawParams, cs: readonly Delivery[]): `0x${string}`[];
|
|
216
|
-
declare function validateCancelCreditRequest(c: TransactionContext, p: CancelCreditParams): {
|
|
217
|
-
source: {
|
|
218
|
-
treeId: bigint;
|
|
219
|
-
merkleRoot: `0x${string}`;
|
|
220
|
-
};
|
|
221
|
-
nullifier: `0x${string}`;
|
|
222
|
-
owner: `0x${string}`;
|
|
223
|
-
amount: bigint;
|
|
224
|
-
deadline: bigint;
|
|
225
|
-
feeRecipient: `0x${string}`;
|
|
226
|
-
feeAmount: bigint;
|
|
227
|
-
chainId: bigint;
|
|
228
|
-
protocolAddress: Hex;
|
|
229
|
-
tokenAddress: Hex;
|
|
230
|
-
now?: bigint;
|
|
231
|
-
timestamp?: bigint;
|
|
232
|
-
};
|
|
233
|
-
declare function cancelCreditBaseInputs(c: TransactionContext, p: CancelCreditParams): `0x${string}`[];
|
|
234
|
-
declare function validateTopUpCreditRequest(c: TransactionContext, p: TopUpCreditParams, cs: readonly Delivery[], funding?: FundingInput): {
|
|
235
|
-
creation: {
|
|
236
|
-
sources: {
|
|
237
|
-
treeId: bigint;
|
|
238
|
-
merkleRoot: `0x${string}`;
|
|
239
|
-
}[];
|
|
240
|
-
nullifiers: `0x${string}`[];
|
|
241
|
-
actualCount: number;
|
|
242
|
-
sourceCount: number;
|
|
243
|
-
creditCommitment: `0x${string}`;
|
|
244
|
-
changeCommitment: `0x${string}`;
|
|
245
|
-
owner: `0x${string}`;
|
|
246
|
-
expiry: bigint;
|
|
247
|
-
deadline: bigint;
|
|
248
|
-
deliveries: Delivery[];
|
|
249
|
-
funding: FundingParams;
|
|
250
|
-
feeRecipient: `0x${string}`;
|
|
251
|
-
feeAmount: bigint;
|
|
252
|
-
chainId: bigint;
|
|
253
|
-
protocolAddress: Hex;
|
|
254
|
-
tokenAddress: Hex;
|
|
255
|
-
now?: bigint;
|
|
256
|
-
timestamp?: bigint;
|
|
257
|
-
};
|
|
258
|
-
creditSource: {
|
|
259
|
-
treeId: bigint;
|
|
260
|
-
merkleRoot: `0x${string}`;
|
|
261
|
-
};
|
|
262
|
-
creditNullifier: `0x${string}`;
|
|
263
|
-
previousExpiry: bigint;
|
|
264
|
-
};
|
|
265
|
-
declare function topUpCreditBaseInputs(c: TransactionContext, p: TopUpCreditParams, cs: readonly Delivery[], f?: FundingInput): `0x${string}`[];
|
|
266
|
-
declare function cancelCreditRequestHash(p: CancelCreditParams): Hex;
|
|
267
|
-
declare function topUpCreditRequestHash(p: TopUpCreditParams, cs: readonly Delivery[], f?: FundingInput): Hex;
|
|
268
|
-
declare function encodeCancelCreditTypedData(c: TransactionContext, p: CancelCreditParams): {
|
|
269
|
-
domain: {
|
|
270
|
-
name: string;
|
|
271
|
-
version: string;
|
|
272
|
-
chainId: bigint;
|
|
273
|
-
verifyingContract: `0x${string}`;
|
|
274
|
-
};
|
|
275
|
-
types: {
|
|
276
|
-
readonly WalletAuthorization: readonly [{
|
|
277
|
-
readonly name: "operation";
|
|
278
|
-
readonly type: "bytes32";
|
|
279
|
-
}, {
|
|
280
|
-
readonly name: "statementHash";
|
|
281
|
-
readonly type: "bytes32";
|
|
282
|
-
}];
|
|
283
|
-
};
|
|
284
|
-
primaryType: "WalletAuthorization";
|
|
285
|
-
message: {
|
|
286
|
-
operation: `0x${string}`;
|
|
287
|
-
statementHash: `0x${string}`;
|
|
288
|
-
};
|
|
289
|
-
};
|
|
290
|
-
declare function encodeTopUpCreditTypedData(c: TransactionContext, p: TopUpCreditParams, deliveries: readonly Delivery[], funding?: FundingInput): {
|
|
291
|
-
domain: {
|
|
292
|
-
name: string;
|
|
293
|
-
version: string;
|
|
294
|
-
chainId: bigint;
|
|
295
|
-
verifyingContract: `0x${string}`;
|
|
296
|
-
};
|
|
297
|
-
types: {
|
|
298
|
-
readonly WalletAuthorization: readonly [{
|
|
299
|
-
readonly name: "operation";
|
|
300
|
-
readonly type: "bytes32";
|
|
301
|
-
}, {
|
|
302
|
-
readonly name: "statementHash";
|
|
303
|
-
readonly type: "bytes32";
|
|
304
|
-
}];
|
|
305
|
-
};
|
|
306
|
-
primaryType: "WalletAuthorization";
|
|
307
|
-
message: {
|
|
308
|
-
operation: `0x${string}`;
|
|
309
|
-
statementHash: `0x${string}`;
|
|
310
|
-
};
|
|
311
|
-
};
|
|
312
|
-
declare function encodeCreditDrawTypedData(c: TransactionContext, p: CreditDrawParams, deliveries: readonly Delivery[]): {
|
|
313
|
-
domain: {
|
|
314
|
-
name: string;
|
|
315
|
-
version: string;
|
|
316
|
-
chainId: bigint;
|
|
317
|
-
verifyingContract: `0x${string}`;
|
|
318
|
-
};
|
|
319
|
-
types: {
|
|
320
|
-
readonly WalletAuthorization: readonly [{
|
|
321
|
-
readonly name: "operation";
|
|
322
|
-
readonly type: "bytes32";
|
|
323
|
-
}, {
|
|
324
|
-
readonly name: "statementHash";
|
|
325
|
-
readonly type: "bytes32";
|
|
326
|
-
}];
|
|
327
|
-
};
|
|
328
|
-
primaryType: "WalletAuthorization";
|
|
329
|
-
message: {
|
|
330
|
-
operation: `0x${string}`;
|
|
331
|
-
statementHash: `0x${string}`;
|
|
332
|
-
};
|
|
333
|
-
};
|
|
334
|
-
declare function creditDrawPublicInputs(c: TransactionContext, p: CreditDrawParams, deliveries: readonly Delivery[]): `0x${string}`[];
|
|
335
|
-
declare function cancelCreditPublicInputs(c: TransactionContext, p: CancelCreditParams): `0x${string}`[];
|
|
336
|
-
declare function topUpCreditPublicInputs(c: TransactionContext, p: TopUpCreditParams, deliveries: readonly Delivery[], funding?: FundingInput): `0x${string}`[];
|
|
337
|
-
declare function encodeTopUpCreditFundingTypedData(c: TransactionContext, p: TopUpCreditParams, cs: readonly Delivery[], f: FundingInput): {
|
|
338
|
-
domain: {
|
|
339
|
-
name: string;
|
|
340
|
-
version: string;
|
|
341
|
-
chainId: bigint;
|
|
342
|
-
verifyingContract: Hex;
|
|
343
|
-
};
|
|
344
|
-
primaryType: "FundTransact";
|
|
345
|
-
types: {
|
|
346
|
-
FundTransact: readonly [{
|
|
347
|
-
readonly name: "requestHash";
|
|
348
|
-
readonly type: "bytes32";
|
|
349
|
-
}, {
|
|
350
|
-
readonly name: "payer";
|
|
351
|
-
readonly type: "address";
|
|
352
|
-
}, {
|
|
353
|
-
readonly name: "amount";
|
|
354
|
-
readonly type: "uint256";
|
|
355
|
-
}, {
|
|
356
|
-
readonly name: "sigNonce";
|
|
357
|
-
readonly type: "uint256";
|
|
358
|
-
}, {
|
|
359
|
-
readonly name: "deadline";
|
|
360
|
-
readonly type: "uint256";
|
|
361
|
-
}];
|
|
362
|
-
};
|
|
363
|
-
message: {
|
|
364
|
-
requestHash: `0x${string}`;
|
|
365
|
-
payer: `0x${string}`;
|
|
366
|
-
amount: bigint;
|
|
367
|
-
sigNonce: bigint;
|
|
368
|
-
deadline: bigint;
|
|
369
|
-
};
|
|
370
|
-
};
|
|
371
|
-
interface BuildCreditDrawCalldataParams {
|
|
372
|
-
context: TransactionContext;
|
|
373
|
-
proof: Hex;
|
|
374
|
-
params: CreditDrawParams;
|
|
375
|
-
deliveries: readonly Delivery[];
|
|
376
|
-
}
|
|
377
|
-
declare function buildCreditDrawCalldata(p: BuildCreditDrawCalldataParams): {
|
|
378
|
-
data: Hex;
|
|
379
|
-
nullifiers: readonly `0x${string}`[];
|
|
380
|
-
totalAmount: bigint;
|
|
381
|
-
};
|
|
382
|
-
interface BuildCancelCreditCalldataParams {
|
|
383
|
-
context: TransactionContext;
|
|
384
|
-
proof: Hex;
|
|
385
|
-
params: CancelCreditParams;
|
|
386
|
-
}
|
|
387
|
-
declare function buildCancelCreditCalldata(p: BuildCancelCreditCalldataParams): {
|
|
388
|
-
data: Hex;
|
|
389
|
-
};
|
|
390
|
-
interface BuildTopUpCreditCalldataParams {
|
|
391
|
-
context: TransactionContext;
|
|
392
|
-
proof: Hex;
|
|
393
|
-
params: TopUpCreditParams;
|
|
394
|
-
deliveries: readonly Delivery[];
|
|
395
|
-
funding?: FundingInput;
|
|
396
|
-
caller?: Address;
|
|
397
|
-
}
|
|
398
|
-
declare function buildTopUpCreditCalldata(p: BuildTopUpCreditCalldataParams): {
|
|
399
|
-
data: Hex;
|
|
400
|
-
approveAmount: bigint;
|
|
401
|
-
};
|
|
402
|
-
|
|
403
|
-
interface BuildTransactAggregateCalldataParams {
|
|
404
|
-
context: DeploymentContext & {
|
|
405
|
-
now?: bigint;
|
|
406
|
-
};
|
|
407
|
-
proof: Hex;
|
|
408
|
-
requests: readonly TransactRequest[];
|
|
409
|
-
caller?: Address;
|
|
410
|
-
}
|
|
411
|
-
declare function buildTransactAggregateCalldata(p: BuildTransactAggregateCalldataParams): {
|
|
412
|
-
data: Hex;
|
|
413
|
-
capacity: 14;
|
|
414
|
-
};
|
|
415
|
-
type AggregateMemberInput = Pick<TransactRequest, "params" | "deliveries"> & {
|
|
416
|
-
funding?: FundingInput;
|
|
417
|
-
};
|
|
418
|
-
/** Atomic aggregate funding binds the member statement rather than the aggregate proof bytes. */
|
|
419
|
-
declare function aggregateMemberRequestHash(c: TransactionContext, r: AggregateMemberInput): Hex;
|
|
420
|
-
/** Router adapter business words (58 per member), not the aggregate circuit statement. */
|
|
421
|
-
declare function aggregatePublicInputs(c: TransactionContext, requests: readonly AggregateMemberInput[]): `0x${string}`[];
|
|
422
|
-
declare function encodeAggregateFundingTypedData(c: TransactionContext, r: AggregateMemberInput): {
|
|
423
|
-
domain: {
|
|
424
|
-
name: string;
|
|
425
|
-
version: string;
|
|
426
|
-
chainId: bigint;
|
|
427
|
-
verifyingContract: Hex;
|
|
428
|
-
};
|
|
429
|
-
primaryType: "FundTransact";
|
|
430
|
-
types: {
|
|
431
|
-
FundTransact: readonly [{
|
|
432
|
-
readonly name: "requestHash";
|
|
433
|
-
readonly type: "bytes32";
|
|
434
|
-
}, {
|
|
435
|
-
readonly name: "payer";
|
|
436
|
-
readonly type: "address";
|
|
437
|
-
}, {
|
|
438
|
-
readonly name: "amount";
|
|
439
|
-
readonly type: "uint256";
|
|
440
|
-
}, {
|
|
441
|
-
readonly name: "sigNonce";
|
|
442
|
-
readonly type: "uint256";
|
|
443
|
-
}, {
|
|
444
|
-
readonly name: "deadline";
|
|
445
|
-
readonly type: "uint256";
|
|
446
|
-
}];
|
|
447
|
-
};
|
|
448
|
-
message: {
|
|
449
|
-
requestHash: `0x${string}`;
|
|
450
|
-
payer: `0x${string}`;
|
|
451
|
-
amount: bigint;
|
|
452
|
-
sigNonce: bigint;
|
|
453
|
-
deadline: bigint;
|
|
454
|
-
};
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
declare const TRANSACT_CAPACITIES: readonly [14, 56, 112, 168];
|
|
458
|
-
type TransactCapacity = (typeof TRANSACT_CAPACITIES)[number];
|
|
459
|
-
declare function selectTransactCapacity(inputs: number, outputs: number): TransactCapacity;
|
|
460
|
-
type TransactRequestParams = CrossTreeTransactParams;
|
|
461
|
-
declare function normalizeTransactRequest(c: TransactionContext, p: TransactRequestParams, cs: readonly Delivery[], funding?: FundingInput): {
|
|
462
|
-
capacity: 14 | 56 | 112 | 168;
|
|
463
|
-
sources: {
|
|
464
|
-
treeId: bigint;
|
|
465
|
-
merkleRoot: `0x${string}`;
|
|
466
|
-
}[];
|
|
467
|
-
nullifiers: `0x${string}`[];
|
|
468
|
-
outputCommitments: `0x${string}`[];
|
|
469
|
-
inputCount: number;
|
|
470
|
-
outputCount: number;
|
|
471
|
-
sourceCount: number;
|
|
472
|
-
inputTreeIds: bigint[];
|
|
473
|
-
merkleRoots: bigint[];
|
|
474
|
-
slotValues: bigint[];
|
|
475
|
-
deliveries: Delivery[];
|
|
476
|
-
deliveriesHash: `0x${string}`;
|
|
477
|
-
withdrawalAddress: `0x${string}`;
|
|
478
|
-
withdrawalAmount: bigint;
|
|
479
|
-
feeRecipient: `0x${string}`;
|
|
480
|
-
feeAmount: bigint;
|
|
481
|
-
deadline: bigint;
|
|
482
|
-
depositAmount: bigint;
|
|
483
|
-
depositPayer: `0x${string}`;
|
|
484
|
-
funding: FundingParams;
|
|
485
|
-
chainId: bigint;
|
|
486
|
-
protocolAddress: Hex;
|
|
487
|
-
tokenAddress: Hex;
|
|
488
|
-
now?: bigint;
|
|
489
|
-
timestamp?: bigint;
|
|
490
|
-
};
|
|
491
|
-
declare function transactPublicInputs(c: TransactionContext, p: TransactRequestParams, cs: readonly Delivery[], f?: FundingInput): `0x${string}`[];
|
|
492
|
-
|
|
493
|
-
interface BuildTransactCalldataParams {
|
|
494
|
-
context: TransactionContext;
|
|
495
|
-
proof: Hex;
|
|
496
|
-
params: TransactRequestParams;
|
|
497
|
-
deliveries: readonly Delivery[];
|
|
498
|
-
funding?: FundingInput;
|
|
499
|
-
caller?: Address;
|
|
500
|
-
}
|
|
501
|
-
declare function buildTransactCalldata(p: BuildTransactCalldataParams): {
|
|
502
|
-
data: `0x${string}`;
|
|
503
|
-
capacity: 14 | 56 | 112 | 168;
|
|
504
|
-
approveAmount: bigint;
|
|
505
|
-
};
|
|
506
|
-
|
|
507
|
-
interface BuildShieldCalldataParams {
|
|
508
|
-
context: TransactionContext;
|
|
509
|
-
params: ShieldParams;
|
|
510
|
-
outputs: readonly ShieldOutput[];
|
|
511
|
-
deliveries: readonly Delivery[];
|
|
512
|
-
funding: FundingInput;
|
|
513
|
-
caller?: Address;
|
|
514
|
-
}
|
|
515
|
-
declare function validateShieldRequest(p: BuildShieldCalldataParams): Promise<FundingParams>;
|
|
516
|
-
declare function encodeShieldFundingTypedData(p: BuildShieldCalldataParams): Promise<{
|
|
517
|
-
domain: {
|
|
518
|
-
name: string;
|
|
519
|
-
version: string;
|
|
520
|
-
chainId: bigint;
|
|
521
|
-
verifyingContract: Hex;
|
|
522
|
-
};
|
|
523
|
-
primaryType: "FundShield";
|
|
524
|
-
types: {
|
|
525
|
-
FundShield: readonly [{
|
|
526
|
-
readonly name: "requestHash";
|
|
527
|
-
readonly type: "bytes32";
|
|
528
|
-
}, {
|
|
529
|
-
readonly name: "payer";
|
|
530
|
-
readonly type: "address";
|
|
531
|
-
}, {
|
|
532
|
-
readonly name: "amount";
|
|
533
|
-
readonly type: "uint256";
|
|
534
|
-
}, {
|
|
535
|
-
readonly name: "sigNonce";
|
|
536
|
-
readonly type: "uint256";
|
|
537
|
-
}, {
|
|
538
|
-
readonly name: "deadline";
|
|
539
|
-
readonly type: "uint256";
|
|
540
|
-
}];
|
|
541
|
-
};
|
|
542
|
-
message: {
|
|
543
|
-
requestHash: `0x${string}`;
|
|
544
|
-
payer: `0x${string}`;
|
|
545
|
-
amount: bigint;
|
|
546
|
-
sigNonce: bigint;
|
|
547
|
-
deadline: bigint;
|
|
548
|
-
};
|
|
549
|
-
}>;
|
|
550
|
-
declare function buildShieldCalldata(p: BuildShieldCalldataParams): Promise<{
|
|
551
|
-
data: Hex;
|
|
552
|
-
approveAmount: bigint;
|
|
553
|
-
}>;
|
|
554
|
-
declare function shieldFundingRequestHash(params: ShieldParams, outputs: readonly ShieldOutput[], cs: readonly Delivery[]): Hex;
|
|
11
|
+
/** Full active user-circuit public inputs: business statement followed by EIP-712 digest limbs. */
|
|
12
|
+
declare function transactUserPublicInputs(c: TransactionContext, p: TransactRequestParams, cs: readonly Delivery[], f?: FundingInput): `0x${string}`[];
|
|
555
13
|
|
|
556
14
|
interface ProtocolLog {
|
|
557
15
|
address: Address;
|
|
@@ -567,6 +25,11 @@ interface CanonicalReceipt {
|
|
|
567
25
|
status?: "success" | "reverted";
|
|
568
26
|
}
|
|
569
27
|
interface ChainReader {
|
|
28
|
+
getCreditAllocation?(context: DeploymentContext, owner: Address, token: Address, block: CanonicalBlock): Promise<{
|
|
29
|
+
shard: bigint;
|
|
30
|
+
slot: number;
|
|
31
|
+
}>;
|
|
32
|
+
getCreditRevocationBitmap?(context: DeploymentContext, owner: Address, token: Address, shard: bigint, word: number, block: CanonicalBlock): Promise<bigint>;
|
|
570
33
|
getChainId(): Promise<bigint>;
|
|
571
34
|
/** Required when a selected deployment includes a receiving-key registry. */
|
|
572
35
|
getProtocolAddressRegistry?(address: Address): Promise<Address>;
|
|
@@ -595,211 +58,6 @@ interface FactoryReader {
|
|
|
595
58
|
getInstanceFactory(instance: Address): Promise<Address>;
|
|
596
59
|
}
|
|
597
60
|
|
|
598
|
-
interface TokenProtocolOptions {
|
|
599
|
-
expectedRuntimeCodeHash?: Hex;
|
|
600
|
-
}
|
|
601
|
-
/** A token-specific operation binding within a multi-token deployment. Pure builders never sign or submit. */
|
|
602
|
-
declare class TokenProtocol {
|
|
603
|
-
readonly context: Readonly<TransactionContext>;
|
|
604
|
-
readonly expectedRuntimeCodeHash: Hex | undefined;
|
|
605
|
-
constructor(context: TransactionContext, options?: TokenProtocolOptions);
|
|
606
|
-
validateDeployment(reader: Pick<ChainReader, "getChainId" | "getCode">, options?: {
|
|
607
|
-
requireRuntimeProfile?: boolean;
|
|
608
|
-
}): Promise<void>;
|
|
609
|
-
transact(request: Omit<BuildTransactCalldataParams, "context">): {
|
|
610
|
-
data: `0x${string}`;
|
|
611
|
-
capacity: 14 | 56 | 112 | 168;
|
|
612
|
-
approveAmount: bigint;
|
|
613
|
-
to: `0x${string}`;
|
|
614
|
-
value: bigint;
|
|
615
|
-
};
|
|
616
|
-
aggregate(request: Omit<BuildTransactAggregateCalldataParams, "context">): {
|
|
617
|
-
data: Hex;
|
|
618
|
-
capacity: 14;
|
|
619
|
-
to: `0x${string}`;
|
|
620
|
-
value: bigint;
|
|
621
|
-
};
|
|
622
|
-
shield(request: Omit<BuildShieldCalldataParams, "context">): Promise<{
|
|
623
|
-
data: Hex;
|
|
624
|
-
approveAmount: bigint;
|
|
625
|
-
to: `0x${string}`;
|
|
626
|
-
value: bigint;
|
|
627
|
-
}>;
|
|
628
|
-
createCredit(request: Omit<BuildCreateCreditCalldataParams, "context">): {
|
|
629
|
-
data: Hex;
|
|
630
|
-
approveAmount: bigint;
|
|
631
|
-
to: `0x${string}`;
|
|
632
|
-
value: bigint;
|
|
633
|
-
};
|
|
634
|
-
drawCredit(request: Omit<BuildCreditDrawCalldataParams, "context">): {
|
|
635
|
-
data: Hex;
|
|
636
|
-
nullifiers: readonly `0x${string}`[];
|
|
637
|
-
totalAmount: bigint;
|
|
638
|
-
to: `0x${string}`;
|
|
639
|
-
value: bigint;
|
|
640
|
-
};
|
|
641
|
-
cancelCredit(request: Omit<BuildCancelCreditCalldataParams, "context">): {
|
|
642
|
-
data: Hex;
|
|
643
|
-
to: `0x${string}`;
|
|
644
|
-
value: bigint;
|
|
645
|
-
};
|
|
646
|
-
topUpCredit(request: Omit<BuildTopUpCreditCalldataParams, "context">): {
|
|
647
|
-
data: Hex;
|
|
648
|
-
approveAmount: bigint;
|
|
649
|
-
to: `0x${string}`;
|
|
650
|
-
value: bigint;
|
|
651
|
-
};
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
interface NoteMembership {
|
|
655
|
-
note: Note;
|
|
656
|
-
treeId: bigint;
|
|
657
|
-
leafIndex: number;
|
|
658
|
-
path: readonly bigint[];
|
|
659
|
-
}
|
|
660
|
-
interface CreditMembership {
|
|
661
|
-
state: CreditDeliveryState;
|
|
662
|
-
treeId: bigint;
|
|
663
|
-
leafIndex: number;
|
|
664
|
-
path: readonly bigint[];
|
|
665
|
-
}
|
|
666
|
-
interface TransactWitnessParams extends Omit<BuildTransactCalldataParams, "proof" | "context"> {
|
|
667
|
-
inputs: readonly NoteMembership[];
|
|
668
|
-
outputs: readonly (Note | {
|
|
669
|
-
identity: Hex;
|
|
670
|
-
amount: bigint;
|
|
671
|
-
note?: Note;
|
|
672
|
-
})[];
|
|
673
|
-
authorization?: AuthorizedStatement;
|
|
674
|
-
target?: ProofTarget;
|
|
675
|
-
}
|
|
676
|
-
interface CreateCreditWitnessParams {
|
|
677
|
-
params: CreateCreditParams;
|
|
678
|
-
deliveries: readonly Delivery[];
|
|
679
|
-
funding?: FundingInput;
|
|
680
|
-
inputs: readonly NoteMembership[];
|
|
681
|
-
state: CreditDeliveryState;
|
|
682
|
-
change?: Note;
|
|
683
|
-
authorization: AuthorizedStatement;
|
|
684
|
-
}
|
|
685
|
-
interface DrawCreditWitnessParams {
|
|
686
|
-
/** Explicit chain timestamp used to prepare this signed statement. */
|
|
687
|
-
timestamp: bigint;
|
|
688
|
-
params: CreditDrawParams;
|
|
689
|
-
deliveries: readonly Delivery[];
|
|
690
|
-
inputs: readonly CreditMembership[];
|
|
691
|
-
amounts: readonly bigint[];
|
|
692
|
-
authorization: AuthorizedStatement;
|
|
693
|
-
}
|
|
694
|
-
interface CancelCreditWitnessParams {
|
|
695
|
-
params: CancelCreditParams;
|
|
696
|
-
input: CreditMembership;
|
|
697
|
-
authorization: AuthorizedStatement;
|
|
698
|
-
}
|
|
699
|
-
interface TopUpCreditWitnessParams extends Omit<CreateCreditWitnessParams, "params"> {
|
|
700
|
-
params: TopUpCreditParams;
|
|
701
|
-
previous: CreditMembership;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
/** Assemble witnesses through operation-specific builders with shared validation. */
|
|
705
|
-
declare class WitnessBuilder {
|
|
706
|
-
#private;
|
|
707
|
-
constructor(protocol: TokenProtocol);
|
|
708
|
-
static statement(circuitName: CircuitName, expectedPublicInputs: readonly Hex[], target?: ProofTarget): ProofStatement;
|
|
709
|
-
transact(p: TransactWitnessParams): Promise<ProvingRequest>;
|
|
710
|
-
createCredit(p: CreateCreditWitnessParams): Promise<ProvingRequest>;
|
|
711
|
-
cancelCredit(p: CancelCreditWitnessParams): Promise<ProvingRequest>;
|
|
712
|
-
drawCredit(p: DrawCreditWitnessParams): Promise<ProvingRequest>;
|
|
713
|
-
topUpCredit(p: TopUpCreditWitnessParams): Promise<ProvingRequest>;
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
interface ProtocolOptions {
|
|
717
|
-
deployment: ProtocolDeployment;
|
|
718
|
-
}
|
|
719
|
-
/** A multi-token deployment. Asset support is always read from the chain. */
|
|
720
|
-
declare class Protocol {
|
|
721
|
-
readonly deployment: Readonly<ProtocolDeployment>;
|
|
722
|
-
readonly context: Readonly<DeploymentContext>;
|
|
723
|
-
constructor(options: ProtocolOptions);
|
|
724
|
-
/** Load the selected deployment and verify its contract against Chain RPC before returning. */
|
|
725
|
-
static fromRpc(rpc: Pick<ProtocolRpcClient, "getDeployment">, provider: Provider, options?: {
|
|
726
|
-
signal?: AbortSignal;
|
|
727
|
-
}): Promise<Protocol>;
|
|
728
|
-
validateDeployment(connection: Provider | (Pick<ChainReader, "getChainId" | "getCode"> & {
|
|
729
|
-
getProtocolVersion?(address: Address): Promise<bigint>;
|
|
730
|
-
getProtocolAddressRegistry?(address: Address): Promise<Address>;
|
|
731
|
-
})): Promise<void>;
|
|
732
|
-
aggregate(request: Omit<BuildTransactAggregateCalldataParams, "context">): {
|
|
733
|
-
data: Hex;
|
|
734
|
-
capacity: 14;
|
|
735
|
-
to: `0x${string}`;
|
|
736
|
-
value: bigint;
|
|
737
|
-
};
|
|
738
|
-
/** Build an operation context for one asset within this same deployment. */
|
|
739
|
-
forToken(tokenAddress: Address): TokenProtocol;
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
declare function encodeTransactTypedData(c: TransactionContext, p: TransactRequestParams, deliveries: readonly Delivery[], f?: FundingInput): {
|
|
743
|
-
domain: {
|
|
744
|
-
name: string;
|
|
745
|
-
version: string;
|
|
746
|
-
chainId: bigint;
|
|
747
|
-
verifyingContract: `0x${string}`;
|
|
748
|
-
};
|
|
749
|
-
types: {
|
|
750
|
-
readonly WalletAuthorization: readonly [{
|
|
751
|
-
readonly name: "operation";
|
|
752
|
-
readonly type: "bytes32";
|
|
753
|
-
}, {
|
|
754
|
-
readonly name: "statementHash";
|
|
755
|
-
readonly type: "bytes32";
|
|
756
|
-
}];
|
|
757
|
-
};
|
|
758
|
-
primaryType: "WalletAuthorization";
|
|
759
|
-
message: {
|
|
760
|
-
operation: `0x${string}`;
|
|
761
|
-
statementHash: `0x${string}`;
|
|
762
|
-
};
|
|
763
|
-
};
|
|
764
|
-
declare function transactFundingRequestHash(proof: Hex, p: TransactRequestParams, cs: readonly Delivery[]): `0x${string}`;
|
|
765
|
-
declare function encodeTransactFundingTypedData(c: TransactionContext, proof: Hex, p: TransactRequestParams, cs: readonly Delivery[], funding: FundingInput): {
|
|
766
|
-
domain: {
|
|
767
|
-
name: string;
|
|
768
|
-
version: string;
|
|
769
|
-
chainId: bigint;
|
|
770
|
-
verifyingContract: Hex;
|
|
771
|
-
};
|
|
772
|
-
primaryType: "FundTransact";
|
|
773
|
-
types: {
|
|
774
|
-
FundTransact: readonly [{
|
|
775
|
-
readonly name: "requestHash";
|
|
776
|
-
readonly type: "bytes32";
|
|
777
|
-
}, {
|
|
778
|
-
readonly name: "payer";
|
|
779
|
-
readonly type: "address";
|
|
780
|
-
}, {
|
|
781
|
-
readonly name: "amount";
|
|
782
|
-
readonly type: "uint256";
|
|
783
|
-
}, {
|
|
784
|
-
readonly name: "sigNonce";
|
|
785
|
-
readonly type: "uint256";
|
|
786
|
-
}, {
|
|
787
|
-
readonly name: "deadline";
|
|
788
|
-
readonly type: "uint256";
|
|
789
|
-
}];
|
|
790
|
-
};
|
|
791
|
-
message: {
|
|
792
|
-
requestHash: `0x${string}`;
|
|
793
|
-
payer: `0x${string}`;
|
|
794
|
-
amount: bigint;
|
|
795
|
-
sigNonce: bigint;
|
|
796
|
-
deadline: bigint;
|
|
797
|
-
};
|
|
798
|
-
};
|
|
799
|
-
|
|
800
|
-
/** Full active user-circuit public inputs: business statement followed by EIP-712 digest limbs. */
|
|
801
|
-
declare function transactUserPublicInputs(c: TransactionContext, p: TransactRequestParams, cs: readonly Delivery[], f?: FundingInput): `0x${string}`[];
|
|
802
|
-
|
|
803
61
|
interface RegistryContext {
|
|
804
62
|
chainId: bigint;
|
|
805
63
|
registryAddress: Address;
|
|
@@ -859,122 +117,6 @@ type RegistryReadClient = ContractRunner;
|
|
|
859
117
|
/** One receivingKeysOf query per short address; RPC failures propagate unchanged. */
|
|
860
118
|
declare function createRegistryReceivingKeyLookup(client: RegistryReadClient, registryAddress: Address): ReceivingKeyLookup;
|
|
861
119
|
|
|
862
|
-
interface RegistryReader extends Pick<ChainReader, "getChainId" | "getCode" | "getBlock" | "getLatestBlockNumber" | "getTransaction" | "getReceipt"> {
|
|
863
|
-
/** Validate arbitrary ERC-1271 bytes for a contract owner; transport errors propagate. */
|
|
864
|
-
isValidRegistrationSignature?(owner: Address, digest: Hex, signature: Hex): Promise<boolean>;
|
|
865
|
-
getRegistryNonce(context: RegistryContext, ownerAddress: Hex, block: CanonicalBlock): Promise<bigint>;
|
|
866
|
-
}
|
|
867
|
-
interface RegistrationPreparation {
|
|
868
|
-
wallet: PublicWallet;
|
|
869
|
-
reader: RegistryReader;
|
|
870
|
-
deadline?: bigint;
|
|
871
|
-
update?: boolean;
|
|
872
|
-
}
|
|
873
|
-
type RegistrationStatus = "prepared" | "ready" | "submitted" | "confirmed" | "uncertain" | "failed" | "expired" | "reorged";
|
|
874
|
-
declare class RegistrationOperation {
|
|
875
|
-
#private;
|
|
876
|
-
readonly status: RegistrationStatus;
|
|
877
|
-
private constructor();
|
|
878
|
-
static prepare(registry: AddressRegistry, options: RegistrationPreparation): Promise<RegistrationOperation>;
|
|
879
|
-
get id(): string;
|
|
880
|
-
preview(): {
|
|
881
|
-
update: boolean;
|
|
882
|
-
ownerAddress: Hex;
|
|
883
|
-
keys: RegistryReceivingKeys;
|
|
884
|
-
nonce: bigint;
|
|
885
|
-
deadline: bigint;
|
|
886
|
-
id: string;
|
|
887
|
-
status: RegistrationStatus;
|
|
888
|
-
chainId: bigint;
|
|
889
|
-
registryAddress: `0x${string}`;
|
|
890
|
-
};
|
|
891
|
-
/** Export portable EIP-712 data for external signing. */
|
|
892
|
-
exportRegistrationAuthorization(options?: {
|
|
893
|
-
signal?: AbortSignal;
|
|
894
|
-
}): Promise<_invisi_labs_core.SigningRequest>;
|
|
895
|
-
/** Validate and attach an independently obtained EOA or ERC-1271 signature. */
|
|
896
|
-
withSignature(signature: string, options?: {
|
|
897
|
-
signal?: AbortSignal;
|
|
898
|
-
}): Promise<RegistrationOperation>;
|
|
899
|
-
/** Empty signatures require the transaction sender to be the wallet owner. */
|
|
900
|
-
authorizeDirect(): Promise<RegistrationOperation>;
|
|
901
|
-
typedData(): {
|
|
902
|
-
domain: {
|
|
903
|
-
name: string;
|
|
904
|
-
version: string;
|
|
905
|
-
chainId: bigint;
|
|
906
|
-
verifyingContract: `0x${string}`;
|
|
907
|
-
};
|
|
908
|
-
primaryType: string;
|
|
909
|
-
types: {
|
|
910
|
-
[x: string]: {
|
|
911
|
-
name: string;
|
|
912
|
-
type: string;
|
|
913
|
-
}[];
|
|
914
|
-
};
|
|
915
|
-
message: {
|
|
916
|
-
nonce: bigint;
|
|
917
|
-
deadline: bigint;
|
|
918
|
-
viewingPublicKey: Hex;
|
|
919
|
-
clueKey: Hex;
|
|
920
|
-
walletIdentity: string;
|
|
921
|
-
};
|
|
922
|
-
};
|
|
923
|
-
private call;
|
|
924
|
-
exportTransaction(): Promise<TransactionCall>;
|
|
925
|
-
private validateFreshness;
|
|
926
|
-
/** Associate a signed/broadcast transaction; ethers owns sending and receipt waiting. */
|
|
927
|
-
trackTransaction(transactionHash: string): RegistrationOperation;
|
|
928
|
-
reconcile(options?: {
|
|
929
|
-
transactionHash?: Hex;
|
|
930
|
-
signal?: AbortSignal;
|
|
931
|
-
}): Promise<RegistrationOperation>;
|
|
932
|
-
toJSON(): {
|
|
933
|
-
id: string;
|
|
934
|
-
kind: string;
|
|
935
|
-
status: RegistrationStatus;
|
|
936
|
-
};
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
interface AddressRegistryOptions {
|
|
940
|
-
lookup?: ReceivingKeyLookup;
|
|
941
|
-
expectedRuntimeCodeHash?: Hex;
|
|
942
|
-
}
|
|
943
|
-
/** Independent registry deployment and nonce domain, selected by the application. */
|
|
944
|
-
declare class AddressRegistry {
|
|
945
|
-
#private;
|
|
946
|
-
readonly context: Readonly<RegistryContext>;
|
|
947
|
-
readonly expectedRuntimeCodeHash: Hex | undefined;
|
|
948
|
-
constructor(context: RegistryContext, options?: AddressRegistryOptions);
|
|
949
|
-
validateDeployment(reader: Pick<RegistryReader, "getChainId" | "getCode">): Promise<void>;
|
|
950
|
-
prepareRegistration(options: RegistrationPreparation): Promise<RegistrationOperation>;
|
|
951
|
-
resolve(address: string): Promise<string>;
|
|
952
|
-
typedData(registration: AddressRegistration, options?: RegistrationOptions): {
|
|
953
|
-
domain: {
|
|
954
|
-
name: string;
|
|
955
|
-
version: string;
|
|
956
|
-
chainId: bigint;
|
|
957
|
-
verifyingContract: `0x${string}`;
|
|
958
|
-
};
|
|
959
|
-
primaryType: string;
|
|
960
|
-
types: {
|
|
961
|
-
[x: string]: {
|
|
962
|
-
name: string;
|
|
963
|
-
type: string;
|
|
964
|
-
}[];
|
|
965
|
-
};
|
|
966
|
-
message: {
|
|
967
|
-
nonce: bigint;
|
|
968
|
-
deadline: bigint;
|
|
969
|
-
viewingPublicKey: Hex;
|
|
970
|
-
clueKey: Hex;
|
|
971
|
-
walletIdentity: string;
|
|
972
|
-
};
|
|
973
|
-
};
|
|
974
|
-
digest(registration: AddressRegistration, options?: RegistrationOptions): `0x${string}`;
|
|
975
|
-
buildCall(registration: AddressRegistration, signature: `0x${string}`, options?: RegistrationOptions): RegistrationCalldata;
|
|
976
|
-
}
|
|
977
|
-
|
|
978
120
|
interface VerifyNoteCommitmentParams {
|
|
979
121
|
ownerAddress: `0x${string}`;
|
|
980
122
|
tokenAddress: `0x${string}`;
|
|
@@ -982,28 +124,14 @@ interface VerifyNoteCommitmentParams {
|
|
|
982
124
|
nonce: `0x${string}`;
|
|
983
125
|
noteCommitment: `0x${string}`;
|
|
984
126
|
chainId: bigint;
|
|
127
|
+
protocolAddress: `0x${string}`;
|
|
985
128
|
}
|
|
986
129
|
declare function verifyNoteCommitment(params: VerifyNoteCommitmentParams): Promise<boolean>;
|
|
987
|
-
interface VerifyCreditCommitmentParams
|
|
988
|
-
|
|
989
|
-
spenderWalletIdentity: `0x${string}`;
|
|
990
|
-
ownerWalletIdentity: `0x${string}`;
|
|
991
|
-
spenderPayout: `0x${string}`;
|
|
992
|
-
ownerPayout: `0x${string}`;
|
|
993
|
-
tokenAddress: `0x${string}`;
|
|
994
|
-
amount: bigint;
|
|
995
|
-
nonce: bigint;
|
|
996
|
-
expiry: bigint;
|
|
997
|
-
creditSharedKey: bigint;
|
|
998
|
-
/** Server-returned value to verify against the locally recomputed commitment. */
|
|
130
|
+
interface VerifyCreditCommitmentParams {
|
|
131
|
+
state: _invisi_labs_primitives.CreditState;
|
|
999
132
|
creditCommitment: `0x${string}`;
|
|
1000
133
|
}
|
|
1001
|
-
|
|
1002
|
-
* Hashes the received shared key locally, recomputes the Credit leaf and compares it to the
|
|
1003
|
-
* server-returned value. A mismatch means the server folded a wrong nonce
|
|
1004
|
-
* (or other parameter) — the caller MUST abort and not create a Credit.
|
|
1005
|
-
*/
|
|
1006
|
-
declare function verifyCreditCommitment(params: VerifyCreditCommitmentParams): Promise<boolean>;
|
|
134
|
+
declare function verifyCreditCommitment(p: VerifyCreditCommitmentParams): Promise<boolean>;
|
|
1007
135
|
|
|
1008
136
|
/**
|
|
1009
137
|
* Query the selected factory. The caller still verifies the returned deployment profile.
|
|
@@ -1011,4 +139,72 @@ declare function verifyCreditCommitment(params: VerifyCreditCommitmentParams): P
|
|
|
1011
139
|
*/
|
|
1012
140
|
declare function resolveInstanceAddress(client: ContractRunner, factoryAddress: `0x${string}`, salt: `0x${string}`): Promise<`0x${string}`>;
|
|
1013
141
|
|
|
1014
|
-
|
|
142
|
+
/** Canonical optional public fee. Omitting both fields explicitly selects zero fee. */
|
|
143
|
+
declare function normalizeFee(p: {
|
|
144
|
+
feeRecipient?: Address;
|
|
145
|
+
feeAmount?: bigint;
|
|
146
|
+
}): {
|
|
147
|
+
feeRecipient: `0x${string}`;
|
|
148
|
+
feeAmount: bigint;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
declare const CIRCUIT_RELEASE: {
|
|
152
|
+
readonly note: {
|
|
153
|
+
readonly version: 4;
|
|
154
|
+
readonly formatVersion: 7;
|
|
155
|
+
readonly aggregateFormatVersion: 10;
|
|
156
|
+
};
|
|
157
|
+
readonly credit: {
|
|
158
|
+
readonly version: 7;
|
|
159
|
+
readonly formatVersion: 8;
|
|
160
|
+
readonly manifestSha256: "c84fe8b0817f722428d9f888c0e38f2b1b48f15b670e74a75e8dd84776b14d66";
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
type DocumentedReleaseIdentity = {
|
|
165
|
+
creditManifestVersion: number;
|
|
166
|
+
creditFormatVersion: number;
|
|
167
|
+
creditManifestSha256?: string;
|
|
168
|
+
} | {
|
|
169
|
+
userManifestVersion: number;
|
|
170
|
+
userFormatVersion: number;
|
|
171
|
+
};
|
|
172
|
+
type DocumentedGasShape = Readonly<Record<string, string | number | boolean>>;
|
|
173
|
+
type DocumentedGasReference = {
|
|
174
|
+
source: "documented-reference";
|
|
175
|
+
available: false;
|
|
176
|
+
reason: "shape-not-covered" | "release-not-covered";
|
|
177
|
+
} | {
|
|
178
|
+
source: "documented-reference";
|
|
179
|
+
available: true;
|
|
180
|
+
gasUnits: bigint;
|
|
181
|
+
statistic: "median";
|
|
182
|
+
sampleCount: number;
|
|
183
|
+
referenceId: string;
|
|
184
|
+
document: string;
|
|
185
|
+
sourceSha256: string;
|
|
186
|
+
docsCommit: string;
|
|
187
|
+
conditions: string;
|
|
188
|
+
assumptions: readonly string[];
|
|
189
|
+
releaseIdentity: DocumentedReleaseIdentity;
|
|
190
|
+
};
|
|
191
|
+
/** Exact documented workload lookup. This is neither a transaction gas limit nor an RPC estimate. */
|
|
192
|
+
declare function getDocumentedGasReference(query: DocumentedGasShape): DocumentedGasReference;
|
|
193
|
+
|
|
194
|
+
/** Runtime identity and indexing start for one deployed contract. */
|
|
195
|
+
interface ContractDeployment {
|
|
196
|
+
readonly address: Address;
|
|
197
|
+
readonly runtimeCodeHash: Hex;
|
|
198
|
+
readonly fromBlock: bigint;
|
|
199
|
+
}
|
|
200
|
+
/** A deployment record supplied by the selected service or its publisher. */
|
|
201
|
+
interface ProtocolDeployment {
|
|
202
|
+
readonly chainId: bigint;
|
|
203
|
+
readonly protocol: Readonly<ContractDeployment>;
|
|
204
|
+
readonly registry?: Readonly<ContractDeployment>;
|
|
205
|
+
readonly broadcasterRegistry?: Readonly<ContractDeployment>;
|
|
206
|
+
}
|
|
207
|
+
/** Validate and snapshot an object or JSON record. This does not authenticate its source. */
|
|
208
|
+
declare function defineDeployment(value: unknown): Readonly<ProtocolDeployment>;
|
|
209
|
+
|
|
210
|
+
export { type AddressRegistration, CIRCUIT_RELEASE, CanonicalBlock, type CanonicalReceipt, type ChainReader, type ContractDeployment, DeploymentContext, type DocumentedGasReference, type DocumentedGasShape, type DocumentedReleaseIdentity, type FactoryReader, FundingInput, type ProtocolDeployment, type ProtocolLog, type RegistrationCalldata, type RegistrationOptions, type RegistryContext, type RegistryReadClient, type RegistryReceivingKeys, TransactRequestParams, type TransactionCall, TransactionContext, type VerifyCreditCommitmentParams, type VerifyNoteCommitmentParams, buildRegistrationCalldata, createRegistryReceivingKeyLookup, defineDeployment, getDocumentedGasReference, normalizeFee, registrationDigest, registrationTypedData, resolveInstanceAddress, transactUserPublicInputs, verifyCreditCommitment, verifyNoteCommitment };
|