@cloak.dev/sdk 0.2.6 → 0.2.8

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/index.d.cts CHANGED
@@ -3589,18 +3589,43 @@ interface TransactOptions {
3589
3589
  */
3590
3590
  relayAuthBatch?: RelayBatchAuthItemHandle;
3591
3591
  /**
3592
- * Referral code attached to fee-bearing relay requests (SDK-001).
3592
+ * Partner (affiliate) code attached to fee-bearing relay requests (SDK-001).
3593
3593
  *
3594
- * Sent as `affiliate_code`, and signed inside the relay request, only when it is a non-empty
3595
- * string AND the request is fee-bearing: a withdrawal / send to a public address
3596
- * (`externalAmount < 0` with a recipient) or a swap intake. Deposits and shield-to-shield sends
3597
- * never carry it, whatever is passed here. Omitted, every request is byte-identical to one built
3594
+ * Normalised once at the flow boundary (trimmed, lower-cased; see {@link normalizeAffiliateCode}),
3595
+ * then sent as `affiliate_code` and signed inside the relay request, only when it is valid
3596
+ * (`^[a-z0-9_]{3,24}$`) AND the request is fee-bearing: a withdrawal / send to a public address
3597
+ * (`externalAmount < 0` with a recipient) or a swap intake. Deposits, shield-to-shield sends and
3598
+ * the internal merge steps of `partialWithdraw` never carry it, whatever is passed here. A code
3599
+ * that is still invalid after normalising is left out and reported through {@link onWarning};
3600
+ * it never fails the withdrawal or swap. Omitted, every request is byte-identical to one built
3598
3601
  * without this option (INV-007). Requires a relay that accepts `affiliate_code`.
3599
3602
  *
3600
- * @internal For Cloak's own web and mobile apps. Not part of the public API, not documented, and
3601
- * may change without notice.
3603
+ * `partialWithdraw`, `fullWithdraw`, `swapUtxo`, `swapWithChange` and `transactBatch` all pass it
3604
+ * down: in a batch one code applies to every fee-bearing item (a per-item `options.affiliateCode`
3605
+ * overrides it).
3606
+ *
3607
+ * @internal For Cloak's own web and mobile apps (spec SDK-001, NG-02, NG-10). Not part of the
3608
+ * public API, not documented, and may change without notice.
3602
3609
  */
3603
3610
  affiliateCode?: string;
3611
+ /**
3612
+ * Called with a human-readable message when the SDK adjusts or drops something instead of
3613
+ * failing: today, an `affiliateCode` or `relayClientId` that is not valid. Optional; the flow
3614
+ * behaves the same without it.
3615
+ */
3616
+ onWarning?: (message: string) => void;
3617
+ /**
3618
+ * Identifies a non-browser client to the relay by sending `X-Cloak-Client: <value>` with
3619
+ * `/transact` and `/transact_swap`. The relay only counts affiliate events from an allowed
3620
+ * browser Origin or from a client id of the exact form `cloak-mobile/(ios|android)/N.N.N`, so
3621
+ * Cloak's own mobile app sets this, e.g. `"cloak-mobile/ios/1.4.0"`. A malformed value is left
3622
+ * out and reported through {@link onWarning}; it never fails the request (INV-006). Browser
3623
+ * callers should leave it unset: a non-safelisted header turns every submission into a CORS
3624
+ * preflight. Wins over a `relayHeaders` entry of the same name.
3625
+ *
3626
+ * @internal For Cloak's own mobile app (spec REL-016, NG-02). Not part of the public API.
3627
+ */
3628
+ relayClientId?: string;
3604
3629
  /**
3605
3630
  * Extra HTTP headers sent with this flow's relay submissions (`POST /transact` and
3606
3631
  * `POST /transact_swap`), e.g. `{ "X-Cloak-Client": "cloak-mobile/ios/1.4.0" }` (SDK-004).
@@ -3792,7 +3817,7 @@ interface SubmitTransactToRelayArgs {
3792
3817
  * builds its own request must `await preflightNullifiers(inputUtxos, connection, programId)` first.
3793
3818
  */
3794
3819
  declare function submitTransactToRelay(args: SubmitTransactToRelayArgs): Promise<RelaySubmissionResult>;
3795
- declare function transact(params: TransactParams, options: TransactOptions): Promise<TransactResult>;
3820
+ declare function transact(params: TransactParams, rawOptions: TransactOptions): Promise<TransactResult>;
3796
3821
  /**
3797
3822
  * Execute a shield-to-shield transfer
3798
3823
  *
@@ -3808,7 +3833,21 @@ declare function transact(params: TransactParams, options: TransactOptions): Pro
3808
3833
  * @param amount Amount to transfer
3809
3834
  * @param options Transaction options, including the mandatory `ownerUtxoKeypair`
3810
3835
  */
3811
- declare function transfer(inputUtxos: Utxo[], recipientPubkey: bigint, amount: bigint, options: SpendOptions): Promise<TransactResult>;
3836
+ declare function transfer(inputUtxos: Utxo[], recipientPubkey: bigint, amount: bigint, rawOptions: SpendOptions): Promise<TransactResult>;
3837
+ type SweepResult = {
3838
+ note: Utxo;
3839
+ result: TransactResult;
3840
+ };
3841
+ /**
3842
+ * Move up to two notes owned by other keys (a per-request receive key, or a pre-0.2.6 legacy key)
3843
+ * under the wallet's long-lived key with ONE self-spend: one extra transaction and one extra relay
3844
+ * request signature. `transfer` does this on its own when no input is wallet-owned; call it
3845
+ * directly to sweep received request notes in the background. `partialWithdraw`/`fullWithdraw` need
3846
+ * no sweep (their change is output 0, which the circuit leaves free).
3847
+ *
3848
+ * The sweep must not carry a recipient delivery, so `recipientViewingPublicKey` is dropped.
3849
+ */
3850
+ declare function sweepToWalletKey(inputUtxos: Utxo[], rawOptions: SpendOptions): Promise<SweepResult>;
3812
3851
  /**
3813
3852
  * Execute a partial withdrawal
3814
3853
  *
@@ -3823,7 +3862,7 @@ declare function transfer(inputUtxos: Utxo[], recipientPubkey: bigint, amount: b
3823
3862
  * @param withdrawAmount Amount to withdraw
3824
3863
  * @param options Transaction options, including the mandatory `ownerUtxoKeypair`
3825
3864
  */
3826
- declare function partialWithdraw(inputUtxos: Utxo[], recipient: Address, withdrawAmount: bigint, options: SpendOptions): Promise<TransactResult>;
3865
+ declare function partialWithdraw(inputUtxos: Utxo[], recipient: Address, withdrawAmount: bigint, rawOptions: SpendOptions): Promise<TransactResult>;
3827
3866
  /**
3828
3867
  * Execute a full withdrawal
3829
3868
  *
@@ -3894,7 +3933,7 @@ interface UtxoSwapResult extends TransactResult {
3894
3933
  * @param options Transaction options
3895
3934
  * @returns UtxoSwapResult with SwapState PDA for executing the swap
3896
3935
  */
3897
- declare function swapUtxo(params: UtxoSwapParams, options: SpendOptions): Promise<UtxoSwapResult>;
3936
+ declare function swapUtxo(params: UtxoSwapParams, rawOptions: SpendOptions): Promise<UtxoSwapResult>;
3898
3937
  /**
3899
3938
  * Execute a swap with change
3900
3939
  *
@@ -3907,7 +3946,7 @@ declare function swapUtxo(params: UtxoSwapParams, options: SpendOptions): Promis
3907
3946
  * @param minOutputAmount Minimum output (slippage protection)
3908
3947
  * @param options Transaction options
3909
3948
  */
3910
- declare function swapWithChange(inputUtxos: Utxo[], swapAmount: bigint, outputMint: Address, recipientAta: Address, minOutputAmount: bigint, options: SpendOptions, recipientWallet?: Address): Promise<UtxoSwapResult>;
3949
+ declare function swapWithChange(inputUtxos: Utxo[], swapAmount: bigint, outputMint: Address, recipientAta: Address, minOutputAmount: bigint, rawOptions: SpendOptions, recipientWallet?: Address): Promise<UtxoSwapResult>;
3911
3950
 
3912
3951
  /**
3913
3952
  * Circuit artifact loading and integrity verification.
@@ -4206,6 +4245,21 @@ declare function cleanupStalePendingOperations(maxAgeMs?: number): {
4206
4245
  removedWithdrawals: number;
4207
4246
  };
4208
4247
 
4248
+ /**
4249
+ * Normalise a partner code the way the relay expects it: trimmed and lower-cased. Returns `null`
4250
+ * when the result is still not a valid code (or the input is not a string), so apps can validate a
4251
+ * field before they ever call the SDK.
4252
+ *
4253
+ * @internal For Cloak's own web and mobile apps (spec NG-10). Not part of the public API.
4254
+ */
4255
+ declare function normalizeAffiliateCode(raw: unknown): string | null;
4256
+ /**
4257
+ * Whether `value` is a well-formed `X-Cloak-Client` value, e.g. `cloak-mobile/ios/1.4.0`.
4258
+ *
4259
+ * @internal For Cloak's own mobile app (spec REL-016). Not part of the public API.
4260
+ */
4261
+ declare function isValidRelayClientId(value: unknown): value is string;
4262
+
4209
4263
  interface TransactBatchItem {
4210
4264
  params: TransactParams;
4211
4265
  /** Per-item overrides (recipient viewing key, chain-note salt, expected mint, ...). */
@@ -4230,7 +4284,14 @@ interface TransactBatchResult {
4230
4284
  /** Wallet approvals raised: 1 for the batch, plus 1 per wave of stale-root re-proves. */
4231
4285
  approvals: number;
4232
4286
  }
4233
- declare function transactBatch(items: readonly TransactBatchItem[], options: TransactBatchOptions): Promise<TransactBatchResult>;
4287
+ /**
4288
+ * Partner code semantics: `options.affiliateCode` (and `relayClientId`) apply to every item, and
4289
+ * each item decides for itself whether it is fee-bearing. A withdrawal with a recipient carries the
4290
+ * code; a shield-to-shield send, a deposit or a consolidation step charges no variable fee and
4291
+ * never does. An item may set its own `options.affiliateCode` to override the batch's. The code is
4292
+ * normalised, and an invalid one reported through `onWarning`, once for the whole batch.
4293
+ */
4294
+ declare function transactBatch(items: readonly TransactBatchItem[], rawOptions: TransactBatchOptions): Promise<TransactBatchResult>;
4234
4295
 
4235
4296
  /**
4236
4297
  * Recipient-addressed delivery envelope (CLKD1).
@@ -5295,6 +5356,59 @@ declare function encodeNoteIndexItem(item: NoteIndexItem): Uint8Array;
5295
5356
  */
5296
5357
  declare function encodeNoteIndexPage(params: EncodeNoteIndexPageParams): Uint8Array;
5297
5358
 
5359
+ /**
5360
+ * Per-request receive keys.
5361
+ *
5362
+ * A request link names who should be paid. If every link carried the wallet's long-lived UTXO key
5363
+ * and viewing key, two payers (or anyone who sees two links) could tell they came from one
5364
+ * requester. So each request gets its own UTXO keypair and its own X25519 viewing keypair:
5365
+ *
5366
+ * root = BLAKE3("cloak_request_root_nk_v1" || nk) (default, "nk")
5367
+ * | BLAKE3("cloak_request_root_v1" || skSpend) ("seed")
5368
+ * utxo priv = BLAKE3("cloak_request_utxo_v1" || root || counter_be32) mod (r >> 4)
5369
+ * view sk = clamp(BLAKE3("cloak_request_vk_v1" || root || counter_be32))
5370
+ *
5371
+ * Deterministic, so a restore from the seed re-derives counters 0..N and scans for them.
5372
+ *
5373
+ * ── Which root ─────────────────────────────────────────────────────────────────────────────────
5374
+ * The default root derives from `nk`, the viewing base the wallet registers with the relay for
5375
+ * compliance. So Cloak's compliance tooling can still see which requests belong to a wallet, while
5376
+ * nothing public links two request links to one requester: each link carries its own keys and the
5377
+ * public never sees nk. The "seed" root derives from the spend key instead and never reaches the
5378
+ * relay, so even the relay cannot link requests to a wallet. Both are implemented and tested;
5379
+ * {@link REQUEST_KEY_ROOT_SOURCE} is the one switch, and callers that pass no source get it.
5380
+ */
5381
+
5382
+ type RequestKeyRootSource = "seed" | "nk";
5383
+ /** The root the SDK derives request keys from when the caller does not choose. */
5384
+ declare const REQUEST_KEY_ROOT_SOURCE: RequestKeyRootSource;
5385
+ /** HD-style gap limit a restore derives and scans past the last counter it knows of. */
5386
+ declare const REQUEST_KEY_GAP_LIMIT = 20;
5387
+ /** Most request keys one scan trials (each costs one trial open per recipient-delivery item). */
5388
+ declare const MAX_REQUEST_KEYS = 64;
5389
+ interface RequestKeys {
5390
+ counter: number;
5391
+ /** Owner of notes paid to this request. Real private key. */
5392
+ utxoKeypair: UtxoKeypair;
5393
+ /** X25519 pair the delivery envelope is sealed to. */
5394
+ viewingKeypair: {
5395
+ privateKey: Uint8Array;
5396
+ publicKey: Uint8Array;
5397
+ };
5398
+ }
5399
+ /**
5400
+ * The 32-byte request root. `skSpend` is the wallet's spend key (seed root); `nk` is the registered
5401
+ * viewing base (nk root). Only the field the chosen source needs is read.
5402
+ */
5403
+ declare function deriveRequestKeyRoot(input: {
5404
+ skSpend?: Uint8Array;
5405
+ nk?: Uint8Array;
5406
+ }, source?: RequestKeyRootSource): Uint8Array;
5407
+ /** The keys for request `counter`. */
5408
+ declare function deriveRequestKeys(root: Uint8Array, counter: number): Promise<RequestKeys>;
5409
+ /** Keys for counters `[from, from + count)`, at most {@link MAX_REQUEST_KEYS}. */
5410
+ declare function deriveRequestKeyRange(root: Uint8Array, from: number, count: number): Promise<RequestKeys[]>;
5411
+
5298
5412
  /**
5299
5413
  * Restore a wallet's notes from the relay's Note Index v1 (contract revision 2.1), without walking
5300
5414
  * the chain and without telling anyone which notes, pools or nullifiers are its own.
@@ -5398,6 +5512,12 @@ interface IndexedRecoveredNote {
5398
5512
  * key), `false` for `notes`.
5399
5513
  */
5400
5514
  legacyExposed: boolean;
5515
+ /**
5516
+ * Set when the note was paid to a per-request key ({@link RecoverNotesFromIndexParams.requestKeys}):
5517
+ * that entry's `index`. `utxo.keypair` is then the request's keypair, not the wallet's, so the
5518
+ * note is spent by sweeping it into the wallet key first.
5519
+ */
5520
+ requestIndex?: number;
5401
5521
  }
5402
5522
  /**
5403
5523
  * The persisted resume point. JSON-serializable and holds NO key material, but `own` records which
@@ -5472,6 +5592,18 @@ interface RecoverNotesFromIndexParams {
5472
5592
  legacyViewingKeyNks?: Uint8Array[];
5473
5593
  /** The wallet's long-lived UTXO keypair, with its real private key. */
5474
5594
  ownerUtxoKeypair: UtxoKeypair;
5595
+ /**
5596
+ * Per-request receive keys (see `notes/request-keys.ts`), at most {@link MAX_REQUEST_KEYS}. Only
5597
+ * recipient-delivery items are trialed against them, so each costs one extra open per delivery
5598
+ * item and no extra request. Notes found through one come back in `notes` with `requestIndex`
5599
+ * set. A cursor from a run with fewer keys has already covered earlier pages without them: when
5600
+ * a restore adds keys, drop the cursor.
5601
+ */
5602
+ requestKeys?: Array<{
5603
+ index: number;
5604
+ viewingSecretKey: Uint8Array;
5605
+ ownerKeypair: UtxoKeypair;
5606
+ }>;
5475
5607
  /** The `cursor` of the previous run. Omit for a full sync. */
5476
5608
  cursor?: NoteIndexCursor;
5477
5609
  /** Per mint: ignore legacy-shaped (nk-owned) notes at or after this leaf (a release cutoff). */
@@ -6415,8 +6547,8 @@ declare function withShieldRetries<T>(attempt: (attemptNo: number) => Promise<T>
6415
6547
  * @packageDocumentation
6416
6548
  */
6417
6549
 
6418
- declare const VERSION = "0.2.6";
6550
+ declare const VERSION = "0.2.8";
6419
6551
  /** True when scanner supports TransactSwap (tag 1). Check this to verify the correct SDK bundle is loaded. */
6420
6552
  declare const SCANNER_SUPPORTS_TRANSACT_SWAP = true;
6421
6553
 
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 };
6554
+ 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, MAX_REQUEST_KEYS, 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, REQUEST_KEY_GAP_LIMIT, REQUEST_KEY_ROOT_SOURCE, 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 RequestKeyRootSource, type RequestKeys, 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, type SweepResult, 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, deriveRequestKeyRange, deriveRequestKeyRoot, deriveRequestKeys, 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, isValidRelayClientId, isValidRpcUrl, isValidSolanaAddress, isWithdrawAmountSufficient, isWithdrawable, listBridgeDeposits, loadPendingDeposits, loadPendingWithdrawals, loadVerifiedCircuitArtifacts, matchChangeNote, matchDepositNote, matchSwapRefundLeaf, mayRetry, messageSignerFromCallback, normalizeAffiliateCode, 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, sweepToWalletKey, 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 };
package/dist/index.d.ts CHANGED
@@ -3589,18 +3589,43 @@ interface TransactOptions {
3589
3589
  */
3590
3590
  relayAuthBatch?: RelayBatchAuthItemHandle;
3591
3591
  /**
3592
- * Referral code attached to fee-bearing relay requests (SDK-001).
3592
+ * Partner (affiliate) code attached to fee-bearing relay requests (SDK-001).
3593
3593
  *
3594
- * Sent as `affiliate_code`, and signed inside the relay request, only when it is a non-empty
3595
- * string AND the request is fee-bearing: a withdrawal / send to a public address
3596
- * (`externalAmount < 0` with a recipient) or a swap intake. Deposits and shield-to-shield sends
3597
- * never carry it, whatever is passed here. Omitted, every request is byte-identical to one built
3594
+ * Normalised once at the flow boundary (trimmed, lower-cased; see {@link normalizeAffiliateCode}),
3595
+ * then sent as `affiliate_code` and signed inside the relay request, only when it is valid
3596
+ * (`^[a-z0-9_]{3,24}$`) AND the request is fee-bearing: a withdrawal / send to a public address
3597
+ * (`externalAmount < 0` with a recipient) or a swap intake. Deposits, shield-to-shield sends and
3598
+ * the internal merge steps of `partialWithdraw` never carry it, whatever is passed here. A code
3599
+ * that is still invalid after normalising is left out and reported through {@link onWarning};
3600
+ * it never fails the withdrawal or swap. Omitted, every request is byte-identical to one built
3598
3601
  * without this option (INV-007). Requires a relay that accepts `affiliate_code`.
3599
3602
  *
3600
- * @internal For Cloak's own web and mobile apps. Not part of the public API, not documented, and
3601
- * may change without notice.
3603
+ * `partialWithdraw`, `fullWithdraw`, `swapUtxo`, `swapWithChange` and `transactBatch` all pass it
3604
+ * down: in a batch one code applies to every fee-bearing item (a per-item `options.affiliateCode`
3605
+ * overrides it).
3606
+ *
3607
+ * @internal For Cloak's own web and mobile apps (spec SDK-001, NG-02, NG-10). Not part of the
3608
+ * public API, not documented, and may change without notice.
3602
3609
  */
3603
3610
  affiliateCode?: string;
3611
+ /**
3612
+ * Called with a human-readable message when the SDK adjusts or drops something instead of
3613
+ * failing: today, an `affiliateCode` or `relayClientId` that is not valid. Optional; the flow
3614
+ * behaves the same without it.
3615
+ */
3616
+ onWarning?: (message: string) => void;
3617
+ /**
3618
+ * Identifies a non-browser client to the relay by sending `X-Cloak-Client: <value>` with
3619
+ * `/transact` and `/transact_swap`. The relay only counts affiliate events from an allowed
3620
+ * browser Origin or from a client id of the exact form `cloak-mobile/(ios|android)/N.N.N`, so
3621
+ * Cloak's own mobile app sets this, e.g. `"cloak-mobile/ios/1.4.0"`. A malformed value is left
3622
+ * out and reported through {@link onWarning}; it never fails the request (INV-006). Browser
3623
+ * callers should leave it unset: a non-safelisted header turns every submission into a CORS
3624
+ * preflight. Wins over a `relayHeaders` entry of the same name.
3625
+ *
3626
+ * @internal For Cloak's own mobile app (spec REL-016, NG-02). Not part of the public API.
3627
+ */
3628
+ relayClientId?: string;
3604
3629
  /**
3605
3630
  * Extra HTTP headers sent with this flow's relay submissions (`POST /transact` and
3606
3631
  * `POST /transact_swap`), e.g. `{ "X-Cloak-Client": "cloak-mobile/ios/1.4.0" }` (SDK-004).
@@ -3792,7 +3817,7 @@ interface SubmitTransactToRelayArgs {
3792
3817
  * builds its own request must `await preflightNullifiers(inputUtxos, connection, programId)` first.
3793
3818
  */
3794
3819
  declare function submitTransactToRelay(args: SubmitTransactToRelayArgs): Promise<RelaySubmissionResult>;
3795
- declare function transact(params: TransactParams, options: TransactOptions): Promise<TransactResult>;
3820
+ declare function transact(params: TransactParams, rawOptions: TransactOptions): Promise<TransactResult>;
3796
3821
  /**
3797
3822
  * Execute a shield-to-shield transfer
3798
3823
  *
@@ -3808,7 +3833,21 @@ declare function transact(params: TransactParams, options: TransactOptions): Pro
3808
3833
  * @param amount Amount to transfer
3809
3834
  * @param options Transaction options, including the mandatory `ownerUtxoKeypair`
3810
3835
  */
3811
- declare function transfer(inputUtxos: Utxo[], recipientPubkey: bigint, amount: bigint, options: SpendOptions): Promise<TransactResult>;
3836
+ declare function transfer(inputUtxos: Utxo[], recipientPubkey: bigint, amount: bigint, rawOptions: SpendOptions): Promise<TransactResult>;
3837
+ type SweepResult = {
3838
+ note: Utxo;
3839
+ result: TransactResult;
3840
+ };
3841
+ /**
3842
+ * Move up to two notes owned by other keys (a per-request receive key, or a pre-0.2.6 legacy key)
3843
+ * under the wallet's long-lived key with ONE self-spend: one extra transaction and one extra relay
3844
+ * request signature. `transfer` does this on its own when no input is wallet-owned; call it
3845
+ * directly to sweep received request notes in the background. `partialWithdraw`/`fullWithdraw` need
3846
+ * no sweep (their change is output 0, which the circuit leaves free).
3847
+ *
3848
+ * The sweep must not carry a recipient delivery, so `recipientViewingPublicKey` is dropped.
3849
+ */
3850
+ declare function sweepToWalletKey(inputUtxos: Utxo[], rawOptions: SpendOptions): Promise<SweepResult>;
3812
3851
  /**
3813
3852
  * Execute a partial withdrawal
3814
3853
  *
@@ -3823,7 +3862,7 @@ declare function transfer(inputUtxos: Utxo[], recipientPubkey: bigint, amount: b
3823
3862
  * @param withdrawAmount Amount to withdraw
3824
3863
  * @param options Transaction options, including the mandatory `ownerUtxoKeypair`
3825
3864
  */
3826
- declare function partialWithdraw(inputUtxos: Utxo[], recipient: Address, withdrawAmount: bigint, options: SpendOptions): Promise<TransactResult>;
3865
+ declare function partialWithdraw(inputUtxos: Utxo[], recipient: Address, withdrawAmount: bigint, rawOptions: SpendOptions): Promise<TransactResult>;
3827
3866
  /**
3828
3867
  * Execute a full withdrawal
3829
3868
  *
@@ -3894,7 +3933,7 @@ interface UtxoSwapResult extends TransactResult {
3894
3933
  * @param options Transaction options
3895
3934
  * @returns UtxoSwapResult with SwapState PDA for executing the swap
3896
3935
  */
3897
- declare function swapUtxo(params: UtxoSwapParams, options: SpendOptions): Promise<UtxoSwapResult>;
3936
+ declare function swapUtxo(params: UtxoSwapParams, rawOptions: SpendOptions): Promise<UtxoSwapResult>;
3898
3937
  /**
3899
3938
  * Execute a swap with change
3900
3939
  *
@@ -3907,7 +3946,7 @@ declare function swapUtxo(params: UtxoSwapParams, options: SpendOptions): Promis
3907
3946
  * @param minOutputAmount Minimum output (slippage protection)
3908
3947
  * @param options Transaction options
3909
3948
  */
3910
- declare function swapWithChange(inputUtxos: Utxo[], swapAmount: bigint, outputMint: Address, recipientAta: Address, minOutputAmount: bigint, options: SpendOptions, recipientWallet?: Address): Promise<UtxoSwapResult>;
3949
+ declare function swapWithChange(inputUtxos: Utxo[], swapAmount: bigint, outputMint: Address, recipientAta: Address, minOutputAmount: bigint, rawOptions: SpendOptions, recipientWallet?: Address): Promise<UtxoSwapResult>;
3911
3950
 
3912
3951
  /**
3913
3952
  * Circuit artifact loading and integrity verification.
@@ -4206,6 +4245,21 @@ declare function cleanupStalePendingOperations(maxAgeMs?: number): {
4206
4245
  removedWithdrawals: number;
4207
4246
  };
4208
4247
 
4248
+ /**
4249
+ * Normalise a partner code the way the relay expects it: trimmed and lower-cased. Returns `null`
4250
+ * when the result is still not a valid code (or the input is not a string), so apps can validate a
4251
+ * field before they ever call the SDK.
4252
+ *
4253
+ * @internal For Cloak's own web and mobile apps (spec NG-10). Not part of the public API.
4254
+ */
4255
+ declare function normalizeAffiliateCode(raw: unknown): string | null;
4256
+ /**
4257
+ * Whether `value` is a well-formed `X-Cloak-Client` value, e.g. `cloak-mobile/ios/1.4.0`.
4258
+ *
4259
+ * @internal For Cloak's own mobile app (spec REL-016). Not part of the public API.
4260
+ */
4261
+ declare function isValidRelayClientId(value: unknown): value is string;
4262
+
4209
4263
  interface TransactBatchItem {
4210
4264
  params: TransactParams;
4211
4265
  /** Per-item overrides (recipient viewing key, chain-note salt, expected mint, ...). */
@@ -4230,7 +4284,14 @@ interface TransactBatchResult {
4230
4284
  /** Wallet approvals raised: 1 for the batch, plus 1 per wave of stale-root re-proves. */
4231
4285
  approvals: number;
4232
4286
  }
4233
- declare function transactBatch(items: readonly TransactBatchItem[], options: TransactBatchOptions): Promise<TransactBatchResult>;
4287
+ /**
4288
+ * Partner code semantics: `options.affiliateCode` (and `relayClientId`) apply to every item, and
4289
+ * each item decides for itself whether it is fee-bearing. A withdrawal with a recipient carries the
4290
+ * code; a shield-to-shield send, a deposit or a consolidation step charges no variable fee and
4291
+ * never does. An item may set its own `options.affiliateCode` to override the batch's. The code is
4292
+ * normalised, and an invalid one reported through `onWarning`, once for the whole batch.
4293
+ */
4294
+ declare function transactBatch(items: readonly TransactBatchItem[], rawOptions: TransactBatchOptions): Promise<TransactBatchResult>;
4234
4295
 
4235
4296
  /**
4236
4297
  * Recipient-addressed delivery envelope (CLKD1).
@@ -5295,6 +5356,59 @@ declare function encodeNoteIndexItem(item: NoteIndexItem): Uint8Array;
5295
5356
  */
5296
5357
  declare function encodeNoteIndexPage(params: EncodeNoteIndexPageParams): Uint8Array;
5297
5358
 
5359
+ /**
5360
+ * Per-request receive keys.
5361
+ *
5362
+ * A request link names who should be paid. If every link carried the wallet's long-lived UTXO key
5363
+ * and viewing key, two payers (or anyone who sees two links) could tell they came from one
5364
+ * requester. So each request gets its own UTXO keypair and its own X25519 viewing keypair:
5365
+ *
5366
+ * root = BLAKE3("cloak_request_root_nk_v1" || nk) (default, "nk")
5367
+ * | BLAKE3("cloak_request_root_v1" || skSpend) ("seed")
5368
+ * utxo priv = BLAKE3("cloak_request_utxo_v1" || root || counter_be32) mod (r >> 4)
5369
+ * view sk = clamp(BLAKE3("cloak_request_vk_v1" || root || counter_be32))
5370
+ *
5371
+ * Deterministic, so a restore from the seed re-derives counters 0..N and scans for them.
5372
+ *
5373
+ * ── Which root ─────────────────────────────────────────────────────────────────────────────────
5374
+ * The default root derives from `nk`, the viewing base the wallet registers with the relay for
5375
+ * compliance. So Cloak's compliance tooling can still see which requests belong to a wallet, while
5376
+ * nothing public links two request links to one requester: each link carries its own keys and the
5377
+ * public never sees nk. The "seed" root derives from the spend key instead and never reaches the
5378
+ * relay, so even the relay cannot link requests to a wallet. Both are implemented and tested;
5379
+ * {@link REQUEST_KEY_ROOT_SOURCE} is the one switch, and callers that pass no source get it.
5380
+ */
5381
+
5382
+ type RequestKeyRootSource = "seed" | "nk";
5383
+ /** The root the SDK derives request keys from when the caller does not choose. */
5384
+ declare const REQUEST_KEY_ROOT_SOURCE: RequestKeyRootSource;
5385
+ /** HD-style gap limit a restore derives and scans past the last counter it knows of. */
5386
+ declare const REQUEST_KEY_GAP_LIMIT = 20;
5387
+ /** Most request keys one scan trials (each costs one trial open per recipient-delivery item). */
5388
+ declare const MAX_REQUEST_KEYS = 64;
5389
+ interface RequestKeys {
5390
+ counter: number;
5391
+ /** Owner of notes paid to this request. Real private key. */
5392
+ utxoKeypair: UtxoKeypair;
5393
+ /** X25519 pair the delivery envelope is sealed to. */
5394
+ viewingKeypair: {
5395
+ privateKey: Uint8Array;
5396
+ publicKey: Uint8Array;
5397
+ };
5398
+ }
5399
+ /**
5400
+ * The 32-byte request root. `skSpend` is the wallet's spend key (seed root); `nk` is the registered
5401
+ * viewing base (nk root). Only the field the chosen source needs is read.
5402
+ */
5403
+ declare function deriveRequestKeyRoot(input: {
5404
+ skSpend?: Uint8Array;
5405
+ nk?: Uint8Array;
5406
+ }, source?: RequestKeyRootSource): Uint8Array;
5407
+ /** The keys for request `counter`. */
5408
+ declare function deriveRequestKeys(root: Uint8Array, counter: number): Promise<RequestKeys>;
5409
+ /** Keys for counters `[from, from + count)`, at most {@link MAX_REQUEST_KEYS}. */
5410
+ declare function deriveRequestKeyRange(root: Uint8Array, from: number, count: number): Promise<RequestKeys[]>;
5411
+
5298
5412
  /**
5299
5413
  * Restore a wallet's notes from the relay's Note Index v1 (contract revision 2.1), without walking
5300
5414
  * the chain and without telling anyone which notes, pools or nullifiers are its own.
@@ -5398,6 +5512,12 @@ interface IndexedRecoveredNote {
5398
5512
  * key), `false` for `notes`.
5399
5513
  */
5400
5514
  legacyExposed: boolean;
5515
+ /**
5516
+ * Set when the note was paid to a per-request key ({@link RecoverNotesFromIndexParams.requestKeys}):
5517
+ * that entry's `index`. `utxo.keypair` is then the request's keypair, not the wallet's, so the
5518
+ * note is spent by sweeping it into the wallet key first.
5519
+ */
5520
+ requestIndex?: number;
5401
5521
  }
5402
5522
  /**
5403
5523
  * The persisted resume point. JSON-serializable and holds NO key material, but `own` records which
@@ -5472,6 +5592,18 @@ interface RecoverNotesFromIndexParams {
5472
5592
  legacyViewingKeyNks?: Uint8Array[];
5473
5593
  /** The wallet's long-lived UTXO keypair, with its real private key. */
5474
5594
  ownerUtxoKeypair: UtxoKeypair;
5595
+ /**
5596
+ * Per-request receive keys (see `notes/request-keys.ts`), at most {@link MAX_REQUEST_KEYS}. Only
5597
+ * recipient-delivery items are trialed against them, so each costs one extra open per delivery
5598
+ * item and no extra request. Notes found through one come back in `notes` with `requestIndex`
5599
+ * set. A cursor from a run with fewer keys has already covered earlier pages without them: when
5600
+ * a restore adds keys, drop the cursor.
5601
+ */
5602
+ requestKeys?: Array<{
5603
+ index: number;
5604
+ viewingSecretKey: Uint8Array;
5605
+ ownerKeypair: UtxoKeypair;
5606
+ }>;
5475
5607
  /** The `cursor` of the previous run. Omit for a full sync. */
5476
5608
  cursor?: NoteIndexCursor;
5477
5609
  /** Per mint: ignore legacy-shaped (nk-owned) notes at or after this leaf (a release cutoff). */
@@ -6415,8 +6547,8 @@ declare function withShieldRetries<T>(attempt: (attemptNo: number) => Promise<T>
6415
6547
  * @packageDocumentation
6416
6548
  */
6417
6549
 
6418
- declare const VERSION = "0.2.6";
6550
+ declare const VERSION = "0.2.8";
6419
6551
  /** True when scanner supports TransactSwap (tag 1). Check this to verify the correct SDK bundle is loaded. */
6420
6552
  declare const SCANNER_SUPPORTS_TRANSACT_SWAP = true;
6421
6553
 
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 };
6554
+ 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, MAX_REQUEST_KEYS, 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, REQUEST_KEY_GAP_LIMIT, REQUEST_KEY_ROOT_SOURCE, 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 RequestKeyRootSource, type RequestKeys, 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, type SweepResult, 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, deriveRequestKeyRange, deriveRequestKeyRoot, deriveRequestKeys, 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, isValidRelayClientId, isValidRpcUrl, isValidSolanaAddress, isWithdrawAmountSufficient, isWithdrawable, listBridgeDeposits, loadPendingDeposits, loadPendingWithdrawals, loadVerifiedCircuitArtifacts, matchChangeNote, matchDepositNote, matchSwapRefundLeaf, mayRetry, messageSignerFromCallback, normalizeAffiliateCode, 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, sweepToWalletKey, 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 };