UNPKG

@flipflop-sdk/node

Version:

FlipFlop Node.js SDK for programmatic token operations

146 lines (145 loc) 3.3 kB
import { BN } from "@coral-xyz/anchor"; import { Connection, Keypair, PublicKey } from "@solana/web3.js"; export interface AddLiquidityOptions { rpc: string; mint: PublicKey; tokenAmount: number; slippage: number; payer: Keypair; } export interface AddLiquidityResponse { signature: string; mintAddress: PublicKey; tokenAmount: BN; solAmount: BN; lpTokenAmount: BN; poolAddress: PublicKey; } export interface BurnLiquidityOptions { rpc: string; mint: PublicKey; lpTokenAmount: number; burner: Keypair; } export interface BurnLiquidityResponse { signature: string; mintAddress: PublicKey; burnedLpTokenAmount: number; lpMintAddress: PublicKey; poolAddress: PublicKey; } export interface BuyTokenOptions { rpc: string; mint: PublicKey; amount: number; slippage?: number; payer: Keypair; } export interface BuyTokenResponse { mintAddress: PublicKey; solAmount: number; tokenAmount: number; poolAddress: PublicKey; txId: string; } export interface CreatePoolOptions { rpc: string; mintA: PublicKey; mintB: PublicKey; amountA: number; amountB: number; creator: Keypair; startTime?: number; } export interface CreatePoolResponse { signature: string; poolAddress: PublicKey; mintA: PublicKey; mintB: PublicKey; amountA: BN; amountB: BN; creator: PublicKey; } export interface DisplayLPOptions { rpc: string; owner: PublicKey; mint: PublicKey; } export interface LPDisplayResponse { poolId: PublicKey; lpTokenMint: PublicKey; lpTokenBalance: BN; shareOfPool: number; tokenAAmount: BN; tokenBAmount: BN; poolInfo: DisplayPoolResponse; } export interface DisplayPoolOptions { connection: Connection; tokenAMint: PublicKey; tokenBMint: PublicKey; rpc?: string; } export interface DisplayPoolResponse { poolAddress: PublicKey; configId: PublicKey; poolCreator: PublicKey; vaultA: PublicKey; vaultB: PublicKey; mintLp: PublicKey; mintA: PublicKey; mintB: PublicKey; mintProgramA: PublicKey; mintProgramB: PublicKey; observationId: PublicKey; bump: number; status: number; lpDecimals: number; mintDecimalA: number; mintDecimalB: number; lpAmount: BN; protocolFeesMintA: BN; protocolFeesMintB: BN; fundFeesMintA: BN; fundFeesMintB: BN; openTime: BN; programId: PublicKey; baseReserve: BN; quoteReserve: BN; vaultAAmount: BN; vaultBAmount: BN; configInfo: any; poolPrice: number; lpMint: PublicKey; } export interface RemoveLiquidityOptions { rpc: string; payer: Keypair; mint: PublicKey; removePercentage: number; slippage?: number; } export interface RemoveLiquidityResponse { signature?: string; tokenAAmount?: BN; tokenBAmount?: BN; } export interface SellTokenOptions { rpc: string; mint: PublicKey; amount: number; slippage?: number; seller: Keypair; } export interface SellTokenResponse { mintAddress: PublicKey; tokenAmount: number; solAmount: number; poolAddress: PublicKey; txId: string; } export interface ApiResponse<T> { success: boolean; data?: T; message?: string; }