goosefx-ssl-sdk
Version:
SDK for interacting with GooseFX Single-sided Liquidity pools
40 lines (39 loc) • 1.89 kB
TypeScript
import { Connection, PublicKey, TransactionInstruction } from "@solana/web3.js";
import * as wasm from "../wasm/gfx_ssl_wasm";
export { default as wasmData } from "../wasm/gfx_ssl_wasm_data";
export interface Quote {
amountIn: bigint;
fee: bigint;
amountOut: bigint;
impact: number;
swapPrice: number;
instantPrice: number;
oraclePrice: number;
}
export declare class Swap {
connection: Connection;
controller: PublicKey;
programId: PublicKey;
constructor(connection: Connection, controller?: PublicKey, programId?: PublicKey);
getWasm(): Promise<typeof wasm>;
getPairAddress: (tokenA: PublicKey, tokenB: PublicKey) => PublicKey;
createAssociatedTokenAccountIx: (mint: PublicKey, associatedAccount: PublicKey, owner: PublicKey) => TransactionInstruction;
getQuoter: (tokenIn: PublicKey, tokenOut: PublicKey) => Promise<Quoter>;
getQuote: (tokenIn: PublicKey, tokenOut: PublicKey, inTokenAmount: bigint, silent?: boolean) => Promise<Quote>;
getMinimumQuote: (tokenA: PublicKey, tokenB: PublicKey, inTokenAmount: bigint, slippage: number) => Promise<bigint>;
createSwapIx: (tokenA: PublicKey, tokenB: PublicKey, inTokenAmount: bigint, minOut: bigint, wallet: PublicKey, referrerTokenAccount?: PublicKey | undefined) => Promise<Array<TransactionInstruction>>;
}
declare class Quoter {
connection: Connection;
programId: PublicKey;
controller: PublicKey;
tokenIn: PublicKey;
tokenOut: PublicKey;
wasm: any;
private prepared;
constructor(connection: Connection, programId: PublicKey, controller: PublicKey, tokenIn: PublicKey, tokenOut: PublicKey, wasm: any);
prepare(): Promise<void>;
isSuspended(currentSlot?: bigint): boolean;
quote(inTokenAmount: bigint, silent?: boolean, niter?: number): Quote;
getPairAddress: (tokenA: PublicKey, tokenB: PublicKey) => PublicKey;
}