@cloak.dev/sdk 0.2.3-staging.f2d7f2a → 0.2.3-staging.fdea6cd
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.cjs +889 -432
- package/dist/index.d.cts +361 -127
- package/dist/index.d.ts +361 -127
- package/dist/index.js +856 -408
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublicKey, Transaction, AddressLookupTableAccount, Connection, TransactionInstruction,
|
|
1
|
+
import { PublicKey, Transaction, Keypair, AddressLookupTableAccount, Connection, TransactionInstruction, SendOptions, VersionedTransaction } from '@solana/web3.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The deployed Cloak program.
|
|
@@ -781,6 +781,199 @@ declare class LocalStorageAdapter implements StorageAdapter {
|
|
|
781
781
|
deleteKeys(): void;
|
|
782
782
|
}
|
|
783
783
|
|
|
784
|
+
/**
|
|
785
|
+
* How long the relay accepts a signed request after its `auth_issued_at`
|
|
786
|
+
* (`REQUEST_AUTH_MAX_AGE_SECONDS`, `api/request_auth.rs`).
|
|
787
|
+
*
|
|
788
|
+
* A FIRST-USE request past this window is rejected outright. The expiry exception the relay grants
|
|
789
|
+
* applies only to an exact replay of a request whose durable row already exists, which by
|
|
790
|
+
* definition never happens for a request that has not been accepted once.
|
|
791
|
+
*/
|
|
792
|
+
declare const REQUEST_AUTH_MAX_AGE_SECONDS = 300;
|
|
793
|
+
/**
|
|
794
|
+
* How far ahead of the relay's clock a request may be stamped
|
|
795
|
+
* (`REQUEST_AUTH_MAX_FUTURE_SKEW_SECONDS`, `api/request_auth.rs`).
|
|
796
|
+
*
|
|
797
|
+
* `auth_issued_at` comes from `Date.now()`. On a server that is NTP-disciplined; in a browser it
|
|
798
|
+
* is the user's own machine clock, and a laptop more than 30 seconds fast cannot authenticate at
|
|
799
|
+
* all until its clock is corrected.
|
|
800
|
+
*/
|
|
801
|
+
declare const REQUEST_AUTH_MAX_FUTURE_SKEW_SECONDS = 30;
|
|
802
|
+
/**
|
|
803
|
+
* The exact fields each endpoint signs. Both lists mirror the relay's `*_auth_request` builders and
|
|
804
|
+
* must stay in lockstep with them: adding a field on one side alone silently invalidates every
|
|
805
|
+
* signature, and the failure surfaces as a bare 401 with nothing pointing here.
|
|
806
|
+
*/
|
|
807
|
+
declare const TRANSACT_AUTH_FIELDS: readonly ["encrypted_notes", "max_fee", "mint", "proof_bytes", "public_inputs", "recipient", "recipient_delivery_notes", "risk_quote", "sender"];
|
|
808
|
+
declare const TRANSACT_SWAP_AUTH_FIELDS: readonly ["close_timed_out", "dexes", "encrypted_notes", "exclude_dexes", "max_fee", "min_output_amount", "output_mint", "proof_bytes", "public_inputs", "recipient", "recipient_ata", "refund_blinding", "refund_pubkey", "retry_request_id", "risk_quote", "route_retry_attempts", "sender", "slippage_bps", "swap_max_retries"];
|
|
809
|
+
/**
|
|
810
|
+
* Serialize exactly like the relay's `canonical_json`: keys sorted bytewise, no whitespace.
|
|
811
|
+
*
|
|
812
|
+
* SCOPE. This is the SDK's half of a byte-for-byte agreement with one specific Rust function over
|
|
813
|
+
* one specific schema: the values reachable through {@link TRANSACT_AUTH_FIELDS} and
|
|
814
|
+
* {@link TRANSACT_SWAP_AUTH_FIELDS}, which are ASCII keys over strings, small unsigned integers,
|
|
815
|
+
* booleans, nulls, arrays and plain objects. Inside that schema the two implementations agree.
|
|
816
|
+
*
|
|
817
|
+
* Outside it they need not, so anything that could serialize differently on the two sides is
|
|
818
|
+
* REFUSED here rather than signed into a digest that silently fails to match:
|
|
819
|
+
*
|
|
820
|
+
* - Non-integer, non-finite and beyond-safe-integer numbers. `serde_json` renders an f64 as Rust
|
|
821
|
+
* does (`1e21`) where JavaScript renders `1e+21`, and `0.1 + 0.2` has no single spelling. Every
|
|
822
|
+
* number in both field lists is a small unsigned integer (`slippage_bps`, `route_retry_attempts`,
|
|
823
|
+
* `swap_max_retries`); u64 amounts already travel as decimal STRINGS for exactly this reason.
|
|
824
|
+
* - Functions and symbols as object VALUES. `JSON.stringify` drops such a key from the wire body
|
|
825
|
+
* while it stays in the signed view, so the two digests can never agree.
|
|
826
|
+
*
|
|
827
|
+
* `undefined` is NOT refused: it serializes as `null` here, `JSON.stringify` omits the key on the
|
|
828
|
+
* wire, and every optional field on the relay side is `Option<T>` with `#[serde(default)]`, so the
|
|
829
|
+
* relay sees `null` too. That is the same agreement {@link buildAuthRequest} relies on. The one
|
|
830
|
+
* field where it does not hold is `slippage_bps`, which is why that field is checked by name.
|
|
831
|
+
*
|
|
832
|
+
* `bigint` is accepted and rendered as a bare decimal integer, matching serde's u64/i64 output.
|
|
833
|
+
* Note that such a value cannot also go on the wire: `JSON.stringify` throws on a bigint. Use a
|
|
834
|
+
* decimal string in the body, as every SDK-built body does.
|
|
835
|
+
*/
|
|
836
|
+
declare function canonicalJson(value: unknown): string;
|
|
837
|
+
interface RelayAuthFields {
|
|
838
|
+
sender: string;
|
|
839
|
+
auth_issued_at: string;
|
|
840
|
+
auth_nonce: string;
|
|
841
|
+
auth_signature: string;
|
|
842
|
+
/**
|
|
843
|
+
* How `auth_signature` was produced. Absent means an off-chain message, today's wire. Set to
|
|
844
|
+
* `"transaction"` when the wallet signed the no-op transaction envelope instead
|
|
845
|
+
* (`signRelayAuthPayload`). Not part of the signed view, so it never enters the digest.
|
|
846
|
+
*/
|
|
847
|
+
auth_mode?: RelayAuthMode;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Everything an authenticated request needs EXCEPT the signature: the three fields that go on the
|
|
851
|
+
* wire alongside it, plus the exact bytes to sign.
|
|
852
|
+
*
|
|
853
|
+
* This exists because the holder of the pen is not always a `Keypair`. A browser wallet adapter
|
|
854
|
+
* exposes `signMessage(bytes): Promise<Uint8Array>` and no secret key at all, so the scheme has to
|
|
855
|
+
* be reachable in two halves: build the preimage here, sign it wherever the key actually lives,
|
|
856
|
+
* then put `sender` / `auth_issued_at` / `auth_nonce` and the base64 signature on the body.
|
|
857
|
+
*
|
|
858
|
+
* `message` is a plain ed25519 detached-signature preimage — nothing about the scheme changes
|
|
859
|
+
* between a local keypair and a wallet, only who signs it.
|
|
860
|
+
*/
|
|
861
|
+
interface RelayAuthPreimage {
|
|
862
|
+
sender: string;
|
|
863
|
+
auth_issued_at: string;
|
|
864
|
+
auth_nonce: string;
|
|
865
|
+
message: Uint8Array;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Build the signed view and its preimage for one request, WITHOUT signing.
|
|
869
|
+
*
|
|
870
|
+
* `sender` is bound into the signed view and returned for the body — the relay rejects a request
|
|
871
|
+
* whose authenticated sender is not also present inside the signed payload. It must be the end
|
|
872
|
+
* user's own wallet: `sender` is the key screened for sanctions on a shield-to-shield send, so
|
|
873
|
+
* substituting an ephemeral or service key here moves the screening off the actual user.
|
|
874
|
+
*
|
|
875
|
+
* `nonce` and `issued_at` are generated here, once per call. Callers that re-POST a request must
|
|
876
|
+
* reuse the same preimage rather than rebuilding it, or the relay sees a brand-new request.
|
|
877
|
+
*/
|
|
878
|
+
declare function buildRelayAuthPreimage(endpoint: string, programId: PublicKey, body: Record<string, unknown>, sender: PublicKey, nowSeconds?: number, fields?: readonly string[]): RelayAuthPreimage;
|
|
879
|
+
/**
|
|
880
|
+
* An async message signer standing in for a `Keypair`.
|
|
881
|
+
*
|
|
882
|
+
* A browser wallet adapter has no secret key to hand over — it exposes `signMessage`, and what
|
|
883
|
+
* this scheme needs signed is a plain ed25519 detached signature, which is exactly what that
|
|
884
|
+
* produces. Only the holder of the pen changes.
|
|
885
|
+
*
|
|
886
|
+
* COMPLIANCE — `walletPublicKey` becomes the request's authenticated `sender`, and `sender` is the
|
|
887
|
+
* key screened for sanctions on a shield-to-shield send. It MUST be the end user's own wallet.
|
|
888
|
+
* Putting an ephemeral, service-held or otherwise substituted key here moves the screening onto a
|
|
889
|
+
* key that is not the user: a compliance regression, not a shortcut.
|
|
890
|
+
*/
|
|
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
|
+
/**
|
|
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`.
|
|
902
|
+
*/
|
|
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;
|
|
910
|
+
/** How a relay-auth payload was signed. Mirrors `RelayAuthMode` in the relay's `auth_envelope.rs`. */
|
|
911
|
+
type RelayAuthMode = "message" | "transaction";
|
|
912
|
+
/**
|
|
913
|
+
* The transaction a message-less wallet signs to authenticate a relay payload.
|
|
914
|
+
*
|
|
915
|
+
* Legacy message, one instruction: `sender -> sender`, 0 lamports, System program. The 32-byte
|
|
916
|
+
* `recent_blockhash` slot carries `sha256(payload)`, so the signature binds the payload exactly as
|
|
917
|
+
* a message signature would, through a shape every hardware wallet can sign. It cannot land on
|
|
918
|
+
* chain: the network does not know that "blockhash". It names no Cloak program, endpoint or domain,
|
|
919
|
+
* so it leaks nothing if published. Byte-identical to the relay's `build_auth_transaction_message`;
|
|
920
|
+
* the vector is pinned on both sides.
|
|
921
|
+
*/
|
|
922
|
+
declare function buildAuthTransactionMessage(sender: PublicKey, digest: Uint8Array): Transaction;
|
|
923
|
+
/** The exact bytes the wallet signs for `buildAuthTransactionMessage(sender, digest)`. */
|
|
924
|
+
declare function serializeAuthTransactionMessage(sender: PublicKey, digest: Uint8Array): Uint8Array;
|
|
925
|
+
/**
|
|
926
|
+
* Sign a relay-auth payload with whatever the caller holds: a local `Keypair` or a message signer
|
|
927
|
+
* signs the payload bytes; a transaction-only signer signs the no-op transaction carrying the
|
|
928
|
+
* payload's digest. Returns the 64-byte detached signature and the mode the relay must be told.
|
|
929
|
+
*/
|
|
930
|
+
declare function signRelayAuthPayload(signer: RelayAuthSigner | Keypair, payload: Uint8Array): Promise<{
|
|
931
|
+
signature: Uint8Array;
|
|
932
|
+
mode: RelayAuthMode;
|
|
933
|
+
}>;
|
|
934
|
+
/**
|
|
935
|
+
* Turn a relay rejection into something the person in front of the screen can act on.
|
|
936
|
+
*
|
|
937
|
+
* Every string matched here is an `Error::Unauthorized` from `api/request_auth.rs`, and all of them
|
|
938
|
+
* arrive as the same bare 401. Two of them are not the caller's mistake at all: an approval that
|
|
939
|
+
* sat too long, and a machine clock that is simply wrong. Returns `null` for anything that is not
|
|
940
|
+
* an authentication rejection, so callers can append it only when there is something to add.
|
|
941
|
+
*/
|
|
942
|
+
declare function explainRelayAuthRejection(responseText: string): string | null;
|
|
943
|
+
declare const REQUEST_AUTH_BATCH_DOMAIN = "CLOAK_RELAY_BATCH_AUTH_V1";
|
|
944
|
+
/**
|
|
945
|
+
* How long the relay accepts an item that arrives under a batch signature
|
|
946
|
+
* (`REQUEST_AUTH_BATCH_MAX_AGE_SECONDS`, `api/request_auth.rs`).
|
|
947
|
+
*
|
|
948
|
+
* Longer than the single-request window because one approval now stands in front of N
|
|
949
|
+
* submissions, each confirmed on chain in turn. Every digest is a specific proof over specific
|
|
950
|
+
* nullifiers and every item still burns its own nonce, so the extra time widens nothing except how
|
|
951
|
+
* long the SAME already-approved requests stay submittable.
|
|
952
|
+
*/
|
|
953
|
+
declare const REQUEST_AUTH_BATCH_MAX_AGE_SECONDS = 600;
|
|
954
|
+
/**
|
|
955
|
+
* Most items one batch signature may cover (`REQUEST_AUTH_BATCH_MAX_ITEMS`, `api/request_auth.rs`).
|
|
956
|
+
*
|
|
957
|
+
* The practical bound is lower and comes from the chain, not the relay: every spend appends two
|
|
958
|
+
* roots to the on-chain ring of 100, so N items proved against one root push that root out of the
|
|
959
|
+
* ring by themselves before N reaches 50, and sooner with other traffic. Size a batch as
|
|
960
|
+
* `(100 - expected foreign inserts while it submits) / 2`, and chunk above that.
|
|
961
|
+
*/
|
|
962
|
+
declare const RELAY_BATCH_AUTH_MAX_ITEMS = 64;
|
|
963
|
+
/** The batch envelope an item carries next to its per-request auth fields. Not part of the digest. */
|
|
964
|
+
interface RelayBatchAuthEnvelope {
|
|
965
|
+
/** Lowercase hex sha256 of every item's request-auth message, in the order the wallet signed. */
|
|
966
|
+
digests: string[];
|
|
967
|
+
}
|
|
968
|
+
/** Per-item wire fields under a batch signature: the single-request fields plus the envelope. */
|
|
969
|
+
interface RelayBatchAuthFields extends RelayAuthFields {
|
|
970
|
+
auth_batch: RelayBatchAuthEnvelope;
|
|
971
|
+
}
|
|
972
|
+
/** The digest an item contributes to a batch: sha256 of its request-auth message bytes, hex. */
|
|
973
|
+
declare function relayRequestDigestHex(preimage: RelayAuthPreimage): string;
|
|
974
|
+
/** 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;
|
|
976
|
+
|
|
784
977
|
interface ViewingKeyPair {
|
|
785
978
|
privateKey: Uint8Array;
|
|
786
979
|
publicKey: Uint8Array;
|
|
@@ -858,7 +1051,7 @@ declare const SIGN_IN_MESSAGE = "Cloak: Sign in\n\nSign this message to securely
|
|
|
858
1051
|
* Relay stores nk and derives sk_d per note when exporting.
|
|
859
1052
|
* Registration is authenticated via one-time nonce challenge.
|
|
860
1053
|
*/
|
|
861
|
-
declare function registerViewingKey(relayUrl: string, userPubkey: PublicKey, nk: Uint8Array, signMessage: (message: Uint8Array) => Promise<Uint8Array>): Promise<void>;
|
|
1054
|
+
declare function registerViewingKey(relayUrl: string, userPubkey: PublicKey, nk: Uint8Array, signMessage: ((message: Uint8Array) => Promise<Uint8Array>) | RelayAuthSigner): Promise<void>;
|
|
862
1055
|
|
|
863
1056
|
interface EncryptMetadataContext {
|
|
864
1057
|
userPubkey?: PublicKey | string;
|
|
@@ -2081,7 +2274,7 @@ declare class RelayService {
|
|
|
2081
2274
|
* );
|
|
2082
2275
|
* ```
|
|
2083
2276
|
*/
|
|
2084
|
-
registerViewingKey(userPubkey: string, viewingKey: string, signMessage: (message: Uint8Array) => Promise<Uint8Array>): Promise<boolean>;
|
|
2277
|
+
registerViewingKey(userPubkey: string, viewingKey: string, signMessage: ((message: Uint8Array) => Promise<Uint8Array>) | RelayAuthSigner): Promise<boolean>;
|
|
2085
2278
|
/**
|
|
2086
2279
|
* Fetch relay compliance master public key.
|
|
2087
2280
|
* DEPRECATED: This endpoint is no longer used
|
|
@@ -2329,6 +2522,14 @@ interface OnchainMerkleProof {
|
|
|
2329
2522
|
pathElements: string[];
|
|
2330
2523
|
pathIndices: number[];
|
|
2331
2524
|
root: string;
|
|
2525
|
+
/**
|
|
2526
|
+
* Levels whose sibling could NOT be taken from the current frontier; see
|
|
2527
|
+
* {@link nearTipProofUndecidableLevels}. Empty means the path reproduces the root the program
|
|
2528
|
+
* stored when this leaf was appended. Level 0 alone is recoverable by a caller that knows the
|
|
2529
|
+
* left neighbour's commitment (`leftSiblingCommitment` / `siblingCommitment`); any other level
|
|
2530
|
+
* is not, and the caller must rebuild the full tree instead of submitting the path.
|
|
2531
|
+
*/
|
|
2532
|
+
undecidableLevels: number[];
|
|
2332
2533
|
}
|
|
2333
2534
|
interface MerkleTreeState {
|
|
2334
2535
|
nextIndex: number;
|
|
@@ -2344,25 +2545,6 @@ interface MerkleTreeState {
|
|
|
2344
2545
|
declare function readMerkleTreeState(connection: Connection, merkleTreePDA: PublicKey, forceConfirmed?: boolean, relayUrl?: string,
|
|
2345
2546
|
/** When true, skip relay root and use chain directly (avoids stale relay root causing ProofInvalid) */
|
|
2346
2547
|
skipRelayRoot?: boolean, mint?: PublicKey): Promise<MerkleTreeState>;
|
|
2347
|
-
/**
|
|
2348
|
-
* Compute Merkle proof for a leaf at a given index using on-chain state
|
|
2349
|
-
*
|
|
2350
|
-
* This works by:
|
|
2351
|
-
* 1. Reading the subtrees (frontier) from the on-chain account
|
|
2352
|
-
* 2. For each level, determining the sibling:
|
|
2353
|
-
* - If index is odd: sibling is the stored subtree (left sibling)
|
|
2354
|
-
* - If index is even: sibling is either a subsequent subtree or zero value
|
|
2355
|
-
*
|
|
2356
|
-
* Note: This works best for recent leaves where siblings are zero values.
|
|
2357
|
-
* For older leaves with non-zero siblings that aren't stored in subtrees,
|
|
2358
|
-
* an indexer may still be needed.
|
|
2359
|
-
*
|
|
2360
|
-
* @param connection - Solana connection
|
|
2361
|
-
* @param merkleTreePDA - PDA of the merkle tree account
|
|
2362
|
-
* @param leafIndex - Index of the leaf to compute proof for
|
|
2363
|
-
* @param forceConfirmed - If true, forces "confirmed" commitment level for fresh data
|
|
2364
|
-
* @returns Merkle proof with path elements and indices
|
|
2365
|
-
*/
|
|
2366
2548
|
declare function computeProofFromChain(connection: Connection, merkleTreePDA: PublicKey, leafIndex: number, forceConfirmed?: boolean): Promise<OnchainMerkleProof>;
|
|
2367
2549
|
/**
|
|
2368
2550
|
* Compute proof for the most recently inserted leaf
|
|
@@ -2634,115 +2816,119 @@ declare function isBrowser(): boolean;
|
|
|
2634
2816
|
declare function isBrowserLike(): boolean;
|
|
2635
2817
|
|
|
2636
2818
|
/**
|
|
2637
|
-
*
|
|
2638
|
-
*
|
|
2639
|
-
*
|
|
2640
|
-
* A
|
|
2641
|
-
*
|
|
2642
|
-
*
|
|
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.
|
|
2643
2857
|
*/
|
|
2644
|
-
|
|
2645
|
-
/**
|
|
2646
|
-
* How far ahead of the relay's clock a request may be stamped
|
|
2647
|
-
* (`REQUEST_AUTH_MAX_FUTURE_SKEW_SECONDS`, `api/request_auth.rs`).
|
|
2648
|
-
*
|
|
2649
|
-
* `auth_issued_at` comes from `Date.now()`. On a server that is NTP-disciplined; in a browser it
|
|
2650
|
-
* is the user's own machine clock, and a laptop more than 30 seconds fast cannot authenticate at
|
|
2651
|
-
* all until its clock is corrected.
|
|
2652
|
-
*/
|
|
2653
|
-
declare const REQUEST_AUTH_MAX_FUTURE_SKEW_SECONDS = 30;
|
|
2654
|
-
/**
|
|
2655
|
-
* The exact fields each endpoint signs. Both lists mirror the relay's `*_auth_request` builders and
|
|
2656
|
-
* must stay in lockstep with them: adding a field on one side alone silently invalidates every
|
|
2657
|
-
* signature, and the failure surfaces as a bare 401 with nothing pointing here.
|
|
2658
|
-
*/
|
|
2659
|
-
declare const TRANSACT_AUTH_FIELDS: readonly ["encrypted_notes", "max_fee", "mint", "proof_bytes", "public_inputs", "recipient", "recipient_delivery_notes", "risk_quote", "sender"];
|
|
2660
|
-
declare const TRANSACT_SWAP_AUTH_FIELDS: readonly ["close_timed_out", "dexes", "encrypted_notes", "exclude_dexes", "max_fee", "min_output_amount", "output_mint", "proof_bytes", "public_inputs", "recipient", "recipient_ata", "refund_blinding", "refund_pubkey", "retry_request_id", "risk_quote", "route_retry_attempts", "sender", "slippage_bps", "swap_max_retries"];
|
|
2661
|
-
/**
|
|
2662
|
-
* Serialize exactly like the relay's `canonical_json`: keys sorted bytewise, no whitespace.
|
|
2663
|
-
*
|
|
2664
|
-
* SCOPE. This is the SDK's half of a byte-for-byte agreement with one specific Rust function over
|
|
2665
|
-
* one specific schema: the values reachable through {@link TRANSACT_AUTH_FIELDS} and
|
|
2666
|
-
* {@link TRANSACT_SWAP_AUTH_FIELDS}, which are ASCII keys over strings, small unsigned integers,
|
|
2667
|
-
* booleans, nulls, arrays and plain objects. Inside that schema the two implementations agree.
|
|
2668
|
-
*
|
|
2669
|
-
* Outside it they need not, so anything that could serialize differently on the two sides is
|
|
2670
|
-
* REFUSED here rather than signed into a digest that silently fails to match:
|
|
2671
|
-
*
|
|
2672
|
-
* - Non-integer, non-finite and beyond-safe-integer numbers. `serde_json` renders an f64 as Rust
|
|
2673
|
-
* does (`1e21`) where JavaScript renders `1e+21`, and `0.1 + 0.2` has no single spelling. Every
|
|
2674
|
-
* number in both field lists is a small unsigned integer (`slippage_bps`, `route_retry_attempts`,
|
|
2675
|
-
* `swap_max_retries`); u64 amounts already travel as decimal STRINGS for exactly this reason.
|
|
2676
|
-
* - Functions and symbols as object VALUES. `JSON.stringify` drops such a key from the wire body
|
|
2677
|
-
* while it stays in the signed view, so the two digests can never agree.
|
|
2678
|
-
*
|
|
2679
|
-
* `undefined` is NOT refused: it serializes as `null` here, `JSON.stringify` omits the key on the
|
|
2680
|
-
* wire, and every optional field on the relay side is `Option<T>` with `#[serde(default)]`, so the
|
|
2681
|
-
* relay sees `null` too. That is the same agreement {@link buildAuthRequest} relies on. The one
|
|
2682
|
-
* field where it does not hold is `slippage_bps`, which is why that field is checked by name.
|
|
2683
|
-
*
|
|
2684
|
-
* `bigint` is accepted and rendered as a bare decimal integer, matching serde's u64/i64 output.
|
|
2685
|
-
* Note that such a value cannot also go on the wire: `JSON.stringify` throws on a bigint. Use a
|
|
2686
|
-
* decimal string in the body, as every SDK-built body does.
|
|
2687
|
-
*/
|
|
2688
|
-
declare function canonicalJson(value: unknown): string;
|
|
2858
|
+
|
|
2689
2859
|
/**
|
|
2690
|
-
*
|
|
2691
|
-
*
|
|
2692
|
-
*
|
|
2693
|
-
* This exists because the holder of the pen is not always a `Keypair`. A browser wallet adapter
|
|
2694
|
-
* exposes `signMessage(bytes): Promise<Uint8Array>` and no secret key at all, so the scheme has to
|
|
2695
|
-
* be reachable in two halves: build the preimage here, sign it wherever the key actually lives,
|
|
2696
|
-
* then put `sender` / `auth_issued_at` / `auth_nonce` and the base64 signature on the body.
|
|
2697
|
-
*
|
|
2698
|
-
* `message` is a plain ed25519 detached-signature preimage — nothing about the scheme changes
|
|
2699
|
-
* between a local keypair and a wallet, only who signs it.
|
|
2860
|
+
* What one item of the batch holds. `submitTransactToRelay` calls `authorize` where it would
|
|
2861
|
+
* otherwise sign; the caller that ran the item calls `finish` when the item's flow has settled,
|
|
2862
|
+
* successfully or not, so the coordinator never waits on an item that is not coming.
|
|
2700
2863
|
*/
|
|
2701
|
-
interface
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2864
|
+
interface RelayBatchAuthItemHandle {
|
|
2865
|
+
/**
|
|
2866
|
+
* Wait for a proof slot. Every row of a batch is in flight at once, because all proofs must exist
|
|
2867
|
+
* before the one signature; this is where CPU and memory are bounded instead. Returns the release.
|
|
2868
|
+
*/
|
|
2869
|
+
proofSlot(): Promise<() => void>;
|
|
2870
|
+
authorize(endpoint: string, programId: PublicKey, body: Record<string, unknown>, fields: readonly string[]): Promise<RelayBatchAuthFields>;
|
|
2871
|
+
finish(): void;
|
|
2706
2872
|
}
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
*/
|
|
2718
|
-
|
|
2719
|
-
/**
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
* A browser wallet adapter has no secret key to hand over — it exposes `signMessage`, and what
|
|
2723
|
-
* this scheme needs signed is a plain ed25519 detached signature, which is exactly what that
|
|
2724
|
-
* produces. Only the holder of the pen changes.
|
|
2725
|
-
*
|
|
2726
|
-
* COMPLIANCE — `walletPublicKey` becomes the request's authenticated `sender`, and `sender` is the
|
|
2727
|
-
* key screened for sanctions on a shield-to-shield send. It MUST be the end user's own wallet.
|
|
2728
|
-
* Putting an ephemeral, service-held or otherwise substituted key here moves the screening onto a
|
|
2729
|
-
* key that is not the user: a compliance regression, not a shortcut.
|
|
2730
|
-
*/
|
|
2731
|
-
interface RelayAuthSigner {
|
|
2732
|
-
/** The end user's real wallet. Becomes the authenticated `sender`. Never an ephemeral key. */
|
|
2733
|
-
walletPublicKey: PublicKey;
|
|
2734
|
-
/** Wallet-adapter `signMessage`; must return the 64-byte ed25519 detached signature. */
|
|
2735
|
-
signMessage: (message: Uint8Array) => Promise<Uint8Array>;
|
|
2873
|
+
interface RelayBatchAuthCoordinatorOptions {
|
|
2874
|
+
/**
|
|
2875
|
+
* Who signs. A `Keypair` signs locally (tests, scripts, server-side callers); a wallet adapter
|
|
2876
|
+
* signs through `signMessage` and its `walletPublicKey` becomes every item's authenticated
|
|
2877
|
+
* `sender`. COMPLIANCE: that key is the one screened for sanctions on a shield-to-shield send,
|
|
2878
|
+
* so it must be the end user's own wallet, never a service or ephemeral key.
|
|
2879
|
+
*/
|
|
2880
|
+
signer: RelayAuthSigner | Keypair;
|
|
2881
|
+
/** How many items will call `item()`. The wave signs only when all of them are accounted for. */
|
|
2882
|
+
items: number;
|
|
2883
|
+
/** Rows proving at the same time. Proofs are CPU-bound; default 2. */
|
|
2884
|
+
proofConcurrency?: number;
|
|
2885
|
+
/** Items released to submit at once after a signature. Default 3. */
|
|
2886
|
+
submitConcurrency?: number;
|
|
2887
|
+
onProgress?: (status: string) => void;
|
|
2736
2888
|
}
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2889
|
+
declare class RelayBatchAuthCoordinator {
|
|
2890
|
+
private readonly signer;
|
|
2891
|
+
private readonly sender;
|
|
2892
|
+
private readonly expectedItems;
|
|
2893
|
+
private readonly submitConcurrency;
|
|
2894
|
+
private readonly proofConcurrency;
|
|
2895
|
+
private proofSlotsInUse;
|
|
2896
|
+
private readonly proofQueue;
|
|
2897
|
+
private readonly onProgress?;
|
|
2898
|
+
private readonly items;
|
|
2899
|
+
private signing;
|
|
2900
|
+
private slotsInUse;
|
|
2901
|
+
private readonly ready;
|
|
2902
|
+
private waves;
|
|
2903
|
+
constructor(options: RelayBatchAuthCoordinatorOptions);
|
|
2904
|
+
/** The wallet that signs and is every item's authenticated `sender`. */
|
|
2905
|
+
get walletPublicKey(): PublicKey;
|
|
2906
|
+
/** How many times the signer has been asked so far: one per wave. */
|
|
2907
|
+
get approvals(): number;
|
|
2908
|
+
/** Where every item is right now. For progress UIs and for diagnosing a batch that never signs. */
|
|
2909
|
+
snapshot(): {
|
|
2910
|
+
building: number;
|
|
2911
|
+
waiting: number;
|
|
2912
|
+
submitting: number;
|
|
2913
|
+
done: number;
|
|
2914
|
+
proving: number;
|
|
2915
|
+
proofQueue: number;
|
|
2916
|
+
registered: number;
|
|
2917
|
+
expected: number;
|
|
2918
|
+
};
|
|
2919
|
+
/** Register one item. Throws past `items`: the wave condition would never be reachable. */
|
|
2920
|
+
item(): RelayBatchAuthItemHandle;
|
|
2921
|
+
private acquireProofSlot;
|
|
2922
|
+
private authorize;
|
|
2923
|
+
private finish;
|
|
2924
|
+
private releaseSlot;
|
|
2925
|
+
/** Sign when every registered item is either waiting here or finished, and nothing is building. */
|
|
2926
|
+
private maybeSign;
|
|
2927
|
+
private signWave;
|
|
2928
|
+
/** Release signed items to submit, `submitConcurrency` at a time, in signing order. */
|
|
2929
|
+
private pump;
|
|
2930
|
+
}
|
|
2931
|
+
declare function createRelayBatchAuthCoordinator(options: RelayBatchAuthCoordinatorOptions): RelayBatchAuthCoordinator;
|
|
2746
2932
|
|
|
2747
2933
|
/**
|
|
2748
2934
|
* The circuit artifacts this SDK build proves against.
|
|
@@ -2994,6 +3180,14 @@ interface TransactOptions {
|
|
|
2994
3180
|
signTransaction?: <T extends Transaction | VersionedTransaction>(transaction: T) => Promise<T>;
|
|
2995
3181
|
/** Wallet adapter signMessage for viewing-key registration auth. */
|
|
2996
3182
|
signMessage?: (message: Uint8Array) => Promise<Uint8Array>;
|
|
3183
|
+
/**
|
|
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>;
|
|
2997
3191
|
/** Public key of the depositor when using signTransaction */
|
|
2998
3192
|
depositorPublicKey?: PublicKey;
|
|
2999
3193
|
/** Wallet public key for relay submissions when depositor keypair isn't used. */
|
|
@@ -3230,6 +3424,13 @@ interface TransactOptions {
|
|
|
3230
3424
|
* Optional for backward compatibility, but pass it on every flow you can.
|
|
3231
3425
|
*/
|
|
3232
3426
|
expectedMint?: PublicKey;
|
|
3427
|
+
/**
|
|
3428
|
+
* One item of a batch approval, from `createRelayBatchAuthCoordinator().item()`. When present the
|
|
3429
|
+
* relay request is authenticated with the batch's single wallet signature instead of a prompt of
|
|
3430
|
+
* its own; `transactBatch` sets it for every item it runs. Ignored on the deposit path, which the
|
|
3431
|
+
* relay does not authenticate this way.
|
|
3432
|
+
*/
|
|
3433
|
+
relayAuthBatch?: RelayBatchAuthItemHandle;
|
|
3233
3434
|
}
|
|
3234
3435
|
/**
|
|
3235
3436
|
* Switchboard-style response: a pre-built instruction.
|
|
@@ -3334,6 +3535,13 @@ interface SubmitTransactToRelayArgs {
|
|
|
3334
3535
|
* or server-side key here is a compliance regression, not a shortcut.
|
|
3335
3536
|
*/
|
|
3336
3537
|
relayAuthSigner?: RelayAuthSigner;
|
|
3538
|
+
/**
|
|
3539
|
+
* Batch alternative to both signers above: the request is authenticated by the batch's one
|
|
3540
|
+
* wallet signature (CLOAK_RELAY_BATCH_AUTH_V1) instead of signing here. Takes precedence over
|
|
3541
|
+
* `depositorKeypair` and `relayAuthSigner` when present, because the coordinator already holds
|
|
3542
|
+
* whichever of those the batch was created with.
|
|
3543
|
+
*/
|
|
3544
|
+
relayAuthBatch?: RelayBatchAuthItemHandle;
|
|
3337
3545
|
settlement: SettlementContext;
|
|
3338
3546
|
/** True while the caller still has a re-prove budget for a stale root. */
|
|
3339
3547
|
canRetryStaleRoot: boolean;
|
|
@@ -3784,6 +3992,32 @@ declare function cleanupStalePendingOperations(maxAgeMs?: number): {
|
|
|
3784
3992
|
removedWithdrawals: number;
|
|
3785
3993
|
};
|
|
3786
3994
|
|
|
3995
|
+
interface TransactBatchItem {
|
|
3996
|
+
params: TransactParams;
|
|
3997
|
+
/** Per-item overrides (recipient viewing key, chain-note salt, expected mint, ...). */
|
|
3998
|
+
options?: Partial<TransactOptions>;
|
|
3999
|
+
}
|
|
4000
|
+
interface TransactBatchOptions extends Omit<TransactOptions, "relayAuthBatch"> {
|
|
4001
|
+
/** Items proved at the same time. Proofs are CPU-bound; default 2. */
|
|
4002
|
+
proofConcurrency?: number;
|
|
4003
|
+
/** Items released to the relay at the same time after the signature. Default 3. */
|
|
4004
|
+
submitConcurrency?: number;
|
|
4005
|
+
}
|
|
4006
|
+
type TransactBatchItemOutcome = {
|
|
4007
|
+
status: "fulfilled";
|
|
4008
|
+
value: TransactResult;
|
|
4009
|
+
} | {
|
|
4010
|
+
status: "rejected";
|
|
4011
|
+
reason: unknown;
|
|
4012
|
+
};
|
|
4013
|
+
interface TransactBatchResult {
|
|
4014
|
+
/** One entry per item, in input order. A rejected item did not settle; the others are unaffected. */
|
|
4015
|
+
results: TransactBatchItemOutcome[];
|
|
4016
|
+
/** Wallet approvals raised: 1 for the batch, plus 1 per wave of stale-root re-proves. */
|
|
4017
|
+
approvals: number;
|
|
4018
|
+
}
|
|
4019
|
+
declare function transactBatch(items: readonly TransactBatchItem[], options: TransactBatchOptions): Promise<TransactBatchResult>;
|
|
4020
|
+
|
|
3787
4021
|
/**
|
|
3788
4022
|
* Recipient-addressed delivery envelope (CLKD1).
|
|
3789
4023
|
*
|
|
@@ -5401,4 +5635,4 @@ declare const VERSION = "0.2.3";
|
|
|
5401
5635
|
/** True when scanner supports TransactSwap (tag 1). Check this to verify the correct SDK bundle is loaded. */
|
|
5402
5636
|
declare const SCANNER_SUPPORTS_TRANSACT_SWAP = true;
|
|
5403
5637
|
|
|
5404
|
-
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_ORIGIN_ALLOWLIST, REQUEST_AUTH_MAX_AGE_SECONDS, REQUEST_AUTH_MAX_FUTURE_SKEW_SECONDS, type RecipientDeliveryNote, type RecoveredChangeNote, type RecoveredChangeNoteRecord, type RecoveredDepositNote, type RecoveredDepositNoteRecord, type RecoveredSwapRefund, type RelayAuthPreimage, type RelayAuthSigner, RelayInternalError, RelayService, type RelaySubmissionResult, type 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 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, buildMerkleTree, buildMerkleTreeFromChain, buildMerkleTreeFromRelay, buildRecipientDeliveryNotes, buildRelayAuthPreimage, 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, 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, removePendingDeposit, removePendingWithdrawal, renderAssessment, resolveCircuitsBase, retryDelayMs, savePendingDeposit, savePendingWithdrawal, scanNotesForWallet, scanRecipientDeliveryNotes, scanTransactions, sdkLogger, selectUtxos, sendTransaction, serializeNote, serializeUtxo, setCircuitsPath, setDebugMode, signTransaction, splitTo2Limbs, submitTransactToRelay, sumUtxoAmounts, swapUtxo, swapWithChange, toComplianceReport, transact, transfer, truncate, tryDecryptNote, updateNoteWithDeposit, updatePendingDeposit, updatePendingWithdrawal, bigintToBytes32 as utxoBigintToBytes32, utxoEquals, hexToBigint as utxoHexToBigint, validateDepositParams, validateNote, validateOutputsSum, validatePaymasterTopUpTransaction, validateRoot, validateTransfers, validateWalletConnected, validateWithdrawableNote, verifyAllCircuits, verifyCircuitIntegrity, verifyQuoteSignature, verifyUtxos, waitForRoot, withShieldRetries, withTiming, withdrawFeeFor };
|
|
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 };
|