-
Notifications
You must be signed in to change notification settings - Fork 0
feat: implement the create and deploy flows #1
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,69 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| import * as fs from "fs"; | ||
| import * as path from "path"; | ||
| import { fileURLToPath } from "url"; | ||
|
|
||
| const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
| const cliRoot = path.resolve(__dirname, ".."); | ||
| const sdkRoot = path.resolve(cliRoot, "../sdk"); | ||
|
|
||
| // Template files to copy from SDK to CLI dist | ||
| const templates = [ | ||
| "src/client/common/templates/Dockerfile.layered.tmpl", | ||
| "src/client/common/templates/compute-source-env.sh.tmpl", | ||
| ]; | ||
|
|
||
| // Create templates directory in CLI dist | ||
| const distTemplatesDir = path.join(cliRoot, "dist", "templates"); | ||
| if (!fs.existsSync(distTemplatesDir)) { | ||
| fs.mkdirSync(distTemplatesDir, { recursive: true }); | ||
| } | ||
|
|
||
| // Copy each template file | ||
| for (const template of templates) { | ||
| const srcPath = path.join(sdkRoot, template); | ||
| const filename = path.basename(template); | ||
| const destPath = path.join(distTemplatesDir, filename); | ||
|
|
||
| if (!fs.existsSync(srcPath)) { | ||
| console.warn(`Warning: Template file not found: ${srcPath}`); | ||
| continue; | ||
| } | ||
|
|
||
| fs.copyFileSync(srcPath, destPath); | ||
| console.log(`Copied ${filename} to dist/templates/`); | ||
| } | ||
|
|
||
| console.log("Template files copied successfully"); | ||
|
|
||
| // Copy keys directory structure from SDK to CLI dist | ||
| const keysSrcDir = path.join(sdkRoot, "keys"); | ||
| const keysDistDir = path.join(cliRoot, "dist", "keys"); | ||
|
|
||
| if (fs.existsSync(keysSrcDir)) { | ||
| // Copy entire keys directory structure recursively | ||
| function copyDirRecursive(src, dest) { | ||
| if (!fs.existsSync(dest)) { | ||
| fs.mkdirSync(dest, { recursive: true }); | ||
| } | ||
|
|
||
| const entries = fs.readdirSync(src, { withFileTypes: true }); | ||
| for (const entry of entries) { | ||
| const srcPath = path.join(src, entry.name); | ||
| const destPath = path.join(dest, entry.name); | ||
|
|
||
| if (entry.isDirectory()) { | ||
| copyDirRecursive(srcPath, destPath); | ||
| } else { | ||
| fs.copyFileSync(srcPath, destPath); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| copyDirRecursive(keysSrcDir, keysDistDir); | ||
|
|
||
| console.log("Keys directory copied successfully"); | ||
| } else { | ||
| console.warn("Warning: Keys directory not found at", keysSrcDir); | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,15 +1,15 @@ | ||
| import { createECloudClient } from "@ecloud/sdk"; | ||
|
|
||
| export function loadClient(flags: { | ||
| privateKey: string; | ||
| verbose: boolean; | ||
| environment: string; | ||
| rpcUrl?: string; | ||
| apiBaseUrl?: string; | ||
| "private-key": string; | ||
| "rpc-url"?: string; | ||
| }) { | ||
| return createECloudClient({ | ||
| privateKey: flags.privateKey as `0x${string}`, | ||
| verbose: flags.verbose, | ||
| environment: flags.environment, | ||
| rpcUrl: flags.rpcUrl, | ||
| apiBaseUrl: flags.apiBaseUrl, | ||
| privateKey: flags["private-key"] as `0x${string}`, | ||
grezle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| rpcUrl: flags["rpc-url"], | ||
| }); | ||
| } | ||
This file contains hidden or 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,28 @@ | ||
| import { Command, Flags } from "@oclif/core"; | ||
| import { createApp } from "@ecloud/sdk"; | ||
|
|
||
| export default class AppCreate extends Command { | ||
| static description = "Create a new app"; | ||
|
|
||
| // CreateApp flags | ||
| static flags = { | ||
| name: Flags.string(), | ||
| language: Flags.string(), | ||
| template: Flags.string(), | ||
| templateVersion: Flags.string(), | ||
| verbose: Flags.boolean(), | ||
| }; | ||
|
|
||
| async run() { | ||
| const { flags } = await this.parse(AppCreate); | ||
|
|
||
| // Skip creating client and call createApp directly | ||
| return createApp(flags, { | ||
| info: (msg: string, ...args: any[]) => console.log(msg, ...args), | ||
| warn: (msg: string, ...args: any[]) => console.warn(msg, ...args), | ||
| error: (msg: string, ...args: any[]) => console.error(msg, ...args), | ||
| debug: (msg: string, ...args: any[]) => | ||
| flags.verbose && console.debug(msg, ...args), | ||
| }); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,12 +1,25 @@ | ||
| import { Flags } from "@oclif/core"; | ||
|
|
||
| export const commonFlags = { | ||
| privateKey: Flags.string({ required: true, env: "ECLOUD_PRIVATE_KEY" }), | ||
| environment: Flags.string({ | ||
| required: true, | ||
| description: "Deployment environment to use", | ||
| options: ["sepolia", "mainnet-alpha"], | ||
| env: "ECLOUD_ENV", | ||
| }), | ||
| rpcUrl: Flags.string({ required: false, env: "ECLOUD_RPC_URL" }), | ||
| apiBaseUrl: Flags.string({ required: false, env: "ECLOUD_API_BASE_URL" }), | ||
| "private-key": Flags.string({ | ||
| required: true, | ||
| description: "Private key for signing transactions", | ||
| env: "ECLOUD_PRIVATE_KEY", | ||
| }), | ||
| "rpc-url": Flags.string({ | ||
| required: false, | ||
| description: "RPC URL to connect to blockchain", | ||
| env: "ECLOUD_RPC_URL", | ||
| }), | ||
| verbose: Flags.boolean({ | ||
| required: false, | ||
| description: "Enable verbose logging (default: false)", | ||
| default: false, | ||
| }), | ||
| }; |
14 changes: 14 additions & 0 deletions
14
packages/sdk/keys/mainnet-alpha/prod/kms-encryption-public-key.pem
This file contains hidden or 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,14 @@ | ||
| -----BEGIN PUBLIC KEY----- | ||
| MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0kHU86k17ofCIGcJKDcf | ||
| AFurFhSLeWmOL0bwWLCeVnTPG0MMHtJOq+woE0XXSWw6lzm+jzavBBTwKde1dgal | ||
| Ap91vULAZFMUpiUdd2dNUVtvU89qW0Pgf1Eu5FDj7BkY/SnyECbWJM4ga0BmpiGy | ||
| nQwLNN9mMGhjVoVLn2zwEGZ7JzS9Nz11EZKO/k/9DcO6LaoIFmKuvVf3jl6lvZg8 | ||
| aeA0LoZXjkycHlRUt/kfKwZnhakUaYHP1ksV7ZNmolS5GYDTSKGB2KPPNR1s4/Xu | ||
| u8zeEFC8HuGRU8XuuBeaAunitnGhbNVREUNJGff6HZOGB6CIFNXjbQETeZ3p5uro | ||
| 0v+hd1QqQYBv7+DEaMCmGnJNGAyIMr2mn4vr7wGsIj0HonlSHmQ8rmdUhL2ocNTc | ||
| LhKgZiZmBuDpSbFW/r53R2G7CHcqaqGeUBnT54QCH4zsYKw0/4dOtwFxQpTyBf9/ | ||
| +k+KaWEJYKkx9d9OzKGyAvzrTDVOFoajddiJ6LPvRlMdOUQr3hl4IAC0/nh9lhHq | ||
| D0R+i5WAU96TkdAe7B7iTGH2D22k0KUPR6Q9W3aF353SLxQAMPNrgG4QQufAdRJn | ||
| AF+8ntun5TkTqjTWRSwAsUJZ1z4wb96DympWJbDi0OciJRZ3Fz3j9+amC43yCHGg | ||
| aaEMjdt35ewbztUSc04F10MCAwEAAQ== | ||
| -----END PUBLIC KEY----- |
4 changes: 4 additions & 0 deletions
4
packages/sdk/keys/mainnet-alpha/prod/kms-signing-public-key.pem
This file contains hidden or 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,4 @@ | ||
| -----BEGIN PUBLIC KEY----- | ||
| MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEfxbhXJjH4D0DH/iW5/rK1HzWS+f9 | ||
| EyooZTrCYjCfezuOEmRuOWNaZLvwXN8SdzrvjWA7gSvOS85hLzp4grANRQ== | ||
| -----END PUBLIC KEY----- |
14 changes: 14 additions & 0 deletions
14
packages/sdk/keys/sepolia/dev/kms-encryption-public-key.pem
This file contains hidden or 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,14 @@ | ||
| -----BEGIN PUBLIC KEY----- | ||
| MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAr/vqttU6aXX35HtsXavU | ||
| 5teysunDzZB3HyaFM4qcuRnqj+70KxqLOwZsERN5SwZ/56Jm8T2ds1CcXsQCMUMw | ||
| +MPlsF6KMGfzghLtYHONwvKLnn+U9y886aAay6W8a0A7O7YCZehNYD3kQnCXjOIc | ||
| Mj6v8AEvMw+w/lNabjRXnwSBMKVIGp/cSL0hGwt8fGoC3TsxQN9opzvU1Z4rAw9K | ||
| a119l6dlPnqezDva378TCaXDjqKe/jSZOI1CcYpaSK2SJ+95Wbvte5j3lXbg1oT2 | ||
| 0rXeJUHEJ68QxMtJplfw0Sg+Ek4CUJ2c/kbdg0u7sIIO5wcB4WHL/Lfbw2XPmcBI | ||
| t0r0EC575D3iHF/aI01Ms2IRA0GDeHnNcr5FJLWJljTjNLEt4tFITrXwBe1Ealm3 | ||
| NCxamApl5bBSwQ72Gb5fiQFwB8Fl2/XG3wfGTFInFEvWE4c/H8dtu1wHTsyEFZcG | ||
| B47IkD5GBSZq90Hd9xuZva55dxGpqUVrEJO88SqHGP9Oa+HLTYdEe5AR5Hitw4Mu | ||
| dk1cCH+X5OqY9dfpdoCNbKAM0N2SJvNAnDTU2JKGYheXrnDslXR6atBmU5gDkH+W | ||
| QVryDYl9xbwWIACMQsAQjrrtKw5xqJ4V89+06FN/wyEVF7KWAcJ4AhKiVnCvLqzb | ||
| BbISc+gOkRsefhCDJVPEKDkCAwEAAQ== | ||
| -----END PUBLIC KEY----- |
This file contains hidden or 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,4 @@ | ||
| -----BEGIN PUBLIC KEY----- | ||
| MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEb2Q88/cxdic2xi4jS2V0dtYHjLwq | ||
| 4wVFBFmaY8TTXoMXNggKEdU6PuE8EovocVKMpw3SIlaM27z9uxksNVL2xw== | ||
| -----END PUBLIC KEY----- |
14 changes: 14 additions & 0 deletions
14
packages/sdk/keys/sepolia/prod/kms-encryption-public-key.pem
This file contains hidden or 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,14 @@ | ||
| -----BEGIN PUBLIC KEY----- | ||
| MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEApDvk8pAivkgtiC5li5MP | ||
| xMTJDduTeorBl18ynrooTxp2BwwgPwXfXbJaCA0qRubvc0aO2uh2VDrPM27CqMLH | ||
| o2S9YLtpLii4A1Nl7SE/MdWKWdG6v94xNGpc2YyPP7yWtHfqOkgDWp8sokl3Uq/9 | ||
| MS0pjUaI7RyS5boCTy8Qw90BxGMpucjOmqm+luw4EdPWZCrgriUR2bbGRRgAmrT1 | ||
| K4ou4IgPp799r120hwHbCWxnOvLdQdpiv2507b900xS/3yZahhnHCAn66146LU/f | ||
| BrRpQKSM0qSpktXrrc9MH/ru2VLR5cGLp89ZcZMQA9cRGglWM5XWVY3Ti2TPJ6Kd | ||
| An1d7qNkGJaSdVa3x3HkOf6c6HeTyqis5/L/6L+PFhUsTRbmKg1FtwD+3xxdyf7h | ||
| abFxryE9rv+WatHL6r6z5ztV0znJ/Fpfs5A45FWA6pfb28fA59RGpi/DQ8RxgdCH | ||
| nZRNvdz8dTgRaXSPgkfGXBcCFqb/QhFmad7XbWDthGzfhbPOxNPtiaGRQ1Dr/Pgq | ||
| n0ugdLbRQLmDOAFgaQcnr0U4y1TUlWJnvoZMETkVN7gmITtXA4F324ALT7Rd+Lgk | ||
| HikW5vG+NjAEwXfPsK0YzT+VbHd7o1lbru9UxiDlN03XVEkz/oRQi47CvSTo3FSr | ||
| 5dB4lz8kov3UUcNJfQFZolMCAwEAAQ== | ||
| -----END PUBLIC KEY----- |
This file contains hidden or 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,4 @@ | ||
| -----BEGIN PUBLIC KEY----- | ||
| MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEsk6ZdmmvBqFfKHs+1cYjIemRGN7h | ||
| 1NatIEitFRyx+3q8wmTJ9LknTE1FwWBLcCNTseJDti8Rh+SaVxfGOyJuuA== | ||
| -----END PUBLIC KEY----- |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npxwould need to use the actual package name, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npx uses the named
binscript frompackage.json, sonpx ecloudworks 🙏There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that'd only work if it's found locally, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the user installs the cli globally then it will be available everywhere, is that what you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nah, i mean people normally use
npxto run packages without installing them. if it's not on their machine at all, wouldn't they need to donpx @layr-labs/ecloud-cli app deploy?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh, sorry yes! It would be
npx @layr-labs/ecloud-cliif its not installed, andnpx ecloudif it is!