@bayswap/sdk
Version:
SDK for BaySwap smart contract
62 lines (61 loc) • 1.56 kB
TypeScript
import { JsonRpcProvider, SuiObjectResponse } from '@mysten/sui.js';
import { SwapRegistry } from '../types';
export interface Currency {
type: string;
name: string;
symbol: string;
decimal: number;
logo?: string;
}
export interface OwnedCoin {
type: string;
id: string;
balance: bigint;
}
export interface EventCreatedCoin {
coinSymbol: string;
coinType: string;
treasuryCapID: string;
}
export type CommonPoolInfo = {
coinX: string;
coinY: string;
curve: string;
creator: string;
poolID: string;
};
export interface DetailedPoolInfo {
id: string;
name: string;
fullType: string;
coinX: string;
coinY: string;
curve: string;
coinXReserve: bigint;
coinYReserve: bigint;
feePercent: bigint;
xScale: bigint;
yScale: bigint;
isLocked: boolean;
lpTokenSupply: {
value: bigint;
type: string;
};
}
export type AllBalances = {
[coinType: string]: {
symbol: string;
balance: bigint;
};
};
export declare class QueryModule {
protected _provider: JsonRpcProvider;
protected _registry: SwapRegistry;
constructor(provider: JsonRpcProvider, registry: SwapRegistry);
getAllPools(): Promise<CommonPoolInfo[]>;
getAllTestTokens(): Promise<EventCreatedCoin[]>;
parsePool(resp: SuiObjectResponse): DetailedPoolInfo;
getPool(poolId: string): Promise<DetailedPoolInfo>;
getPoolBatch(poolIds: string[]): Promise<DetailedPoolInfo[]>;
getAllBalances(owner: string): Promise<AllBalances>;
}