Skip to content

Commit

Permalink
Merge pull request #8 from hypercerts-org/feat/arbitrum_one_support
Browse files Browse the repository at this point in the history
feat(arbOne): update contracts package and expose arbOne deployment
  • Loading branch information
bitbeckers authored Sep 9, 2024
2 parents 559fc2c + ddd8cb2 commit 62257eb
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 10 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/dryrun-release-ci-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Build and release - staging

on:
pull_request:

jobs:
build-and-test:
name: Build and test
runs-on: ubuntu-latest
environment: test
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Run tests
run: pnpm test

semantic-release:
needs: build-and-test
if: "!contains(github.event.head_commit.message, '[skip ci]')"

name: Semantic Release
runs-on: ubuntu-latest
environment: staging
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Prepare prerelease semantic
if: github.ref != 'refs/heads/main'
run: mv .releaserc.prerelease.yaml .releaserc.yaml

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic # Need an `id` for output variables
with:
dry_run: true
extra_plugins: |
@semantic-release/commit-analyzer
@semantic-release/release-notes-generator
@semantic-release/changelog
@semantic-release/github
@semantic-release/npm
env:
GITHUB_TOKEN: ${{ secrets.GH_PA_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Do something when a new release published
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo ${{ steps.semantic.outputs.new_release_version }}
echo ${{ steps.semantic.outputs.new_release_major_version }}
echo ${{ steps.semantic.outputs.new_release_minor_version }}
echo ${{ steps.semantic.outputs.new_release_patch_version }}
4 changes: 2 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import tseslint from "typescript-eslint";


export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
{ files: ["**/*.{js,mjs,cjs,ts}"] },
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
],
"dependencies": {
"@graphql-typed-document-node/core": "^3.2.0",
"@hypercerts-org/contracts": "2.0.0-alpha.7",
"@hypercerts-org/contracts": "2.0.0-alpha.8",
"@openzeppelin/merkle-tree": "^1.0.7",
"@swc/core": "^1.6.3",
"ajv": "^8.11.2",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

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

5 changes: 5 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ const DEPLOYMENTS: { [key in SupportedChainIds]: Deployment } = {
addresses: deployments[84532],
isTestnet: true,
} as const,
42161: {
chainId: 42161,
addresses: deployments[42161],
isTestnet: false,
} as const,
421614: {
chainId: 421614,
addresses: deployments[421614],
Expand Down
2 changes: 1 addition & 1 deletion src/types/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ByteArray, Hex, PublicClient, WalletClient } from "viem";
import { AxiosRequestConfig } from "axios";

export type TestChainIds = 11155111 | 84532 | 421614;
export type ProductionChainIds = 10 | 42220 | 8453;
export type ProductionChainIds = 10 | 42220 | 8453 | 42161;

/**
* Enum to verify the supported chainIds
Expand Down
6 changes: 5 additions & 1 deletion src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import { createPublicClient, http } from "viem";
* - 11155111: Sepolia
* - 84532: Base Sepolia
* - 8453: Base Mainnet
* - 421613: Arbitrum Sepolia
* - 42161: Arbitrum One
* - 421614: Arbitrum Sepolia
*
* @param config - An object containing any configuration values to override. This should be a partial HypercertClientConfig object.
* @returns The final configuration object for the Hypercert client.
Expand All @@ -39,6 +40,7 @@ export const getConfig = (
};

const chainId = _config.walletClient?.chain?.id;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const writeAbleChainIds = Object.entries(_config.deployments).map(([_, deployment]) => deployment.chainId);

if (!_config.walletClient) {
Expand Down Expand Up @@ -73,6 +75,7 @@ export const getConfig = (
*/
export const getDeploymentsForEnvironment = (environment: Environment) => {
const deployments = Object.fromEntries(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Object.entries(DEPLOYMENTS).filter(([_, deployment]) => {
if (deployment.isTestnet && environment === "test") {
return deployment;
Expand Down Expand Up @@ -105,6 +108,7 @@ export const getDeploymentsForChainId = (chainId: SupportedChainIds) => {
logger.info("Indexer", "getDeploymentsForChainId", { chainId });

const deployments = Object.fromEntries(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Object.entries(DEPLOYMENTS).filter(([_, deployment]) => {
if (deployment.chainId === chainId) {
return deployment;
Expand Down

0 comments on commit 62257eb

Please sign in to comment.