Using `getPairAddress()` with Avalanche . . .?

I’m finding that I’m unable to use getPairAddress() with AVAX. I receive an Invalid Exchange error. I’ve tried each of: uniswapv2, uniswapv3, sushiswapv2, pancakeswapv2, pancakeswapv1, quickswap.

I have no trouble with BSC, ETH, or MATIC. But AVAX is unhappy with any exchange I select. FYI, the provider setup (using 43114 chainId) seems to work fine for all other relevant calls that don’t involve an exchange.

What amazingly obvious thing am I missing? :thinking:

There’s no AVAX exchange supported currently with getPairAddress according to the docs.

Alternatively you can try using the API (if one exists) for the exchange where this pair address can be found or query the DEX contract directly (e.g. typically the main factory contract will have a getPair or similar function that you can call).

Hrm. Seems odd in light of this event. But fair enough.

Guess I can use the ABI with contract.token0()/token1() and then getTokenMetadata() on the individual tokens. Was just really trying to keep the flow. :woozy_face: