Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Commit

Permalink
Merge 01f0298 into b4bb9a8
Browse files Browse the repository at this point in the history
  • Loading branch information
shoom3301 committed Dec 13, 2023
2 parents b4bb9a8 + 01f0298 commit be0b772
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ REACT_APP_IPFS_READ_URI=https://cloudflare-ipfs.com/ipfs
# Sentry
#REACT_APP_SENTRY_DSN='https://<url>'
#REACT_APP_SENTRY_TRACES_SAMPLE_RATE="1.0"
#REACT_APP_SENTRY_AUTH_TOKEN='<sentry_auth_token>'
#REACT_APP_SENTRY_AUTH_TOKEN='<sentry_auth_token>'

# Orderbook API Endpoints
#REACT_APP_ORDER_BOOK_URLS='{"1":"https://YOUR_HOST","100":"https://YOUR_HOST","5":"https://YOUR_HOST"}
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ Gnosis Protocol is a fully permissionless DEX that enables ring trades to maximi
`Gnosis Protocol UI` contains:

- **Explorer**: Gnosis Protocol explorer. Allows you to explore the protocol orders and trades. For now Explorer is a WIP 👷‍♀️.
- **Trade**: Classical trading interface. For now it is just a WIP 👷‍♀️.
- **Trade**: Classical trading interface. For now it is just a WIP 👷‍♀️.
- **Legacy GP v1 UI**: Trading interface for Gnosis Protocol v1. It's the only app that is not generated automatically, but it can be run/built by following the instructions in this readme.
- **Story Book**: Showcases some of the components used in these apps.


## 🧪 Install dependencies
## 🧪 Install dependencies
```bash
# Install dependencies (we use Yarn but NPM should work too)
yarn
Expand All @@ -35,7 +35,7 @@ yarn
| Safe Swap | Gnosis Safe's Swap UI | `yarn start:safe-swap` | 🚧 `WIP: Under construction` |
| Trade UI | Classical trading UI | `yarn start:trade` | 🚧 `WIP: Just a not working prototype` |
| GP v1 Swap | Swap UI for Gnosis Protocol v1 | `yarn start:gp-v1` | |


Open http://localhost:8080 in your browser.

Expand All @@ -53,3 +53,16 @@ Static files will be generated inside the `./dist` dir.
```bash
yarn test
```

## Orderbook API Endpoints

Fee quote requests and posting orders are sent to the Orderbook API. This API has the responsibility of collecting orders and
handing them to the solvers.

The reference implementation of the API is [CoW Protocol Services](https://github.com/cowprotocol/services).

The API endpoint is configured using the environment variable `REACT_APP_ORDER_BOOK_URLS`:

```ini
REACT_APP_ORDER_BOOK_URLS='{"1":"https://YOUR_HOST","100":"https://YOUR_HOST","5":"https://YOUR_HOST"}
```
9 changes: 8 additions & 1 deletion src/cowSdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { SubgraphApi } from '@cowprotocol/cow-sdk'
import { MetadataApi } from '@cowprotocol/app-data'
import { SUBGRAPH_PROD_CONFIG } from '@cowprotocol/cow-sdk'

const prodBaseUrls = process.env.REACT_APP_ORDER_BOOK_URLS
? JSON.parse(process.env.REACT_APP_ORDER_BOOK_URLS)
: undefined

function getSubgraphUrls(): Record<SupportedChainId, string> {
const [mainnetUrl, gcUrl, goerliUrl] = [
process.env.REACT_APP_SUBGRAPH_URL_MAINNET || undefined,
Expand All @@ -18,6 +22,9 @@ function getSubgraphUrls(): Record<SupportedChainId, string> {
}
}

export const orderBookSDK = new OrderBookApi({ env: 'prod' })
export const orderBookSDK = new OrderBookApi({
env: 'prod',
...(prodBaseUrls ? { baseUrls: prodBaseUrls } : undefined),
})
export const subgraphApiSDK = new SubgraphApi({ baseUrls: getSubgraphUrls() })
export const metadataApiSDK = new MetadataApi()

0 comments on commit be0b772

Please sign in to comment.