Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
bf22275
separate request json from component
smk762 Aug 6, 2025
5627514
fix missing "
smk762 Aug 7, 2025
46be1a0
Merge branch 'dev' into update/codegroup
smk762 Aug 7, 2025
76f91ff
migrates v2 activation to CompactTables
smk762 Aug 7, 2025
546b00a
adds request example electrum/node update script and workflow
smk762 Aug 7, 2025
188cefd
migrate legacy activation methods to CodeGroup external json souce
smk762 Aug 7, 2025
9b32d65
migrate legacy activation tables to CompactTable component
smk762 Aug 7, 2025
c763518
migrate v2 activation to CompactTable
smk762 Aug 7, 2025
62d5c33
fix json refname format
smk762 Aug 7, 2025
01bdc9d
rm CompactTable import (now global)
smk762 Aug 7, 2025
c76404d
Migrate legacy activation responses to KdfResponses component
smk762 Aug 7, 2025
8612a3a
update kdfresponses request key
gcharang Aug 21, 2025
c43bbf8
update kdfresponses request key to response key
gcharang Aug 22, 2025
82acb6b
updates style guide
gcharang Aug 22, 2025
d297d8f
updates validation
gcharang Aug 22, 2025
fa1eb6d
[Bot] File and author data updated, validated and updated internal li…
gcharang Aug 22, 2025
20af07d
updates cf publish action to wrangler
gcharang Aug 22, 2025
abc4d37
Merge pull request #578 from KomodoPlatform/lint-fix-patches/response…
gcharang Aug 22, 2025
9dc53b4
[Bot] File and author data updated, validated and updated internal li…
gcharang Aug 22, 2025
3421f59
attempt to fix cache
gcharang Aug 22, 2025
31d2ecb
Merge branch 'responses-component' of https://github.com/KomodoPlatfo…
gcharang Aug 22, 2025
053bf31
Merge pull request #579 from KomodoPlatform/lint-fix-patches/response…
gcharang Aug 22, 2025
d135fda
[Bot] File and author data updated, validated and updated internal li…
gcharang Aug 22, 2025
6bc2e95
Merge pull request #580 from KomodoPlatform/lint-fix-patches/response…
gcharang Aug 22, 2025
b36f8a5
attempt to fix cache
gcharang Aug 22, 2025
0de33f4
Merge branch 'responses-component' of https://github.com/KomodoPlatfo…
gcharang Aug 22, 2025
1e7b55a
rm spurious files
gcharang Aug 22, 2025
be1e274
rm spurious files
gcharang Aug 22, 2025
f351d13
adds node-updater workflow
smk762 Aug 25, 2025
02f47be
adds update_request_nodes script
smk762 Aug 25, 2025
a440af5
add initial coin_activation.json for legacy and v2
smk762 Aug 25, 2025
9f6222f
fix failing legacy injections
smk762 Aug 25, 2025
d430739
create responses folder
smk762 Aug 26, 2025
3d5f2fa
move req/resp json into kdf subfolder
smk762 Aug 26, 2025
8ac6a46
update CompactTable usage in style guide.
smk762 Aug 26, 2025
cd00d3f
Merge branch 'responses-component' into inject-clean-electrums
smk762 Aug 26, 2025
df8f3ba
rm old coin_activation.json files
smk762 Aug 26, 2025
cc71c88
fix nit: camelcase validation
smk762 Aug 26, 2025
e8f3759
remove unused script param
smk762 Aug 26, 2025
0f5f034
remove redundant type check
smk762 Aug 26, 2025
acfdaed
rm unused "version" arg
smk762 Aug 26, 2025
79746b3
rm redundant type check
smk762 Aug 26, 2025
d655804
fix path references in scripts
smk762 Aug 26, 2025
8309a88
remove erroneous responses
smk762 Aug 26, 2025
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
53 changes: 36 additions & 17 deletions .github/workflows/get_data_lint_files_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,19 @@ jobs:
- name: Enable Corepack
run: corepack enable

- name: Cache dependencies
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Cache npm dependencies
uses: actions/cache@v4
id: npm-cache
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('utils/js/package-lock.json') }}
restore-keys: |
npm-${{ runner.os }}-
${{ runner.os }}-npm-

- name: Generate API methods table
if: github.base_ref == 'main' || github.ref == 'refs/heads/main'
Expand Down Expand Up @@ -157,16 +163,30 @@ jobs:
- name: Enable Corepack
run: corepack enable

