@invisi-labs/protocol 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/contracts.d.cts +1 -1
- package/dist/contracts.d.ts +1 -1
- package/dist/index.cjs +6566 -6496
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +397 -398
- package/dist/index.d.ts +397 -398
- package/dist/index.js +2228 -2153
- package/dist/index.js.map +1 -1
- package/dist/{types-BmUlasOg.d.cts → types-Bvakbfeb.d.cts} +1 -1
- package/dist/{types-BmUlasOg.d.ts → types-Bvakbfeb.d.ts} +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
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.js';
|
|
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
|
-
ownerAddress: 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;
|
|
@@ -136,164 +77,6 @@ declare const fundingFields: readonly [{
|
|
|
136
77
|
readonly type: "uint256";
|
|
137
78
|
}];
|
|
138
79
|
|
|
139
|
-
interface ProtocolLog {
|
|
140
|
-
address: Address;
|
|
141
|
-
data: Hex;
|
|
142
|
-
topics: readonly Hex[];
|
|
143
|
-
transactionHash: Hex;
|
|
144
|
-
logIndex: number;
|
|
145
|
-
}
|
|
146
|
-
interface CanonicalReceipt {
|
|
147
|
-
block: CanonicalBlock;
|
|
148
|
-
transactionHash: Hex;
|
|
149
|
-
logs: readonly ProtocolLog[];
|
|
150
|
-
status?: "success" | "reverted";
|
|
151
|
-
}
|
|
152
|
-
interface ChainReader {
|
|
153
|
-
getChainId(): Promise<bigint>;
|
|
154
|
-
/** Required when a selected deployment includes a receiving-key registry. */
|
|
155
|
-
getProtocolAddressRegistry?(address: Address): Promise<Address>;
|
|
156
|
-
getCode(address: Address): Promise<Hex>;
|
|
157
|
-
getBlock(number: bigint): Promise<CanonicalBlock>;
|
|
158
|
-
getLatestBlockNumber(): Promise<bigint>;
|
|
159
|
-
getFundingNonce(context: DeploymentContext, payer: Address, block: CanonicalBlock): Promise<bigint>;
|
|
160
|
-
isKnownRoot(context: DeploymentContext, treeId: bigint, root: Hex, block: CanonicalBlock): Promise<boolean>;
|
|
161
|
-
getTransaction(hash: Hex): Promise<(TransactionCall & {
|
|
162
|
-
transactionHash: Hex;
|
|
163
|
-
from: Address;
|
|
164
|
-
nonce: bigint;
|
|
165
|
-
}) | null>;
|
|
166
|
-
getReceipt(hash: Hex): Promise<CanonicalReceipt | null>;
|
|
167
|
-
isSpent(context: DeploymentContext, nullifiers: readonly Hex[], block: CanonicalBlock): Promise<readonly boolean[]>;
|
|
168
|
-
}
|
|
169
|
-
interface TransactionCall {
|
|
170
|
-
to: Address;
|
|
171
|
-
data: Hex;
|
|
172
|
-
value: bigint;
|
|
173
|
-
}
|
|
174
|
-
/** Optional deployment provenance queries, independent of token policy. */
|
|
175
|
-
interface FactoryReader {
|
|
176
|
-
getFactoryInstanceAddress(factory: Address, salt: Hex): Promise<Address>;
|
|
177
|
-
isFactoryInstance(factory: Address, instance: Address): Promise<boolean>;
|
|
178
|
-
getInstanceFactory(instance: Address): Promise<Address>;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
interface RegistryReader extends Pick<ChainReader, "getChainId" | "getCode" | "getBlock" | "getLatestBlockNumber" | "getTransaction" | "getReceipt"> {
|
|
182
|
-
/** Validate arbitrary ERC-1271 bytes for a contract owner; transport errors propagate. */
|
|
183
|
-
isValidRegistrationSignature?(owner: Address, digest: Hex, signature: Hex): Promise<boolean>;
|
|
184
|
-
getRegistryNonce(context: RegistryContext, ownerAddress: Hex, block: CanonicalBlock): Promise<bigint>;
|
|
185
|
-
}
|
|
186
|
-
interface RegistrationPreparation {
|
|
187
|
-
wallet: PublicWallet;
|
|
188
|
-
reader: RegistryReader;
|
|
189
|
-
deadline?: bigint;
|
|
190
|
-
update?: boolean;
|
|
191
|
-
}
|
|
192
|
-
type RegistrationStatus = "prepared" | "ready" | "submitted" | "confirmed" | "uncertain" | "failed" | "expired" | "reorged";
|
|
193
|
-
declare class RegistrationOperation {
|
|
194
|
-
#private;
|
|
195
|
-
readonly status: RegistrationStatus;
|
|
196
|
-
private constructor();
|
|
197
|
-
static prepare(registry: AddressRegistry, options: RegistrationPreparation): Promise<RegistrationOperation>;
|
|
198
|
-
get id(): string;
|
|
199
|
-
preview(): {
|
|
200
|
-
update: boolean;
|
|
201
|
-
ownerAddress: Hex;
|
|
202
|
-
keys: RegistryReceivingKeys;
|
|
203
|
-
nonce: bigint;
|
|
204
|
-
deadline: bigint;
|
|
205
|
-
id: string;
|
|
206
|
-
status: RegistrationStatus;
|
|
207
|
-
chainId: bigint;
|
|
208
|
-
registryAddress: `0x${string}`;
|
|
209
|
-
};
|
|
210
|
-
/** Export portable EIP-712 data for external signing. */
|
|
211
|
-
exportRegistrationAuthorization(options?: {
|
|
212
|
-
signal?: AbortSignal;
|
|
213
|
-
}): Promise<_invisi_labs_core.SigningRequest>;
|
|
214
|
-
/** Validate and attach an independently obtained EOA or ERC-1271 signature. */
|
|
215
|
-
withSignature(signature: string, options?: {
|
|
216
|
-
signal?: AbortSignal;
|
|
217
|
-
}): Promise<RegistrationOperation>;
|
|
218
|
-
/** Empty signatures require the transaction sender to be the wallet owner. */
|
|
219
|
-
authorizeDirect(): Promise<RegistrationOperation>;
|
|
220
|
-
typedData(): {
|
|
221
|
-
domain: {
|
|
222
|
-
name: string;
|
|
223
|
-
version: string;
|
|
224
|
-
chainId: bigint;
|
|
225
|
-
verifyingContract: `0x${string}`;
|
|
226
|
-
};
|
|
227
|
-
primaryType: string;
|
|
228
|
-
types: {
|
|
229
|
-
[x: string]: {
|
|
230
|
-
name: string;
|
|
231
|
-
type: string;
|
|
232
|
-
}[];
|
|
233
|
-
};
|
|
234
|
-
message: {
|
|
235
|
-
nonce: bigint;
|
|
236
|
-
deadline: bigint;
|
|
237
|
-
viewingPublicKey: Hex;
|
|
238
|
-
clueKey: Hex;
|
|
239
|
-
walletIdentity: string;
|
|
240
|
-
};
|
|
241
|
-
};
|
|
242
|
-
private call;
|
|
243
|
-
exportTransaction(): Promise<TransactionCall>;
|
|
244
|
-
private validateFreshness;
|
|
245
|
-
/** Associate a signed/broadcast transaction; ethers owns sending and receipt waiting. */
|
|
246
|
-
trackTransaction(transactionHash: string): RegistrationOperation;
|
|
247
|
-
reconcile(options?: {
|
|
248
|
-
transactionHash?: Hex;
|
|
249
|
-
signal?: AbortSignal;
|
|
250
|
-
}): Promise<RegistrationOperation>;
|
|
251
|
-
toJSON(): {
|
|
252
|
-
id: string;
|
|
253
|
-
kind: string;
|
|
254
|
-
status: RegistrationStatus;
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
interface AddressRegistryOptions {
|
|
259
|
-
lookup?: ReceivingKeyLookup;
|
|
260
|
-
expectedRuntimeCodeHash?: Hex;
|
|
261
|
-
}
|
|
262
|
-
/** Independent registry deployment and nonce domain, selected by the application. */
|
|
263
|
-
declare class AddressRegistry {
|
|
264
|
-
#private;
|
|
265
|
-
readonly context: Readonly<RegistryContext>;
|
|
266
|
-
readonly expectedRuntimeCodeHash: Hex | undefined;
|
|
267
|
-
constructor(context: RegistryContext, options?: AddressRegistryOptions);
|
|
268
|
-
validateDeployment(reader: Pick<RegistryReader, "getChainId" | "getCode">): Promise<void>;
|
|
269
|
-
prepareRegistration(options: RegistrationPreparation): Promise<RegistrationOperation>;
|
|
270
|
-
resolve(address: string): Promise<string>;
|
|
271
|
-
typedData(registration: AddressRegistration, options?: RegistrationOptions): {
|
|
272
|
-
domain: {
|
|
273
|
-
name: string;
|
|
274
|
-
version: string;
|
|
275
|
-
chainId: bigint;
|
|
276
|
-
verifyingContract: `0x${string}`;
|
|
277
|
-
};
|
|
278
|
-
primaryType: string;
|
|
279
|
-
types: {
|
|
280
|
-
[x: string]: {
|
|
281
|
-
name: string;
|
|
282
|
-
type: string;
|
|
283
|
-
}[];
|
|
284
|
-
};
|
|
285
|
-
message: {
|
|
286
|
-
nonce: bigint;
|
|
287
|
-
deadline: bigint;
|
|
288
|
-
viewingPublicKey: Hex;
|
|
289
|
-
clueKey: Hex;
|
|
290
|
-
walletIdentity: string;
|
|
291
|
-
};
|
|
292
|
-
};
|
|
293
|
-
digest(registration: AddressRegistration, options?: RegistrationOptions): `0x${string}`;
|
|
294
|
-
buildCall(registration: AddressRegistration, signature: `0x${string}`, options?: RegistrationOptions): RegistrationCalldata;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
80
|
declare const CREATE_CREDIT_FIELDS: readonly ["token", "sources", "nullifiers", "creditCommitment", "changeCommitment", "owner", "expiry", "deadline", "feeRecipient", "feeAmount"];
|
|
298
81
|
/** Public checks cannot establish ownership or conservation: those are enforced by the proof. */
|
|
299
82
|
declare function validateCreateCreditRequest(c: TransactionContext, p: CreateCreditParams, cs: readonly Delivery[], funding?: FundingInput): {
|
|
@@ -617,65 +400,26 @@ declare function buildTopUpCreditCalldata(p: BuildTopUpCreditCalldataParams): {
|
|
|
617
400
|
approveAmount: bigint;
|
|
618
401
|
};
|
|
619
402
|
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
type TransactRequestParams = CrossTreeTransactParams;
|
|
624
|
-
declare function normalizeTransactRequest(c: TransactionContext, p: TransactRequestParams, cs: readonly Delivery[], funding?: FundingInput): {
|
|
625
|
-
capacity: 14 | 56 | 112 | 168;
|
|
626
|
-
sources: {
|
|
627
|
-
treeId: bigint;
|
|
628
|
-
merkleRoot: `0x${string}`;
|
|
629
|
-
}[];
|
|
630
|
-
nullifiers: `0x${string}`[];
|
|
631
|
-
outputCommitments: `0x${string}`[];
|
|
632
|
-
inputCount: number;
|
|
633
|
-
outputCount: number;
|
|
634
|
-
sourceCount: number;
|
|
635
|
-
inputTreeIds: bigint[];
|
|
636
|
-
merkleRoots: bigint[];
|
|
637
|
-
slotValues: bigint[];
|
|
638
|
-
deliveries: Delivery[];
|
|
639
|
-
deliveriesHash: `0x${string}`;
|
|
640
|
-
withdrawalAddress: `0x${string}`;
|
|
641
|
-
withdrawalAmount: bigint;
|
|
642
|
-
feeRecipient: `0x${string}`;
|
|
643
|
-
feeAmount: bigint;
|
|
644
|
-
deadline: bigint;
|
|
645
|
-
depositAmount: bigint;
|
|
646
|
-
depositPayer: `0x${string}`;
|
|
647
|
-
funding: FundingParams;
|
|
648
|
-
chainId: bigint;
|
|
649
|
-
protocolAddress: Hex;
|
|
650
|
-
tokenAddress: Hex;
|
|
651
|
-
now?: bigint;
|
|
652
|
-
timestamp?: bigint;
|
|
653
|
-
};
|
|
654
|
-
declare function transactPublicInputs(c: TransactionContext, p: TransactRequestParams, cs: readonly Delivery[], f?: FundingInput): `0x${string}`[];
|
|
655
|
-
declare function encodeTransactTypedData(c: TransactionContext, p: TransactRequestParams, deliveries: readonly Delivery[], f?: FundingInput): {
|
|
656
|
-
domain: {
|
|
657
|
-
name: string;
|
|
658
|
-
version: string;
|
|
659
|
-
chainId: bigint;
|
|
660
|
-
verifyingContract: `0x${string}`;
|
|
661
|
-
};
|
|
662
|
-
types: {
|
|
663
|
-
readonly WalletAuthorization: readonly [{
|
|
664
|
-
readonly name: "operation";
|
|
665
|
-
readonly type: "bytes32";
|
|
666
|
-
}, {
|
|
667
|
-
readonly name: "statementHash";
|
|
668
|
-
readonly type: "bytes32";
|
|
669
|
-
}];
|
|
670
|
-
};
|
|
671
|
-
primaryType: "WalletAuthorization";
|
|
672
|
-
message: {
|
|
673
|
-
operation: `0x${string}`;
|
|
674
|
-
statementHash: `0x${string}`;
|
|
403
|
+
interface BuildTransactAggregateCalldataParams {
|
|
404
|
+
context: DeploymentContext & {
|
|
405
|
+
now?: bigint;
|
|
675
406
|
};
|
|
407
|
+
proof: Hex;
|
|
408
|
+
requests: readonly TransactRequest[];
|
|
409
|
+
caller?: Address;
|
|
410
|
+
}
|
|
411
|
+
declare function buildTransactAggregateCalldata(p: BuildTransactAggregateCalldataParams): {
|
|
412
|
+
data: Hex;
|
|
413
|
+
capacity: 14;
|
|
676
414
|
};
|
|
677
|
-
|
|
678
|
-
|
|
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): {
|
|
679
423
|
domain: {
|
|
680
424
|
name: string;
|
|
681
425
|
version: string;
|
|
@@ -709,6 +453,43 @@ declare function encodeTransactFundingTypedData(c: TransactionContext, proof: He
|
|
|
709
453
|
deadline: bigint;
|
|
710
454
|
};
|
|
711
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
|
+
|
|
712
493
|
interface BuildTransactCalldataParams {
|
|
713
494
|
context: TransactionContext;
|
|
714
495
|
proof: Hex;
|
|
@@ -722,18 +503,7 @@ declare function buildTransactCalldata(p: BuildTransactCalldataParams): {
|
|
|
722
503
|
capacity: 14 | 56 | 112 | 168;
|
|
723
504
|
approveAmount: bigint;
|
|
724
505
|
};
|
|
725
|
-
|
|
726
|
-
context: DeploymentContext & {
|
|
727
|
-
now?: bigint;
|
|
728
|
-
};
|
|
729
|
-
proof: Hex;
|
|
730
|
-
requests: readonly TransactRequest[];
|
|
731
|
-
caller?: Address;
|
|
732
|
-
}
|
|
733
|
-
declare function buildTransactAggregateCalldata(p: BuildTransactAggregateCalldataParams): {
|
|
734
|
-
data: Hex;
|
|
735
|
-
capacity: 14;
|
|
736
|
-
};
|
|
506
|
+
|
|
737
507
|
interface BuildShieldCalldataParams {
|
|
738
508
|
context: TransactionContext;
|
|
739
509
|
params: ShieldParams;
|
|
@@ -743,7 +513,6 @@ interface BuildShieldCalldataParams {
|
|
|
743
513
|
caller?: Address;
|
|
744
514
|
}
|
|
745
515
|
declare function validateShieldRequest(p: BuildShieldCalldataParams): Promise<FundingParams>;
|
|
746
|
-
declare function shieldFundingRequestHash(params: ShieldParams, outputs: readonly ShieldOutput[], cs: readonly Delivery[]): Hex;
|
|
747
516
|
declare function encodeShieldFundingTypedData(p: BuildShieldCalldataParams): Promise<{
|
|
748
517
|
domain: {
|
|
749
518
|
name: string;
|
|
@@ -782,49 +551,49 @@ declare function buildShieldCalldata(p: BuildShieldCalldataParams): Promise<{
|
|
|
782
551
|
data: Hex;
|
|
783
552
|
approveAmount: bigint;
|
|
784
553
|
}>;
|
|
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
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
}
|
|
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
|
+
}
|
|
828
597
|
|
|
829
598
|
interface TokenProtocolOptions {
|
|
830
599
|
expectedRuntimeCodeHash?: Hex;
|
|
@@ -882,62 +651,6 @@ declare class TokenProtocol {
|
|
|
882
651
|
};
|
|
883
652
|
}
|
|
884
653
|
|
|
885
|
-
interface ProtocolOptions {
|
|
886
|
-
deployment: ProtocolDeployment;
|
|
887
|
-
}
|
|
888
|
-
/** A multi-token deployment. Asset support is always read from the chain. */
|
|
889
|
-
declare class Protocol {
|
|
890
|
-
readonly deployment: Readonly<ProtocolDeployment>;
|
|
891
|
-
readonly context: Readonly<DeploymentContext>;
|
|
892
|
-
constructor(options: ProtocolOptions);
|
|
893
|
-
/** Load the selected deployment and verify its contract against Chain RPC before returning. */
|
|
894
|
-
static fromRpc(rpc: Pick<ProtocolRpcClient, "getDeployment">, provider: Provider, options?: {
|
|
895
|
-
signal?: AbortSignal;
|
|
896
|
-
}): Promise<Protocol>;
|
|
897
|
-
validateDeployment(connection: Provider | (Pick<ChainReader, "getChainId" | "getCode"> & {
|
|
898
|
-
getProtocolVersion?(address: Address): Promise<bigint>;
|
|
899
|
-
getProtocolAddressRegistry?(address: Address): Promise<Address>;
|
|
900
|
-
})): Promise<void>;
|
|
901
|
-
aggregate(request: Omit<BuildTransactAggregateCalldataParams, "context">): {
|
|
902
|
-
data: Hex;
|
|
903
|
-
capacity: 14;
|
|
904
|
-
to: `0x${string}`;
|
|
905
|
-
value: bigint;
|
|
906
|
-
};
|
|
907
|
-
/** Build an operation context for one asset within this same deployment. */
|
|
908
|
-
forToken(tokenAddress: Address): TokenProtocol;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
interface VerifyNoteCommitmentParams {
|
|
912
|
-
ownerAddress: `0x${string}`;
|
|
913
|
-
tokenAddress: `0x${string}`;
|
|
914
|
-
amount: bigint;
|
|
915
|
-
nonce: `0x${string}`;
|
|
916
|
-
noteCommitment: `0x${string}`;
|
|
917
|
-
chainId: bigint;
|
|
918
|
-
}
|
|
919
|
-
declare function verifyNoteCommitment(params: VerifyNoteCommitmentParams): Promise<boolean>;
|
|
920
|
-
interface VerifyCreditCommitmentParams extends Partial<_invisi_labs_core.CreditPolicy> {
|
|
921
|
-
chainId: bigint;
|
|
922
|
-
spenderWalletIdentity: `0x${string}`;
|
|
923
|
-
ownerWalletIdentity: `0x${string}`;
|
|
924
|
-
spenderPayout: `0x${string}`;
|
|
925
|
-
ownerPayout: `0x${string}`;
|
|
926
|
-
tokenAddress: `0x${string}`;
|
|
927
|
-
amount: bigint;
|
|
928
|
-
nonce: bigint;
|
|
929
|
-
expiry: bigint;
|
|
930
|
-
creditSharedKey: bigint;
|
|
931
|
-
/** Server-returned value to verify against the locally recomputed commitment. */
|
|
932
|
-
creditCommitment: `0x${string}`;
|
|
933
|
-
}
|
|
934
|
-
/**
|
|
935
|
-
* Hashes the received shared key locally, recomputes the Credit leaf and compares it to the
|
|
936
|
-
* server-returned value. A mismatch means the server folded a wrong nonce
|
|
937
|
-
* (or other parameter) — the caller MUST abort and not create a Credit.
|
|
938
|
-
*/
|
|
939
|
-
declare function verifyCreditCommitment(params: VerifyCreditCommitmentParams): Promise<boolean>;
|
|
940
|
-
|
|
941
654
|
interface NoteMembership {
|
|
942
655
|
note: Note;
|
|
943
656
|
treeId: bigint;
|
|
@@ -987,25 +700,311 @@ interface TopUpCreditWitnessParams extends Omit<CreateCreditWitnessParams, "para
|
|
|
987
700
|
params: TopUpCreditParams;
|
|
988
701
|
previous: CreditMembership;
|
|
989
702
|
}
|
|
990
|
-
|
|
703
|
+
|
|
704
|
+
/** Assemble witnesses through operation-specific builders with shared validation. */
|
|
991
705
|
declare class WitnessBuilder {
|
|
992
706
|
#private;
|
|
993
707
|
constructor(protocol: TokenProtocol);
|
|
994
708
|
static statement(circuitName: CircuitName, expectedPublicInputs: readonly Hex[], target?: ProofTarget): ProofStatement;
|
|
995
|
-
private context;
|
|
996
|
-
private authority;
|
|
997
|
-
private membership;
|
|
998
|
-
private noteLeaf;
|
|
999
|
-
private creditLeaf;
|
|
1000
|
-
private noteInputs;
|
|
1001
709
|
transact(p: TransactWitnessParams): Promise<ProvingRequest>;
|
|
1002
|
-
private creation;
|
|
1003
710
|
createCredit(p: CreateCreditWitnessParams): Promise<ProvingRequest>;
|
|
1004
711
|
cancelCredit(p: CancelCreditWitnessParams): Promise<ProvingRequest>;
|
|
1005
712
|
drawCredit(p: DrawCreditWitnessParams): Promise<ProvingRequest>;
|
|
1006
713
|
topUpCredit(p: TopUpCreditWitnessParams): Promise<ProvingRequest>;
|
|
1007
714
|
}
|
|
1008
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
|
+
|
|
1009
1008
|
/**
|
|
1010
1009
|
* Query the selected factory. The caller still verifies the returned deployment profile.
|
|
1011
1010
|
* Calls `factory.getInstanceAddress(salt)` on-chain.
|