UNPKG

@alcorexchange/alcor-swap-sdk

Version:

​​ **npm** ``` npm i @alcorexchange/alcor-swap-sdk ``` **yarn** ``` yarn add @alcorexchange/alcor-swap-sdk ``` ## Usage ### Import:

35 lines (34 loc) 1.06 kB
import { Token, Pool, Route } from '../entities'; /** * Fast WASM route finder with persistent pool storage * Pools are loaded once and can be updated dynamically */ export declare class WASMRouteFinder { private initialized; private poolsMap; /** * Initialize with pools - loads them into WASM memory */ initialize(pools: Pool[]): Promise<void>; /** * Update pools (add new or update existing) * @param pools - Array of pools to update/add */ updatePools(pools: Pool[]): Promise<void>; /** * Compute all routes between two tokens */ computeAllRoutes(tokenIn: Token, tokenOut: Token, maxHops: number): Route<Token, Token>[]; /** * Get the number of pools currently loaded */ getPoolCount(): number; /** * Clear all pools from memory */ clear(): void; } /** * Convenience function for one-off route computation */ export declare function computeAllRoutesWASM(tokenIn: Token, tokenOut: Token, pools: Pool[], maxHops: number): Promise<Route<Token, Token>[]>;