Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: finish setup of token list #1

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
37 changes: 37 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy to GitHub Pages

on:
push:
branches: [main]
paths:
- "tokens/**"

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Validate token list
run: npm run validate

- name: Create dist directory
run: |
mkdir -p dist
cp tokens/token-list.json dist/
cp tokens/token-list.json dist/latest.json

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
32 changes: 32 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: PR Validation

on:
pull_request:
branches: [main]
paths:
- "tokens/**"
- "src/**"
- "tests/**"
- "package.json"
- "package-lock.json"

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Validate token list
run: npm run validate
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
dist
5 changes: 5 additions & 0 deletions .husky/_/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
npm run format
npm run check
git add -A
npm run validate
78 changes: 78 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Contributing to Request Network Token List

We love your input! We want to make contributing to the Request Network Token List as easy and transparent as possible, whether it's:

- Adding new tokens
- Reporting a bug
- Discussing the current state of the token list
- Submitting a fix
- Proposing new features

## Token Requirements

To add a token to the list, ensure it meets the following criteria:

1. The token must be deployed on a supported blockchain network
2. The token contract must be verified on the respective blockchain explorer
3. The token must be actively used or intended for use within the Request Network ecosystem
4. Logo requirements:
- PNG or SVG format
- Recommended size: 128x128px
- Maximum file size: 100KB

## Adding a New Token

1. Fork the repository
2. Create a new branch: `git checkout -b add-token-NAME`
3. Add your token information to `tokens/token-list.json`
4. Add your token's logo to `tokens/assets/`
5. Run tests locally: `npm test`
6. Commit your changes: `git commit -m 'Add TOKEN_NAME token'`
7. Push to the branch: `git push origin add-token-NAME`
8. Submit a Pull Request

### Token Information Format

```json
{
"name": "Token Name",
"address": "0x...",
"symbol": "TKN",
"decimals": 18,
"chainId": 1,
"logoURI": "https://..."
}
```

## Pull Request Process

1. Ensure your PR includes all required token information
2. Update the README.md with details of changes if needed
3. The PR will be merged once you have the sign-off of at least one maintainer
4. All CI checks must pass before merging

## Any contributions you make will be under the MIT Software License

When you submit code changes, your submissions are understood to be under the same [MIT License](LICENSE) that covers the project. Feel free to contact the maintainers if that's a concern.

## Report bugs using Github's [issue tracker](issues)

We use GitHub issues to track public bugs. Report a bug by [opening a new issue](issues/new).

## Write bug reports with detail, background, and sample code

**Great Bug Reports** tend to have:

- A quick summary and/or background
- Steps to reproduce
- What you expected would happen
- What actually happens
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)

## License

By contributing, you agree that your contributions will be licensed under its MIT License.

## References

This document was adapted from the open-source contribution guidelines for [Facebook's Draft](https://github.com/facebook/draft-js/blob/a9316a723f9e918afde44dea68b5f9f39b7d9b00/CONTRIBUTING.md).
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Request Network

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
83 changes: 83 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Request Network Token List

A comprehensive token list for Request Network products, containing verified tokens that can be used across the Request Network ecosystem.

## Overview

This repository contains a curated list of tokens supported by Request Network products. The token list follows a standardized format and includes essential information about each token, such as address, symbol, name, decimals, and chainId.

## Usage

The token list is available at:
`[TOKEN_LIST_URL]`

You can fetch the token list directly in your application:

```typescript
const tokenList = await fetch("TOKEN_LIST_URL").then((res) => res.json());
```

## Token List Structure

Each token in the list contains the following information:

```json
{
"name": "Token Name",
"address": "0x...",
"symbol": "TKN",
"decimals": 18,
"chainId": 1,
"logoURI": "https://..."
}
```

## Adding a New Token

We welcome community contributions! To add a new token to the list:

1. Fork this repository
2. Add your token information to `tokens/token-list.json`
3. Make sure your token meets our requirements (see [CONTRIBUTING.md](./CONTRIBUTING.md))
4. Run tests locally: `npm test`
5. Create a Pull Request

## Development

### Prerequisites

- Node.js (v14 or higher)
- npm or yarn

### Installation

```bash
npm install
```

### Testing

```bash
npm test
```

## Validation

All tokens undergo automatic validation through our CI/CD pipeline to ensure:

- Valid token addresses
- Correct token information
- Logo availability and format
- Compliance with schema requirements

## License

This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.

## Contributing

Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.

## Security

For security concerns, please submit an issue or contact the Request Network team.
10 changes: 10 additions & 0 deletions examples/token.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "dai-mainnet",
"name": "Dai Stablecoin",
"symbol": "DAI",
"decimals": 18,
"address": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"network": "mainnet",
"type": "ERC20",
"logoURI": "https://raw.githubusercontent.com/requestNetwork/token-list/main/tokens/assets/dai-mainnet.svg"
}
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"test": "vitest",
"format": "biome format . --write",
"lint": "biome lint .",
"check": "biome check --apply ."
"check": "biome check --apply .",
"prepare": "husky"
},
"keywords": [
"request-network",
Expand All @@ -25,6 +26,7 @@
"devDependencies": {
"@types/node": "^22.10.5",
"biome": "^0.3.3",
"husky": "^9.1.7",
"tsx": "^4.19.2",
"typescript": "^5.7.2",
"vitest": "^2.1.8"
Expand Down
24 changes: 24 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface RequestToken {
decimals: number;
address: string;
network: NetworkType;
chainId: number;
type: TokenType;
hash?: string;
logoURI?: string;
Expand Down Expand Up @@ -49,4 +50,27 @@ export enum NetworkType {
ZKSYNCERA = "zksyncera",
ZKSYNCERATESTNET = "zksynceratestnet",
BASE = "base",
FIAT = "fiat",
}

export const CHAIN_IDS: Record<string, number> = {
mainnet: 1,
matic: 137,
fantom: 250,
bsc: 56,
xdai: 100,
avalanche: 43114,
optimism: 10,
moonbeam: 1284,
sepolia: 11155111,
fuse: 122,
"arbitrum-one": 42161,
tombchain: 6969,
mantle: 5000,
"mantle-testnet": 5001,
core: 1116,
zksyncera: 324,
zksynceratestnet: 300,
base: 8453,
fiat: 0, // Special case for fiat currencies
};
Loading
Loading