@meteora-ag/zap-sdk 1.1.2 → 1.2.0-rc.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/README.md +23 -1
- package/dist/index.d.mts +25 -8
- package/dist/index.d.ts +25 -8
- package/dist/index.js +172 -101
- package/dist/index.mjs +173 -103
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -16,6 +16,25 @@ pnpm install @meteora-ag/zap-sdk
|
|
|
16
16
|
yarn add @meteora-ag/zap-sdk
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
## Jupiter API Setup
|
|
20
|
+
|
|
21
|
+
All Jupiter-related functions (`getJupiterQuote`, `getJupiterSwapInstruction`, and estimate functions) support custom API configuration.
|
|
22
|
+
|
|
23
|
+
### Getting Your Jupiter API Key
|
|
24
|
+
|
|
25
|
+
As of January 31st 2026, Jupiter requires an API key for all api request to https://api.jup.ag/. Obtain your API key at the [Jupiter Portal](https://portal.jup.ag/)
|
|
26
|
+
|
|
27
|
+
For detailed setup instructions, see [Jupiter's Setup Guide](https://dev.jup.ag/portal/setup).
|
|
28
|
+
|
|
29
|
+
### API Parameters
|
|
30
|
+
|
|
31
|
+
All Jupiter functions accept optional `jupiterApiUrl` and `jupiterApiKey` parameters:
|
|
32
|
+
|
|
33
|
+
- `jupiterApiUrl` (optional): The Jupiter API endpoint. Default: `"https://api.jup.ag"`
|
|
34
|
+
- `jupiterApiKey` (optional): Your Jupiter API key. Default: `""` (empty string)
|
|
35
|
+
|
|
36
|
+
**Note**: While the API key parameter is optional in the function signature, Jupiter requires an API key for all requests. Using the default empty string may result in API errors.
|
|
37
|
+
|
|
19
38
|
## Initialization
|
|
20
39
|
|
|
21
40
|
```typescript
|
|
@@ -23,7 +42,10 @@ import { Connection } from "@solana/web3.js";
|
|
|
23
42
|
import { Zap } from "@meteora-ag/zap-sdk";
|
|
24
43
|
|
|
25
44
|
const connection = new Connection("https://api.mainnet-beta.solana.com");
|
|
26
|
-
const
|
|
45
|
+
const jupiterApiUrl = "https://api.jup.ag";
|
|
46
|
+
const jupiterApiKey = "YOUR_API_KEY_HERE";
|
|
47
|
+
|
|
48
|
+
const zap = new Zap(connection, jupiterApiUrl, jupiterApiKey);
|
|
27
49
|
```
|
|
28
50
|
|
|
29
51
|
## Usage
|
package/dist/index.d.mts
CHANGED
|
@@ -1575,6 +1575,10 @@ type Zap$1 = {
|
|
|
1575
1575
|
};
|
|
1576
1576
|
|
|
1577
1577
|
type ZapProgram = Program<Zap$1>;
|
|
1578
|
+
type ZapConfig = {
|
|
1579
|
+
jupiterApiUrl?: string;
|
|
1580
|
+
jupiterApiKey?: string;
|
|
1581
|
+
};
|
|
1578
1582
|
type ZapOutParameters = IdlTypes<Zap$1>["zapOutParameters"];
|
|
1579
1583
|
type ZapOutParams = {
|
|
1580
1584
|
userTokenInAccount: PublicKey;
|
|
@@ -1799,6 +1803,7 @@ interface EstimateDlmmDirectSwapParams {
|
|
|
1799
1803
|
maxDeltaId: number;
|
|
1800
1804
|
strategy: StrategyType;
|
|
1801
1805
|
singleSided?: DlmmSingleSided;
|
|
1806
|
+
config?: ZapConfig;
|
|
1802
1807
|
}
|
|
1803
1808
|
interface DlmmDirectSwapEstimateContext {
|
|
1804
1809
|
amountIn: BN;
|
|
@@ -1830,6 +1835,7 @@ interface EstimateDlmmRebalanceSwapParams {
|
|
|
1830
1835
|
maxDeltaId: number;
|
|
1831
1836
|
swapSlippageBps: number;
|
|
1832
1837
|
strategy: StrategyType;
|
|
1838
|
+
config?: ZapConfig;
|
|
1833
1839
|
}
|
|
1834
1840
|
interface DlmmDirectRebalanceEstimateContext {
|
|
1835
1841
|
lbPair: PublicKey;
|
|
@@ -1854,6 +1860,7 @@ interface EstimateDlmmIndirectSwapParams {
|
|
|
1854
1860
|
maxDeltaId: number;
|
|
1855
1861
|
strategy: StrategyType;
|
|
1856
1862
|
singleSided?: DlmmSingleSided;
|
|
1863
|
+
config?: ZapConfig;
|
|
1857
1864
|
}
|
|
1858
1865
|
interface DlmmIndirectSwapEstimateResult {
|
|
1859
1866
|
swapToX: JupiterQuoteResponse | null;
|
|
@@ -1998,8 +2005,14 @@ type ZapInDlmmResponse = {
|
|
|
1998
2005
|
|
|
1999
2006
|
declare class Zap {
|
|
2000
2007
|
private connection;
|
|
2008
|
+
private jupiterApiUrl;
|
|
2009
|
+
private jupiterApiKey;
|
|
2001
2010
|
zapProgram: ZapProgram;
|
|
2002
|
-
|
|
2011
|
+
/**
|
|
2012
|
+
* @param connection - The connection to the Solana cluster
|
|
2013
|
+
* @param config - Optional configuration for Jupiter API URL (default: https://api.jup.ag) and API key (default: empty string)
|
|
2014
|
+
*/
|
|
2015
|
+
constructor(connection: Connection, config?: ZapConfig);
|
|
2003
2016
|
private initializeLedgerAccount;
|
|
2004
2017
|
private closeLedgerAccount;
|
|
2005
2018
|
private setLedgerBalance;
|
|
@@ -2232,9 +2245,9 @@ declare class Zap {
|
|
|
2232
2245
|
zapOutThroughDlmm(params: ZapOutThroughDlmmParams): Promise<Transaction>;
|
|
2233
2246
|
}
|
|
2234
2247
|
|
|
2235
|
-
declare function getJupiterQuote(inputMint: PublicKey, outputMint: PublicKey, amount: BN, maxAccounts: number, slippageBps: number, dynamicSlippage: boolean | undefined, onlyDirectRoutes: boolean, restrictIntermediateTokens: boolean,
|
|
2236
|
-
declare function getJupiterSwapInstruction(userPublicKey: PublicKey, quoteResponse: any,
|
|
2237
|
-
declare function buildJupiterSwapTransaction(user: PublicKey, inputMint: PublicKey, outputMint: PublicKey, amount: BN, maxAccounts: number, slippageBps: number, jupiterQuoteResponse?: JupiterQuoteResponse): Promise<{
|
|
2248
|
+
declare function getJupiterQuote(inputMint: PublicKey, outputMint: PublicKey, amount: BN, maxAccounts: number, slippageBps: number, dynamicSlippage: boolean | undefined, onlyDirectRoutes: boolean, restrictIntermediateTokens: boolean, config?: ZapConfig): Promise<JupiterQuoteResponse | null>;
|
|
2249
|
+
declare function getJupiterSwapInstruction(userPublicKey: PublicKey, quoteResponse: any, config?: ZapConfig): Promise<JupiterSwapInstructionResponse>;
|
|
2250
|
+
declare function buildJupiterSwapTransaction(user: PublicKey, inputMint: PublicKey, outputMint: PublicKey, amount: BN, maxAccounts: number, slippageBps: number, jupiterQuoteResponse?: JupiterQuoteResponse, config?: ZapConfig): Promise<{
|
|
2238
2251
|
transaction: Transaction;
|
|
2239
2252
|
quoteResponse: JupiterQuoteResponse;
|
|
2240
2253
|
}>;
|
|
@@ -2357,11 +2370,12 @@ declare function getExtraAccountMetasForTransferHook(connection: Connection, min
|
|
|
2357
2370
|
* @param params.maxDeltaId - Maximum bin delta from active bin
|
|
2358
2371
|
* @param params.strategy - Strategy type for the position
|
|
2359
2372
|
* @param params.singleSided - Optional single-sided deposit mode (X or Y only) - default is non-single-sided
|
|
2373
|
+
* @param params.config - Optional configuration for Jupiter API URL (default: https://api.jup.ag) and API key (default: empty string)
|
|
2360
2374
|
* @returns IndirectSwapEstimate with swap details and post-swap token amounts
|
|
2361
2375
|
* @throws if inputTokenMint matches any token in the DLMM pool
|
|
2362
2376
|
* @throws if failed to get Jupiter swap quote
|
|
2363
2377
|
*/
|
|
2364
|
-
declare function estimateDlmmIndirectSwap({ amountIn, inputTokenMint, lbPair, connection, swapSlippageBps, minDeltaId, maxDeltaId, strategy, singleSided, }: EstimateDlmmIndirectSwapParams): Promise<DlmmIndirectSwapEstimate>;
|
|
2378
|
+
declare function estimateDlmmIndirectSwap({ amountIn, inputTokenMint, lbPair, connection, swapSlippageBps, minDeltaId, maxDeltaId, strategy, singleSided, config, }: EstimateDlmmIndirectSwapParams): Promise<DlmmIndirectSwapEstimate>;
|
|
2365
2379
|
/**
|
|
2366
2380
|
* Calculate optimal swap amount for zap-in deposits (single token input)
|
|
2367
2381
|
*
|
|
@@ -2378,10 +2392,11 @@ declare function estimateDlmmIndirectSwap({ amountIn, inputTokenMint, lbPair, co
|
|
|
2378
2392
|
* @param params.maxDeltaId - Maximum bin delta from active bin
|
|
2379
2393
|
* @param params.strategy - Strategy type for the position
|
|
2380
2394
|
* @param params.singleSided - Optional single-sided deposit mode (X or Y only) - default is non-single-sided
|
|
2395
|
+
* @param params.config - Optional configuration for Jupiter API URL (default: https://api.jup.ag) and API key (default: empty string)
|
|
2381
2396
|
* @returns DirectSwapEstimate with swap details and post-swap token amounts
|
|
2382
2397
|
* @throws if failed to get both Jupiter and DLMM swap quotes
|
|
2383
2398
|
*/
|
|
2384
|
-
declare function estimateDlmmDirectSwap({ amountIn, inputTokenMint, lbPair, connection, swapSlippageBps, minDeltaId, maxDeltaId, strategy, singleSided, }: EstimateDlmmDirectSwapParams): Promise<DlmmDirectSwapEstimate>;
|
|
2399
|
+
declare function estimateDlmmDirectSwap({ amountIn, inputTokenMint, lbPair, connection, swapSlippageBps, minDeltaId, maxDeltaId, strategy, singleSided, config, }: EstimateDlmmDirectSwapParams): Promise<DlmmDirectSwapEstimate>;
|
|
2385
2400
|
/**
|
|
2386
2401
|
* Calculate optimal swap amount for rebalancing existing positions (both tokens)
|
|
2387
2402
|
*
|
|
@@ -2396,10 +2411,11 @@ declare function estimateDlmmDirectSwap({ amountIn, inputTokenMint, lbPair, conn
|
|
|
2396
2411
|
* @param params.minDeltaId - Minimum bin delta from active bin
|
|
2397
2412
|
* @param params.maxDeltaId - Maximum bin delta from active bin
|
|
2398
2413
|
* @param params.strategy - Strategy type for the position
|
|
2414
|
+
* @param params.config - Optional configuration for Jupiter API URL (default: https://api.jup.ag) and API key (default: empty string)
|
|
2399
2415
|
* @returns DirectSwapEstimate with swap details and post-swap token amounts
|
|
2400
2416
|
* @throws if failed to get both Jupiter and DLMM swap quotes
|
|
2401
2417
|
*/
|
|
2402
|
-
declare function estimateDlmmRebalanceSwap({ lbPair, position, connection, swapSlippageBps, minDeltaId, maxDeltaId, strategy, }: EstimateDlmmRebalanceSwapParams): Promise<DlmmDirectRebalanceEstimate>;
|
|
2418
|
+
declare function estimateDlmmRebalanceSwap({ lbPair, position, connection, swapSlippageBps, minDeltaId, maxDeltaId, strategy, config, }: EstimateDlmmRebalanceSwapParams): Promise<DlmmDirectRebalanceEstimate>;
|
|
2403
2419
|
|
|
2404
2420
|
declare const ZAP_PROGRAM_ID: PublicKey;
|
|
2405
2421
|
declare const JUP_V6_PROGRAM_ID: PublicKey;
|
|
@@ -2423,6 +2439,7 @@ declare const AMOUNT_IN_DLMM_OFFSET = 8;
|
|
|
2423
2439
|
declare const AMOUNT_IN_JUP_V6_REVERSE_OFFSET = 19;
|
|
2424
2440
|
declare const AMOUNT_IN_DAMM_V2_OFFSET = 8;
|
|
2425
2441
|
declare const DAMM_V2_SWAP_DISCRIMINATOR: number[];
|
|
2442
|
+
declare const DEFAULT_JUPITER_API_URL = "https://api.jup.ag";
|
|
2426
2443
|
|
|
2427
2444
|
var address = "zapvX9M3uf5pvy4wRPAbQgdQsM1xmuiFnkfHKPvwMiz";
|
|
2428
2445
|
var metadata = {
|
|
@@ -4304,4 +4321,4 @@ var idl = {
|
|
|
4304
4321
|
constants: constants
|
|
4305
4322
|
};
|
|
4306
4323
|
|
|
4307
|
-
export { AMOUNT_IN_DAMM_V2_OFFSET, AMOUNT_IN_DLMM_OFFSET, AMOUNT_IN_JUP_V6_REVERSE_OFFSET, AccountsType, BIN_ARRAY_INDEX_BOUND, DAMM_V2_PROGRAM_ID, DAMM_V2_SWAP_DISCRIMINATOR, DLMM_PROGRAM_ID, DLMM_SWAP_DISCRIMINATOR, type DlmmDirectEstimateResult, type DlmmDirectRebalanceEstimate, type DlmmDirectRebalanceEstimateContext, type DlmmDirectSwapEstimate, type DlmmDirectSwapEstimateContext, DlmmDirectSwapQuoteRoute, type DlmmIndirectSwapEstimate, type DlmmIndirectSwapEstimateContext, type DlmmIndirectSwapEstimateResult, DlmmSingleSided, DlmmSwapType, type EstimateDlmmDirectSwapParams, type EstimateDlmmIndirectSwapParams, type EstimateDlmmRebalanceSwapParams, type GetZapInDammV2DirectPoolParams, type GetZapInDammV2IndirectPoolParams, type GetZapInDlmmDirectParams, type GetZapInDlmmIndirectParams, JUP_V6_PROGRAM_ID, type JupiterInstruction, type JupiterQuoteResponse, type JupiterRoutePlan, type JupiterSwapInstructionResponse, MEMO_PROGRAM_ID, type ProgramStrategyType, type RebalanceDlmmPositionParams, type RebalanceDlmmPositionResponse, SwapExternalType, type SwapQuoteResult, ZAP_PROGRAM_ID, Zap, idl as ZapIdl, type ZapInDammV2DirectPoolParam, type ZapInDammV2IndirectPoolParam, ZapInDammV2PoolSwapRoute, type ZapInDammV2Response, type ZapInDlmmDirectPoolParam, type ZapInDlmmIndirectPoolParam, type ZapInDlmmResponse, type ZapOutParameters, type ZapOutParams, type ZapOutThroughDammV2Params, type ZapOutThroughDlmmParams, type ZapOutThroughJupiterParams, type ZapProgram, type Zap$1 as ZapTypes, buildJupiterSwapTransaction, convertAccountTypeToNumber, convertLamportsToUiAmount, convertUiAmountToLamports, createDammV2SwapPayload, createDlmmSwapPayload, deriveDammV2EventAuthority, deriveDammV2PoolAuthority, deriveDlmmEventAuthority, deriveLedgerAccount, estimateDlmmDirectSwap, estimateDlmmIndirectSwap, estimateDlmmRebalanceSwap, filterOutCloseSplTokenAccountInstructions, getBinArrayBitmapExtension, getBitFromBinArrayIndexInBitmapExtension, getDammV2Pool, getDammV2RemainingAccounts, getDlmmRemainingAccounts, getExtraAccountMetasForTransferHook, getJupiterQuote, getJupiterSwapInstruction, getLbPairState, getNextBinArrayIndexWithLiquidity, getOrCreateATAInstruction, getTokenAccountBalance, getTokenProgramFromMint, toProgramStrategyType, unwrapSOLInstruction, wrapSOLInstruction };
|
|
4324
|
+
export { AMOUNT_IN_DAMM_V2_OFFSET, AMOUNT_IN_DLMM_OFFSET, AMOUNT_IN_JUP_V6_REVERSE_OFFSET, AccountsType, BIN_ARRAY_INDEX_BOUND, DAMM_V2_PROGRAM_ID, DAMM_V2_SWAP_DISCRIMINATOR, DEFAULT_JUPITER_API_URL, DLMM_PROGRAM_ID, DLMM_SWAP_DISCRIMINATOR, type DlmmDirectEstimateResult, type DlmmDirectRebalanceEstimate, type DlmmDirectRebalanceEstimateContext, type DlmmDirectSwapEstimate, type DlmmDirectSwapEstimateContext, DlmmDirectSwapQuoteRoute, type DlmmIndirectSwapEstimate, type DlmmIndirectSwapEstimateContext, type DlmmIndirectSwapEstimateResult, DlmmSingleSided, DlmmSwapType, type EstimateDlmmDirectSwapParams, type EstimateDlmmIndirectSwapParams, type EstimateDlmmRebalanceSwapParams, type GetZapInDammV2DirectPoolParams, type GetZapInDammV2IndirectPoolParams, type GetZapInDlmmDirectParams, type GetZapInDlmmIndirectParams, JUP_V6_PROGRAM_ID, type JupiterInstruction, type JupiterQuoteResponse, type JupiterRoutePlan, type JupiterSwapInstructionResponse, MEMO_PROGRAM_ID, type ProgramStrategyType, type RebalanceDlmmPositionParams, type RebalanceDlmmPositionResponse, SwapExternalType, type SwapQuoteResult, ZAP_PROGRAM_ID, Zap, type ZapConfig, idl as ZapIdl, type ZapInDammV2DirectPoolParam, type ZapInDammV2IndirectPoolParam, ZapInDammV2PoolSwapRoute, type ZapInDammV2Response, type ZapInDlmmDirectPoolParam, type ZapInDlmmIndirectPoolParam, type ZapInDlmmResponse, type ZapOutParameters, type ZapOutParams, type ZapOutThroughDammV2Params, type ZapOutThroughDlmmParams, type ZapOutThroughJupiterParams, type ZapProgram, type Zap$1 as ZapTypes, buildJupiterSwapTransaction, convertAccountTypeToNumber, convertLamportsToUiAmount, convertUiAmountToLamports, createDammV2SwapPayload, createDlmmSwapPayload, deriveDammV2EventAuthority, deriveDammV2PoolAuthority, deriveDlmmEventAuthority, deriveLedgerAccount, estimateDlmmDirectSwap, estimateDlmmIndirectSwap, estimateDlmmRebalanceSwap, filterOutCloseSplTokenAccountInstructions, getBinArrayBitmapExtension, getBitFromBinArrayIndexInBitmapExtension, getDammV2Pool, getDammV2RemainingAccounts, getDlmmRemainingAccounts, getExtraAccountMetasForTransferHook, getJupiterQuote, getJupiterSwapInstruction, getLbPairState, getNextBinArrayIndexWithLiquidity, getOrCreateATAInstruction, getTokenAccountBalance, getTokenProgramFromMint, toProgramStrategyType, unwrapSOLInstruction, wrapSOLInstruction };
|
package/dist/index.d.ts
CHANGED
|
@@ -1575,6 +1575,10 @@ type Zap$1 = {
|
|
|
1575
1575
|
};
|
|
1576
1576
|
|
|
1577
1577
|
type ZapProgram = Program<Zap$1>;
|
|
1578
|
+
type ZapConfig = {
|
|
1579
|
+
jupiterApiUrl?: string;
|
|
1580
|
+
jupiterApiKey?: string;
|
|
1581
|
+
};
|
|
1578
1582
|
type ZapOutParameters = IdlTypes<Zap$1>["zapOutParameters"];
|
|
1579
1583
|
type ZapOutParams = {
|
|
1580
1584
|
userTokenInAccount: PublicKey;
|
|
@@ -1799,6 +1803,7 @@ interface EstimateDlmmDirectSwapParams {
|
|
|
1799
1803
|
maxDeltaId: number;
|
|
1800
1804
|
strategy: StrategyType;
|
|
1801
1805
|
singleSided?: DlmmSingleSided;
|
|
1806
|
+
config?: ZapConfig;
|
|
1802
1807
|
}
|
|
1803
1808
|
interface DlmmDirectSwapEstimateContext {
|
|
1804
1809
|
amountIn: BN;
|
|
@@ -1830,6 +1835,7 @@ interface EstimateDlmmRebalanceSwapParams {
|
|
|
1830
1835
|
maxDeltaId: number;
|
|
1831
1836
|
swapSlippageBps: number;
|
|
1832
1837
|
strategy: StrategyType;
|
|
1838
|
+
config?: ZapConfig;
|
|
1833
1839
|
}
|
|
1834
1840
|
interface DlmmDirectRebalanceEstimateContext {
|
|
1835
1841
|
lbPair: PublicKey;
|
|
@@ -1854,6 +1860,7 @@ interface EstimateDlmmIndirectSwapParams {
|
|
|
1854
1860
|
maxDeltaId: number;
|
|
1855
1861
|
strategy: StrategyType;
|
|
1856
1862
|
singleSided?: DlmmSingleSided;
|
|
1863
|
+
config?: ZapConfig;
|
|
1857
1864
|
}
|
|
1858
1865
|
interface DlmmIndirectSwapEstimateResult {
|
|
1859
1866
|
swapToX: JupiterQuoteResponse | null;
|
|
@@ -1998,8 +2005,14 @@ type ZapInDlmmResponse = {
|
|
|
1998
2005
|
|
|
1999
2006
|
declare class Zap {
|
|
2000
2007
|
private connection;
|
|
2008
|
+
private jupiterApiUrl;
|
|
2009
|
+
private jupiterApiKey;
|
|
2001
2010
|
zapProgram: ZapProgram;
|
|
2002
|
-
|
|
2011
|
+
/**
|
|
2012
|
+
* @param connection - The connection to the Solana cluster
|
|
2013
|
+
* @param config - Optional configuration for Jupiter API URL (default: https://api.jup.ag) and API key (default: empty string)
|
|
2014
|
+
*/
|
|
2015
|
+
constructor(connection: Connection, config?: ZapConfig);
|
|
2003
2016
|
private initializeLedgerAccount;
|
|
2004
2017
|
private closeLedgerAccount;
|
|
2005
2018
|
private setLedgerBalance;
|
|
@@ -2232,9 +2245,9 @@ declare class Zap {
|
|
|
2232
2245
|
zapOutThroughDlmm(params: ZapOutThroughDlmmParams): Promise<Transaction>;
|
|
2233
2246
|
}
|
|
2234
2247
|
|
|
2235
|
-
declare function getJupiterQuote(inputMint: PublicKey, outputMint: PublicKey, amount: BN, maxAccounts: number, slippageBps: number, dynamicSlippage: boolean | undefined, onlyDirectRoutes: boolean, restrictIntermediateTokens: boolean,
|
|
2236
|
-
declare function getJupiterSwapInstruction(userPublicKey: PublicKey, quoteResponse: any,
|
|
2237
|
-
declare function buildJupiterSwapTransaction(user: PublicKey, inputMint: PublicKey, outputMint: PublicKey, amount: BN, maxAccounts: number, slippageBps: number, jupiterQuoteResponse?: JupiterQuoteResponse): Promise<{
|
|
2248
|
+
declare function getJupiterQuote(inputMint: PublicKey, outputMint: PublicKey, amount: BN, maxAccounts: number, slippageBps: number, dynamicSlippage: boolean | undefined, onlyDirectRoutes: boolean, restrictIntermediateTokens: boolean, config?: ZapConfig): Promise<JupiterQuoteResponse | null>;
|
|
2249
|
+
declare function getJupiterSwapInstruction(userPublicKey: PublicKey, quoteResponse: any, config?: ZapConfig): Promise<JupiterSwapInstructionResponse>;
|
|
2250
|
+
declare function buildJupiterSwapTransaction(user: PublicKey, inputMint: PublicKey, outputMint: PublicKey, amount: BN, maxAccounts: number, slippageBps: number, jupiterQuoteResponse?: JupiterQuoteResponse, config?: ZapConfig): Promise<{
|
|
2238
2251
|
transaction: Transaction;
|
|
2239
2252
|
quoteResponse: JupiterQuoteResponse;
|
|
2240
2253
|
}>;
|
|
@@ -2357,11 +2370,12 @@ declare function getExtraAccountMetasForTransferHook(connection: Connection, min
|
|
|
2357
2370
|
* @param params.maxDeltaId - Maximum bin delta from active bin
|
|
2358
2371
|
* @param params.strategy - Strategy type for the position
|
|
2359
2372
|
* @param params.singleSided - Optional single-sided deposit mode (X or Y only) - default is non-single-sided
|
|
2373
|
+
* @param params.config - Optional configuration for Jupiter API URL (default: https://api.jup.ag) and API key (default: empty string)
|
|
2360
2374
|
* @returns IndirectSwapEstimate with swap details and post-swap token amounts
|
|
2361
2375
|
* @throws if inputTokenMint matches any token in the DLMM pool
|
|
2362
2376
|
* @throws if failed to get Jupiter swap quote
|
|
2363
2377
|
*/
|
|
2364
|
-
declare function estimateDlmmIndirectSwap({ amountIn, inputTokenMint, lbPair, connection, swapSlippageBps, minDeltaId, maxDeltaId, strategy, singleSided, }: EstimateDlmmIndirectSwapParams): Promise<DlmmIndirectSwapEstimate>;
|
|
2378
|
+
declare function estimateDlmmIndirectSwap({ amountIn, inputTokenMint, lbPair, connection, swapSlippageBps, minDeltaId, maxDeltaId, strategy, singleSided, config, }: EstimateDlmmIndirectSwapParams): Promise<DlmmIndirectSwapEstimate>;
|
|
2365
2379
|
/**
|
|
2366
2380
|
* Calculate optimal swap amount for zap-in deposits (single token input)
|
|
2367
2381
|
*
|
|
@@ -2378,10 +2392,11 @@ declare function estimateDlmmIndirectSwap({ amountIn, inputTokenMint, lbPair, co
|
|
|
2378
2392
|
* @param params.maxDeltaId - Maximum bin delta from active bin
|
|
2379
2393
|
* @param params.strategy - Strategy type for the position
|
|
2380
2394
|
* @param params.singleSided - Optional single-sided deposit mode (X or Y only) - default is non-single-sided
|
|
2395
|
+
* @param params.config - Optional configuration for Jupiter API URL (default: https://api.jup.ag) and API key (default: empty string)
|
|
2381
2396
|
* @returns DirectSwapEstimate with swap details and post-swap token amounts
|
|
2382
2397
|
* @throws if failed to get both Jupiter and DLMM swap quotes
|
|
2383
2398
|
*/
|
|
2384
|
-
declare function estimateDlmmDirectSwap({ amountIn, inputTokenMint, lbPair, connection, swapSlippageBps, minDeltaId, maxDeltaId, strategy, singleSided, }: EstimateDlmmDirectSwapParams): Promise<DlmmDirectSwapEstimate>;
|
|
2399
|
+
declare function estimateDlmmDirectSwap({ amountIn, inputTokenMint, lbPair, connection, swapSlippageBps, minDeltaId, maxDeltaId, strategy, singleSided, config, }: EstimateDlmmDirectSwapParams): Promise<DlmmDirectSwapEstimate>;
|
|
2385
2400
|
/**
|
|
2386
2401
|
* Calculate optimal swap amount for rebalancing existing positions (both tokens)
|
|
2387
2402
|
*
|
|
@@ -2396,10 +2411,11 @@ declare function estimateDlmmDirectSwap({ amountIn, inputTokenMint, lbPair, conn
|
|
|
2396
2411
|
* @param params.minDeltaId - Minimum bin delta from active bin
|
|
2397
2412
|
* @param params.maxDeltaId - Maximum bin delta from active bin
|
|
2398
2413
|
* @param params.strategy - Strategy type for the position
|
|
2414
|
+
* @param params.config - Optional configuration for Jupiter API URL (default: https://api.jup.ag) and API key (default: empty string)
|
|
2399
2415
|
* @returns DirectSwapEstimate with swap details and post-swap token amounts
|
|
2400
2416
|
* @throws if failed to get both Jupiter and DLMM swap quotes
|
|
2401
2417
|
*/
|
|
2402
|
-
declare function estimateDlmmRebalanceSwap({ lbPair, position, connection, swapSlippageBps, minDeltaId, maxDeltaId, strategy, }: EstimateDlmmRebalanceSwapParams): Promise<DlmmDirectRebalanceEstimate>;
|
|
2418
|
+
declare function estimateDlmmRebalanceSwap({ lbPair, position, connection, swapSlippageBps, minDeltaId, maxDeltaId, strategy, config, }: EstimateDlmmRebalanceSwapParams): Promise<DlmmDirectRebalanceEstimate>;
|
|
2403
2419
|
|
|
2404
2420
|
declare const ZAP_PROGRAM_ID: PublicKey;
|
|
2405
2421
|
declare const JUP_V6_PROGRAM_ID: PublicKey;
|
|
@@ -2423,6 +2439,7 @@ declare const AMOUNT_IN_DLMM_OFFSET = 8;
|
|
|
2423
2439
|
declare const AMOUNT_IN_JUP_V6_REVERSE_OFFSET = 19;
|
|
2424
2440
|
declare const AMOUNT_IN_DAMM_V2_OFFSET = 8;
|
|
2425
2441
|
declare const DAMM_V2_SWAP_DISCRIMINATOR: number[];
|
|
2442
|
+
declare const DEFAULT_JUPITER_API_URL = "https://api.jup.ag";
|
|
2426
2443
|
|
|
2427
2444
|
var address = "zapvX9M3uf5pvy4wRPAbQgdQsM1xmuiFnkfHKPvwMiz";
|
|
2428
2445
|
var metadata = {
|
|
@@ -4304,4 +4321,4 @@ var idl = {
|
|
|
4304
4321
|
constants: constants
|
|
4305
4322
|
};
|
|
4306
4323
|
|
|
4307
|
-
export { AMOUNT_IN_DAMM_V2_OFFSET, AMOUNT_IN_DLMM_OFFSET, AMOUNT_IN_JUP_V6_REVERSE_OFFSET, AccountsType, BIN_ARRAY_INDEX_BOUND, DAMM_V2_PROGRAM_ID, DAMM_V2_SWAP_DISCRIMINATOR, DLMM_PROGRAM_ID, DLMM_SWAP_DISCRIMINATOR, type DlmmDirectEstimateResult, type DlmmDirectRebalanceEstimate, type DlmmDirectRebalanceEstimateContext, type DlmmDirectSwapEstimate, type DlmmDirectSwapEstimateContext, DlmmDirectSwapQuoteRoute, type DlmmIndirectSwapEstimate, type DlmmIndirectSwapEstimateContext, type DlmmIndirectSwapEstimateResult, DlmmSingleSided, DlmmSwapType, type EstimateDlmmDirectSwapParams, type EstimateDlmmIndirectSwapParams, type EstimateDlmmRebalanceSwapParams, type GetZapInDammV2DirectPoolParams, type GetZapInDammV2IndirectPoolParams, type GetZapInDlmmDirectParams, type GetZapInDlmmIndirectParams, JUP_V6_PROGRAM_ID, type JupiterInstruction, type JupiterQuoteResponse, type JupiterRoutePlan, type JupiterSwapInstructionResponse, MEMO_PROGRAM_ID, type ProgramStrategyType, type RebalanceDlmmPositionParams, type RebalanceDlmmPositionResponse, SwapExternalType, type SwapQuoteResult, ZAP_PROGRAM_ID, Zap, idl as ZapIdl, type ZapInDammV2DirectPoolParam, type ZapInDammV2IndirectPoolParam, ZapInDammV2PoolSwapRoute, type ZapInDammV2Response, type ZapInDlmmDirectPoolParam, type ZapInDlmmIndirectPoolParam, type ZapInDlmmResponse, type ZapOutParameters, type ZapOutParams, type ZapOutThroughDammV2Params, type ZapOutThroughDlmmParams, type ZapOutThroughJupiterParams, type ZapProgram, type Zap$1 as ZapTypes, buildJupiterSwapTransaction, convertAccountTypeToNumber, convertLamportsToUiAmount, convertUiAmountToLamports, createDammV2SwapPayload, createDlmmSwapPayload, deriveDammV2EventAuthority, deriveDammV2PoolAuthority, deriveDlmmEventAuthority, deriveLedgerAccount, estimateDlmmDirectSwap, estimateDlmmIndirectSwap, estimateDlmmRebalanceSwap, filterOutCloseSplTokenAccountInstructions, getBinArrayBitmapExtension, getBitFromBinArrayIndexInBitmapExtension, getDammV2Pool, getDammV2RemainingAccounts, getDlmmRemainingAccounts, getExtraAccountMetasForTransferHook, getJupiterQuote, getJupiterSwapInstruction, getLbPairState, getNextBinArrayIndexWithLiquidity, getOrCreateATAInstruction, getTokenAccountBalance, getTokenProgramFromMint, toProgramStrategyType, unwrapSOLInstruction, wrapSOLInstruction };
|
|
4324
|
+
export { AMOUNT_IN_DAMM_V2_OFFSET, AMOUNT_IN_DLMM_OFFSET, AMOUNT_IN_JUP_V6_REVERSE_OFFSET, AccountsType, BIN_ARRAY_INDEX_BOUND, DAMM_V2_PROGRAM_ID, DAMM_V2_SWAP_DISCRIMINATOR, DEFAULT_JUPITER_API_URL, DLMM_PROGRAM_ID, DLMM_SWAP_DISCRIMINATOR, type DlmmDirectEstimateResult, type DlmmDirectRebalanceEstimate, type DlmmDirectRebalanceEstimateContext, type DlmmDirectSwapEstimate, type DlmmDirectSwapEstimateContext, DlmmDirectSwapQuoteRoute, type DlmmIndirectSwapEstimate, type DlmmIndirectSwapEstimateContext, type DlmmIndirectSwapEstimateResult, DlmmSingleSided, DlmmSwapType, type EstimateDlmmDirectSwapParams, type EstimateDlmmIndirectSwapParams, type EstimateDlmmRebalanceSwapParams, type GetZapInDammV2DirectPoolParams, type GetZapInDammV2IndirectPoolParams, type GetZapInDlmmDirectParams, type GetZapInDlmmIndirectParams, JUP_V6_PROGRAM_ID, type JupiterInstruction, type JupiterQuoteResponse, type JupiterRoutePlan, type JupiterSwapInstructionResponse, MEMO_PROGRAM_ID, type ProgramStrategyType, type RebalanceDlmmPositionParams, type RebalanceDlmmPositionResponse, SwapExternalType, type SwapQuoteResult, ZAP_PROGRAM_ID, Zap, type ZapConfig, idl as ZapIdl, type ZapInDammV2DirectPoolParam, type ZapInDammV2IndirectPoolParam, ZapInDammV2PoolSwapRoute, type ZapInDammV2Response, type ZapInDlmmDirectPoolParam, type ZapInDlmmIndirectPoolParam, type ZapInDlmmResponse, type ZapOutParameters, type ZapOutParams, type ZapOutThroughDammV2Params, type ZapOutThroughDlmmParams, type ZapOutThroughJupiterParams, type ZapProgram, type Zap$1 as ZapTypes, buildJupiterSwapTransaction, convertAccountTypeToNumber, convertLamportsToUiAmount, convertUiAmountToLamports, createDammV2SwapPayload, createDlmmSwapPayload, deriveDammV2EventAuthority, deriveDammV2PoolAuthority, deriveDlmmEventAuthority, deriveLedgerAccount, estimateDlmmDirectSwap, estimateDlmmIndirectSwap, estimateDlmmRebalanceSwap, filterOutCloseSplTokenAccountInstructions, getBinArrayBitmapExtension, getBitFromBinArrayIndexInBitmapExtension, getDammV2Pool, getDammV2RemainingAccounts, getDlmmRemainingAccounts, getExtraAccountMetasForTransferHook, getJupiterQuote, getJupiterSwapInstruction, getLbPairState, getNextBinArrayIndexWithLiquidity, getOrCreateATAInstruction, getTokenAccountBalance, getTokenProgramFromMint, toProgramStrategyType, unwrapSOLInstruction, wrapSOLInstruction };
|