veilix-sdk 0.2.2 → 0.3.0
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/{VeilixSDK-D1hKisoi.d.ts → VeilixSDK-BfiPKwIa.d.ts} +134 -7
- package/dist/{VeilixSDK-CGbGpth9.d.cts → VeilixSDK-sbYKDbdy.d.cts} +134 -7
- package/dist/circuits/paths.cjs.map +1 -1
- package/dist/circuits/paths.js.map +1 -1
- package/dist/index.cjs +1356 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -3
- package/dist/index.d.ts +42 -3
- package/dist/index.js +1351 -68
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +1350 -67
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1350 -67
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { N as Network } from './VeilixSDK-sbYKDbdy.cjs';
|
|
2
|
+
export { B as BuildDepositTxParams, a as BuildRelayPayloadParams, b as BuildSwapPayloadOptions, c as BuildWithdrawPayloadOptions, C as CommitmentStatus, E as EncryptKeyWallet, d as ExtData, F as FetchWalletBalanceOptions, G as GenerateDepositParamsResult, e as GetQuoteParams, f as GetQuoteResponse, g as GetSwapQuoteParams, I as IndexedLeaf, h as IndexerAsset, i as NOTE_PREFIX, j as NoteStatus, k as NullifierStatus, P as ParsedNote, l as PlatformFeeWallet, m as PoolTransaction, n as PreparedCircuitArtifacts, o as ProvedTransaction, Q as Quote, p as QuoteRelayer, q as QuoteTransaction, R as RelayPayload, r as Relayer, s as RelayerJob, t as ResolvedNoteAsset, S as ScanOwnedNotesOptions, u as Submission, v as SubmissionItem, w as SwapParams, x as SwapQuote, y as SwapRelayBundle, z as SwapRelayPayload, A as SwapResult, T as TokenDecimalsSymbol, D as TokenSymbol, H as TransactionProof, J as TreeAccountState, K as TreeState, L as TxStatus, U as Utxo, V as VeilixKeypair, M as VeilixMerkleTree, O as VeilixSDK, W as VeilixSdkInitOptions, X as VeilixSdkRuntimeConfig, Y as VeilixTransferDepositFailure, Z as VeilixTransferItem, _ as VeilixTransferOptions, $ as VeilixTransferResult, a0 as VeilixTransferWithdrawFailure, a1 as WithdrawParams, a2 as WithdrawRelayBundle, a3 as WithdrawResult, a4 as WithdrawStatus, a5 as buildMerkleTree, a6 as decodeNote, a7 as decryptData, a8 as decryptNoteOutput, O as default, a9 as encodeNote, aa as encryptData, ab as encryptNoteOutput, ac as encryptSwapNoteOutput, ad as extDataHash, ae as formatNoteForDisplay, af as getQuote, ag as isLegacyNote, ah as mintToField, ai as parseSecretNote, aj as prepareCircuitArtifacts, ak as proveTransaction, al as swapOutputNote } from './VeilixSDK-sbYKDbdy.cjs';
|
|
2
3
|
export { C as CircuitPaths, a as WITHDRAW_CIRCUIT_WASM, b as WITHDRAW_CIRCUIT_ZKEY, c as resolveCircuitPathsFromBase, d as resolveNpmCdnCircuitBase } from './constants-C-u6nmCv.cjs';
|
|
4
|
+
import { PublicKey, Connection } from '@solana/web3.js';
|
|
3
5
|
export { Wallet } from '@coral-xyz/anchor/dist/cjs/provider';
|
|
4
|
-
import '@solana/web3.js';
|
|
5
6
|
import 'buffer';
|
|
6
7
|
import 'fixed-merkle-tree';
|
|
7
8
|
import '@switchboard-xyz/common';
|
|
@@ -9,6 +10,44 @@ import '@coral-xyz/anchor';
|
|
|
9
10
|
|
|
10
11
|
declare const MALICIOUS_RECIPIENT_ERROR = "Recipient address flagged as malicious";
|
|
11
12
|
|
|
13
|
+
/** Must match `SWAP_DOMAIN` in the Veilix program. */
|
|
14
|
+
declare const SWAP_DOMAIN: Uint8Array<ArrayBuffer>;
|
|
15
|
+
/** Data a private swap binds to its proof; mirrors `SwapExtData` in the program. */
|
|
16
|
+
type SwapExtData = {
|
|
17
|
+
/** Tree mints, `null` for SOL. */
|
|
18
|
+
mintIn: PublicKey | null;
|
|
19
|
+
mintOut: PublicKey | null;
|
|
20
|
+
relayer: PublicKey;
|
|
21
|
+
amountIn: bigint;
|
|
22
|
+
fee: bigint;
|
|
23
|
+
minAmountOut: bigint;
|
|
24
|
+
/** Public key and blinding of the asset-B note, completed on-chain. */
|
|
25
|
+
outPubkey: bigint;
|
|
26
|
+
outBlinding: bigint;
|
|
27
|
+
encryptedOutput1: Uint8Array;
|
|
28
|
+
encryptedOutput2: Uint8Array;
|
|
29
|
+
encryptedNote: Uint8Array;
|
|
30
|
+
};
|
|
31
|
+
/** sha256("veilix:swap:v1" || fields) with the first byte zeroed, as computed on-chain. */
|
|
32
|
+
declare function swapExtDataHash(ext: SwapExtData): Promise<bigint>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Independent quote for Raydium CPMM routes. The user's `minAmountOut` comes from this,
|
|
36
|
+
* not from the relayer: a relayer that quoted low could otherwise lower the user's
|
|
37
|
+
* slippage floor and keep the difference by sandwiching its own transaction.
|
|
38
|
+
*/
|
|
39
|
+
declare const CPMM_PROGRAM_IDS: Record<Network, string>;
|
|
40
|
+
type CpmmQuote = {
|
|
41
|
+
amountOut: bigint;
|
|
42
|
+
/** Output lost to the trade size versus the pool's spot price (0..1). */
|
|
43
|
+
priceImpact: number;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Expected `swap_base_input` output of `pool` for `amountIn` of `treeMintIn`
|
|
47
|
+
* (`null` = SOL, traded as wrapped SOL). Throws if the pool does not trade that pair.
|
|
48
|
+
*/
|
|
49
|
+
declare function quoteCpmm(connection: Connection, network: Network, poolAddress: PublicKey, treeMintIn: PublicKey | null, treeMintOut: PublicKey | null, amountIn: bigint): Promise<CpmmQuote>;
|
|
50
|
+
|
|
12
51
|
/** BN254 scalar field modulus. */
|
|
13
52
|
declare const FIELD_SIZE: bigint;
|
|
14
53
|
/** Merkle tree height of every on-chain asset tree (`MERKLE_TREE_HEIGHT` in the program). */
|
|
@@ -21,4 +60,4 @@ declare function parseAmountToBaseUnits(amount: string | number, decimals: numbe
|
|
|
21
60
|
/** Base units → human-readable decimal string (trailing zeros trimmed). */
|
|
22
61
|
declare function formatBaseUnits(value: bigint | string | number, decimals: number): string;
|
|
23
62
|
|
|
24
|
-
export { FIELD_SIZE, MALICIOUS_RECIPIENT_ERROR, TREE_LEVELS, ZERO_LEAF, formatBaseUnits, parseAmountToBaseUnits };
|
|
63
|
+
export { CPMM_PROGRAM_IDS, type CpmmQuote, FIELD_SIZE, MALICIOUS_RECIPIENT_ERROR, Network, SWAP_DOMAIN, type SwapExtData, TREE_LEVELS, ZERO_LEAF, formatBaseUnits, parseAmountToBaseUnits, quoteCpmm, swapExtDataHash };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { N as Network } from './VeilixSDK-BfiPKwIa.js';
|
|
2
|
+
export { B as BuildDepositTxParams, a as BuildRelayPayloadParams, b as BuildSwapPayloadOptions, c as BuildWithdrawPayloadOptions, C as CommitmentStatus, E as EncryptKeyWallet, d as ExtData, F as FetchWalletBalanceOptions, G as GenerateDepositParamsResult, e as GetQuoteParams, f as GetQuoteResponse, g as GetSwapQuoteParams, I as IndexedLeaf, h as IndexerAsset, i as NOTE_PREFIX, j as NoteStatus, k as NullifierStatus, P as ParsedNote, l as PlatformFeeWallet, m as PoolTransaction, n as PreparedCircuitArtifacts, o as ProvedTransaction, Q as Quote, p as QuoteRelayer, q as QuoteTransaction, R as RelayPayload, r as Relayer, s as RelayerJob, t as ResolvedNoteAsset, S as ScanOwnedNotesOptions, u as Submission, v as SubmissionItem, w as SwapParams, x as SwapQuote, y as SwapRelayBundle, z as SwapRelayPayload, A as SwapResult, T as TokenDecimalsSymbol, D as TokenSymbol, H as TransactionProof, J as TreeAccountState, K as TreeState, L as TxStatus, U as Utxo, V as VeilixKeypair, M as VeilixMerkleTree, O as VeilixSDK, W as VeilixSdkInitOptions, X as VeilixSdkRuntimeConfig, Y as VeilixTransferDepositFailure, Z as VeilixTransferItem, _ as VeilixTransferOptions, $ as VeilixTransferResult, a0 as VeilixTransferWithdrawFailure, a1 as WithdrawParams, a2 as WithdrawRelayBundle, a3 as WithdrawResult, a4 as WithdrawStatus, a5 as buildMerkleTree, a6 as decodeNote, a7 as decryptData, a8 as decryptNoteOutput, O as default, a9 as encodeNote, aa as encryptData, ab as encryptNoteOutput, ac as encryptSwapNoteOutput, ad as extDataHash, ae as formatNoteForDisplay, af as getQuote, ag as isLegacyNote, ah as mintToField, ai as parseSecretNote, aj as prepareCircuitArtifacts, ak as proveTransaction, al as swapOutputNote } from './VeilixSDK-BfiPKwIa.js';
|
|
2
3
|
export { C as CircuitPaths, a as WITHDRAW_CIRCUIT_WASM, b as WITHDRAW_CIRCUIT_ZKEY, c as resolveCircuitPathsFromBase, d as resolveNpmCdnCircuitBase } from './constants-C-u6nmCv.js';
|
|
4
|
+
import { PublicKey, Connection } from '@solana/web3.js';
|
|
3
5
|
export { Wallet } from '@coral-xyz/anchor/dist/cjs/provider';
|
|
4
|
-
import '@solana/web3.js';
|
|
5
6
|
import 'buffer';
|
|
6
7
|
import 'fixed-merkle-tree';
|
|
7
8
|
import '@switchboard-xyz/common';
|
|
@@ -9,6 +10,44 @@ import '@coral-xyz/anchor';
|
|
|
9
10
|
|
|
10
11
|
declare const MALICIOUS_RECIPIENT_ERROR = "Recipient address flagged as malicious";
|
|
11
12
|
|
|
13
|
+
/** Must match `SWAP_DOMAIN` in the Veilix program. */
|
|
14
|
+
declare const SWAP_DOMAIN: Uint8Array<ArrayBuffer>;
|
|
15
|
+
/** Data a private swap binds to its proof; mirrors `SwapExtData` in the program. */
|
|
16
|
+
type SwapExtData = {
|
|
17
|
+
/** Tree mints, `null` for SOL. */
|
|
18
|
+
mintIn: PublicKey | null;
|
|
19
|
+
mintOut: PublicKey | null;
|
|
20
|
+
relayer: PublicKey;
|
|
21
|
+
amountIn: bigint;
|
|
22
|
+
fee: bigint;
|
|
23
|
+
minAmountOut: bigint;
|
|
24
|
+
/** Public key and blinding of the asset-B note, completed on-chain. */
|
|
25
|
+
outPubkey: bigint;
|
|
26
|
+
outBlinding: bigint;
|
|
27
|
+
encryptedOutput1: Uint8Array;
|
|
28
|
+
encryptedOutput2: Uint8Array;
|
|
29
|
+
encryptedNote: Uint8Array;
|
|
30
|
+
};
|
|
31
|
+
/** sha256("veilix:swap:v1" || fields) with the first byte zeroed, as computed on-chain. */
|
|
32
|
+
declare function swapExtDataHash(ext: SwapExtData): Promise<bigint>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Independent quote for Raydium CPMM routes. The user's `minAmountOut` comes from this,
|
|
36
|
+
* not from the relayer: a relayer that quoted low could otherwise lower the user's
|
|
37
|
+
* slippage floor and keep the difference by sandwiching its own transaction.
|
|
38
|
+
*/
|
|
39
|
+
declare const CPMM_PROGRAM_IDS: Record<Network, string>;
|
|
40
|
+
type CpmmQuote = {
|
|
41
|
+
amountOut: bigint;
|
|
42
|
+
/** Output lost to the trade size versus the pool's spot price (0..1). */
|
|
43
|
+
priceImpact: number;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Expected `swap_base_input` output of `pool` for `amountIn` of `treeMintIn`
|
|
47
|
+
* (`null` = SOL, traded as wrapped SOL). Throws if the pool does not trade that pair.
|
|
48
|
+
*/
|
|
49
|
+
declare function quoteCpmm(connection: Connection, network: Network, poolAddress: PublicKey, treeMintIn: PublicKey | null, treeMintOut: PublicKey | null, amountIn: bigint): Promise<CpmmQuote>;
|
|
50
|
+
|
|
12
51
|
/** BN254 scalar field modulus. */
|
|
13
52
|
declare const FIELD_SIZE: bigint;
|
|
14
53
|
/** Merkle tree height of every on-chain asset tree (`MERKLE_TREE_HEIGHT` in the program). */
|
|
@@ -21,4 +60,4 @@ declare function parseAmountToBaseUnits(amount: string | number, decimals: numbe
|
|
|
21
60
|
/** Base units → human-readable decimal string (trailing zeros trimmed). */
|
|
22
61
|
declare function formatBaseUnits(value: bigint | string | number, decimals: number): string;
|
|
23
62
|
|
|
24
|
-
export { FIELD_SIZE, MALICIOUS_RECIPIENT_ERROR, TREE_LEVELS, ZERO_LEAF, formatBaseUnits, parseAmountToBaseUnits };
|
|
63
|
+
export { CPMM_PROGRAM_IDS, type CpmmQuote, FIELD_SIZE, MALICIOUS_RECIPIENT_ERROR, Network, SWAP_DOMAIN, type SwapExtData, TREE_LEVELS, ZERO_LEAF, formatBaseUnits, parseAmountToBaseUnits, quoteCpmm, swapExtDataHash };
|