Initiating a Swap
import { Wallet, providers, utils } from "ethers";
import { Mento } from "@mento-protocol/mento-sdk";
const privateKey = "YOUR_PRIVATE_KEY_HERE";
const provider = new providers.JsonRpcProvider(
"https://alfajores-forno.celo-testnet.org"
);
const signer = new Wallet(privateKey, provider);
const mento = await Mento.create(signer);const celoTokenAddr = "0xF194afDf50B03e69Bd7D057c1Aa9e10c9954E4C9";
const cUSDTokenAddr = "0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1";
const tokenUnits = 18; // both CELO and cUSD have 18 decimal places
const amountIn = utils.parseUnits("1", tokenUnits);
const quoteAmountOut = await mento.getAmountOut(
celoTokenAddr,
cUSDTokenAddr,
amountIn
);Last updated