@cloak.dev/sdk 0.2.4 → 0.2.5-staging.4b3a899

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.ts CHANGED
@@ -1,4 +1,23 @@
1
- import { PublicKey, Transaction, Keypair, AddressLookupTableAccount, Connection, TransactionInstruction, SendOptions, VersionedTransaction } from '@solana/web3.js';
1
+ import * as _solana_kit from '@solana/kit';
2
+ import { Address, MessagePartialSigner, MessageModifyingSigner, KeyPairSigner, TransactionSigner, Rpc, SolanaRpcApi, Commitment, Instruction, Transaction, TransactionWithLifetime, AccountMeta, TransactionModifyingSigner } from '@solana/kit';
3
+ export { AccountRole, Address, Instruction, KeyPairSigner, TransactionSigner, address, generateKeyPairSigner, isAddress, isTransactionSigner } from '@solana/kit';
4
+ import * as _solana_nominal_types from '@solana/nominal-types';
5
+ export { SYSTEM_PROGRAM_ADDRESS } from '@solana-program/system';
6
+
7
+ /**
8
+ * Addresses, the kit way. An `Address` is a branded base58 string: it prints as itself, compares
9
+ * with `===`, and carries no methods. The two helpers below cover what `PublicKey.toBuffer()` and
10
+ * `new PublicKey(bytes)` used to do; everything else is a string.
11
+ */
12
+
13
+ /** The 32 raw bytes of an address. */
14
+ declare function addressBytes(value: Address | string): Uint8Array;
15
+ /** The address of 32 raw bytes. */
16
+ declare function addressFromBytes(bytes: Uint8Array | ArrayLike<number>): Address;
17
+ /** Accepts an `Address`, a base58 string, or anything with `toBase58()` (a legacy `PublicKey`). */
18
+ declare function toAddress(value: Address | string | {
19
+ toBase58(): string;
20
+ }): Address;
2
21
 
3
22
  /**
4
23
  * The deployed Cloak program.
@@ -18,7 +37,28 @@ import { PublicKey, Transaction, Keypair, AddressLookupTableAccount, Connection,
18
37
  * they are calling — `getShieldPoolPDAs`, `transact`, `scanTransactions` and
19
38
  * friends all take one.
20
39
  */
21
- declare const CLOAK_PROGRAM_ID: PublicKey;
40
+ declare const CLOAK_PROGRAM_ID: Address;
41
+
42
+ /**
43
+ * Signers, the kit way. A `TransactionSigner` signs (or signs and sends) transactions; a
44
+ * `MessagePartialSigner` signs detached messages, which is what the relay's request auth needs.
45
+ * A `KeyPairSigner` is both. A browser wallet is whichever of the two it can do; see `compat.ts`.
46
+ */
47
+
48
+ type MessageSigner = MessagePartialSigner | MessageModifyingSigner;
49
+ declare function isMessageSigner(value: unknown): value is MessageSigner;
50
+ /**
51
+ * A signer from a 64-byte secret key (the `Keypair.secretKey` layout: seed + public key) or a
52
+ * 32-byte seed. The key is imported as non-extractable; the bytes are not retained.
53
+ */
54
+ declare function signerFromSecretKey(secretKey: Uint8Array): Promise<KeyPairSigner>;
55
+ /** Detached ed25519 signature of `message` by `signer`, 64 bytes. */
56
+ declare function signMessageBytes(signer: MessageSigner, message: Uint8Array): Promise<Uint8Array>;
57
+ /**
58
+ * A message signer from an address and a `signMessage` callback, the shape a wallet adapter
59
+ * exposes. The callback must return the 64-byte ed25519 detached signature.
60
+ */
61
+ declare function messageSignerFromCallback(address: Address, signMessage: (message: Uint8Array) => Promise<Uint8Array>): MessagePartialSigner;
22
62
 
23
63
  type ComplianceTxType = "deposit" | "withdraw" | "send" | "swap";
