@cloak.dev/sdk 0.2.1 → 0.2.2-staging.0f03668
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -11
- package/dist/index.cjs +378 -31
- package/dist/index.d.cts +160 -1
- package/dist/index.d.ts +160 -1
- package/dist/index.js +372 -31
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3027,6 +3027,15 @@ interface TransactOptions {
|
|
|
3027
3027
|
* to compress account addresses from 32 bytes to 1-byte indices.
|
|
3028
3028
|
*/
|
|
3029
3029
|
addressLookupTableAccounts?: AddressLookupTableAccount[];
|
|
3030
|
+
/**
|
|
3031
|
+
* Opt-in: when true and `relayUrl` is set, an SPL deposit that needs a supplemental lookup
|
|
3032
|
+
* table asks the relay to extend its shared table (`${relayUrl}/supplemental-alt`) instead of
|
|
3033
|
+
* creating a depositor-signed throwaway table, so the user signs exactly once. Any relay
|
|
3034
|
+
* failure — a bad response, a missing address, or the client-side slot gate never clearing —
|
|
3035
|
+
* falls back to the old depositor-signed ephemeral-ALT path automatically. Off (the default)
|
|
3036
|
+
* preserves the old behaviour exactly.
|
|
3037
|
+
*/
|
|
3038
|
+
relaySupplementalAlt?: boolean;
|
|
3030
3039
|
/**
|
|
3031
3040
|
* Optional Range.org API key for direct SDK-side quote fetching.
|
|
3032
3041
|
*
|
|
@@ -3979,6 +3988,137 @@ interface MatchDepositNoteParams {
|
|
|
3979
3988
|
*/
|
|
3980
3989
|
declare function matchDepositNote(params: MatchDepositNoteParams): Promise<RecoveredDepositNote | null>;
|
|
3981
3990
|
|
|
3991
|
+
/**
|
|
3992
|
+
* Recoverable change notes (VK-01, change shape).
|
|
3993
|
+
*
|
|
3994
|
+
* ── The defect this closes ────────────────────────────────────────────────────────────────────
|
|
3995
|
+
* A partial withdrawal spends a note worth more than the withdrawal and puts the remainder back in
|
|
3996
|
+
* the pool as a change note. `partialWithdraw` built that note with plain `createUtxo`, whose
|
|
3997
|
+
* blinding comes from `randomFieldElement()` — a 252-bit CSPRNG draw written to exactly one place:
|
|
3998
|
+
* whatever the caller does with `TransactResult.outputUtxos`. A caller that drops it, or a throw
|
|
3999
|
+
* between the relay accepting the transaction and the caller persisting the result, destroys the
|
|
4000
|
+
* only copy. The inputs are spent, the change is on chain, and it can never be spent by anyone.
|
|
4001
|
+
*
|
|
4002
|
+
* This is not hypothetical. It stranded 19.939819 USDC on 2026-09-02 (commitment
|
|
4003
|
+
* `138d126b58521b5d14e5bc85ed4e38db3f1218ef4061ad86e07ad4784ee40b6c`, leaf 2290 of the USDC tree):
|
|
4004
|
+
* a payment-link claim ran `partialWithdraw`, the claim page never read `outputUtxos`, and the
|
|
4005
|
+
* blinding died with the page. Every other value needed to spend that note is still recoverable —
|
|
4006
|
+
* amount, owner key, mint, commitment, leaf index. Only the randomness is gone.
|
|
4007
|
+
*
|
|
4008
|
+
* The SDK already ships key-only recovery for DEPOSITS (`notes/deposit-note.ts`, PRF(nk, noteSalt)),
|
|
4009
|
+
* for RECEIVED transfers (`notes/delivery-note.ts`, CLKD1 envelope) and for SWAP REFUNDS
|
|
4010
|
+
* (`notes/swap-refund.ts`, PRF(nk, nullifier0)). Change was the one shape with no recovery path at
|
|
4011
|
+
* all, and it is the shape every withdrawal produces.
|
|
4012
|
+
*
|
|
4013
|
+
* ── Why derivation, and why nothing else was available ────────────────────────────────────────
|
|
4014
|
+
* The CLKD1 delivery envelope is the only rail in the protocol that publishes a blinding, and it
|
|
4015
|
+
* rejects this shape twice over: `buildRecipientDeliveryNotes` returns `undefined` when
|
|
4016
|
+
* `externalAmount !== 0` (a withdrawal) and again when the note's owner is the spender (change is
|
|
4017
|
+
* self-owned). Both gates are correct — a delivery envelope exists to reach someone else, and
|
|
4018
|
+
* change has no one to reach. So make the chain note the protocol already emits carry the recovery
|
|
4019
|
+
* instead, at zero additional bytes:
|
|
4020
|
+
*
|
|
4021
|
+
* seed = BLAKE3("cloak_change_note_v1" || nk || noteSalt(32B BE) || outputIndex(1B) || "blinding")
|
|
4022
|
+
* blinding = seed reduced into the field
|
|
4023
|
+
*
|
|
4024
|
+
* The output index is in the preimage because one transaction carries one salt but two output
|
|
4025
|
+
* slots, and a send-to-self puts a self-owned note in BOTH. Without the index those two notes would
|
|
4026
|
+
* derive one blinding, and `transact`'s fail-closed check could not tell which slot it was looking
|
|
4027
|
+
* at. With it, every slot has its own answer.
|
|
4028
|
+
*
|
|
4029
|
+
* ── Why only the blinding, when deposits derive the keypair too ───────────────────────────────
|
|
4030
|
+
* A deposit's output note has no prior owner, so `deposit-note.ts` is free to give it a per-deposit
|
|
4031
|
+
* key and gains unlinkability by doing so. A change note is different: its owner is already fixed —
|
|
4032
|
+
* it is the keypair of the note being spent (`inputUtxos[0].keypair`), which the spender by
|
|
4033
|
+
* definition holds, and which callers rely on to keep spending their own change. Re-owning it under
|
|
4034
|
+
* a derived key would change `outPubkey0`, break that expectation, and buy nothing, because the
|
|
4035
|
+
* spender's key is the one value in a change note that was never at risk. Only the randomness was.
|
|
4036
|
+
*
|
|
4037
|
+
* ── What a cold scan can rebuild, and what it cannot ──────────────────────────────────────────
|
|
4038
|
+
* For the shape that lost the money — a partial withdrawal — recovery is COMPLETE from `nk` alone.
|
|
4039
|
+
* `partialWithdraw` emits the change as `outputUtxos[0]`, and a v4 chain note binds
|
|
4040
|
+
* `noteSemantics = Poseidon(outAmount0, outPubkey0, isSendToSelfKey0)` and carries all three in its
|
|
4041
|
+
* (encrypted, authenticated) plaintext. So a scanner holding `nk` decrypts the note, reads
|
|
4042
|
+
* `noteSalt`, `outAmount0` and `outPubkey0`, replays the line above, recomputes
|
|
4043
|
+
* `Poseidon(amount, pubkey, blinding, mint)` and requires it to equal a commitment the transaction
|
|
4044
|
+
* actually published. That equality is the authentication, exactly as in `matchDepositNote`.
|
|
4045
|
+
*
|
|
4046
|
+
* For `transfer`, change is `outputUtxos[1]` — the recipient note has to be output 0 because the
|
|
4047
|
+
* delivery carrier is bound to `output_commitments[0]`. A v4 chain note describes output 0 only, so
|
|
4048
|
+
* a cold scan does not learn the change AMOUNT and cannot finish the match on its own. The blinding
|
|
4049
|
+
* is still derived and still recoverable, which turns "permanently unspendable" into "spendable as
|
|
4050
|
+
* soon as the amount is known" — and a sender who knows what they sent knows the amount. Closing
|
|
4051
|
+
* that last gap needs the chain note to describe output 1 as well, which is a format change and is
|
|
4052
|
+
* deliberately not attempted here.
|
|
4053
|
+
*
|
|
4054
|
+
* ── Guardrails preserved ──────────────────────────────────────────────────────────────────────
|
|
4055
|
+
* [M-04] `noteSalt` stays a private input to `chainNoteHash`; it is only ever published inside the
|
|
4056
|
+
* note's own authenticated ciphertext, so nothing an observer can see changes. [H-04-shaped] the
|
|
4057
|
+
* reduction forces non-zero, because a zero blinding is an unspendable note. Callers that pass no
|
|
4058
|
+
* `nk` keep the previous random-blinding behaviour unchanged, so this is additive.
|
|
4059
|
+
*/
|
|
4060
|
+
|
|
4061
|
+
/** A change note recovered from `nk` (plus the owner key the spender already holds). */
|
|
4062
|
+
interface RecoveredChangeNote {
|
|
4063
|
+
keypair: UtxoKeypair;
|
|
4064
|
+
blinding: bigint;
|
|
4065
|
+
amount: bigint;
|
|
4066
|
+
mintAddress: PublicKey;
|
|
4067
|
+
/** The commitment the transaction published, reproduced from the derived blinding. */
|
|
4068
|
+
commitment: bigint;
|
|
4069
|
+
/** The salt the chain note carried, which anchored the derivation. */
|
|
4070
|
+
noteSalt: bigint;
|
|
4071
|
+
}
|
|
4072
|
+
/** A fresh 96-bit chain-note salt, from the same fail-closed source `transact` uses. */
|
|
4073
|
+
declare function randomChangeNoteSalt(): bigint;
|
|
4074
|
+
/**
|
|
4075
|
+
* Derive a change note's blinding from `(nk, noteSalt)`.
|
|
4076
|
+
*
|
|
4077
|
+
* Deterministic by design: this is the whole reason a cold scan can rebuild the note. Both the
|
|
4078
|
+
* builder and the scanner call it, so there is exactly one definition of what a change note is.
|
|
4079
|
+
*/
|
|
4080
|
+
declare function deriveChangeNoteBlinding(viewingKeyNk: Uint8Array, noteSalt: bigint, outputIndex: number): bigint;
|
|
4081
|
+
/**
|
|
4082
|
+
* Build a change output note whose blinding a cold `(rpc, programId, nk)` scan can re-derive.
|
|
4083
|
+
*
|
|
4084
|
+
* Returns the UTXO AND the salt that anchored it. The SAME salt must reach `transact` as
|
|
4085
|
+
* `options.chainNoteSalt`, because the chain note is what publishes it — a salt that does not reach
|
|
4086
|
+
* the note leaves the change exactly as unrecoverable as before. `partialWithdraw` and `transfer`
|
|
4087
|
+
* do this for you; the pairing is only your concern if you call `transact` directly.
|
|
4088
|
+
*/
|
|
4089
|
+
declare function createRecoverableChangeUtxo(amount: bigint, keypair: UtxoKeypair, viewingKeyNk: Uint8Array, mintAddress?: PublicKey, noteSalt?: bigint, outputIndex?: number): Promise<{
|
|
4090
|
+
utxo: Utxo;
|
|
4091
|
+
noteSalt: bigint;
|
|
4092
|
+
}>;
|
|
4093
|
+
interface MatchChangeNoteParams {
|
|
4094
|
+
/** The spending wallet's incoming viewing base. */
|
|
4095
|
+
viewingKeyNk: Uint8Array;
|
|
4096
|
+
/** `noteSalt`, read out of the decrypted chain note. */
|
|
4097
|
+
noteSalt: bigint;
|
|
4098
|
+
/** Candidate note amount — `outAmount0` for a partial withdrawal's change. */
|
|
4099
|
+
amount: bigint;
|
|
4100
|
+
/**
|
|
4101
|
+
* The change note's owner keypair. For a match, only `publicKey` is used (`outPubkey0` from the
|
|
4102
|
+
* chain note is enough); supply the private key too if you intend to spend the result.
|
|
4103
|
+
*/
|
|
4104
|
+
keypair: UtxoKeypair;
|
|
4105
|
+
/** Pool mint the commitment was computed under. */
|
|
4106
|
+
mintAddress: PublicKey;
|
|
4107
|
+
/** Which output slot the note occupied — part of the derivation, so it must match. */
|
|
4108
|
+
outputIndex: number;
|
|
4109
|
+
/** Output commitments the transaction actually published, hex or field elements. */
|
|
4110
|
+
outputCommitments: Array<string | bigint>;
|
|
4111
|
+
}
|
|
4112
|
+
/**
|
|
4113
|
+
* Decide whether a published commitment is a change note this `nk` can rebuild, and if so return it
|
|
4114
|
+
* in spendable form. Returns `null` for everything that is not ours.
|
|
4115
|
+
*
|
|
4116
|
+
* The commitment equality is the authentication. Nothing here trusts the chain note's own claim
|
|
4117
|
+
* about what it describes; the note supplies `noteSalt`, `amount` and the owner key, and the derived
|
|
4118
|
+
* blinding has to reproduce a value the transaction published or the candidate is discarded.
|
|
4119
|
+
*/
|
|
4120
|
+
declare function matchChangeNote(params: MatchChangeNoteParams): Promise<RecoveredChangeNote | null>;
|
|
4121
|
+
|
|
3982
4122
|
/**
|
|
3983
4123
|
* Swap timeout-refund discovery (VK-02).
|
|
3984
4124
|
*
|
|
@@ -4230,6 +4370,25 @@ interface ScanResult {
|
|
|
4230
4370
|
* Additive, for the same reason as `deliveredNotes`: note secrets are not compliance rows.
|
|
4231
4371
|
*/
|
|
4232
4372
|
recoveredDepositNotes: RecoveredDepositNoteRecord[];
|
|
4373
|
+
/**
|
|
4374
|
+
* This wallet's OWN withdrawal/swap change, rebuilt from `nk` alone (VK-01, change shape).
|
|
4375
|
+
*
|
|
4376
|
+
* `partialWithdraw` and `swapWithChange` emit change as output 0, and a v4 chain note carries
|
|
4377
|
+
* `outAmount0`/`outPubkey0`, so `nk` plus the derived blinding is everything the note needs.
|
|
4378
|
+
*
|
|
4379
|
+
* One difference from `recoveredDepositNotes`: a change note's owner key is NOT derived — it is
|
|
4380
|
+
* the keypair of the note that was spent, deliberately, so that holding a viewing key never
|
|
4381
|
+
* confers spend authority. So `keypair.privateKey` comes back as `0n` and the caller must supply
|
|
4382
|
+
* their own before spending. Everything else is complete.
|
|
4383
|
+
*/
|
|
4384
|
+
recoveredChangeNotes: RecoveredChangeNoteRecord[];
|
|
4385
|
+
}
|
|
4386
|
+
/** A recovered change note plus the chain coordinates it was recovered from. */
|
|
4387
|
+
interface RecoveredChangeNoteRecord extends RecoveredChangeNote {
|
|
4388
|
+
/** Signature of the withdrawal/swap transaction. */
|
|
4389
|
+
signature: string;
|
|
4390
|
+
/** Millisecond timestamp from the chain note. */
|
|
4391
|
+
timestamp: bigint;
|
|
4233
4392
|
}
|
|
4234
4393
|
/** A recovered deposit note plus the chain coordinates it was recovered from. */
|
|
4235
4394
|
interface RecoveredDepositNoteRecord extends RecoveredDepositNote {
|
|
@@ -4519,4 +4678,4 @@ declare const VERSION = "0.2.1";
|
|
|
4519
4678
|
/** True when scanner supports TransactSwap (tag 1). Check this to verify the correct SDK bundle is loaded. */
|
|
4520
4679
|
declare const SCANNER_SUPPORTS_TRANSACT_SWAP = true;
|
|
4521
4680
|
|
|
4522
|
-
export { BUILD_ALLOWS_LOCAL_ENDPOINTS, type BuildRecipientDeliveryNotesParams, CHAIN_NOTE_SALT_BITS, CLOAK_PRODUCTION_RELAY_URL, CLOAK_PROGRAM_ID, type ChainNoteTxType, type CircuitVerificationResult, type CloakConfig, CloakError, type CloakKeyPair, type CloakNote, type CommitmentEntry, type CommitmentsResponse, type CompactChainNote, type ComplianceReport, type ComplianceTxType, type ConfirmSettlementParams, DEFAULT_CIRCUITS_URL, DEFAULT_TRANSACTION_CIRCUITS_URL, DELIVERY_MEMO_TAG, DELIVERY_REGISTRY_SEED, type DeliveredNote, type DepositInstructionParams, type DepositNoteSecrets, type DepositOptions, type DepositResult, type DepositStatus, type DiscoverSwapRefundsOptions, type DiscoveredSwapRefund, EXPECTED_CIRCUIT_HASHES, type EncryptedMetadataBundle, type EncryptedNote$1 as EncryptedNote, type ErrorCategory, type ExpandedSpendKey, type ExternalFeePayerAdapter, FIXED_FEE_LAMPORTS, type Groth16Proof, InsecureRandomnessError, LAMPORTS_PER_SOL, LocalStorageAdapter, type LogLevel, type Logger, MERKLE_TREE_HEIGHT, MIN_DEPOSIT_LAMPORTS, type MasterKey, type MatchDepositNoteParams, type MatchSwapRefundLeafParams, type MaxLengthArray, MemoryStorageAdapter, type MerkleProof, type MerkleRootResponse, MerkleTree, NATIVE_SOL_MINT, type Network, type NoteData, type OnchainMerkleProof, type ParsedDeliveryCarrier, type PendingDeposit, type PendingWithdrawal, 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_ORIGIN_ALLOWLIST, REQUEST_AUTH_MAX_AGE_SECONDS, REQUEST_AUTH_MAX_FUTURE_SKEW_SECONDS, type RecipientDeliveryNote, type RecoveredDepositNote, type RecoveredDepositNoteRecord, type RecoveredSwapRefund, type RelayAuthPreimage, type RelayAuthSigner, RelayInternalError, RelayService, type RelaySubmissionResult, 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 StorageAdapter, type SubmitTransactToRelayArgs, type SwapOptions, type SwapParams, type SwapRefundAuthorization, type SwapResult, TRANSACTION_CIRCUITS_VERSION, TRANSACT_AUTH_FIELDS, TRANSACT_SWAP_AUTH_FIELDS, type TransactOptions, type TransactParams, type TransactRequestBodyParams, type TransactResult, 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, type WalletAdapter, type WalletUtxo, type WithdrawOptions, type WithdrawSubmissionResult, assertDirectSubmissionLanded, assertTransactionCircuitIntegrity, bigintToBytes32$1 as bigintToBytes32, bigintToHex, buildMerkleTree, buildMerkleTreeFromChain, buildMerkleTreeFromRelay, buildRecipientDeliveryNotes, buildRelayAuthPreimage, buildTransactRequestBody, bytesToHex, calculateFee, calculateFeeBigint, calculateRelayFee, canRebuildMerkleTreeFromChain, canonicalJson, chainNoteFromBase64, chainNoteToBase64, classifyRelayError, cleanupStalePendingOperations, clearPendingDeposits, clearPendingWithdrawals, computeChainNoteHash, computeExtDataHash, computeMerkleRoot, computeProofForLatestDeposit, computeProofFromChain, computeSignature, computeSwapRefundCommitment, computeCommitment as computeUtxoCommitment, computeNullifier as computeUtxoNullifier, confirmTransactSettlement, copyNoteToClipboard, createCloakError, createDepositInstruction, createLogger, createRecoverableDepositUtxo, createUtxo, createZeroUtxo, decryptCompactChainNote, decryptComplianceMetadataWithMasterKey, decryptTransactionMetadata, deriveDepositNoteSecrets, deriveDiversifiedViewingKey, deriveDiversifier, deriveInputNullifierPdas, derivePublicKey, deriveSpendKey, deriveSwapRefundAuthorization, deriveUserCompliancePublicKey, deriveUserComplianceScalar, deriveUtxoKeypairFromSpendKey, deriveViewKey, deriveViewingKeyFromNk, deriveViewingKeyFromSpendKey, deriveViewingKeyFromUtxoPrivateKey, deserializeUtxo, detectNetworkFromRpcUrl, discoverSwapRefunds, downloadNote, encodeDeliveryCarrierMemo, encodeNoteSimple, encodeRecipientDeliveryNote, encryptCompactChainNote, encryptNoteForRecipient, encryptTransactionMetadata, encryptTransactionMetadataBundle, expandSpendKey, explainRelayAuthRejection, exportKeys, exportNote, exportWalletKeys, fetchCommitments, fetchRiskQuoteInstruction, fetchRiskQuoteIx, filterNotesByNetwork, filterWithdrawableNotes, findNoteByCommitment, formatAmount, formatComplianceCsv, formatErrorForLogging, formatSol, fullWithdraw, 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, isPlausibleSignature, isReactNative, isRootNotFoundError, isSubmissionOutcomeUnknownResponse, isValidHex, isValidRpcUrl, isValidSolanaAddress, isWithdrawAmountSufficient, isWithdrawable, keypairToAdapter, loadPendingDeposits, loadPendingWithdrawals, loadVerifiedCircuitArtifacts, matchDepositNote, matchSwapRefundLeaf, openRecipientDeliveryNote, parseAmount, parseDeliveryCarrierMemo, parseError, parseNote, parseRelayErrorResponse, parseRelayErrorSignature, parseTransactionError, partialWithdraw, poseidonHash, preflightCheck, preflightNullifiers, prepareEncryptedOutput, prepareEncryptedOutputForRecipient, proofToBytes, pubkeyToFieldElement, pubkeyToLimbs, randomBytes, randomDepositNoteSalt, randomFieldElement, readMerkleTreeState, recipientDeliveryNoteToBase64, registerViewingKey, removePendingDeposit, removePendingWithdrawal, resolveCircuitsBase, savePendingDeposit, savePendingWithdrawal, scanNotesForWallet, scanRecipientDeliveryNotes, scanTransactions, sdkLogger, selectUtxos, sendTransaction, serializeNote, serializeUtxo, setCircuitsPath, setDebugMode, signTransaction, splitTo2Limbs, submitTransactToRelay, sumUtxoAmounts, swapUtxo, swapWithChange, toComplianceReport, transact, transfer, truncate, tryDecryptNote, updateNoteWithDeposit, updatePendingDeposit, updatePendingWithdrawal, bigintToBytes32 as utxoBigintToBytes32, utxoEquals, hexToBigint as utxoHexToBigint, validateDepositParams, validateNote, validateOutputsSum, validateRoot, validateTransfers, validateWalletConnected, validateWithdrawableNote, verifyAllCircuits, verifyCircuitIntegrity, verifyUtxos, waitForRoot, withTiming };
|
|
4681
|
+
export { BUILD_ALLOWS_LOCAL_ENDPOINTS, type BuildRecipientDeliveryNotesParams, CHAIN_NOTE_SALT_BITS, CLOAK_PRODUCTION_RELAY_URL, CLOAK_PROGRAM_ID, type ChainNoteTxType, type CircuitVerificationResult, type CloakConfig, CloakError, type CloakKeyPair, type CloakNote, type CommitmentEntry, type CommitmentsResponse, type CompactChainNote, type ComplianceReport, type ComplianceTxType, type ConfirmSettlementParams, DEFAULT_CIRCUITS_URL, DEFAULT_TRANSACTION_CIRCUITS_URL, DELIVERY_MEMO_TAG, DELIVERY_REGISTRY_SEED, type DeliveredNote, type DepositInstructionParams, type DepositNoteSecrets, type DepositOptions, type DepositResult, type DepositStatus, type DiscoverSwapRefundsOptions, type DiscoveredSwapRefund, EXPECTED_CIRCUIT_HASHES, type EncryptedMetadataBundle, type EncryptedNote$1 as EncryptedNote, type ErrorCategory, type ExpandedSpendKey, type ExternalFeePayerAdapter, FIXED_FEE_LAMPORTS, type Groth16Proof, InsecureRandomnessError, LAMPORTS_PER_SOL, LocalStorageAdapter, type LogLevel, type Logger, MERKLE_TREE_HEIGHT, MIN_DEPOSIT_LAMPORTS, type MasterKey, type MatchChangeNoteParams, type MatchDepositNoteParams, type MatchSwapRefundLeafParams, type MaxLengthArray, MemoryStorageAdapter, type MerkleProof, type MerkleRootResponse, MerkleTree, NATIVE_SOL_MINT, type Network, type NoteData, type OnchainMerkleProof, type ParsedDeliveryCarrier, type PendingDeposit, type PendingWithdrawal, 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_ORIGIN_ALLOWLIST, REQUEST_AUTH_MAX_AGE_SECONDS, REQUEST_AUTH_MAX_FUTURE_SKEW_SECONDS, type RecipientDeliveryNote, type RecoveredChangeNote, type RecoveredChangeNoteRecord, type RecoveredDepositNote, type RecoveredDepositNoteRecord, type RecoveredSwapRefund, type RelayAuthPreimage, type RelayAuthSigner, RelayInternalError, RelayService, type RelaySubmissionResult, 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 StorageAdapter, type SubmitTransactToRelayArgs, type SwapOptions, type SwapParams, type SwapRefundAuthorization, type SwapResult, TRANSACTION_CIRCUITS_VERSION, TRANSACT_AUTH_FIELDS, TRANSACT_SWAP_AUTH_FIELDS, type TransactOptions, type TransactParams, type TransactRequestBodyParams, type TransactResult, 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, type WalletAdapter, type WalletUtxo, type WithdrawOptions, type WithdrawSubmissionResult, assertDirectSubmissionLanded, assertTransactionCircuitIntegrity, bigintToBytes32$1 as bigintToBytes32, bigintToHex, buildMerkleTree, buildMerkleTreeFromChain, buildMerkleTreeFromRelay, buildRecipientDeliveryNotes, buildRelayAuthPreimage, buildTransactRequestBody, bytesToHex, calculateFee, calculateFeeBigint, calculateRelayFee, canRebuildMerkleTreeFromChain, canonicalJson, chainNoteFromBase64, chainNoteToBase64, classifyRelayError, cleanupStalePendingOperations, clearPendingDeposits, clearPendingWithdrawals, computeChainNoteHash, computeExtDataHash, computeMerkleRoot, computeProofForLatestDeposit, computeProofFromChain, computeSignature, computeSwapRefundCommitment, computeCommitment as computeUtxoCommitment, computeNullifier as computeUtxoNullifier, confirmTransactSettlement, copyNoteToClipboard, createCloakError, createDepositInstruction, createLogger, createRecoverableChangeUtxo, createRecoverableDepositUtxo, createUtxo, createZeroUtxo, decryptCompactChainNote, decryptComplianceMetadataWithMasterKey, decryptTransactionMetadata, deriveChangeNoteBlinding, deriveDepositNoteSecrets, deriveDiversifiedViewingKey, deriveDiversifier, deriveInputNullifierPdas, derivePublicKey, deriveSpendKey, deriveSwapRefundAuthorization, deriveUserCompliancePublicKey, deriveUserComplianceScalar, deriveUtxoKeypairFromSpendKey, deriveViewKey, deriveViewingKeyFromNk, deriveViewingKeyFromSpendKey, deriveViewingKeyFromUtxoPrivateKey, deserializeUtxo, detectNetworkFromRpcUrl, discoverSwapRefunds, downloadNote, encodeDeliveryCarrierMemo, encodeNoteSimple, encodeRecipientDeliveryNote, encryptCompactChainNote, encryptNoteForRecipient, encryptTransactionMetadata, encryptTransactionMetadataBundle, expandSpendKey, explainRelayAuthRejection, exportKeys, exportNote, exportWalletKeys, fetchCommitments, fetchRiskQuoteInstruction, fetchRiskQuoteIx, filterNotesByNetwork, filterWithdrawableNotes, findNoteByCommitment, formatAmount, formatComplianceCsv, formatErrorForLogging, formatSol, fullWithdraw, 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, isPlausibleSignature, isReactNative, isRootNotFoundError, isSubmissionOutcomeUnknownResponse, isValidHex, isValidRpcUrl, isValidSolanaAddress, isWithdrawAmountSufficient, isWithdrawable, keypairToAdapter, loadPendingDeposits, loadPendingWithdrawals, loadVerifiedCircuitArtifacts, matchChangeNote, matchDepositNote, matchSwapRefundLeaf, openRecipientDeliveryNote, parseAmount, parseDeliveryCarrierMemo, parseError, parseNote, parseRelayErrorResponse, parseRelayErrorSignature, parseTransactionError, partialWithdraw, poseidonHash, preflightCheck, preflightNullifiers, prepareEncryptedOutput, prepareEncryptedOutputForRecipient, proofToBytes, pubkeyToFieldElement, pubkeyToLimbs, randomBytes, randomChangeNoteSalt, randomDepositNoteSalt, randomFieldElement, readMerkleTreeState, recipientDeliveryNoteToBase64, registerViewingKey, removePendingDeposit, removePendingWithdrawal, resolveCircuitsBase, savePendingDeposit, savePendingWithdrawal, scanNotesForWallet, scanRecipientDeliveryNotes, scanTransactions, sdkLogger, selectUtxos, sendTransaction, serializeNote, serializeUtxo, setCircuitsPath, setDebugMode, signTransaction, splitTo2Limbs, submitTransactToRelay, sumUtxoAmounts, swapUtxo, swapWithChange, toComplianceReport, transact, transfer, truncate, tryDecryptNote, updateNoteWithDeposit, updatePendingDeposit, updatePendingWithdrawal, bigintToBytes32 as utxoBigintToBytes32, utxoEquals, hexToBigint as utxoHexToBigint, validateDepositParams, validateNote, validateOutputsSum, validateRoot, validateTransfers, validateWalletConnected, validateWithdrawableNote, verifyAllCircuits, verifyCircuitIntegrity, verifyUtxos, waitForRoot, withTiming };
|
package/dist/index.d.ts
CHANGED
|
@@ -3027,6 +3027,15 @@ interface TransactOptions {
|
|
|
3027
3027
|
* to compress account addresses from 32 bytes to 1-byte indices.
|
|
3028
3028
|
*/
|
|
3029
3029
|
addressLookupTableAccounts?: AddressLookupTableAccount[];
|
|
3030
|
+
/**
|
|
3031
|
+
* Opt-in: when true and `relayUrl` is set, an SPL deposit that needs a supplemental lookup
|
|
3032
|
+
* table asks the relay to extend its shared table (`${relayUrl}/supplemental-alt`) instead of
|
|
3033
|
+
* creating a depositor-signed throwaway table, so the user signs exactly once. Any relay
|
|
3034
|
+
* failure — a bad response, a missing address, or the client-side slot gate never clearing —
|
|
3035
|
+
* falls back to the old depositor-signed ephemeral-ALT path automatically. Off (the default)
|
|
3036
|
+
* preserves the old behaviour exactly.
|
|
3037
|
+
*/
|
|
3038
|
+
relaySupplementalAlt?: boolean;
|
|
3030
3039
|
/**
|
|
3031
3040
|
* Optional Range.org API key for direct SDK-side quote fetching.
|
|
3032
3041
|
*
|
|
@@ -3979,6 +3988,137 @@ interface MatchDepositNoteParams {
|
|
|
3979
3988
|
*/
|
|
3980
3989
|
declare function matchDepositNote(params: MatchDepositNoteParams): Promise<RecoveredDepositNote | null>;
|
|
3981
3990
|
|
|
3991
|
+
/**
|
|
3992
|
+
* Recoverable change notes (VK-01, change shape).
|
|
3993
|
+
*
|
|
3994
|
+
* ── The defect this closes ────────────────────────────────────────────────────────────────────
|
|
3995
|
+
* A partial withdrawal spends a note worth more than the withdrawal and puts the remainder back in
|
|
3996
|
+
* the pool as a change note. `partialWithdraw` built that note with plain `createUtxo`, whose
|
|
3997
|
+
* blinding comes from `randomFieldElement()` — a 252-bit CSPRNG draw written to exactly one place:
|
|
3998
|
+
* whatever the caller does with `TransactResult.outputUtxos`. A caller that drops it, or a throw
|
|
3999
|
+
* between the relay accepting the transaction and the caller persisting the result, destroys the
|
|
4000
|
+
* only copy. The inputs are spent, the change is on chain, and it can never be spent by anyone.
|
|
4001
|
+
*
|
|
4002
|
+
* This is not hypothetical. It stranded 19.939819 USDC on 2026-09-02 (commitment
|
|
4003
|
+
* `138d126b58521b5d14e5bc85ed4e38db3f1218ef4061ad86e07ad4784ee40b6c`, leaf 2290 of the USDC tree):
|
|
4004
|
+
* a payment-link claim ran `partialWithdraw`, the claim page never read `outputUtxos`, and the
|
|
4005
|
+
* blinding died with the page. Every other value needed to spend that note is still recoverable —
|
|
4006
|
+
* amount, owner key, mint, commitment, leaf index. Only the randomness is gone.
|
|
4007
|
+
*
|
|
4008
|
+
* The SDK already ships key-only recovery for DEPOSITS (`notes/deposit-note.ts`, PRF(nk, noteSalt)),
|
|
4009
|
+
* for RECEIVED transfers (`notes/delivery-note.ts`, CLKD1 envelope) and for SWAP REFUNDS
|
|
4010
|
+
* (`notes/swap-refund.ts`, PRF(nk, nullifier0)). Change was the one shape with no recovery path at
|
|
4011
|
+
* all, and it is the shape every withdrawal produces.
|
|
4012
|
+
*
|
|
4013
|
+
* ── Why derivation, and why nothing else was available ────────────────────────────────────────
|
|
4014
|
+
* The CLKD1 delivery envelope is the only rail in the protocol that publishes a blinding, and it
|
|
4015
|
+
* rejects this shape twice over: `buildRecipientDeliveryNotes` returns `undefined` when
|
|
4016
|
+
* `externalAmount !== 0` (a withdrawal) and again when the note's owner is the spender (change is
|
|
4017
|
+
* self-owned). Both gates are correct — a delivery envelope exists to reach someone else, and
|
|
4018
|
+
* change has no one to reach. So make the chain note the protocol already emits carry the recovery
|
|
4019
|
+
* instead, at zero additional bytes:
|
|
4020
|
+
*
|
|
4021
|
+
* seed = BLAKE3("cloak_change_note_v1" || nk || noteSalt(32B BE) || outputIndex(1B) || "blinding")
|
|
4022
|
+
* blinding = seed reduced into the field
|
|
4023
|
+
*
|
|
4024
|
+
* The output index is in the preimage because one transaction carries one salt but two output
|
|
4025
|
+
* slots, and a send-to-self puts a self-owned note in BOTH. Without the index those two notes would
|
|
4026
|
+
* derive one blinding, and `transact`'s fail-closed check could not tell which slot it was looking
|
|
4027
|
+
* at. With it, every slot has its own answer.
|
|
4028
|
+
*
|
|
4029
|
+
* ── Why only the blinding, when deposits derive the keypair too ───────────────────────────────
|
|
4030
|
+
* A deposit's output note has no prior owner, so `deposit-note.ts` is free to give it a per-deposit
|
|
4031
|
+
* key and gains unlinkability by doing so. A change note is different: its owner is already fixed —
|
|
4032
|
+
* it is the keypair of the note being spent (`inputUtxos[0].keypair`), which the spender by
|
|
4033
|
+
* definition holds, and which callers rely on to keep spending their own change. Re-owning it under
|
|
4034
|
+
* a derived key would change `outPubkey0`, break that expectation, and buy nothing, because the
|
|
4035
|
+
* spender's key is the one value in a change note that was never at risk. Only the randomness was.
|
|
4036
|
+
*
|
|
4037
|
+
* ── What a cold scan can rebuild, and what it cannot ──────────────────────────────────────────
|
|
4038
|
+
* For the shape that lost the money — a partial withdrawal — recovery is COMPLETE from `nk` alone.
|
|
4039
|
+
* `partialWithdraw` emits the change as `outputUtxos[0]`, and a v4 chain note binds
|
|
4040
|
+
* `noteSemantics = Poseidon(outAmount0, outPubkey0, isSendToSelfKey0)` and carries all three in its
|
|
4041
|
+
* (encrypted, authenticated) plaintext. So a scanner holding `nk` decrypts the note, reads
|
|
4042
|
+
* `noteSalt`, `outAmount0` and `outPubkey0`, replays the line above, recomputes
|
|
4043
|
+
* `Poseidon(amount, pubkey, blinding, mint)` and requires it to equal a commitment the transaction
|
|
4044
|
+
* actually published. That equality is the authentication, exactly as in `matchDepositNote`.
|
|
4045
|
+
*
|
|
4046
|
+
* For `transfer`, change is `outputUtxos[1]` — the recipient note has to be output 0 because the
|
|
4047
|
+
* delivery carrier is bound to `output_commitments[0]`. A v4 chain note describes output 0 only, so
|
|
4048
|
+
* a cold scan does not learn the change AMOUNT and cannot finish the match on its own. The blinding
|
|
4049
|
+
* is still derived and still recoverable, which turns "permanently unspendable" into "spendable as
|
|
4050
|
+
* soon as the amount is known" — and a sender who knows what they sent knows the amount. Closing
|
|
4051
|
+
* that last gap needs the chain note to describe output 1 as well, which is a format change and is
|
|
4052
|
+
* deliberately not attempted here.
|
|
4053
|
+
*
|
|
4054
|
+
* ── Guardrails preserved ──────────────────────────────────────────────────────────────────────
|
|
4055
|
+
* [M-04] `noteSalt` stays a private input to `chainNoteHash`; it is only ever published inside the
|
|
4056
|
+
* note's own authenticated ciphertext, so nothing an observer can see changes. [H-04-shaped] the
|
|
4057
|
+
* reduction forces non-zero, because a zero blinding is an unspendable note. Callers that pass no
|
|
4058
|
+
* `nk` keep the previous random-blinding behaviour unchanged, so this is additive.
|
|
4059
|
+
*/
|
|
4060
|
+
|
|
4061
|
+
/** A change note recovered from `nk` (plus the owner key the spender already holds). */
|
|
4062
|
+
interface RecoveredChangeNote {
|
|
4063
|
+
keypair: UtxoKeypair;
|
|
4064
|
+
blinding: bigint;
|
|
4065
|
+
amount: bigint;
|
|
4066
|
+
mintAddress: PublicKey;
|
|
4067
|
+
/** The commitment the transaction published, reproduced from the derived blinding. */
|
|
4068
|
+
commitment: bigint;
|
|
4069
|
+
/** The salt the chain note carried, which anchored the derivation. */
|
|
4070
|
+
noteSalt: bigint;
|
|
4071
|
+
}
|
|
4072
|
+
/** A fresh 96-bit chain-note salt, from the same fail-closed source `transact` uses. */
|
|
4073
|
+
declare function randomChangeNoteSalt(): bigint;
|
|
4074
|
+
/**
|
|
4075
|
+
* Derive a change note's blinding from `(nk, noteSalt)`.
|
|
4076
|
+
*
|
|
4077
|
+
* Deterministic by design: this is the whole reason a cold scan can rebuild the note. Both the
|
|
4078
|
+
* builder and the scanner call it, so there is exactly one definition of what a change note is.
|
|
4079
|
+
*/
|
|
4080
|
+
declare function deriveChangeNoteBlinding(viewingKeyNk: Uint8Array, noteSalt: bigint, outputIndex: number): bigint;
|
|
4081
|
+
/**
|
|
4082
|
+
* Build a change output note whose blinding a cold `(rpc, programId, nk)` scan can re-derive.
|
|
4083
|
+
*
|
|
4084
|
+
* Returns the UTXO AND the salt that anchored it. The SAME salt must reach `transact` as
|
|
4085
|
+
* `options.chainNoteSalt`, because the chain note is what publishes it — a salt that does not reach
|
|
4086
|
+
* the note leaves the change exactly as unrecoverable as before. `partialWithdraw` and `transfer`
|
|
4087
|
+
* do this for you; the pairing is only your concern if you call `transact` directly.
|
|
4088
|
+
*/
|
|
4089
|
+
declare function createRecoverableChangeUtxo(amount: bigint, keypair: UtxoKeypair, viewingKeyNk: Uint8Array, mintAddress?: PublicKey, noteSalt?: bigint, outputIndex?: number): Promise<{
|
|
4090
|
+
utxo: Utxo;
|
|
4091
|
+
noteSalt: bigint;
|
|
4092
|
+
}>;
|
|
4093
|
+
interface MatchChangeNoteParams {
|
|
4094
|
+
/** The spending wallet's incoming viewing base. */
|
|
4095
|
+
viewingKeyNk: Uint8Array;
|
|
4096
|
+
/** `noteSalt`, read out of the decrypted chain note. */
|
|
4097
|
+
noteSalt: bigint;
|
|
4098
|
+
/** Candidate note amount — `outAmount0` for a partial withdrawal's change. */
|
|
4099
|
+
amount: bigint;
|
|
4100
|
+
/**
|
|
4101
|
+
* The change note's owner keypair. For a match, only `publicKey` is used (`outPubkey0` from the
|
|
4102
|
+
* chain note is enough); supply the private key too if you intend to spend the result.
|
|
4103
|
+
*/
|
|
4104
|
+
keypair: UtxoKeypair;
|
|
4105
|
+
/** Pool mint the commitment was computed under. */
|
|
4106
|
+
mintAddress: PublicKey;
|
|
4107
|
+
/** Which output slot the note occupied — part of the derivation, so it must match. */
|
|
4108
|
+
outputIndex: number;
|
|
4109
|
+
/** Output commitments the transaction actually published, hex or field elements. */
|
|
4110
|
+
outputCommitments: Array<string | bigint>;
|
|
4111
|
+
}
|
|
4112
|
+
/**
|
|
4113
|
+
* Decide whether a published commitment is a change note this `nk` can rebuild, and if so return it
|
|
4114
|
+
* in spendable form. Returns `null` for everything that is not ours.
|
|
4115
|
+
*
|
|
4116
|
+
* The commitment equality is the authentication. Nothing here trusts the chain note's own claim
|
|
4117
|
+
* about what it describes; the note supplies `noteSalt`, `amount` and the owner key, and the derived
|
|
4118
|
+
* blinding has to reproduce a value the transaction published or the candidate is discarded.
|
|
4119
|
+
*/
|
|
4120
|
+
declare function matchChangeNote(params: MatchChangeNoteParams): Promise<RecoveredChangeNote | null>;
|
|
4121
|
+
|
|
3982
4122
|
/**
|
|
3983
4123
|
* Swap timeout-refund discovery (VK-02).
|
|
3984
4124
|
*
|
|
@@ -4230,6 +4370,25 @@ interface ScanResult {
|
|
|
4230
4370
|
* Additive, for the same reason as `deliveredNotes`: note secrets are not compliance rows.
|
|
4231
4371
|
*/
|
|
4232
4372
|
recoveredDepositNotes: RecoveredDepositNoteRecord[];
|
|
4373
|
+
/**
|
|
4374
|
+
* This wallet's OWN withdrawal/swap change, rebuilt from `nk` alone (VK-01, change shape).
|
|
4375
|
+
*
|
|
4376
|
+
* `partialWithdraw` and `swapWithChange` emit change as output 0, and a v4 chain note carries
|
|
4377
|
+
* `outAmount0`/`outPubkey0`, so `nk` plus the derived blinding is everything the note needs.
|
|
4378
|
+
*
|
|
4379
|
+
* One difference from `recoveredDepositNotes`: a change note's owner key is NOT derived — it is
|
|
4380
|
+
* the keypair of the note that was spent, deliberately, so that holding a viewing key never
|
|
4381
|
+
* confers spend authority. So `keypair.privateKey` comes back as `0n` and the caller must supply
|
|
4382
|
+
* their own before spending. Everything else is complete.
|
|
4383
|
+
*/
|
|
4384
|
+
recoveredChangeNotes: RecoveredChangeNoteRecord[];
|
|
4385
|
+
}
|
|
4386
|
+
/** A recovered change note plus the chain coordinates it was recovered from. */
|
|
4387
|
+
interface RecoveredChangeNoteRecord extends RecoveredChangeNote {
|
|
4388
|
+
/** Signature of the withdrawal/swap transaction. */
|
|
4389
|
+
signature: string;
|
|
4390
|
+
/** Millisecond timestamp from the chain note. */
|
|
4391
|
+
timestamp: bigint;
|
|
4233
4392
|
}
|
|
4234
4393
|
/** A recovered deposit note plus the chain coordinates it was recovered from. */
|
|
4235
4394
|
interface RecoveredDepositNoteRecord extends RecoveredDepositNote {
|
|
@@ -4519,4 +4678,4 @@ declare const VERSION = "0.2.1";
|
|
|
4519
4678
|
/** True when scanner supports TransactSwap (tag 1). Check this to verify the correct SDK bundle is loaded. */
|
|
4520
4679
|
declare const SCANNER_SUPPORTS_TRANSACT_SWAP = true;
|
|
4521
4680
|
|
|
4522
|
-
export { BUILD_ALLOWS_LOCAL_ENDPOINTS, type BuildRecipientDeliveryNotesParams, CHAIN_NOTE_SALT_BITS, CLOAK_PRODUCTION_RELAY_URL, CLOAK_PROGRAM_ID, type ChainNoteTxType, type CircuitVerificationResult, type CloakConfig, CloakError, type CloakKeyPair, type CloakNote, type CommitmentEntry, type CommitmentsResponse, type CompactChainNote, type ComplianceReport, type ComplianceTxType, type ConfirmSettlementParams, DEFAULT_CIRCUITS_URL, DEFAULT_TRANSACTION_CIRCUITS_URL, DELIVERY_MEMO_TAG, DELIVERY_REGISTRY_SEED, type DeliveredNote, type DepositInstructionParams, type DepositNoteSecrets, type DepositOptions, type DepositResult, type DepositStatus, type DiscoverSwapRefundsOptions, type DiscoveredSwapRefund, EXPECTED_CIRCUIT_HASHES, type EncryptedMetadataBundle, type EncryptedNote$1 as EncryptedNote, type ErrorCategory, type ExpandedSpendKey, type ExternalFeePayerAdapter, FIXED_FEE_LAMPORTS, type Groth16Proof, InsecureRandomnessError, LAMPORTS_PER_SOL, LocalStorageAdapter, type LogLevel, type Logger, MERKLE_TREE_HEIGHT, MIN_DEPOSIT_LAMPORTS, type MasterKey, type MatchDepositNoteParams, type MatchSwapRefundLeafParams, type MaxLengthArray, MemoryStorageAdapter, type MerkleProof, type MerkleRootResponse, MerkleTree, NATIVE_SOL_MINT, type Network, type NoteData, type OnchainMerkleProof, type ParsedDeliveryCarrier, type PendingDeposit, type PendingWithdrawal, 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_ORIGIN_ALLOWLIST, REQUEST_AUTH_MAX_AGE_SECONDS, REQUEST_AUTH_MAX_FUTURE_SKEW_SECONDS, type RecipientDeliveryNote, type RecoveredDepositNote, type RecoveredDepositNoteRecord, type RecoveredSwapRefund, type RelayAuthPreimage, type RelayAuthSigner, RelayInternalError, RelayService, type RelaySubmissionResult, 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 StorageAdapter, type SubmitTransactToRelayArgs, type SwapOptions, type SwapParams, type SwapRefundAuthorization, type SwapResult, TRANSACTION_CIRCUITS_VERSION, TRANSACT_AUTH_FIELDS, TRANSACT_SWAP_AUTH_FIELDS, type TransactOptions, type TransactParams, type TransactRequestBodyParams, type TransactResult, 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, type WalletAdapter, type WalletUtxo, type WithdrawOptions, type WithdrawSubmissionResult, assertDirectSubmissionLanded, assertTransactionCircuitIntegrity, bigintToBytes32$1 as bigintToBytes32, bigintToHex, buildMerkleTree, buildMerkleTreeFromChain, buildMerkleTreeFromRelay, buildRecipientDeliveryNotes, buildRelayAuthPreimage, buildTransactRequestBody, bytesToHex, calculateFee, calculateFeeBigint, calculateRelayFee, canRebuildMerkleTreeFromChain, canonicalJson, chainNoteFromBase64, chainNoteToBase64, classifyRelayError, cleanupStalePendingOperations, clearPendingDeposits, clearPendingWithdrawals, computeChainNoteHash, computeExtDataHash, computeMerkleRoot, computeProofForLatestDeposit, computeProofFromChain, computeSignature, computeSwapRefundCommitment, computeCommitment as computeUtxoCommitment, computeNullifier as computeUtxoNullifier, confirmTransactSettlement, copyNoteToClipboard, createCloakError, createDepositInstruction, createLogger, createRecoverableDepositUtxo, createUtxo, createZeroUtxo, decryptCompactChainNote, decryptComplianceMetadataWithMasterKey, decryptTransactionMetadata, deriveDepositNoteSecrets, deriveDiversifiedViewingKey, deriveDiversifier, deriveInputNullifierPdas, derivePublicKey, deriveSpendKey, deriveSwapRefundAuthorization, deriveUserCompliancePublicKey, deriveUserComplianceScalar, deriveUtxoKeypairFromSpendKey, deriveViewKey, deriveViewingKeyFromNk, deriveViewingKeyFromSpendKey, deriveViewingKeyFromUtxoPrivateKey, deserializeUtxo, detectNetworkFromRpcUrl, discoverSwapRefunds, downloadNote, encodeDeliveryCarrierMemo, encodeNoteSimple, encodeRecipientDeliveryNote, encryptCompactChainNote, encryptNoteForRecipient, encryptTransactionMetadata, encryptTransactionMetadataBundle, expandSpendKey, explainRelayAuthRejection, exportKeys, exportNote, exportWalletKeys, fetchCommitments, fetchRiskQuoteInstruction, fetchRiskQuoteIx, filterNotesByNetwork, filterWithdrawableNotes, findNoteByCommitment, formatAmount, formatComplianceCsv, formatErrorForLogging, formatSol, fullWithdraw, 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, isPlausibleSignature, isReactNative, isRootNotFoundError, isSubmissionOutcomeUnknownResponse, isValidHex, isValidRpcUrl, isValidSolanaAddress, isWithdrawAmountSufficient, isWithdrawable, keypairToAdapter, loadPendingDeposits, loadPendingWithdrawals, loadVerifiedCircuitArtifacts, matchDepositNote, matchSwapRefundLeaf, openRecipientDeliveryNote, parseAmount, parseDeliveryCarrierMemo, parseError, parseNote, parseRelayErrorResponse, parseRelayErrorSignature, parseTransactionError, partialWithdraw, poseidonHash, preflightCheck, preflightNullifiers, prepareEncryptedOutput, prepareEncryptedOutputForRecipient, proofToBytes, pubkeyToFieldElement, pubkeyToLimbs, randomBytes, randomDepositNoteSalt, randomFieldElement, readMerkleTreeState, recipientDeliveryNoteToBase64, registerViewingKey, removePendingDeposit, removePendingWithdrawal, resolveCircuitsBase, savePendingDeposit, savePendingWithdrawal, scanNotesForWallet, scanRecipientDeliveryNotes, scanTransactions, sdkLogger, selectUtxos, sendTransaction, serializeNote, serializeUtxo, setCircuitsPath, setDebugMode, signTransaction, splitTo2Limbs, submitTransactToRelay, sumUtxoAmounts, swapUtxo, swapWithChange, toComplianceReport, transact, transfer, truncate, tryDecryptNote, updateNoteWithDeposit, updatePendingDeposit, updatePendingWithdrawal, bigintToBytes32 as utxoBigintToBytes32, utxoEquals, hexToBigint as utxoHexToBigint, validateDepositParams, validateNote, validateOutputsSum, validateRoot, validateTransfers, validateWalletConnected, validateWithdrawableNote, verifyAllCircuits, verifyCircuitIntegrity, verifyUtxos, waitForRoot, withTiming };
|
|
4681
|
+
export { BUILD_ALLOWS_LOCAL_ENDPOINTS, type BuildRecipientDeliveryNotesParams, CHAIN_NOTE_SALT_BITS, CLOAK_PRODUCTION_RELAY_URL, CLOAK_PROGRAM_ID, type ChainNoteTxType, type CircuitVerificationResult, type CloakConfig, CloakError, type CloakKeyPair, type CloakNote, type CommitmentEntry, type CommitmentsResponse, type CompactChainNote, type ComplianceReport, type ComplianceTxType, type ConfirmSettlementParams, DEFAULT_CIRCUITS_URL, DEFAULT_TRANSACTION_CIRCUITS_URL, DELIVERY_MEMO_TAG, DELIVERY_REGISTRY_SEED, type DeliveredNote, type DepositInstructionParams, type DepositNoteSecrets, type DepositOptions, type DepositResult, type DepositStatus, type DiscoverSwapRefundsOptions, type DiscoveredSwapRefund, EXPECTED_CIRCUIT_HASHES, type EncryptedMetadataBundle, type EncryptedNote$1 as EncryptedNote, type ErrorCategory, type ExpandedSpendKey, type ExternalFeePayerAdapter, FIXED_FEE_LAMPORTS, type Groth16Proof, InsecureRandomnessError, LAMPORTS_PER_SOL, LocalStorageAdapter, type LogLevel, type Logger, MERKLE_TREE_HEIGHT, MIN_DEPOSIT_LAMPORTS, type MasterKey, type MatchChangeNoteParams, type MatchDepositNoteParams, type MatchSwapRefundLeafParams, type MaxLengthArray, MemoryStorageAdapter, type MerkleProof, type MerkleRootResponse, MerkleTree, NATIVE_SOL_MINT, type Network, type NoteData, type OnchainMerkleProof, type ParsedDeliveryCarrier, type PendingDeposit, type PendingWithdrawal, 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_ORIGIN_ALLOWLIST, REQUEST_AUTH_MAX_AGE_SECONDS, REQUEST_AUTH_MAX_FUTURE_SKEW_SECONDS, type RecipientDeliveryNote, type RecoveredChangeNote, type RecoveredChangeNoteRecord, type RecoveredDepositNote, type RecoveredDepositNoteRecord, type RecoveredSwapRefund, type RelayAuthPreimage, type RelayAuthSigner, RelayInternalError, RelayService, type RelaySubmissionResult, 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 StorageAdapter, type SubmitTransactToRelayArgs, type SwapOptions, type SwapParams, type SwapRefundAuthorization, type SwapResult, TRANSACTION_CIRCUITS_VERSION, TRANSACT_AUTH_FIELDS, TRANSACT_SWAP_AUTH_FIELDS, type TransactOptions, type TransactParams, type TransactRequestBodyParams, type TransactResult, 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, type WalletAdapter, type WalletUtxo, type WithdrawOptions, type WithdrawSubmissionResult, assertDirectSubmissionLanded, assertTransactionCircuitIntegrity, bigintToBytes32$1 as bigintToBytes32, bigintToHex, buildMerkleTree, buildMerkleTreeFromChain, buildMerkleTreeFromRelay, buildRecipientDeliveryNotes, buildRelayAuthPreimage, buildTransactRequestBody, bytesToHex, calculateFee, calculateFeeBigint, calculateRelayFee, canRebuildMerkleTreeFromChain, canonicalJson, chainNoteFromBase64, chainNoteToBase64, classifyRelayError, cleanupStalePendingOperations, clearPendingDeposits, clearPendingWithdrawals, computeChainNoteHash, computeExtDataHash, computeMerkleRoot, computeProofForLatestDeposit, computeProofFromChain, computeSignature, computeSwapRefundCommitment, computeCommitment as computeUtxoCommitment, computeNullifier as computeUtxoNullifier, confirmTransactSettlement, copyNoteToClipboard, createCloakError, createDepositInstruction, createLogger, createRecoverableChangeUtxo, createRecoverableDepositUtxo, createUtxo, createZeroUtxo, decryptCompactChainNote, decryptComplianceMetadataWithMasterKey, decryptTransactionMetadata, deriveChangeNoteBlinding, deriveDepositNoteSecrets, deriveDiversifiedViewingKey, deriveDiversifier, deriveInputNullifierPdas, derivePublicKey, deriveSpendKey, deriveSwapRefundAuthorization, deriveUserCompliancePublicKey, deriveUserComplianceScalar, deriveUtxoKeypairFromSpendKey, deriveViewKey, deriveViewingKeyFromNk, deriveViewingKeyFromSpendKey, deriveViewingKeyFromUtxoPrivateKey, deserializeUtxo, detectNetworkFromRpcUrl, discoverSwapRefunds, downloadNote, encodeDeliveryCarrierMemo, encodeNoteSimple, encodeRecipientDeliveryNote, encryptCompactChainNote, encryptNoteForRecipient, encryptTransactionMetadata, encryptTransactionMetadataBundle, expandSpendKey, explainRelayAuthRejection, exportKeys, exportNote, exportWalletKeys, fetchCommitments, fetchRiskQuoteInstruction, fetchRiskQuoteIx, filterNotesByNetwork, filterWithdrawableNotes, findNoteByCommitment, formatAmount, formatComplianceCsv, formatErrorForLogging, formatSol, fullWithdraw, 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, isPlausibleSignature, isReactNative, isRootNotFoundError, isSubmissionOutcomeUnknownResponse, isValidHex, isValidRpcUrl, isValidSolanaAddress, isWithdrawAmountSufficient, isWithdrawable, keypairToAdapter, loadPendingDeposits, loadPendingWithdrawals, loadVerifiedCircuitArtifacts, matchChangeNote, matchDepositNote, matchSwapRefundLeaf, openRecipientDeliveryNote, parseAmount, parseDeliveryCarrierMemo, parseError, parseNote, parseRelayErrorResponse, parseRelayErrorSignature, parseTransactionError, partialWithdraw, poseidonHash, preflightCheck, preflightNullifiers, prepareEncryptedOutput, prepareEncryptedOutputForRecipient, proofToBytes, pubkeyToFieldElement, pubkeyToLimbs, randomBytes, randomChangeNoteSalt, randomDepositNoteSalt, randomFieldElement, readMerkleTreeState, recipientDeliveryNoteToBase64, registerViewingKey, removePendingDeposit, removePendingWithdrawal, resolveCircuitsBase, savePendingDeposit, savePendingWithdrawal, scanNotesForWallet, scanRecipientDeliveryNotes, scanTransactions, sdkLogger, selectUtxos, sendTransaction, serializeNote, serializeUtxo, setCircuitsPath, setDebugMode, signTransaction, splitTo2Limbs, submitTransactToRelay, sumUtxoAmounts, swapUtxo, swapWithChange, toComplianceReport, transact, transfer, truncate, tryDecryptNote, updateNoteWithDeposit, updatePendingDeposit, updatePendingWithdrawal, bigintToBytes32 as utxoBigintToBytes32, utxoEquals, hexToBigint as utxoHexToBigint, validateDepositParams, validateNote, validateOutputsSum, validateRoot, validateTransfers, validateWalletConnected, validateWithdrawableNote, verifyAllCircuits, verifyCircuitIntegrity, verifyUtxos, waitForRoot, withTiming };
|