Skip to content

Commit

Permalink
Merge pull request #152 from api3dao/moving-chains-to-phase21-organiz…
Browse files Browse the repository at this point in the history
…ation

Moving chains to phase21 organization #151
  • Loading branch information
hiletmis authored Jan 11, 2024
2 parents cd48309 + 565074d commit e9683b3
Show file tree
Hide file tree
Showing 6 changed files with 1,020 additions and 25 deletions.
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"access": "public",
"baseBranch": "main",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"ignore": [],
"linked": [],
"updateInternalDependencies": "patch"
}
29 changes: 29 additions & 0 deletions .github/workflows/dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Trigger on release

on:
release:
types: [published]
jobs:
Trigger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Repository Dispatch - Release logos
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.PAT }}
repository: api3dao/logos
event-type: release
- name: Repository Dispatch - Release dapi-management
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.PAT }}
repository: api3dao/dapi-management
event-type: release
- name: Repository Dispatch - Release data-collectors
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.PAT }}
repository: api3dao/data-collectors
event-type: release
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# https://github.com/changesets/action
name: Release

on:
push:
branches:
- phase21

env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: "18.x"

- name: Install dependencies
run: yarn --network-timeout 300000

- name: Build package
run: yarn build

- name: Create Release Pull Request or Publish to npm
uses: changesets/action@master
with:
publish: yarn release
commit: "ci: release packages"
title: "ci: release packages"
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ The single source of truth for chain-related information across API3 projects
## 📦 Installation

```sh
npm install @api3/chains --save
yarn add @api3/chains
pnpm add @api3/chains
npm install @phase21/chains --save
yarn add @phase21/chains
pnpm add @phase21/chains
```

## 📖 API
Expand All @@ -34,7 +34,7 @@ The single source of truth for the list of supported chains.
A static array of `Chain` objects.

```ts
import { CHAINS } from '@api3/chains';
import { CHAINS } from '@phase21/chains';
console.log(CHAINS);
/*
[
Expand All @@ -56,7 +56,7 @@ Returns an object where the key is each chain's alias and the value is an object
The default `url` values can be overridden with chain specific environment variables. These environment variables take the form of `HARDHAT_HTTP_RPC_URL_${toUpperSnakeCase(chain.alias)}`. e.g. `HARDHAT_HTTP_RPC_URL_ARBITRUM_GOERLI_TESTNET`.

```ts
import { hardhatConfig } from '@api3/chains';
import { hardhatConfig } from '@phase21/chains';
console.log(hardhatConfig.networks());
/*
{
Expand All @@ -77,7 +77,7 @@ Returns an object where the key is each chain's alias and the value is an object
NOTE: [hardhat-etherscan](https://www.npmjs.com/package/@nomiclabs/hardhat-etherscan) requires us to use a dummy API key with Blockscout block explorer APIs. We use "DUMMY_VALUE" but it could have been anything else.

```ts
import { hardhatConfig } from '@api3/chains';
import { hardhatConfig } from '@phase21/chains';
console.log(hardhatConfig.etherscan());
/*
{
Expand All @@ -98,7 +98,7 @@ Returns an array of expected environment variable names for chains that have an
NOTE: Each `ETHERSCAN_API_KEY_` and `HARDHAT_HTTP_RPC_URL_` environment variable has the chain alias as a suffix, where the alias has been converted to upper snake case.

```ts
import { hardhatConfig } from '@api3/chains';
import { hardhatConfig } from '@phase21/chains';
console.log(hardhatConfig.getEnvVariableNames());
/*
[
Expand All @@ -118,7 +118,7 @@ Returns an array of chains in the format that [Viem](https://viem.sh/docs/client
Additional `rpcUrls` values can (optionally) be added through the use of environment variables. These environment variables take the form of `API3_CHAINS_HTTP_RPC_URL_${toUpperSnakeCase(chain.alias)}`. If a matching environment variable is detected for a given chain, then it will be added to the `http` array of the `rpcUrls.environment` object. If no matching environment variable is detected, then the `http` array is left empty.

```ts
import { viemConfig } from '@api3/chains';
import { viemConfig } from '@phase21/chains';
console.log(viemConfig.chains());
/*
[
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@api3/chains",
"name": "@phase21/chains",
"license": "MIT",
"version": "4.2.0",
"version": "0.1.1",
"author": "API3 DAO",
"private": false,
"main": "./dist/index.js",
Expand All @@ -27,14 +27,17 @@
"providers:time": "ts-node scripts/calculate-average-block-times.ts",
"test": "jest",
"validate": "yarn validate:chains",
"validate:chains": "ts-node scripts/validate-chains.ts"
"validate:chains": "ts-node scripts/validate-chains.ts",
"release": "yarn changeset publish"
},
"dependencies": {
"viem": "^1.21.3",
"zod": "^3.22.4"
},
"devDependencies": {
"@api3/promise-utils": "^0.4.0",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@slack/web-api": "^6.11.0",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.6",
Expand Down
Loading

0 comments on commit e9683b3

Please sign in to comment.