Skip to content

Commit

Permalink
Create EVM contract metadata package (#1)
Browse files Browse the repository at this point in the history
* chore: add Hyperlane configs

* chore: add router addresses and mainnet addresses

* chore: update package.json

* chore: update package.json and remove index.html

* chore: add vitest

* chore: migrate to eslint.config.js

* chore: add tests

* chore: update package manager

* chore: update README

* chore: add github workflows

* chore: format code

* chore: enable corepack in workflows

* chore: code format

* chore: update check clean workflow

* chore: add corepack enable in workflow

* fix: ci

* fix: ci

* fix: ci

* chore: update workflows

* chore: add CODEOWNERS and PULL_REQUEST_TEMPLATE

* chore: add semantic-release

---------

Co-authored-by: Pavan Soratur <[email protected]>
  • Loading branch information
devpavan04 and Pavan Soratur authored Nov 7, 2024
1 parent 48f2cd4 commit 5a406c1
Show file tree
Hide file tree
Showing 38 changed files with 15,662 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# CODEOWNERS: https://help.github.com/articles/about-codeowners/

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# they will be requested for review when someone opens a pull request.
* @AtelyPham @devpavan04 @yurixander
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Summary of changes

_Provide a detailed description of proposed changes._

-

### Associated issue(s)

_Specify any issues that can be closed from these changes (e.g. `Closes #123`)._

- Closes
58 changes: 58 additions & 0 deletions .github/workflows/check-clean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: clean 🧹

on:
push:
branches:
- 'main'
pull_request:
branches: ['main', 'feat/**', 'feature/**']

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
format:
name: format
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: yarn install

- name: Format Check
run: yarn format:check

lint:
name: lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: yarn install

- name: Lint Check
run: yarn lint:check
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release 📦

on:
push:
branches:
- main

jobs:
release:
name: Release
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: yarn install

- name: Build
run: yarn build

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn semantic-release
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.yarn
.yarn-integrity
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"jsxSingleQuote": true,
"trailingComma": "none"
}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
71 changes: 70 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,70 @@
# evm-contract-metadata
# @tangle-network/evm-contract-metadata

This package contains the EVM contract addresses, bridge contracts, and configs, along with token addresses.

## Installation

To install this package, run:

```bash
yarn add @tangle-network/evm-contract-metadata
```

## Usage

You can import the following addresses, types, and configs from this package:

```typescript
import {
HyperlaneAddresses,
HyperlaneAddressesType,
HyperlaneChains,
HyperlaneChainEnum,
HyperlaneWarpRouteConfig,
HyperlaneWarpRouteWhitelist,
EVMTokens,
EVMTokenEnum,
EVMChainEnum
} from '@tangle-network/evm-contract-metadata';
```

- `HyperlaneAddresses` - Hyperlane contract addresses deployed by the Tangle Network. Contains core Hyperlane addresses like mailbox, IGP, router contracts, etc.
- `HyperlaneChains` - List of chains on which the Tangle Network has deployed Hyperlane contracts.
- `HyperlaneWarpRouteConfig` - Warp routes deployed by the Tangle Network used by the Tangle bridge dApp.
- `HyperlaneWarpRouteWhitelist` - List of warp route IDs whitelisted for use by the Tangle bridge dApp.
- `EVMTokens` - Object that maps EVM chains to the object containing different token addresses.

## Development

To run this package locally:

1. Clone the repository:

```bash
git clone https://github.com/tangle-network/evm-contract-metadata.git
```

2. Install dependencies:

```bash
yarn install
```

3. Build the package:

```bash
yarn build
```

4. Run tests:

```bash
yarn test
```

## Follow Tangle Network

