Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COINGECKO_API_KEY=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add a trailing newline.

The file is missing a trailing newline at the end. Text files should end with a newline character per POSIX standards to ensure consistent behavior across tools and editors.

📝 Proposed fix
-COINGECKO_API_KEY=
+COINGECKO_API_KEY=
+

(Add a blank line after the last line)

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
COINGECKO_API_KEY=
COINGECKO_API_KEY=
🧰 Tools
🪛 dotenv-linter (4.0.0)

[warning] 1-1: [EndingBlankLine] No blank line at the end of the file

(EndingBlankLine)

🤖 Prompt for AI Agents
In @.env.example at line 1, The file ends without a trailing newline; add a
single newline character after the final line so the file ends with a blank line
(i.e., ensure the COINGECKO_API_KEY= line is followed by a newline/linefeed at
EOF).

1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/1-addTokenForm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ body:
- LENS
- LINEA
- PLASMA
- INK
validations:
required: true
- type: input
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/2-addImageForm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ body:
- LENS
- LINEA
- PLASMA
- INK
validations:
required: true
- type: input
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/3-removeTokenForm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ body:
- LENS
- LINEA
- PLASMA
- INK
validations:
required: true
- type: input
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/updatePermitInfo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false # continue parallel jobs even if individual parts fail
matrix:
chainId: [ 1, 56, 100, 137, 232, 8453, 9745, 42161, 43114, 59144 ] # all supported chains
chainId: [ 1, 56, 100, 137, 232, 8453, 9745, 42161, 43114, 57073, 59144 ] # all supported chains

steps:
- name: Checkout code
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ src/cowFi/TEMP*

# NPM setup
.npmrc

# Env files:
.env
.env.local
.env.*.local
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Instructions for setting up and running the various scripts locally

### Prerequisites

Currently runs on Node.js LTS/Gallium v16.20.2
Currently runs on Node.js v18 (as this scripts use `fetch`, which was introduced in Node.js 18)

```bash
# Install dependencies
Expand Down Expand Up @@ -106,4 +106,33 @@ The script generates token list files in `src/public/` for the following network
- Lens (CoinGecko.232.json, Uniswap.232.json)
- Linea (CoinGecko.59144.json, Uniswap.59144.json)
- Plasma (CoinGecko.9745.json, Uniswap.9745.json)
- Polygon (CoinGecko.137.json, Uniswap.137.json)
- Ink (CoinGecko.57073.json, Uniswap.57073.json)
- Polygon (CoinGecko.137.json, Uniswap.137.json)

### Adding a new network

To support a new network (e.g. Ink, chain ID 57073), run these steps in order:

1. **Generate auxiliary token lists** for the new chain (the chain must already be in `COINGECKO_CHAINS` in `src/scripts/auxLists/utils.ts`):

```bash
COINGECKO_API_KEY=your_key yarn generateAuxLists
```

This creates `src/public/CoinGecko.<chainId>.json` and `src/public/Uniswap.<chainId>.json` for the new network.

2. **Fetch permit info** for the new chain. The default token list (`CowSwap.json`) does not include tokens for new networks, so you must pass the path to the chain-specific list as the **second** argument:

```bash
yarn run fetchPermitInfo -- <chainId> CoinGecko.<chainId>.json
```

Example for Ink:

```bash
yarn run fetchPermitInfo -- 57073 CoinGecko.57073.json
```

Without the second argument, the script would use `CowSwap.json` and skip all tokens (they would have the wrong chainId), leaving the permit file empty.

3. **Include only the new network's files in your PR.** The scripts above may have updated files for other networks too; do not include those changes, as they are updated daily by a cron job.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,25 @@
"fetchPermitInfo:lens": "yarn run fetchPermitInfo -- 232",
"fetchPermitInfo:linea": "yarn run fetchPermitInfo -- 59144",
"fetchPermitInfo:plasma": "yarn run fetchPermitInfo -- 9745",
"fetchPermitInfo:ink": "yarn run fetchPermitInfo -- 57073",
"recheckPermitInfo:mainnet": "yarn run fetchPermitInfo -- 1 '' '' true",
"recheckPermitInfo:arb1": "yarn run fetchPermitInfo -- 42161 '' '' true",
"recheckPermitInfo:base": "yarn run fetchPermitInfo -- 8453 '' '' true",
"recheckPermitInfo:gnosis": "yarn run fetchPermitInfo -- 100 '' '' true",
"recheckPermitInfo:sepolia": "yarn run fetchPermitInfo -- 11155111 '' '' true",
"recheckPermitInfo:avalanche": "yarn run fetchPermitInfo -- 43114 '' '' true",
"recheckPermitInfo:polygon": "yarn run fetchPermitInfo -- 137 '' '' true",
"run-script": "node --loader ts-node/esm --experimental-json-modules --experimental-specifier-resolution=node",
"recheckPermitInfo:bnb": "yarn run fetchPermitInfo -- 56 '' '' true",
"recheckPermitInfo:lens": "yarn run fetchPermitInfo -- 232 '' '' true",
"recheckPermitInfo:linea": "yarn run fetchPermitInfo -- 59144 '' '' true",
"recheckPermitInfo:plasma": "yarn run fetchPermitInfo -- 9745 '' '' true",
"recheckPermitInfo:ink": "yarn run fetchPermitInfo -- 57073 '' '' true",
"run-script": "node --loader ts-node/esm --experimental-json-modules --experimental-specifier-resolution=node",
"test": "node --test"
},
"license": "(MIT OR Apache-2.0)",
"dependencies": {
"@cowprotocol/cow-sdk": "7.1.0",
"@cowprotocol/cow-sdk": "7.3.1",
"@cowprotocol/permit-utils": "^0.7.0-RC.1",
"@uniswap/token-lists": "^1.0.0-beta.33",
"ajv": "^8.17.1",
Expand Down
1 change: 1 addition & 0 deletions scripts/processRequest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const NETWORK_CONFIG = {
GNOSIS: { chainId: 100, blockExplorer: 'gnosisscan.io' },
LINEA: { chainId: 59144, blockExplorer: 'lineascan.build' },
PLASMA: { chainId: 9745, blockExplorer: 'plasmascan.to' },
INK: { chainId: 57073, blockExplorer: 'explorer.inkonchain.com' },
}

export const VALIDATION_RULES = {
Expand Down
1 change: 1 addition & 0 deletions src/permitInfo/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const DEFAULT_RPC_URLS: Record<SupportedChainId, string> = {
[SupportedChainId.LENS]: 'https://rpc.lens.xyz',
[SupportedChainId.LINEA]: 'https://rpc.linea.build',
[SupportedChainId.PLASMA]: 'https://rpc.plasma.to',
[SupportedChainId.INK]: 'https://rpc-ten.inkonchain.com',
}

export const BASE_PATH = join('..', 'public')
2 changes: 1 addition & 1 deletion src/permitInfo/utils/getTokensFromTokenList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function getTokensFromTokenList(
if (tokenListPath?.startsWith('http')) {
return (await fetch(tokenListPath).then((r) => r.json())).tokens
} else {
const filePath = tokenListPath ? tokenListPath : join(BASE_PATH, tokenListsByNetwork[chainId])
const filePath = tokenListPath ? join(BASE_PATH, tokenListPath) : join(BASE_PATH, tokenListsByNetwork[chainId])

return JSON.parse(readFileSync(filePath, 'utf-8')).tokens
}
Expand Down
Loading