PoolGraph: {
    getPath: ((startMint: Address, endMint: Address, options?: PathSearchOptions) => Path[]);
    getAllPaths(options?: PathSearchOptions): PathSearchEntries;
    getPathsForPairs(searchTokenPairs: [Address, Address][], options?: PathSearchOptions): PathSearchEntries;
}

A type representing an undirected graph of pools that can be used to find paths between two tokens. In this graph, nodes are token mints, and edges are pools

Type declaration

  • getPath: ((startMint: Address, endMint: Address, options?: PathSearchOptions) => Path[])

    Get a list of paths between two tokens for this pool graph.

    Notes:

    • Only support paths with up to 2 edges
    • Paths searching between two identical token mints are not supported.
      • (startMint, endMint, options?): Path[]
      • Parameters

        • startMint: Address

          The token the path starts from

        • endMint: Address

          The token the path ends in

        • Optionaloptions: PathSearchOptions

          Options for finding a path

        Returns Path[]

        A list of path between the two tokens. If no path are found, it will be an empty array.

  • getAllPaths:function
  • getPathsForPairs:function
    • Get a map of paths from a list of token pairs for this pool graph.

      Notes:

      • Only support paths with up to 2 edges
      • Paths searching between two identical token mints are not supported.

      Parameters

      • searchTokenPairs: [Address, Address][]

        A list of token pairs to find paths for. The first token in the pair is the start token, and the second token is the end token.

      • Optionaloptions: PathSearchOptions

        Options for finding a path

      Returns PathSearchEntries

      An array of search result entires in the same order as the searchTokenPairs.