@cloak.dev/sdk 0.2.6-staging.af2dfc0 → 0.2.6
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/CHANGELOG.md +70 -0
- package/README.md +102 -4
- package/dist/index.cjs +1920 -58
- package/dist/index.d.cts +468 -1
- package/dist/index.d.ts +468 -1
- package/dist/index.js +1906 -60
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1547,6 +1547,14 @@ declare class MerkleTree {
|
|
|
1547
1547
|
* @param height Tree height (default: 32)
|
|
1548
1548
|
*/
|
|
1549
1549
|
declare function buildMerkleTree(commitments: bigint[], height?: number): Promise<MerkleTree>;
|
|
1550
|
+
/**
|
|
1551
|
+
* Serializable state of a {@link MerkleFrontier}: the leaf count and, per level, the hash of the
|
|
1552
|
+
* last complete LEFT node still waiting for its right sibling (hex, `""` when that level has none).
|
|
1553
|
+
*/
|
|
1554
|
+
interface MerkleFrontierState {
|
|
1555
|
+
nextIndex: number;
|
|
1556
|
+
left: string[];
|
|
1557
|
+
}
|
|
1550
1558
|
|
|
1551
1559
|
/**
|
|
1552
1560
|
* Error Utilities
|
|
@@ -3776,6 +3784,12 @@ interface SubmitTransactToRelayArgs {
|
|
|
3776
3784
|
* captured across attempts, and every terminal failure that could plausibly have been submitted
|
|
3777
3785
|
* is resolved against chain into a `SettlementVerificationError` that states the outcome and
|
|
3778
3786
|
* carries the signature.
|
|
3787
|
+
*
|
|
3788
|
+
* WARNING [preflight 0x1020]: this posts an already-built request and does NOT run
|
|
3789
|
+
* `preflightNullifiers`. Notes restored from an untrusted source (the relay's note index can hide a
|
|
3790
|
+
* nullifier, so a spent note can look unspent) must go through `transact` / `partialWithdraw` /
|
|
3791
|
+
* `fullWithdraw` / `swapUtxo`, which run the preflight before proof generation; a caller that
|
|
3792
|
+
* builds its own request must `await preflightNullifiers(inputUtxos, connection, programId)` first.
|
|
3779
3793
|
*/
|
|
3780
3794
|
declare function submitTransactToRelay(args: SubmitTransactToRelayArgs): Promise<RelaySubmissionResult>;
|
|
3781
3795
|
declare function transact(params: TransactParams, options: TransactOptions): Promise<TransactResult>;
|
|
@@ -5099,6 +5113,459 @@ declare function toComplianceReport(result: ScanResult): ComplianceReport;
|
|
|
5099
5113
|
/** Format compliance report as CSV for export. */
|
|
5100
5114
|
declare function formatComplianceCsv(report: ComplianceReport): string;
|
|
5101
5115
|
|
|
5116
|
+
/**
|
|
5117
|
+
* Note Index v1 transport (contract revision 2): the head and the pages.
|
|
5118
|
+
*
|
|
5119
|
+
* Every request goes through `relayFetch`, the origin-allowlisted egress chokepoint
|
|
5120
|
+
* (`relay/endpoint.ts`), so nothing here can reach a host the build is not pinned to.
|
|
5121
|
+
*
|
|
5122
|
+
* ── Privacy rule ──────────────────────────────────────────────────────────────────────────────
|
|
5123
|
+
* No request here carries anything that points at a specific note, commitment, nullifier, wallet,
|
|
5124
|
+
* pool or time window. Pages are addressed by epoch and page number only, and every page is
|
|
5125
|
+
* downloaded. Trees are rebuilt from the pages themselves, so nothing else is ever requested.
|
|
5126
|
+
*
|
|
5127
|
+
* Caching: complete pages are served `immutable` with a strong ETag and the tail with
|
|
5128
|
+
* `max-age=5`, so a browser's HTTP cache makes a refresh cheap without any client-side store.
|
|
5129
|
+
* Nothing here persists an ETag (the contract forbids persisting a tail ETag). Compression is
|
|
5130
|
+
* negotiated by the fetch implementation; the decoded size is capped while streaming.
|
|
5131
|
+
*/
|
|
5132
|
+
/** `GET /note-index/v1/head`. */
|
|
5133
|
+
interface NoteIndexHead {
|
|
5134
|
+
format: 1;
|
|
5135
|
+
/** Random id of this index instance; a rebuild or restore gets a new one. */
|
|
5136
|
+
epoch: bigint;
|
|
5137
|
+
pageSize: number;
|
|
5138
|
+
/** Number of published items. */
|
|
5139
|
+
watermark: number;
|
|
5140
|
+
/** Pages with exactly `pageSize` items; they never change. */
|
|
5141
|
+
completePages: number;
|
|
5142
|
+
/** chain_{completePages}, 64 lowercase hex. */
|
|
5143
|
+
chainTip: string;
|
|
5144
|
+
}
|
|
5145
|
+
/** Transport options shared by every note-index request. */
|
|
5146
|
+
interface NoteIndexFetchOptions {
|
|
5147
|
+
signal?: AbortSignal;
|
|
5148
|
+
/** Per-attempt timeout. Default 30 s. */
|
|
5149
|
+
timeoutMs?: number;
|
|
5150
|
+
/** Retries after the first attempt, for network errors, 429 and 5xx. Default 3. */
|
|
5151
|
+
maxRetries?: number;
|
|
5152
|
+
}
|
|
5153
|
+
/** Fetch and validate `GET /note-index/v1/head`. */
|
|
5154
|
+
declare function fetchNoteIndexHead(relayUrl: string, options?: NoteIndexFetchOptions): Promise<NoteIndexHead>;
|
|
5155
|
+
/**
|
|
5156
|
+
* Fetch the raw bytes of `GET /note-index/v1/e/{epoch}/pages/{n}`, with the decoded size bounded
|
|
5157
|
+
* to {@link NOTE_INDEX_MAX_PAGE_BYTES} while streaming. Parse with
|
|
5158
|
+
* `parseNoteIndexPage(bytes, { epoch, page })`.
|
|
5159
|
+
*/
|
|
5160
|
+
declare function fetchNoteIndexPage(relayUrl: string, epoch: bigint, page: number, options?: NoteIndexFetchOptions): Promise<Uint8Array>;
|
|
5161
|
+
|
|
5162
|
+
/** Items per page. A page is complete iff it holds exactly this many items. */
|
|
5163
|
+
declare const NOTE_INDEX_PAGE_SIZE = 1024;
|
|
5164
|
+
/** Leaf index of an all-zero (never appended) commitment. */
|
|
5165
|
+
declare const NOTE_INDEX_NO_LEAF = 18446744073709551615n;
|
|
5166
|
+
/** Thrown for every byte sequence that is not a well-formed Note Index v1 page or head. */
|
|
5167
|
+
declare class NoteIndexFormatError extends Error {
|
|
5168
|
+
constructor(message: string);
|
|
5169
|
+
}
|
|
5170
|
+
/** kind 1: one confirmed Cloak Transact / TransactSwap instruction, with its note if any. */
|
|
5171
|
+
interface NoteIndexTxItem {
|
|
5172
|
+
kind: 1;
|
|
5173
|
+
mint: Uint8Array;
|
|
5174
|
+
slot: bigint;
|
|
5175
|
+
blockPos: number;
|
|
5176
|
+
/** 0 Transact, 1 TransactSwap. */
|
|
5177
|
+
ixTag: number;
|
|
5178
|
+
/** Signed public amount from the public inputs (positive for a deposit). */
|
|
5179
|
+
publicAmount: bigint;
|
|
5180
|
+
nullifier0: Uint8Array;
|
|
5181
|
+
nullifier1: Uint8Array;
|
|
5182
|
+
comm0: Uint8Array;
|
|
5183
|
+
/** {@link NOTE_INDEX_NO_LEAF} iff comm0 is all zero. */
|
|
5184
|
+
leaf0: bigint;
|
|
5185
|
+
comm1: Uint8Array;
|
|
5186
|
+
leaf1: bigint;
|
|
5187
|
+
/** 0 none, 1 inline in the instruction data, 2 CLK1 carrier. */
|
|
5188
|
+
noteSource: number;
|
|
5189
|
+
/** The bare chain-note envelope `[version][AES-GCM ct || tag]`; empty when noteSource is 0. */
|
|
5190
|
+
note: Uint8Array;
|
|
5191
|
+
/** The Cloak program transaction. Relay-supplied metadata, not proof of anything. */
|
|
5192
|
+
signature: Uint8Array;
|
|
5193
|
+
}
|
|
5194
|
+
/** kind 2: a CLKD1 recipient-delivery envelope. */
|
|
5195
|
+
interface NoteIndexDeliveryItem {
|
|
5196
|
+
kind: 2;
|
|
5197
|
+
mint: Uint8Array;
|
|
5198
|
+
slot: bigint;
|
|
5199
|
+
/** output_commitment[0] of the source transaction. */
|
|
5200
|
+
commitment: Uint8Array;
|
|
5201
|
+
leaf: bigint;
|
|
5202
|
+
envelope: Uint8Array;
|
|
5203
|
+
signature: Uint8Array;
|
|
5204
|
+
}
|
|
5205
|
+
/** kind 3: an R_fb swap refund leaf appended by CloseSwapState. */
|
|
5206
|
+
interface NoteIndexSwapRefundItem {
|
|
5207
|
+
kind: 3;
|
|
5208
|
+
/** Always WSOL. */
|
|
5209
|
+
mint: Uint8Array;
|
|
5210
|
+
slot: bigint;
|
|
5211
|
+
commitment: Uint8Array;
|
|
5212
|
+
leaf: bigint;
|
|
5213
|
+
amountAfterFee: bigint;
|
|
5214
|
+
/** The swap's first input nullifier (TransactSwap public inputs +104). */
|
|
5215
|
+
nullifier0: Uint8Array;
|
|
5216
|
+
/** The close transaction. */
|
|
5217
|
+
signature: Uint8Array;
|
|
5218
|
+
}
|
|
5219
|
+
type NoteIndexItem = NoteIndexTxItem | NoteIndexDeliveryItem | NoteIndexSwapRefundItem;
|
|
5220
|
+
interface NoteIndexPage {
|
|
5221
|
+
epoch: bigint;
|
|
5222
|
+
page: bigint;
|
|
5223
|
+
firstSeq: bigint;
|
|
5224
|
+
complete: boolean;
|
|
5225
|
+
/** The item count the header declared, unknown kinds included. */
|
|
5226
|
+
count: number;
|
|
5227
|
+
/** chain_page: the hash chain value BEFORE this page. */
|
|
5228
|
+
prevChain: Uint8Array;
|
|
5229
|
+
/** Items of known kinds, in page order. */
|
|
5230
|
+
items: NoteIndexItem[];
|
|
5231
|
+
/** Raw `kind | body_len | body` bytes of each entry of `items`, same order. */
|
|
5232
|
+
rawItems: Uint8Array[];
|
|
5233
|
+
/** Items of unknown kinds, skipped by `body_len`. */
|
|
5234
|
+
skippedUnknown: number;
|
|
5235
|
+
/**
|
|
5236
|
+
* Position in the page (0-based, unknown and malformed kinds counted) of each entry of `items`,
|
|
5237
|
+
* so `page * NOTE_INDEX_PAGE_SIZE + itemPositions[i]` is the item's real sequence number.
|
|
5238
|
+
*/
|
|
5239
|
+
itemPositions: number[];
|
|
5240
|
+
/**
|
|
5241
|
+
* Known-kind items whose body failed that kind's checks and were skipped by `body_len`. Always 0
|
|
5242
|
+
* unless {@link ParseNoteIndexPageOptions.skipMalformedItems} is set (otherwise they throw).
|
|
5243
|
+
*/
|
|
5244
|
+
skippedMalformed: number;
|
|
5245
|
+
}
|
|
5246
|
+
/** Options of {@link parseNoteIndexPage}. */
|
|
5247
|
+
interface ParseNoteIndexPageOptions {
|
|
5248
|
+
/**
|
|
5249
|
+
* Skip (and count in `skippedMalformed`) a known-kind item whose body fails that kind's checks,
|
|
5250
|
+
* instead of refusing the whole page. Only the BODY is forgiven: the page header, the item
|
|
5251
|
+
* framing (`kind | body_len` inside the page, no truncation, no trailing bytes) and the hash
|
|
5252
|
+
* chain stay strict, so a skipped item is exactly a hidden item, which an untrusted relay can
|
|
5253
|
+
* already do. `recoverNotesFromIndex` sets it, so that one bad entry cannot abort every
|
|
5254
|
+
* wallet's restore.
|
|
5255
|
+
*/
|
|
5256
|
+
skipMalformedItems?: boolean;
|
|
5257
|
+
}
|
|
5258
|
+
/** Input to {@link encodeNoteIndexPage}. */
|
|
5259
|
+
interface EncodeNoteIndexPageParams {
|
|
5260
|
+
epoch: bigint | number;
|
|
5261
|
+
page: bigint | number;
|
|
5262
|
+
firstSeq: bigint | number;
|
|
5263
|
+
complete: boolean;
|
|
5264
|
+
prevChain: Uint8Array;
|
|
5265
|
+
items: NoteIndexItem[];
|
|
5266
|
+
}
|
|
5267
|
+
/**
|
|
5268
|
+
* Parse one page, strictly. Throws {@link NoteIndexFormatError} on anything that is not exactly a
|
|
5269
|
+
* Note Index v1 page: wrong magic/version, unknown flag bits, non-zero reserved bytes, a count over
|
|
5270
|
+
* 1024, a complete page whose count is not 1024, first_seq that is not page * 1024, an epoch or page
|
|
5271
|
+
* other than `expect`, an item whose body_len differs from the exact length of its kind, a note
|
|
5272
|
+
* whose version disagrees with its length, an out-of-range ix_tag / note_source, a refund whose mint
|
|
5273
|
+
* is not WSOL, an unknown kind longer than 1024 bytes, a truncated item, or trailing bytes.
|
|
5274
|
+
*
|
|
5275
|
+
* With `options.skipMalformedItems`, an item whose body alone is at fault (its framing inside the
|
|
5276
|
+
* page is intact) is skipped and counted in `skippedMalformed` instead; everything else above
|
|
5277
|
+
* still throws.
|
|
5278
|
+
*/
|
|
5279
|
+
declare function parseNoteIndexPage(bytes: Uint8Array, expect?: {
|
|
5280
|
+
epoch: bigint;
|
|
5281
|
+
page: number;
|
|
5282
|
+
}, options?: ParseNoteIndexPageOptions): NoteIndexPage;
|
|
5283
|
+
/**
|
|
5284
|
+
* Parse ONE raw item (`kind | body_len | body`), as kept in `NoteIndexPage.rawItems` and in a
|
|
5285
|
+
* persisted cursor. Same strictness as the page parser; unknown kinds are an error here.
|
|
5286
|
+
*/
|
|
5287
|
+
declare function parseNoteIndexItem(raw: Uint8Array): NoteIndexItem;
|
|
5288
|
+
/** chain_{n+1} = sha256(chain_n || items bytes of page n), for a COMPLETE page's raw bytes. */
|
|
5289
|
+
declare function computeNoteIndexChain(prevChain: Uint8Array, pageBytes: Uint8Array): Uint8Array;
|
|
5290
|
+
/** Encode one item as `kind | body_len | body`. */
|
|
5291
|
+
declare function encodeNoteIndexItem(item: NoteIndexItem): Uint8Array;
|
|
5292
|
+
/**
|
|
5293
|
+
* Encode a page exactly as the relay serves it. The relay is the producer; this exists so both
|
|
5294
|
+
* sides pin the same golden vector and so tests can serve real pages from a stub.
|
|
5295
|
+
*/
|
|
5296
|
+
declare function encodeNoteIndexPage(params: EncodeNoteIndexPageParams): Uint8Array;
|
|
5297
|
+
|
|
5298
|
+
/**
|
|
5299
|
+
* Restore a wallet's notes from the relay's Note Index v1 (contract revision 2.1), without walking
|
|
5300
|
+
* the chain and without telling anyone which notes, pools or nullifiers are its own.
|
|
5301
|
+
*
|
|
5302
|
+
* ── What this replaces ────────────────────────────────────────────────────────────────────────
|
|
5303
|
+
* `scanTransactions` enumerates the program's whole signature history and fetches every
|
|
5304
|
+
* transaction over RPC (thousands of paid calls, minutes). The relay indexes every confirmed Cloak
|
|
5305
|
+
* transaction once and serves all of it in bulk; this downloads every page, decrypts and matches
|
|
5306
|
+
* locally, rebuilds every listed pool's commitment tree from the index's own leaf stream, and spends
|
|
5307
|
+
* exactly ONE RPC request: a `getMultipleAccounts` of every listed pool's tree account, to check the
|
|
5308
|
+
* rebuilt trees. Spent status comes from the nullifiers in the index, so no nullifier of the user
|
|
5309
|
+
* reaches the relay or the RPC.
|
|
5310
|
+
*
|
|
5311
|
+
* ── Trust model (every byte from the relay is untrusted) ──────────────────────────────────────
|
|
5312
|
+
* A note is returned only when all of these hold:
|
|
5313
|
+
* (a) it decrypts / opens under the caller's own keys;
|
|
5314
|
+
* (b) the commitment recomputed from the decrypted values and an owner public key equals the
|
|
5315
|
+
* item's commitment, that owner key is the caller's `ownerUtxoKeypair.publicKey` (or a legacy
|
|
5316
|
+
* key this same recovery derived from nk), and derivePublicKey(privateKey) === publicKey for
|
|
5317
|
+
* the keypair returned. A relay cannot plant a note under somebody else's key and have it
|
|
5318
|
+
* counted as balance (the R2 fake-balance fix: `matchChangeNote` accepts any `outPubkey0`,
|
|
5319
|
+
* so the index path refuses every owner that is not the caller's);
|
|
5320
|
+
* (c) the commitment sits at the item's leaf in the tree rebuilt from the index's leaf stream,
|
|
5321
|
+
* and that leaf lies in a prefix of the stream the chain's tree account authenticates: the
|
|
5322
|
+
* whole stream when its root is the account's current root or one in its root history, or
|
|
5323
|
+
* the leaves under a COMPLETE node the account still stores in its frontier (`subtrees`,
|
|
5324
|
+
* see `readTreeAccountFrontier`), which keeps old notes verifiable when a busy pool has
|
|
5325
|
+
* moved more than the 100-root history past the index. Unverifiable candidates are counted
|
|
5326
|
+
* in `pending`, never returned, and carried in the cursor until they verify.
|
|
5327
|
+
* A lying relay can hide items. It cannot inject a note, alter one, or point one at a wrong leaf.
|
|
5328
|
+
* A HIDDEN nullifier makes a spent note look unspent; the spend-time `preflightNullifiers` in every
|
|
5329
|
+
* spend entry point is what catches that, and it stays mandatory.
|
|
5330
|
+
*
|
|
5331
|
+
* What is NOT checked: the proof-bound `chainNoteHash`. An index item does not carry it (nor the
|
|
5332
|
+
* `extDataHash` its preimage needs), and fetching either per transaction would break the one-RPC
|
|
5333
|
+
* budget. It is not needed for (a) to (c): the chain note is AES-GCM under a key HKDF'd from nk
|
|
5334
|
+
* with the item's own `comm0` as salt (`comm1` for a v2 note), so a note written for one
|
|
5335
|
+
* transaction never opens when the relay attaches it to another (a mispaired CLK1 carrier), for its
|
|
5336
|
+
* real owner or anyone else, and whatever does open (a note crafted for the transaction it sits
|
|
5337
|
+
* on, say under a public legacy key) is still held to (b) and (c). The item's other public fields (`publicAmount`,
|
|
5338
|
+
* the nullifiers) feed only derivations whose result must reproduce a published commitment, so a
|
|
5339
|
+
* wrong value there can only make a note fail to match. The cost of a mispairing is therefore
|
|
5340
|
+
* hidden notes (the memo's real owner's, and the paired source's own), never a wrong note, and no
|
|
5341
|
+
* client-side check can recover them: only the relay can pair correctly.
|
|
5342
|
+
*
|
|
5343
|
+
* ── One bad entry never aborts a run ──────────────────────────────────────────────────────────
|
|
5344
|
+
* The index carries what anyone can put on chain, and a legacy viewing key may be public, so a
|
|
5345
|
+
* stranger can write a note that opens for a wallet. An item whose body is malformed (framing
|
|
5346
|
+
* intact), or whose opened contents make a matcher throw, is skipped and counted in
|
|
5347
|
+
* `stats.skipped`, exactly as if it were not this wallet's. Only page-level faults (header,
|
|
5348
|
+
* framing, hash chain, head) still fail the run, since they are not one entry's.
|
|
5349
|
+
*
|
|
5350
|
+
* ── The cursor never depends on what the wallet owns (contract property 1) ────────────────────
|
|
5351
|
+
* Every run downloads from the persisted cursor page, so that page must be a function of public
|
|
5352
|
+
* data only. It is always `floor(complete_pages / 8) * 8` of the head this run saw (or the previous
|
|
5353
|
+
* page when a public condition holds it: more out-of-order leaves than the cursor may carry). It is
|
|
5354
|
+
* NEVER held back by this wallet's candidates: a candidate that cannot be verified yet travels
|
|
5355
|
+
* INSIDE the cursor instead (its raw item bytes, plus the stream's own value at its leaf, which is
|
|
5356
|
+
* exactly the value the client hashed into its frontier), bounded by `MAX_CARRIED_PENDING`, so a
|
|
5357
|
+
* later run can verify it without re-reading the pages it came from. A full re-sync from page 0 is
|
|
5358
|
+
* likewise only ever triggered by public conditions (an epoch change, a broken hash chain, a later
|
|
5359
|
+
* item that rewrites or fills the tree before the cursor, a rebuilt tree the chain disproves), never
|
|
5360
|
+
* by anything about this wallet's own items, so the request pattern of two wallets with the same
|
|
5361
|
+
* cursor is identical.
|
|
5362
|
+
*
|
|
5363
|
+
* ── Legacy (nk-derived owner keys) ────────────────────────────────────────────────────────────
|
|
5364
|
+
* Notes whose owner key older releases derived from nk are spendable by anyone holding nk. They are
|
|
5365
|
+
* returned in `atRisk`, never in `notes`, so an app can migrate them without counting them as
|
|
5366
|
+
* balance.
|
|
5367
|
+
*
|
|
5368
|
+
* Some older clients also encrypted their chain notes under a viewing key that is not the wallet's
|
|
5369
|
+
* canonical nk (mobile used SHA-512 of the public wallet address, or the embedded wallet's nsk).
|
|
5370
|
+
* Pass those as `legacyViewingKeyNks` to find such notes in the same download, at no extra request:
|
|
5371
|
+
* every item is trial-opened under the canonical nk first, then under each legacy key. A legacy key
|
|
5372
|
+
* only ever FINDS notes. Everything that opened only under one is returned in `atRisk`, whatever
|
|
5373
|
+
* its owner key (a legacy key may be public, so the relay and anyone else can read those notes), it
|
|
5374
|
+
* never opens a recipient delivery (the delivery rail never used one), and nothing a legacy key opens
|
|
5375
|
+
* can enter `notes`. A note of this wallet's that spends a legacy note and is encrypted under the
|
|
5376
|
+
* canonical nk (a migration) is matched normally and lands in `notes`.
|
|
5377
|
+
*
|
|
5378
|
+
* ── Refund leaves ─────────────────────────────────────────────────────────────────────────────
|
|
5379
|
+
* CloseSwapState appends R_fb to the WSOL MAIN tree (`["merkle_tree", WSOL]`; the separate refund
|
|
5380
|
+
* tree belonged to the retired ClaimRefund design and the program rejects it). So SWAP_REFUND
|
|
5381
|
+
* leaves are part of the WSOL leaf stream here, interleaved with TX leaves. Treating them as a
|
|
5382
|
+
* separate tree would leave a gap at every refund leaf and the WSOL root could never verify.
|
|
5383
|
+
*/
|
|
5384
|
+
|
|
5385
|
+
type IndexedRecoveredNoteKind = "deposit" | "change" | "received" | "swap_refund";
|
|
5386
|
+
/** A verified note restored from the index. */
|
|
5387
|
+
interface IndexedRecoveredNote {
|
|
5388
|
+
kind: IndexedRecoveredNoteKind;
|
|
5389
|
+
/**
|
|
5390
|
+
* Ready to spend: `keypair` has the real private key, plus `blinding`, `amount`, `mintAddress`,
|
|
5391
|
+
* `index` (leaf, verified against the on-chain tree) and `commitment`.
|
|
5392
|
+
*/
|
|
5393
|
+
utxo: Utxo;
|
|
5394
|
+
/** Base58 signature the relay attached. Metadata only, NOT proof of payment. */
|
|
5395
|
+
signature: string;
|
|
5396
|
+
/**
|
|
5397
|
+
* `true` for every `atRisk` note (owner key derivable from nk, or found through a legacy viewing
|
|
5398
|
+
* key), `false` for `notes`.
|
|
5399
|
+
*/
|
|
5400
|
+
legacyExposed: boolean;
|
|
5401
|
+
}
|
|
5402
|
+
/**
|
|
5403
|
+
* The persisted resume point. JSON-serializable and holds NO key material, but `own` records which
|
|
5404
|
+
* index items are this wallet's, so store it as privately as the notes themselves, and never hand
|
|
5405
|
+
* one wallet's cursor to another wallet.
|
|
5406
|
+
*
|
|
5407
|
+
* Version 2. Any other version (including the v1 cursor of the first release), or anything that
|
|
5408
|
+
* fails validation, is ignored with a warning and the run re-syncs from page 0.
|
|
5409
|
+
*/
|
|
5410
|
+
interface NoteIndexCursor {
|
|
5411
|
+
v: 2;
|
|
5412
|
+
/** Index epoch (u64, decimal). A different epoch at the relay means a full re-sync. */
|
|
5413
|
+
epoch: string;
|
|
5414
|
+
/**
|
|
5415
|
+
* First page the next run downloads: `floor(complete_pages / 8) * 8` of a head this wallet saw.
|
|
5416
|
+
* Public data only; it never depends on which items are this wallet's.
|
|
5417
|
+
*/
|
|
5418
|
+
page: number;
|
|
5419
|
+
/** chain_page, 64 hex. */
|
|
5420
|
+
chain: string;
|
|
5421
|
+
/** Highest watermark seen in this epoch; a lower one is refused (`NoteIndexHeadBehindError`). */
|
|
5422
|
+
watermark: number;
|
|
5423
|
+
/** Items below this seq were covered by a pass from page 0; only later items can trigger one. */
|
|
5424
|
+
fullPassSeq: number;
|
|
5425
|
+
/** Per listed pool mint: its leaf stream as rebuilt from every page before `page`. Public data. */
|
|
5426
|
+
trees: Record<string, {
|
|
5427
|
+
frontier: MerkleFrontierState;
|
|
5428
|
+
/** Leaves past a gap, `[leaf, 64 hex]`, waiting for the gap to fill. */
|
|
5429
|
+
pending: Array<[number, string]>;
|
|
5430
|
+
/** Values (64 hex each, concatenated) of the leaves right below `frontier.nextIndex`. */
|
|
5431
|
+
window: string;
|
|
5432
|
+
/** Leaves `[0, verified)` were authenticated against the chain. */
|
|
5433
|
+
verified: number;
|
|
5434
|
+
/** `[leaf, 64 hex]` corrections the chain accepted over the first item for that leaf. */
|
|
5435
|
+
overrides: Array<[number, string]>;
|
|
5436
|
+
/** The chain disproved this stream and a pass from page 0 did not fix it. */
|
|
5437
|
+
mismatch: boolean;
|
|
5438
|
+
}>;
|
|
5439
|
+
/** This wallet's state. Private. */
|
|
5440
|
+
own: {
|
|
5441
|
+
/** Raw items (hex) from pages before `page` that hold a verified or a carried pending note. */
|
|
5442
|
+
items: Array<{
|
|
5443
|
+
seq: number;
|
|
5444
|
+
item: string;
|
|
5445
|
+
}>;
|
|
5446
|
+
/** `mint:leaf:commitmentHex` of every note that verified. */
|
|
5447
|
+
verified: string[];
|
|
5448
|
+
/** Nullifiers (hex) already seen spending one of this wallet's notes. */
|
|
5449
|
+
spent: string[];
|
|
5450
|
+
/** `[mint, leaf, 64 hex]`: the stream's value at each carried pending note's leaf. */
|
|
5451
|
+
pendingLeaves: Array<[string, number, string]>;
|
|
5452
|
+
/** Identities (32 hex) of items rejected for good. */
|
|
5453
|
+
rejected: string[];
|
|
5454
|
+
};
|
|
5455
|
+
}
|
|
5456
|
+
interface RecoverNotesFromIndexParams {
|
|
5457
|
+
/** Relay base URL. Must be on this build's origin allowlist. */
|
|
5458
|
+
relayUrl: string;
|
|
5459
|
+
/** Used for exactly one request: a `getMultipleAccounts` of every listed pool's tree account. */
|
|
5460
|
+
connection: CloakRpc;
|
|
5461
|
+
programId: Address;
|
|
5462
|
+
/** Every active pool mint. Trees are rebuilt and checked for ALL of them, not only where notes are. */
|
|
5463
|
+
poolMints: Address[];
|
|
5464
|
+
/** The wallet's 32-byte viewing base. */
|
|
5465
|
+
viewingKeyNk: Uint8Array;
|
|
5466
|
+
/**
|
|
5467
|
+
* Other 32-byte viewing keys older clients of this wallet encrypted chain notes under (at most
|
|
5468
|
+
* 8). Scan only: every note found through one is returned in `atRisk`, never in `notes`, and a
|
|
5469
|
+
* legacy key never opens a recipient delivery. Costs local trial decryptions, no extra request.
|
|
5470
|
+
* Entries equal to `viewingKeyNk` are ignored.
|
|
5471
|
+
*/
|
|
5472
|
+
legacyViewingKeyNks?: Uint8Array[];
|
|
5473
|
+
/** The wallet's long-lived UTXO keypair, with its real private key. */
|
|
5474
|
+
ownerUtxoKeypair: UtxoKeypair;
|
|
5475
|
+
/** The `cursor` of the previous run. Omit for a full sync. */
|
|
5476
|
+
cursor?: NoteIndexCursor;
|
|
5477
|
+
/** Per mint: ignore legacy-shaped (nk-owned) notes at or after this leaf (a release cutoff). */
|
|
5478
|
+
legacyCutoffLeaf?: Record<string, bigint>;
|
|
5479
|
+
/** Pages in flight. Default 6. */
|
|
5480
|
+
concurrency?: number;
|
|
5481
|
+
onProgress?: (p: {
|
|
5482
|
+
pagesDone: number;
|
|
5483
|
+
pagesTotal: number;
|
|
5484
|
+
itemsChecked: number;
|
|
5485
|
+
notesFound: number;
|
|
5486
|
+
}) => void;
|
|
5487
|
+
signal?: AbortSignal;
|
|
5488
|
+
}
|
|
5489
|
+
interface NoteIndexRecoveryStats {
|
|
5490
|
+
/** Pages downloaded and parsed. */
|
|
5491
|
+
pages: number;
|
|
5492
|
+
/** Items checked (known kinds). */
|
|
5493
|
+
items: number;
|
|
5494
|
+
/** Bytes downloaded (decoded). */
|
|
5495
|
+
bytes: number;
|
|
5496
|
+
/** RPC requests sent through `connection`. */
|
|
5497
|
+
rpcCalls: number;
|
|
5498
|
+
ms: number;
|
|
5499
|
+
/**
|
|
5500
|
+
* Candidates rejected for good: commitment not reproducible from the opened values, not at the
|
|
5501
|
+
* declared leaf of the verified tree, a duplicate (mint, leaf), a legacy note past the cutoff, a
|
|
5502
|
+
* keypair that failed the derivePublicKey check, or an item already rejected by an earlier run.
|
|
5503
|
+
*/
|
|
5504
|
+
dropped: number;
|
|
5505
|
+
/** Items that opened under this wallet's keys. */
|
|
5506
|
+
decrypted: number;
|
|
5507
|
+
/** Matched candidates before the tree and spent checks. */
|
|
5508
|
+
candidates: number;
|
|
5509
|
+
/** Verified notes whose nullifier the index shows as spent. */
|
|
5510
|
+
spent: number;
|
|
5511
|
+
/** Leaves two items assigned different commitments to. */
|
|
5512
|
+
conflicts: number;
|
|
5513
|
+
/** Pending candidates over the carry limit, not carried to the next run. */
|
|
5514
|
+
pendingDropped: number;
|
|
5515
|
+
/**
|
|
5516
|
+
* Index entries skipped instead of failing the run (each one is treated as not this wallet's):
|
|
5517
|
+
* an item whose body fails its kind's format checks while its framing in the page is intact, and
|
|
5518
|
+
* an item that opened under this wallet's keys but whose contents no derivation accepts (a chain
|
|
5519
|
+
* note salt of 0 or over 96 bits, or anything else that throws while it is matched). Anyone who
|
|
5520
|
+
* can read a legacy viewing key can write such a note, so none of this may abort a restore.
|
|
5521
|
+
*/
|
|
5522
|
+
skipped: number;
|
|
5523
|
+
}
|
|
5524
|
+
interface RecoverNotesFromIndexResult {
|
|
5525
|
+
/** Verified, unspent, owned by `ownerUtxoKeypair`; deduped by (mint, leaf). */
|
|
5526
|
+
notes: IndexedRecoveredNote[];
|
|
5527
|
+
/**
|
|
5528
|
+
* Verified, unspent, and either owned by an nk-derived legacy key (spendable by nk holders) or
|
|
5529
|
+
* found only through a `legacyViewingKeyNks` entry (readable by whoever holds that key). Migrate.
|
|
5530
|
+
*/
|
|
5531
|
+
atRisk: IndexedRecoveredNote[];
|
|
5532
|
+
/**
|
|
5533
|
+
* Candidates not verifiable yet (tree or root not caught up). Carried in the cursor. It depends on
|
|
5534
|
+
* what this wallet owns (a relay can make it non-zero for the owner of one item), so never let it
|
|
5535
|
+
* decide whether or what to download: gate polls on the public head (epoch, watermark) alone.
|
|
5536
|
+
*/
|
|
5537
|
+
pending: number;
|
|
5538
|
+
/** Persist and pass back as `cursor`. */
|
|
5539
|
+
cursor: NoteIndexCursor;
|
|
5540
|
+
stats: NoteIndexRecoveryStats;
|
|
5541
|
+
/** Non-fatal events, e.g. a re-sync from page 0. Generic text: never a key, a mint or a note. */
|
|
5542
|
+
warnings: string[];
|
|
5543
|
+
}
|
|
5544
|
+
/**
|
|
5545
|
+
* The relay's head is behind a watermark this cursor already saw in the same epoch: a cached head
|
|
5546
|
+
* from a stale CDN edge, or a rollback. Nothing was discarded; retry later with the SAME cursor.
|
|
5547
|
+
* If it persists, the index was rolled back without a new epoch (a relay bug): only then drop the
|
|
5548
|
+
* cursor to re-sync from page 0.
|
|
5549
|
+
*/
|
|
5550
|
+
declare class NoteIndexHeadBehindError extends Error {
|
|
5551
|
+
readonly cursorWatermark: number;
|
|
5552
|
+
readonly headWatermark: number;
|
|
5553
|
+
readonly retryable: true;
|
|
5554
|
+
constructor(cursorWatermark: number, headWatermark: number);
|
|
5555
|
+
}
|
|
5556
|
+
/**
|
|
5557
|
+
* Restore every verified, unspent note this wallet owns from the relay's note index.
|
|
5558
|
+
*
|
|
5559
|
+
* Downloads every page from the cursor (or page 0), opens each item locally, rebuilds every listed
|
|
5560
|
+
* pool's tree from the index's leaf stream, checks the trees with ONE `getMultipleAccounts`, and
|
|
5561
|
+
* computes spent status from the index's nullifiers. Persist the returned `cursor`; the next run
|
|
5562
|
+
* re-downloads from it, so dedupe against held notes by (mint, leaf).
|
|
5563
|
+
*
|
|
5564
|
+
* Throws `NoteIndexHeadBehindError` (retryable, nothing discarded) when the relay's head is behind
|
|
5565
|
+
* the cursor. An unusable cursor is never an exception: it is ignored with a warning.
|
|
5566
|
+
*/
|
|
5567
|
+
declare function recoverNotesFromIndex(params: RecoverNotesFromIndexParams): Promise<RecoverNotesFromIndexResult>;
|
|
5568
|
+
|
|
5102
5569
|
/**
|
|
5103
5570
|
* Automatic UTXO Wallet Manager
|
|
5104
5571
|
*
|
|
@@ -5952,4 +6419,4 @@ declare const VERSION = "0.2.6";
|
|
|
5952
6419
|
/** True when scanner supports TransactSwap (tag 1). Check this to verify the correct SDK bundle is loaded. */
|
|
5953
6420
|
declare const SCANNER_SUPPORTS_TRANSACT_SWAP = true;
|
|
5954
6421
|
|
|
5955
|
-
export { BRIDGE_ESCROW_LABEL, BRIDGE_ESCROW_LABEL_V2, BUILD_ALLOWS_LOCAL_ENDPOINTS, type BridgeDeliveryState, type BridgeDeposit, type BridgeDepositState, type BridgeQuoteAssessment, type BridgeQuoteInput, type BridgeRail, type BridgeRailAttestation, type BridgeRailProblem, type BridgeRailQuoteOption, type BridgeRailQuoteRequest, type BridgeRailQuoteResponse, type BridgeRailStatusResult, type BuildRecipientDeliveryNotesParams, CHAIN_NOTE_SALT_BITS, CLEANUP_FEE_BUDGET, CLOAK_PRODUCTION_RELAY_URL, CLOAK_PROGRAM_ID, type ChainNoteTxType, type CircuitVerificationResult, type CleanupResult, type CloakConfig, CloakError, type CloakKeyPair, type CloakNote, type CloakRpc, type CommitmentEntry, type CommitmentsResponse, type CompactChainNote, type ComplianceReport, type ComplianceTxType, type ConfirmSettlementParams, type CreateRecoverableDepositUtxoParams, DEFAULT_CIRCUITS_URL, DEFAULT_TRANSACTION_CIRCUITS_URL, DELIVERY_MEMO_TAG, DELIVERY_REGISTRY_SEED, type DeliveredNote, DepositError, type DepositInstructionParams, type DepositNoteSecrets, type DepositOptions, type DepositOutcome, type DepositRef, type DepositResult, type DepositStatus, type DiscoverOptions, type DiscoverSwapRefundsOptions, type DiscoveredSwapRefund, DoNotRetry, ECONOMIC_MINIMUM, EXPECTED_CIRCUIT_HASHES, type EncryptedMetadataBundle, type EncryptedNote$1 as EncryptedNote, type ErrorCategory, type ExpandedSpendKey, type ExternalFeePayerAdapter, FEE_BUDGET, FIXED_FEE_LAMPORTS, type FundingPlan, type Groth16Proof, InsecureRandomnessError, LAMPORTS_PER_SOL, type LegacyWalletAdapter, type WalletSigner as LegacyWalletSigner, LocalStorageAdapter, type LogLevel, type Logger, type LookupTable, MAINNET_RENT_0, MAINNET_RENT_1, MAX_RECEIVER_INDEX, MERKLE_TREE_HEIGHT, MIN_DEPOSIT_LAMPORTS, MIN_DEPOSIT_SPL_BASE_UNITS, type MasterKey, type MatchChangeNoteParams, type MatchDepositNoteParams, type MatchSwapRefundLeafParams, type MaxLengthArray, MemoryStorageAdapter, type MerkleProof, type MerkleRootResponse, MerkleTree, type MessageSigner, NATIVE_SOL_MINT, type Network, type NoteData, ONECLICK_PUBKEY_B58, type OnchainMerkleProof, type ParsedDeliveryCarrier, type PaymasterTopUpExpectation, type PaymasterTopUpResult, type PendingDeposit, type PendingWithdrawal, type PostFailureVerdict, RECIPIENT_DELIVERY_CIPHERTEXT_LEN, RECIPIENT_DELIVERY_EPHEMERAL_PK_LEN, RECIPIENT_DELIVERY_NONCE_LEN, RECIPIENT_DELIVERY_NOTE_BYTES, RECIPIENT_DELIVERY_PLAINTEXT_LEN, RECIPIENT_DELIVERY_TAG_LEN, RELAY_BATCH_AUTH_MAX_ITEMS, RELAY_ORIGIN_ALLOWLIST, REQUEST_AUTH_BATCH_DOMAIN, REQUEST_AUTH_BATCH_MAX_AGE_SECONDS, REQUEST_AUTH_MAX_AGE_SECONDS, REQUEST_AUTH_MAX_FUTURE_SKEW_SECONDS, type RecipientDeliveryNote, type RecoveredChangeNote, type RecoveredChangeNoteRecord, type RecoveredDepositNote, type RecoveredDepositNoteRecord, type RecoveredSwapRefund, type RelayAuthMode, type RelayAuthPreimage, type RelayAuthSigner, RelayBatchAuthCoordinator, type RelayBatchAuthCoordinatorOptions, type RelayBatchAuthEnvelope, type RelayBatchAuthFields, type RelayBatchAuthItemHandle, RelayInternalError, RelayService, type RelaySubmissionResult, type RentRates, type RetryHooks, type RiskQuoteInstructionResponse, RootNotFoundError, SCANNER_SUPPORTS_TRANSACT_SWAP, SIGN_IN_MESSAGE, SanctionsQuoteError, type ScanOptions, type ScanRecipientDeliveryOptions, type ScanResult, type ScanSummary, type ScannedTransaction, type SettlementConnection, type SettlementContext, type SettlementStatus, type SettlementVerdict, SettlementVerificationError, ShieldPoolErrors, type ShieldPoolPDAs, SimpleWallet, type SpendKey, type SpendOptions, type StorageAdapter, type SubmitTransactToRelayArgs, type SwapOptions, type SwapParams, type SwapRefundAuthorization, type SwapResult, TERMINAL_FAILURE, TRANSACTION_CIRCUITS_VERSION, TRANSACT_AUTH_FIELDS, TRANSACT_SWAP_AUTH_FIELDS, type TransactBatchItem, type TransactBatchItemOutcome, type TransactBatchOptions, type TransactBatchResult, type TransactOptions, type TransactParams, type TransactRequestBodyParams, type TransactResult, TransactionConfirmationError, type TransactionMetadata, type Transfer, type TransferOptions, type TransferResult, type TxStatus, type UserFriendlyError, type Utxo, UtxoAlreadySpentError, type EncryptedNote as UtxoEncryptedNote, type UtxoKeypair, type UtxoSwapParams, type UtxoSwapResult, UtxoWallet, VARIABLE_FEE_DENOMINATOR, VARIABLE_FEE_NUMERATOR, VARIABLE_FEE_RATE, VERSION, type VerifyUtxosResult, type ViewKey, type ViewingKeyPair, WITHDRAW_FEE_BPS, WITHDRAW_FIXED_FEE, type WalletAdapterBridgeOptions, type WalletSigner$1 as WalletSigner, type WalletUtxo, type Web3Module, type WithdrawOptions, type WithdrawSubmissionResult, accountMeta, addressBytes, addressFromBytes, addressFromPublicKey, assertDirectSubmissionLanded, assertInputMints, assertTransactionCircuitIntegrity, assessBridgeQuote, bigintToBytes32$1 as bigintToBytes32, bigintToHex, buildAuthTransactionMessage, buildMerkleTree, buildMerkleTreeFromChain, buildMerkleTreeFromRelay, buildRecipientDeliveryNotes, buildRelayAuthPreimage, buildRelayBatchAuthMessage, buildTransactRequestBody, buildTransactionMessage, bytesToHex, calculateFee, calculateFeeBigint, calculateRelayFee, canRebuildMerkleTreeFromChain, canonicalJson, canonicalPayloadString, chainNoteFromBase64, chainNoteToBase64, classifyPostFailure, classifyRelayError, cleanupReceivingAddress, cleanupStalePendingOperations, clearPendingDeposits, clearPendingWithdrawals, cloakBridgeRail, computeChainNoteHash, computeExtDataHash, computeMerkleRoot, computeProofForLatestDeposit, computeProofFromChain, computeSignature, computeSwapRefundCommitment, computeCommitment as computeUtxoCommitment, computeNullifier as computeUtxoNullifier, confirmSignature, confirmTransactSettlement, copyNoteToClipboard, createCloakError, createCloakRpc, createDepositInstruction, createLogger, createRecoverableChangeUtxo, createRecoverableDepositUtxo, createRelayBatchAuthCoordinator, createUtxo, createZeroUtxo, decryptCompactChainNote, decryptComplianceMetadataWithMasterKey, decryptTransactionMetadata, depositFromDerivedKey, deriveBridgeReceiver, deriveChangeNoteBlinding, deriveDepositNoteBlinding, deriveDiversifiedViewingKey, deriveDiversifier, deriveFundingTargets, deriveInputNullifierPdas, deriveLegacyBridgeReceiver, deriveLegacyDepositNoteSecrets, deriveLegacySwapRefundAuthorization, derivePublicKey, deriveSpendKey, deriveSwapRefundAuthorization, deriveSwapRefundBlinding, deriveUserCompliancePublicKey, deriveUserComplianceScalar, deriveUtxoKeypairFromSpendKey, deriveViewKey, deriveViewingKeyFromNk, deriveViewingKeyFromSpendKey, deriveViewingKeyFromUtxoPrivateKey, deserializeUtxo, detectNetworkFromRpcUrl, discoverSwapRefunds, downloadNote, encodeDeliveryCarrierMemo, encodeNoteSimple, encodeRecipientDeliveryNote, encryptCompactChainNote, encryptNoteForRecipient, encryptTransactionMetadata, encryptTransactionMetadataBundle, expandSpendKey, explainRelayAuthRejection, exportKeys, exportNote, exportWalletKeys, fetchAccountBytes, fetchCommitments, fetchLatestBlockhash, fetchLookupTables, fetchRiskQuoteInstruction, fetchRiskQuoteIx, fetchSignaturesForAddress, filterNotesByNetwork, filterWithdrawableNotes, findNoteByCommitment, findProgramAddress, formatAmount, formatComplianceCsv, formatErrorForLogging, formatSol, fullWithdraw, fundReceiverViaPaymaster, generateCloakKeys, generateCommitmentAsync, generateMasterSeed, generateNoteFromWallet, generateUtxoKeypair, generateViewingKeyPair, getAddressExplorerUrl, getChainNoteRegistryPDA, getCircuitsPath, getDeliveryRegistryPDA, getDistributableAmount, getExplorerUrl, getNkFromUtxoPrivateKey, getNullifierPDA, getPendingOperationsSummary, getPoolAuthorityConfigPDA, getPublicKey, getPublicViewKey, getRecipientAmount, getRpcUrlForNetwork, getShieldPoolPDAs, getSwapStatePDA, getViewKey, hasPendingOperations, hexToBigint$1 as hexToBigint, hexToBytes, importKeys, importWalletKeys, isBrowser, isBrowserLike, isDebugEnabled, isMessageSigner, isPlausibleSignature, isReactNative, isRootNotFoundError, isSubmissionOutcomeUnknownResponse, isTerminalFailure, isValidHex, isValidRpcUrl, isValidSolanaAddress, isWithdrawAmountSufficient, isWithdrawable, listBridgeDeposits, loadPendingDeposits, loadPendingWithdrawals, loadVerifiedCircuitArtifacts, matchChangeNote, matchDepositNote, matchSwapRefundLeaf, mayRetry, messageSignerFromCallback, openRecipientDeliveryNote, parseAmount, parseDeliveryCarrierMemo, parseError, parseNote, parseRelayErrorResponse, parseRelayErrorSignature, parseTransactionError, partialWithdraw, partiallySignTransaction, poseidonHash, preflightCheck, preflightNullifiers, prepareEncryptedOutput, prepareEncryptedOutputForRecipient, programInstruction, proofToBytes, pubkeyToFieldElement, pubkeyToLimbs, randomBytes, randomChangeNoteSalt, randomDepositNoteSalt, randomFieldElement, readMerkleTreeState, readRent, recipientDeliveryNoteToBase64, registerViewingKey, relayRequestDigestHex, removePendingDeposit, removePendingWithdrawal, renderAssessment, resolveCircuitsBase, retryDelayMs, savePendingDeposit, savePendingWithdrawal, scanNotesForWallet, scanRecipientDeliveryNotes, scanTransactions, sdkLogger, selectUtxos, sendInstructions, sendRawTransaction, sendTransaction, serializeAuthTransactionMessage, serializeNote, serializeUtxo, setCircuitsPath, setDebugMode, signCompiledTransaction, signMessageBytes, signRelayAuthPayload, signTransaction, signerFromKeypair, signerFromSecretKey, signerFromWalletAdapter, splitTo2Limbs, submitTransactToRelay, sumUtxoAmounts, swapUtxo, swapWithChange, toAddress, toComplianceReport, transact, transactBatch, transactionBase64, transactionBytes, transactionFromBytes, transactionWireSize, transfer, truncate, tryDecryptNote, updateNoteWithDeposit, updatePendingDeposit, updatePendingWithdrawal, bigintToBytes32 as utxoBigintToBytes32, utxoEquals, hexToBigint as utxoHexToBigint, validateDepositParams, validateNote, validateOutputsSum, validatePaymasterTopUpTransaction, validateRoot, validateTransfers, validateWalletConnected, validateWithdrawableNote, verifyAllCircuits, verifyCircuitIntegrity, verifyQuoteSignature, verifyUtxos, waitForRoot, withShieldRetries, withTiming, withdrawFeeFor };
|
|
6422
|
+
export { BRIDGE_ESCROW_LABEL, BRIDGE_ESCROW_LABEL_V2, BUILD_ALLOWS_LOCAL_ENDPOINTS, type BridgeDeliveryState, type BridgeDeposit, type BridgeDepositState, type BridgeQuoteAssessment, type BridgeQuoteInput, type BridgeRail, type BridgeRailAttestation, type BridgeRailProblem, type BridgeRailQuoteOption, type BridgeRailQuoteRequest, type BridgeRailQuoteResponse, type BridgeRailStatusResult, type BuildRecipientDeliveryNotesParams, CHAIN_NOTE_SALT_BITS, CLEANUP_FEE_BUDGET, CLOAK_PRODUCTION_RELAY_URL, CLOAK_PROGRAM_ID, type ChainNoteTxType, type CircuitVerificationResult, type CleanupResult, type CloakConfig, CloakError, type CloakKeyPair, type CloakNote, type CloakRpc, type CommitmentEntry, type CommitmentsResponse, type CompactChainNote, type ComplianceReport, type ComplianceTxType, type ConfirmSettlementParams, type CreateRecoverableDepositUtxoParams, DEFAULT_CIRCUITS_URL, DEFAULT_TRANSACTION_CIRCUITS_URL, DELIVERY_MEMO_TAG, DELIVERY_REGISTRY_SEED, type DeliveredNote, DepositError, type DepositInstructionParams, type DepositNoteSecrets, type DepositOptions, type DepositOutcome, type DepositRef, type DepositResult, type DepositStatus, type DiscoverOptions, type DiscoverSwapRefundsOptions, type DiscoveredSwapRefund, DoNotRetry, ECONOMIC_MINIMUM, EXPECTED_CIRCUIT_HASHES, type EncodeNoteIndexPageParams, type EncryptedMetadataBundle, type EncryptedNote$1 as EncryptedNote, type ErrorCategory, type ExpandedSpendKey, type ExternalFeePayerAdapter, FEE_BUDGET, FIXED_FEE_LAMPORTS, type FundingPlan, type Groth16Proof, type IndexedRecoveredNote, type IndexedRecoveredNoteKind, InsecureRandomnessError, LAMPORTS_PER_SOL, type LegacyWalletAdapter, type WalletSigner as LegacyWalletSigner, LocalStorageAdapter, type LogLevel, type Logger, type LookupTable, MAINNET_RENT_0, MAINNET_RENT_1, MAX_RECEIVER_INDEX, MERKLE_TREE_HEIGHT, MIN_DEPOSIT_LAMPORTS, MIN_DEPOSIT_SPL_BASE_UNITS, type MasterKey, type MatchChangeNoteParams, type MatchDepositNoteParams, type MatchSwapRefundLeafParams, type MaxLengthArray, MemoryStorageAdapter, type MerkleProof, type MerkleRootResponse, MerkleTree, type MessageSigner, NATIVE_SOL_MINT, NOTE_INDEX_NO_LEAF, NOTE_INDEX_PAGE_SIZE, type Network, type NoteData, type NoteIndexCursor, type NoteIndexDeliveryItem, type NoteIndexFetchOptions, NoteIndexFormatError, type NoteIndexHead, NoteIndexHeadBehindError, type NoteIndexItem, type NoteIndexPage, type NoteIndexRecoveryStats, type NoteIndexSwapRefundItem, type NoteIndexTxItem, ONECLICK_PUBKEY_B58, type OnchainMerkleProof, type ParseNoteIndexPageOptions, type ParsedDeliveryCarrier, type PaymasterTopUpExpectation, type PaymasterTopUpResult, type PendingDeposit, type PendingWithdrawal, type PostFailureVerdict, RECIPIENT_DELIVERY_CIPHERTEXT_LEN, RECIPIENT_DELIVERY_EPHEMERAL_PK_LEN, RECIPIENT_DELIVERY_NONCE_LEN, RECIPIENT_DELIVERY_NOTE_BYTES, RECIPIENT_DELIVERY_PLAINTEXT_LEN, RECIPIENT_DELIVERY_TAG_LEN, RELAY_BATCH_AUTH_MAX_ITEMS, RELAY_ORIGIN_ALLOWLIST, REQUEST_AUTH_BATCH_DOMAIN, REQUEST_AUTH_BATCH_MAX_AGE_SECONDS, REQUEST_AUTH_MAX_AGE_SECONDS, REQUEST_AUTH_MAX_FUTURE_SKEW_SECONDS, type RecipientDeliveryNote, type RecoverNotesFromIndexParams, type RecoverNotesFromIndexResult, type RecoveredChangeNote, type RecoveredChangeNoteRecord, type RecoveredDepositNote, type RecoveredDepositNoteRecord, type RecoveredSwapRefund, type RelayAuthMode, type RelayAuthPreimage, type RelayAuthSigner, RelayBatchAuthCoordinator, type RelayBatchAuthCoordinatorOptions, type RelayBatchAuthEnvelope, type RelayBatchAuthFields, type RelayBatchAuthItemHandle, RelayInternalError, RelayService, type RelaySubmissionResult, type RentRates, type RetryHooks, type RiskQuoteInstructionResponse, RootNotFoundError, SCANNER_SUPPORTS_TRANSACT_SWAP, SIGN_IN_MESSAGE, SanctionsQuoteError, type ScanOptions, type ScanRecipientDeliveryOptions, type ScanResult, type ScanSummary, type ScannedTransaction, type SettlementConnection, type SettlementContext, type SettlementStatus, type SettlementVerdict, SettlementVerificationError, ShieldPoolErrors, type ShieldPoolPDAs, SimpleWallet, type SpendKey, type SpendOptions, type StorageAdapter, type SubmitTransactToRelayArgs, type SwapOptions, type SwapParams, type SwapRefundAuthorization, type SwapResult, TERMINAL_FAILURE, TRANSACTION_CIRCUITS_VERSION, TRANSACT_AUTH_FIELDS, TRANSACT_SWAP_AUTH_FIELDS, type TransactBatchItem, type TransactBatchItemOutcome, type TransactBatchOptions, type TransactBatchResult, type TransactOptions, type TransactParams, type TransactRequestBodyParams, type TransactResult, TransactionConfirmationError, type TransactionMetadata, type Transfer, type TransferOptions, type TransferResult, type TxStatus, type UserFriendlyError, type Utxo, UtxoAlreadySpentError, type EncryptedNote as UtxoEncryptedNote, type UtxoKeypair, type UtxoSwapParams, type UtxoSwapResult, UtxoWallet, VARIABLE_FEE_DENOMINATOR, VARIABLE_FEE_NUMERATOR, VARIABLE_FEE_RATE, VERSION, type VerifyUtxosResult, type ViewKey, type ViewingKeyPair, WITHDRAW_FEE_BPS, WITHDRAW_FIXED_FEE, type WalletAdapterBridgeOptions, type WalletSigner$1 as WalletSigner, type WalletUtxo, type Web3Module, type WithdrawOptions, type WithdrawSubmissionResult, accountMeta, addressBytes, addressFromBytes, addressFromPublicKey, assertDirectSubmissionLanded, assertInputMints, assertTransactionCircuitIntegrity, assessBridgeQuote, bigintToBytes32$1 as bigintToBytes32, bigintToHex, buildAuthTransactionMessage, buildMerkleTree, buildMerkleTreeFromChain, buildMerkleTreeFromRelay, buildRecipientDeliveryNotes, buildRelayAuthPreimage, buildRelayBatchAuthMessage, buildTransactRequestBody, buildTransactionMessage, bytesToHex, calculateFee, calculateFeeBigint, calculateRelayFee, canRebuildMerkleTreeFromChain, canonicalJson, canonicalPayloadString, chainNoteFromBase64, chainNoteToBase64, classifyPostFailure, classifyRelayError, cleanupReceivingAddress, cleanupStalePendingOperations, clearPendingDeposits, clearPendingWithdrawals, cloakBridgeRail, computeChainNoteHash, computeExtDataHash, computeMerkleRoot, computeNoteIndexChain, computeProofForLatestDeposit, computeProofFromChain, computeSignature, computeSwapRefundCommitment, computeCommitment as computeUtxoCommitment, computeNullifier as computeUtxoNullifier, confirmSignature, confirmTransactSettlement, copyNoteToClipboard, createCloakError, createCloakRpc, createDepositInstruction, createLogger, createRecoverableChangeUtxo, createRecoverableDepositUtxo, createRelayBatchAuthCoordinator, createUtxo, createZeroUtxo, decryptCompactChainNote, decryptComplianceMetadataWithMasterKey, decryptTransactionMetadata, depositFromDerivedKey, deriveBridgeReceiver, deriveChangeNoteBlinding, deriveDepositNoteBlinding, deriveDiversifiedViewingKey, deriveDiversifier, deriveFundingTargets, deriveInputNullifierPdas, deriveLegacyBridgeReceiver, deriveLegacyDepositNoteSecrets, deriveLegacySwapRefundAuthorization, derivePublicKey, deriveSpendKey, deriveSwapRefundAuthorization, deriveSwapRefundBlinding, deriveUserCompliancePublicKey, deriveUserComplianceScalar, deriveUtxoKeypairFromSpendKey, deriveViewKey, deriveViewingKeyFromNk, deriveViewingKeyFromSpendKey, deriveViewingKeyFromUtxoPrivateKey, deserializeUtxo, detectNetworkFromRpcUrl, discoverSwapRefunds, downloadNote, encodeDeliveryCarrierMemo, encodeNoteIndexItem, encodeNoteIndexPage, encodeNoteSimple, encodeRecipientDeliveryNote, encryptCompactChainNote, encryptNoteForRecipient, encryptTransactionMetadata, encryptTransactionMetadataBundle, expandSpendKey, explainRelayAuthRejection, exportKeys, exportNote, exportWalletKeys, fetchAccountBytes, fetchCommitments, fetchLatestBlockhash, fetchLookupTables, fetchNoteIndexHead, fetchNoteIndexPage, fetchRiskQuoteInstruction, fetchRiskQuoteIx, fetchSignaturesForAddress, filterNotesByNetwork, filterWithdrawableNotes, findNoteByCommitment, findProgramAddress, formatAmount, formatComplianceCsv, formatErrorForLogging, formatSol, fullWithdraw, fundReceiverViaPaymaster, generateCloakKeys, generateCommitmentAsync, generateMasterSeed, generateNoteFromWallet, generateUtxoKeypair, generateViewingKeyPair, getAddressExplorerUrl, getChainNoteRegistryPDA, getCircuitsPath, getDeliveryRegistryPDA, getDistributableAmount, getExplorerUrl, getNkFromUtxoPrivateKey, getNullifierPDA, getPendingOperationsSummary, getPoolAuthorityConfigPDA, getPublicKey, getPublicViewKey, getRecipientAmount, getRpcUrlForNetwork, getShieldPoolPDAs, getSwapStatePDA, getViewKey, hasPendingOperations, hexToBigint$1 as hexToBigint, hexToBytes, importKeys, importWalletKeys, isBrowser, isBrowserLike, isDebugEnabled, isMessageSigner, isPlausibleSignature, isReactNative, isRootNotFoundError, isSubmissionOutcomeUnknownResponse, isTerminalFailure, isValidHex, isValidRpcUrl, isValidSolanaAddress, isWithdrawAmountSufficient, isWithdrawable, listBridgeDeposits, loadPendingDeposits, loadPendingWithdrawals, loadVerifiedCircuitArtifacts, matchChangeNote, matchDepositNote, matchSwapRefundLeaf, mayRetry, messageSignerFromCallback, openRecipientDeliveryNote, parseAmount, parseDeliveryCarrierMemo, parseError, parseNote, parseNoteIndexItem, parseNoteIndexPage, parseRelayErrorResponse, parseRelayErrorSignature, parseTransactionError, partialWithdraw, partiallySignTransaction, poseidonHash, preflightCheck, preflightNullifiers, prepareEncryptedOutput, prepareEncryptedOutputForRecipient, programInstruction, proofToBytes, pubkeyToFieldElement, pubkeyToLimbs, randomBytes, randomChangeNoteSalt, randomDepositNoteSalt, randomFieldElement, readMerkleTreeState, readRent, recipientDeliveryNoteToBase64, recoverNotesFromIndex, registerViewingKey, relayRequestDigestHex, removePendingDeposit, removePendingWithdrawal, renderAssessment, resolveCircuitsBase, retryDelayMs, savePendingDeposit, savePendingWithdrawal, scanNotesForWallet, scanRecipientDeliveryNotes, scanTransactions, sdkLogger, selectUtxos, sendInstructions, sendRawTransaction, sendTransaction, serializeAuthTransactionMessage, serializeNote, serializeUtxo, setCircuitsPath, setDebugMode, signCompiledTransaction, signMessageBytes, signRelayAuthPayload, signTransaction, signerFromKeypair, signerFromSecretKey, signerFromWalletAdapter, splitTo2Limbs, submitTransactToRelay, sumUtxoAmounts, swapUtxo, swapWithChange, toAddress, toComplianceReport, transact, transactBatch, transactionBase64, transactionBytes, transactionFromBytes, transactionWireSize, transfer, truncate, tryDecryptNote, updateNoteWithDeposit, updatePendingDeposit, updatePendingWithdrawal, bigintToBytes32 as utxoBigintToBytes32, utxoEquals, hexToBigint as utxoHexToBigint, validateDepositParams, validateNote, validateOutputsSum, validatePaymasterTopUpTransaction, validateRoot, validateTransfers, validateWalletConnected, validateWithdrawableNote, verifyAllCircuits, verifyCircuitIntegrity, verifyQuoteSignature, verifyUtxos, waitForRoot, withShieldRetries, withTiming, withdrawFeeFor };
|