This repository has been archived by the owner on Sep 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Matias Volpe <matias@parity.io>
- Loading branch information
Showing
109 changed files
with
1,317 additions
and
1,054 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { delay } from "../deps/std/async.ts" | ||
import { _getDeploymentUrl } from "../server/capi.dev/delegator.ts" | ||
|
||
const sha = Deno.env.get("CAPI_SHA")! | ||
|
||
const deploymentPollInterval = 5_000 | ||
|
||
while (!(await _getDeploymentUrl(sha))) { | ||
await delay(deploymentPollInterval) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// This task is used in CI to edit the import map to use capi.dev for codegen | ||
// instead of the local server. | ||
|
||
import { config } from "../capi.config.ts" | ||
import { checkCodegenUploaded, syncConfig } from "../mod.ts" | ||
|
||
const shaAbbrevLength = 8 | ||
const sha = Deno.env.get("CAPI_SHA")!.slice(0, shaAbbrevLength) | ||
|
||
const oldServer = config.server | ||
const capiServer = `https://capi.dev/@${sha}/` | ||
config.server = capiServer | ||
|
||
const importMap = JSON.parse(await Deno.readTextFile("import_map.json")) | ||
const oldCodegenUrl = importMap.imports["@capi/"] | ||
|
||
if (!oldCodegenUrl.startsWith(oldServer)) { | ||
throw new Error("_tasks/use_remote.ts run twice") | ||
} | ||
|
||
const codegenUrl = capiServer + oldCodegenUrl.slice(oldServer.length) | ||
|
||
console.log(codegenUrl) | ||
|
||
importMap.imports["@capi/"] = codegenUrl | ||
importMap.imports[`${capiServer}capi/`] = "./" | ||
|
||
await Deno.writeTextFile("import_map.json", JSON.stringify(importMap, null, 2)) | ||
|
||
const codegenHash = oldCodegenUrl.slice(oldServer.length).split("/")[0] | ||
|
||
if (await checkCodegenUploaded(capiServer, codegenHash)) { | ||
console.log("codegen already uploaded") | ||
} else { | ||
console.log("uploading codegen") | ||
await syncConfig("target/capi", config) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { binary, CapiConfig } from "./mod.ts" | ||
|
||
const polkadot = binary("polkadot", "v0.9.38") | ||
const polkadotParachain = binary("polkadot-parachain", "v0.9.380") | ||
const substrateContractsNode = binary("substrate-contracts-node", "v0.24.0") | ||
|
||
export const config: CapiConfig = { | ||
server: "http://localhost:4646/", | ||
chains: { | ||
polkadot: { | ||
url: "wss://rpc.polkadot.io/", | ||
version: "v0.9.40", | ||
}, | ||
westend: { | ||
url: "wss://westend-rpc.polkadot.io/", | ||
version: "latest", | ||
}, | ||
statemint: { | ||
url: "wss://statemint-rpc.polkadot.io/", | ||
version: "latest", | ||
}, | ||
polkadotDev: { | ||
binary: polkadot, | ||
chain: "polkadot-dev", | ||
}, | ||
westendDev: { | ||
binary: polkadot, | ||
chain: "westend-dev", | ||
}, | ||
contractsDev: { | ||
binary: substrateContractsNode, | ||
chain: "dev", | ||
}, | ||
rococoDev: { | ||
binary: polkadot, | ||
chain: "rococo-local", | ||
parachains: { | ||
statemine: { | ||
id: 1000, | ||
binary: polkadotParachain, | ||
chain: "statemine-local", | ||
}, | ||
contracts: { | ||
id: 2000, | ||
binary: polkadotParachain, | ||
chain: "contracts-rococo-local", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as flags from "../deps/std/flags.ts" | ||
import * as path from "../deps/std/path.ts" | ||
import { CapiConfig } from "../devnets/mod.ts" | ||
|
||
export async function resolveConfig(...args: string[]) { | ||
const { config: rawConfigPath } = flags.parse(args, { | ||
string: ["config"], | ||
default: { | ||
config: "./capi.config.ts", | ||
}, | ||
}) | ||
const configPath = path.resolve(rawConfigPath) | ||
await Deno.stat(configPath) | ||
const configModule = await import(path.toFileUrl(configPath).toString()) | ||
const config = configModule.config | ||
if (typeof config !== "object") throw new Error("config file must have a config export") | ||
|
||
return config as CapiConfig | ||
} |
Oops, something went wrong.