- name: Restore cache
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Cache yarn dependencies
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('website-komodoplatform.com/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Cache Next.js build
uses: actions/cache@v4
with:
path: |
website-komodoplatform.com/.next/cache
# Generate a new cache whenever packages or source files change.
key:
nextjs-${{ hashFiles('website-komodoplatform.com/yarn.lock') }}-${{ hashFiles('website-komodoplatform.com/**.[jt]s', 'website-komodoplatform.com/**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: nextjs-${{ hashFiles('website-komodoplatform.com/yarn.lock') }}-
key: ${{ runner.os }}-nextjs-${{ hashFiles('website-komodoplatform.com/yarn.lock') }}-${{ hashFiles('website-komodoplatform.com/src/**/*.[jt]s', 'website-komodoplatform.com/src/**/*.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('website-komodoplatform.com/yarn.lock') }}-
${{ runner.os }}-nextjs-

- name: Get updated content, Install deps, build, Add no-index headers before publishing to cloudflare
working-directory: website-komodoplatform.com
Expand Down Expand Up @@ -214,21 +234,19 @@ jobs:
rsync -avh --delete $GITHUB_WORKSPACE/utils/_fileData.json src/data/docs/_fileData.json
rsync -avh --delete $GITHUB_WORKSPACE/utils/_searchIndex.json src/data/docs/searchIndex.json

# Export and add headers
# Build first to create .next directory, then export
yarn build
yarn export
echo -e "https://:project.pages.dev/*\n X-Robots-Tag: noindex" > ./out/_headers

- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
uses: cloudflare/wrangler-action@v3
id: cf_publish
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
projectName: komodo-docs
directory: ./website-komodoplatform.com/out
command: pages deploy ./website-komodoplatform.com/out --project-name=komodo-docs --branch=${{ steps.vars.outputs.BRANCH_NAME }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
wranglerVersion: "3"
branch: ${{ steps.vars.outputs.BRANCH_NAME }}

- name: Post Comprehensive Preview Comment
uses: actions/github-script@v7
Expand All @@ -239,7 +257,7 @@ jobs:
const prNumber = context.issue.number;
const repo = context.repo.repo;
const owner = context.repo.owner;
const previewBase = "${{ steps.cf_publish.outputs.url }}/en/docs";
const previewBase = "${{ steps.cf_publish.outputs.deployment-url }}/en/docs";

const { data: commits } = await github.rest.pulls.listCommits({
owner,
Expand Down Expand Up @@ -369,7 +387,7 @@ jobs:
set -e
set -o pipefail
echo "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true" >> $GITHUB_ENV
echo "CF_PUBLISH_URL=${{ steps.cf_publish.outputs.url }}" >> $GITHUB_ENV
echo "CF_PUBLISH_URL=${{ steps.cf_publish.outputs.deployment-url }}" >> $GITHUB_ENV

- name: Generate Preview Images
if: github.base_ref == 'main' || github.ref == 'refs/heads/main'
Expand Down Expand Up @@ -412,6 +430,7 @@ jobs:
set -e
set -o pipefail
rm -rf $GITHUB_WORKSPACE/website-komodoplatform.com
rm $GITHUB_WORKSPACE/package.json $GITHUB_WORKSPACE/package-lock.json

# - name: Check if diff exists
# id: diff_check
Expand Down
156 changes: 156 additions & 0 deletions .github/workflows/update-nodes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: Update Server Values in Request Examples

on:
workflow_dispatch:
# Allow manual triggering
push:
paths:
- 'src/data/requests/kdf/**/*.json'
- 'utils/py/update_request_nodes.py'
branches:
- dev
- main

jobs:
update-nodes:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Create virtual environment
run: |
python -m venv utils/py/.venv
source utils/py/.venv/bin/activate
pip install --upgrade pip

- name: Find and update request JSON files
run: |
source utils/py/.venv/bin/activate

echo "🔍 Finding request JSON files to update..."
updated_files=()

# Find all JSON files in the requests directory
find src/data/requests/kdf/ -name "*.json" | while read file; do
echo "📄 Processing: $file"

# Run the update script and capture output
if python utils/py/update_request_nodes.py "$file" 2>&1 | grep -q "Successfully updated"; then
echo "✅ Updated: $file"
echo "$file" >> /tmp/updated_files.txt
else
echo "ℹ️ No updates needed for: $file"
fi
done

# Read updated files list if it exists
if [ -f /tmp/updated_files.txt ]; then
echo "📋 Updated files:"
cat /tmp/updated_files.txt
echo "UPDATED_FILES_COUNT=$(wc -l < /tmp/updated_files.txt)" >> $GITHUB_ENV
else
echo "UPDATED_FILES_COUNT=0" >> $GITHUB_ENV
fi

- name: Check for changes
id: check-changes
run: |
if git diff --quiet; then
echo "No changes detected"
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "Changes detected"
echo "has_changes=true" >> $GITHUB_OUTPUT
fi

- name: Show changes
if: steps.check-changes.outputs.has_changes == 'true'
run: |
echo "📊 Changes summary:"
git diff --stat
echo ""
echo "🔍 Detailed changes:"
git diff

- name: Create Pull Request
if: steps.check-changes.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |
🔄 Update server values in request examples

- Updated ${{ env.UPDATED_FILES_COUNT }} request file(s) with latest server/node values
- Supports ETH/EVM, Tendermint, UTXO, and ZHTLC protocols
- Limits to 3 servers max, prioritizing cipig/komodo domains
- Synchronized with coins repository data
- Addresses issue #360
title: "🔄 Update server values in request examples"
body: |
## 📋 Summary

This automated PR updates server and node values in documentation request examples to keep them synchronized with the latest data from the [coins repository](https://github.com/KomodoPlatform/coins).

## 🔧 Protocol Support

The update script now supports all major coin protocols:
- **ETH/EVM**: Updates `nodes` from coins_config `nodes`
- **Tendermint**: Updates `nodes` from coins_config `rpc_urls`
- **UTXO**: Updates `servers` from coins_config `electrum`
- **ZHTLC**: Updates `light_wallet_d_servers` + `electrum_servers`

## 📊 Server Selection

- Limited to **3 servers maximum** for lightweight payloads
- **Priority domains**: cipig.net, komodo.earth preferred
- **Random selection** when more than 3 servers available

## 📊 Changes

- **Files Updated**: ${{ env.UPDATED_FILES_COUNT }}
- **Source**: https://raw.githubusercontent.com/KomodoPlatform/coins/master/utils/coins_config.json
- **Script**: `utils/py/update_request_nodes.py`

## 🎯 Related Issue

Addresses #360 - Keep electrum server values updated in the postman collection

## ✅ Validation

- [x] All JSON files remain valid after updates
- [x] Only server/node arrays were modified
- [x] Original request structure preserved

## 🤖 Automation

This PR was created automatically by the `update-nodes.yml` workflow.

---

**Note**: Please review the changes to ensure the new server/node values are appropriate before merging.
branch: update-nodes-${{ github.run_number }}
delete-branch: true
labels: |
enhancement
automated
CI/CD
P1
Important task which needs to be completed soon

- name: Summary
run: |
if [ "${{ steps.check-changes.outputs.has_changes }}" = "true" ]; then
echo "🎉 Successfully created PR with updated node values!"
echo "📊 Updated ${{ env.UPDATED_FILES_COUNT }} file(s)"
else
echo "✅ All request files are already up-to-date!"
fi
78 changes: 72 additions & 6 deletions STYLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@ CompactTable uses a source attribute that references table data stored in JSON f

#### Import and Usage

First import the component at the top of your MDX file:
```jsx
import CompactTable from '@/components/mdx/CompactTable';
```

Then use it with a source reference:
The CompactTable component is globally imported. To use it with a source reference:
```jsx
<CompactTable source="common-structures/activation.ActivationMode" />
```
Expand Down Expand Up @@ -202,6 +197,77 @@ Also supports sending data directly, but not encouraged.
/>
```

### KdfResponses Component

The `KdfResponses` component is used to display API responses for Komodo DeFi Framework methods. It automatically generates response examples from centralized JSON data files, ensuring consistency across documentation.

#### How KdfResponses Works

KdfResponses pulls response data from JSON files stored in `/src/data/responses/kdf/`:
- Response data is organized by subdirectory: `legacy/`, `v2/`, etc.
- Each JSON file contains multiple response definitions
- Responses are referenced using the `responseKey` attribute

#### Usage

The KdfResponses component is globally imported already. To use it:

```jsx
<KdfResponses responseKey="legacy/coin_activation.LegacyElectrumBch" />
```

#### Response Key Format

The `responseKey` attribute follows this pattern:
- `directory/filename.responsename`
- Examples:
- `legacy/coin_activation.LegacyElectrumBch`
- `legacy/coin_activation.LegacyEnableNative`
- `v2/activation.EnableCoinResponse`

#### JSON Data Structure

Response data files are located in `/src/data/responses/kdf/` and follow this structure:

```json
{
"ResponseName": {
"type": "success",
"title": "Response (successful activation)",
"description": "Optional description of the response",
"data": {
"result": {
"address": "RNacVDT8GwQ54CWe5PkEUemLz3WPapEXH9",
"balance": "0",
"coin": "KMD"
}
}
}
}
```

#### When to Use KdfResponses

- **API method responses**: Display standardized response examples
- **Success responses**: Show expected successful returns
- **Error responses**: Document potential error states
- **Multiple response variations**: Different responses based on request parameters

#### Benefits

- **Centralized response management**: Update responses in one place
- **Consistency**: Ensures uniform response structure across docs
- **Validation**: JSON schema validation ensures data integrity
- **Reusability**: Same response data can be referenced from multiple pages
- **Automatic formatting**: Responses are automatically formatted as JSON code blocks

#### Best Practices

- Place `KdfResponses` immediately after the corresponding `CodeGroup` request example
- Use descriptive response names that match the method name
- Include both successful and error responses where applicable
- Group related responses in the same JSON file

## Variables

- For Komodo DeFi Framework API methods, the userpass variable should always be `RPC_UserP@SSW0RD`
Expand Down
Loading