@marinade.finance/kamino-sdk
Version:
50 lines (49 loc) • 1.9 kB
TypeScript
import { TransactionInstruction, PublicKey } from '@solana/web3.js';
import BN from 'bn.js';
export interface SwapV2Args {
amount: BN;
otherAmountThreshold: BN;
sqrtPriceLimitX64: BN;
isBaseInput: boolean;
}
export interface SwapV2Accounts {
/** The user performing the swap */
payer: PublicKey;
/** The factory state to read protocol fees */
ammConfig: PublicKey;
/** The program account of the pool in which the swap will be performed */
poolState: PublicKey;
/** The user token account for input token */
inputTokenAccount: PublicKey;
/** The user token account for output token */
outputTokenAccount: PublicKey;
/** The vault token account for input token */
inputVault: PublicKey;
/** The vault token account for output token */
outputVault: PublicKey;
/** The program account for the most recent oracle observation */
observationState: PublicKey;
/** SPL program for token transfers */
tokenProgram: PublicKey;
/** SPL program 2022 for token transfers */
tokenProgram2022: PublicKey;
memoProgram: PublicKey;
/** The mint of token vault 0 */
inputVaultMint: PublicKey;
/** The mint of token vault 1 */
outputVaultMint: PublicKey;
}
export declare const layout: any;
/**
* Swaps one token for as much as possible of another token across a single pool, support token program 2022
*
* # Arguments
*
* * `ctx` - The context of accounts
* * `amount` - Arranged in pairs with other_amount_threshold. (amount_in, amount_out_minimum) or (amount_out, amount_in_maximum)
* * `other_amount_threshold` - For slippage check
* * `sqrt_price_limit` - The Q64.64 sqrt price √P limit. If zero for one, the price cannot
* * `is_base_input` - swap base input or swap base output
*
*/
export declare function swapV2(args: SwapV2Args, accounts: SwapV2Accounts): TransactionInstruction;