24
64
  interface TransactionMetadata {
@@ -49,12 +89,12 @@ type Network = "localnet" | "devnet" | "mainnet" | "testnet";
49
89
  * Minimal wallet adapter interface
50
90
  * Compatible with @solana/wallet-adapter-base
51
91
  */
52
- interface WalletAdapter {
53
- publicKey: PublicKey | null;
54
- signTransaction?<T extends Transaction>(transaction: T): Promise<T>;
55
- signAllTransactions?<T extends Transaction>(transactions: T[]): Promise<T[]>;
56
- sendTransaction?(transaction: Transaction, connection: any, options?: any): Promise<string>;
57
- }
92
+ /**
93
+ * Who signs on the user's behalf: any kit `TransactionSigner` (a `KeyPairSigner` for a local key,
94
+ * or a wallet wrapped by `signerFromWalletAdapter`). The pre-kit `WalletAdapter` shape
95
+ * (`publicKey` + `signTransaction`) is accepted through `signerFromWalletAdapter` in `solana/compat`.
96
+ */
97
+ type WalletSigner$1 = TransactionSigner;
58
98
  /**
59
99
  * Cloak-specific error with categorization
60
100
  */
@@ -112,7 +152,7 @@ interface MerkleProof {
112
152
  */
113
153
  interface Transfer {
114
154
  /** Recipient's Solana public key */
115
- recipient: PublicKey;
155
+ recipient: Address;
116
156
  /** Amount to send in lamports */
117
157
  amount: number;
118
158
  }
@@ -165,7 +205,7 @@ interface CloakConfig {
165
205
  * Wallet adapter for signing transactions
166
206
  * Required unless using keypairBytes
167
207
  */
168
- wallet?: WalletAdapter;
208
+ signer?: WalletSigner$1;
169
209
  /**
170
210
  * Cloak key pair for v2.0 features (note scanning, encryption)
171
211
  * Optional but recommended for full functionality
@@ -174,13 +214,13 @@ interface CloakConfig {
174
214
  /** Optional: Proof generation timeout in milliseconds (default: 5 minutes) */
175
215
  proofTimeout?: number;
176
216
  /** Optional: Program ID (defaults to Cloak mainnet program) */
177
- programId?: PublicKey;
217
+ programId?: Address;
178
218
  /** Optional: Pool account address (auto-derived from program ID if not provided) */
179
- poolAddress?: PublicKey;
219
+ poolAddress?: Address;
180
220
  /** Optional: Merkle tree account address (auto-derived if not provided) */
181
- merkleTreeAddress?: PublicKey;
221
+ merkleTreeAddress?: Address;
182
222
  /** Optional: Treasury account address (auto-derived if not provided) */
183
- treasuryAddress?: PublicKey;
223
+ treasuryAddress?: Address;
184
224
  /**
185
225
  * Enable debug logging with structured output similar to Rust tracing.
186
226
  *
@@ -373,9 +413,7 @@ interface SwapOptions extends TransferOptions {
373
413
  }>;
374
414
  /**
375
415
  * Recipient's associated token account for the output token.
376
- * If not provided, will be computed automatically (requires @solana/spl-token).
377
- * For browser environments, it's recommended to compute this in the frontend
378
- * where @solana/spl-token is properly bundled.
416
+ * If not provided, it is derived with `findAssociatedTokenPda` from `@solana-program/token`.
379
417
  */
380
418
  recipientAta?: string;
381
419
  }
@@ -781,6 +819,159 @@ declare class LocalStorageAdapter implements StorageAdapter {
781
819
  deleteKeys(): void;
782
820
  }
783
821
 
822
+ /**
823
+ * The SDK's RPC handle. A kit `Rpc<SolanaRpcApi>` that also remembers the endpoint it was created
824
+ * for, because the relay-origin lock (`relay/endpoint.ts`) refuses to pair a production build with
825
+ * an RPC served by this machine and needs the URL to decide. `createCloakRpc` is the one way to
826
+ * get one; a bare kit `rpc` has no endpoint and the guard treats it as unknown.
827
+ */
828
+
829
+ type CloakRpc = Rpc<SolanaRpcApi> & {
830
+ readonly endpoint: string;
831
+ };
832
+ declare function createCloakRpc(endpoint: string): CloakRpc;
833
+ interface AccountBytes {
834
+ address: Address;
835
+ data: Uint8Array;
836
+ owner: Address;
837
+ lamports: bigint;
838
+ executable: boolean;
839
+ }
840
+ /** `getAccountInfo` with base64 data decoded to bytes; `null` when the account does not exist. */
841
+ declare function fetchAccountBytes(rpc: Rpc<SolanaRpcApi>, address: Address, commitment?: Commitment): Promise<AccountBytes | null>;
842
+ interface BlockhashLifetime {
843
+ blockhash: string;
844
+ lastValidBlockHeight: bigint;
845
+ }
846
+ declare function fetchLatestBlockhash(rpc: Rpc<SolanaRpcApi>, commitment?: Commitment): Promise<BlockhashLifetime>;
847
+ interface SendOptions {
848
+ skipPreflight?: boolean;
849
+ preflightCommitment?: Commitment;
850
+ maxRetries?: number;
851
+ }
852
+ /** Sends already-serialized transaction bytes; returns the base58 signature. */
853
+ declare function sendRawTransaction(rpc: Rpc<SolanaRpcApi>, wire: Uint8Array, options?: SendOptions): Promise<string>;
854
+ interface ConfirmOptions {
855
+ commitment?: Commitment;
856
+ /** When given, the wait ends as soon as the blockhash is no longer valid. */
857
+ lastValidBlockHeight?: bigint;
858
+ timeoutMs?: number;
859
+ pollIntervalMs?: number;
860
+ }
861
+ declare class TransactionConfirmationError extends Error {
862
+ readonly signature: string;
863
+ readonly reason: "failed" | "expired" | "timeout";
864
+ readonly err?: unknown | undefined;
865
+ constructor(message: string, signature: string, reason: "failed" | "expired" | "timeout", err?: unknown | undefined);
866
+ }
867
+ /**
868
+ * Waits for `signature` to reach `commitment` by polling `getSignatureStatuses`, the way the
869
+ * previous `confirmTransaction` did over a websocket. No subscription is opened: a local Surfpool
870
+ * fork and a busy public RPC both answer status polls reliably, and a hung subscription was the
871
+ * failure mode this replaces.
872
+ */
873
+ declare function confirmSignature(rpc: Rpc<SolanaRpcApi>, signature: string, options?: ConfirmOptions): Promise<{
874
+ slot: bigint;
875
+ }>;
876
+ interface SignatureInfo {
877
+ signature: string;
878
+ slot: number;
879
+ err: unknown;
880
+ memo: string | null;
881
+ blockTime: number | null;
882
+ }
883
+ declare function fetchSignaturesForAddress(rpc: Rpc<SolanaRpcApi>, address: Address, options?: {
884
+ before?: string;
885
+ until?: string;
886
+ limit?: number;
887
+ commitment?: Commitment;
888
+ }): Promise<SignatureInfo[]>;
889
+
890
+ type SignedTransaction = Transaction & TransactionWithLifetime;
891
+ interface LookupTable {
892
+ address: Address;
893
+ addresses: readonly Address[];
894
+ }
895
+ /** Fetches lookup tables by address; a missing table throws, as the old `getAddressLookupTable` did. */
896
+ declare function fetchLookupTables(rpc: Rpc<SolanaRpcApi>, addresses: readonly Address[]): Promise<LookupTable[]>;
897
+ type MessageVersion = 0 | 1 | "legacy";
898
+ /**
899
+ * Compute configuration a v1 message carries in its header (SIMD-0296). A v0/legacy message
900
+ * expresses the same through ComputeBudget instructions instead, so this is refused for them.
901
+ */
902
+ interface ComputeConfig {
903
+ computeUnitLimit?: number;
904
+ /** The priority fee in lamports for the whole transaction (v1 has no per-unit price). */
905
+ priorityFeeLamports?: bigint;
906
+ loadedAccountsDataSizeLimit?: number;
907
+ }
908
+ interface BuildTransactionMessageParams {
909
+ version?: MessageVersion;
910
+ /** v1 only. */
911
+ computeConfig?: ComputeConfig;
912
+ /** A signer makes the message signable by `signTransaction`; a bare address only sets the fee payer. */
913
+ feePayer: TransactionSigner | Address;
914
+ lifetime: BlockhashLifetime;
915
+ instructions: readonly Instruction[];
916
+ lookupTables?: readonly LookupTable[];
917
+ /**
918
+ * Signers to attach to the accounts they own, so `signTransaction` / `partiallySignTransaction`
919
+ * can sign for them even though the instructions were built from bare addresses.
920
+ */
921
+ signers?: readonly TransactionSigner[];
922
+ }
923
+ type BuiltTransactionMessage = ReturnType<typeof buildTransactionMessage>;
924
+ declare function buildTransactionMessage(params: BuildTransactionMessageParams): Readonly<{
925
+ instructions: readonly Instruction<string, readonly (_solana_kit.AccountLookupMeta<string, string> | _solana_kit.AccountMeta<string>)[]>[];
926
+ version: 0;
927
+ }> | (Omit<_solana_kit.ExcludeTransactionMessageWithinSizeLimit<Omit<Omit<Omit<Readonly<{
928
+ instructions: readonly Instruction<string, readonly _solana_kit.AccountMeta<string>[]>[];
929
+ version: "legacy";
930
+ }> | (Readonly<{
931
+ instructions: readonly Instruction<string, readonly _solana_kit.AccountMeta<string>[]>[];
932
+ version: 1;
933
+ }> & Readonly<{
934
+ config?: _solana_kit.V1TransactionConfig;
935
+ }>) | Readonly<{
936
+ instructions: readonly Instruction<string, readonly (_solana_kit.AccountLookupMeta<string, string> | _solana_kit.AccountMeta<string>)[]>[];
937
+ version: 0;
938
+ }>, "instructions"> & _solana_kit.TransactionMessageWithinSizeLimit & {
939
+ instructions: readonly [];
940
+ }, "feePayer"> & _solana_kit.TransactionMessageWithFeePayer<string>, "lifetimeConstraint"> & _solana_kit.TransactionMessageWithBlockhashLifetime>, "instructions"> & {
941
+ readonly instructions: readonly Instruction<string, readonly (_solana_kit.AccountLookupMeta<string, string> | _solana_kit.AccountMeta<string>)[]>[];
942
+ });
943
+ /** Exact wire bytes (signature slots included), signed or not. */
944
+ declare function transactionBytes(transaction: Transaction): Uint8Array;
945
+ /** Wire size in bytes of the transaction this message compiles to; what the RPC measures against 1,232. */
946
+ declare function transactionWireSize(message: BuiltTransactionMessage): number;
947
+ declare function transactionFromBytes(bytes: Uint8Array): Transaction;
948
+ /**
949
+ * Add a signer's signature to an already-compiled transaction (one that arrived as wire bytes,
950
+ * e.g. a paymaster's prepared top-up), leaving every other signature slot as it was. The kit
951
+ * signer types demand a lifetime-bearing message; a decoded wire transaction carries none, so the
952
+ * cast below is the same one every partial-sign of foreign bytes needs.
953
+ */
954
+ declare function signCompiledTransaction(signer: {
955
+ signTransactions: KeyPairSigner["signTransactions"];
956
+ }, transaction: Transaction): Promise<Transaction>;
957
+ declare function transactionBase64(transaction: Transaction): string;
958
+ /** Signs with every signer the message names; throws if one is missing. */
959
+ declare function signTransaction(message: BuiltTransactionMessage): Promise<SignedTransaction>;
960
+ /** Signs with the signers the message has; other required signatures stay empty. */
961
+ declare function partiallySignTransaction(message: BuiltTransactionMessage): Promise<SignedTransaction>;
962
+
963
+ /**
964
+ * Builds, signs, sends and confirms one transaction from `instructions`, paid and signed by
965
+ * `payer` (a local key pair or a wallet). The convenience most scripts want; the flows use the
966
+ * pieces above directly because they retry on blockhash expiry and measure sizes first.
967
+ */
968
+ declare function sendInstructions(rpc: Rpc<SolanaRpcApi>, payer: TransactionSigner, instructions: readonly Instruction[], options?: {
969
+ version?: 0 | "legacy";
970
+ lookupTables?: readonly LookupTable[];
971
+ skipPreflight?: boolean;
972
+ commitment?: "processed" | "confirmed" | "finalized";
973
+ }): Promise<string>;
974
+
784
975
  /**
785
976
  * How long the relay accepts a signed request after its `auth_issued_at`
786
977
  * (`REQUEST_AUTH_MAX_AGE_SECONDS`, `api/request_auth.rs`).
@@ -875,7 +1066,7 @@ interface RelayAuthPreimage {
875
1066
  * `nonce` and `issued_at` are generated here, once per call. Callers that re-POST a request must
876
1067
  * reuse the same preimage rather than rebuilding it, or the relay sees a brand-new request.
877
1068
  */
878
- declare function buildRelayAuthPreimage(endpoint: string, programId: PublicKey, body: Record<string, unknown>, sender: PublicKey, nowSeconds?: number, fields?: readonly string[]): RelayAuthPreimage;
1069
+ declare function buildRelayAuthPreimage(endpoint: string, programId: Address, body: Record<string, unknown>, sender: Address, nowSeconds?: number, fields?: readonly string[]): RelayAuthPreimage;
879
1070
  /**
880
1071
  * An async message signer standing in for a `Keypair`.
881
1072
  *
@@ -888,25 +1079,19 @@ declare function buildRelayAuthPreimage(endpoint: string, programId: PublicKey,
888
1079
  * Putting an ephemeral, service-held or otherwise substituted key here moves the screening onto a
889
1080
  * key that is not the user: a compliance regression, not a shortcut.
890
1081
  */
891
- interface RelayMessageSigner {
892
- /** The end user's real wallet. Becomes the authenticated `sender`. Never an ephemeral key. */
893
- walletPublicKey: PublicKey;
894
- /** Wallet-adapter `signMessage`; must return the 64-byte ed25519 detached signature. */
895
- signMessage: (message: Uint8Array) => Promise<Uint8Array>;
896
- signAuthTransaction?: undefined;
897
- }
898
1082
  /**
899
- * A wallet that cannot sign messages at all (Ledger, Trezor) but can sign a transaction. It signs
900
- * the deterministic no-op transaction from `buildAuthTransactionMessage` instead; the relay rebuilds
901
- * the same bytes and verifies against them. See `signRelayAuthPayload`.
1083
+ * Who authenticates a relay request. Any kit signer: a `KeyPairSigner` (local key, signs in
1084
+ * microseconds), a wallet that signs messages (`MessagePartialSigner`, wired through
1085
+ * `signerFromWalletAdapter` when the adapter has `signMessage`), or a wallet that can only sign
1086
+ * transactions (Ledger, Trezor), which signs the deterministic no-op transaction from
1087
+ * `buildAuthTransactionMessage` instead; the relay rebuilds the same bytes and verifies against them.
1088
+ *
1089
+ * COMPLIANCE — the signer's address becomes the request's authenticated `sender`, and `sender` is
1090
+ * the key screened for sanctions on a shield-to-shield send. It MUST be the end user's own wallet.
1091
+ * Putting an ephemeral, service-held or otherwise substituted key here moves the screening onto a
1092
+ * key that is not the user: a compliance regression, not a shortcut.
902
1093
  */
903
- interface RelayTransactionSigner {
904
- walletPublicKey: PublicKey;
905
- /** Wallet-adapter `signTransaction`. Receives a legacy `Transaction` and returns it signed. */
906
- signAuthTransaction: <T extends Transaction>(transaction: T) => Promise<T>;
907
- signMessage?: undefined;
908
- }
909
- type RelayAuthSigner = RelayMessageSigner | RelayTransactionSigner;
1094
+ type RelayAuthSigner = MessageSigner | TransactionSigner;
910
1095
  /** How a relay-auth payload was signed. Mirrors `RelayAuthMode` in the relay's `auth_envelope.rs`. */
911
1096
  type RelayAuthMode = "message" | "transaction";
912
1097
  /**
@@ -919,15 +1104,15 @@ type RelayAuthMode = "message" | "transaction";
919
1104
  * so it leaks nothing if published. Byte-identical to the relay's `build_auth_transaction_message`;
920
1105
  * the vector is pinned on both sides.
921
1106
  */
922
- declare function buildAuthTransactionMessage(sender: PublicKey, digest: Uint8Array): Transaction;
1107
+ declare function buildAuthTransactionMessage(sender: Address, digest: Uint8Array): BuiltTransactionMessage;
923
1108
  /** The exact bytes the wallet signs for `buildAuthTransactionMessage(sender, digest)`. */
924
- declare function serializeAuthTransactionMessage(sender: PublicKey, digest: Uint8Array): Uint8Array;
1109
+ declare function serializeAuthTransactionMessage(sender: Address, digest: Uint8Array): Uint8Array;
925
1110
  /**
926
1111
  * Sign a relay-auth payload with whatever the caller holds: a local `Keypair` or a message signer
927
1112
  * signs the payload bytes; a transaction-only signer signs the no-op transaction carrying the
928
1113
  * payload's digest. Returns the 64-byte detached signature and the mode the relay must be told.
929
1114
  */
930
- declare function signRelayAuthPayload(signer: RelayAuthSigner | Keypair, payload: Uint8Array): Promise<{
1115
+ declare function signRelayAuthPayload(signer: RelayAuthSigner, payload: Uint8Array): Promise<{
931
1116
  signature: Uint8Array;
932
1117
  mode: RelayAuthMode;
933
1118
  }>;
@@ -972,7 +1157,7 @@ interface RelayBatchAuthFields extends RelayAuthFields {
972
1157
  /** The digest an item contributes to a batch: sha256 of its request-auth message bytes, hex. */
973
1158
  declare function relayRequestDigestHex(preimage: RelayAuthPreimage): string;
974
1159
  /** Build the batch message the wallet signs. Byte-identical to `build_batch_auth_message`. */
975
- declare function buildRelayBatchAuthMessage(programId: PublicKey, issuedAt: string, digests: readonly string[]): Uint8Array;
1160
+ declare function buildRelayBatchAuthMessage(programId: Address, issuedAt: string, digests: readonly string[]): Uint8Array;
976
1161
 
977
1162
  interface ViewingKeyPair {
978
1163
  privateKey: Uint8Array;
@@ -1032,7 +1217,7 @@ declare function generateViewingKeyPair(): ViewingKeyPair;
1032
1217
  /**
1033
1218
  * Derive the user-specific scalar from the relay-provided compliance master public key.
1034
1219
  */
1035
- declare function deriveUserComplianceScalar(masterCompliancePublicKey: Uint8Array, userPublicKey: PublicKey): Promise<Uint8Array>;
1220
+ declare function deriveUserComplianceScalar(masterCompliancePublicKey: Uint8Array, userPublicKey: Address): Promise<Uint8Array>;
1036
1221
  /**
1037
1222
  * Derive a per-user compliance public key from the relay's master compliance public key.
1038
1223
  *
@@ -1040,7 +1225,7 @@ declare function deriveUserComplianceScalar(masterCompliancePublicKey: Uint8Arra
1040
1225
  * - factor = Poseidon(master_compliance_public_key, user_wallet_pubkey)
1041
1226
  * - user_compliance_public = X25519(factor, master_compliance_public_key)
1042
1227
  */
1043
- declare function deriveUserCompliancePublicKey(masterCompliancePublicKey: Uint8Array, userPublicKey: PublicKey): Promise<Uint8Array>;
1228
+ declare function deriveUserCompliancePublicKey(masterCompliancePublicKey: Uint8Array, userPublicKey: Address): Promise<Uint8Array>;
1044
1229
  /**
1045
1230
  * Legacy sign-in message retained for wallet-seed derivation compatibility in web/examples.
1046
1231
  * Viewing-key registration auth now uses one-time relay challenge messages.
@@ -1051,10 +1236,10 @@ declare const SIGN_IN_MESSAGE = "Cloak: Sign in\n\nSign this message to securely
1051
1236
  * Relay stores nk and derives sk_d per note when exporting.
1052
1237
  * Registration is authenticated via one-time nonce challenge.
1053
1238
  */
1054
- declare function registerViewingKey(relayUrl: string, userPubkey: PublicKey, nk: Uint8Array, signMessage: ((message: Uint8Array) => Promise<Uint8Array>) | RelayAuthSigner): Promise<void>;
1239
+ declare function registerViewingKey(relayUrl: string, userPubkey: Address, nk: Uint8Array, signMessage: ((message: Uint8Array) => Promise<Uint8Array>) | RelayAuthSigner): Promise<void>;
1055
1240
 
1056
1241
  interface EncryptMetadataContext {
1057
- userPubkey?: PublicKey | string;
1242
+ userPubkey?: Address | string;
1058
1243
  }
1059
1244
  /**
1060
1245
  * Encrypt a metadata object under:
@@ -1071,7 +1256,7 @@ declare function encryptTransactionMetadata(metadata: TransactionMetadata, userV
1071
1256
  * @param userPubkey - The user's wallet public key
1072
1257
  * @returns Encrypted metadata bundle
1073
1258
  */
1074
- declare function encryptTransactionMetadataBundle(metadata: TransactionMetadata, viewingKeyPrivate: Uint8Array, userPubkey: PublicKey): Promise<{
1259
+ declare function encryptTransactionMetadataBundle(metadata: TransactionMetadata, viewingKeyPrivate: Uint8Array, userPubkey: Address): Promise<{
1075
1260
  encrypted_user: string;
1076
1261
  encrypted_compliance: string;
1077
1262
  user_pubkey: string;
@@ -1092,7 +1277,7 @@ declare function decryptTransactionMetadata(encrypted: string, viewKeySecret: Ui
1092
1277
  * This mirrors relay-side decryption:
1093
1278
  * shared = X25519(master_private, X25519(user_factor, ephemeral_pk))
1094
1279
  */
1095
- declare function decryptComplianceMetadataWithMasterKey(encrypted: string, masterCompliancePrivateKey: Uint8Array, masterCompliancePublicKey: Uint8Array, userPublicKey: PublicKey): Promise<TransactionMetadata>;
1280
+ declare function decryptComplianceMetadataWithMasterKey(encrypted: string, masterCompliancePrivateKey: Uint8Array, masterCompliancePublicKey: Uint8Array, userPublicKey: Address): Promise<TransactionMetadata>;
1096
1281
 
1097
1282
  /**
1098
1283
  * Compute Poseidon hash of field elements
@@ -1108,7 +1293,7 @@ declare function splitTo2Limbs(value: bigint): [bigint, bigint];
1108
1293
  * Convert a PublicKey (32 bytes) to two 128-bit limbs
1109
1294
  * Uses duck typing to handle cross-module PublicKey instances
1110
1295
  */
1111
- declare function pubkeyToLimbs(pubkey: Uint8Array | PublicKey | {
1296
+ declare function pubkeyToLimbs(pubkey: Uint8Array | string | {
1112
1297
  toBytes: () => Uint8Array;
1113
1298
  }): [bigint, bigint];
1114
1299
  /**
@@ -1242,7 +1427,7 @@ declare function validateWithdrawableNote(note: CloakNote): void;
1242
1427
  * @throws Error if invalid
1243
1428
  */
1244
1429
  declare function validateTransfers(recipients: Array<{
1245
- recipient: PublicKey;
1430
+ recipient: Address;
1246
1431
  amount: number;
1247
1432
  }>, totalAmount: number): void;
1248
1433
 
@@ -1579,7 +1764,7 @@ declare function formatErrorForLogging(error: unknown): string;
1579
1764
  * - Multi-token support (SOL + any SPL token)
1580
1765
  */
1581
1766
 
1582
- declare const NATIVE_SOL_MINT: PublicKey;
1767
+ declare const NATIVE_SOL_MINT: Address;
1583
1768
  /**
1584
1769
  * UTXO Keypair for ownership verification
1585
1770
  *
@@ -1611,7 +1796,7 @@ interface Utxo {
1611
1796
  /** Random blinding factor */
1612
1797
  blinding: bigint;
1613
1798
  /** Token mint address (NATIVE_SOL_MINT for SOL) */
1614
- mintAddress: PublicKey;
1799
+ mintAddress: Address;
1615
1800
  /** Leaf index in Merkle tree (set after the UTXO is in the tree) */
1616
1801
  index?: number;
1617
1802
  /** Commitment hash (computed from amount, pubkey, blinding, mint) */
@@ -1648,11 +1833,11 @@ interface TransactParams {
1648
1833
  /** Output UTXOs to create (max 2) */
1649
1834
  outputUtxos: Utxo[];
1650
1835
  /** External recipient for withdrawal (optional) */
1651
- recipient?: PublicKey;
1836
+ recipient?: Address;
1652
1837
  /** Net external amount: positive = deposit, negative = withdraw */
1653
1838
  externalAmount?: bigint;
1654
1839
  /** Depositor address (for deposits, the source of funds) */
1655
- depositor?: PublicKey;
1840
+ depositor?: Address;
1656
1841
  }
1657
1842
  /**
1658
1843
  * Result from a UTXO transaction
@@ -1704,7 +1889,7 @@ interface TransactResult {
1704
1889
  * Address lookup table used for v0 transaction (when chain notes or risk oracle require it).
1705
1890
  * Pass this as `addressLookupTableAccounts` in the next deposit to avoid creating a new ALT.
1706
1891
  */
1707
- addressLookupTableAccounts?: AddressLookupTableAccount[];
1892
+ addressLookupTableAccounts?: LookupTable[];
1708
1893
  }
1709
1894
  /**
1710
1895
  * Generate a random field element suitable for BN254
@@ -1740,7 +1925,7 @@ declare function derivePublicKey(privateKey: bigint): Promise<bigint>;
1740
1925
  * @param mintAddress Token mint (defaults to native SOL)
1741
1926
  * @returns A new UTXO (commitment will be computed)
1742
1927
  */
1743
- declare function createUtxo(amount: bigint, keypair: UtxoKeypair, mintAddress?: PublicKey): Promise<Utxo>;
1928
+ declare function createUtxo(amount: bigint, keypair: UtxoKeypair, mintAddress?: Address): Promise<Utxo>;
1744
1929
  /**
1745
1930
  * Create a zero/padding UTXO
1746
1931
  *
@@ -1753,14 +1938,14 @@ declare function createUtxo(amount: bigint, keypair: UtxoKeypair, mintAddress?:
1753
1938
  * @param mintAddress Token mint (defaults to native SOL)
1754
1939
  * @param salt Optional salt; if omitted, uses timestamp+counter for uniqueness
1755
1940
  */
1756
- declare function createZeroUtxo(mintAddress?: PublicKey, salt?: bigint): Promise<Utxo>;
1941
+ declare function createZeroUtxo(mintAddress?: Address, salt?: bigint): Promise<Utxo>;
1757
1942
  /**
1758
1943
  * Convert PublicKey to field element for circuit
1759
1944
  *
1760
- * @param pubkey Solana PublicKey
1945
+ * @param pubkey Solana address
1761
1946
  * @returns Field element representation
1762
1947
  */
1763
- declare function pubkeyToFieldElement(pubkey: PublicKey): bigint;
1948
+ declare function pubkeyToFieldElement(pubkey: Address): bigint;
1764
1949
  /**
1765
1950
  * Compute the commitment for a UTXO
1766
1951
  *
@@ -1882,14 +2067,14 @@ interface VerifyUtxosResult {
1882
2067
  *
1883
2068
  * Typical latency: ~150-300ms on a healthy RPC.
1884
2069
  */
1885
- declare function verifyUtxos(utxos: Utxo[], connection: Connection, programId: PublicKey, commitment?: "processed" | "confirmed" | "finalized"): Promise<VerifyUtxosResult>;
2070
+ declare function verifyUtxos(utxos: Utxo[], connection: CloakRpc, programId: Address, commitment?: "processed" | "confirmed" | "finalized"): Promise<VerifyUtxosResult>;
1886
2071
  /**
1887
2072
  * Pre-flight gate: throw `UtxoAlreadySpentError` if any input is already
1888
2073
  * spent on-chain. Called at the top of spend entry points in flows/transact.
1889
2074
  *
1890
2075
  * Browser-safe: uses one batched RPC call.
1891
2076
  */
1892
- declare function preflightNullifiers(utxos: Utxo[], connection: Connection, programId: PublicKey, commitment?: "processed" | "confirmed" | "finalized"): Promise<void>;
2077
+ declare function preflightNullifiers(utxos: Utxo[], connection: CloakRpc, programId: Address, commitment?: "processed" | "confirmed" | "finalized"): Promise<void>;
1893
2078
 
1894
2079
  /**
1895
2080
  * Settlement verification — decide from CHAIN STATE whether a submission landed.
@@ -1941,6 +2126,9 @@ declare function preflightNullifiers(utxos: Utxo[], connection: Connection, prog
1941
2126
  * is what lets the phantom-relay / lying-RPC regressions be reproduced without a validator.
1942
2127
  */
1943
2128
  interface SettlementConnection {
2129
+ /** Names the RPC it talks to, so the loopback guard can read it (a `CloakRpc` does). */
2130
+ endpoint?: string;
2131
+ rpcEndpoint?: string;
1944
2132
  getSignatureStatuses(signatures: string[], config?: {
1945
2133
  searchTransactionHistory?: boolean;
1946
2134
  }): Promise<{
@@ -1949,7 +2137,7 @@ interface SettlementConnection {
1949
2137
  confirmationStatus?: string | null;
1950
2138
  } | null>;
1951
2139
  }>;
1952
- getMultipleAccountsInfo(publicKeys: PublicKey[], commitmentOrConfig?: any): Promise<Array<unknown | null>>;
2140
+ getMultipleAccounts(addresses: Address[], commitment?: "processed" | "confirmed" | "finalized"): Promise<Array<unknown | null>>;
1953
2141
  }
1954
2142
  /**
1955
2143
  * What the chain says about a submission.
@@ -1979,8 +2167,8 @@ interface SettlementVerdict {
1979
2167
  }
1980
2168
  interface ConfirmSettlementParams {
1981
2169
  connection: SettlementConnection;
1982
- programId: PublicKey;
1983
- mint: PublicKey;
2170
+ programId: Address;
2171
+ mint: Address;
1984
2172
  /** The proof's public input nullifiers. All-zero entries are padding and are skipped. */
1985
2173
  inputNullifiers: bigint[];
1986
2174
  /** The signature the counterparty reported, if it reported one. */
@@ -1995,7 +2183,7 @@ declare function isPlausibleSignature(value: string | null | undefined): value i
1995
2183
  * Derive the nullifier PDA for each non-zero input nullifier. Zero entries are the program's own
1996
2184
  * padding sentinel (`transact.rs`: "Skip zero nullifiers (padding inputs)") and create no account.
1997
2185
  */
1998
- declare function deriveInputNullifierPdas(programId: PublicKey, mint: PublicKey, inputNullifiers: bigint[]): PublicKey[];
2186
+ declare function deriveInputNullifierPdas(programId: Address, mint: Address, inputNullifiers: bigint[]): Promise<Address[]>;
1999
2187
  /**
2000
2188
  * Establish, from chain state, whether a submission landed.
2001
2189
  *
@@ -2018,8 +2206,8 @@ declare function confirmTransactSettlement(params: ConfirmSettlementParams): Pro
2018
2206
  */
2019
2207
  declare function assertDirectSubmissionLanded(params: {
2020
2208
  connection: SettlementConnection;
2021
- programId: PublicKey;
2022
- mint: PublicKey;
2209
+ programId: Address;
2210
+ mint: Address;
2023
2211
  nullifiers: Array<Uint8Array | bigint>;
2024
2212
  signature: string;
2025
2213
  timeoutMs?: number;
@@ -2291,6 +2479,17 @@ declare class RelayService {
2291
2479
  private computeViewingKeyIdentifier;
2292
2480
  }
2293
2481
 
2482
+ /**
2483
+ * Instruction helpers. A kit `Instruction` is `{ programAddress, accounts, data }` with an
2484
+ * `AccountRole` per account instead of the `isSigner`/`isWritable` pair.
2485
+ */
2486
+
2487
+ declare function accountMeta(address: Address, options?: {
2488
+ signer?: boolean;
2489
+ writable?: boolean;
2490
+ }): AccountMeta;
2491
+ declare function programInstruction(programAddress: Address, accounts: readonly AccountMeta[], data: Uint8Array): Instruction;
2492
+
2294
2493
  /**
2295
2494
  * Risk Oracle Service
2296
2495
  *
@@ -2318,9 +2517,9 @@ declare class RelayService {
2318
2517
  * @param rangeApiKey - Range.org API key for the risk score lookup
2319
2518
  * @returns The Ed25519 sig-verify instruction to prepend at index 0, plus the queue pubkey
2320
2519
  */
2321
- declare function fetchRiskQuoteIx(connection: Connection, wallet: PublicKey, rangeApiKey: string): Promise<{
2322
- instruction: TransactionInstruction;
2323
- queue: PublicKey;
2520
+ declare function fetchRiskQuoteIx(connection: CloakRpc, wallet: Address, rangeApiKey: string): Promise<{
2521
+ instruction: Instruction;
2522
+ queue: Address;
2324
2523
  }>;
2325
2524
 
2326
2525
  /**
@@ -2354,31 +2553,18 @@ declare function prepareEncryptedOutputForRecipient(note: CloakNote, recipientPv
2354
2553
  declare function encodeNoteSimple(note: CloakNote): string;
2355
2554
 
2356
2555
  /**
2357
- * Wallet Integration Helpers
2556
+ * Signer helpers: one shape for "who signs" whether it is a local key pair or a browser wallet.
2358
2557
  *
2359
- * Helper functions for working with Solana Wallet Adapters
2558
+ * A kit `TransactionSigner` already covers both, so this module is thin: connection checks, the
2559
+ * signer's address, and sending a signed transaction through a {@link CloakRpc}.
2360
2560
  */
2361
2561
 
2362
- /**
2363
- * Validate wallet is connected and has public key
2364
- */
2365
- declare function validateWalletConnected(wallet: WalletAdapter | Keypair): void;
2366
- /**
2367
- * Get public key from wallet or keypair
2368
- */
2369
- declare function getPublicKey(wallet: WalletAdapter | Keypair): PublicKey;
2370
- /**
2371
- * Send transaction using wallet adapter or keypair
2372
- */
2373
- declare function sendTransaction(transaction: Transaction, wallet: WalletAdapter | Keypair, connection: Connection, options?: SendOptions): Promise<string>;
2374
- /**
2375
- * Sign transaction using wallet adapter or keypair
2376
- */
2377
- declare function signTransaction<T extends Transaction>(transaction: T, wallet: WalletAdapter | Keypair): Promise<T>;
2378
- /**
2379
- * Create a keypair adapter for testing
2380
- */
2381
- declare function keypairToAdapter(keypair: Keypair): WalletAdapter;
2562
+ /** Throws unless `signer` is a usable kit signer (a wallet that is not connected has none). */
2563
+ declare function validateWalletConnected(signer: TransactionSigner | null | undefined): void;
2564
+ /** The signer's address. */
2565
+ declare function getPublicKey(signer: TransactionSigner): Address;
2566
+ /** Sends a signed transaction; the signature is the transaction's own. */
2567
+ declare function sendTransaction(transaction: SignedTransaction, connection: CloakRpc, options?: SendOptions): Promise<string>;
2382
2568
 
2383
2569
  /**
2384
2570
  * Create a deposit instruction
@@ -2406,21 +2592,21 @@ declare function keypairToAdapter(keypair: Keypair): WalletAdapter;
2406
2592
  * ```
2407
2593
  */
2408
2594
  declare function createDepositInstruction(params: {
2409
- programId: PublicKey;
2410
- payer: PublicKey;
2411
- pool: PublicKey;
2412
- merkleTree: PublicKey;
2595
+ programId: Address;
2596
+ payer: Address;
2597
+ pool: Address;
2598
+ merkleTree: Address;
2413
2599
  amount: number;
2414
2600
  commitment: Uint8Array;
2415
- }): TransactionInstruction;
2601
+ }): Instruction;
2416
2602
  /**
2417
2603
  * Deposit instruction parameters for type safety
2418
2604
  */
2419
2605
  interface DepositInstructionParams {
2420
- programId: PublicKey;
2421
- payer: PublicKey;
2422
- pool: PublicKey;
2423
- merkleTree: PublicKey;
2606
+ programId: Address;
2607
+ payer: Address;
2608
+ pool: Address;
2609
+ merkleTree: Address;
2424
2610
  amount: number;
2425
2611
  commitment: Uint8Array;
2426
2612
  }
@@ -2437,60 +2623,36 @@ declare function validateDepositParams(params: DepositInstructionParams): void;
2437
2623
  *
2438
2624
  * These functions derive deterministic addresses from the program ID and seeds.
2439
2625
  * This matches the behavior in tooling/test/src/shared.rs::get_pda_addresses()
2626
+ *
2627
+ * Derivation is asynchronous (kit hashes through WebCrypto); every helper returns a promise.
2440
2628
  */
2441
2629
 
2630
+ /** Core PDAs for a pool */
2442
2631
  interface ShieldPoolPDAs {
2443
- pool: PublicKey;
2444
- merkleTree: PublicKey;
2445
- vaultAuthority: PublicKey;
2446
- treasury: PublicKey;
2632
+ pool: Address;
2633
+ merkleTree: Address;
2634
+ vaultAuthority: Address;
2635
+ treasury: Address;
2447
2636
  }
2448
2637
  /**
2449
2638
  * Derive all Shield Pool PDAs from program ID + pool mint
2450
2639
  *
2451
- * Seeds match the on-chain mint-scoped program:
2452
- * - pool: [b"pool", mint]
2453
- * - merkle_tree: [b"merkle_tree", mint]
2454
- * - treasury: [b"treasury", mint]
2455
- * - vault_authority: [b"vault_authority", mint]
2456
- *
2457
- * @param programId - Optional program ID (defaults to CLOAK_PROGRAM_ID)
2458
- * @param mint - Pool mint (defaults to NATIVE_SOL_MINT / WSOL sentinel)
2640
+ * @param programId Shield Pool program ID (defaults to CLOAK_PROGRAM_ID)
2641
+ * @param mint Pool mint (defaults to native SOL)
2459
2642
  */
2460
- declare function getShieldPoolPDAs(programId?: PublicKey, mint?: PublicKey): ShieldPoolPDAs;
2643
+ declare function getShieldPoolPDAs(programId?: Address, mint?: Address): Promise<ShieldPoolPDAs>;
2461
2644
  /**
2462
- * Derive the nullifier PDA for a specific pool + nullifier hash.
2463
- *
2464
- * With the new PDA-per-nullifier design, each nullifier has its own PDA
2465
- * instead of being stored in a shared shard. The PDA is created when
2466
- * the nullifier is used during withdrawal.
2467
- *
2468
- * Seeds: ["nullifier", pool_pubkey, nullifier_hash]
2469
- *
2470
- * @param poolPubkey - Pool PDA that scopes nullifier domain
2471
- * @param nullifier - 32-byte nullifier hash
2472
- * @param programId - Optional program ID (defaults to CLOAK_PROGRAM_ID)
2473
- * @returns [PublicKey, bump] - The nullifier PDA and its bump seed
2645
+ * Derive the nullifier PDA for a given pool and nullifier hash
2474
2646
  */
2475
- declare function getNullifierPDA(poolPubkey: PublicKey, nullifier: Uint8Array | Buffer, programId?: PublicKey): [PublicKey, number];
2647
+ declare function getNullifierPDA(poolAddress: Address, nullifier: Uint8Array, programId?: Address): Promise<[Address, number]>;
2476
2648
  /**
2477
- * Derive the swap state PDA for a given pool + nullifier.
2478
- *
2479
- * Seeds: ["swap_state", pool_pubkey, nullifier_hash]
2480
- *
2481
- * @param poolPubkey - Pool PDA used for swap state domain separation
2482
- * @param nullifier - 32-byte nullifier hash
2483
- * @param programId - Optional program ID (defaults to CLOAK_PROGRAM_ID)
2484
- * @returns [PublicKey, bump] - The swap state PDA and its bump seed
2649
+ * Derive the swap-state PDA for a given pool and nullifier hash
2485
2650
  */
2486
- declare function getSwapStatePDA(poolPubkey: PublicKey, nullifier: Uint8Array | Buffer, programId?: PublicKey): [PublicKey, number];
2651
+ declare function getSwapStatePDA(poolAddress: Address, nullifier: Uint8Array, programId?: Address): Promise<[Address, number]>;
2487
2652
  /**
2488
- * M-07: derive the per-pool PoolAuthorityConfig PDA (holds the mint-scoped
2489
- * withdraw-authorizer).
2490
- *
2491
- * Seeds: ["pool_authority", pool_mint]
2653
+ * Derive the per-pool authority config PDA (range signer / withdraw authorizer)
2492
2654
  */
2493
- declare function getPoolAuthorityConfigPDA(mint?: PublicKey, programId?: PublicKey): [PublicKey, number];
2655
+ declare function getPoolAuthorityConfigPDA(mint?: Address, programId?: Address): Promise<[Address, number]>;
2494
2656
  /**
2495
2657
  * Registry PDA the relay's recipient-delivery carrier (CLKD1) touches so the carrier transaction is
2496
2658
  * enumerable via `getSignaturesForAddress`.
@@ -2499,14 +2661,14 @@ declare function getPoolAuthorityConfigPDA(mint?: PublicKey, programId?: PublicK
2499
2661
  * `services/relay/src/solana/mod.rs::emit_recipient_delivery_carrier`. Mint-independent, exactly
2500
2662
  * like the chain-note registry: one registry per program, not per pool.
2501
2663
  */
2502
- declare function getDeliveryRegistryPDA(programId?: PublicKey): PublicKey;
2664
+ declare function getDeliveryRegistryPDA(programId?: Address): Promise<Address>;
2503
2665
  /**
2504
2666
  * Registry PDA the relay's compliance chain-note carrier (CLK1) touches.
2505
2667
  *
2506
2668
  * Seed: ["cloak_chain_note_registry"] — `CHAIN_NOTE_REGISTRY_SEED` in
2507
2669
  * `services/relay/src/solana/mod.rs::emit_chain_note_carrier`.
2508
2670
  */
2509
- declare function getChainNoteRegistryPDA(programId?: PublicKey): PublicKey;
2671
+ declare function getChainNoteRegistryPDA(programId?: Address): Promise<Address>;
2510
2672
 
2511
2673
  /**
2512
2674
  * On-chain Merkle proof computation
@@ -2542,10 +2704,10 @@ interface MerkleTreeState {
2542
2704
  * @param relayUrl - Optional relay URL to query for current root (bypasses RPC caching)
2543
2705
  * @param mint - Optional pool mint used when querying relay /merkle-root
2544
2706
  */
2545
- declare function readMerkleTreeState(connection: Connection, merkleTreePDA: PublicKey, forceConfirmed?: boolean, relayUrl?: string,
2707
+ declare function readMerkleTreeState(connection: CloakRpc, merkleTreePDA: Address, forceConfirmed?: boolean, relayUrl?: string,
2546
2708
  /** When true, skip relay root and use chain directly (avoids stale relay root causing ProofInvalid) */
2547
- skipRelayRoot?: boolean, mint?: PublicKey): Promise<MerkleTreeState>;
2548
- declare function computeProofFromChain(connection: Connection, merkleTreePDA: PublicKey, leafIndex: number, forceConfirmed?: boolean): Promise<OnchainMerkleProof>;
2709
+ skipRelayRoot?: boolean, mint?: Address): Promise<MerkleTreeState>;
2710
+ declare function computeProofFromChain(connection: CloakRpc, merkleTreePDA: Address, leafIndex: number, forceConfirmed?: boolean): Promise<OnchainMerkleProof>;
2549
2711
  /**
2550
2712
  * Compute proof for the most recently inserted leaf
2551
2713
  *
@@ -2553,7 +2715,7 @@ declare function computeProofFromChain(connection: Connection, merkleTreePDA: Pu
2553
2715
  * all siblings to the right are zero values, and siblings to the left
2554
2716
  * are stored in the subtrees.
2555
2717
  */
2556
- declare function computeProofForLatestDeposit(connection: Connection, merkleTreePDA: PublicKey): Promise<OnchainMerkleProof & {
2718
+ declare function computeProofForLatestDeposit(connection: CloakRpc, merkleTreePDA: Address): Promise<OnchainMerkleProof & {
2557
2719
  leafIndex: number;
2558
2720
  }>;
2559
2721
 
@@ -2653,7 +2815,7 @@ interface CommitmentsResponse {
2653
2815
  canonical_reason?: string | null;
2654
2816
  }
2655
2817
  interface FetchCommitmentsOptions {
2656
- mint?: PublicKey;
2818
+ mint?: Address;
2657
2819
  timeoutMs?: number;
2658
2820
  maxRetries?: number;
2659
2821
  sync?: boolean;
@@ -2682,7 +2844,7 @@ declare function fetchCommitments(relayUrl: string, options?: FetchCommitmentsOp
2682
2844
  * zero leaves to match the on-chain Merkle tree structure.
2683
2845
  */
2684
2846
  declare function buildMerkleTreeFromRelay(relayUrl: string, options?: {
2685
- mint?: PublicKey;
2847
+ mint?: Address;
2686
2848
  sync?: boolean;
2687
2849
  repair?: boolean;
2688
2850
  requireTarget?: boolean;
@@ -2691,12 +2853,12 @@ declare function buildMerkleTreeFromRelay(relayUrl: string, options?: {
2691
2853
  maxRetries?: number;
2692
2854
  waitForIndex?: number;
2693
2855
  }): Promise<MerkleTree>;
2694
- declare function buildMerkleTreeFromChain(connection: Connection, programId: PublicKey, merkleTree: PublicKey, onProgress?: (message: string) => void,
2856
+ declare function buildMerkleTreeFromChain(connection: CloakRpc, programId: Address, merkleTree: Address, onProgress?: (message: string) => void,
2695
2857
  /**
2696
2858
  * The pool mint this tree belongs to. Required in practice: without it a `CloseSwapState` refund
2697
2859
  * leaf cannot be attributed to a tree, and reconstruction fails closed rather than guess.
2698
2860
  */
2699
- mint?: PublicKey): Promise<MerkleTree>;
2861
+ mint?: Address): Promise<MerkleTree>;
2700
2862
  /**
2701
2863
  * Pre-flight root validation
2702
2864
  *
@@ -2815,47 +2977,6 @@ declare function isBrowser(): boolean;
2815
2977
  */
2816
2978
  declare function isBrowserLike(): boolean;
2817
2979
 
2818
- /**
2819
- * One wallet approval for a batch of relay requests (CLOAK_RELAY_BATCH_AUTH_V1).
2820
- *
2821
- * ── The problem ───────────────────────────────────────────────────────────────────────────────
2822
- * A payout to N recipients is N private spends, because the recipient is bound into each proof
2823
- * through `ext_data_hash`. Every spend is its own `/transact` request, and the relay authenticates
2824
- * every request with a wallet signature over that request's digest (`payload.ts`). So a payout of
2825
- * forty asked the wallet forty times. The transactions are not the problem: the relay builds and
2826
- * submits those and the user never signs them. The forty prompts were forty request signatures.
2827
- *
2828
- * ── The mechanism ─────────────────────────────────────────────────────────────────────────────
2829
- * Every item runs the ordinary `transact` flow unchanged, up to the moment it would sign its
2830
- * request. There it hands its finished body to the coordinator below and waits. When every item of
2831
- * the batch is either waiting here or already finished, the coordinator stamps one `issued_at`,
2832
- * builds each item's per-request preimage exactly as the single path would, takes the sha256 of
2833
- * each preimage, and asks the wallet ONCE to sign the list of those digests. Each item then gets
2834
- * back its own nonce and that one signature, plus the digest list the relay needs to verify it, and
2835
- * proceeds to POST as before. The relay checks that the item's digest is in the signed list and that
2836
- * the signature covers the list (`request_auth.rs`).
2837
- *
2838
- * ── What it deliberately keeps ────────────────────────────────────────────────────────────────
2839
- * - Every item still has its own one-time nonce, so an item cannot be submitted twice.
2840
- * - The user still signs every request they submit, as a list; nothing here can add a request the
2841
- * wallet did not see without breaking the signature.
2842
- * - A stale-root retry re-proves, which changes the item's digest. That item comes back here and
2843
- * is signed in a NEW wave with whichever other items also had to re-prove: one more approval for
2844
- * the retries, never one per row. `approvals` counts the waves so a caller can show that.
2845
- * - Submissions after the signature are released `submitConcurrency` at a time, not all at once,
2846
- * so the relay is not hit with N proofs in the same second while the signed window runs.
2847
- *
2848
- * Wave readiness is exact, not a timer: the coordinator knows how many items were registered and
2849
- * what each one is doing, so it signs the moment nothing in the batch is still building a proof.
2850
- *
2851
- * Every row must therefore be IN FLIGHT at once: a row that has not started counts as building, and
2852
- * the wave waits for it. Register every item (`item()`) BEFORE any row can fail, and always call
2853
- * `finish()`: a declared item that never registers, or never finishes, holds the wave forever, and
2854
- * `snapshot()` is how a caller sees that (`registered < expected`, or a row stuck in `building`). Do not run rows through a worker pool smaller than the batch (the pooled
2855
- * rows park at the signature, the pool never frees, and nothing ever signs). Bound the expensive
2856
- * part instead: `proofSlot()` limits how many rows prove at the same time.
2857
- */
2858
-
2859
2980
  /**
2860
2981
  * What one item of the batch holds. `submitTransactToRelay` calls `authorize` where it would
2861
2982
  * otherwise sign; the caller that ran the item calls `finish` when the item's flow has settled,
@@ -2867,7 +2988,7 @@ interface RelayBatchAuthItemHandle {
2867
2988
  * before the one signature; this is where CPU and memory are bounded instead. Returns the release.
2868
2989
  */
2869
2990
  proofSlot(): Promise<() => void>;
2870
- authorize(endpoint: string, programId: PublicKey, body: Record<string, unknown>, fields: readonly string[]): Promise<RelayBatchAuthFields>;
2991
+ authorize(endpoint: string, programId: Address, body: Record<string, unknown>, fields: readonly string[]): Promise<RelayBatchAuthFields>;
2871
2992
  finish(): void;
2872
2993
  }
2873
2994
  interface RelayBatchAuthCoordinatorOptions {
@@ -2877,7 +2998,7 @@ interface RelayBatchAuthCoordinatorOptions {
2877
2998
  * `sender`. COMPLIANCE: that key is the one screened for sanctions on a shield-to-shield send,
2878
2999
  * so it must be the end user's own wallet, never a service or ephemeral key.
2879
3000
  */
2880
- signer: RelayAuthSigner | Keypair;
3001
+ signer: RelayAuthSigner;
2881
3002
  /** How many items will call `item()`. The wave signs only when all of them are accounted for. */
2882
3003
  items: number;
2883
3004
  /** Rows proving at the same time. Proofs are CPU-bound; default 2. */
@@ -2902,7 +3023,7 @@ declare class RelayBatchAuthCoordinator {
2902
3023
  private waves;
2903
3024
  constructor(options: RelayBatchAuthCoordinatorOptions);
2904
3025
  /** The wallet that signs and is every item's authenticated `sender`. */
2905
- get walletPublicKey(): PublicKey;
3026
+ get walletPublicKey(): Address;
2906
3027
  /** How many times the signer has been asked so far: one per wave. */
2907
3028
  get approvals(): number;
2908
3029
  /** Where every item is right now. For progress UIs and for diagnosing a batch that never signs. */
@@ -3054,7 +3175,7 @@ declare function resolveCircuitsBase(explicit?: string): string;
3054
3175
  * exactly as the circuit computes it.
3055
3176
  */
3056
3177
  declare function computeChainNoteHash(publicAmount: bigint, extDataHash: bigint, noteTimestamp: bigint, noteCommitment: bigint, noteSalt: bigint, outAmount0: bigint, outPubkey0: bigint, noteIsSendToSelfKey0: bigint): Promise<bigint>;
3057
- declare function computeExtDataHash(recipient: PublicKey | null, relayerFee: bigint, relayer: PublicKey | null, maxFee?: bigint): Promise<bigint>;
3178
+ declare function computeExtDataHash(recipient: Address | null, relayerFee: bigint, relayer: Address | null, maxFee?: bigint): Promise<bigint>;
3058
3179
  /**
3059
3180
  * Adapter for a third-party fee-payer relayer (e.g. Kora, https://github.com/solana-foundation/kora)
3060
3181
  * that lets the depositor pay network fees — and, via `buildTopUpInstructions`, the on-chain rent
@@ -3065,7 +3186,7 @@ declare function computeExtDataHash(recipient: PublicKey | null, relayerFee: big
3065
3186
  */
3066
3187
  interface ExternalFeePayerAdapter {
3067
3188
  /** Returns the external fee payer's pubkey (Kora's `getPayerSigner`). */
3068
- getPayerPubkey: () => Promise<PublicKey>;
3189
+ getPayerPubkey: () => Promise<Address>;
3069
3190
  /**
3070
3191
  * Instructions to insert right after the risk-quote instruction (if any) and before every
3071
3192
  * instruction that spends the depositor's own SOL balance — typically a single
@@ -3090,13 +3211,13 @@ interface ExternalFeePayerAdapter {
3090
3211
  * carries one of each, sized for the whole thing including this top-up; a second pair is
3091
3212
  * rejected by the runtime as duplicate instructions.
3092
3213
  */
3093
- buildTopUpInstructions: (payerPubkey: PublicKey) => Promise<TransactionInstruction[]>;
3214
+ buildTopUpInstructions: (payerPubkey: Address) => Promise<Instruction[]>;
3094
3215
  /**
3095
3216
  * Given a base64-encoded, unsigned V0 transaction (feePayer = the external payer's pubkey, every
3096
3217
  * instruction the deposit needs including any top-up, fresh blockhash), returns the fee-payment
3097
3218
  * instruction to append before final signing (Kora's `getPaymentInstruction`).
3098
3219
  */
3099
- getPaymentInstruction: (unsignedTxBase64: string) => Promise<TransactionInstruction>;
3220
+ getPaymentInstruction: (unsignedTxBase64: string) => Promise<Instruction>;
3100
3221
  /**
3101
3222
  * Given a base64-encoded transaction the depositor has already partially signed (their own signer
3102
3223
  * slot filled; the external payer's slot still empty — same instructions plus the payment
@@ -3115,7 +3236,7 @@ interface ExternalFeePayerAdapter {
3115
3236
  * transaction and extra rent, paid by the external payer). Measured on the first real deposit:
3116
3237
  * 1236 bytes vs the 1232 limit — over by 4. With the hint, one ALT covers the final transaction.
3117
3238
  */
3118
- getPaymentAccountHints?: () => Promise<PublicKey[]>;
3239
+ getPaymentAccountHints?: () => Promise<Address[]>;
3119
3240
  }
3120
3241
  /**
3121
3242
  * Refuse a transaction whose input notes do not agree on a mint, or do not
@@ -3137,15 +3258,15 @@ interface ExternalFeePayerAdapter {
3137
3258
  * The error names both mints, because the whole failure mode is that the two
3138
3259
  * were assumed to be the same.
3139
3260
  */
3140
- declare function assertInputMints(inputUtxos: Utxo[], expectedMint?: PublicKey): void;
3261
+ declare function assertInputMints(inputUtxos: Utxo[], expectedMint?: Address): void;
3141
3262
  /**
3142
3263
  * Options for transact operation
3143
3264
  */
3144
3265
  interface TransactOptions {
3145
3266
  /** Connection to Solana */
3146
- connection: Connection;
3267
+ connection: CloakRpc;
3147
3268
  /** Program ID */
3148
- programId: PublicKey;
3269
+ programId: Address;
3149
3270
  /** Callback for progress updates */
3150
3271
  onProgress?: (status: string) => void;
3151
3272
  /** Callback for proof generation progress */
@@ -3153,7 +3274,7 @@ interface TransactOptions {
3153
3274
  /** Relayer fee in lamports */
3154
3275
  relayerFee?: bigint;
3155
3276
  /** Relayer address for fee payment */
3156
- relayer?: PublicKey;
3277
+ relayer?: Address;
3157
3278
  /**
3158
3279
  * Cloak endpoint to submit through.
3159
3280
  *
@@ -3170,28 +3291,26 @@ interface TransactOptions {
3170
3291
  * variable, because a published build must not be repointable at either.
3171
3292
  */
3172
3293
  relayUrl?: string;
3173
- /** Keypair of the depositor (signs the deposit transaction) - for programmatic use */
3174
- depositorKeypair?: Keypair;
3294
+ /** Local key pair of the depositor (signs deposits and relay requests) - for programmatic use */
3295
+ depositorKeypair?: KeyPairSigner;
3175
3296
  /**
3176
- * Wallet adapter sign function - for web app use
3177
- * If provided (along with depositorPublicKey), user will sign deposits via wallet.
3178
- * Accepts both legacy Transaction and VersionedTransaction (for V0 with ALTs).
3297
+ * The user's wallet as a kit signer - for web app use. Signs deposits; also authenticates relay
3298
+ * requests: through `signMessages` when the wallet can sign messages, otherwise by signing the
3299
+ * deterministic no-op transaction that carries the request digest in its blockhash slot
3300
+ * (`relay/payload.ts`, `buildAuthTransactionMessage`), which is what a Ledger or Trezor can do.
3301
+ * Wrap a wallet-adapter with `signerFromWalletAdapter` from `solana/compat`.
3179
3302
  */
3180
- signTransaction?: <T extends Transaction | VersionedTransaction>(transaction: T) => Promise<T>;
3181
- /** Wallet adapter signMessage for viewing-key registration auth. */
3182
- signMessage?: (message: Uint8Array) => Promise<Uint8Array>;
3303
+ signer?: TransactionSigner;
3183
3304
  /**
3184
- * Relay authentication for a wallet that cannot sign messages at all (Ledger, Trezor): the
3185
- * wallet-adapter `signTransaction`, used to sign a deterministic no-op transaction that carries
3186
- * the request digest in its blockhash slot instead of signing the text (`relay/payload.ts`,
3187
- * `buildAuthTransactionMessage`). Also used for viewing-key registration. Requires
3188
- * `walletPublicKey` (or `depositorPublicKey`). `signMessage` wins when both are present.
3189
- */
3190
- signAuthTransaction?: <T extends Transaction>(transaction: T) => Promise<T>;
3191
- /** Public key of the depositor when using signTransaction */
3192
- depositorPublicKey?: PublicKey;
3193
- /** Wallet public key for relay submissions when depositor keypair isn't used. */
3194
- walletPublicKey?: PublicKey;
3305
+ * Wallet-adapter `signMessage`, for relay authentication without `signer` (relay-only flows:
3306
+ * sends, withdraws, swaps). Requires `walletPublicKey` (or `depositorPublicKey`). Wins over the
3307
+ * signer's own message signing when both are present.
3308
+ */
3309
+ signMessage?: (message: Uint8Array) => Promise<Uint8Array>;
3310
+ /** Address of the depositor when the wallet signs (same key as `signer.address`). */
3311
+ depositorPublicKey?: Address;
3312
+ /** Wallet address for relay submissions when a depositor key pair isn't used. */
3313
+ walletPublicKey?: Address;
3195
3314
  /** Maximum retries on RootNotFound error (default: 5) */
3196
3315
  maxRootRetries?: number;
3197
3316
  /**
@@ -3210,7 +3329,7 @@ interface TransactOptions {
3210
3329
  * Switchboard oracle queue for risk check on deposits.
3211
3330
  * Required when program has risk oracle enabled and depositor signs directly.
3212
3331
  */
3213
- riskOracleQueue?: PublicKey;
3332
+ riskOracleQueue?: Address;
3214
3333
  /**
3215
3334
  * URL for fetching the risk quote instruction (Range/Switchboard).
3216
3335
  * Used for deposits when riskOracleQueue is set. The backend must return a signed
@@ -3228,7 +3347,7 @@ interface TransactOptions {
3228
3347
  * Optional: provide the risk quote instruction directly (e.g. from your backend).
3229
3348
  * If set, used instead of riskQuoteUrl for deposits with risk oracle.
3230
3349
  */
3231
- getRiskQuoteInstruction?: (wallet: PublicKey) => Promise<TransactionInstruction>;
3350
+ getRiskQuoteInstruction?: (wallet: Address) => Promise<Instruction>;
3232
3351
  /**
3233
3352
  * Pre-built ALT addresses (base58 strings) for V0 transactions.
3234
3353
  * When relayUrl is set, ALTs are also fetched from relay /health.
@@ -3241,7 +3360,7 @@ interface TransactOptions {
3241
3360
  * The ALT should contain common read-only accounts (sysvars, system program, etc.)
3242
3361
  * to compress account addresses from 32 bytes to 1-byte indices.
3243
3362
  */
3244
- addressLookupTableAccounts?: AddressLookupTableAccount[];
3363
+ addressLookupTableAccounts?: LookupTable[];
3245
3364
  /**
3246
3365
  * Opt-in: when true and `relayUrl` is set, an SPL deposit that needs a supplemental lookup
3247
3366
  * table asks the relay to extend its shared table (`${relayUrl}/supplemental-alt`) instead of
@@ -3251,6 +3370,14 @@ interface TransactOptions {
3251
3370
  * preserves the old behaviour exactly.
3252
3371
  */
3253
3372
  relaySupplementalAlt?: boolean;
3373
+ /**
3374
+ * Message version for the transactions the SDK builds and submits itself (deposits, and the
3375
+ * external-fee-payer path). `0` (default) is a v0 message with ComputeBudget instructions;
3376
+ * `1` is a Transaction V1 message (SIMD-0385): 4,096-byte packet, every account static (no
3377
+ * lookup tables), the compute budget in the message header. Needs the cluster's v1 gate active
3378
+ * and a signer that signs v1 messages (a local keypair does; a browser wallet may not yet).
3379
+ */
3380
+ transactionVersion?: 0 | 1;
3254
3381
  /**
3255
3382
  * Optional Range.org API key for direct SDK-side quote fetching.
3256
3383
  *
@@ -3423,7 +3550,7 @@ interface TransactOptions {
3423
3550
  *
3424
3551
  * Optional for backward compatibility, but pass it on every flow you can.
3425
3552
  */
3426
- expectedMint?: PublicKey;
3553
+ expectedMint?: Address;
3427
3554
  /**
3428
3555
  * One item of a batch approval, from `createRelayBatchAuthCoordinator().item()`. When present the
3429
3556
  * relay request is authenticated with the batch's single wallet signature instead of a prompt of
@@ -3453,23 +3580,23 @@ interface RiskQuoteInstructionResponse {
3453
3580
  data: string;
3454
3581
  };
3455
3582
  }
3456
- declare function fetchRiskQuoteInstruction(riskQuoteUrl: string, wallet: PublicKey, options: {
3457
- poolMint: PublicKey;
3458
- recipient?: PublicKey;
3583
+ declare function fetchRiskQuoteInstruction(riskQuoteUrl: string, wallet: Address, options: {
3584
+ poolMint: Address;
3585
+ recipient?: Address;
3459
3586
  amount?: bigint;
3460
- token?: PublicKey;
3587
+ token?: Address;
3461
3588
  commitment?: string | Uint8Array;
3462
3589
  context?: "deposit" | "send" | "withdraw";
3463
3590
  nullifier0?: string;
3464
3591
  nullifier1?: string;
3465
- }): Promise<TransactionInstruction>;
3592
+ }): Promise<Instruction>;
3466
3593
  /** Everything the `/transact` relay body is built from. */
3467
3594
  interface TransactRequestBodyParams {
3468
3595
  proofB64: string;
3469
3596
  publicInputsB64: string;
3470
- mint: PublicKey;
3471
- recipient?: PublicKey | null;
3472
- relayer?: PublicKey | null;
3597
+ mint: Address;
3598
+ recipient?: Address | null;
3599
+ relayer?: Address | null;
3473
3600
  relayerFee: bigint;
3474
3601
  maxFee: bigint;
3475
3602
  encryptedNotes?: string[];
@@ -3479,7 +3606,7 @@ interface TransactRequestBodyParams {
3479
3606
  signer_pubkey: string;
3480
3607
  };
3481
3608
  /** Present only on shield-to-shield sends, where the relay enforces sanctions on the sender. */
3482
- sender?: PublicKey | null;
3609
+ sender?: Address | null;
3483
3610
  /** Signed public amount; zero is a shield-to-shield send. */
3484
3611
  externalAmount: bigint;
3485
3612
  /** Base64 CLKD1 envelopes, from `buildRecipientDeliveryNotes`. Omitted when the rail is off. */
@@ -3498,8 +3625,8 @@ declare function buildTransactRequestBody(params: TransactRequestBodyParams): Re
3498
3625
  /** Everything settlement verification needs to check THIS proof against chain state. */
3499
3626
  interface SettlementContext {
3500
3627
  connection: SettlementConnection;
3501
- programId: PublicKey;
3502
- mint: PublicKey;
3628
+ programId: Address;
3629
+ mint: Address;
3503
3630
  /** The proof's public input nullifiers — the ground truth for "did this land". */
3504
3631
  inputNullifiers: bigint[];
3505
3632
  }
@@ -3523,8 +3650,8 @@ interface SubmitTransactToRelayArgs {
3523
3650
  relayUrl: string;
3524
3651
  /** The exact body to POST. Auth fields are added ONCE, in place, and then never changed. */
3525
3652
  requestBody: Record<string, unknown>;
3526
- programId: PublicKey;
3527
- depositorKeypair?: Keypair;
3653
+ programId: Address;
3654
+ depositorKeypair?: KeyPairSigner;
3528
3655
  /**
3529
3656
  * Wallet-adapter alternative to `depositorKeypair` for request authentication, used only when
3530
3657
  * no keypair is supplied. Lets a browser or mobile caller — which holds no secret key — submit
@@ -3608,7 +3735,7 @@ declare function transfer(inputUtxos: Utxo[], recipientPubkey: bigint, amount: b
3608
3735
  * @param withdrawAmount Amount to withdraw
3609
3736
  * @param options Transaction options
3610
3737
  */
3611
- declare function partialWithdraw(inputUtxos: Utxo[], recipient: PublicKey, withdrawAmount: bigint, options: TransactOptions): Promise<TransactResult>;
3738
+ declare function partialWithdraw(inputUtxos: Utxo[], recipient: Address, withdrawAmount: bigint, options: TransactOptions): Promise<TransactResult>;
3612
3739
  /**
3613
3740
  * Execute a full withdrawal
3614
3741
  *
@@ -3618,7 +3745,7 @@ declare function partialWithdraw(inputUtxos: Utxo[], recipient: PublicKey, withd
3618
3745
  * @param recipient External Solana address
3619
3746
  * @param options Transaction options
3620
3747
  */
3621
- declare function fullWithdraw(inputUtxos: Utxo[], recipient: PublicKey, options: TransactOptions): Promise<TransactResult>;
3748
+ declare function fullWithdraw(inputUtxos: Utxo[], recipient: Address, options: TransactOptions): Promise<TransactResult>;
3622
3749
  /**
3623
3750
  * Parameters for UTXO swap operation
3624
3751
  */
@@ -3630,11 +3757,11 @@ interface UtxoSwapParams {
3630
3757
  /** Amount to swap (lamports) */
3631
3758
  swapAmount: bigint;
3632
3759
  /** Output token mint address */
3633
- outputMint: PublicKey;
3760
+ outputMint: Address;
3634
3761
  /** Recipient's Associated Token Account for output tokens */
3635
- recipientAta: PublicKey;
3762
+ recipientAta: Address;
3636
3763
  /** Optional recipient wallet (used by relay to create ATA if missing) */
3637
- recipientWallet?: PublicKey;
3764
+ recipientWallet?: Address;
3638
3765
  /** Minimum output amount (slippage protection) */
3639
3766
  minOutputAmount: bigint;
3640
3767
  }
@@ -3693,7 +3820,7 @@ declare function swapUtxo(params: UtxoSwapParams, options: TransactOptions): Pro
3693
3820
  * @param minOutputAmount Minimum output (slippage protection)
3694
3821
  * @param options Transaction options
3695
3822
  */
3696
- declare function swapWithChange(inputUtxos: Utxo[], swapAmount: bigint, outputMint: PublicKey, recipientAta: PublicKey, minOutputAmount: bigint, options: TransactOptions, recipientWallet?: PublicKey): Promise<UtxoSwapResult>;
3823
+ declare function swapWithChange(inputUtxos: Utxo[], swapAmount: bigint, outputMint: Address, recipientAta: Address, minOutputAmount: bigint, options: TransactOptions, recipientWallet?: Address): Promise<UtxoSwapResult>;
3697
3824
 
3698
3825
  /**
3699
3826
  * Circuit artifact loading and integrity verification.
@@ -4104,7 +4231,7 @@ interface BuildRecipientDeliveryNotesParams {
4104
4231
  /** Signed public amount. Zero — and only zero — is a shield-to-shield send. */
4105
4232
  externalAmount: bigint;
4106
4233
  /** External withdrawal recipient, if any. A send has none. */
4107
- recipient?: PublicKey | null;
4234
+ recipient?: Address | null;
4108
4235
  /** The recipient's 32-byte X25519 public viewing key (`deriveViewingKeyFromNk(nk).publicKey`). */
4109
4236
  recipientViewingPublicKey?: Uint8Array | string | null;
4110
4237
  /**
@@ -4214,7 +4341,7 @@ interface DepositNoteSecrets {
4214
4341
  /** A deposit note recovered from `nk` alone, in spendable form. */
4215
4342
  interface RecoveredDepositNote extends DepositNoteSecrets {
4216
4343
  amount: bigint;
4217
- mintAddress: PublicKey;
4344
+ mintAddress: Address;
4218
4345
  /** The commitment the transaction published, reproduced from the derived secrets. */
4219
4346
  commitment: bigint;
4220
4347
  /** The salt the chain note carried, which anchored the derivation. */
@@ -4242,7 +4369,7 @@ declare function deriveDepositNoteSecrets(viewingKeyNk: Uint8Array, noteSalt: bi
4242
4369
  * { chainNoteViewingKeyNk: nk, chainNoteSalt: noteSalt, ... });
4243
4370
  * ```
4244
4371
  */
4245
- declare function createRecoverableDepositUtxo(amount: bigint, viewingKeyNk: Uint8Array, mintAddress?: PublicKey, noteSalt?: bigint): Promise<{
4372
+ declare function createRecoverableDepositUtxo(amount: bigint, viewingKeyNk: Uint8Array, mintAddress?: Address, noteSalt?: bigint): Promise<{
4246
4373
  utxo: Utxo;
4247
4374
  noteSalt: bigint;
4248
4375
  }>;
@@ -4254,7 +4381,7 @@ interface MatchDepositNoteParams {
4254
4381
  /** Candidate note amount — for a shield with no inputs this is the public deposit amount. */
4255
4382
  amount: bigint;
4256
4383
  /** Pool mint the commitment was computed under. */
4257
- mintAddress: PublicKey;
4384
+ mintAddress: Address;
4258
4385
  /** Output commitments the transaction actually published, hex or field elements. */
4259
4386
  outputCommitments: Array<string | bigint>;
4260
4387
  }
@@ -4343,7 +4470,7 @@ interface RecoveredChangeNote {
4343
4470
  keypair: UtxoKeypair;
4344
4471
  blinding: bigint;
4345
4472
  amount: bigint;
4346
- mintAddress: PublicKey;
4473
+ mintAddress: Address;
4347
4474
  /** The commitment the transaction published, reproduced from the derived blinding. */
4348
4475
  commitment: bigint;
4349
4476
  /** The salt the chain note carried, which anchored the derivation. */
@@ -4366,7 +4493,7 @@ declare function deriveChangeNoteBlinding(viewingKeyNk: Uint8Array, noteSalt: bi
4366
4493
  * the note leaves the change exactly as unrecoverable as before. `partialWithdraw` and `transfer`
4367
4494
  * do this for you; the pairing is only your concern if you call `transact` directly.
4368
4495
  */
4369
- declare function createRecoverableChangeUtxo(amount: bigint, keypair: UtxoKeypair, viewingKeyNk: Uint8Array, mintAddress?: PublicKey, noteSalt?: bigint, outputIndex?: number): Promise<{
4496
+ declare function createRecoverableChangeUtxo(amount: bigint, keypair: UtxoKeypair, viewingKeyNk: Uint8Array, mintAddress?: Address, noteSalt?: bigint, outputIndex?: number): Promise<{
4370
4497
  utxo: Utxo;
4371
4498
  noteSalt: bigint;
4372
4499
  }>;
@@ -4383,7 +4510,7 @@ interface MatchChangeNoteParams {
4383
4510
  */
4384
4511
  keypair: UtxoKeypair;
4385
4512
  /** Pool mint the commitment was computed under. */
4386
- mintAddress: PublicKey;
4513
+ mintAddress: Address;
4387
4514
  /** Which output slot the note occupied — part of the derivation, so it must match. */
4388
4515
  outputIndex: number;
4389
4516
  /** Output commitments the transaction actually published, hex or field elements. */
@@ -4508,7 +4635,7 @@ interface DiscoverSwapRefundsOptions {
4508
4635
  * Pool mint whose `swap_state` PDAs to derive. Swap input is wSOL-locked, so the default is the
4509
4636
  * native-SOL sentinel and there is no reason to change it outside a test.
4510
4637
  */
4511
- poolMint?: PublicKey;
4638
+ poolMint?: Address;
4512
4639
  }
4513
4640
  /**
4514
4641
  * Find every swap timeout-refund leaf on chain that belongs to the holder of `viewingKeyNk`, and
@@ -4529,7 +4656,7 @@ interface DiscoverSwapRefundsOptions {
4529
4656
  * @param programId Shield-pool program id.
4530
4657
  * @param viewingKeyNk 32-byte `nk` — the same value chain notes are decrypted with.
4531
4658
  */
4532
- declare function discoverSwapRefunds(connection: Connection, programId: PublicKey, viewingKeyNk: Uint8Array, options?: DiscoverSwapRefundsOptions): Promise<DiscoveredSwapRefund[]>;
4659
+ declare function discoverSwapRefunds(connection: CloakRpc, programId: Address, viewingKeyNk: Uint8Array, options?: DiscoverSwapRefundsOptions): Promise<DiscoveredSwapRefund[]>;
4533
4660
 
4534
4661
  /**
4535
4662
  * Compact deterministic chain note format.
@@ -4680,9 +4807,9 @@ interface RecoveredDepositNoteRecord extends RecoveredDepositNote {
4680
4807
  /** Options for `scanTransactions`. */
4681
4808
  interface ScanOptions {
4682
4809
  /** Solana RPC connection */
4683
- connection: Connection;
4810
+ connection: CloakRpc;
4684
4811
  /** Cloak shield pool program ID */
4685
- programId: PublicKey;
4812
+ programId: Address;
4686
4813
  /** nk (32 bytes) for diversified chain note decryption (Phase 3) */
4687
4814
  viewingKeyNk: Uint8Array;
4688
4815
  /** Maximum number of signatures to scan. Omit or set to 0 for no limit (scan everything). */
@@ -4723,7 +4850,7 @@ interface ScanOptions {
4723
4850
  */
4724
4851
  ownerUtxoPublicKey?: bigint;
4725
4852
  /** Candidate pool mints for delivery-carrier commitment verification. Defaults to native SOL. */
4726
- deliveryMints?: PublicKey[];
4853
+ deliveryMints?: Address[];
4727
4854
  }
4728
4855
  /** A note delivered TO the scanning wallet by someone else's shield-to-shield send. */
4729
4856
  interface DeliveredNote {
@@ -4749,8 +4876,8 @@ interface DeliveredNote {
4749
4876
  commitmentVerified: boolean;
4750
4877
  }
4751
4878
  interface ScanRecipientDeliveryOptions {
4752
- connection: Connection;
4753
- programId: PublicKey;
4879
+ connection: CloakRpc;
4880
+ programId: Address;
4754
4881
  /** nk (32 bytes). The X25519 opening key is `deriveViewingKeyFromNk(nk).privateKey`. */
4755
4882
  viewingKeyNk: Uint8Array;
4756
4883
  /**
@@ -4761,7 +4888,7 @@ interface ScanRecipientDeliveryOptions {
4761
4888
  */
4762
4889
  ownerUtxoPublicKey?: bigint;
4763
4890
  /** Candidate pool mints to try when verifying. Defaults to the native-SOL sentinel. */
4764
- mints?: PublicKey[];
4891
+ mints?: Address[];
4765
4892
  onStatus?: (status: string) => void;
4766
4893
  debug?: boolean;
4767
4894
  }
@@ -4854,19 +4981,19 @@ declare class UtxoWallet {
4854
4981
  /**
4855
4982
  * Add a UTXO to the wallet (discovered from chain or created)
4856
4983
  */
4857
- addUtxo(utxo: Utxo, mint?: PublicKey): void;
4984
+ addUtxo(utxo: Utxo, mint?: Address): void;
4858
4985
  /**
4859
4986
  * Mark a UTXO as spent
4860
4987
  */
4861
- markSpent(utxo: Utxo, mint?: PublicKey): void;
4988
+ markSpent(utxo: Utxo, mint?: Address): void;
4862
4989
  /**
4863
4990
  * Get total balance (unspent only)
4864
4991
  */
4865
- getBalance(mint?: PublicKey): bigint;
4992
+ getBalance(mint?: Address): bigint;
4866
4993
  /**
4867
4994
  * Get all unspent UTXOs
4868
4995
  */
4869
- getUnspentUtxos(mint?: PublicKey): WalletUtxo[];
4996
+ getUnspentUtxos(mint?: Address): WalletUtxo[];
4870
4997
  /**
4871
4998
  * Automatically select UTXOs for a transaction
4872
4999
  *
@@ -4877,7 +5004,7 @@ declare class UtxoWallet {
4877
5004
  *
4878
5005
  * Returns selected inputs and change amount
4879
5006
  */
4880
- selectInputs(amount: bigint, mint?: PublicKey, strategy?: "exact" | "largest" | "smallest"): {
5007
+ selectInputs(amount: bigint, mint?: Address, strategy?: "exact" | "largest" | "smallest"): {
4881
5008
  inputs: Utxo[];
4882
5009
  change: bigint;
4883
5010
  total: bigint;
@@ -4887,7 +5014,7 @@ declare class UtxoWallet {
4887
5014
  *
4888
5015
  * Just like ZCash: specify amount and recipient, wallet handles the rest
4889
5016
  */
4890
- prepareSend(amount: bigint, recipient: PublicKey, mint?: PublicKey, options?: {
5017
+ prepareSend(amount: bigint, recipient: Address, mint?: Address, options?: {
4891
5018
  strategy?: "exact" | "largest" | "smallest";
4892
5019
  }): Promise<{
4893
5020
  inputs: Utxo[];
@@ -4913,7 +5040,7 @@ declare class UtxoWallet {
4913
5040
  /**
4914
5041
  * Get wallet statistics
4915
5042
  */
4916
- getStats(mint?: PublicKey): {
5043
+ getStats(mint?: Address): {
4917
5044
  totalUtxos: number;
4918
5045
  unspentUtxos: number;
4919
5046
  spentUtxos: number;
@@ -4936,7 +5063,7 @@ declare class SimpleWallet {
4936
5063
  * Send amount to recipient
4937
5064
  * Returns transaction parameters ready for transact()
4938
5065
  */
4939
- send(amount: bigint, recipient: PublicKey): Promise<{
5066
+ send(amount: bigint, recipient: Address): Promise<{
4940
5067
  inputs: Utxo[];
4941
5068
  outputs: Utxo[];
4942
5069
  change: bigint;
@@ -4948,6 +5075,64 @@ declare class SimpleWallet {
4948
5075
  sync(): Promise<void>;
4949
5076
  }
4950
5077
 
5078
+ /**
5079
+ * Program-derived addresses. Kit derives them asynchronously (SHA-256 through WebCrypto), so every
5080
+ * PDA helper in the SDK is `async`; the `bump` is returned alongside as before.
5081
+ */
5082
+
5083
+ type Seed = Uint8Array | string;
5084
+ declare function findProgramAddress(seeds: readonly Seed[], programAddress: Address): Promise<[Address, number]>;
5085
+
5086
+ /**
5087
+ * Bridges for callers still holding `@solana/web3.js` objects. Nothing here imports web3.js
5088
+ * statically: an address is read through `toBase58()`, a key pair through `secretKey`, and only a
5089
+ * wallet adapter needs the real `VersionedTransaction` class, loaded on demand so the SDK itself
5090
+ * has no runtime dependency on web3.js.
5091
+ */
5092
+
5093
+ /** A legacy `PublicKey`, or anything else that prints as base58. */
5094
+ declare function addressFromPublicKey(publicKey: {
5095
+ toBase58(): string;
5096
+ }): Address;
5097
+ /** A signer from a legacy `Keypair` (its 64-byte `secretKey`). */
5098
+ declare function signerFromKeypair(keypair: {
5099
+ secretKey: Uint8Array;
5100
+ }): Promise<KeyPairSigner>;
5101
+
5102
+ /** The subset of a wallet-adapter that the SDK can drive. */
5103
+ interface LegacyWalletAdapter {
5104
+ publicKey: {
5105
+ toBase58(): string;
5106
+ } | null;
5107
+ /**
5108
+ * The adapter's own generic `signTransaction<T extends Transaction | VersionedTransaction>` is
5109
+ * not assignable to a `(transaction: unknown) => Promise<unknown>` property, so this accepts the
5110
+ * wallet's method as declared; it always receives a web3.js `VersionedTransaction` here.
5111
+ */
5112
+ signTransaction?: (transaction: any) => Promise<any>;
5113
+ signMessage?: (message: Uint8Array) => Promise<Uint8Array>;
5114
+ }
5115
+ type WalletSigner = TransactionModifyingSigner & Partial<MessagePartialSigner>;
5116
+ /**
5117
+ * Wraps a legacy wallet adapter as a kit signer. Transactions cross the boundary as bytes: the
5118
+ * wallet receives a `VersionedTransaction` deserialized from the wire encoding and its signed
5119
+ * result is decoded back. `@solana/web3.js` must be installed by the caller for that step.
5120
+ */
5121
+ /**
5122
+ * The one web3.js class the bridge needs. A bundled app passes it in (`{ VersionedTransaction }`
5123
+ * from its own `@solana/web3.js`); without it the bridge loads the module on demand, which works
5124
+ * in Node but not through a bundler that cannot see a variable import specifier.
5125
+ */
5126
+ interface WalletAdapterBridgeOptions {
5127
+ web3?: Web3Module;
5128
+ }
5129
+ declare function signerFromWalletAdapter(adapter: LegacyWalletAdapter, options?: WalletAdapterBridgeOptions): WalletSigner;
5130
+ type Web3Module = {
5131
+ VersionedTransaction: {
5132
+ deserialize(bytes: Uint8Array): unknown;
5133
+ };
5134
+ };
5135
+
4951
5136
  /**
4952
5137
  * What a quote option attests, which is NOT the same question as whether the rail worked.
4953
5138
  *
@@ -5078,10 +5263,10 @@ declare function cloakBridgeRail(relayUrl: string): BridgeRail;
5078
5263
  /** What `prepare`'s response is checked against before R ever signs it. */
5079
5264
  interface PaymasterTopUpExpectation {
5080
5265
  /** R — the only account this transaction may fund or spend from. */
5081
- recipient: PublicKey;
5266
+ recipient: Address;
5082
5267
  /** The lamports we asked for. `ix0.lamports` may come in at or under this, never over. */
5083
5268
  maxGrantLamports: bigint;
5084
- feeMint: PublicKey;
5269
+ feeMint: Address;
5085
5270
  /** The fee Kora actually quoted at `prepare` time. `ix1.amount`, if `ix1` exists, must equal this
5086
5271
  * exactly — not "at most", because the fee is a quote the service already committed to, not a
5087
5272
  * ceiling. */
@@ -5089,7 +5274,7 @@ interface PaymasterTopUpExpectation {
5089
5274
  /** The paymaster's own token account owner, from `prepare`'s `payment_address`. `ix1`'s
5090
5275
  * destination must be exactly THIS address's ATA for `feeMint` — nothing else, and never an ATA
5091
5276
  * derived from `recipient` or from an address the caller does not already trust. */
5092
- paymentAddress: PublicKey;
5277
+ paymentAddress: Address;
5093
5278
  }
5094
5279
  /**
5095
5280
  * The one check standing between `prepare`'s response and R's signature.
@@ -5105,8 +5290,11 @@ interface PaymasterTopUpExpectation {
5105
5290
  * that does not match the quote — is refused. This function throws rather than returning a verdict:
5106
5291
  * there is no partial-trust path here, and a caller that wants to keep going after a refusal is a
5107
5292
  * caller papering over a corrupted or hostile response.
5293
+ *
5294
+ * Async (unlike the web3.js original): the paymaster's own fee-mint ATA (`expectedDestination`
5295
+ * below) is derived through kit's PDA path, which goes through WebCrypto and has no sync form.
5108
5296
  */
5109
- declare function validatePaymasterTopUpTransaction(tx: Transaction, expect: PaymasterTopUpExpectation): void;
5297
+ declare function validatePaymasterTopUpTransaction(tx: Transaction, expect: PaymasterTopUpExpectation): Promise<void>;
5110
5298
  interface PaymasterTopUpResult {
5111
5299
  /** Fully signed by both R and the paymaster. The caller submits it — Kora's own
5112
5300
  * `signAndSendTransaction` is disabled service-side, and the broadcast should not carry the
@@ -5124,7 +5312,7 @@ interface PaymasterTopUpResult {
5124
5312
  * here in this file's flow, and its secret never leaves this function — nothing above needs it, and
5125
5313
  * nothing here sends it anywhere.
5126
5314
  */
5127
- declare function fundReceiverViaPaymaster(relayUrl: string, receiver: Keypair, grantLamports: bigint): Promise<PaymasterTopUpResult>;
5315
+ declare function fundReceiverViaPaymaster(relayUrl: string, receiver: KeyPairSigner, grantLamports: bigint): Promise<PaymasterTopUpResult>;
5128
5316
 
5129
5317
  /**
5130
5318
  * Deriving a bridge receiving address.
@@ -5151,19 +5339,13 @@ declare const BRIDGE_ESCROW_LABEL = "cloak_bridge_escrow";
5151
5339
  * being documented and it being enforced.
5152
5340
  */
5153
5341
  declare const MAX_RECEIVER_INDEX = 10000;
5154
- declare function deriveBridgeReceiver(nk: Uint8Array | Buffer, index: number): Keypair;
5155
-
5156
5342
  /**
5157
- * Finding a user's bridge deposits from their key material alone.
5158
- *
5159
- * THIS IS THE FUNCTION THAT MAKES THE BRIDGE AN SDK CAPABILITY RATHER THAN A WEB FEATURE.
5160
- *
5161
- * Derive receivers for index 0…N and read each on chain. No stored state, no link to carry, no
5162
- * localStorage. It works on a device that has never seen the app, in a CLI, on mobile, after a
5163
- * browser wipe. An earlier design proposed a shareable URL to carry the deposit index to a second
5164
- * device; the index does not need carrying, it needs scanning, and the link it replaced was a
5165
- * packaged correlation between an origin payment and a Solana address about to enter the pool.
5343
+ * Async because kit derives a signer's public key through WebCrypto's non-extractable ed25519 key
5344
+ * import (`signerFromSecretKey`, `solana/signer.ts`) — there is no synchronous path to a kit
5345
+ * `KeyPairSigner`. `Keypair.fromSeed(seed)` and `signerFromSecretKey(seed)` (32-byte seed form)
5346
+ * derive the identical public key from identical seed bytes; only the sync/async boundary moved.
5166
5347
  */
5348
+ declare function deriveBridgeReceiver(nk: Uint8Array | Buffer, index: number): Promise<KeyPairSigner>;
5167
5349
 
5168
5350
  type BridgeDepositState =
5169
5351
  /** Nothing ever happened at this index. */
@@ -5187,13 +5369,13 @@ type BridgeDepositState =
5187
5369
  | "unknown";
5188
5370
  interface BridgeDeposit {
5189
5371
  index: number;
5190
- receiver: PublicKey;
5191
- tokenAccount: PublicKey;
5372
+ receiver: Address;
5373
+ tokenAccount: Address;
5192
5374
  state: BridgeDepositState;
5193
5375
  /** Placeholder 0n when state is "unknown" — the read that would have set this failed. */
5194
5376
  tokenBalance: bigint;
5195
- /** Placeholder 0 when state is "unknown" — the read that would have set this failed. */
5196
- lamports: number;
5377
+ /** Placeholder 0n when state is "unknown" — the read that would have set this failed. */
5378
+ lamports: bigint;
5197
5379
  /** Signature of the shield-pool transaction, when one was found. Most recent, if more than one — see indexReused. */
5198
5380
  shieldSignature?: string;
5199
5381
  /**
@@ -5229,8 +5411,8 @@ interface DiscoverOptions {
5229
5411
  * letting it break a real run of unused indices early would reintroduce the same false-absence
5230
5412
  * failure this file exists to prevent. */
5231
5413
  stopAfterUnused?: number;
5232
- programId: PublicKey;
5233
- mint: PublicKey;
5414
+ programId: Address;
5415
+ mint: Address;
5234
5416
  }
5235
5417
  /**
5236
5418
  * A terminal state needs TWO conjuncts, never one.
@@ -5241,24 +5423,7 @@ interface DiscoverOptions {
5241
5423
  * Completion therefore requires the shield-pool transaction to be present in the receiver's own
5242
5424
  * history as well.
5243
5425
  */
5244
- declare function listBridgeDeposits(conn: Connection, nk: Uint8Array | Buffer, opts: DiscoverOptions): Promise<BridgeDeposit[]>;
5245
-
5246
- /**
5247
- * The client half of a bridge deposit, from "tokens have arrived at R" onwards.
5248
- *
5249
- * This module is deliberately RAIL-AGNOSTIC. It is imported unchanged by:
5250
- * - phase1-deposit.ts, where a seeded account plays the rail with a direct SPL transfer
5251
- * - phase2-e2e.ts, where the rail stand-in delivers over HTTP
5252
- * - phase3-e2e.ts, where a real Polygon fork drives the whole thing
5253
- *
5254
- * That import graph IS the proof of 11-E2E-PLAN.md Phase 2's pass criterion — "the client code
5255
- * from Phase 1 runs unchanged against the stand-in" — enforced structurally rather than by
5256
- * eyeballing two copies.
5257
- *
5258
- * It was NOT true when first written: phase1-deposit.ts kept its own inline copy, and so never
5259
- * received the CLEANUP_FEE_BUDGET fix that landed here and in funder.ts. A reviewer caught both
5260
- * the stale copy and the false claim. Keep every phase importing this file; do not fork it.
5261
- */
5426
+ declare function listBridgeDeposits(rpc: CloakRpc, nk: Uint8Array | Buffer, opts: DiscoverOptions): Promise<BridgeDeposit[]>;
5262
5427
 
5263
5428
  interface DepositOutcome {
5264
5429
  signature: string;
@@ -5284,7 +5449,7 @@ interface DepositOutcome {
5284
5449
  /** Thrown by `depositFromDerivedKey` in place of a bare `Error` whenever the funding seam ran
5285
5450
  * before the failure, so a caller can see exactly what already landed on chain despite the
5286
5451
  * overall deposit failing. `fundedAccounts` / `measuredSize` are `undefined` only if the seam
5287
- * never ran at all (failure before signTransaction was called). */
5452
+ * never ran at all (failure before signing was attempted). */
5288
5453
  declare class DepositError extends Error {
5289
5454
  readonly fundedAccounts: DepositOutcome["fundedAccounts"];
5290
5455
  readonly measuredTxSize: number;
@@ -5293,16 +5458,12 @@ declare class DepositError extends Error {
5293
5458
  /**
5294
5459
  * Fund R minimally, then deposit with R as the only signer.
5295
5460
  *
5296
- * The funding seam is the SDK's `signTransaction`: by the time it is called the proof and the
5297
- * relay's risk quote both exist, so the three program accounts are READ OFF the built
5298
- * transaction rather than re-derived, and cannot drift from what the program will touch.
5299
- *
5300
5461
  * `grantOverride` replaces the computed grant (rent floor + deposit fee + cleanup fee) with an
5301
5462
  * arbitrary lamport amount. Only phase4-adversarial.ts case (a) passes it, to reproduce the
5302
5463
  * "funded R with just its fee, not its floor" mistake deliberately; every other caller omits it
5303
5464
  * and gets the same grant this function has always sent.
5304
5465
  */
5305
- declare function depositFromDerivedKey(conn: Connection, R: Keypair, funder: Keypair, amount: bigint, log: ((s: string) => void) | undefined, grantOverride: number | undefined,
5466
+ declare function depositFromDerivedKey(rpc: CloakRpc, R: KeyPairSigner, funder: KeyPairSigner, amount: bigint, log: ((s: string) => void) | undefined, grantOverride: number | undefined,
5306
5467
  /**
5307
5468
  * relayUrl, programId and mint are all REQUIRED — no default, for any of the three, on any
5308
5469
  * environment. They used to fall back to the module-level RELAY/PROGRAM/MINT constants above,
@@ -5312,43 +5473,15 @@ declare function depositFromDerivedKey(conn: Connection, R: Keypair, funder: Key
5312
5473
  */
5313
5474
  opts: {
5314
5475
  relayUrl: string;
5315
- programId: PublicKey;
5316
- mint: PublicKey;
5476
+ programId: Address;
5477
+ mint: Address;
5317
5478
  noteSpendKey: Uint8Array;
5318
5479
  }): Promise<DepositOutcome>;
5319
5480
 
5320
- /**
5321
- * Recover the receiving address's token-account rent, even when someone has dusted it.
5322
- *
5323
- * THE PROBLEM (found by testing, docs/11-E2E-PLAN.md Phase 4): the rail creates R's token account
5324
- * and pays its 2,039,280 rent. After the deposit that account is empty and closing it returns the
5325
- * rent TO THE USER. But SPL Token refuses to close a non-empty account, and dust below the
5326
- * program's 1,000,000-base-unit deposit minimum cannot be swept by re-depositing it — the program
5327
- * correctly rejects it with DepositTooSmall. So one base unit from anyone permanently strands
5328
- * about forty cents of somebody else's money, for free.
5329
- *
5330
- * THE FIX, in two parts. Dust that arrives BEFORE the deposit is not a problem at all: the deposit
5331
- * shields R's whole balance, so it goes into the pool with everything else. The griefing only bites
5332
- * when dust lands AFTER the deposit, and then the honest answer is to leave it.
5333
- *
5334
- * WHY LEAVE IT — this reverses an earlier decision, deliberately. Sweeping the dust to the user's
5335
- * own wallet publishes `R -> user` on a public ledger, and R has just deposited into the shielded
5336
- * pool. Anyone can join those two facts and learn that this user made that deposit. That is the
5337
- * precise inference the pool exists to prevent, and it is the same leak that funding R from the
5338
- * user's wallet used to cause at the other end of the flow — moved to the end, not removed. It is
5339
- * not worth about twenty-two cents of rent. Sweeping to Cloak instead is not an option either:
5340
- * capturing user funds off-chain is an off-chain fee, which the team rule forbids.
5341
- *
5342
- * So the default is privacy-first: close when empty, and when dusted, leave the account open and
5343
- * say so. `dustDestination` lets a caller sweep anyway, with the linkage stated in its doc comment.
5344
- * Burning stays out: dust can be up to 999,999 base units, and destroying a dollar to recover
5345
- * twenty-two cents is a worse outcome than the griefing it answers.
5346
- */
5347
-
5348
5481
  interface CleanupResult {
5349
5482
  closed: boolean;
5350
5483
  dustSwept: bigint;
5351
- rentReturned: number;
5484
+ rentReturned: bigint;
5352
5485
  destination: string | null;
5353
5486
  signature: string | null;
5354
5487
  note: string;
@@ -5365,26 +5498,7 @@ interface CleanupResult {
5365
5498
  * dust sitting in it both belong to whatever mint the rail actually delivered, not to this
5366
5499
  * default.
5367
5500
  */
5368
- declare function cleanupReceivingAddress(conn: Connection, R: Keypair, dustDestination?: PublicKey, mint?: PublicKey): Promise<CleanupResult>;
5369
-
5370
- /**
5371
- * Local deposit funder for the bridge testbed.
5372
- *
5373
- * The bridge pays a derived address R that arrives with zero SOL, and the deposit takes its
5374
- * account rent from R (`transact_spl/mod.rs:92` passes `payer_info` into `create_nullifier_pdas`).
5375
- * But `create_pda_account_safe` (`utils/pda.rs:30-61`) ADOPTS an already-funded, System-owned,
5376
- * zero-data account and transfers only the shortfall — so the rent can be paid straight to the
5377
- * three PDAs in an earlier transaction, and R never touches it.
5378
- *
5379
- * That split is the whole point. Lamports parked at the nullifier and risk-nonce PDAs are
5380
- * unrecoverable by ANYONE (no instruction in the program closes them), so flooding this funder
5381
- * burns Cloak's SOL and earns an attacker nothing. Sending the same total to R instead would put
5382
- * all of it in an account the requester can sweep in one instruction.
5383
- *
5384
- * WHAT SURVIVED THE PORT: the rent constants, the funding-target derivation, and the live rent
5385
- * read. Everything that SUBMITTED a transaction stayed behind in the prototype — see the note at
5386
- * the bottom of this file. The production funder is the paymaster, and it runs on a server.
5387
- */
5501
+ declare function cleanupReceivingAddress(rpc: CloakRpc, R: KeyPairSigner, dustDestination?: Address, mint?: Address): Promise<CleanupResult>;
5388
5502
 
5389
5503
  /** Rent for a 0-byte System account. `utils/pda.rs:99` -> `minimum_balance(0)`. */
5390
5504
  declare const MAINNET_RENT_0 = 890880;
@@ -5410,36 +5524,39 @@ declare const FEE_BUDGET = 130000;
5410
5524
  */
5411
5525
  declare const CLEANUP_FEE_BUDGET = 5000;
5412
5526
  interface DepositRef {
5413
- programId: PublicKey;
5414
- mint: PublicKey;
5527
+ programId: Address;
5528
+ mint: Address;
5415
5529
  /** The two input nullifiers from the proof's public inputs. */
5416
5530
  nullifiers: [Uint8Array, Uint8Array];
5417
5531
  /** bind0 from the relay's signed risk quote; the risk-nonce PDA is derived from it. */
5418
5532
  bind0: Uint8Array;
5419
5533
  /** R — the derived receiving address that will sign the deposit. */
5420
- depositor: PublicKey;
5421
- }
5422
- /** Mirrors relay `derive_addresses` (supplemental_alt.rs) and the program's own derivations. */
5423
- declare function deriveFundingTargets(d: DepositRef): {
5424
- pool: PublicKey;
5425
- nullifier0: PublicKey;
5426
- nullifier1: PublicKey;
5427
- riskNonce: PublicKey;
5428
- depositorAta: PublicKey;
5429
- };
5534
+ depositor: Address;
5535
+ }
5536
+ /**
5537
+ * Mirrors relay `derive_addresses` (supplemental_alt.rs) and the program's own derivations. Async
5538
+ * (kit derives PDAs through WebCrypto's SHA-256), unlike the previous `findProgramAddressSync`.
5539
+ */
5540
+ declare function deriveFundingTargets(d: DepositRef): Promise<{
5541
+ pool: Address;
5542
+ nullifier0: _solana_nominal_types.NominalType<"brand", "Address"> & _solana_nominal_types.NominalType<"stringEncoding", "base58"> & string;
5543
+ nullifier1: _solana_nominal_types.NominalType<"brand", "Address"> & _solana_nominal_types.NominalType<"stringEncoding", "base58"> & string;
5544
+ riskNonce: _solana_nominal_types.NominalType<"brand", "Address"> & _solana_nominal_types.NominalType<"stringEncoding", "base58"> & string;
5545
+ depositorAta: Address<string>;
5546
+ }>;
5430
5547
  interface RentRates {
5431
- zero: number;
5432
- one: number;
5548
+ zero: bigint;
5549
+ one: bigint;
5433
5550
  }
5434
5551
  /** Read rent live. Never hard-code it: a local validator's rent sysvar is not authoritative. */
5435
- declare function readRent(conn: Connection): Promise<RentRates>;
5552
+ declare function readRent(rpc: CloakRpc): Promise<RentRates>;
5436
5553
  interface FundingPlan {
5437
5554
  transfers: {
5438
- to: PublicKey;
5439
- lamports: number;
5555
+ to: Address;
5556
+ lamports: bigint;
5440
5557
  why: string;
5441
5558
  }[];
5442
- total: number;
5559
+ total: bigint;
5443
5560
  alreadyFunded: string[];
5444
5561
  rent: RentRates;
5445
5562
  warnings: string[];
@@ -5631,8 +5748,8 @@ declare function withShieldRetries<T>(attempt: (attemptNo: number) => Promise<T>
5631
5748
  * @packageDocumentation
5632
5749
  */
5633
5750
 
5634
- declare const VERSION = "0.2.4";
5751
+ declare const VERSION = "0.2.5";
5635
5752
  /** True when scanner supports TransactSwap (tag 1). Check this to verify the correct SDK bundle is loaded. */
5636
5753
  declare const SCANNER_SUPPORTS_TRANSACT_SWAP = true;
5637
5754
 
5638
- export { BRIDGE_ESCROW_LABEL, 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 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, DepositError, type DepositInstructionParams, type DepositNoteSecrets, type DepositOptions, type DepositOutcome, type DepositRef, type DepositResult, type DepositStatus, type DiscoverOptions, type DiscoverSwapRefundsOptions, type DiscoveredSwapRefund, DoNotRetry, ECONOMIC_MINIMUM, EXPECTED_CIRCUIT_HASHES, type EncryptedMetadataBundle, type EncryptedNote$1 as EncryptedNote, type ErrorCategory, type ExpandedSpendKey, type ExternalFeePayerAdapter, FEE_BUDGET, FIXED_FEE_LAMPORTS, type FundingPlan, type Groth16Proof, InsecureRandomnessError, LAMPORTS_PER_SOL, LocalStorageAdapter, type LogLevel, type Logger, 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, NATIVE_SOL_MINT, type Network, type NoteData, ONECLICK_PUBKEY_B58, type OnchainMerkleProof, type ParsedDeliveryCarrier, type PaymasterTopUpExpectation, type PaymasterTopUpResult, type PendingDeposit, type PendingWithdrawal, type PostFailureVerdict, RECIPIENT_DELIVERY_CIPHERTEXT_LEN, RECIPIENT_DELIVERY_EPHEMERAL_PK_LEN, RECIPIENT_DELIVERY_NONCE_LEN, RECIPIENT_DELIVERY_NOTE_BYTES, RECIPIENT_DELIVERY_PLAINTEXT_LEN, RECIPIENT_DELIVERY_TAG_LEN, RELAY_BATCH_AUTH_MAX_ITEMS, RELAY_ORIGIN_ALLOWLIST, REQUEST_AUTH_BATCH_DOMAIN, REQUEST_AUTH_BATCH_MAX_AGE_SECONDS, REQUEST_AUTH_MAX_AGE_SECONDS, REQUEST_AUTH_MAX_FUTURE_SKEW_SECONDS, type RecipientDeliveryNote, type RecoveredChangeNote, type RecoveredChangeNoteRecord, type RecoveredDepositNote, type RecoveredDepositNoteRecord, type RecoveredSwapRefund, type RelayAuthMode, type RelayAuthPreimage, type RelayAuthSigner, RelayBatchAuthCoordinator, type RelayBatchAuthCoordinatorOptions, type RelayBatchAuthEnvelope, type RelayBatchAuthFields, type RelayBatchAuthItemHandle, RelayInternalError, type RelayMessageSigner, RelayService, type RelaySubmissionResult, type RelayTransactionSigner, 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 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, 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 WalletAdapter, type WalletUtxo, type WithdrawOptions, type WithdrawSubmissionResult, assertDirectSubmissionLanded, assertInputMints, assertTransactionCircuitIntegrity, assessBridgeQuote, bigintToBytes32$1 as bigintToBytes32, bigintToHex, buildAuthTransactionMessage, buildMerkleTree, buildMerkleTreeFromChain, buildMerkleTreeFromRelay, buildRecipientDeliveryNotes, buildRelayAuthPreimage, buildRelayBatchAuthMessage, buildTransactRequestBody, bytesToHex, calculateFee, calculateFeeBigint, calculateRelayFee, canRebuildMerkleTreeFromChain, canonicalJson, canonicalPayloadString, chainNoteFromBase64, chainNoteToBase64, classifyPostFailure, classifyRelayError, cleanupReceivingAddress, cleanupStalePendingOperations, clearPendingDeposits, clearPendingWithdrawals, cloakBridgeRail, computeChainNoteHash, computeExtDataHash, computeMerkleRoot, computeProofForLatestDeposit, computeProofFromChain, computeSignature, computeSwapRefundCommitment, computeCommitment as computeUtxoCommitment, computeNullifier as computeUtxoNullifier, confirmTransactSettlement, copyNoteToClipboard, createCloakError, createDepositInstruction, createLogger, createRecoverableChangeUtxo, createRecoverableDepositUtxo, createRelayBatchAuthCoordinator, createUtxo, createZeroUtxo, decryptCompactChainNote, decryptComplianceMetadataWithMasterKey, decryptTransactionMetadata, depositFromDerivedKey, deriveBridgeReceiver, deriveChangeNoteBlinding, deriveDepositNoteSecrets, deriveDiversifiedViewingKey, deriveDiversifier, deriveFundingTargets, 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, 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, isPlausibleSignature, isReactNative, isRootNotFoundError, isSubmissionOutcomeUnknownResponse, isTerminalFailure, isValidHex, isValidRpcUrl, isValidSolanaAddress, isWithdrawAmountSufficient, isWithdrawable, keypairToAdapter, listBridgeDeposits, loadPendingDeposits, loadPendingWithdrawals, loadVerifiedCircuitArtifacts, matchChangeNote, matchDepositNote, matchSwapRefundLeaf, mayRetry, openRecipientDeliveryNote, parseAmount, parseDeliveryCarrierMemo, parseError, parseNote, parseRelayErrorResponse, parseRelayErrorSignature, parseTransactionError, partialWithdraw, poseidonHash, preflightCheck, preflightNullifiers, prepareEncryptedOutput, prepareEncryptedOutputForRecipient, proofToBytes, pubkeyToFieldElement, pubkeyToLimbs, randomBytes, randomChangeNoteSalt, randomDepositNoteSalt, randomFieldElement, readMerkleTreeState, readRent, recipientDeliveryNoteToBase64, registerViewingKey, relayRequestDigestHex, removePendingDeposit, removePendingWithdrawal, renderAssessment, resolveCircuitsBase, retryDelayMs, savePendingDeposit, savePendingWithdrawal, scanNotesForWallet, scanRecipientDeliveryNotes, scanTransactions, sdkLogger, selectUtxos, sendTransaction, serializeAuthTransactionMessage, serializeNote, serializeUtxo, setCircuitsPath, setDebugMode, signRelayAuthPayload, signTransaction, splitTo2Limbs, submitTransactToRelay, sumUtxoAmounts, swapUtxo, swapWithChange, toComplianceReport, transact, transactBatch, 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 };
5755
+ export { BRIDGE_ESCROW_LABEL, 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, DEFAULT_CIRCUITS_URL, DEFAULT_TRANSACTION_CIRCUITS_URL, DELIVERY_MEMO_TAG, DELIVERY_REGISTRY_SEED, type DeliveredNote, DepositError, type DepositInstructionParams, type DepositNoteSecrets, type DepositOptions, type DepositOutcome, type DepositRef, type DepositResult, type DepositStatus, type DiscoverOptions, type DiscoverSwapRefundsOptions, type DiscoveredSwapRefund, DoNotRetry, ECONOMIC_MINIMUM, EXPECTED_CIRCUIT_HASHES, type EncryptedMetadataBundle, type EncryptedNote$1 as EncryptedNote, type ErrorCategory, type ExpandedSpendKey, type ExternalFeePayerAdapter, FEE_BUDGET, FIXED_FEE_LAMPORTS, type FundingPlan, type Groth16Proof, InsecureRandomnessError, LAMPORTS_PER_SOL, type LegacyWalletAdapter, type WalletSigner as LegacyWalletSigner, LocalStorageAdapter, type LogLevel, type Logger, type LookupTable, MAINNET_RENT_0, MAINNET_RENT_1, MAX_RECEIVER_INDEX, MERKLE_TREE_HEIGHT, MIN_DEPOSIT_LAMPORTS, MIN_DEPOSIT_SPL_BASE_UNITS, type MasterKey, type MatchChangeNoteParams, type MatchDepositNoteParams, type MatchSwapRefundLeafParams, type MaxLengthArray, MemoryStorageAdapter, type MerkleProof, type MerkleRootResponse, MerkleTree, type MessageSigner, NATIVE_SOL_MINT, type Network, type NoteData, ONECLICK_PUBKEY_B58, type OnchainMerkleProof, type ParsedDeliveryCarrier, type PaymasterTopUpExpectation, type PaymasterTopUpResult, type PendingDeposit, type PendingWithdrawal, type PostFailureVerdict, RECIPIENT_DELIVERY_CIPHERTEXT_LEN, RECIPIENT_DELIVERY_EPHEMERAL_PK_LEN, RECIPIENT_DELIVERY_NONCE_LEN, RECIPIENT_DELIVERY_NOTE_BYTES, RECIPIENT_DELIVERY_PLAINTEXT_LEN, RECIPIENT_DELIVERY_TAG_LEN, RELAY_BATCH_AUTH_MAX_ITEMS, RELAY_ORIGIN_ALLOWLIST, REQUEST_AUTH_BATCH_DOMAIN, REQUEST_AUTH_BATCH_MAX_AGE_SECONDS, REQUEST_AUTH_MAX_AGE_SECONDS, REQUEST_AUTH_MAX_FUTURE_SKEW_SECONDS, type RecipientDeliveryNote, type RecoveredChangeNote, type RecoveredChangeNoteRecord, type RecoveredDepositNote, type RecoveredDepositNoteRecord, type RecoveredSwapRefund, type RelayAuthMode, type RelayAuthPreimage, type RelayAuthSigner, RelayBatchAuthCoordinator, type RelayBatchAuthCoordinatorOptions, type RelayBatchAuthEnvelope, type RelayBatchAuthFields, type RelayBatchAuthItemHandle, RelayInternalError, RelayService, type RelaySubmissionResult, type RentRates, type RetryHooks, type RiskQuoteInstructionResponse, RootNotFoundError, SCANNER_SUPPORTS_TRANSACT_SWAP, SIGN_IN_MESSAGE, SanctionsQuoteError, type ScanOptions, type ScanRecipientDeliveryOptions, type ScanResult, type ScanSummary, type ScannedTransaction, type SettlementConnection, type SettlementContext, type SettlementStatus, type SettlementVerdict, SettlementVerificationError, ShieldPoolErrors, type ShieldPoolPDAs, SimpleWallet, type SpendKey, type StorageAdapter, type SubmitTransactToRelayArgs, type SwapOptions, type SwapParams, type SwapRefundAuthorization, type SwapResult, TERMINAL_FAILURE, TRANSACTION_CIRCUITS_VERSION, TRANSACT_AUTH_FIELDS, TRANSACT_SWAP_AUTH_FIELDS, type TransactBatchItem, type TransactBatchItemOutcome, type TransactBatchOptions, type TransactBatchResult, type TransactOptions, type TransactParams, type TransactRequestBodyParams, type TransactResult, TransactionConfirmationError, type TransactionMetadata, type Transfer, type TransferOptions, type TransferResult, type TxStatus, type UserFriendlyError, type Utxo, UtxoAlreadySpentError, type EncryptedNote as UtxoEncryptedNote, type UtxoKeypair, type UtxoSwapParams, type UtxoSwapResult, UtxoWallet, VARIABLE_FEE_DENOMINATOR, VARIABLE_FEE_NUMERATOR, VARIABLE_FEE_RATE, VERSION, type VerifyUtxosResult, type ViewKey, type ViewingKeyPair, WITHDRAW_FEE_BPS, WITHDRAW_FIXED_FEE, type WalletAdapterBridgeOptions, type WalletSigner$1 as WalletSigner, type WalletUtxo, type Web3Module, type WithdrawOptions, type WithdrawSubmissionResult, accountMeta, addressBytes, addressFromBytes, addressFromPublicKey, assertDirectSubmissionLanded, assertInputMints, assertTransactionCircuitIntegrity, assessBridgeQuote, bigintToBytes32$1 as bigintToBytes32, bigintToHex, buildAuthTransactionMessage, buildMerkleTree, buildMerkleTreeFromChain, buildMerkleTreeFromRelay, buildRecipientDeliveryNotes, buildRelayAuthPreimage, buildRelayBatchAuthMessage, buildTransactRequestBody, buildTransactionMessage, bytesToHex, calculateFee, calculateFeeBigint, calculateRelayFee, canRebuildMerkleTreeFromChain, canonicalJson, canonicalPayloadString, chainNoteFromBase64, chainNoteToBase64, classifyPostFailure, classifyRelayError, cleanupReceivingAddress, cleanupStalePendingOperations, clearPendingDeposits, clearPendingWithdrawals, cloakBridgeRail, computeChainNoteHash, computeExtDataHash, computeMerkleRoot, computeProofForLatestDeposit, computeProofFromChain, computeSignature, computeSwapRefundCommitment, computeCommitment as computeUtxoCommitment, computeNullifier as computeUtxoNullifier, confirmSignature, confirmTransactSettlement, copyNoteToClipboard, createCloakError, createCloakRpc, createDepositInstruction, createLogger, createRecoverableChangeUtxo, createRecoverableDepositUtxo, createRelayBatchAuthCoordinator, createUtxo, createZeroUtxo, decryptCompactChainNote, decryptComplianceMetadataWithMasterKey, decryptTransactionMetadata, depositFromDerivedKey, deriveBridgeReceiver, deriveChangeNoteBlinding, deriveDepositNoteSecrets, deriveDiversifiedViewingKey, deriveDiversifier, deriveFundingTargets, 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, fetchAccountBytes, fetchCommitments, fetchLatestBlockhash, fetchLookupTables, fetchRiskQuoteInstruction, fetchRiskQuoteIx, fetchSignaturesForAddress, filterNotesByNetwork, filterWithdrawableNotes, findNoteByCommitment, findProgramAddress, formatAmount, formatComplianceCsv, formatErrorForLogging, formatSol, fullWithdraw, fundReceiverViaPaymaster, generateCloakKeys, generateCommitmentAsync, generateMasterSeed, generateNoteFromWallet, generateUtxoKeypair, generateViewingKeyPair, getAddressExplorerUrl, getChainNoteRegistryPDA, getCircuitsPath, getDeliveryRegistryPDA, getDistributableAmount, getExplorerUrl, getNkFromUtxoPrivateKey, getNullifierPDA, getPendingOperationsSummary, getPoolAuthorityConfigPDA, getPublicKey, getPublicViewKey, getRecipientAmount, getRpcUrlForNetwork, getShieldPoolPDAs, getSwapStatePDA, getViewKey, hasPendingOperations, hexToBigint$1 as hexToBigint, hexToBytes, importKeys, importWalletKeys, isBrowser, isBrowserLike, isDebugEnabled, isMessageSigner, isPlausibleSignature, isReactNative, isRootNotFoundError, isSubmissionOutcomeUnknownResponse, isTerminalFailure, isValidHex, isValidRpcUrl, isValidSolanaAddress, isWithdrawAmountSufficient, isWithdrawable, listBridgeDeposits, loadPendingDeposits, loadPendingWithdrawals, loadVerifiedCircuitArtifacts, matchChangeNote, matchDepositNote, matchSwapRefundLeaf, mayRetry, messageSignerFromCallback, openRecipientDeliveryNote, parseAmount, parseDeliveryCarrierMemo, parseError, parseNote, parseRelayErrorResponse, parseRelayErrorSignature, parseTransactionError, partialWithdraw, partiallySignTransaction, poseidonHash, preflightCheck, preflightNullifiers, prepareEncryptedOutput, prepareEncryptedOutputForRecipient, programInstruction, proofToBytes, pubkeyToFieldElement, pubkeyToLimbs, randomBytes, randomChangeNoteSalt, randomDepositNoteSalt, randomFieldElement, readMerkleTreeState, readRent, recipientDeliveryNoteToBase64, registerViewingKey, relayRequestDigestHex, removePendingDeposit, removePendingWithdrawal, renderAssessment, resolveCircuitsBase, retryDelayMs, savePendingDeposit, savePendingWithdrawal, scanNotesForWallet, scanRecipientDeliveryNotes, scanTransactions, sdkLogger, selectUtxos, sendInstructions, sendRawTransaction, sendTransaction, serializeAuthTransactionMessage, serializeNote, serializeUtxo, setCircuitsPath, setDebugMode, signCompiledTransaction, signMessageBytes, signRelayAuthPayload, signTransaction, signerFromKeypair, signerFromSecretKey, signerFromWalletAdapter, splitTo2Limbs, submitTransactToRelay, sumUtxoAmounts, swapUtxo, swapWithChange, toAddress, toComplianceReport, transact, transactBatch, transactionBase64, transactionBytes, transactionFromBytes, transactionWireSize, transfer, truncate, tryDecryptNote, updateNoteWithDeposit, updatePendingDeposit, updatePendingWithdrawal, bigintToBytes32 as utxoBigintToBytes32, utxoEquals, hexToBigint as utxoHexToBigint, validateDepositParams, validateNote, validateOutputsSum, validatePaymasterTopUpTransaction, validateRoot, validateTransfers, validateWalletConnected, validateWithdrawableNote, verifyAllCircuits, verifyCircuitIntegrity, verifyQuoteSignature, verifyUtxos, waitForRoot, withShieldRetries, withTiming, withdrawFeeFor };