Getting Exchange Pairs
This guide will walk you through an example code snippet for instantiating the SDK and getting all tradeable pairs from exchanges configured in the broker contract within the Alfajores Celo testnet.
After installing the SDK, we can import it alongside Ethers:
To instantiate the Mento class we will need to pass an Ethers provider or signer object. This example will use a JsonRpcProvider
connected to forno, a public hosted node service operated by cLabs.
Now that the Mento class is instantiated, we can fetch all the pairs by calling the getTradeablePairs
method:
Which will output the list of pairs alongside their token addresses and symbols in an array format:
You can find the full runnable code for this section within the mento-sdk-examples repo:
Last updated