- [Website](https://www.tangle.tools/)
- [X (Twitter)](https://x.com/tangle_network)
- [Telegram](https://t.me/tanglenet)
- [Discord](https://discord.gg/cv8EfJu3Tn)
35 changes: 35 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import eslint from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsparser from '@typescript-eslint/parser';
import prettier from 'eslint-plugin-prettier';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import importPlugin from 'eslint-plugin-import';

export default [
{
ignores: ['node_modules/**', 'dist/**']
},
eslint.configs.recommended,
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
}
},
plugins: {
'@typescript-eslint': tseslint,
'simple-import-sort': simpleImportSort,
prettier: prettier,
import: importPlugin
},
rules: {
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'prettier/prettier': 'error',
...tseslint.configs.recommended.rules
}
}
];
71 changes: 71 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"name": "@tangle-network/evm-contract-metadata",
"homepage": "https://www.tangle.tools/",
"repository": "https://github.com/tangle-network/evm-contract-metadata",
"version": "0.0.0",
"license": "MIT",
"type": "module",
"main": "./dist/evm-contract-metadata.umd.cjs",
"module": "./dist/evm-contract-metadata.js",
"types": "./dist/evm-contract-metadata.d.ts",
"files": [
"dist",
"README.md"
],
"exports": {
".": {
"import": "./dist/evm-contract-metadata.js",
"require": "./dist/evm-contract-metadata.umd.cjs",
"types": "./dist/evm-contract-metadata.d.ts"
}
},
"scripts": {
"build": "vite build",
"lint:check": "eslint \"src/**/*.{js,ts,tsx,json,yaml,yml}\"",
"lint:fix": "eslint 'src/**/*.{js,ts,json,yaml,yml}' --fix",
"format:check": "prettier --check \"**/*.{ts,js,json,yaml,yml}\"",
"format:fix": "prettier --write \"**/*.{ts,js,json,yaml,yml}\"",
"test": "vitest",
"semantic-release": "semantic-release"
},
"devDependencies": {
"@eslint/js": "^9.14.0",
"@semantic-release/commit-analyzer": "^13.0.0",
"@semantic-release/github": "^11.0.1",
"@semantic-release/npm": "^12.0.1",
"@semantic-release/release-notes-generator": "^14.0.1",
"@types/node": "^22.9.0",
"@typescript-eslint/eslint-plugin": "^8.13.0",
"@typescript-eslint/parser": "^8.13.0",
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-simple-import-sort": "^12.1.1",
"prettier": "^3.3.3",
"semantic-release": "^24.2.0",
"typescript": "~5.6.2",
"vite": "^5.4.10",
"vitest": "^2.1.4"
},
"dependencies": {
"@hyperlane-xyz/sdk": "^5.6.2",
"@hyperlane-xyz/utils": "^5.6.2",
"vite-plugin-dts": "^4.3.0"
},
"packageManager": "[email protected]",
"publishConfig": {
"access": "public"
},
"release": {
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github"
]
}
}
2 changes: 2 additions & 0 deletions src/EVM/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './tokens';
export * from './types';
31 changes: 31 additions & 0 deletions src/EVM/tokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { EVMChainEnum, EVMTokenEnum } from './types';

/**
* EVM tokens and their contract addresses.
*
* example:
*
* ```ts
* import { EVMChainEnum, EVMTokens } from '@tangle-network/evm-contract-metadata';
*
* const WETHAddressOnHolesky = EVMTokens[EVMChainEnum.Holesky].WETH;
* const USDTAddressOnTangleMainnet = EVMTokens[EVMChainEnum.TangleMainnet].USDT;
* ```
*/
export const EVMTokens = {
[EVMChainEnum.Holesky]: {
[EVMTokenEnum.WETH]: '0x94373a4919B3240D86eA41593D5eBa789FEF3848'
},
[EVMChainEnum.TangleTestnet]: {
[EVMTokenEnum.WETH]: '0x200DE548e393c38ee80482e9c5c186CBA7096ad4'
},
[EVMChainEnum.TangleMainnet]: {
[EVMTokenEnum.USDT]: '0xb6dc6c8b71e88642cead3be1025565a9ee74d1c6',
[EVMTokenEnum.USDC]: '0x97eec1c29f745dc7c267f90292aa663d997a601d',
[EVMTokenEnum.WETH]: '0x01b4ce0d48ce91eb6bcaf5db33870c65d641b894',
[EVMTokenEnum.AVAIL]: '0xb8a09939F27908505C4241C3c251f3DA33a207A9'
}
} as const satisfies Record<
EVMChainEnum,
Partial<Record<EVMTokenEnum, string>>
>;
Loading

0 comments on commit 5a406c1

Please sign in to comment.