Skip to content

Type issue when finding pool pairs? #68

@trezm

Description

@trezm

I've been using the BlockFrost adapter but noticed the code here, copied below and annotated for ease of reference:

  public async getV2PoolByPair(
    assetA: Asset,
    assetB: Asset
  ): Promise<PoolV2.State | null> {
    const [normalizedAssetA, normalizedAssetB] = normalizeAssets(
      Asset.toString(assetA),
      Asset.toString(assetB)
    ); // [string, string]
    const { pools: allPools } = await this.getAllV2Pools();
    return (
      allPools.find(
        (pool) =>
          pool.assetA /* Asset */ === normalizedAssetA /* string */ && pool.assetB /* Asset */ === normalizedAssetB /* string */
      ) ?? null
    );
  }

Is there some equality function or something that I'm missing here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions