Skip to content

Commit

Permalink
merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
timbrinded committed Dec 12, 2024
1 parent 3d2ffe2 commit 481bb34
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 235 deletions.
204 changes: 0 additions & 204 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions typescript-api/scripts/scrapeMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import fs from "node:fs";
import { ChildProcessWithoutNullStreams, execSync, spawn } from "node:child_process";
import { execSync, spawn } from "node:child_process";
import type { ChildProcessWithoutNullStreams } from "node:child_process";
import path from "node:path";

const CHAINS = ["moonbase", "moonriver", "moonbeam"];

const fetchMetadata = async (port: number = 9933) => {
const fetchMetadata = async (port = 9933) => {
const maxRetries = 60;
const sleepTime = 500;
const url = `http://localhost:${port}`;
const payload = {
id: "1",
jsonrpc: "2.0",
method: "state_getMetadata",
params: [],
params: []
};

for (let i = 0; i < maxRetries; i++) {
try {
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify(payload),
body: JSON.stringify(payload)
});

if (!response.ok) {
Expand All @@ -40,7 +41,7 @@ const fetchMetadata = async (port: number = 9933) => {
throw new Error("Error fetching metadata");
};

let nodes: { [key: string]: ChildProcessWithoutNullStreams } = {};
const nodes: { [key: string]: ChildProcessWithoutNullStreams } = {};

async function main() {
const runtimeChainSpec = process.argv[2];
Expand All @@ -67,7 +68,7 @@ async function main() {
"--tmp",
`--chain=${chain}-dev`,
"--wasm-execution=interpreted-i-know-what-i-do",
"--rpc-port=9933",
"--rpc-port=9933"
]);

console.log(`Getting ${chain} metadata`);
Expand Down
4 changes: 2 additions & 2 deletions typescript-api/src/moonbase/interfaces/moon/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { moonbeamDefinitions } from "moonbeam-types-bundle";
export default {
types: {},
rpc: {
...moonbeamDefinitions.rpc?.moon,
},
...moonbeamDefinitions.rpc?.moon
}
};
4 changes: 2 additions & 2 deletions typescript-api/src/moonbeam/interfaces/moon/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { moonbeamDefinitions } from "moonbeam-types-bundle";
export default {
types: {},
rpc: {
...moonbeamDefinitions.rpc?.moon,
},
...moonbeamDefinitions.rpc?.moon
}
};
4 changes: 2 additions & 2 deletions typescript-api/src/moonriver/interfaces/moon/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { moonbeamDefinitions } from "moonbeam-types-bundle";
export default {
types: {},
rpc: {
...moonbeamDefinitions.rpc?.moon,
},
...moonbeamDefinitions.rpc?.moon
}
};
42 changes: 24 additions & 18 deletions typescript-api/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,44 @@
import { defineConfig } from 'tsup'
import { execSync } from 'child_process'
import { defineConfig } from "tsup";
import { execSync } from "node:child_process";

export default defineConfig([
{
entry: ['src/moonbeam'],
outDir: 'dist/moonbeam',
format: ['esm', 'cjs'],
entry: ["src/moonbeam"],
outDir: "dist/moonbeam",
format: ["esm", "cjs"],
splitting: false,
clean: true,
onSuccess: async () => {
console.log('Running tsc for moonbeam...')
execSync('pnpm tsc -p src/moonbeam/tsconfig.json --emitDeclarationOnly', { stdio: 'inherit' })
console.log("Running tsc for moonbeam...");
execSync("pnpm tsc -p src/moonbeam/tsconfig.json --emitDeclarationOnly", {
stdio: "inherit"
});
}
},
{
entry: ['src/moonriver'],
outDir: 'dist/moonriver',
format: ['esm', 'cjs'],
entry: ["src/moonriver"],
outDir: "dist/moonriver",
format: ["esm", "cjs"],
splitting: false,
clean: true,
onSuccess: async () => {
console.log('Running tsc for moonriver...')
execSync('pnpm tsc -p src/moonriver/tsconfig.json --emitDeclarationOnly', { stdio: 'inherit' })
console.log("Running tsc for moonriver...");
execSync("pnpm tsc -p src/moonriver/tsconfig.json --emitDeclarationOnly", {
stdio: "inherit"
});
}
},
{
entry: ['src/moonbase'],
outDir: 'dist/moonbase',
format: ['esm', 'cjs'],
entry: ["src/moonbase"],
outDir: "dist/moonbase",
format: ["esm", "cjs"],
splitting: false,
clean: true,
onSuccess: async () => {
console.log('Running tsc for moonbase...')
execSync('pnpm tsc -p src/moonbase/tsconfig.json --emitDeclarationOnly', { stdio: 'inherit' })
console.log("Running tsc for moonbase...");
execSync("pnpm tsc -p src/moonbase/tsconfig.json --emitDeclarationOnly", {
stdio: "inherit"
});
}
}
])
]);

0 comments on commit 481bb34

Please sign in to comment.