diff --git a/.github/workflows/update-typescript-api.yml b/.github/workflows/update-typescript-api.yml new file mode 100644 index 0000000000..e261186f7a --- /dev/null +++ b/.github/workflows/update-typescript-api.yml @@ -0,0 +1,65 @@ +name: Update Rust/TS bindings + +on: + workflow_dispatch: + schedule: + - cron: "0 5 * * *" # Runs every day at 5:00 AM UTC + +jobs: + build: + runs-on: + labels: bare-metal + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Local build new Node + uses: ./.github/workflow-templates/cargo-build + - name: Upload Node + uses: actions/upload-artifact@v4 + with: + name: moonbeam + path: build + + update-typescript-api: + needs: build + runs-on: moonbeam-release-medium + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download Node + uses: actions/download-artifact@v4 + with: + name: moonbeam + path: target/release + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: 9 + run_install: false + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version-file: "test/.nvmrc" + cache: pnpm + registry-url: https://registry.npmjs.org/ + - name: Run Typegen + run: | + chmod uog+x target/release/moonbeam + pnpm i + cd test + pnpm typegen + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + base: master + branch: "update-typescript-api-${{ github.run_id }}" + commit-message: "Update Rust/TS bindings" + draft: true + title: "Update Rust/TS bindings" + reviewers: "moonsong-coredev" + labels: "B0-silent,D2-notlive" \ No newline at end of file diff --git a/typescript-api/scripts/scrapeMetadata.ts b/typescript-api/scripts/scrapeMetadata.ts index c2186ea911..7e5b6a8fce 100644 --- a/typescript-api/scripts/scrapeMetadata.ts +++ b/typescript-api/scripts/scrapeMetadata.ts @@ -7,7 +7,7 @@ const CHAINS = ["moonbase", "moonriver", "moonbeam"]; const fetchMetadata = async (port = 9933) => { const maxRetries = 60; const sleepTime = 500; - const url = `http://localhost:${port}`; + const url = `http://127.0.0.1:${port}`; const payload = { id: "1", jsonrpc: "2.0", @@ -75,7 +75,7 @@ async function main() { const metadata = await fetchMetadata(); fs.writeFileSync(`metadata-${chain}.json`, JSON.stringify(metadata, null, 2)); console.log(`✅ Metadata for ${chain} written to metadata-${chain}.json`); - nodes[chain].kill(); + nodes[chain]?.kill(); await new Promise((resolve) => setTimeout(resolve, 2000)); } catch (error) { console.error(`❌ Error getting metadata for ${chain}`); @@ -86,7 +86,7 @@ async function main() { process.on("SIGINT", () => { for (const chain of CHAINS) { - nodes[chain].kill(); + nodes[chain]?.kill(); } process.exit(); }); @@ -98,6 +98,6 @@ main() }) .finally(() => { for (const chain of CHAINS) { - nodes[chain].kill(); + nodes[chain]?.kill(); } });