diff --git a/README.md b/README.md index f4da3c4c..c992839a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,16 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next ## Getting Started -First, run the development server: +First, ensure you have a `.env.development.local` file with the following environment variables: + +* `NEXT_PUBLIC_API_URL`: Root URL of the Skip API server the frontend will query. The two acceptable values are: + * `https://api.skip.money/v1`: The stable, production API server + * `https://solve-dev.skip.money/v1`: The nightly, unstable dev server used for testing and previewing new functionality +(An example has been included in the repo under example.env). You *MUST* copy this to `env.development.local`. Internally, we use `env.development.local` to develop against the nightly API and `env.production.local` to develop against the stable one. + +## Develop + +Run the development server: ```bash npm run dev @@ -18,6 +27,16 @@ You can start editing the page by modifying `app/page.tsx`. The page auto-update This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. +## Build and Run + +```bash +npm run build && npm run start +# or +yarn build && yarn start +# or +pnpm build && pnpm start +``` + ## Learn More To learn more about Next.js, take a look at the following resources: diff --git a/example.env b/example.env new file mode 100644 index 00000000..55429bcb --- /dev/null +++ b/example.env @@ -0,0 +1,5 @@ +# production api +NEXT_PUBLIC_API_URL=https://api.skip.money/v1 + +# development API +# NEXT_PUBLIC_API_URL=https://solve-dev.skip.money/v1 \ No newline at end of file diff --git a/src/solve/api.ts b/src/solve/api.ts index 0065434d..99a6d4d4 100644 --- a/src/solve/api.ts +++ b/src/solve/api.ts @@ -1,8 +1,7 @@ import axios from "axios"; import { Affiliate, Chain, MultiChainMsg, Operation, SwapVenue } from "./types"; -const API_URL = "https://api.skip.money/v1"; - +const API_URL = `${process.env.NEXT_PUBLIC_API_URL}`; interface GetChainsResponse { chains: Chain[]; }