diff --git a/.changeset/README.md b/.changeset/README.md new file mode 100644 index 000000000..e5b6d8d6a --- /dev/null +++ b/.changeset/README.md @@ -0,0 +1,8 @@ +# Changesets + +Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works +with multi-package repos, or single-package repos to help you version and publish your code. You can +find the full documentation for it [in our repository](https://github.com/changesets/changesets) + +We have a quick list of common questions to get you started engaging with this project in +[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 000000000..976d50dbe --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json", + "changelog": "@changesets/cli/changelog", + "commit": false, + "fixed": [ + [ + "@hashgraph/asset-tokenization-contracts", + "@hashgraph/asset-tokenization-sdk", + "@hashgraph/asset-tokenization-dapp" + ] + ], + "linked": [], + "access": "restricted", + "baseBranch": "main", + "updateInternalDependencies": "patch", + "ignore": [] +} diff --git a/.github/README.md b/.github/README.md new file mode 100644 index 000000000..c196a2e9a --- /dev/null +++ b/.github/README.md @@ -0,0 +1,352 @@ +# GitHub Workflows Documentation + +This document explains the CI/CD system for the Asset Tokenization Studio (ATS) monorepo, including development workflow, release processes, and how to work with changesets. + +## Overview + +The repository uses **Changesets** for version management with independent release cycles for: + +- **ATS Project**: Asset Tokenization Studio (contracts, SDK, web app) +- **Mass Payout Project**: Mass payout functionality + +All development happens on the `develop` branch with automated testing, changeset validation, and manual release controls by authorized teams. + +## How to test github workflows locally + +To be able to test github workflows locally you can use act, a github actions simulator [act homepage](https://nektosact.com/introduction.html) + +### Install act + +```bash +curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash +``` + +### Run workflow + +Substitute \ for the workflow you want to test (ats.pubilsh, mp.release, ...) + +```bash +./bin/act workflow_dispatch \ + -W .github/workflows/.yml \ + --input dry-run-enabled=true \ + -s NPM_TOKEN=fake_token \ + -P token-studio-linux-large=catthehacker/ubuntu:act-latest +``` + +## Developer Workflow + +### Daily Development Process + +```mermaid +sequenceDiagram + participant D as develop + participant F as feature/branch + participant M as main + participant F1 as feature/branch-main + + Note over D,M: Daily Development Pattern + + D->>F: Create feature branch + Note over F: Code changes + changeset + F->>D: PR with changeset (tests + validation) + Note over D: Accumulate features + + D->>F1: Create branch from develop + Note over F1: Same changes (no changeset needed) + F1->>M: PR to main (ready for release) + Note over M: Production-ready code +``` + +### Step-by-Step Guide + +1. **Create feature branch from develop**: + + ```bash + git checkout develop && git pull origin develop + git checkout -b feature/your-feature-name + ``` + +2. **Make your changes** to ATS or Mass Payout packages + +3. **Create changeset** (required for all PRs): + + ```bash + npm run changeset + ``` + + - Select affected packages + - Choose change type (patch/minor/major) + - Write clear description + +4. **Commit with DCO and Signature compliance**: + +Commit messages should comply with the [conventional commits standard](https://www.conventionalcommits.org/en/v1.0.0/) + +```bash +git add . +git commit --signoff -S -m "feat: your commit message" +git push origin feature/your-feature-name +``` + +5. **Open PR to develop branch** - automated checks will run + +### Bypass Changeset Validation + +For non-feature changes, add these labels to skip changeset requirement: + +- `no-changeset`: Configuration or documentation changes +- `docs-only`: Documentation-only changes +- `chore`: Build system or dependency updates +- `hotfix`: Emergency fixes + +## Workflow Reference + +### Automated Workflows + +| Workflow | Trigger | Purpose | +| --------------------- | ---------------------------- | ------------------------------------- | +| **ATS Tests** | PR to main, ATS file changes | Run ATS contracts, SDK, and web tests | +| **Mass Payout Tests** | PR to main, MP file changes | Run Mass Payout package tests | +| **Changeset Check** | PR to develop | Validate changeset or bypass labels | + +### Manual Release Workflows + +| Workflow | Purpose | Authorized Teams | +| ----------------------- | ------------------------------------ | ------------------------------------------------------------ | +| **ATS Release** | Version ATS packages, create release | platform-ci, release-engineering-managers, iobuilders-hedera | +| **Mass Payout Release** | Version MP packages, create release | platform-ci, release-engineering-managers, iobuilders-hedera | + +### Automatic Publishing + +| Workflow | Trigger | Purpose | +| ----------------------- | ------------------- | --------------------------- | +| **ATS Publish** | Release tag `*-ats` | Publish ATS packages to npm | +| **Mass Payout Publish** | Release tag `*-mp` | Publish MP packages to npm | + +## Release Process + +The repository supports **two release approaches**: + +1. **Automated Release Workflows** (recommended for most releases) +2. **Manual Release Branches** (alternative for complex releases or when automation is unavailable) + +### Option 1: Automated Release Workflows + +#### ATS Release Flow + +```mermaid +sequenceDiagram + participant Dev as Developer + participant M as main + participant GH as GitHub Actions + participant NPM as NPM Registry + + Dev->>GH: Trigger ATS Release Workflow + GH->>GH: Validate ATS changesets exist + GH->>M: Run changeset version --ignore MP + GH->>M: Commit version changes to main + GH->>M: Create tag v1.16.0-ats + GH->>GH: Create GitHub release + GH->>NPM: Auto-trigger publish workflow + NPM->>NPM: Publish contracts & SDK +``` + +#### Mass Payout Release Flow + +```mermaid +sequenceDiagram + participant Dev as Developer + participant M as main + participant GH as GitHub Actions + participant NPM as NPM Registry + + Dev->>GH: Trigger MP Release Workflow + GH->>GH: Validate MP changesets exist + GH->>M: Run changeset version --ignore ATS + GH->>M: Commit version changes to main + GH->>M: Create tag v2.4.0-mp + GH->>GH: Create GitHub release + GH->>NPM: Auto-trigger publish workflow + NPM->>NPM: Publish MP packages +``` + +#### Release Options + +Both automated workflows support: + +- **Preview Mode**: Shows what would be released (dry-run) +- **Release Mode**: Actually creates releases and triggers publishing + +### Option 2: Manual Release Branches + +For complex releases or when automation is unavailable, you can use the traditional manual release branch approach: + +```mermaid +sequenceDiagram + participant M as main + participant D as develop + participant F as feat/example + participant F1 as feat/example-main + participant R as release/v1.22.2-ats + + Note over M,D: Initial state + + loop for each feature in sprint + D->>F: Create feature branch + Note over F: Feature development + changeset + F->>D: Merge PR with changeset + + D->>F1: Create branch from develop + F1->>M: Merge PR directly to main + end + + M->>R: Create release branch + Note over R: Run: npx changeset version + Note over R: Generate changelogs + version bump + R->>M: Merge version commit to main + + Note over M: Create tag v1.22.2-ats + Note over M: Manual GitHub release + Note over M: Automatic NPM publish via workflow + + M->>D: Merge main back to develop +``` + +#### Manual Release Steps + +1. **Create release branch from main**: + + ```bash + git checkout main && git pull origin main + git checkout -b release/v1.22.2-ats + ``` + +2. **Apply changesets and version packages**: + + ```bash + # For ATS release + npx changeset version --ignore "@hashgraph/mass-payout*" + + # For Mass Payout release + npx changeset version --ignore "@hashgraph/asset-tokenization-*" + ``` + +3. **Commit version changes**: + + ```bash + git add . + git commit --signoff -S -m "chore: release v1.22.2-ats" + git push origin release/v1.22.2-ats + ``` + +4. **Merge release branch to main**: + - Create PR from `release/v1.22.2-ats` to `main` + - Review and merge the version changes + +5. **Create GitHub release**: + - Create tag `v1.22.2-ats` on main branch + - Create GitHub release with generated changelog + - Publishing workflows trigger automatically + +6. **Sync main back to develop**: + ```bash + git checkout develop + git merge main + git push origin develop + ``` + +**Benefits of Manual Release Branches**: + +- ✅ Full control over version timing and content +- ✅ Ability to make additional changes during release process +- ✅ Works with existing automated publishing workflows +- ✅ Suitable for complex releases requiring manual intervention + +### Release Authorization + +Only these teams can trigger releases: + +- `platform-ci` +- `platform-ci-committers` +- `release-engineering-managers` +- `developer-advocates` +- `iobuilders-hedera` +- Users containing `hashgraph` + +## Workflow Interactions + +```mermaid +sequenceDiagram + participant D as develop + participant M as main + participant GH as GitHub Actions + participant NPM as NPM Registry + + Note over D,M: Workflow Overview + + loop Feature Development + Note over D: Features merge to develop + Note over D: Changesets accumulate + D->>M: Feature PRs to main + end + + Note over M: Ready for release + M->>GH: Manual release trigger + GH->>M: Version packages + create tag + GH->>GH: Create GitHub release + GH->>NPM: Auto-trigger publish + NPM->>NPM: Publish to NPM + + M->>D: Sync version changes back +``` + +## Troubleshooting + +### Common Issues + +**❌ Changeset check failed** + +- **Solution**: Create changeset with `npm run changeset` or add bypass label + +**❌ "No changesets found to be bumped"** + +- **Solution**: Ensure changesets exist for the project you're releasing +- Use `npm run changeset:status` to check pending changes + +**❌ Release workflow unauthorized** + +- **Solution**: Ensure you're member of authorized teams listed in CODEOWNERS + +**❌ Tests failing on PR** + +- **Solution**: Run `npm run ats:test` or `npm run mass-payout:test` locally +- Fix failing tests before requesting review + +**❌ DCO check failed** + +- **Solution**: Ensure all commits use `--signoff` flag: + ```bash + git commit --signoff -S -m "your message" + ``` + +### Getting Help + +- **Changesets documentation**: [Changesets Intro](https://github.com/changesets/changesets/blob/main/docs/intro-to-using-changesets.md) +- **Check pending releases**: `npm run changeset:status` +- **Preview releases**: `npm run release:preview` +- **Local development**: See `CLAUDE.md` for complete development setup + +## Quick Commands + +```bash +# Development +npm run changeset # Create changeset +npm run changeset:status # Check pending changes +npm run ats:test # Run ATS tests +npm run mass-payout:test # Run MP tests + +# Preview releases +npm run release:preview # Show all pending releases +npm run release:ats # Preview ATS release (local) +npm run release:mp # Preview MP release (local) +``` diff --git a/.github/workflows/all.publish.yml b/.github/workflows/all.publish.yml deleted file mode 100644 index 13b9b0225..000000000 --- a/.github/workflows/all.publish.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Publishing - - -on: - release: - types: [published] - - -permissions: - contents: read - -jobs: - publish: - name: Publish NPM Packages - runs-on: ubuntu-latest - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - steps: - - name: Harden Runner - uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 - with: - egress-policy: audit - - - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Setup NodeJS Environment - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - with: - node-version: 20.x - - - name: Install dependencies - run: npm ci - - # --- ATS publishing --- - - name: Publish ats/contracts - if: contains(github.ref_name, 'ats') - run: npm run ats:contracts:publish - - - name: Publish ats/sdk - if: contains(github.ref_name, 'ats') - run: npm run ats:sdk:publish - - # --- Mass Payout publishing --- - - name: Publish mass-payout - if: contains(github.ref_name, 'mp') - run: npm run mass-payout:publish diff --git a/.github/workflows/ats.publish.yml b/.github/workflows/ats.publish.yml new file mode 100644 index 000000000..411f30b0f --- /dev/null +++ b/.github/workflows/ats.publish.yml @@ -0,0 +1,160 @@ +name: ATS Publish + +on: + # Manual trigger with dry-run option + workflow_dispatch: + inputs: + dry-run-enabled: + description: 'Run npm publish with dry-run flag' + required: false + type: boolean + default: false + + # Release published trigger (GitHub release creation) - only for ATS releases (tags ending with -ats) + release: + types: + - published + +defaults: + run: + shell: bash + +permissions: + contents: read + id-token: write + +jobs: + contracts: + name: Publish ATS Contracts + runs-on: token-studio-linux-large + # Only run if manual trigger OR release tag contains '-ats-'/'-ATS-' + if: ${{ github.event_name == 'workflow_dispatch' || contains(github.ref_name, '-ats-') || contains(github.ref_name, '-ATS-') }} + + steps: + - name: Harden Runner + uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + ref: ${{ github.ref }} + fetch-depth: 0 + + - name: Setup NodeJS Environment + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 22.20.0 + registry-url: https://registry.npmjs.org + + - name: Create .npmrc file + working-directory: packages/ats/contracts + run: | + cat << 'EOF' > .npmrc + //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN} + EOF + + - name: Install dependencies + run: npm ci + + - name: Build ATS Contracts + run: npm run ats:contracts:build + + - name: Publish ATS Contracts + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + DRY_RUN: ${{ inputs.dry-run-enabled }} + working-directory: packages/ats/contracts + run: | + PUBLISH_ARGS=("--access=restricted") + if [[ "${DRY_RUN}" == "true" ]]; then + PUBLISH_ARGS+=("--dry-run") + echo "🔍 DRY RUN MODE: Would publish @hashgraph/asset-tokenization-contracts" + fi + + if ! npm publish "${PUBLISH_ARGS[@]}"; then + echo "❌ Failed to publish package: ${package_name}" + echo "📋 Package info:" && cat package.json | jq '.name, .version' + exit 1 + fi + + sdk: + name: Publish ATS SDK + runs-on: token-studio-linux-large + # Only run if manual trigger OR release tag contains '-ats-'/'-ATS-' + if: ${{ github.event_name == 'workflow_dispatch' || contains(github.ref_name, '-ats-') || contains(github.ref_name, '-ATS-') }} + # needs: contracts # Commented out for parallel execution + + steps: + - name: Harden Runner + uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + ref: ${{ github.ref }} + fetch-depth: 0 + + - name: Setup NodeJS Environment + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 22.20.0 + registry-url: https://registry.npmjs.org + + - name: Create .npmrc file + working-directory: packages/ats/sdk + run: | + cat << 'EOF' > .npmrc + //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN} + EOF + + - name: Install dependencies + run: npm ci + + - name: Build ATS Contracts and SDK + run: | + npm run ats:contracts:build + npm run ats:sdk:build + + - name: Publish ATS SDK + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + DRY_RUN: ${{ inputs.dry-run-enabled }} + working-directory: packages/ats/sdk + run: | + PUBLISH_ARGS=("--access=restricted") + if [[ "${DRY_RUN}" == "true" ]]; then + PUBLISH_ARGS+=("--dry-run") + echo "🔍 DRY RUN MODE: Would publish @hashgraph/asset-tokenization-sdk" + fi + + if ! npm publish "${PUBLISH_ARGS[@]}"; then + echo "❌ Failed to publish package: ${package_name}" + echo "📋 Package info:" && cat package.json | jq '.name, .version' + exit 1 + fi + + # Summary job to report results + summary: + name: Publish Summary + runs-on: token-studio-linux-large + needs: + - contracts + - sdk + if: ${{ always() }} + steps: + - name: Report Results + run: | + echo "## ATS Publish Results" >> "${GITHUB_STEP_SUMMARY}" + echo "| Package | Status |" >> "${GITHUB_STEP_SUMMARY}" + echo "| --- | --- |" >> "${GITHUB_STEP_SUMMARY}" + echo "| Contracts | ${{ needs.contracts.result }} |" >> "${GITHUB_STEP_SUMMARY}" + echo "| SDK | ${{ needs.sdk.result }} |" >> "${GITHUB_STEP_SUMMARY}" + + if [[ "${{ inputs.dry-run-enabled }}" == "true" ]]; then + echo "" >> "${GITHUB_STEP_SUMMARY}" + echo "🔍 **DRY RUN MODE** - No packages were actually published" >> "${GITHUB_STEP_SUMMARY}" + fi diff --git a/.github/workflows/ats.release.yml b/.github/workflows/ats.release.yml new file mode 100644 index 000000000..19ef010ee --- /dev/null +++ b/.github/workflows/ats.release.yml @@ -0,0 +1,155 @@ +name: ATS Release + +on: + # Manual trigger with preview/release option + workflow_dispatch: + inputs: + release-type: + description: 'Type of release to perform' + required: true + type: choice + options: + - preview # Show what would be released (dry-run) + - release # Full production release + default: 'preview' + +defaults: + run: + shell: bash + +permissions: + contents: write # For creating commits and tags + id-token: write + +jobs: + ats-release: + name: Create ATS Release + runs-on: token-studio-linux-large + + steps: + - name: Harden Runner + uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + # Use GitHub App token to bypass branch protection + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 + + - name: Setup NodeJS Environment + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: v22.20.0 + + - name: Install dependencies + run: npm ci + + - name: Validate ATS changesets exist + id: validate + run: | + echo "📋 Getting changeset status..." + npx changeset status --output=changeset-status.json + + ATS_PACKAGES_TO_BUMP=$(jq -r '.releases[] | select(.name | test("@hashgraph/asset-tokenization-")) | .name' changeset-status.json | wc -l) + + echo "ats-packages-to-bump=${ATS_PACKAGES_TO_BUMP}" >> "${GITHUB_OUTPUT}" + + if [ "${ATS_PACKAGES_TO_BUMP}" -eq 0 ]; then + echo "❌ No ATS packages found to be bumped" + echo "📋 Current changeset status:" + npx changeset status + exit 1 + fi + + echo "✅ Found ${ATS_PACKAGES_TO_BUMP} ATS package(s) ready for release" + + echo "📦 ATS packages to be released:" + jq -r '.releases[] | select(.name | test("@hashgraph/asset-tokenization-")) | " - \(.name) (\(.oldVersion) → \(.newVersion))"' changeset-status.json + + - name: Preview ATS release + if: ${{ inputs.release-type == 'preview' }} + run: | + echo "🔍 PREVIEW MODE - What would be released for ATS packages:" + echo "" + echo "📋 Current changeset status:" + npx changeset status + echo "" + echo "🚫 Mass Payout packages would be ignored during ATS release" + echo "🎯 Only @hashgraph/asset-tokenization-* packages would be processed" + echo "" + echo "To proceed with actual release, run this workflow with 'release' option." + + - name: Version ATS packages + if: ${{ inputs.release-type == 'release' }} + run: | + echo "🚀 Releasing ATS packages only (ignoring Mass Payout packages)" + + npx changeset version --ignore "@hashgraph/mass-payout*" + + if [[ -n "$(git status --porcelain)" ]]; then + echo "✅ Version bump completed for ATS packages" + else + echo "❌ No version changes detected" + exit 1 + fi + + - name: Commit version changes + if: ${{ inputs.release-type == 'release' }} + run: | + git add . + + if git commit --signoff -S -m "chore: release ATS packages"; then + echo "✅ Version changes committed" + else + echo "ℹ️ No changes to commit" + fi + + - name: Create ATS release + id: create-release-tag + if: ${{ inputs.release-type == 'release' }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + ATS_VERSION=$(node -p "require('./packages/ats/contracts/package.json').version") + TAG_NAME="v${ATS_VERSION}-ats" + echo "📦 Creating ATS release tag: ${TAG_NAME}" + git tag "${TAG_NAME}" + git push origin "${TAG_NAME}" + + echo "tag-name=${TAG_NAME}" >> "${GITHUB_OUTPUT}" + + - name: Create github release + if: ${{ inputs.release-type == 'release' }} + uses: step-security/release-action@03a57407052f15d1537fd5469a6fbbc536aba326 # v1.20.0 + with: + tag: ${{ steps.create-release-tag.outputs.tag-name }} + prerelease: false + draft: false + generateReleaseNotes: true + skipIfReleaseExists: true + + - name: Release Summary + if: always() + run: | + if [ "${{ inputs.release-type }}" = "preview" ]; then + echo "## 🔍 ATS Release Preview Completed" >> "${GITHUB_STEP_SUMMARY}" + echo "Preview mode was selected. No actual release was created." >> "${GITHUB_STEP_SUMMARY}" + elif [ "${{ job.status }}" = "success" ]; then + ATS_VERSION=$(node -p "require('./packages/ats/contracts/package.json').version" 2>/dev/null || echo "unknown") + echo "## ✅ ATS Release v${ATS_VERSION} Completed Successfully" >> "${GITHUB_STEP_SUMMARY}" + echo "| Package | Status |" >> "${GITHUB_STEP_SUMMARY}" + echo "| --- | --- |" >> "${GITHUB_STEP_SUMMARY}" + echo "| ATS Contracts | ✅ Released |" >> "${GITHUB_STEP_SUMMARY}" + echo "| ATS SDK | ✅ Released |" >> "${GITHUB_STEP_SUMMARY}" + echo "| GitHub Release | ✅ Created |" >> "${GITHUB_STEP_SUMMARY}" + echo "" >> "${GITHUB_STEP_SUMMARY}" + echo "**Next Steps:**" >> "${GITHUB_STEP_SUMMARY}" + echo "- NPM publishing will be triggered automatically via ats.publish.yml" >> "${GITHUB_STEP_SUMMARY}" + echo "- Mass Payout packages were ignored and remain available for separate release" >> "${GITHUB_STEP_SUMMARY}" + else + echo "## ❌ ATS Release Failed" >> "${GITHUB_STEP_SUMMARY}" + echo "Check the logs above for details on what went wrong." >> "${GITHUB_STEP_SUMMARY}" + fi diff --git a/.github/workflows/ats.test.yml b/.github/workflows/ats.test.yml index 97e46c02b..5a3c7cdac 100644 --- a/.github/workflows/ats.test.yml +++ b/.github/workflows/ats.test.yml @@ -59,7 +59,7 @@ jobs: - name: Setup NodeJS Environment uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: - node-version: 22.x + node-version: 22.20.0 - name: Install dependencies run: npm ci diff --git a/.github/workflows/changeset-check.yml b/.github/workflows/changeset-check.yml new file mode 100644 index 000000000..b50461362 --- /dev/null +++ b/.github/workflows/changeset-check.yml @@ -0,0 +1,115 @@ +name: Changeset Check + +on: + pull_request: + branches: + - develop + types: + - opened + - synchronize + - reopened + - labeled + - unlabeled + +permissions: + contents: read + pull-requests: read + +jobs: + check-changeset: + name: Validate Changeset Required + runs-on: token-studio-linux-large + + steps: + - name: Harden Runner + uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + # Ensure we have the develop branch for comparison + ref: ${{ github.head_ref }} + + - name: Fetch develop branch + run: | + git fetch origin develop:develop || git fetch origin main:develop || true + git branch -a + + - name: Setup NodeJS Environment + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 22.20.0 + + - name: Check for bypass labels + id: bypass + env: + GH_TOKEN: ${{ github.token }} + run: | + LABELS=$(gh pr view ${{ github.event.number }} --json labels --jq '.labels[].name' || echo "") + if echo "${LABELS}" | grep -E "(no-changeset|docs-only|hotfix|chore)" > /dev/null; then + echo "bypass=true" >> "${GITHUB_OUTPUT}" + echo "✅ Found bypass label. Skipping changeset check." + else + echo "bypass=false" >> "${GITHUB_OUTPUT}" + echo "🔍 No bypass labels found. Changeset check required." + fi + + - name: Install dependencies + if: ${{ steps.bypass.outputs.bypass == 'false' }} + run: npm ci + + - name: Check changeset status + if: ${{ steps.bypass.outputs.bypass == 'false' }} + run: | + echo "🔍 Checking for NEW changesets in this PR..." + + NEW_CHANGESETS=$(git diff develop...HEAD --name-only --diff-filter=A | grep "^\.changeset/.*\.md$" | grep -v "README.md" || true) + NEW_CHANGESET_COUNT=$(echo "${NEW_CHANGESETS}" | grep -c "\.md$" || echo "0") + + echo "Files changed in PR:" + git diff develop...HEAD --name-only --diff-filter=A | head -10 + echo "" + echo "NEW changeset files in this PR: ${NEW_CHANGESET_COUNT}" + if [ -n "${NEW_CHANGESETS}" ]; then + echo "Found NEW changesets:" + echo "${NEW_CHANGESETS}" + fi + + if [[ "${NEW_CHANGESET_COUNT}" -gt 0 ]]; then + echo "✅ Changeset validation passed - found NEW changeset files in PR" + else + echo "" + echo "❌ NEW CHANGESET REQUIRED" + echo "" + echo "This PR requires a NEW changeset to document the changes." + echo "We found no new .changeset/*.md files introduced by this PR." + echo "" + echo "To create a changeset:" + echo "1. Run: npm run changeset" + echo "2. Select the packages that changed" + echo "3. Choose the change type (patch/minor/major)" + echo "4. Write a description of your changes" + echo "5. Commit the generated .changeset/*.md file" + echo "" + echo "To bypass this check (for docs/chore changes only):" + echo "Add one of these labels to the PR:" + echo "- no-changeset: For pure documentation or config changes" + echo "- docs-only: For documentation-only changes" + echo "- chore: For build system or dependency updates" + echo "- hotfix: For emergency fixes" + echo "" + echo "More info: https://github.com/changesets/changesets/blob/main/docs/intro-to-using-changesets.md" + exit 1 + fi + + - name: Success summary + if: ${{ always() }} + run: | + if [ "${{ steps.bypass.outputs.bypass }}" = "true" ]; then + echo "✅ Changeset check bypassed due to label" + else + echo "✅ Changeset validation completed successfully" + fi diff --git a/.github/workflows/mp.publish.yml b/.github/workflows/mp.publish.yml new file mode 100644 index 000000000..941880a8f --- /dev/null +++ b/.github/workflows/mp.publish.yml @@ -0,0 +1,116 @@ +name: Mass Payout Publish + +on: + # Manual trigger with dry-run option + workflow_dispatch: + inputs: + dry-run-enabled: + description: 'Run npm publish with dry-run flag' + required: false + type: boolean + default: false + + # Release published trigger (GitHub release creation) - only for Mass Payout releases (tags ending with -mp) + release: + types: + - published + +defaults: + run: + shell: bash + +permissions: + contents: read + id-token: write + +jobs: + mass-payout: + name: Publish Mass Payout Packages + runs-on: token-studio-linux-large + # Only run if manual trigger OR release tag contains 'mp' + if: ${{ github.event_name == 'workflow_dispatch' || contains(github.ref_name, '-mp') }} + + steps: + - name: Harden Runner + uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + ref: ${{ github.ref }} + fetch-depth: 0 + + - name: Setup NodeJS Environment + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 22.20.0 + registry-url: https://registry.npmjs.org + + - name: Create .npmrc file + run: | + cat << 'EOF' > .npmrc + //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN} + EOF + + - name: Install dependencies + run: npm ci + + - name: Install NestJS CLI globally + run: npm install -g @nestjs/cli + + - name: Build Mass Payout packages + run: npm run mass-payout:build + + - name: Publish Mass Payout packages + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + DRY_RUN: ${{ inputs.dry-run-enabled }} + run: | + for package_dir in packages/mass-payout/*/; do + if [ -d "${package_dir}" ] && [ -f "${package_dir}package.json" ]; then + package_name=$(basename "${package_dir}") + echo "📦 Processing Mass Payout package: ${package_name}" + + cd "${package_dir}" + + if ! node -p "require('./package.json').private || false" | grep -q "true"; then + PUBLISH_ARGS=("--access=restricted") + if [[ "${DRY_RUN}" == "true" ]]; then + PUBLISH_ARGS+=("--dry-run") + echo "🔍 DRY RUN MODE: Would publish @hashgraph/mass-payout-${package_name}" + fi + + if ! npm publish "${PUBLISH_ARGS[@]}"; then + echo "❌ Failed to publish package: ${package_name}" + echo "📋 Package info:" && cat package.json | jq '.name, .version' + exit 1 + fi + else + echo "⏭️ Skipping private package: ${package_name}" + fi + + cd - > /dev/null + fi + done + + # Summary job to report results + summary: + name: Publish Summary + runs-on: token-studio-linux-large + needs: + - mass-payout + if: ${{ always() }} + steps: + - name: Report Results + run: | + echo "## Mass Payout Publish Results" >> "${GITHUB_STEP_SUMMARY}" + echo "| Package Type | Status |" >> "${GITHUB_STEP_SUMMARY}" + echo "| --- | --- |" >> "${GITHUB_STEP_SUMMARY}" + echo "| Mass Payout | ${{ needs.mass-payout.result }} |" >> "${GITHUB_STEP_SUMMARY}" + + if [[ "${{ inputs.dry-run-enabled }}" == "true" ]]; then + echo "" >> "${GITHUB_STEP_SUMMARY}" + echo "🔍 **DRY RUN MODE** - No packages were actually published" >> "${GITHUB_STEP_SUMMARY}" + fi diff --git a/.github/workflows/mp.release.yml b/.github/workflows/mp.release.yml new file mode 100644 index 000000000..78942e87d --- /dev/null +++ b/.github/workflows/mp.release.yml @@ -0,0 +1,154 @@ +name: Mass Payout Release + +on: + # Manual trigger with preview/release option + workflow_dispatch: + inputs: + release-type: + description: 'Type of release to perform' + required: true + type: choice + options: + - preview # Show what would be released (dry-run) + - release # Full production release + default: 'preview' + +defaults: + run: + shell: bash + +permissions: + contents: write # For creating commits and tags + id-token: write + +jobs: + mp-release: + name: Create Mass Payout Release + runs-on: token-studio-linux-large + + steps: + - name: Harden Runner + uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + # Use GitHub App token to bypass branch protection + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 + + - name: Setup NodeJS Environment + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 22.20.0 + + - name: Install dependencies + run: npm ci + + - name: Validate Mass Payout changesets exist + id: validate + run: | + echo "📋 Getting changeset status..." + npx changeset status --output=changeset-status.json + + MP_PACKAGES_TO_BUMP=$(jq -r '.releases[] | select(.name | test("@hashgraph/mass-payout")) | .name' changeset-status.json | wc -l) + + echo "mp-packages-to-bump=${MP_PACKAGES_TO_BUMP}" >> "${GITHUB_OUTPUT}" + + if [ "${MP_PACKAGES_TO_BUMP}" -eq 0 ]; then + echo "❌ No Mass Payout packages found to be bumped" + echo "📋 Current changeset status:" + npx changeset status + exit 1 + fi + + echo "✅ Found ${MP_PACKAGES_TO_BUMP} Mass Payout package(s) ready for release" + + echo "📦 Mass Payout packages to be released:" + jq -r '.releases[] | select(.name | test("@hashgraph/mass-payout")) | " - \(.name) (\(.oldVersion) → \(.newVersion))"' changeset-status.json + + - name: Preview Mass Payout release + if: ${{ inputs.release-type == 'preview' }} + run: | + echo "🔍 PREVIEW MODE - What would be released for Mass Payout packages:" + echo "" + echo "📋 Current changeset status:" + npx changeset status + echo "" + echo "🚫 ATS packages would be ignored during Mass Payout release" + echo "🎯 Only @hashgraph/mass-payout* packages would be processed" + echo "" + echo "To proceed with actual release, run this workflow with 'release' option." + + - name: Version Mass Payout packages + if: ${{ inputs.release-type == 'release' }} + run: | + echo "🚀 Releasing Mass Payout packages only (ignoring ATS packages)" + + npx changeset version --ignore "@hashgraph/asset-tokenization-*" + + if [[ -n "$(git status --porcelain)" ]]; then + echo "✅ Version bump completed for Mass Payout packages" + else + echo "❌ No version changes detected" + exit 1 + fi + + - name: Commit version changes + if: ${{ inputs.release-type == 'release' }} + run: | + git add . + + if git commit --signoff -S -m "chore: release Mass Payout packages"; then + echo "✅ Version changes committed" + else + echo "ℹ️ No changes to commit" + fi + + - name: Create Mass Payout release + id: create-mp-release-tag + if: ${{ inputs.release-type == 'release' }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + MP_VERSION=$(node -p "require('./packages/mass-payout/core/package.json').version" 2>/dev/null || echo "1.0.0") + TAG_NAME="v${MP_VERSION}-mp" + echo "📦 Creating Mass Payout release: ${TAG_NAME}" + git tag -s -a "${TAG_NAME}" -m "Creating Mass Payout Release with tag: ${TAG_NAME}" + git push origin "${TAG_NAME}" + + echo "release-tag=${TAG_NAME}" >> "${GITHUB_OUTPUT}" + + - name: Create github release + if: ${{ inputs.release-type == 'release' }} + uses: step-security/release-action@03a57407052f15d1537fd5469a6fbbc536aba326 # v1.20.0 + with: + tag: ${{ steps.create-mp-release-tag.outputs.release-tag }} + prerelease: false + draft: false + generateReleaseNotes: true + skipIfReleaseExists: true + + - name: Release Summary + if: ${{ always() }} + run: | + if [ "${{ inputs.release-type }}" = "preview" ]; then + echo "## 🔍 Mass Payout Release Preview Completed" >> "${GITHUB_STEP_SUMMARY}" + echo "Preview mode was selected. No actual release was created." >> "${GITHUB_STEP_SUMMARY}" + elif [ "${{ job.status }}" = "success" ]; then + MP_VERSION=$(node -p "require('./packages/mass-payout/core/package.json').version" 2>/dev/null || echo "unknown") + echo "## ✅ Mass Payout Release v${MP_VERSION} Completed Successfully" >> "${GITHUB_STEP_SUMMARY}" + echo "| Package | Status |" >> "${GITHUB_STEP_SUMMARY}" + echo "| --- | --- |" >> "${GITHUB_STEP_SUMMARY}" + echo "| Mass Payout Packages | ✅ Released |" >> "${GITHUB_STEP_SUMMARY}" + echo "| GitHub Release | ✅ Created |" >> "${GITHUB_STEP_SUMMARY}" + echo "" >> "${GITHUB_STEP_SUMMARY}" + echo "**Next Steps:**" >> "${GITHUB_STEP_SUMMARY}" + echo "- NPM publishing will be triggered automatically via mp.publish.yml" >> "${GITHUB_STEP_SUMMARY}" + echo "- ATS packages were ignored and remain available for separate release" >> "${GITHUB_STEP_SUMMARY}" + else + echo "## ❌ Mass Payout Release Failed" >> "${GITHUB_STEP_SUMMARY}" + echo "Check the logs above for details on what went wrong." >> "${GITHUB_STEP_SUMMARY}" + fi diff --git a/.github/workflows/mp.test.yml b/.github/workflows/mp.test.yml index 751be7f20..c80dae155 100644 --- a/.github/workflows/mp.test.yml +++ b/.github/workflows/mp.test.yml @@ -59,11 +59,14 @@ jobs: - name: Setup NodeJS Environment uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: - node-version: 22.x + node-version: 22.20.0 - name: Install dependencies run: npm ci + - name: Install NestJS CLI globally + run: npm install -g @nestjs/cli + - name: Build mass-payout run: npm run mass-payout:build diff --git a/.gitignore b/.gitignore index 12e65f3ab..aab0693b1 100644 --- a/.gitignore +++ b/.gitignore @@ -140,3 +140,6 @@ CLAUDE.md # Extracted methods from contracts contracts/extracted-methods.txt + +# bin files +bin/ diff --git a/README.md b/README.md index 9a20b3eee..752545ceb 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,6 @@ This monorepo is structured with **npm workspaces** and is designed for scalabil ### High-Level Overview -![Architecture Overview](./docs/images/architecture.png) - ```mermaid flowchart TD subgraph Users diff --git a/apps/ats/web/.env.sample b/apps/ats/web/.env.sample index 303b1aaa4..a95d41856 100644 --- a/apps/ats/web/.env.sample +++ b/apps/ats/web/.env.sample @@ -6,10 +6,11 @@ REACT_APP_BOND_CONFIG_VERSION='0' REACT_APP_SHOW_DISCLAIMER="true" # * Network Configuration +REACT_APP_NETWORK='testnet' REACT_APP_MIRROR_NODE='https://testnet.mirrornode.hedera.com/api/v1/' REACT_APP_RPC_NODE='https://testnet.hashio.io/api' -REACT_APP_RPC_RESOLVER='0.0.6797832' -REACT_APP_RPC_FACTORY='0.0.6797955' +REACT_APP_RPC_RESOLVER='0.0.6934364' +REACT_APP_RPC_FACTORY='0.0.6934415' # * Hedera Wallet Connnect REACT_APP_PROJECT_ID='1a2b3c4d [...] 9a0b1c2d3e4f' diff --git a/apps/ats/web/CHANGELOG.md b/apps/ats/web/CHANGELOG.md new file mode 100644 index 000000000..e5212d48e --- /dev/null +++ b/apps/ats/web/CHANGELOG.md @@ -0,0 +1,46 @@ +# @hashgraph/asset-tokenization-dapp + +## 1.17.0 + +### Minor Changes + +- a36b1c8: Integrate Changesets for version management and implement enterprise-grade release workflow + + #### Changesets Integration + - Add Changesets configuration with fixed versioning for ATS packages (contracts, SDK, dapp) + - Configure develop-branch strategy as base for version management + - Add comprehensive changeset management scripts: create, version, publish, status, snapshot + - Implement automated semantic versioning and changelog generation + - Add @changesets/cli dependency for modern monorepo version management + + #### Enterprise Release Workflow + - Implement new ats.publish.yml workflow focused exclusively on contracts and SDK packages + - Add manual trigger with dry-run capability for safe testing before actual releases + - Configure parallel execution of contracts and SDK publishing jobs for improved performance + - Support automatic triggers on version tags, release branches, and GitHub releases + - Add changeset validation workflow to enforce one changeset per PR requirement + - Include bypass labels for non-feature changes (no-changeset, docs-only, hotfix, chore) + + #### Repository Configuration + - Update .gitignore to properly track .github/ workflows while excluding build artifacts + - Remove deprecated all.publish.yml workflow in favor of focused ATS publishing + - Update package.json with complete changeset workflow scripts and release commands + - Enhance documentation with new version management workflow and enterprise practices + + #### Benefits + - **Modern Version Management**: Semantic versioning with automated changelog generation + - **Enterprise Compliance**: Manual release control with proper audit trails + - **Parallel Publishing**: Improved CI/CD performance with independent job execution + - **Developer Experience**: Simplified workflow with comprehensive documentation + - **Quality Assurance**: Mandatory changeset validation ensures all changes are documented + + This establishes a production-ready, enterprise-grade release management system that follows modern monorepo practices while maintaining backward compatibility with existing development workflows. + +### Patch Changes + +- Display proceed recipients' data in text format in ats web +- Add REACT_APP_NETWORK to .env to be able to select testnet, previewnet or mainnet +- Fix Hedera ID validation rule to accept until 9 digits after "0.0." +- Fix maxWidth in EditRole component to prevent text from overflowing to the left when resizing the window to a smaller size +- Updated dependencies + - @hashgraph/asset-tokenization-sdk@1.17.0 diff --git a/apps/ats/web/README.md b/apps/ats/web/README.md index 1c1797f14..6d39fb9a8 100644 --- a/apps/ats/web/README.md +++ b/apps/ats/web/README.md @@ -59,6 +59,7 @@ Below is a description of what each variable represents. ## Network +- **REACT_APP_NETWORK :** testnet, previewnet or mainnet - **REACT_APP_MIRROR_NODE :** mirror node's url. - **REACT_APP_RPC_NODE :** rpc node's url. - **REACT_APP_RPC_RESOLVER :** resolver's proxy smart contract address. Should be immutable. @@ -78,8 +79,6 @@ Below is a description of what each variable represents. ```bash # Start full development environment (builds contracts & SDK, then starts web) -npm start -# or npm run ats:start # Start just the web development server (assumes contracts & SDK are built) diff --git a/apps/ats/web/package.json b/apps/ats/web/package.json index e96498733..bf9581426 100644 --- a/apps/ats/web/package.json +++ b/apps/ats/web/package.json @@ -1,6 +1,6 @@ { "name": "@hashgraph/asset-tokenization-dapp", - "version": "1.16.1", + "version": "1.17.0", "license": "Apache-2.0", "scripts": { "build": "tsc && vite build", @@ -21,61 +21,61 @@ "format:check": "prettier --check '**/*.{js,jsx,mjs,cjs,ts,tsx,mts,json,md,yml,yaml}' --cache" }, "devDependencies": { - "@babel/preset-env": "^7.21.4", - "@babel/preset-react": "^7.18.6", - "@babel/preset-typescript": "^7.21.5", - "@chakra-ui/cli": "^2.4.1", - "@esbuild-plugins/node-globals-polyfill": "^0.2.3", - "@esbuild-plugins/node-modules-polyfill": "^0.2.2", - "@rollup/plugin-commonjs": "^28.0.6", - "@testing-library/jest-dom": "^5.16.5", - "@testing-library/react": "^14.0.0", - "@testing-library/user-event": "^14.4.3", - "@types/format-util": "^1.0.2", - "@types/jest": "^29.5.1", - "@types/react": "^18.2.15", - "@types/react-dom": "^18.2.7", - "@vitejs/plugin-react": "^4.0.3", - "babel-jest": "^29.5.0", - "babel-plugin-transform-vite-meta-env": "^1.0.3", - "date-fns-tz": "^2.0.0", - "dotenv": "^16.0.3", - "format-util": "^1.0.5", - "history": "^5.3.0", - "jest": "^29.5.0", - "jest-environment-jsdom": "^29.5.0", - "npm-run-all": "^4.1.5", - "react-select-event": "^5.5.1", - "rimraf": "^6.0.1", - "ts-jest": "^29.1.0", - "ts-xor": "^1.1.0", + "@babel/preset-env": "7.28.3", + "@babel/preset-react": "7.27.1", + "@babel/preset-typescript": "7.27.1", + "@chakra-ui/cli": "2.5.8", + "@esbuild-plugins/node-globals-polyfill": "0.2.3", + "@esbuild-plugins/node-modules-polyfill": "0.2.2", + "@rollup/plugin-commonjs": "28.0.6", + "@testing-library/jest-dom": "5.17.0", + "@testing-library/react": "14.2.1", + "@testing-library/user-event": "14.5.2", + "@types/format-util": "1.0.4", + "@types/jest": "29.5.14", + "@types/react": "18.3.25", + "@types/react-dom": "18.3.7", + "@vitejs/plugin-react": "4.7.0", + "babel-jest": "29.7.0", + "babel-plugin-transform-vite-meta-env": "1.0.3", + "date-fns-tz": "2.0.1", + "dotenv": "16.6.1", + "format-util": "1.0.5", + "history": "5.3.0", + "jest": "29.7.0", + "jest-environment-jsdom": "29.7.0", + "npm-run-all": "4.1.5", + "react-select-event": "5.5.1", + "rimraf": "6.0.1", + "ts-jest": "29.4.4", + "ts-xor": "1.3.0", "typescript": "5.3.3", - "util": "^0.12.5", + "util": "0.12.5", "vite": "4.5.5", - "vite-plugin-environment": "^1.1.3", - "vite-plugin-node-polyfills": "^0.24.0", + "vite-plugin-environment": "1.1.3", + "vite-plugin-node-polyfills": "0.24.0", "vite-plugin-rewrite-all": "1.0.1", - "vite-tsconfig-paths": "^4.2.1" + "vite-tsconfig-paths": "4.3.2" }, "dependencies": { "@chakra-ui/react": "2.6.1", - "@emotion/react": "^11.11.1", - "@emotion/styled": "^11.11.0", + "@emotion/react": "11.14.0", + "@emotion/styled": "11.14.1", "@hashgraph/asset-tokenization-sdk": "file:../../../packages/ats/sdk", - "@tanstack/react-query": "^4.35.3", - "framer-motion": "^10.16.4", + "@tanstack/react-query": "4.41.0", + "framer-motion": "10.18.0", "i18next": "23.10.1", "i18next-browser-languagedetector": "7.2.0", "io-bricks-ui": "2.7.4", "@phosphor-icons/react": "2.0.9", - "named-urls": "^2.0.1", - "react": "^18.2.0", - "react-device-detect": "^2.2.3", - "react-dom": "^18.2.0", + "named-urls": "2.0.1", + "react": "18.3.1", + "react-device-detect": "2.2.3", + "react-dom": "18.3.1", "react-hook-form": "7.41.5", "react-i18next": "13.2.0", "react-router-dom": "6.10.0", - "use-react-router-breadcrumbs": "^4.0.1", + "use-react-router-breadcrumbs": "4.0.1", "zustand": "4.4.1" } } diff --git a/apps/ats/web/src/services/SDKService.ts b/apps/ats/web/src/services/SDKService.ts index e7a101d4a..e9ce8279f 100644 --- a/apps/ats/web/src/services/SDKService.ts +++ b/apps/ats/web/src/services/SDKService.ts @@ -1,207 +1,4 @@ -/* - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ +// SPDX-License-Identifier: Apache-2.0 import { ApplyRolesRequest, @@ -383,7 +180,7 @@ import { export class SDKService { static initData?: InitializationData = undefined; - static testnetNetwork = 'testnet'; + static testnetNetwork = process.env.REACT_APP_NETWORK ?? 'testnet'; static testnetMirrorNode = { baseUrl: process.env.REACT_APP_MIRROR_NODE ?? '', apiKey: '', diff --git a/apps/ats/web/src/utils/rules.ts b/apps/ats/web/src/utils/rules.ts index 94ad0f932..a0680ee4f 100644 --- a/apps/ats/web/src/utils/rules.ts +++ b/apps/ats/web/src/utils/rules.ts @@ -318,7 +318,7 @@ export const isISINValid = (val: string) => { }; export const isValidHederaId = (val: string) => { - const maskRegex = /^[0-9]\.[0-9]\.[0-9]{1,7}$/; + const maskRegex = /^[0-9]\.[0-9]\.[0-9]{1,9}$/; return maskRegex.test(val) || t('isValidHederaId'); }; diff --git a/apps/ats/web/src/views/CreateBond/Components/StepProceedRecipients.tsx b/apps/ats/web/src/views/CreateBond/Components/StepProceedRecipients.tsx index 31e4fad7d..9e6bb9d73 100644 --- a/apps/ats/web/src/views/CreateBond/Components/StepProceedRecipients.tsx +++ b/apps/ats/web/src/views/CreateBond/Components/StepProceedRecipients.tsx @@ -220,7 +220,7 @@ import { useFormContext, useFormState, useForm } from 'react-hook-form'; import { FormStepContainer } from '../../../components/FormStepContainer'; import { Trash } from '@phosphor-icons/react'; import { createColumnHelper } from '@tanstack/table-core'; -import { isValidHederaId, isValidHex, required } from '../../../utils/rules'; +import { isValidHederaId, required } from '../../../utils/rules'; interface IProceedRecipient { address: string; @@ -363,18 +363,7 @@ export const StepProceedRecipients = () => { {t('stepProceedRecipients.data')} - - !value || - isValidHex(value) || - t('stepProceedRecipients.invalidHexFormat'), - }} - /> +