Swap tokens on Uniswap.
npm install @goat-sdk/plugin-uniswap
yarn add @goat-sdk/plugin-uniswap
pnpm add @goat-sdk/plugin-uniswap
You can get your Uniswap API key here.
For testing purposes, you can use the following base URL and API key:
UNISWAP_BASE_URL="https://trade-api.gateway.uniswap.org/v1"
UNISWAP_API_KEY="kHEhfIPvCE3PO5PeT0rNb1CA3JJcnQ8r7kJDXN5X"
Use the plugin in your code:
import { uniswap } from "@goat-sdk/plugin-uniswap";
const plugin = uniswap({
baseUrl: process.env.UNISWAP_BASE_URL as string,
apiKey: process.env.UNISWAP_API_KEY as string,
});
- Get quote
- Swap tokens