@invisi-labs/sdk 1.1.6 → 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/broadcaster-3KTB4JO2.cjs +21 -0
- package/dist/broadcaster-3KTB4JO2.cjs.map +1 -0
- package/dist/broadcaster-7ZKKSTZQ.js +21 -0
- package/dist/broadcaster-preparation-PJ263WBL.cjs +15 -0
- package/dist/broadcaster-preparation-PJ263WBL.cjs.map +1 -0
- package/dist/broadcaster-preparation-ZQAPZAUG.js +15 -0
- package/dist/broadcaster-preparation-ZQAPZAUG.js.map +1 -0
- package/dist/chunk-2URICDPW.cjs +167 -0
- package/dist/chunk-2URICDPW.cjs.map +1 -0
- package/dist/chunk-3D24ABYR.js +86 -0
- package/dist/chunk-3D24ABYR.js.map +1 -0
- package/dist/chunk-3KTQQZOW.cjs +71 -0
- package/dist/chunk-3KTQQZOW.cjs.map +1 -0
- package/dist/chunk-4H4FARQK.js +1582 -0
- package/dist/chunk-4H4FARQK.js.map +1 -0
- package/dist/chunk-4SDP53YQ.cjs +765 -0
- package/dist/chunk-4SDP53YQ.cjs.map +1 -0
- package/dist/{chunk-QC6TQR3R.js → chunk-4VI6LYGH.js} +35 -12
- package/dist/chunk-4VI6LYGH.js.map +1 -0
- package/dist/chunk-BBSRP4MH.cjs +287 -0
- package/dist/chunk-BBSRP4MH.cjs.map +1 -0
- package/dist/chunk-DGMVGFKM.js +41 -0
- package/dist/chunk-DGMVGFKM.js.map +1 -0
- package/dist/chunk-GUD3LAUO.js +765 -0
- package/dist/chunk-GUD3LAUO.js.map +1 -0
- package/dist/chunk-HCB7RQ3S.cjs +79 -0
- package/dist/chunk-HCB7RQ3S.cjs.map +1 -0
- package/dist/{broadcaster-preparation-QVL62KM6.js → chunk-HKGJXQVN.js} +73 -34
- package/dist/chunk-HKGJXQVN.js.map +1 -0
- package/dist/chunk-HLH5JZD4.js +287 -0
- package/dist/chunk-HLH5JZD4.js.map +1 -0
- package/dist/chunk-J6TZZVAM.cjs +230 -0
- package/dist/chunk-J6TZZVAM.cjs.map +1 -0
- package/dist/chunk-LOR6PYH5.cjs +397 -0
- package/dist/chunk-LOR6PYH5.cjs.map +1 -0
- package/dist/chunk-MA2QZEF5.cjs +399 -0
- package/dist/chunk-MA2QZEF5.cjs.map +1 -0
- package/dist/chunk-MI4IP4ZD.cjs +86 -0
- package/dist/chunk-MI4IP4ZD.cjs.map +1 -0
- package/dist/chunk-NKYHYIRP.cjs +1582 -0
- package/dist/chunk-NKYHYIRP.cjs.map +1 -0
- package/dist/chunk-OCZLJKIA.cjs +41 -0
- package/dist/chunk-OCZLJKIA.cjs.map +1 -0
- package/dist/chunk-R5YAOJKB.js +71 -0
- package/dist/chunk-R5YAOJKB.js.map +1 -0
- package/dist/chunk-RY4M2CIQ.js +399 -0
- package/dist/chunk-RY4M2CIQ.js.map +1 -0
- package/dist/chunk-THMD5QO2.js +79 -0
- package/dist/chunk-THMD5QO2.js.map +1 -0
- package/dist/chunk-ZD2652WH.js +230 -0
- package/dist/chunk-ZD2652WH.js.map +1 -0
- package/dist/credit.cjs +1 -0
- package/dist/credit.cjs.map +1 -0
- package/dist/credit.d.cts +12 -0
- package/dist/credit.d.ts +12 -0
- package/dist/credit.js +1 -0
- package/dist/credit.js.map +1 -0
- package/dist/ethers.cjs +11 -385
- package/dist/ethers.cjs.map +1 -1
- package/dist/ethers.d.cts +16 -6
- package/dist/ethers.d.ts +16 -6
- package/dist/ethers.js +1 -1
- package/dist/index-CLhGwLxZ.d.cts +42 -0
- package/dist/index-Crp-ZFiM.d.ts +42 -0
- package/dist/index.cjs +479 -7847
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -710
- package/dist/index.d.ts +87 -710
- package/dist/index.js +407 -869
- package/dist/index.js.map +1 -1
- package/dist/note.cjs +11 -0
- package/dist/note.cjs.map +1 -0
- package/dist/note.d.cts +29 -0
- package/dist/note.d.ts +29 -0
- package/dist/note.js +11 -0
- package/dist/note.js.map +1 -0
- package/dist/operation-bridge-CoECSxfi.d.cts +472 -0
- package/dist/operation-bridge-CoECSxfi.d.ts +472 -0
- package/dist/preparation-HUBTVCZE.js +404 -0
- package/dist/preparation-HUBTVCZE.js.map +1 -0
- package/dist/preparation-QD3ZSYV5.cjs +404 -0
- package/dist/preparation-QD3ZSYV5.cjs.map +1 -0
- package/dist/provenance-preparation-43DN2WK7.cjs +16 -0
- package/dist/provenance-preparation-43DN2WK7.cjs.map +1 -0
- package/dist/provenance-preparation-HEZE4L5H.js +16 -0
- package/dist/provenance-preparation-HEZE4L5H.js.map +1 -0
- package/dist/provenance.cjs +59 -0
- package/dist/provenance.cjs.map +1 -0
- package/dist/provenance.d.cts +34 -0
- package/dist/provenance.d.ts +34 -0
- package/dist/provenance.js +59 -0
- package/dist/provenance.js.map +1 -0
- package/dist/receipt-logs-8Msm_HZS.d.ts +322 -0
- package/dist/receipt-logs-DWG4In8N.d.cts +322 -0
- package/dist/session-support.cjs +189 -0
- package/dist/session-support.cjs.map +1 -0
- package/dist/session-support.d.cts +284 -0
- package/dist/session-support.d.ts +284 -0
- package/dist/session-support.js +189 -0
- package/dist/session-support.js.map +1 -0
- package/package.json +25 -19
- package/dist/NoteOutput-DRkVnwlx.d.cts +0 -398
- package/dist/NoteOutput-DpDC6T2O.d.ts +0 -398
- package/dist/broadcaster-preparation-QVL62KM6.js.map +0 -1
- package/dist/chunk-4SD3MW6N.js +0 -4711
- package/dist/chunk-4SD3MW6N.js.map +0 -1
- package/dist/chunk-FL4TIGWW.js +0 -1781
- package/dist/chunk-FL4TIGWW.js.map +0 -1
- package/dist/chunk-QC6TQR3R.js.map +0 -1
- package/dist/indexeddb.cjs +0 -6878
- package/dist/indexeddb.cjs.map +0 -1
- package/dist/indexeddb.d.cts +0 -20
- package/dist/indexeddb.d.ts +0 -20
- package/dist/indexeddb.js +0 -71
- package/dist/indexeddb.js.map +0 -1
- package/dist/memory.cjs +0 -6886
- package/dist/memory.cjs.map +0 -1
- package/dist/memory.d.cts +0 -12
- package/dist/memory.d.ts +0 -12
- package/dist/memory.js +0 -11
- package/dist/sqlite.cjs +0 -6862
- package/dist/sqlite.cjs.map +0 -1
- package/dist/sqlite.d.cts +0 -28
- package/dist/sqlite.d.ts +0 -28
- package/dist/sqlite.js +0 -55
- package/dist/sqlite.js.map +0 -1
- package/dist/state-C4HZFotm.d.cts +0 -78
- package/dist/state-C4HZFotm.d.ts +0 -78
- package/dist/store-8aBhnbGr.d.ts +0 -42
- package/dist/store-YrbXb6CY.d.cts +0 -42
- /package/dist/{memory.js.map → broadcaster-7ZKKSTZQ.js.map} +0 -0
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import { ProofSidecar, ManifestIdentity, Scope } from '@invisi-labs/protocol/provenance';
|
|
2
|
+
import { OfflineProver } from '@invisi-labs/prover/provenance-witness';
|
|
3
|
+
import * as _invisi_labs_rpc_provenance from '@invisi-labs/rpc/provenance';
|
|
4
|
+
import { ProvenanceClient } from '@invisi-labs/rpc/provenance';
|
|
5
|
+
import { Note, CreditDeliveryState, ReceivingKeyLookup, Wallet, CreditUpdateChanges, AuthorizedStatement } from '@invisi-labs/primitives';
|
|
6
|
+
import * as _invisi_labs_prover from '@invisi-labs/prover';
|
|
7
|
+
import { Hex, Prover, NoteMembership, CreditMembership, ProverOptions, AggregateMember, ProofBundle } from '@invisi-labs/prover';
|
|
8
|
+
import * as _invisi_labs_protocol from '@invisi-labs/protocol';
|
|
9
|
+
import { FundingInput, ChainReader, ProtocolDataProvider, TransactionContext, CanonicalBlock, TransactRequestParams } from '@invisi-labs/protocol';
|
|
10
|
+
import { SignedBroadcasterQuote, BroadcasterClient as BroadcasterClient$1, BroadcasterStatus, BroadcasterConfiguration } from '@invisi-labs/rpc/broadcaster';
|
|
11
|
+
import { Hex as Hex$1, Delivery, Address, ShieldParams, ShieldOutput, CreateCreditParams, CreditDrawParams, UpdateCreditParams, RevokeCreditParams, TransactRequest } from '@invisi-labs/protocol/contracts';
|
|
12
|
+
import { Provider } from 'ethers';
|
|
13
|
+
import { Protocol, TokenProtocol } from '@invisi-labs/rpc';
|
|
14
|
+
|
|
15
|
+
/** Public recovery packet; persist encrypted Note openings separately if reproof is needed. */
|
|
16
|
+
interface ProvenanceProof {
|
|
17
|
+
format: "invisi-provenance-submission-v1";
|
|
18
|
+
data: string;
|
|
19
|
+
context: {
|
|
20
|
+
chainId: string;
|
|
21
|
+
protocolAddress: string;
|
|
22
|
+
tokenAddress: string;
|
|
23
|
+
};
|
|
24
|
+
mainCircuitCapacity: number;
|
|
25
|
+
publicInputs: string[];
|
|
26
|
+
operationDigest: string;
|
|
27
|
+
sidecars: ProofSidecar[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface WalletScope {
|
|
31
|
+
namespace: string;
|
|
32
|
+
chainId: bigint;
|
|
33
|
+
protocolAddress: Hex;
|
|
34
|
+
ownerAddress: Hex;
|
|
35
|
+
}
|
|
36
|
+
declare function creditReservationKey(commitment: string): string;
|
|
37
|
+
interface Checkpoint {
|
|
38
|
+
number: bigint;
|
|
39
|
+
hash: Hex;
|
|
40
|
+
}
|
|
41
|
+
type SpentState = "unknown" | "unspent" | "spent";
|
|
42
|
+
interface ReceiptPosition {
|
|
43
|
+
commitment: Hex;
|
|
44
|
+
treeId: bigint;
|
|
45
|
+
leafIndex: number;
|
|
46
|
+
blockNumber: bigint;
|
|
47
|
+
blockHash: Hex;
|
|
48
|
+
transactionHash?: Hex;
|
|
49
|
+
}
|
|
50
|
+
interface NoteRecord extends ReceiptPosition {
|
|
51
|
+
note: Note;
|
|
52
|
+
spent: SpentState;
|
|
53
|
+
checkedThrough?: Checkpoint;
|
|
54
|
+
}
|
|
55
|
+
interface CreditRecord extends ReceiptPosition {
|
|
56
|
+
receivingKeySource?: {
|
|
57
|
+
kind: "draw" | "update";
|
|
58
|
+
commitment: Hex;
|
|
59
|
+
};
|
|
60
|
+
revoked?: boolean;
|
|
61
|
+
state: CreditDeliveryState;
|
|
62
|
+
role: "owner" | "spender";
|
|
63
|
+
spent: SpentState;
|
|
64
|
+
checkedThrough?: Checkpoint;
|
|
65
|
+
}
|
|
66
|
+
type OperationStatus = "prepared" | "authorized" | "proved" | "ready" | "submitted" | "confirmed" | "failed" | "expired" | "uncertain" | "reorged";
|
|
67
|
+
|
|
68
|
+
/** Minimal input count by descending amount, with deterministic tree/position/commitment ties. */
|
|
69
|
+
type SelectableNote = Pick<NoteRecord, "note" | "commitment" | "treeId" | "leafIndex" | "spent">;
|
|
70
|
+
|
|
71
|
+
type PreparationIntent = {
|
|
72
|
+
kind: "transfer";
|
|
73
|
+
options: TransferPreparation;
|
|
74
|
+
} | {
|
|
75
|
+
kind: "shield";
|
|
76
|
+
options: ShieldPreparation;
|
|
77
|
+
} | {
|
|
78
|
+
kind: "create-credit";
|
|
79
|
+
options: CreateCreditPreparation;
|
|
80
|
+
} | {
|
|
81
|
+
kind: "draw-credit";
|
|
82
|
+
options: DrawCreditPreparation;
|
|
83
|
+
} | {
|
|
84
|
+
kind: "update-credit";
|
|
85
|
+
options: UpdateCreditPreparation;
|
|
86
|
+
} | {
|
|
87
|
+
kind: "revoke-credit";
|
|
88
|
+
options: RevokeCreditPreparation;
|
|
89
|
+
};
|
|
90
|
+
type BroadcasterFeeSource = "public-funding" | "private-inputs";
|
|
91
|
+
interface BroadcasterQuoteOptions {
|
|
92
|
+
maxFeeAmount: bigint;
|
|
93
|
+
feeSource?: BroadcasterFeeSource;
|
|
94
|
+
maxAttempts?: number;
|
|
95
|
+
/** Optional app-owned permit signing, requested once for the final gross funding amount. */
|
|
96
|
+
fundingPermit?: (request: {
|
|
97
|
+
payer: `0x${string}`;
|
|
98
|
+
amount: bigint;
|
|
99
|
+
tokenAddress: `0x${string}`;
|
|
100
|
+
protocolAddress: `0x${string}`;
|
|
101
|
+
}) => Promise<NonNullable<TransferPreparation["funding"]>["permit"]>;
|
|
102
|
+
}
|
|
103
|
+
declare function prepareIntent(runtime: PreparationRuntime<OperationPlan>, intent: PreparationIntent): Promise<OperationPlan>;
|
|
104
|
+
declare function prepareBroadcasterPlan(plan: OperationPlan, reprepare: (intent: PreparationIntent) => Promise<OperationPlan>, client: BroadcasterClient, options: BroadcasterQuoteOptions): Promise<{
|
|
105
|
+
plan: OperationPlan;
|
|
106
|
+
quote: SignedBroadcasterQuote;
|
|
107
|
+
broadcasterBinding: NonNullable<SavedOperation["broadcasterBinding"]>;
|
|
108
|
+
}>;
|
|
109
|
+
|
|
110
|
+
/** Application-level quote and submission conveniences over the public RPC client. */
|
|
111
|
+
declare class BroadcasterClient extends BroadcasterClient$1 {
|
|
112
|
+
quote<T extends BroadcasterTransaction>(transaction: T, options: BroadcasterQuoteOptions): Promise<T>;
|
|
113
|
+
submit(transaction: BroadcasterTransaction): Promise<BroadcasterStatus>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
type AddressLookup = "chain" | "protocol-rpc";
|
|
117
|
+
/** Capture deployment pins before a Protocol is bound to an operation's token. */
|
|
118
|
+
declare function configureRecipientInfrastructure<T extends TransactionInfrastructure>(options: T): T;
|
|
119
|
+
/** Internal lookup plumbing; public APIs never accept resolver functions. */
|
|
120
|
+
declare function recipientLookup(options: object, source?: AddressLookup): ReceivingKeyLookup;
|
|
121
|
+
|
|
122
|
+
interface NoteOutputContext {
|
|
123
|
+
chainId: bigint;
|
|
124
|
+
protocolAddress: Hex$1;
|
|
125
|
+
tokenAddress: Hex$1;
|
|
126
|
+
}
|
|
127
|
+
type NoteOutputRecipient = {
|
|
128
|
+
type: "evm";
|
|
129
|
+
address: string;
|
|
130
|
+
envelope?: boolean;
|
|
131
|
+
addressLookup?: AddressLookup;
|
|
132
|
+
nonce?: bigint | undefined;
|
|
133
|
+
} | {
|
|
134
|
+
type: "invisi";
|
|
135
|
+
address: string;
|
|
136
|
+
nonce?: bigint | undefined;
|
|
137
|
+
} | {
|
|
138
|
+
type: "identity";
|
|
139
|
+
identity: Hex$1;
|
|
140
|
+
};
|
|
141
|
+
type EncryptedRecipient = {
|
|
142
|
+
type: "evm";
|
|
143
|
+
address: string;
|
|
144
|
+
envelope?: true;
|
|
145
|
+
addressLookup?: AddressLookup;
|
|
146
|
+
nonce?: bigint | undefined;
|
|
147
|
+
} | {
|
|
148
|
+
type: "invisi";
|
|
149
|
+
address: string;
|
|
150
|
+
nonce?: bigint | undefined;
|
|
151
|
+
};
|
|
152
|
+
type PaymentRequest = NoteOutputContext & {
|
|
153
|
+
amount: bigint;
|
|
154
|
+
} & ({
|
|
155
|
+
recipient: EncryptedRecipient;
|
|
156
|
+
payload?: Uint8Array;
|
|
157
|
+
} | {
|
|
158
|
+
recipient: {
|
|
159
|
+
type: "evm";
|
|
160
|
+
address: string;
|
|
161
|
+
envelope: false;
|
|
162
|
+
addressLookup?: AddressLookup;
|
|
163
|
+
nonce?: bigint | undefined;
|
|
164
|
+
} | {
|
|
165
|
+
type: "identity";
|
|
166
|
+
identity: Hex$1;
|
|
167
|
+
};
|
|
168
|
+
payload?: never;
|
|
169
|
+
});
|
|
170
|
+
/** Local payment choices; these never rewrite the encoded request. */
|
|
171
|
+
interface NoteOutputExecutionOptions {
|
|
172
|
+
nonce?: bigint;
|
|
173
|
+
addressLookup?: AddressLookup;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** Immutable output statement and optional recoverable opening. */
|
|
177
|
+
declare class NoteOutput {
|
|
178
|
+
readonly to: string;
|
|
179
|
+
readonly ipp: string;
|
|
180
|
+
readonly amount: bigint;
|
|
181
|
+
readonly identity: Hex$1;
|
|
182
|
+
readonly commitment: Hex$1;
|
|
183
|
+
readonly deliveryFingerprint: Hex$1;
|
|
184
|
+
/** Encrypted EVM delivery is resolved by preparation; the original offline intent stays pending. */
|
|
185
|
+
readonly deliveryPending: boolean;
|
|
186
|
+
readonly context: NoteOutputContext;
|
|
187
|
+
readonly recipient: NoteOutputRecipient;
|
|
188
|
+
readonly nonce: bigint | undefined;
|
|
189
|
+
readonly payload: Uint8Array;
|
|
190
|
+
readonly preparedOutput: PreparedOutput;
|
|
191
|
+
private constructor();
|
|
192
|
+
/** Private offline delivery data; does not assert that the output has been mined. */
|
|
193
|
+
exportPaymentNote(): string;
|
|
194
|
+
static create(input: PaymentRequest | string, execution?: NoteOutputExecutionOptions): Promise<NoteOutput>;
|
|
195
|
+
assertCommitment(expectedHex: Hex$1): void;
|
|
196
|
+
get note(): Note | undefined;
|
|
197
|
+
get delivery(): Delivery;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
interface CoinSelector {
|
|
201
|
+
select(candidates: readonly NoteRecord[], requiredAmount: bigint): readonly Hex$1[] | Promise<readonly Hex$1[]>;
|
|
202
|
+
}
|
|
203
|
+
interface FundingTypedData {
|
|
204
|
+
domain: Record<string, unknown>;
|
|
205
|
+
primaryType: string;
|
|
206
|
+
types: Record<string, readonly {
|
|
207
|
+
name: string;
|
|
208
|
+
type: string;
|
|
209
|
+
}[]>;
|
|
210
|
+
message: Record<string, unknown>;
|
|
211
|
+
}
|
|
212
|
+
interface FundingSigner {
|
|
213
|
+
readonly address: Address;
|
|
214
|
+
signTypedData(data: FundingTypedData): Promise<Hex$1>;
|
|
215
|
+
}
|
|
216
|
+
interface FundingAuthorizationVerifier {
|
|
217
|
+
verifyTypedData(data: FundingTypedData & {
|
|
218
|
+
address: Address;
|
|
219
|
+
signature: Hex$1;
|
|
220
|
+
}): Promise<boolean>;
|
|
221
|
+
}
|
|
222
|
+
interface FundingSource {
|
|
223
|
+
payer: Address;
|
|
224
|
+
amount: bigint;
|
|
225
|
+
authorization?: "signature" | "caller";
|
|
226
|
+
sigNonce?: bigint;
|
|
227
|
+
deadline?: bigint;
|
|
228
|
+
permit?: NonNullable<FundingInput["permit"]>;
|
|
229
|
+
}
|
|
230
|
+
/** Public submission mode; backend proof targets are selected internally. */
|
|
231
|
+
type TransactionExecution = "single" | "aggregate";
|
|
232
|
+
interface TransactionProveOptions extends ProverOptions {
|
|
233
|
+
/** Defaults to single. Aggregate produces a member for a separate aggregate submission. */
|
|
234
|
+
execution?: TransactionExecution;
|
|
235
|
+
}
|
|
236
|
+
interface TransferPreparation {
|
|
237
|
+
tokenAddress: Address;
|
|
238
|
+
/** Explicit subset for managed inventory; detached calls already supply inputs. */
|
|
239
|
+
commitments?: readonly Hex$1[];
|
|
240
|
+
/** Public ERC20 payout. Empty private outputs are allowed when a payout is present. */
|
|
241
|
+
withdrawal?: {
|
|
242
|
+
to: Address;
|
|
243
|
+
amount: bigint;
|
|
244
|
+
};
|
|
245
|
+
/** Immediate public fee paid from this operation's token. */
|
|
246
|
+
fee?: {
|
|
247
|
+
recipient: Address;
|
|
248
|
+
amount: bigint;
|
|
249
|
+
};
|
|
250
|
+
outputs: readonly NoteOutput[];
|
|
251
|
+
funding?: FundingSource;
|
|
252
|
+
deadline?: bigint;
|
|
253
|
+
}
|
|
254
|
+
interface ShieldPreparation {
|
|
255
|
+
fee?: {
|
|
256
|
+
recipient: Address;
|
|
257
|
+
amount: bigint;
|
|
258
|
+
};
|
|
259
|
+
tokenAddress: Address;
|
|
260
|
+
outputs: readonly NoteOutput[];
|
|
261
|
+
funding: FundingSource;
|
|
262
|
+
deadline?: bigint;
|
|
263
|
+
}
|
|
264
|
+
interface PreparedOutput {
|
|
265
|
+
context: NoteOutputContext;
|
|
266
|
+
recipient: NoteOutputRecipient;
|
|
267
|
+
amount: bigint;
|
|
268
|
+
note?: Note;
|
|
269
|
+
commitment: Hex$1;
|
|
270
|
+
identity: Hex$1;
|
|
271
|
+
delivery: Delivery;
|
|
272
|
+
/** Only offline encrypted EVM outputs may await registry-key resolution. */
|
|
273
|
+
deliveryPending?: true;
|
|
274
|
+
address: string;
|
|
275
|
+
change: boolean;
|
|
276
|
+
}
|
|
277
|
+
interface CreateCreditPreparation {
|
|
278
|
+
fee?: {
|
|
279
|
+
recipient: Address;
|
|
280
|
+
amount: bigint;
|
|
281
|
+
};
|
|
282
|
+
payload?: Uint8Array;
|
|
283
|
+
singleLimit?: bigint;
|
|
284
|
+
dailyLimit?: bigint;
|
|
285
|
+
monthlyLimit?: bigint;
|
|
286
|
+
availableCredit?: bigint;
|
|
287
|
+
unlimited?: boolean;
|
|
288
|
+
tokenAddress: Address;
|
|
289
|
+
spender: string;
|
|
290
|
+
expiry: bigint;
|
|
291
|
+
deadline?: bigint;
|
|
292
|
+
}
|
|
293
|
+
interface DrawCreditPreparation {
|
|
294
|
+
fee?: {
|
|
295
|
+
recipient: Address;
|
|
296
|
+
amount: bigint;
|
|
297
|
+
};
|
|
298
|
+
tokenAddress: Address;
|
|
299
|
+
credits: readonly {
|
|
300
|
+
credit: Hex$1;
|
|
301
|
+
amount: bigint;
|
|
302
|
+
payload?: Uint8Array;
|
|
303
|
+
}[];
|
|
304
|
+
recipient: string;
|
|
305
|
+
payload?: Uint8Array;
|
|
306
|
+
deadline?: bigint;
|
|
307
|
+
}
|
|
308
|
+
interface UpdateCreditPreparation {
|
|
309
|
+
fee?: {
|
|
310
|
+
recipient: Address;
|
|
311
|
+
amount: bigint;
|
|
312
|
+
};
|
|
313
|
+
payload?: Uint8Array;
|
|
314
|
+
singleLimit?: bigint;
|
|
315
|
+
dailyLimit?: bigint;
|
|
316
|
+
monthlyLimit?: bigint;
|
|
317
|
+
increaseAvailableCredit?: bigint;
|
|
318
|
+
decreaseAvailableCredit?: bigint;
|
|
319
|
+
unlimited?: boolean;
|
|
320
|
+
tokenAddress: Address;
|
|
321
|
+
credit: Hex$1;
|
|
322
|
+
expiry?: bigint;
|
|
323
|
+
deadline?: bigint;
|
|
324
|
+
}
|
|
325
|
+
interface RevokeCreditPreparation {
|
|
326
|
+
fee?: {
|
|
327
|
+
recipient: Address;
|
|
328
|
+
amount: bigint;
|
|
329
|
+
};
|
|
330
|
+
tokenAddress: Address;
|
|
331
|
+
owner?: Address;
|
|
332
|
+
shard: bigint;
|
|
333
|
+
slot: bigint;
|
|
334
|
+
caller?: Address;
|
|
335
|
+
deadline?: bigint;
|
|
336
|
+
}
|
|
337
|
+
interface PreparedCreditOutput {
|
|
338
|
+
state: CreditDeliveryState;
|
|
339
|
+
commitment: Hex$1;
|
|
340
|
+
deliveries: [Delivery, Delivery];
|
|
341
|
+
}
|
|
342
|
+
interface PreparedCreditInput extends CreditMembership {
|
|
343
|
+
commitment: Hex$1;
|
|
344
|
+
role: "owner" | "spender";
|
|
345
|
+
}
|
|
346
|
+
interface CreditPlan {
|
|
347
|
+
inputs: PreparedCreditInput[];
|
|
348
|
+
outputs: PreparedCreditOutput[];
|
|
349
|
+
deliveries: Delivery[];
|
|
350
|
+
creation?: CreateCreditParams;
|
|
351
|
+
draw?: CreditDrawParams;
|
|
352
|
+
update?: UpdateCreditParams;
|
|
353
|
+
updateChanges?: CreditUpdateChanges;
|
|
354
|
+
revocation?: RevokeCreditParams;
|
|
355
|
+
revocationSignature?: Hex$1;
|
|
356
|
+
revocationCaller?: Hex$1;
|
|
357
|
+
amounts?: bigint[];
|
|
358
|
+
}
|
|
359
|
+
interface OperationPlan {
|
|
360
|
+
intent?: PreparationIntent;
|
|
361
|
+
version: 1;
|
|
362
|
+
id: string;
|
|
363
|
+
kind: "transfer" | "shield" | "create-credit" | "draw-credit" | "update-credit" | "revoke-credit";
|
|
364
|
+
context: TransactionContext;
|
|
365
|
+
scope: WalletScope;
|
|
366
|
+
preparedAt: CanonicalBlock;
|
|
367
|
+
deadline: bigint;
|
|
368
|
+
outputs: PreparedOutput[];
|
|
369
|
+
inputs: Array<NoteMembership & {
|
|
370
|
+
commitment: Hex$1;
|
|
371
|
+
}>;
|
|
372
|
+
funding: FundingInput;
|
|
373
|
+
fundingMode: "none" | "signature" | "caller";
|
|
374
|
+
params?: TransactRequestParams;
|
|
375
|
+
shieldParams?: ShieldParams;
|
|
376
|
+
shieldOutputs?: ShieldOutput[];
|
|
377
|
+
capacity?: number;
|
|
378
|
+
credit?: CreditPlan;
|
|
379
|
+
statement?: _invisi_labs_prover.ProofStatement;
|
|
380
|
+
}
|
|
381
|
+
interface SavedOperation {
|
|
382
|
+
plan: OperationPlan;
|
|
383
|
+
provenance?: ProvenanceProof;
|
|
384
|
+
broadcasterBinding?: {
|
|
385
|
+
configuration: BroadcasterConfiguration;
|
|
386
|
+
intentHash: string;
|
|
387
|
+
};
|
|
388
|
+
broadcasterSubmissionId?: string;
|
|
389
|
+
broadcasterAttempted?: boolean;
|
|
390
|
+
broadcasterQuote?: SignedBroadcasterQuote;
|
|
391
|
+
proof?: ProofBundle;
|
|
392
|
+
call?: _invisi_labs_protocol.TransactionCall;
|
|
393
|
+
externalized?: boolean;
|
|
394
|
+
generation: number;
|
|
395
|
+
claim?: {
|
|
396
|
+
stage: string;
|
|
397
|
+
token: string;
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
interface TransactionInfrastructure {
|
|
401
|
+
provenanceClient?: _invisi_labs_rpc_provenance.ProvenanceClient;
|
|
402
|
+
provenance?: PreparedProvenanceCapability;
|
|
403
|
+
wallet: Wallet;
|
|
404
|
+
protocol: Protocol;
|
|
405
|
+
chainReader?: ChainReader;
|
|
406
|
+
protocolRpc?: ProtocolDataProvider;
|
|
407
|
+
prover?: Prover;
|
|
408
|
+
fundingVerifier?: FundingAuthorizationVerifier;
|
|
409
|
+
/** Optional ethers provider used by per-output direct-chain receiving-key lookup. */
|
|
410
|
+
provider?: Provider;
|
|
411
|
+
coinSelector?: CoinSelector;
|
|
412
|
+
transactionTTL?: bigint;
|
|
413
|
+
}
|
|
414
|
+
interface TransactionRuntime {
|
|
415
|
+
options: Omit<TransactionInfrastructure, "protocol"> & {
|
|
416
|
+
protocol: TokenProtocol;
|
|
417
|
+
};
|
|
418
|
+
scope: WalletScope;
|
|
419
|
+
reader: ChainReader;
|
|
420
|
+
}
|
|
421
|
+
interface LocalOperationSecrets {
|
|
422
|
+
authorization?: AuthorizedStatement;
|
|
423
|
+
}
|
|
424
|
+
interface OperationAggregateMember extends AggregateMember {
|
|
425
|
+
context: TransactionContext;
|
|
426
|
+
request: TransactRequest;
|
|
427
|
+
}
|
|
428
|
+
/** Data required while preparing an operation; it does not own persistence or reservations. */
|
|
429
|
+
interface PreparationRuntime<Result> extends TransactionRuntime {
|
|
430
|
+
readInventory(): Promise<PreparationInventory>;
|
|
431
|
+
complete(plan: OperationPlan): Promise<Result>;
|
|
432
|
+
explicitInputs?: boolean;
|
|
433
|
+
inputSelection?: readonly Hex$1[];
|
|
434
|
+
changeAddress?: string;
|
|
435
|
+
}
|
|
436
|
+
interface PreparationInventory {
|
|
437
|
+
reservations: Record<string, string>;
|
|
438
|
+
invalidated?: string;
|
|
439
|
+
observedThrough?: Checkpoint;
|
|
440
|
+
notes: Record<string, SelectableNote>;
|
|
441
|
+
credits: Record<string, Pick<CreditRecord, "state" | "commitment" | "treeId" | "leafIndex" | "role" | "spent">>;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
interface PreparedProvenanceCapability {
|
|
445
|
+
client: ProvenanceClient;
|
|
446
|
+
manifest: ManifestIdentity;
|
|
447
|
+
prover: OfflineProver;
|
|
448
|
+
maxRootPages?: number;
|
|
449
|
+
maxLeaves?: number;
|
|
450
|
+
}
|
|
451
|
+
declare function prepareProvenance(plan: OperationPlan, runtime: TransactionRuntime): Promise<{
|
|
452
|
+
operationDigest: string;
|
|
453
|
+
sidecars: ProofSidecar[];
|
|
454
|
+
}>;
|
|
455
|
+
declare function provePreparedProvenance(saved: SavedOperation, runtime: TransactionRuntime, capability?: PreparedProvenanceCapability, reprove?: boolean): Promise<ProvenanceProof>;
|
|
456
|
+
declare function validateBroadcastEnvelope(saved: SavedOperation, client: BroadcasterClient): void;
|
|
457
|
+
declare function validatePreparedBroadcast(saved: SavedOperation, client: BroadcasterClient, runtime: TransactionRuntime): Promise<void>;
|
|
458
|
+
|
|
459
|
+
interface BroadcasterTransaction {
|
|
460
|
+
readonly id: string;
|
|
461
|
+
readonly status: string;
|
|
462
|
+
}
|
|
463
|
+
interface Hooks<T extends BroadcasterTransaction> {
|
|
464
|
+
quote(client: BroadcasterClient, options: BroadcasterQuoteOptions): Promise<T>;
|
|
465
|
+
submit(client: BroadcasterClient): Promise<BroadcasterStatus>;
|
|
466
|
+
provenanceContext(): Promise<Scope>;
|
|
467
|
+
readProvenance(): Promise<ProvenanceProof | undefined>;
|
|
468
|
+
proveProvenance(capability: PreparedProvenanceCapability, reprove?: boolean): Promise<ProvenanceProof>;
|
|
469
|
+
}
|
|
470
|
+
declare function bindBroadcasterOperation<T extends BroadcasterTransaction>(target: T, hooks: Hooks<T>): void;
|
|
471
|
+
|
|
472
|
+
export { validateBroadcastEnvelope as $, type AddressLookup as A, type BroadcasterTransaction as B, type CreateCreditPreparation as C, type DrawCreditPreparation as D, type PreparedCreditInput as E, type FundingSigner as F, type PreparedCreditOutput as G, type PreparedOutput as H, type ReceiptPosition as I, type SpentState as J, bindBroadcasterOperation as K, type LocalOperationSecrets as L, configureRecipientInfrastructure as M, NoteOutput as N, type OperationStatus as O, type ProvenanceProof as P, creditReservationKey as Q, type RevokeCreditPreparation as R, type ShieldPreparation as S, type TransactionRuntime as T, type UpdateCreditPreparation as U, prepareBroadcasterPlan as V, type WalletScope as W, prepareIntent as X, prepareProvenance as Y, provePreparedProvenance as Z, recipientLookup as _, type PreparedProvenanceCapability as a, validatePreparedBroadcast as a0, type FundingTypedData as b, type FundingAuthorizationVerifier as c, type PreparationIntent as d, type OperationPlan as e, type TransactionProveOptions as f, type OperationAggregateMember as g, type TransactionInfrastructure as h, BroadcasterClient as i, type PaymentRequest as j, type BroadcasterFeeSource as k, type BroadcasterQuoteOptions as l, type FundingSource as m, type NoteOutputContext as n, type NoteOutputExecutionOptions as o, type NoteOutputRecipient as p, type TransactionExecution as q, type TransferPreparation as r, type SavedOperation as s, type PreparationRuntime as t, type Checkpoint as u, type CoinSelector as v, type CreditPlan as w, type CreditRecord as x, type NoteRecord as y, type PreparationInventory as z };
|