@marinade.finance/kamino-sdk
Version:
44 lines (43 loc) • 1.64 kB
TypeScript
import { TransactionInstruction, PublicKey } from '@solana/web3.js';
import BN from 'bn.js';
export interface SwapArgs {
amount: BN;
otherAmountThreshold: BN;
sqrtPriceLimitX64: BN;
isBaseInput: boolean;
}
export interface SwapAccounts {
/** 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;
tickArray: PublicKey;
}
export declare const layout: any;
/**
* Swaps one token for as much as possible of another token across a single pool
*
* # 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 swap(args: SwapArgs, accounts: SwapAccounts): TransactionInstruction;