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

WIP: Update metadata checker #2179

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
16 changes: 11 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,9 @@ jobs:
docker run -d --rm --net=net-${{env.RELEASE_BRANCH_NAME}} \
-v `pwd`:/app \
--name test-node \
ubuntu:22.04 \
ubuntu:24.04 \
/bin/sh -c "chmod +x /app/${{env.TEST_BIN_FILENAME}} && /app/${{env.TEST_BIN_FILENAME}} \
--chain=frequency-bench \
--chain=frequency \
--rpc-external \
--rpc-cors=all \
--rpc-methods=Unsafe \
Expand All @@ -559,9 +559,9 @@ jobs:
docker run -d --rm --net=net-${{env.RELEASE_BRANCH_NAME}} \
-v `pwd`:/app \
--name ref-node \
ubuntu:22.04 \
ubuntu:24.04 \
/bin/sh -c "chmod +x /app/${{env.REF_BIN_FILENAME}} && /app/${{env.REF_BIN_FILENAME}} \
--chain=frequency-bench \
--chain=frequency \
--rpc-external \
--rpc-cors=all \
--rpc-methods=Unsafe \
Expand All @@ -585,7 +585,7 @@ jobs:
- name: Compare Metadata
timeout-minutes: 10
run: |
CMD="docker run --pull always --net=net-${{env.RELEASE_BRANCH_NAME}} jacogr/polkadot-js-tools:0.57.1 metadata ws://ref-node:9944 ws://test-node:9944"
CMD="docker run --pull always --net=net-${{env.RELEASE_BRANCH_NAME}} jacogr/polkadot-js-tools:0.59.1 metadata ws://ref-node:9944 ws://test-node:9944"
echo -e "Running:\n$CMD"
$CMD >> ${{env.OUTPUT_DIR}}/${{env.OUTPUT_FILENAME}}
cat ${{env.OUTPUT_DIR}}/${{env.OUTPUT_FILENAME}} | egrep -n -i ''
Expand Down Expand Up @@ -718,6 +718,12 @@ jobs:
pattern: artifacts-*-${{github.run_id}}
path: /tmp
merge-multiple: true
- name: Download api-augment artifacts
id: download-js
uses: actions/download-artifact@v4
with:
name: js-api-augment-${{github.run_id}}/js/api-augment/json
path: /tmp/polkadot-api-types-json
- name: List Downloaded Artifacts
working-directory: /tmp
run: |
Expand Down
3 changes: 2 additions & 1 deletion js/api-augment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"prepackage": "cp CONTRIBUTING.md README.md ../../LICENSE ./dist",
"prebuild": "npm run generate",
"build": "tsc -p ./tsconfig.types.json && tsc -p ./tsconfig.cjs.json && tsc -p ./tsconfig.esm.json",
"postbuild": "npm run package",
"build:types-json": "node scripts/generate.mjs",
"postbuild": "npm run package && npm run build:types-json",
"fetch:local": "curl -H \"Content-Type: application/json\" -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9944 -o ./metadata.json",
"generate:defs": "node --import=tsx/esm node_modules/.bin/polkadot-types-from-defs --package @frequency-chain/api-augment --input ./interfaces --endpoint ./metadata.json",
"generate:meta": "node --import=tsx/esm node_modules/.bin/polkadot-types-from-chain --package @frequency-chain/api-augment --endpoint ./metadata.json --output ./interfaces",
Expand Down
15 changes: 15 additions & 0 deletions js/api-augment/scripts/generate.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { types } from '../dist/esm/index.js';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import { dirname } from 'path';

// Get the filename from the URL
const __filename = fileURLToPath(import.meta.url);
// Get the directory name from the filename
const __dirname = dirname(__filename);
const outdir = path.join(__dirname, '../dist/json/');

fs.mkdirSync(outdir, { recursive: true });

fs.writeFileSync(path.join(outdir, 'types.json'), JSON.stringify(types, null, 4));
Loading