veilix-sdk 0.2.3 → 0.3.1
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-DL7hvWhB.d.ts → VeilixSDK-BLZZ5yVj.d.ts} +216 -87
- package/dist/{VeilixSDK-CousE3xD.d.cts → VeilixSDK-CpjyQiV7.d.cts} +216 -87
- package/dist/circuits/paths.cjs.map +1 -1
- package/dist/circuits/paths.js.map +1 -1
- package/dist/index.cjs +1406 -104
- 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 +1401 -105
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +1400 -104
- 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 +1400 -104
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublicKey, Keypair,
|
|
1
|
+
import { Connection, PublicKey, Keypair, TransactionInstruction, VersionedTransaction, Transaction } from '@solana/web3.js';
|
|
2
2
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
3
3
|
import { MerkleTree } from 'fixed-merkle-tree';
|
|
4
4
|
import { OracleJob } from '@switchboard-xyz/common';
|
|
@@ -6,6 +6,86 @@ import { Program } from '@coral-xyz/anchor';
|
|
|
6
6
|
import { Wallet } from '@coral-xyz/anchor/dist/cjs/provider';
|
|
7
7
|
import { C as CircuitPaths } from './constants-C-u6nmCv.js';
|
|
8
8
|
|
|
9
|
+
type Network = "mainnet" | "devnet";
|
|
10
|
+
declare const MAINNET_TOKEN_MINTS: {
|
|
11
|
+
readonly Veilix: "GAFN64LvtCBoc5BHncVn3JEJGpq42rUzQjPmvMK2UhZH";
|
|
12
|
+
readonly Bitcoin: "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh";
|
|
13
|
+
readonly Ethereum: "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs";
|
|
14
|
+
readonly USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
15
|
+
};
|
|
16
|
+
type TokenSymbol = keyof typeof MAINNET_TOKEN_MINTS;
|
|
17
|
+
declare const TOKEN_DECIMALS: {
|
|
18
|
+
readonly Solana: 9;
|
|
19
|
+
readonly Veilix: 9;
|
|
20
|
+
readonly Ethereum: 8;
|
|
21
|
+
readonly Bitcoin: 8;
|
|
22
|
+
readonly USDC: 6;
|
|
23
|
+
};
|
|
24
|
+
type TokenDecimalsSymbol = keyof typeof TOKEN_DECIMALS;
|
|
25
|
+
|
|
26
|
+
type Relayer = {
|
|
27
|
+
isValid: true;
|
|
28
|
+
label: string;
|
|
29
|
+
url: string;
|
|
30
|
+
key: number;
|
|
31
|
+
value: string;
|
|
32
|
+
fee: unknown;
|
|
33
|
+
recentActivities: unknown;
|
|
34
|
+
userPubkey: unknown;
|
|
35
|
+
workers: unknown;
|
|
36
|
+
totalFeeEarningsSol: unknown;
|
|
37
|
+
totalWithdrawCount: unknown;
|
|
38
|
+
stakedAmount: unknown;
|
|
39
|
+
volume24hSol: unknown;
|
|
40
|
+
volume7dSol: unknown;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
interface VeilixSdkInitOptions {
|
|
44
|
+
/** Wallet for Anchor provider transactions. */
|
|
45
|
+
wallet: Wallet;
|
|
46
|
+
/**
|
|
47
|
+
* Solana JSON-RPC endpoint (Node/scripts). Omit when passing {@link connection}
|
|
48
|
+
* from `@solana/wallet-adapter-react` (`useConnection()`).
|
|
49
|
+
*/
|
|
50
|
+
rpcEndpoint?: string;
|
|
51
|
+
/** Existing connection (e.g. `useConnection()` in React). */
|
|
52
|
+
connection?: Connection;
|
|
53
|
+
/**
|
|
54
|
+
* Cluster override when the RPC URL does not contain `devnet` / `mainnet` hints
|
|
55
|
+
* (common with private RPC providers).
|
|
56
|
+
*/
|
|
57
|
+
network: Network;
|
|
58
|
+
/**
|
|
59
|
+
* Base URL/path for withdraw circuit artifacts in the browser.
|
|
60
|
+
* Defaults to `/node_modules/<pkg>/dist/circuits/` on localhost and the
|
|
61
|
+
* pinned, SHA-256-verified jsDelivr CDN in production (domain-independent).
|
|
62
|
+
* Set this to self-host instead, e.g. `"/circuits/"` (verified, with CDN fallback)
|
|
63
|
+
* or `"https://cdn.example.com/veilix/circuits/"`.
|
|
64
|
+
*/
|
|
65
|
+
circuitPathsBase?: string;
|
|
66
|
+
/** Indexer base URL override (defaults to the Veilix indexer of {@link network}). */
|
|
67
|
+
indexerUrl?: string;
|
|
68
|
+
/** Address-risk API base URL override. */
|
|
69
|
+
riskApiUrl?: string;
|
|
70
|
+
}
|
|
71
|
+
interface VeilixSdkRuntimeConfig {
|
|
72
|
+
rpcEndpoint: string;
|
|
73
|
+
/** Cluster inferred from {@link rpcEndpoint}. */
|
|
74
|
+
network: Network;
|
|
75
|
+
programId: string;
|
|
76
|
+
indexerUrl: string;
|
|
77
|
+
riskApiUrl: string;
|
|
78
|
+
/** Active relayers for {@link network}, loaded at SDK initialization. */
|
|
79
|
+
relayers: Relayer[];
|
|
80
|
+
connection: Connection;
|
|
81
|
+
wallet: Wallet;
|
|
82
|
+
program: Program;
|
|
83
|
+
/** Set by {@link VeilixSDK.getEncryptionKey}; required for on-chain note backup. */
|
|
84
|
+
encryptKey?: Uint8Array;
|
|
85
|
+
/** Resolved withdraw circuit wasm/zkey URLs for browser proof generation. */
|
|
86
|
+
circuitPaths?: CircuitPaths;
|
|
87
|
+
}
|
|
88
|
+
|
|
9
89
|
type VeilixMerkleTree = MerkleTree;
|
|
10
90
|
/** Rebuild an asset tree from its leaves (commitments in index order). */
|
|
11
91
|
declare function buildMerkleTree(leaves: Array<bigint | string>): VeilixMerkleTree;
|
|
@@ -97,7 +177,7 @@ declare function extDataHash(ext: ExtData): Promise<bigint>;
|
|
|
97
177
|
* `tree` is required when spending notes; deposits only need a `root` from the
|
|
98
178
|
* on-chain root history.
|
|
99
179
|
*/
|
|
100
|
-
declare function proveTransaction({ tree, root, nextIndex, inputs, outputs, ext, circuit, }: {
|
|
180
|
+
declare function proveTransaction({ tree, root, nextIndex, inputs, outputs, ext, extDataHashOverride, circuit, }: {
|
|
101
181
|
tree?: VeilixMerkleTree;
|
|
102
182
|
root?: bigint;
|
|
103
183
|
/** Leaf index the first output will get (defaults to the tree size). */
|
|
@@ -105,6 +185,11 @@ declare function proveTransaction({ tree, root, nextIndex, inputs, outputs, ext,
|
|
|
105
185
|
inputs?: Utxo[];
|
|
106
186
|
outputs?: Utxo[];
|
|
107
187
|
ext: ExtData;
|
|
188
|
+
/**
|
|
189
|
+
* Bind the proof to this hash instead of `extDataHash(ext)` (private swap). `ext`
|
|
190
|
+
* still supplies the mint, `extAmount` and the encrypted outputs.
|
|
191
|
+
*/
|
|
192
|
+
extDataHashOverride?: bigint;
|
|
108
193
|
circuit: CircuitArtifactPaths;
|
|
109
194
|
}): Promise<ProvedTransaction>;
|
|
110
195
|
|
|
@@ -135,8 +220,14 @@ declare function parseSecretNote(note: string): ParsedNote;
|
|
|
135
220
|
* The mint is implied by the tree the output is appended to.
|
|
136
221
|
*/
|
|
137
222
|
declare function encryptNoteOutput(key: Uint8Array, utxo: Utxo): Uint8Array;
|
|
138
|
-
/**
|
|
139
|
-
declare function
|
|
223
|
+
/** `encryptedNote` of a private swap: key and blinding of the asset-B note, no amount. */
|
|
224
|
+
declare function encryptSwapNoteOutput(key: Uint8Array, keypair: VeilixKeypair, blinding: bigint): Uint8Array;
|
|
225
|
+
/**
|
|
226
|
+
* Returns the note if `encryptedOutput` was sealed with `key`, otherwise `null`.
|
|
227
|
+
* A swap output needs `onchainAmount` (the leaf's indexed amount); callers must
|
|
228
|
+
* still check the result against the leaf commitment.
|
|
229
|
+
*/
|
|
230
|
+
declare function decryptNoteOutput(key: Uint8Array, encryptedOutput: Uint8Array, mint: PublicKey | null, index: number, onchainAmount?: bigint | null): Utxo | null;
|
|
140
231
|
/** Truncate each note segment for display. */
|
|
141
232
|
declare function formatNoteForDisplay(note: string, segmentLen?: number): string;
|
|
142
233
|
|
|
@@ -186,6 +277,8 @@ type BuildDepositTxParams = {
|
|
|
186
277
|
computeUnitLimit?: number;
|
|
187
278
|
/** Shared, already verified circuit artifacts (see `prepareCircuitArtifacts`). */
|
|
188
279
|
circuitArtifacts?: PreparedCircuitArtifacts;
|
|
280
|
+
/** Seals `onChainBackup`. Defaults to this SDK instance's key. */
|
|
281
|
+
encryptKey?: Uint8Array;
|
|
189
282
|
};
|
|
190
283
|
/** Body of the relayer `POST /relay` (also one item of indexer `POST /submit`). */
|
|
191
284
|
type RelayPayload = {
|
|
@@ -242,6 +335,8 @@ type IndexedLeaf = {
|
|
|
242
335
|
commitment: string;
|
|
243
336
|
/** `0x`-prefixed hex (may be `"0x"` when empty). Present when requested. */
|
|
244
337
|
encryptedOutput?: string;
|
|
338
|
+
/** Swap output leaves: note amount set on-chain (not inside `encryptedOutput`). */
|
|
339
|
+
amountRaw?: string;
|
|
245
340
|
};
|
|
246
341
|
type TreeState = {
|
|
247
342
|
asset: string;
|
|
@@ -257,7 +352,7 @@ type TreeState = {
|
|
|
257
352
|
synced: boolean;
|
|
258
353
|
};
|
|
259
354
|
type SpentIn = {
|
|
260
|
-
kind: "Deposit" | "Withdraw";
|
|
355
|
+
kind: "Deposit" | "Withdraw" | "Swap" | "onchain";
|
|
261
356
|
signature: string;
|
|
262
357
|
asset?: string;
|
|
263
358
|
[key: string]: unknown;
|
|
@@ -367,86 +462,6 @@ type ScanOwnedNotesOptions = {
|
|
|
367
462
|
includeSpent?: boolean;
|
|
368
463
|
};
|
|
369
464
|
|
|
370
|
-
type Network = "mainnet" | "devnet";
|
|
371
|
-
declare const MAINNET_TOKEN_MINTS: {
|
|
372
|
-
readonly Veilix: "GAFN64LvtCBoc5BHncVn3JEJGpq42rUzQjPmvMK2UhZH";
|
|
373
|
-
readonly Bitcoin: "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh";
|
|
374
|
-
readonly Ethereum: "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs";
|
|
375
|
-
readonly USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
376
|
-
};
|
|
377
|
-
type TokenSymbol = keyof typeof MAINNET_TOKEN_MINTS;
|
|
378
|
-
declare const TOKEN_DECIMALS: {
|
|
379
|
-
readonly Solana: 9;
|
|
380
|
-
readonly Veilix: 9;
|
|
381
|
-
readonly Ethereum: 8;
|
|
382
|
-
readonly Bitcoin: 8;
|
|
383
|
-
readonly USDC: 6;
|
|
384
|
-
};
|
|
385
|
-
type TokenDecimalsSymbol = keyof typeof TOKEN_DECIMALS;
|
|
386
|
-
|
|
387
|
-
type Relayer = {
|
|
388
|
-
isValid: true;
|
|
389
|
-
label: string;
|
|
390
|
-
url: string;
|
|
391
|
-
key: number;
|
|
392
|
-
value: string;
|
|
393
|
-
fee: unknown;
|
|
394
|
-
recentActivities: unknown;
|
|
395
|
-
userPubkey: unknown;
|
|
396
|
-
workers: unknown;
|
|
397
|
-
totalFeeEarningsSol: unknown;
|
|
398
|
-
totalWithdrawCount: unknown;
|
|
399
|
-
stakedAmount: unknown;
|
|
400
|
-
volume24hSol: unknown;
|
|
401
|
-
volume7dSol: unknown;
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
interface VeilixSdkInitOptions {
|
|
405
|
-
/** Wallet for Anchor provider transactions. */
|
|
406
|
-
wallet: Wallet;
|
|
407
|
-
/**
|
|
408
|
-
* Solana JSON-RPC endpoint (Node/scripts). Omit when passing {@link connection}
|
|
409
|
-
* from `@solana/wallet-adapter-react` (`useConnection()`).
|
|
410
|
-
*/
|
|
411
|
-
rpcEndpoint?: string;
|
|
412
|
-
/** Existing connection (e.g. `useConnection()` in React). */
|
|
413
|
-
connection?: Connection;
|
|
414
|
-
/**
|
|
415
|
-
* Cluster override when the RPC URL does not contain `devnet` / `mainnet` hints
|
|
416
|
-
* (common with private RPC providers).
|
|
417
|
-
*/
|
|
418
|
-
network: Network;
|
|
419
|
-
/**
|
|
420
|
-
* Base URL/path for withdraw circuit artifacts in the browser.
|
|
421
|
-
* Defaults to `/node_modules/<pkg>/dist/circuits/` on localhost and the
|
|
422
|
-
* pinned, SHA-256-verified jsDelivr CDN in production (domain-independent).
|
|
423
|
-
* Set this to self-host instead, e.g. `"/circuits/"` (verified, with CDN fallback)
|
|
424
|
-
* or `"https://cdn.example.com/veilix/circuits/"`.
|
|
425
|
-
*/
|
|
426
|
-
circuitPathsBase?: string;
|
|
427
|
-
/** Indexer base URL override (defaults to the Veilix indexer of {@link network}). */
|
|
428
|
-
indexerUrl?: string;
|
|
429
|
-
/** Address-risk API base URL override. */
|
|
430
|
-
riskApiUrl?: string;
|
|
431
|
-
}
|
|
432
|
-
interface VeilixSdkRuntimeConfig {
|
|
433
|
-
rpcEndpoint: string;
|
|
434
|
-
/** Cluster inferred from {@link rpcEndpoint}. */
|
|
435
|
-
network: Network;
|
|
436
|
-
programId: string;
|
|
437
|
-
indexerUrl: string;
|
|
438
|
-
riskApiUrl: string;
|
|
439
|
-
/** Active relayers for {@link network}, loaded at SDK initialization. */
|
|
440
|
-
relayers: Relayer[];
|
|
441
|
-
connection: Connection;
|
|
442
|
-
wallet: Wallet;
|
|
443
|
-
program: Program;
|
|
444
|
-
/** Set by {@link VeilixSDK.getEncryptionKey}; required for on-chain note backup. */
|
|
445
|
-
encryptKey?: Uint8Array;
|
|
446
|
-
/** Resolved withdraw circuit wasm/zkey URLs for browser proof generation. */
|
|
447
|
-
circuitPaths?: CircuitPaths;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
465
|
type WithdrawParams = {
|
|
451
466
|
/** Secret note to spend. */
|
|
452
467
|
note: string;
|
|
@@ -554,6 +569,106 @@ type GetQuoteParams = {
|
|
|
554
569
|
/** Fetch a withdraw quote (relayer + platform fees) from the indexer. */
|
|
555
570
|
declare function getQuote(params: GetQuoteParams): Promise<GetQuoteResponse>;
|
|
556
571
|
|
|
572
|
+
type MintInput = PublicKey | string | null | undefined;
|
|
573
|
+
type SwapQuote = {
|
|
574
|
+
/** Tree mints, `null` for SOL. */
|
|
575
|
+
mintIn: string | null;
|
|
576
|
+
mintOut: string | null;
|
|
577
|
+
/** Base units of `mintIn` spent from the note (fee included). */
|
|
578
|
+
amountIn: string;
|
|
579
|
+
/** Relayer + platform fee, taken from `amountIn` in asset A. */
|
|
580
|
+
fee: string;
|
|
581
|
+
/** `amountIn - fee`, sold on the DEX. */
|
|
582
|
+
swapIn: string;
|
|
583
|
+
/** Expected output in base units of `mintOut`, computed by the SDK from the pool on-chain. */
|
|
584
|
+
amountOut: string;
|
|
585
|
+
/** Output lost to the trade size versus the pool's spot price (0..1). */
|
|
586
|
+
priceImpact: number;
|
|
587
|
+
dexProgram: string;
|
|
588
|
+
pool: string;
|
|
589
|
+
dexFeePercent: number;
|
|
590
|
+
/** Relayer reward account the quote is for. */
|
|
591
|
+
relayer: string;
|
|
592
|
+
relayerUrl: string;
|
|
593
|
+
};
|
|
594
|
+
type GetSwapQuoteParams = {
|
|
595
|
+
mintIn: MintInput;
|
|
596
|
+
mintOut: MintInput;
|
|
597
|
+
/** Base units of `mintIn` to spend (fee included). */
|
|
598
|
+
amountIn: bigint | number | string;
|
|
599
|
+
relayerUrl?: string;
|
|
600
|
+
};
|
|
601
|
+
type SwapParams = {
|
|
602
|
+
/** Secret note of asset A to spend. */
|
|
603
|
+
note: string;
|
|
604
|
+
/** Asset B tree mint (`null` / omitted for SOL). */
|
|
605
|
+
mintOut?: MintInput;
|
|
606
|
+
/** Base units of asset A to swap, fee included. Defaults to the full note. */
|
|
607
|
+
amount?: bigint | number | string;
|
|
608
|
+
/** Max price movement accepted, in basis points (default 100 = 1%). */
|
|
609
|
+
slippageBps?: number;
|
|
610
|
+
relayerUrl?: string;
|
|
611
|
+
};
|
|
612
|
+
type SwapRelayPayload = {
|
|
613
|
+
proof: string;
|
|
614
|
+
root: string;
|
|
615
|
+
inputNullifiers: [string, string];
|
|
616
|
+
outputCommitments: [string, string];
|
|
617
|
+
mintIn?: string;
|
|
618
|
+
mintOut?: string;
|
|
619
|
+
amountIn: string;
|
|
620
|
+
fee: string;
|
|
621
|
+
minAmountOut: string;
|
|
622
|
+
outPubkey: string;
|
|
623
|
+
outBlinding: string;
|
|
624
|
+
relayer: string;
|
|
625
|
+
encryptedOutput1: string;
|
|
626
|
+
encryptedOutput2: string;
|
|
627
|
+
encryptedNote: string;
|
|
628
|
+
};
|
|
629
|
+
type SwapRelayBundle = {
|
|
630
|
+
payload: SwapRelayPayload;
|
|
631
|
+
relayerUrl: string;
|
|
632
|
+
quote: SwapQuote;
|
|
633
|
+
amountIn: bigint;
|
|
634
|
+
fee: bigint;
|
|
635
|
+
minAmountOut: bigint;
|
|
636
|
+
/** Change of asset A (save it like any other note). */
|
|
637
|
+
changeNote: string | null;
|
|
638
|
+
/**
|
|
639
|
+
* Secret of the asset-B note, needed to spend it. The amount is only known once the
|
|
640
|
+
* swap lands; with an encryption key the note is also recoverable by scanning.
|
|
641
|
+
*/
|
|
642
|
+
output: {
|
|
643
|
+
mint: string | null;
|
|
644
|
+
privKey: string;
|
|
645
|
+
blinding: string;
|
|
646
|
+
};
|
|
647
|
+
nullifiers: string[];
|
|
648
|
+
};
|
|
649
|
+
type BuildSwapPayloadOptions = {
|
|
650
|
+
circuitArtifacts?: PreparedCircuitArtifacts;
|
|
651
|
+
tree?: VeilixMerkleTree;
|
|
652
|
+
};
|
|
653
|
+
type SwapResult = {
|
|
654
|
+
txHash: string;
|
|
655
|
+
status: "success" | "failed";
|
|
656
|
+
error?: string;
|
|
657
|
+
/** The asset-B note. Save it: it is the only way to spend the swapped funds. */
|
|
658
|
+
outputNote: string | null;
|
|
659
|
+
changeNote: string | null;
|
|
660
|
+
amountIn: string;
|
|
661
|
+
fee: string;
|
|
662
|
+
amountOut: string | null;
|
|
663
|
+
minAmountOut: string;
|
|
664
|
+
};
|
|
665
|
+
/** Note of the asset-B side once the swap has landed. Checks it against the chain. */
|
|
666
|
+
declare function swapOutputNote(output: SwapRelayBundle["output"], result: {
|
|
667
|
+
amountOut: string;
|
|
668
|
+
outputIndex: number;
|
|
669
|
+
outputCommitment: string;
|
|
670
|
+
}): string;
|
|
671
|
+
|
|
557
672
|
type ResolvedNoteAsset = {
|
|
558
673
|
key: string;
|
|
559
674
|
tokenName: TokenDecimalsSymbol;
|
|
@@ -642,7 +757,7 @@ declare class VeilixSDK {
|
|
|
642
757
|
getRiskApiUrl(): string;
|
|
643
758
|
getTokenMints(): {
|
|
644
759
|
Solana: string;
|
|
645
|
-
Veilix: "GAFN64LvtCBoc5BHncVn3JEJGpq42rUzQjPmvMK2UhZH";
|
|
760
|
+
Veilix: "GAFN64LvtCBoc5BHncVn3JEJGpq42rUzQjPmvMK2UhZH" | "Gmo636w21RBZX9ySVtPYcuYP6f1E5bdW5eBYhvK1bc8J";
|
|
646
761
|
Bitcoin: "" | "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh";
|
|
647
762
|
Ethereum: "" | "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs";
|
|
648
763
|
USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" | "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
|
|
@@ -691,6 +806,20 @@ declare class VeilixSDK {
|
|
|
691
806
|
/** Prove a withdrawal without submitting it (see {@link submitWithdrawPayload}). */
|
|
692
807
|
buildWithdrawPayload(params: WithdrawParams, options?: BuildWithdrawPayloadOptions): Promise<WithdrawRelayBundle>;
|
|
693
808
|
submitWithdrawPayload(bundle: WithdrawRelayBundle): Promise<WithdrawResult>;
|
|
809
|
+
/** Fee and expected output of swapping `amountIn` of `mintIn` into `mintOut`. */
|
|
810
|
+
getSwapQuote(params: GetSwapQuoteParams): Promise<{
|
|
811
|
+
quote: SwapQuote;
|
|
812
|
+
relayer: Relayer;
|
|
813
|
+
}>;
|
|
814
|
+
/**
|
|
815
|
+
* Swap a note of asset A into a new shielded note of asset B (`mintOut`, `null` for
|
|
816
|
+
* SOL) through a relayer and an allowlisted DEX. Funds never leave the pool
|
|
817
|
+
* unshielded. Returns the asset-B note and any asset-A change note.
|
|
818
|
+
*/
|
|
819
|
+
swap(params: SwapParams): Promise<SwapResult>;
|
|
820
|
+
/** Prove a swap without submitting it (see {@link submitSwapPayload}). */
|
|
821
|
+
buildSwapPayload(params: SwapParams, options?: BuildSwapPayloadOptions): Promise<SwapRelayBundle>;
|
|
822
|
+
submitSwapPayload(bundle: SwapRelayBundle): Promise<SwapResult>;
|
|
694
823
|
/**
|
|
695
824
|
* Private transfer: deposit one note per item, then withdraw each note in full
|
|
696
825
|
* to its recipient through the indexer submission queue.
|
|
@@ -778,4 +907,4 @@ declare class VeilixSDK {
|
|
|
778
907
|
static getProgramIdForNetwork(network: Network): string;
|
|
779
908
|
}
|
|
780
909
|
|
|
781
|
-
export {
|
|
910
|
+
export { type VeilixTransferResult as $, type SwapResult as A, type BuildDepositTxParams as B, type CommitmentStatus as C, type TokenSymbol as D, type EncryptKeyWallet as E, type FetchWalletBalanceOptions as F, type GenerateDepositParamsResult as G, type TransactionProof as H, type IndexedLeaf as I, type TreeAccountState as J, type TreeState as K, type TxStatus as L, type VeilixMerkleTree as M, type Network as N, VeilixSDK as O, type ParsedNote as P, type Quote as Q, type RelayPayload as R, type ScanOwnedNotesOptions as S, type TokenDecimalsSymbol as T, Utxo as U, VeilixKeypair as V, type VeilixSdkInitOptions as W, type VeilixSdkRuntimeConfig as X, type VeilixTransferDepositFailure as Y, type VeilixTransferItem as Z, type VeilixTransferOptions as _, type BuildRelayPayloadParams as a, type VeilixTransferWithdrawFailure as a0, type WithdrawParams as a1, type WithdrawRelayBundle as a2, type WithdrawResult as a3, type WithdrawStatus as a4, buildMerkleTree as a5, decodeNote as a6, decryptData as a7, decryptNoteOutput as a8, encodeNote as a9, encryptData as aa, encryptNoteOutput as ab, encryptSwapNoteOutput as ac, extDataHash as ad, formatNoteForDisplay as ae, getQuote as af, isLegacyNote as ag, mintToField as ah, parseSecretNote as ai, prepareCircuitArtifacts as aj, proveTransaction as ak, swapOutputNote as al, type BuildSwapPayloadOptions as b, type BuildWithdrawPayloadOptions as c, type ExtData as d, type GetQuoteParams as e, type GetQuoteResponse as f, type GetSwapQuoteParams as g, type IndexerAsset as h, NOTE_PREFIX as i, type NoteStatus as j, type NullifierStatus as k, type PlatformFeeWallet as l, type PoolTransaction as m, type PreparedCircuitArtifacts as n, type ProvedTransaction as o, type QuoteRelayer as p, type QuoteTransaction as q, type Relayer as r, type RelayerJob as s, type ResolvedNoteAsset as t, type Submission as u, type SubmissionItem as v, type SwapParams as w, type SwapQuote as x, type SwapRelayBundle as y, type SwapRelayPayload as z };
|