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

Create artifact package #38

Merged
merged 26 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.coverage_artifacts
.coverage_cache
.coverage_contracts
artifacts
packages/contracts/artifacts
build
cache
coverage
Expand Down Expand Up @@ -37,3 +37,9 @@ artifacts-zk
cache-zk
deployments-zk
deployments

generated
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved

# artifacts
temp_repo
packages/artifacts/src/abis/abis.ts
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 12 additions & 0 deletions packages/artifacts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Aragon OSx Commons Artifacts
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.4.0
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved

## Added
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved

- Add admin plugin's contracts artifacts of version 1.2.
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved
31 changes: 31 additions & 0 deletions packages/artifacts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Artifacts Package for Admin Plugin
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved

This package is responsible for generating and storing ABIs for smart contracts. It checks out the specified branch, compiles the contracts, and saves the ABIs in the `src/abis/` directory. The package can then be published to NPM for use in other projects.
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved

## Installation

Run the following command to install dependencies:
```sh
yarn install
```

## Usage
### Generate ABIs
Run:
```sh
yarn generate
```
This will:
1. Check out the `packages/contracts`.
2. Install dependencies.
3. Compile contracts using Hardhat.
4. Generate ABIs using Wagmi.
5. Save the ABIs in `src/abis/`.
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved

## Publishing

To publish the package to NPM, run:
```sh
yarn publish --access public
```
Ensure the package version is updated in `package.json` before publishing.
32 changes: 32 additions & 0 deletions packages/artifacts/generateAbis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -e # Exit on error

# Define directories
CONTRACTS_DIR="../contracts"
GENERATED_ABIS="../contracts/generated/abis.ts"
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved
OUTPUT_ABIS_DIR="src/abis"

# Move into contracts package and install dependencies
cd $CONTRACTS_DIR

yarn install

yarn build

yarn wagmi:generate

# Move back to artifacts package
cd -

# Ensure the output directory exists
mkdir -p "$OUTPUT_ABIS_DIR"

# Copy the generated ABIs to the output directory
if [ -f "$GENERATED_ABIS" ]; then
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved
cp "$GENERATED_ABIS" "$OUTPUT_ABIS_DIR/abis.ts"
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved
else
echo "Warning: generated/abis.ts not found."
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved
fi

echo "ABI generation complete. ABIs are stored in $OUTPUT_ABIS_DIR."
22 changes: 22 additions & 0 deletions packages/artifacts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@aragon/admin-plugin-artifacts",
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved
"author": "Aragon X",
"version": "1.4.0",
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved
"license": "AGPL-3.0-or-later",
"description": "The Aragon OSx Solidity contracts ABIs",
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved
"typings": "dist/index.d.ts",
"main": "dist/index.js",
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"generate": "bash generateAbis.sh"
},
"devDependencies": {
"typescript": "^5.5.4"
}
}
10 changes: 10 additions & 0 deletions packages/artifacts/src/addresses/addresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"network": {
"mainnet": {
"pluginRepo":""
},
"polygon": {
"pluginRepo":""
}
}
}
1 change: 1 addition & 0 deletions packages/artifacts/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './abis/abis';
Rekard0 marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions packages/artifacts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"declaration": true,
"outDir": "./dist"
},
"include": ["src"]
}
Loading
Loading