Skip to content

Commit 015d344

Browse files
Danzigeralfetopito
andauthored
feat(COW-163): Update cow-sdk version, add default RPC and run script for Ink (#1307)
* feat: update cow-sdk version, add default RPC and run script for Ink * fix: update auxUtils/utils records * fix: add .env.example and update .gitignore * feat: update token forms * chore: upgrade cow-sdk to 7.3.1 * fix: fix mapTokensListToBrige ABI function name and Node.js version in README * chore: update lists for Ink * Update README.md Co-authored-by: Leandro <alfetopito@users.noreply.github.com> --------- Co-authored-by: Leandro <alfetopito@users.noreply.github.com>
1 parent e09f66f commit 015d344

19 files changed

+556
-70
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
COINGECKO_API_KEY=

.github/ISSUE_TEMPLATE/1-addTokenForm.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ body:
4040
- LENS
4141
- LINEA
4242
- PLASMA
43+
- INK
4344
validations:
4445
required: true
4546
- type: input

.github/ISSUE_TEMPLATE/2-addImageForm.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ body:
3232
- LENS
3333
- LINEA
3434
- PLASMA
35+
- INK
3536
validations:
3637
required: true
3738
- type: input

.github/ISSUE_TEMPLATE/3-removeTokenForm.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ body:
3232
- LENS
3333
- LINEA
3434
- PLASMA
35+
- INK
3536
validations:
3637
required: true
3738
- type: input

.github/workflows/updatePermitInfo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false # continue parallel jobs even if individual parts fail
1818
matrix:
19-
chainId: [ 1, 56, 100, 137, 232, 8453, 9745, 42161, 43114, 59144 ] # all supported chains
19+
chainId: [ 1, 56, 100, 137, 232, 8453, 9745, 42161, 43114, 57073, 59144 ] # all supported chains
2020

2121
steps:
2222
- name: Checkout code

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ src/cowFi/TEMP*
2222

2323
# NPM setup
2424
.npmrc
25+
26+
# Env files:
27+
.env
28+
.env.local
29+
.env.*.local

README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Instructions for setting up and running the various scripts locally
5454

5555
### Prerequisites
5656

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

5959
```bash
6060
# Install dependencies
@@ -106,4 +106,33 @@ The script generates token list files in `src/public/` for the following network
106106
- Lens (CoinGecko.232.json, Uniswap.232.json)
107107
- Linea (CoinGecko.59144.json, Uniswap.59144.json)
108108
- Plasma (CoinGecko.9745.json, Uniswap.9745.json)
109-
- Polygon (CoinGecko.137.json, Uniswap.137.json)
109+
- Ink (CoinGecko.57073.json, Uniswap.57073.json)
110+
- Polygon (CoinGecko.137.json, Uniswap.137.json)
111+
112+
### Adding a new network
113+
114+
To support a new network (e.g. Ink, chain ID 57073), run these steps in order:
115+
116+
1. **Generate auxiliary token lists** for the new chain (the chain must already be in `COINGECKO_CHAINS` in `src/scripts/auxLists/utils.ts`):
117+
118+
```bash
119+
COINGECKO_API_KEY=your_key yarn generateAuxLists
120+
```
121+
122+
This creates `src/public/CoinGecko.<chainId>.json` and `src/public/Uniswap.<chainId>.json` for the new network.
123+
124+
2. **Fetch permit info** for the new chain. The default token list (`CowSwap.json`) will not include tokens for new networks yet if you haven't added any, so you must pass the path to the chain-specific list as the **second** argument:
125+
126+
```bash
127+
yarn run fetchPermitInfo -- <chainId> CoinGecko.<chainId>.json
128+
```
129+
130+
Example for Ink:
131+
132+
```bash
133+
yarn run fetchPermitInfo -- 57073 CoinGecko.57073.json
134+
```
135+
136+
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.
137+
138+
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.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,25 @@
3232
"fetchPermitInfo:lens": "yarn run fetchPermitInfo -- 232",
3333
"fetchPermitInfo:linea": "yarn run fetchPermitInfo -- 59144",
3434
"fetchPermitInfo:plasma": "yarn run fetchPermitInfo -- 9745",
35+
"fetchPermitInfo:ink": "yarn run fetchPermitInfo -- 57073",
3536
"recheckPermitInfo:mainnet": "yarn run fetchPermitInfo -- 1 '' '' true",
3637
"recheckPermitInfo:arb1": "yarn run fetchPermitInfo -- 42161 '' '' true",
3738
"recheckPermitInfo:base": "yarn run fetchPermitInfo -- 8453 '' '' true",
3839
"recheckPermitInfo:gnosis": "yarn run fetchPermitInfo -- 100 '' '' true",
3940
"recheckPermitInfo:sepolia": "yarn run fetchPermitInfo -- 11155111 '' '' true",
4041
"recheckPermitInfo:avalanche": "yarn run fetchPermitInfo -- 43114 '' '' true",
4142
"recheckPermitInfo:polygon": "yarn run fetchPermitInfo -- 137 '' '' true",
42-
"run-script": "node --loader ts-node/esm --experimental-json-modules --experimental-specifier-resolution=node",
4343
"recheckPermitInfo:bnb": "yarn run fetchPermitInfo -- 56 '' '' true",
4444
"recheckPermitInfo:lens": "yarn run fetchPermitInfo -- 232 '' '' true",
4545
"recheckPermitInfo:linea": "yarn run fetchPermitInfo -- 59144 '' '' true",
4646
"recheckPermitInfo:plasma": "yarn run fetchPermitInfo -- 9745 '' '' true",
47+
"recheckPermitInfo:ink": "yarn run fetchPermitInfo -- 57073 '' '' true",
48+
"run-script": "node --loader ts-node/esm --experimental-json-modules --experimental-specifier-resolution=node",
4749
"test": "node --test"
4850
},
4951
"license": "(MIT OR Apache-2.0)",
5052
"dependencies": {
51-
"@cowprotocol/cow-sdk": "7.1.0",
53+
"@cowprotocol/cow-sdk": "7.3.1",
5254
"@cowprotocol/permit-utils": "^0.7.0-RC.1",
5355
"@uniswap/token-lists": "^1.0.0-beta.33",
5456
"ajv": "^8.17.1",

scripts/processRequest.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const NETWORK_CONFIG = {
99
GNOSIS_CHAIN: { chainId: 100, blockExplorer: 'gnosisscan.io' },
1010
LINEA: { chainId: 59144, blockExplorer: 'lineascan.build' },
1111
PLASMA: { chainId: 9745, blockExplorer: 'plasmascan.to' },
12+
INK: { chainId: 57073, blockExplorer: 'explorer.inkonchain.com' },
1213
}
1314

1415
export const VALIDATION_RULES = {

src/permitInfo/const.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const DEFAULT_RPC_URLS: Record<SupportedChainId, string> = {
1717
[SupportedChainId.LENS]: 'https://rpc.lens.xyz',
1818
[SupportedChainId.LINEA]: 'https://rpc.linea.build',
1919
[SupportedChainId.PLASMA]: 'https://rpc.plasma.to',
20+
[SupportedChainId.INK]: 'https://rpc-ten.inkonchain.com',
2021
}
2122

2223
export const BASE_PATH = join('..', 'public')

0 commit comments

Comments
 (0)