@invisi-labs/protocol 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-47SC3EAI.js → chunk-BYJ4LXCJ.js} +389 -9
- package/dist/chunk-BYJ4LXCJ.js.map +1 -0
- package/dist/contracts.cjs +389 -8
- package/dist/contracts.cjs.map +1 -1
- package/dist/contracts.d.cts +134 -3
- package/dist/contracts.d.ts +134 -3
- package/dist/contracts.js +3 -1
- package/dist/index.cjs +6582 -6147
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +412 -400
- package/dist/index.d.ts +412 -400
- package/dist/index.js +2601 -2372
- package/dist/index.js.map +1 -1
- package/dist/{types-BCTQjKzw.d.cts → types-Bvakbfeb.d.cts} +180 -8
- package/dist/{types-BCTQjKzw.d.ts → types-Bvakbfeb.d.ts} +180 -8
- package/package.json +4 -4
- package/dist/chunk-47SC3EAI.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,69 +1,10 @@
|
|
|
1
|
+
import { ProofTarget, CircuitName, ProofStatement, ProvingRequest } from '@invisi-labs/prover';
|
|
1
2
|
import * as _invisi_labs_core from '@invisi-labs/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { Address, Hex, CreditDeliveryState, AuthorizedStatement, Note, ReceivingKeyLookup, PublicWallet } from '@invisi-labs/core';
|
|
4
|
+
import { F as FundingParams, D as Delivery, I as InputSource, C as CreateCreditParams, a as CancelCreditParams, b as CreditDrawParams, T as TopUpCreditParams, c as TransactRequest, d as CrossTreeTransactParams, S as ShieldParams, e as ShieldOutput } from './types-Bvakbfeb.cjs';
|
|
4
5
|
import { DeploymentContext, CanonicalBlock, ProtocolDeployment, ProtocolRpcClient } from '@invisi-labs/rpc';
|
|
5
6
|
export { CanonicalBlock, DeploymentContext, Membership, ProtocolDataProvider, ProtocolDataStatus, ProtocolUpdateRange, ProtocolUpdates } from '@invisi-labs/rpc';
|
|
6
|
-
import {
|
|
7
|
-
import { ProofTarget, CircuitName, ProofStatement, ProvingRequest } from '@invisi-labs/prover';
|
|
8
|
-
|
|
9
|
-
interface RegistryContext {
|
|
10
|
-
chainId: bigint;
|
|
11
|
-
registryAddress: Address;
|
|
12
|
-
/** Optional explicit wall-clock value in seconds. Equality with deadline is valid. */
|
|
13
|
-
now?: bigint;
|
|
14
|
-
}
|
|
15
|
-
interface RegistryReceivingKeys {
|
|
16
|
-
viewingPublicKey: Hex;
|
|
17
|
-
clueKey: Hex;
|
|
18
|
-
}
|
|
19
|
-
interface AddressRegistration {
|
|
20
|
-
/** Nonzero EVM owner: 20 bytes or canonical zero-padded bytes32. */
|
|
21
|
-
walletIdentity: Hex;
|
|
22
|
-
keys: RegistryReceivingKeys;
|
|
23
|
-
/** The current registry nonce expected for this operation. */
|
|
24
|
-
nonce: bigint;
|
|
25
|
-
deadline: bigint;
|
|
26
|
-
}
|
|
27
|
-
interface RegistrationOptions {
|
|
28
|
-
update?: boolean;
|
|
29
|
-
/** Check a separately obtained current nonce before authorizing or encoding. */
|
|
30
|
-
expectedNonce?: bigint;
|
|
31
|
-
}
|
|
32
|
-
interface RegistrationCalldata {
|
|
33
|
-
to: Address;
|
|
34
|
-
callData: Hex;
|
|
35
|
-
value: 0n;
|
|
36
|
-
}
|
|
37
|
-
/** Standard registry EIP-712 data, independent of private WalletAuthorization. */
|
|
38
|
-
declare function registrationTypedData(context: RegistryContext, registration: AddressRegistration, options?: RegistrationOptions): {
|
|
39
|
-
domain: {
|
|
40
|
-
name: string;
|
|
41
|
-
version: string;
|
|
42
|
-
chainId: bigint;
|
|
43
|
-
verifyingContract: `0x${string}`;
|
|
44
|
-
};
|
|
45
|
-
primaryType: string;
|
|
46
|
-
types: {
|
|
47
|
-
[x: string]: {
|
|
48
|
-
name: string;
|
|
49
|
-
type: string;
|
|
50
|
-
}[];
|
|
51
|
-
};
|
|
52
|
-
message: {
|
|
53
|
-
nonce: bigint;
|
|
54
|
-
deadline: bigint;
|
|
55
|
-
viewingPublicKey: Hex;
|
|
56
|
-
clueKey: Hex;
|
|
57
|
-
walletIdentity: string;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
declare function registrationDigest(context: RegistryContext, registration: AddressRegistration, options?: RegistrationOptions): Hex;
|
|
61
|
-
/** Encode an owner call (empty signature) or an EIP-712 / ERC-1271 authorized relay. */
|
|
62
|
-
declare function buildRegistrationCalldata(context: RegistryContext, registration: AddressRegistration, signature: Hex, options?: RegistrationOptions): RegistrationCalldata;
|
|
63
|
-
/** Ethers runner used for registry contract reads. */
|
|
64
|
-
type RegistryReadClient = ContractRunner;
|
|
65
|
-
/** One receivingKeysOf query per short address; RPC failures propagate unchanged. */
|
|
66
|
-
declare function createRegistryReceivingKeyLookup(client: RegistryReadClient, registryAddress: Address): ReceivingKeyLookup;
|
|
7
|
+
import { Provider, ContractRunner } from 'ethers';
|
|
67
8
|
|
|
68
9
|
interface TransactionContext extends DeploymentContext {
|
|
69
10
|
tokenAddress: Address;
|
|
@@ -108,6 +49,7 @@ declare const pad: (v: readonly bigint[], n: number) => bigint[];
|
|
|
108
49
|
/** Receipt/transport validation must not reject unrelated future wallet codecs. */
|
|
109
50
|
declare function normalizeOpaqueDelivery(value: Delivery, options?: {
|
|
110
51
|
empty?: boolean;
|
|
52
|
+
allowEmpty?: boolean;
|
|
111
53
|
}): Delivery;
|
|
112
54
|
declare const deliveriesHash: (v: readonly Delivery[]) => Hex;
|
|
113
55
|
declare function normalizeFunding(input?: FundingInput): FundingParams;
|
|
@@ -135,165 +77,7 @@ declare const fundingFields: readonly [{
|
|
|
135
77
|
readonly type: "uint256";
|
|
136
78
|
}];
|
|
137
79
|
|
|
138
|
-
|
|
139
|
-
address: Address;
|
|
140
|
-
data: Hex;
|
|
141
|
-
topics: readonly Hex[];
|
|
142
|
-
transactionHash: Hex;
|
|
143
|
-
logIndex: number;
|
|
144
|
-
}
|
|
145
|
-
interface CanonicalReceipt {
|
|
146
|
-
block: CanonicalBlock;
|
|
147
|
-
transactionHash: Hex;
|
|
148
|
-
logs: readonly ProtocolLog[];
|
|
149
|
-
status?: "success" | "reverted";
|
|
150
|
-
}
|
|
151
|
-
interface ChainReader {
|
|
152
|
-
getChainId(): Promise<bigint>;
|
|
153
|
-
/** Required when a selected deployment includes a receiving-key registry. */
|
|
154
|
-
getProtocolAddressRegistry?(address: Address): Promise<Address>;
|
|
155
|
-
getCode(address: Address): Promise<Hex>;
|
|
156
|
-
getBlock(number: bigint): Promise<CanonicalBlock>;
|
|
157
|
-
getLatestBlockNumber(): Promise<bigint>;
|
|
158
|
-
getFundingNonce(context: DeploymentContext, payer: Address, block: CanonicalBlock): Promise<bigint>;
|
|
159
|
-
isKnownRoot(context: DeploymentContext, treeId: bigint, root: Hex, block: CanonicalBlock): Promise<boolean>;
|
|
160
|
-
getTransaction(hash: Hex): Promise<(TransactionCall & {
|
|
161
|
-
transactionHash: Hex;
|
|
162
|
-
from: Address;
|
|
163
|
-
nonce: bigint;
|
|
164
|
-
}) | null>;
|
|
165
|
-
getReceipt(hash: Hex): Promise<CanonicalReceipt | null>;
|
|
166
|
-
isSpent(context: DeploymentContext, nullifiers: readonly Hex[], block: CanonicalBlock): Promise<readonly boolean[]>;
|
|
167
|
-
}
|
|
168
|
-
interface TransactionCall {
|
|
169
|
-
to: Address;
|
|
170
|
-
data: Hex;
|
|
171
|
-
value: bigint;
|
|
172
|
-
}
|
|
173
|
-
/** Optional deployment provenance queries, independent of token policy. */
|
|
174
|
-
interface FactoryReader {
|
|
175
|
-
getFactoryInstanceAddress(factory: Address, salt: Hex): Promise<Address>;
|
|
176
|
-
isFactoryInstance(factory: Address, instance: Address): Promise<boolean>;
|
|
177
|
-
getInstanceFactory(instance: Address): Promise<Address>;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
interface RegistryReader extends Pick<ChainReader, "getChainId" | "getCode" | "getBlock" | "getLatestBlockNumber" | "getTransaction" | "getReceipt"> {
|
|
181
|
-
/** Validate arbitrary ERC-1271 bytes for a contract owner; transport errors propagate. */
|
|
182
|
-
isValidRegistrationSignature?(owner: Address, digest: Hex, signature: Hex): Promise<boolean>;
|
|
183
|
-
getRegistryNonce(context: RegistryContext, walletIdentity: Hex, block: CanonicalBlock): Promise<bigint>;
|
|
184
|
-
}
|
|
185
|
-
interface RegistrationPreparation {
|
|
186
|
-
wallet: PublicWallet;
|
|
187
|
-
reader: RegistryReader;
|
|
188
|
-
deadline?: bigint;
|
|
189
|
-
update?: boolean;
|
|
190
|
-
}
|
|
191
|
-
type RegistrationStatus = "prepared" | "ready" | "submitted" | "confirmed" | "uncertain" | "failed" | "expired" | "reorged";
|
|
192
|
-
declare class RegistrationOperation {
|
|
193
|
-
#private;
|
|
194
|
-
readonly status: RegistrationStatus;
|
|
195
|
-
private constructor();
|
|
196
|
-
static prepare(registry: AddressRegistry, options: RegistrationPreparation): Promise<RegistrationOperation>;
|
|
197
|
-
get id(): string;
|
|
198
|
-
preview(): {
|
|
199
|
-
update: boolean;
|
|
200
|
-
walletIdentity: Hex;
|
|
201
|
-
keys: RegistryReceivingKeys;
|
|
202
|
-
nonce: bigint;
|
|
203
|
-
deadline: bigint;
|
|
204
|
-
id: string;
|
|
205
|
-
status: RegistrationStatus;
|
|
206
|
-
chainId: bigint;
|
|
207
|
-
registryAddress: `0x${string}`;
|
|
208
|
-
};
|
|
209
|
-
/** Export portable EIP-712 data for external signing. */
|
|
210
|
-
exportRegistrationAuthorization(options?: {
|
|
211
|
-
signal?: AbortSignal;
|
|
212
|
-
}): Promise<_invisi_labs_core.SigningRequest>;
|
|
213
|
-
/** Validate and attach an independently obtained EOA or ERC-1271 signature. */
|
|
214
|
-
withSignature(signature: string, options?: {
|
|
215
|
-
signal?: AbortSignal;
|
|
216
|
-
}): Promise<RegistrationOperation>;
|
|
217
|
-
/** Empty signatures require the transaction sender to be the wallet owner. */
|
|
218
|
-
authorizeDirect(): Promise<RegistrationOperation>;
|
|
219
|
-
typedData(): {
|
|
220
|
-
domain: {
|
|
221
|
-
name: string;
|
|
222
|
-
version: string;
|
|
223
|
-
chainId: bigint;
|
|
224
|
-
verifyingContract: `0x${string}`;
|
|
225
|
-
};
|
|
226
|
-
primaryType: string;
|
|
227
|
-
types: {
|
|
228
|
-
[x: string]: {
|
|
229
|
-
name: string;
|
|
230
|
-
type: string;
|
|
231
|
-
}[];
|
|
232
|
-
};
|
|
233
|
-
message: {
|
|
234
|
-
nonce: bigint;
|
|
235
|
-
deadline: bigint;
|
|
236
|
-
viewingPublicKey: Hex;
|
|
237
|
-
clueKey: Hex;
|
|
238
|
-
walletIdentity: string;
|
|
239
|
-
};
|
|
240
|
-
};
|
|
241
|
-
private call;
|
|
242
|
-
exportTransaction(): Promise<TransactionCall>;
|
|
243
|
-
private validateFreshness;
|
|
244
|
-
/** Associate a signed/broadcast transaction; ethers owns sending and receipt waiting. */
|
|
245
|
-
trackTransaction(transactionHash: string): RegistrationOperation;
|
|
246
|
-
reconcile(options?: {
|
|
247
|
-
transactionHash?: Hex;
|
|
248
|
-
signal?: AbortSignal;
|
|
249
|
-
}): Promise<RegistrationOperation>;
|
|
250
|
-
toJSON(): {
|
|
251
|
-
id: string;
|
|
252
|
-
kind: string;
|
|
253
|
-
status: RegistrationStatus;
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
interface AddressRegistryOptions {
|
|
258
|
-
lookup?: ReceivingKeyLookup;
|
|
259
|
-
expectedRuntimeCodeHash?: Hex;
|
|
260
|
-
}
|
|
261
|
-
/** Independent registry deployment and nonce domain, selected by the application. */
|
|
262
|
-
declare class AddressRegistry {
|
|
263
|
-
#private;
|
|
264
|
-
readonly context: Readonly<RegistryContext>;
|
|
265
|
-
readonly expectedRuntimeCodeHash: Hex | undefined;
|
|
266
|
-
constructor(context: RegistryContext, options?: AddressRegistryOptions);
|
|
267
|
-
validateDeployment(reader: Pick<RegistryReader, "getChainId" | "getCode">): Promise<void>;
|
|
268
|
-
prepareRegistration(options: RegistrationPreparation): Promise<RegistrationOperation>;
|
|
269
|
-
resolve(address: string): Promise<string>;
|
|
270
|
-
typedData(registration: AddressRegistration, options?: RegistrationOptions): {
|
|
271
|
-
domain: {
|
|
272
|
-
name: string;
|
|
273
|
-
version: string;
|
|
274
|
-
chainId: bigint;
|
|
275
|
-
verifyingContract: `0x${string}`;
|
|
276
|
-
};
|
|
277
|
-
primaryType: string;
|
|
278
|
-
types: {
|
|
279
|
-
[x: string]: {
|
|
280
|
-
name: string;
|
|
281
|
-
type: string;
|
|
282
|
-
}[];
|
|
283
|
-
};
|
|
284
|
-
message: {
|
|
285
|
-
nonce: bigint;
|
|
286
|
-
deadline: bigint;
|
|
287
|
-
viewingPublicKey: Hex;
|
|
288
|
-
clueKey: Hex;
|
|
289
|
-
walletIdentity: string;
|
|
290
|
-
};
|
|
291
|
-
};
|
|
292
|
-
digest(registration: AddressRegistration, options?: RegistrationOptions): `0x${string}`;
|
|
293
|
-
buildCall(registration: AddressRegistration, signature: `0x${string}`, options?: RegistrationOptions): RegistrationCalldata;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
declare const CREATE_CREDIT_FIELDS: readonly ["token", "sources", "nullifiers", "creditCommitment", "changeCommitment", "owner", "expiry", "deadline"];
|
|
80
|
+
declare const CREATE_CREDIT_FIELDS: readonly ["token", "sources", "nullifiers", "creditCommitment", "changeCommitment", "owner", "expiry", "deadline", "feeRecipient", "feeAmount"];
|
|
297
81
|
/** Public checks cannot establish ownership or conservation: those are enforced by the proof. */
|
|
298
82
|
declare function validateCreateCreditRequest(c: TransactionContext, p: CreateCreditParams, cs: readonly Delivery[], funding?: FundingInput): {
|
|
299
83
|
sources: {
|
|
@@ -310,6 +94,8 @@ declare function validateCreateCreditRequest(c: TransactionContext, p: CreateCre
|
|
|
310
94
|
deadline: bigint;
|
|
311
95
|
deliveries: Delivery[];
|
|
312
96
|
funding: FundingParams;
|
|
97
|
+
feeRecipient: `0x${string}`;
|
|
98
|
+
feeAmount: bigint;
|
|
313
99
|
chainId: bigint;
|
|
314
100
|
protocolAddress: Hex;
|
|
315
101
|
tokenAddress: Hex;
|
|
@@ -436,6 +222,8 @@ declare function validateCancelCreditRequest(c: TransactionContext, p: CancelCre
|
|
|
436
222
|
owner: `0x${string}`;
|
|
437
223
|
amount: bigint;
|
|
438
224
|
deadline: bigint;
|
|
225
|
+
feeRecipient: `0x${string}`;
|
|
226
|
+
feeAmount: bigint;
|
|
439
227
|
chainId: bigint;
|
|
440
228
|
protocolAddress: Hex;
|
|
441
229
|
tokenAddress: Hex;
|
|
@@ -459,6 +247,8 @@ declare function validateTopUpCreditRequest(c: TransactionContext, p: TopUpCredi
|
|
|
459
247
|
deadline: bigint;
|
|
460
248
|
deliveries: Delivery[];
|
|
461
249
|
funding: FundingParams;
|
|
250
|
+
feeRecipient: `0x${string}`;
|
|
251
|
+
feeAmount: bigint;
|
|
462
252
|
chainId: bigint;
|
|
463
253
|
protocolAddress: Hex;
|
|
464
254
|
tokenAddress: Hex;
|
|
@@ -610,63 +400,26 @@ declare function buildTopUpCreditCalldata(p: BuildTopUpCreditCalldataParams): {
|
|
|
610
400
|
approveAmount: bigint;
|
|
611
401
|
};
|
|
612
402
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
type TransactRequestParams = CrossTreeTransactParams;
|
|
617
|
-
declare function normalizeTransactRequest(c: TransactionContext, p: TransactRequestParams, cs: readonly Delivery[], funding?: FundingInput): {
|
|
618
|
-
capacity: 112 | 14 | 56 | 168;
|
|
619
|
-
sources: {
|
|
620
|
-
treeId: bigint;
|
|
621
|
-
merkleRoot: `0x${string}`;
|
|
622
|
-
}[];
|
|
623
|
-
nullifiers: `0x${string}`[];
|
|
624
|
-
outputCommitments: `0x${string}`[];
|
|
625
|
-
inputCount: number;
|
|
626
|
-
outputCount: number;
|
|
627
|
-
sourceCount: number;
|
|
628
|
-
inputTreeIds: bigint[];
|
|
629
|
-
merkleRoots: bigint[];
|
|
630
|
-
slotValues: bigint[];
|
|
631
|
-
deliveries: Delivery[];
|
|
632
|
-
deliveriesHash: `0x${string}`;
|
|
633
|
-
withdrawalAddress: `0x${string}`;
|
|
634
|
-
withdrawalAmount: bigint;
|
|
635
|
-
deadline: bigint;
|
|
636
|
-
depositAmount: bigint;
|
|
637
|
-
depositPayer: `0x${string}`;
|
|
638
|
-
funding: FundingParams;
|
|
639
|
-
chainId: bigint;
|
|
640
|
-
protocolAddress: Hex;
|
|
641
|
-
tokenAddress: Hex;
|
|
642
|
-
now?: bigint;
|
|
643
|
-
timestamp?: bigint;
|
|
644
|
-
};
|
|
645
|
-
declare function transactPublicInputs(c: TransactionContext, p: TransactRequestParams, cs: readonly Delivery[], f?: FundingInput): `0x${string}`[];
|
|
646
|
-
declare function encodeTransactTypedData(c: TransactionContext, p: TransactRequestParams, deliveries: readonly Delivery[], f?: FundingInput): {
|
|
647
|
-
domain: {
|
|
648
|
-
name: string;
|
|
649
|
-
version: string;
|
|
650
|
-
chainId: bigint;
|
|
651
|
-
verifyingContract: `0x${string}`;
|
|
652
|
-
};
|
|
653
|
-
types: {
|
|
654
|
-
readonly WalletAuthorization: readonly [{
|
|
655
|
-
readonly name: "operation";
|
|
656
|
-
readonly type: "bytes32";
|
|
657
|
-
}, {
|
|
658
|
-
readonly name: "statementHash";
|
|
659
|
-
readonly type: "bytes32";
|
|
660
|
-
}];
|
|
661
|
-
};
|
|
662
|
-
primaryType: "WalletAuthorization";
|
|
663
|
-
message: {
|
|
664
|
-
operation: `0x${string}`;
|
|
665
|
-
statementHash: `0x${string}`;
|
|
403
|
+
interface BuildTransactAggregateCalldataParams {
|
|
404
|
+
context: DeploymentContext & {
|
|
405
|
+
now?: bigint;
|
|
666
406
|
};
|
|
407
|
+
proof: Hex;
|
|
408
|
+
requests: readonly TransactRequest[];
|
|
409
|
+
caller?: Address;
|
|
410
|
+
}
|
|
411
|
+
declare function buildTransactAggregateCalldata(p: BuildTransactAggregateCalldataParams): {
|
|
412
|
+
data: Hex;
|
|
413
|
+
capacity: 14;
|
|
667
414
|
};
|
|
668
|
-
|
|
669
|
-
|
|
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): {
|
|
670
423
|
domain: {
|
|
671
424
|
name: string;
|
|
672
425
|
version: string;
|
|
@@ -700,6 +453,43 @@ declare function encodeTransactFundingTypedData(c: TransactionContext, proof: He
|
|
|
700
453
|
deadline: bigint;
|
|
701
454
|
};
|
|
702
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
|
+
|
|
703
493
|
interface BuildTransactCalldataParams {
|
|
704
494
|
context: TransactionContext;
|
|
705
495
|
proof: Hex;
|
|
@@ -710,21 +500,10 @@ interface BuildTransactCalldataParams {
|
|
|
710
500
|
}
|
|
711
501
|
declare function buildTransactCalldata(p: BuildTransactCalldataParams): {
|
|
712
502
|
data: `0x${string}`;
|
|
713
|
-
capacity:
|
|
503
|
+
capacity: 14 | 56 | 112 | 168;
|
|
714
504
|
approveAmount: bigint;
|
|
715
505
|
};
|
|
716
|
-
|
|
717
|
-
context: DeploymentContext & {
|
|
718
|
-
now?: bigint;
|
|
719
|
-
};
|
|
720
|
-
proof: Hex;
|
|
721
|
-
requests: readonly TransactRequest[];
|
|
722
|
-
caller?: Address;
|
|
723
|
-
}
|
|
724
|
-
declare function buildTransactAggregateCalldata(p: BuildTransactAggregateCalldataParams): {
|
|
725
|
-
data: Hex;
|
|
726
|
-
capacity: 14;
|
|
727
|
-
};
|
|
506
|
+
|
|
728
507
|
interface BuildShieldCalldataParams {
|
|
729
508
|
context: TransactionContext;
|
|
730
509
|
params: ShieldParams;
|
|
@@ -734,7 +513,6 @@ interface BuildShieldCalldataParams {
|
|
|
734
513
|
caller?: Address;
|
|
735
514
|
}
|
|
736
515
|
declare function validateShieldRequest(p: BuildShieldCalldataParams): Promise<FundingParams>;
|
|
737
|
-
declare function shieldFundingRequestHash(params: ShieldParams, outputs: readonly ShieldOutput[], cs: readonly Delivery[]): Hex;
|
|
738
516
|
declare function encodeShieldFundingTypedData(p: BuildShieldCalldataParams): Promise<{
|
|
739
517
|
domain: {
|
|
740
518
|
name: string;
|
|
@@ -773,49 +551,49 @@ declare function buildShieldCalldata(p: BuildShieldCalldataParams): Promise<{
|
|
|
773
551
|
data: Hex;
|
|
774
552
|
approveAmount: bigint;
|
|
775
553
|
}>;
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
}
|
|
554
|
+
declare function shieldFundingRequestHash(params: ShieldParams, outputs: readonly ShieldOutput[], cs: readonly Delivery[]): Hex;
|
|
555
|
+
|
|
556
|
+
interface ProtocolLog {
|
|
557
|
+
address: Address;
|
|
558
|
+
data: Hex;
|
|
559
|
+
topics: readonly Hex[];
|
|
560
|
+
transactionHash: Hex;
|
|
561
|
+
logIndex: number;
|
|
562
|
+
}
|
|
563
|
+
interface CanonicalReceipt {
|
|
564
|
+
block: CanonicalBlock;
|
|
565
|
+
transactionHash: Hex;
|
|
566
|
+
logs: readonly ProtocolLog[];
|
|
567
|
+
status?: "success" | "reverted";
|
|
568
|
+
}
|
|
569
|
+
interface ChainReader {
|
|
570
|
+
getChainId(): Promise<bigint>;
|
|
571
|
+
/** Required when a selected deployment includes a receiving-key registry. */
|
|
572
|
+
getProtocolAddressRegistry?(address: Address): Promise<Address>;
|
|
573
|
+
getCode(address: Address): Promise<Hex>;
|
|
574
|
+
getBlock(number: bigint): Promise<CanonicalBlock>;
|
|
575
|
+
getLatestBlockNumber(): Promise<bigint>;
|
|
576
|
+
getFundingNonce(context: DeploymentContext, payer: Address, block: CanonicalBlock): Promise<bigint>;
|
|
577
|
+
isKnownRoot(context: DeploymentContext, treeId: bigint, root: Hex, block: CanonicalBlock): Promise<boolean>;
|
|
578
|
+
getTransaction(hash: Hex): Promise<(TransactionCall & {
|
|
579
|
+
transactionHash: Hex;
|
|
580
|
+
from: Address;
|
|
581
|
+
nonce: bigint;
|
|
582
|
+
}) | null>;
|
|
583
|
+
getReceipt(hash: Hex): Promise<CanonicalReceipt | null>;
|
|
584
|
+
isSpent(context: DeploymentContext, nullifiers: readonly Hex[], block: CanonicalBlock): Promise<readonly boolean[]>;
|
|
585
|
+
}
|
|
586
|
+
interface TransactionCall {
|
|
587
|
+
to: Address;
|
|
588
|
+
data: Hex;
|
|
589
|
+
value: bigint;
|
|
590
|
+
}
|
|
591
|
+
/** Optional deployment provenance queries, independent of token policy. */
|
|
592
|
+
interface FactoryReader {
|
|
593
|
+
getFactoryInstanceAddress(factory: Address, salt: Hex): Promise<Address>;
|
|
594
|
+
isFactoryInstance(factory: Address, instance: Address): Promise<boolean>;
|
|
595
|
+
getInstanceFactory(instance: Address): Promise<Address>;
|
|
596
|
+
}
|
|
819
597
|
|
|
820
598
|
interface TokenProtocolOptions {
|
|
821
599
|
expectedRuntimeCodeHash?: Hex;
|
|
@@ -830,7 +608,7 @@ declare class TokenProtocol {
|
|
|
830
608
|
}): Promise<void>;
|
|
831
609
|
transact(request: Omit<BuildTransactCalldataParams, "context">): {
|
|
832
610
|
data: `0x${string}`;
|
|
833
|
-
capacity:
|
|
611
|
+
capacity: 14 | 56 | 112 | 168;
|
|
834
612
|
approveAmount: bigint;
|
|
835
613
|
to: `0x${string}`;
|
|
836
614
|
value: bigint;
|
|
@@ -873,62 +651,6 @@ declare class TokenProtocol {
|
|
|
873
651
|
};
|
|
874
652
|
}
|
|
875
653
|
|
|
876
|
-
interface ProtocolOptions {
|
|
877
|
-
deployment: ProtocolDeployment;
|
|
878
|
-
}
|
|
879
|
-
/** A multi-token deployment. Asset support is always read from the chain. */
|
|
880
|
-
declare class Protocol {
|
|
881
|
-
readonly deployment: Readonly<ProtocolDeployment>;
|
|
882
|
-
readonly context: Readonly<DeploymentContext>;
|
|
883
|
-
constructor(options: ProtocolOptions);
|
|
884
|
-
/** Load the selected deployment and verify its contract against Chain RPC before returning. */
|
|
885
|
-
static fromRpc(rpc: Pick<ProtocolRpcClient, "getDeployment">, provider: Provider, options?: {
|
|
886
|
-
signal?: AbortSignal;
|
|
887
|
-
}): Promise<Protocol>;
|
|
888
|
-
validateDeployment(connection: Provider | (Pick<ChainReader, "getChainId" | "getCode"> & {
|
|
889
|
-
getProtocolVersion?(address: Address): Promise<bigint>;
|
|
890
|
-
getProtocolAddressRegistry?(address: Address): Promise<Address>;
|
|
891
|
-
})): Promise<void>;
|
|
892
|
-
aggregate(request: Omit<BuildTransactAggregateCalldataParams, "context">): {
|
|
893
|
-
data: Hex;
|
|
894
|
-
capacity: 14;
|
|
895
|
-
to: `0x${string}`;
|
|
896
|
-
value: bigint;
|
|
897
|
-
};
|
|
898
|
-
/** Build an operation context for one asset within this same deployment. */
|
|
899
|
-
forToken(tokenAddress: Address): TokenProtocol;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
interface VerifyNoteCommitmentParams {
|
|
903
|
-
walletIdentity: `0x${string}`;
|
|
904
|
-
tokenAddress: `0x${string}`;
|
|
905
|
-
amount: bigint;
|
|
906
|
-
nonce: `0x${string}`;
|
|
907
|
-
noteCommitment: `0x${string}`;
|
|
908
|
-
chainId: bigint;
|
|
909
|
-
}
|
|
910
|
-
declare function verifyNoteCommitment(params: VerifyNoteCommitmentParams): Promise<boolean>;
|
|
911
|
-
interface VerifyCreditCommitmentParams extends Partial<_invisi_labs_core.CreditPolicy> {
|
|
912
|
-
chainId: bigint;
|
|
913
|
-
spenderWalletIdentity: `0x${string}`;
|
|
914
|
-
ownerWalletIdentity: `0x${string}`;
|
|
915
|
-
spenderPayout: `0x${string}`;
|
|
916
|
-
ownerPayout: `0x${string}`;
|
|
917
|
-
tokenAddress: `0x${string}`;
|
|
918
|
-
amount: bigint;
|
|
919
|
-
nonce: bigint;
|
|
920
|
-
expiry: bigint;
|
|
921
|
-
creditSharedKey: bigint;
|
|
922
|
-
/** Server-returned value to verify against the locally recomputed commitment. */
|
|
923
|
-
creditCommitment: `0x${string}`;
|
|
924
|
-
}
|
|
925
|
-
/**
|
|
926
|
-
* Hashes the received shared key locally, recomputes the Credit leaf and compares it to the
|
|
927
|
-
* server-returned value. A mismatch means the server folded a wrong nonce
|
|
928
|
-
* (or other parameter) — the caller MUST abort and not create a Credit.
|
|
929
|
-
*/
|
|
930
|
-
declare function verifyCreditCommitment(params: VerifyCreditCommitmentParams): Promise<boolean>;
|
|
931
|
-
|
|
932
654
|
interface NoteMembership {
|
|
933
655
|
note: Note;
|
|
934
656
|
treeId: bigint;
|
|
@@ -943,7 +665,11 @@ interface CreditMembership {
|
|
|
943
665
|
}
|
|
944
666
|
interface TransactWitnessParams extends Omit<BuildTransactCalldataParams, "proof" | "context"> {
|
|
945
667
|
inputs: readonly NoteMembership[];
|
|
946
|
-
outputs: readonly Note
|
|
668
|
+
outputs: readonly (Note | {
|
|
669
|
+
identity: Hex;
|
|
670
|
+
amount: bigint;
|
|
671
|
+
note?: Note;
|
|
672
|
+
})[];
|
|
947
673
|
authorization?: AuthorizedStatement;
|
|
948
674
|
target?: ProofTarget;
|
|
949
675
|
}
|
|
@@ -974,25 +700,311 @@ interface TopUpCreditWitnessParams extends Omit<CreateCreditWitnessParams, "para
|
|
|
974
700
|
params: TopUpCreditParams;
|
|
975
701
|
previous: CreditMembership;
|
|
976
702
|
}
|
|
977
|
-
|
|
703
|
+
|
|
704
|
+
/** Assemble witnesses through operation-specific builders with shared validation. */
|
|
978
705
|
declare class WitnessBuilder {
|
|
979
706
|
#private;
|
|
980
707
|
constructor(protocol: TokenProtocol);
|
|
981
708
|
static statement(circuitName: CircuitName, expectedPublicInputs: readonly Hex[], target?: ProofTarget): ProofStatement;
|
|
982
|
-
private context;
|
|
983
|
-
private authority;
|
|
984
|
-
private membership;
|
|
985
|
-
private noteLeaf;
|
|
986
|
-
private creditLeaf;
|
|
987
|
-
private noteInputs;
|
|
988
709
|
transact(p: TransactWitnessParams): Promise<ProvingRequest>;
|
|
989
|
-
private creation;
|
|
990
710
|
createCredit(p: CreateCreditWitnessParams): Promise<ProvingRequest>;
|
|
991
711
|
cancelCredit(p: CancelCreditWitnessParams): Promise<ProvingRequest>;
|
|
992
712
|
drawCredit(p: DrawCreditWitnessParams): Promise<ProvingRequest>;
|
|
993
713
|
topUpCredit(p: TopUpCreditWitnessParams): Promise<ProvingRequest>;
|
|
994
714
|
}
|
|
995
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
|
+
interface RegistryContext {
|
|
804
|
+
chainId: bigint;
|
|
805
|
+
registryAddress: Address;
|
|
806
|
+
/** Optional explicit wall-clock value in seconds. Equality with deadline is valid. */
|
|
807
|
+
now?: bigint;
|
|
808
|
+
}
|
|
809
|
+
interface RegistryReceivingKeys {
|
|
810
|
+
viewingPublicKey: Hex;
|
|
811
|
+
clueKey: Hex;
|
|
812
|
+
}
|
|
813
|
+
interface AddressRegistration {
|
|
814
|
+
/** Nonzero EVM owner: 20 bytes or canonical zero-padded bytes32. */
|
|
815
|
+
ownerAddress: Hex;
|
|
816
|
+
keys: RegistryReceivingKeys;
|
|
817
|
+
/** The current registry nonce expected for this operation. */
|
|
818
|
+
nonce: bigint;
|
|
819
|
+
deadline: bigint;
|
|
820
|
+
}
|
|
821
|
+
interface RegistrationOptions {
|
|
822
|
+
update?: boolean;
|
|
823
|
+
/** Check a separately obtained current nonce before authorizing or encoding. */
|
|
824
|
+
expectedNonce?: bigint;
|
|
825
|
+
}
|
|
826
|
+
interface RegistrationCalldata {
|
|
827
|
+
to: Address;
|
|
828
|
+
callData: Hex;
|
|
829
|
+
value: 0n;
|
|
830
|
+
}
|
|
831
|
+
/** Standard registry EIP-712 data, independent of private WalletAuthorization. */
|
|
832
|
+
declare function registrationTypedData(context: RegistryContext, registration: AddressRegistration, options?: RegistrationOptions): {
|
|
833
|
+
domain: {
|
|
834
|
+
name: string;
|
|
835
|
+
version: string;
|
|
836
|
+
chainId: bigint;
|
|
837
|
+
verifyingContract: `0x${string}`;
|
|
838
|
+
};
|
|
839
|
+
primaryType: string;
|
|
840
|
+
types: {
|
|
841
|
+
[x: string]: {
|
|
842
|
+
name: string;
|
|
843
|
+
type: string;
|
|
844
|
+
}[];
|
|
845
|
+
};
|
|
846
|
+
message: {
|
|
847
|
+
nonce: bigint;
|
|
848
|
+
deadline: bigint;
|
|
849
|
+
viewingPublicKey: Hex;
|
|
850
|
+
clueKey: Hex;
|
|
851
|
+
walletIdentity: string;
|
|
852
|
+
};
|
|
853
|
+
};
|
|
854
|
+
declare function registrationDigest(context: RegistryContext, registration: AddressRegistration, options?: RegistrationOptions): Hex;
|
|
855
|
+
/** Encode an owner call (empty signature) or an EIP-712 / ERC-1271 authorized relay. */
|
|
856
|
+
declare function buildRegistrationCalldata(context: RegistryContext, registration: AddressRegistration, signature: Hex, options?: RegistrationOptions): RegistrationCalldata;
|
|
857
|
+
/** Ethers runner used for registry contract reads. */
|
|
858
|
+
type RegistryReadClient = ContractRunner;
|
|
859
|
+
/** One receivingKeysOf query per short address; RPC failures propagate unchanged. */
|
|
860
|
+
declare function createRegistryReceivingKeyLookup(client: RegistryReadClient, registryAddress: Address): ReceivingKeyLookup;
|
|
861
|
+
|
|
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
|
+
interface VerifyNoteCommitmentParams {
|
|
979
|
+
ownerAddress: `0x${string}`;
|
|
980
|
+
tokenAddress: `0x${string}`;
|
|
981
|
+
amount: bigint;
|
|
982
|
+
nonce: `0x${string}`;
|
|
983
|
+
noteCommitment: `0x${string}`;
|
|
984
|
+
chainId: bigint;
|
|
985
|
+
}
|
|
986
|
+
declare function verifyNoteCommitment(params: VerifyNoteCommitmentParams): Promise<boolean>;
|
|
987
|
+
interface VerifyCreditCommitmentParams extends Partial<_invisi_labs_core.CreditPolicy> {
|
|
988
|
+
chainId: bigint;
|
|
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. */
|
|
999
|
+
creditCommitment: `0x${string}`;
|
|
1000
|
+
}
|
|
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>;
|
|
1007
|
+
|
|
996
1008
|
/**
|
|
997
1009
|
* Query the selected factory. The caller still verifies the returned deployment profile.
|
|
998
1010
|
* Calls `factory.getInstanceAddress(salt)` on-chain.
|