From bbcf30d6befd4322718168b2dd161999f61ce1fb Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 24 Sep 2024 11:11:03 +0100 Subject: [PATCH 01/58] feat: add initialize-kakarot script --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 930bbe7..b6a3678 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "devnet": "sh ./devnet/start.sh", "start": "cd frontend && npm run dev", "install": "cd scripts && bash install_tools.sh && cd ../frontend && npm install --legacy-peer-deps", - "build-ui": "cd frontend && npm run build" + "build-ui": "cd frontend && npm run build", + "initialize-kakarot": "rm -rf kakarot && mkdir kakarot && cd kakarot && git clone https://github.com/kkrt-labs/build-on-kakarot.git" }, "repository": { "type": "git", From 1cdce49ccb0419cdd49b603fe27a2ce243ccab12 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 24 Sep 2024 11:23:54 +0100 Subject: [PATCH 02/58] feat: add setup-kakarot script --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b6a3678..7919524 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,9 @@ "start": "cd frontend && npm run dev", "install": "cd scripts && bash install_tools.sh && cd ../frontend && npm install --legacy-peer-deps", "build-ui": "cd frontend && npm run build", - "initialize-kakarot": "rm -rf kakarot && mkdir kakarot && cd kakarot && git clone https://github.com/kkrt-labs/build-on-kakarot.git" + "initialize-kakarot": "rm -rf kakarot && mkdir kakarot && cd kakarot && git clone https://github.com/kkrt-labs/build-on-kakarot.git", + "setup-kakarot": "cd kakarot/build-on-kakarot && make setup" + }, "repository": { "type": "git", From 04d28985456f881d68bbb0b743a222dca7f672c7 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 24 Sep 2024 11:27:05 +0100 Subject: [PATCH 03/58] feat: add start-kakarot script --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 7919524..be6add8 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "install": "cd scripts && bash install_tools.sh && cd ../frontend && npm install --legacy-peer-deps", "build-ui": "cd frontend && npm run build", "initialize-kakarot": "rm -rf kakarot && mkdir kakarot && cd kakarot && git clone https://github.com/kkrt-labs/build-on-kakarot.git", - "setup-kakarot": "cd kakarot/build-on-kakarot && make setup" + "setup-kakarot": "cd kakarot/build-on-kakarot && make setup", + "start-kakarot": "cd kakarot/build-on-kakarot && make start" }, "repository": { From 3533c909beba9753ff74aad8aea85286975b8074 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 24 Sep 2024 12:17:45 +0100 Subject: [PATCH 04/58] feat: add deploy-kakarot-l1-messaging-contracts script --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index be6add8..2354ca3 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "build-ui": "cd frontend && npm run build", "initialize-kakarot": "rm -rf kakarot && mkdir kakarot && cd kakarot && git clone https://github.com/kkrt-labs/build-on-kakarot.git", "setup-kakarot": "cd kakarot/build-on-kakarot && make setup", - "start-kakarot": "cd kakarot/build-on-kakarot && make start" - + "start-kakarot": "cd kakarot/build-on-kakarot && make start", + "deploy-kakarot-l1-messaging-contracts": "cd kakarot/build-on-kakarot && make deploy-l1" }, "repository": { "type": "git", From a8d2fdb93c74d6b1da4f28300bce1aea915e437f Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 24 Sep 2024 12:18:48 +0100 Subject: [PATCH 05/58] feat: add deploy-kakarot-evm-contract script --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2354ca3..df93b93 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "initialize-kakarot": "rm -rf kakarot && mkdir kakarot && cd kakarot && git clone https://github.com/kkrt-labs/build-on-kakarot.git", "setup-kakarot": "cd kakarot/build-on-kakarot && make setup", "start-kakarot": "cd kakarot/build-on-kakarot && make start", - "deploy-kakarot-l1-messaging-contracts": "cd kakarot/build-on-kakarot && make deploy-l1" + "deploy-kakarot-l1-messaging-contracts": "cd kakarot/build-on-kakarot && make deploy-l1", + "deploy-kakarot-evm-contract": "cd kakarot/build-on-kakarot && forge create solidity_contracts/src/${npm_contract_path} --private-key $PRIVATE_KEY" }, "repository": { "type": "git", From 5f1c432b299ce61f75cdd416cf76e3e0d2e77d8c Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 24 Sep 2024 12:45:28 +0100 Subject: [PATCH 06/58] refac: modify kakarot scripts --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index df93b93..e3a1100 100644 --- a/package.json +++ b/package.json @@ -23,11 +23,11 @@ "start": "cd frontend && npm run dev", "install": "cd scripts && bash install_tools.sh && cd ../frontend && npm install --legacy-peer-deps", "build-ui": "cd frontend && npm run build", - "initialize-kakarot": "rm -rf kakarot && mkdir kakarot && cd kakarot && git clone https://github.com/kkrt-labs/build-on-kakarot.git", - "setup-kakarot": "cd kakarot/build-on-kakarot && make setup", - "start-kakarot": "cd kakarot/build-on-kakarot && make start", - "deploy-kakarot-l1-messaging-contracts": "cd kakarot/build-on-kakarot && make deploy-l1", - "deploy-kakarot-evm-contract": "cd kakarot/build-on-kakarot && forge create solidity_contracts/src/${npm_contract_path} --private-key $PRIVATE_KEY" + "initialize-kakarot": "rm -rf contracts && mkdir contracts && cd contracts && git clone https://github.com/kkrt-labs/build-on-kakarot.git && cp -r build-on-kakarot/* ./ && rm -rf .github && rm -rf .trunk && rm -rf build-on-kakarot", + "setup-kakarot": "cd contracts && make setup", + "start-kakarot": "cd contracts && make start", + "deploy-kakarot-l1-messaging-contracts": "cd contracts && make deploy-l1", + "deploy-kakarot-evm-contract": "cd contracts && forge create solidity_contracts/src/${npm_contract_path} --private-key $PRIVATE_KEY" }, "repository": { "type": "git", From c81a80708988580682f3a558bfd9aca5a557cb20 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Thu, 26 Sep 2024 10:43:06 +0100 Subject: [PATCH 07/58] feat: add kakarot support to `bin/cli.mjs` --- bin/cli.mjs | 112 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 68 insertions(+), 44 deletions(-) diff --git a/bin/cli.mjs b/bin/cli.mjs index 396ab94..3b55342 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -15,7 +15,7 @@ const rm = promisify(fs.rm); // Initialize readline interface const rl = readline.createInterface({ input: process.stdin, - output: process.stdout + output: process.stdout, }); // Function to ask questions in the terminal @@ -28,19 +28,29 @@ let projectPath; const installPackage = async () => { try { // Ask for package name - const packageName = await askQuestion('Enter your package name: '); + const packageName = await askQuestion("Enter your package name: "); // Ask for package type - const packageTypeChoices = ['contract_only', 'fullstack', 'dojo', 'debugger']; - console.log('Available package types:'); - packageTypeChoices.forEach((type, index) => console.log(`${index + 1}. ${type}`)); + const packageTypeChoices = [ + "contract_only", + "fullstack", + "dojo", + "debugger", + "kakarot", + ]; + console.log("Available package types:"); + packageTypeChoices.forEach((type, index) => + console.log(`${index + 1}. ${type}`) + ); let packageType; while (!packageType) { - const packageTypeChoice = await askQuestion('Select the package type (1-3): '); + const packageTypeChoice = await askQuestion( + "Select the package type (1-4): " + ); packageType = packageTypeChoices[parseInt(packageTypeChoice) - 1]; if (!packageType) { - console.log('Invalid choice. Please select a valid package type.'); + console.log("Invalid choice. Please select a valid package type."); } } @@ -49,11 +59,12 @@ const installPackage = async () => { projectPath = path.join(currentPath, packageName); if (fs.existsSync(projectPath)) { - console.log(`The file ${projectName} already exist in the current directory, please give it another name.`); - process.exit(1); - } - else { - fs.mkdirSync(projectPath); + console.log( + `The file ${projectName} already exist in the current directory, please give it another name.` + ); + process.exit(1); + } else { + fs.mkdirSync(projectPath); } // Clone the repository @@ -63,11 +74,24 @@ const installPackage = async () => { gitSpinner.succeed(); let cleanupTasks = []; - let excluded_files = [".git", ".github", "CONTRIBUTING.md", "bin", "burner", "website", "docs", "CNAME"]; - - if (packageType === "fullstack" || packageType === "dojo") { - const FRONTEND_BASE_PATH = "frontend/src/app"; - const componentsToRemove = [ + let excluded_files = [ + ".git", + ".github", + "CONTRIBUTING.md", + "bin", + "burner", + "website", + "docs", + "CNAME", + ]; + + if ( + packageType === "fullstack" || + packageType === "dojo" || + packageType === "kakarot" + ) { + const FRONTEND_BASE_PATH = "frontend/src/app"; + const componentsToRemove = [ `${FRONTEND_BASE_PATH}/burner`, `${FRONTEND_BASE_PATH}/wikipedia`, `${FRONTEND_BASE_PATH}/scaffold-deployer`, @@ -78,49 +102,45 @@ const installPackage = async () => { `${FRONTEND_BASE_PATH}/components/AssetTransferModal.tsx`, `${FRONTEND_BASE_PATH}/components/ConnectionModal.tsx`, `${FRONTEND_BASE_PATH}/components/ContractExecutionModal.tsx`, - ]; - cleanupTasks.push( + ]; + cleanupTasks.push( ...componentsToRemove.map((comp) => - rm(path.join(projectPath, comp), { + rm(path.join(projectPath, comp), { recursive: true, force: true, - }), + }) ), ...excluded_files.map((comp) => - rm(path.join(projectPath, comp), { + rm(path.join(projectPath, comp), { recursive: true, force: true, - }), - ), + }) + ) ); - } - else if (packageType == "contract_only") { + } else if (packageType == "contract_only") { let componentsToRemove = [...excluded_files, "frontend", ".editorconfig"]; cleanupTasks.push( ...componentsToRemove.map((comp) => rm(path.join(projectPath, comp), { - recursive: true, - force: true, - }), - ), - ) - } - else { + recursive: true, + force: true, + }) + ) + ); + } else { cleanupTasks.push( ...excluded_files.map((comp) => - rm(path.join(projectPath, comp), { + rm(path.join(projectPath, comp), { recursive: true, force: true, - }), - ), + }) + ) ); } // remove useless files const cleanSpinner = ora("Removing useless files").start(); - await Promise.all([ - ...cleanupTasks, - ]); + await Promise.all([...cleanupTasks]); process.chdir(projectPath); // remove the packages needed for cli @@ -129,10 +149,15 @@ const installPackage = async () => { // install dependencies const npmSpinner = ora("Installing dependencies...").start(); - if(packageType == "dojo") { - await exec("npm run install --legacy-peer-deps && npm run initialize-dojo"); - } - else if(packageType !== "contract_only") { + if (packageType == "dojo") { + await exec( + "npm run install --legacy-peer-deps && npm run initialize-dojo" + ); + } else if (packageType !== "kakarot") { + await exec( + "npm run install --legacy-peer-deps && npm run initialize-kakarot" + ); + } else if (packageType !== "contract_only") { await exec("npm run install --legacy-peer-deps"); } npmSpinner.succeed(); @@ -141,7 +166,6 @@ const installPackage = async () => { console.log("You can now run the scaffold with:"); console.log(` cd ${packageName}`); console.log(` npm run start`); - } catch (err) { // clean up in case of error, so the user does not have to do it manually fs.rmSync(projectPath, { recursive: true, force: true }); From 2dbdcd5afeb79bdacd0f873808253539e1ae9dca Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Thu, 26 Sep 2024 11:01:06 +0100 Subject: [PATCH 08/58] feat: add `Foundry` installation to script --- scripts/install_tools.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index a2e3668..48099d7 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -27,6 +27,18 @@ install_starknet_foundry() { } +# Install Foundry +install_foundry() { + if command_exists forge; then + echo "Foundry is already installed." + else + echo "Installing Foundry..." + curl -L https://foundry.paradigm.xyz | sh + foundryup + fi + +} + # Install Dojo install_dojo() { if command_exists dojoup; then From 1bb12aa67be4fbdfbbc9af1ba251aeeb230609ed Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Fri, 27 Sep 2024 10:51:36 +0100 Subject: [PATCH 09/58] fix: fix else if statement --- bin/cli.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cli.mjs b/bin/cli.mjs index 3b55342..1359e54 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -153,7 +153,7 @@ const installPackage = async () => { await exec( "npm run install --legacy-peer-deps && npm run initialize-dojo" ); - } else if (packageType !== "kakarot") { + } else if (packageType == "kakarot") { await exec( "npm run install --legacy-peer-deps && npm run initialize-kakarot" ); From 3d85dce60732b5a4c738d319554361e55781f65a Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Fri, 27 Sep 2024 13:39:52 +0100 Subject: [PATCH 10/58] refac: modify kakarot scripts --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e3a1100..4c5e987 100644 --- a/package.json +++ b/package.json @@ -23,11 +23,11 @@ "start": "cd frontend && npm run dev", "install": "cd scripts && bash install_tools.sh && cd ../frontend && npm install --legacy-peer-deps", "build-ui": "cd frontend && npm run build", - "initialize-kakarot": "rm -rf contracts && mkdir contracts && cd contracts && git clone https://github.com/kkrt-labs/build-on-kakarot.git && cp -r build-on-kakarot/* ./ && rm -rf .github && rm -rf .trunk && rm -rf build-on-kakarot", - "setup-kakarot": "cd contracts && make setup", + "initialize-kakarot": "rm -rf contracts && mkdir contracts && cd contracts && git clone https://github.com/kkrt-labs/build-on-kakarot.git && cp -r build-on-kakarot/. ./ && rm -rf .github && rm -rf .trunk && rm -rf build-on-kakarot && git init", + "setup-kakarot": "cd contracts && make setup", "start-kakarot": "cd contracts && make start", "deploy-kakarot-l1-messaging-contracts": "cd contracts && make deploy-l1", - "deploy-kakarot-evm-contract": "cd contracts && forge create solidity_contracts/src/${npm_contract_path} --private-key $PRIVATE_KEY" + "deploy-kakarot-evm-contract": "cd contracts && forge create ${npm_config_contract_path} --rpc-url ${npm_config_rpc_url} --private-key ${npm_config_private_key}" }, "repository": { "type": "git", From c15c7189960f965d382df8444f7e7a650dd2b08c Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Fri, 27 Sep 2024 13:41:36 +0100 Subject: [PATCH 11/58] refac: reorder packtage type choices --- bin/cli.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cli.mjs b/bin/cli.mjs index 1359e54..aeee067 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -34,8 +34,8 @@ const installPackage = async () => { const packageTypeChoices = [ "contract_only", "fullstack", - "dojo", "debugger", + "dojo", "kakarot", ]; console.log("Available package types:"); From 78434de05959c80785e948fef2cc3c6f78308284 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Fri, 27 Sep 2024 18:08:08 +0100 Subject: [PATCH 12/58] refac: modify script to install specific version --- bin/cli.mjs | 41 +++++++++++++++++-- kakarot/scripts/install_tools.sh | 67 ++++++++++++++++++++++++++++++++ package.json | 5 ++- 3 files changed, 108 insertions(+), 5 deletions(-) create mode 100644 kakarot/scripts/install_tools.sh diff --git a/bin/cli.mjs b/bin/cli.mjs index aeee067..0691256 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -6,7 +6,7 @@ import fs from "fs"; import path from "path"; import ora from "ora"; -const git_repo = "https://github.com/horuslabsio/Starknet-Scaffold"; +const git_repo = "https://github.com/EjembiEmmanuel/Starknet-Scaffold.git"; // convert libs to promises const exec = promisify(cp.exec); @@ -46,7 +46,7 @@ const installPackage = async () => { let packageType; while (!packageType) { const packageTypeChoice = await askQuestion( - "Select the package type (1-4): " + "Select the package type (1-5): " ); packageType = packageTypeChoices[parseInt(packageTypeChoice) - 1]; if (!packageType) { @@ -154,8 +154,14 @@ const installPackage = async () => { "npm run install --legacy-peer-deps && npm run initialize-dojo" ); } else if (packageType == "kakarot") { + await exec("npm run initialize-kakarot"); + + const tool_versions = await getVersionsFromToolFile( + path.join(projectPath, "/contracts/cairo_contracts/.tool-versions") + ); + await exec( - "npm run install --legacy-peer-deps && npm run initialize-kakarot" + `npm run install --scarb-version=${tool_versions.scarb} --legacy-peer-deps` ); } else if (packageType !== "contract_only") { await exec("npm run install --legacy-peer-deps"); @@ -175,4 +181,33 @@ const installPackage = async () => { } }; +/** + * Reads the .tool-versions file and returns the versions of packages. + * @param {string} filePath - The path to the .tool-versions file. + * @returns {Promise} - A promise that resolves to an object containing package names and their versions. + */ +function getVersionsFromToolFile(filePath) { + return new Promise((resolve, reject) => { + fs.readFile(filePath, "utf8", (err, data) => { + if (err) { + return reject(err); + } + + const versions = {}; + const lines = data.trim().split("\n"); + + for (const line of lines) { + const [packageName, version] = line + .split(" ") + .map((item) => item.trim()); + if (packageName && version) { + versions[packageName] = version; + } + } + + resolve(versions); + }); + }); +} + installPackage(); diff --git a/kakarot/scripts/install_tools.sh b/kakarot/scripts/install_tools.sh new file mode 100644 index 0000000..48099d7 --- /dev/null +++ b/kakarot/scripts/install_tools.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +# Function to check if a command exists +command_exists () { + command -v "$1" >/dev/null 2>&1 ; +} + +# Install Scarb +install_scarb() { + if command_exists scarb; then + echo "Scarb is already installed." + else + echo "Installing Scarb..." + curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh + fi +} + +# Install Starknet-Foundry +install_starknet_foundry() { + if command_exists snforge; then + echo "Starknet-Foundry is already installed." + else + echo "Installing Starknet-Foundry..." + curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh + snfoundryup + fi + +} + +# Install Foundry +install_foundry() { + if command_exists forge; then + echo "Foundry is already installed." + else + echo "Installing Foundry..." + curl -L https://foundry.paradigm.xyz | sh + foundryup + fi + +} + +# Install Dojo +install_dojo() { + if command_exists dojoup; then + echo "Dojo is already installed." + else + echo "Installing Dojo..." + git clone https://github.com/dojoengine/dojo + cd dojo + echo "Installing Sozo..." + cargo install --path ./bin/sozo --locked --force + echo "Installing Katana..." + cargo install --path ./bin/katana --locked --force + cd .. && rm -rf dojo + fi +} + +# Main function to call installation scripts +main() { + install_scarb + install_starknet_foundry + install_dojo + + echo "Installation complete!" +} + +main diff --git a/package.json b/package.json index 4c5e987..01c87e5 100644 --- a/package.json +++ b/package.json @@ -21,13 +21,14 @@ "migrate-dojo": "cd contracts/${npm_config_name} && sozo migrate apply", "devnet": "sh ./devnet/start.sh", "start": "cd frontend && npm run dev", - "install": "cd scripts && bash install_tools.sh && cd ../frontend && npm install --legacy-peer-deps", + "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} && cd ../frontend && npm install --legacy-peer-deps", "build-ui": "cd frontend && npm run build", "initialize-kakarot": "rm -rf contracts && mkdir contracts && cd contracts && git clone https://github.com/kkrt-labs/build-on-kakarot.git && cp -r build-on-kakarot/. ./ && rm -rf .github && rm -rf .trunk && rm -rf build-on-kakarot && git init", "setup-kakarot": "cd contracts && make setup", "start-kakarot": "cd contracts && make start", "deploy-kakarot-l1-messaging-contracts": "cd contracts && make deploy-l1", - "deploy-kakarot-evm-contract": "cd contracts && forge create ${npm_config_contract_path} --rpc-url ${npm_config_rpc_url} --private-key ${npm_config_private_key}" + "deploy-kakarot-evm-contract": "cd contracts && forge create ${npm_config_contract_path} --rpc-url ${npm_config_rpc_url} --private-key ${npm_config_private_key}", + "build-kakarot-cairo-contracts": "cd contracts/cairo_contracts && scarb build" }, "repository": { "type": "git", From 6cc0654764cb799710f4442fe81993b67b07a243 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Fri, 27 Sep 2024 18:18:21 +0100 Subject: [PATCH 13/58] refac: modify scripts to install package version --- scripts/install_tools.sh | 65 ++++++++++++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 9 deletions(-) diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index 48099d7..b46caa5 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -1,3 +1,4 @@ +# Main function to call installation scripts #!/bin/bash # Function to check if a command exists @@ -7,11 +8,18 @@ command_exists () { # Install Scarb install_scarb() { - if command_exists scarb; then - echo "Scarb is already installed." - else - echo "Installing Scarb..." - curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh + local version=$1 + + if [ -n "$version" ]; then + echo "Installing Scarb $version..." + curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v $version + else + if command_exists scarb; then + echo "Scarb is already installed." + else + echo "Installing Scarb latest..." + curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh + fi fi } @@ -57,11 +65,50 @@ install_dojo() { # Main function to call installation scripts main() { - install_scarb - install_starknet_foundry - install_dojo + # Default versions (empty means latest) + local scarb_version="" + local starknet_foundry_version="" + local dojo_version="" + local foundry_version="" + + # Parse the arguments + while [[ $# -gt 0 ]]; do + case $1 in + --scarb) + shift + scarb_version=$1 + shift + ;; + --starknet-foundry) + shift + starknet_foundry_version=$1 + shift + ;; + --dojo) + shift + dojo_version=$1 + shift + ;; + --foundry) + shift + foundry_version=$1 + shift + ;; + *) + echo "Unknown argument: $1" + echo "Available options: --scarb [version], --starknet-foundry [version], --dojo [version], --foundry [version]" + exit 1 + ;; + esac + done + + # Install all packages, using the specified version or default to latest + install_scarb "$scarb_version" + install_starknet_foundry "$starknet_foundry_version" + install_dojo "$dojo_version" + install_foundry "$foundry_version" echo "Installation complete!" } -main +main "$@" From 29ac451c53cc52a58e81915d2bf8e692e592422c Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Sat, 28 Sep 2024 21:33:46 +0100 Subject: [PATCH 14/58] feat: add starkli installation to intall script --- scripts/install_tools.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index b46caa5..f0a557a 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -23,6 +23,17 @@ install_scarb() { fi } +# Install Starkli +install_starkli() { + if command_exists starkliup; then + echo "Starkli is already installed." + else + echo "Installing Starkli..." + curl https://get.starkli.sh | sh + starkliup + fi +} + # Install Starknet-Foundry install_starknet_foundry() { if command_exists snforge; then From 6c8e8bf9002dd1db47f2f3b8c88840bbf087152a Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Sat, 28 Sep 2024 21:34:56 +0100 Subject: [PATCH 15/58] feat: add declare-kakarot-cairo-contract script --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 01c87e5..a5942ff 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "start-kakarot": "cd contracts && make start", "deploy-kakarot-l1-messaging-contracts": "cd contracts && make deploy-l1", "deploy-kakarot-evm-contract": "cd contracts && forge create ${npm_config_contract_path} --rpc-url ${npm_config_rpc_url} --private-key ${npm_config_private_key}", - "build-kakarot-cairo-contracts": "cd contracts/cairo_contracts && scarb build" + "build-kakarot-cairo-contracts": "cd contracts/cairo_contracts && scarb build", + "declare-kakarot-cairo-contract": "cd contracts && starkli declare ${npm_config_class_file} --account ${npm_config_account} --key-store ${npm_config_keystore} --rpc ${npm_config_rpc}" }, "repository": { "type": "git", From ceb9f6b7afb96168e5b8ea33d52269f8247fcb7a Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Sat, 28 Sep 2024 22:08:41 +0100 Subject: [PATCH 16/58] fix: fix starkli call omission in install script --- kakarot/scripts/install_tools.sh | 67 -------------------------------- scripts/install_tools.sh | 7 ++++ 2 files changed, 7 insertions(+), 67 deletions(-) delete mode 100644 kakarot/scripts/install_tools.sh diff --git a/kakarot/scripts/install_tools.sh b/kakarot/scripts/install_tools.sh deleted file mode 100644 index 48099d7..0000000 --- a/kakarot/scripts/install_tools.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -# Function to check if a command exists -command_exists () { - command -v "$1" >/dev/null 2>&1 ; -} - -# Install Scarb -install_scarb() { - if command_exists scarb; then - echo "Scarb is already installed." - else - echo "Installing Scarb..." - curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh - fi -} - -# Install Starknet-Foundry -install_starknet_foundry() { - if command_exists snforge; then - echo "Starknet-Foundry is already installed." - else - echo "Installing Starknet-Foundry..." - curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh - snfoundryup - fi - -} - -# Install Foundry -install_foundry() { - if command_exists forge; then - echo "Foundry is already installed." - else - echo "Installing Foundry..." - curl -L https://foundry.paradigm.xyz | sh - foundryup - fi - -} - -# Install Dojo -install_dojo() { - if command_exists dojoup; then - echo "Dojo is already installed." - else - echo "Installing Dojo..." - git clone https://github.com/dojoengine/dojo - cd dojo - echo "Installing Sozo..." - cargo install --path ./bin/sozo --locked --force - echo "Installing Katana..." - cargo install --path ./bin/katana --locked --force - cd .. && rm -rf dojo - fi -} - -# Main function to call installation scripts -main() { - install_scarb - install_starknet_foundry - install_dojo - - echo "Installation complete!" -} - -main diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index f0a557a..34d9c43 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -78,6 +78,7 @@ install_dojo() { main() { # Default versions (empty means latest) local scarb_version="" + local starkli_version="" local starknet_foundry_version="" local dojo_version="" local foundry_version="" @@ -90,6 +91,11 @@ main() { scarb_version=$1 shift ;; + --starkli) + shift + starkli_version=$1 + shift + ;; --starknet-foundry) shift starknet_foundry_version=$1 @@ -115,6 +121,7 @@ main() { # Install all packages, using the specified version or default to latest install_scarb "$scarb_version" + install_starkli "$starkli_version" install_starknet_foundry "$starknet_foundry_version" install_dojo "$dojo_version" install_foundry "$foundry_version" From cf9f0a20f263498d7afc297b50134e9918a1549e Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Sat, 28 Sep 2024 22:11:40 +0100 Subject: [PATCH 17/58] refac: modify declare-kakarot-cairo-contract script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a5942ff..2b3f9ef 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "deploy-kakarot-l1-messaging-contracts": "cd contracts && make deploy-l1", "deploy-kakarot-evm-contract": "cd contracts && forge create ${npm_config_contract_path} --rpc-url ${npm_config_rpc_url} --private-key ${npm_config_private_key}", "build-kakarot-cairo-contracts": "cd contracts/cairo_contracts && scarb build", - "declare-kakarot-cairo-contract": "cd contracts && starkli declare ${npm_config_class_file} --account ${npm_config_account} --key-store ${npm_config_keystore} --rpc ${npm_config_rpc}" + "declare-kakarot-cairo-contract": "cd contracts && starkli declare ${npm_config_class_file} --account ${npm_config_account} --keystore ${npm_config_keystore} --rpc ${npm_config_rpc}" }, "repository": { "type": "git", From 4416bc91d24b31dda305629cd7645df4d629d560 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Sat, 28 Sep 2024 22:21:51 +0100 Subject: [PATCH 18/58] refac: modify install script --- scripts/install_tools.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index 34d9c43..7e065a8 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -121,7 +121,7 @@ main() { # Install all packages, using the specified version or default to latest install_scarb "$scarb_version" - install_starkli "$starkli_version" + install_starkli install_starknet_foundry "$starknet_foundry_version" install_dojo "$dojo_version" install_foundry "$foundry_version" From 25f5ff1eb1d4151fa1e3c01eb6d06c1d8beddada Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Sun, 29 Sep 2024 11:50:59 +0100 Subject: [PATCH 19/58] refac: modify install script --- scripts/install_tools.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index 7e065a8..34d9c43 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -121,7 +121,7 @@ main() { # Install all packages, using the specified version or default to latest install_scarb "$scarb_version" - install_starkli + install_starkli "$starkli_version" install_starknet_foundry "$starknet_foundry_version" install_dojo "$dojo_version" install_foundry "$foundry_version" From 0548bc33132625a10ceea041313b2f00f7e8f3ff Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Sun, 29 Sep 2024 12:12:10 +0100 Subject: [PATCH 20/58] refac: modify npm install script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2b3f9ef..adc23af 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "migrate-dojo": "cd contracts/${npm_config_name} && sozo migrate apply", "devnet": "sh ./devnet/start.sh", "start": "cd frontend && npm run dev", - "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} && cd ../frontend && npm install --legacy-peer-deps", + "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} --starkli ${npm_config_starkli_version} --starknet-foundry ${npm_config_starknet_foundry_version} --foundry ${npm_config_foundry_version} --dojo ${npm_config_dojo_version} && cd ../frontend && npm install --legacy-peer-deps", "build-ui": "cd frontend && npm run build", "initialize-kakarot": "rm -rf contracts && mkdir contracts && cd contracts && git clone https://github.com/kkrt-labs/build-on-kakarot.git && cp -r build-on-kakarot/. ./ && rm -rf .github && rm -rf .trunk && rm -rf build-on-kakarot && git init", "setup-kakarot": "cd contracts && make setup", From 1e77ac4f7c0ed9503780332178b2ee34aae7042b Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Sun, 29 Sep 2024 12:27:31 +0100 Subject: [PATCH 21/58] feat: reload shell before running starkliup --- scripts/install_tools.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index 34d9c43..076d418 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -30,6 +30,14 @@ install_starkli() { else echo "Installing Starkli..." curl https://get.starkli.sh | sh + + # Reload the shell to make starkliup available in the current session + if [ -f "$HOME/.bashrc" ]; then + source "$HOME/.bashrc" + elif [ -f "$HOME/.zshrc" ]; then + source "$HOME/.zshrc" + fi + starkliup fi } From 62602d3789d2b3bdbc0d030df50b4a71f31a804e Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Sun, 29 Sep 2024 12:42:03 +0100 Subject: [PATCH 22/58] feat: add install_tools script --- bin/cli.mjs | 2 ++ package.json | 1 + 2 files changed, 3 insertions(+) diff --git a/bin/cli.mjs b/bin/cli.mjs index 0691256..4927c7f 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -163,6 +163,8 @@ const installPackage = async () => { await exec( `npm run install --scarb-version=${tool_versions.scarb} --legacy-peer-deps` ); + + await exec(`npm run install_tools`); } else if (packageType !== "contract_only") { await exec("npm run install --legacy-peer-deps"); } diff --git a/package.json b/package.json index adc23af..597fa25 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "devnet": "sh ./devnet/start.sh", "start": "cd frontend && npm run dev", "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} --starkli ${npm_config_starkli_version} --starknet-foundry ${npm_config_starknet_foundry_version} --foundry ${npm_config_foundry_version} --dojo ${npm_config_dojo_version} && cd ../frontend && npm install --legacy-peer-deps", + "install-tools": "starkliup", "build-ui": "cd frontend && npm run build", "initialize-kakarot": "rm -rf contracts && mkdir contracts && cd contracts && git clone https://github.com/kkrt-labs/build-on-kakarot.git && cp -r build-on-kakarot/. ./ && rm -rf .github && rm -rf .trunk && rm -rf build-on-kakarot && git init", "setup-kakarot": "cd contracts && make setup", From 5866470dcbfd94459f86276c5f01f76b444e3844 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Sun, 29 Sep 2024 13:03:50 +0100 Subject: [PATCH 23/58] fix: fix typo --- bin/cli.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cli.mjs b/bin/cli.mjs index 4927c7f..5220dbd 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -164,7 +164,7 @@ const installPackage = async () => { `npm run install --scarb-version=${tool_versions.scarb} --legacy-peer-deps` ); - await exec(`npm run install_tools`); + await exec(`npm run install-tools`); } else if (packageType !== "contract_only") { await exec("npm run install --legacy-peer-deps"); } From 3c111a0d7b026ae52faaeeda9d75f123eed7dd00 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Sun, 29 Sep 2024 13:20:51 +0100 Subject: [PATCH 24/58] refac: modify install script --- bin/cli.mjs | 2 -- package.json | 4 ++-- scripts/install_tools.sh | 11 ----------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/bin/cli.mjs b/bin/cli.mjs index 5220dbd..0691256 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -163,8 +163,6 @@ const installPackage = async () => { await exec( `npm run install --scarb-version=${tool_versions.scarb} --legacy-peer-deps` ); - - await exec(`npm run install-tools`); } else if (packageType !== "contract_only") { await exec("npm run install --legacy-peer-deps"); } diff --git a/package.json b/package.json index 597fa25..9073109 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,8 @@ "migrate-dojo": "cd contracts/${npm_config_name} && sozo migrate apply", "devnet": "sh ./devnet/start.sh", "start": "cd frontend && npm run dev", - "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} --starkli ${npm_config_starkli_version} --starknet-foundry ${npm_config_starknet_foundry_version} --foundry ${npm_config_foundry_version} --dojo ${npm_config_dojo_version} && cd ../frontend && npm install --legacy-peer-deps", - "install-tools": "starkliup", + "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} --starkli ${npm_config_starkli_version} --starknet-foundry ${npm_config_starknet_foundry_version} --foundry ${npm_config_foundry_version} --dojo ${npm_config_dojo_version} && npm run install_tools && cd ../frontend && npm install --legacy-peer-deps", + "install-tools": "starkliup && snfoundryup && foundryup", "build-ui": "cd frontend && npm run build", "initialize-kakarot": "rm -rf contracts && mkdir contracts && cd contracts && git clone https://github.com/kkrt-labs/build-on-kakarot.git && cp -r build-on-kakarot/. ./ && rm -rf .github && rm -rf .trunk && rm -rf build-on-kakarot && git init", "setup-kakarot": "cd contracts && make setup", diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index 076d418..ba621e2 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -30,15 +30,6 @@ install_starkli() { else echo "Installing Starkli..." curl https://get.starkli.sh | sh - - # Reload the shell to make starkliup available in the current session - if [ -f "$HOME/.bashrc" ]; then - source "$HOME/.bashrc" - elif [ -f "$HOME/.zshrc" ]; then - source "$HOME/.zshrc" - fi - - starkliup fi } @@ -49,7 +40,6 @@ install_starknet_foundry() { else echo "Installing Starknet-Foundry..." curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh - snfoundryup fi } @@ -61,7 +51,6 @@ install_foundry() { else echo "Installing Foundry..." curl -L https://foundry.paradigm.xyz | sh - foundryup fi } From 834a033a81cb69f785dcf0436aba20997c7cf69d Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Sun, 29 Sep 2024 13:32:39 +0100 Subject: [PATCH 25/58] fix: fix typo --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9073109..a27b0a3 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "migrate-dojo": "cd contracts/${npm_config_name} && sozo migrate apply", "devnet": "sh ./devnet/start.sh", "start": "cd frontend && npm run dev", - "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} --starkli ${npm_config_starkli_version} --starknet-foundry ${npm_config_starknet_foundry_version} --foundry ${npm_config_foundry_version} --dojo ${npm_config_dojo_version} && npm run install_tools && cd ../frontend && npm install --legacy-peer-deps", + "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} --starkli ${npm_config_starkli_version} --starknet-foundry ${npm_config_starknet_foundry_version} --foundry ${npm_config_foundry_version} --dojo ${npm_config_dojo_version} && npm run install-tools && cd ../frontend && npm install --legacy-peer-deps", "install-tools": "starkliup && snfoundryup && foundryup", "build-ui": "cd frontend && npm run build", "initialize-kakarot": "rm -rf contracts && mkdir contracts && cd contracts && git clone https://github.com/kkrt-labs/build-on-kakarot.git && cp -r build-on-kakarot/. ./ && rm -rf .github && rm -rf .trunk && rm -rf build-on-kakarot && git init", From 83e7279078f8b4d7b948e2f5de72c0a4df99797f Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 1 Oct 2024 09:39:20 +0100 Subject: [PATCH 26/58] refac: remove declare kakarot contracts script --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index a27b0a3..ea5295a 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,7 @@ "start-kakarot": "cd contracts && make start", "deploy-kakarot-l1-messaging-contracts": "cd contracts && make deploy-l1", "deploy-kakarot-evm-contract": "cd contracts && forge create ${npm_config_contract_path} --rpc-url ${npm_config_rpc_url} --private-key ${npm_config_private_key}", - "build-kakarot-cairo-contracts": "cd contracts/cairo_contracts && scarb build", - "declare-kakarot-cairo-contract": "cd contracts && starkli declare ${npm_config_class_file} --account ${npm_config_account} --keystore ${npm_config_keystore} --rpc ${npm_config_rpc}" + "build-kakarot-cairo-contracts": "cd contracts/cairo_contracts && scarb build" }, "repository": { "type": "git", From fc6954be66b9563adadeec9f357ec3c627a73167 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 1 Oct 2024 09:45:03 +0100 Subject: [PATCH 27/58] feat: remove starkli installation --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ea5295a..fa1efcb 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "devnet": "sh ./devnet/start.sh", "start": "cd frontend && npm run dev", "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} --starkli ${npm_config_starkli_version} --starknet-foundry ${npm_config_starknet_foundry_version} --foundry ${npm_config_foundry_version} --dojo ${npm_config_dojo_version} && npm run install-tools && cd ../frontend && npm install --legacy-peer-deps", - "install-tools": "starkliup && snfoundryup && foundryup", + "install-tools": "snfoundryup && foundryup", "build-ui": "cd frontend && npm run build", "initialize-kakarot": "rm -rf contracts && mkdir contracts && cd contracts && git clone https://github.com/kkrt-labs/build-on-kakarot.git && cp -r build-on-kakarot/. ./ && rm -rf .github && rm -rf .trunk && rm -rf build-on-kakarot && git init", "setup-kakarot": "cd contracts && make setup", From 0ae499d4357f93791af294ca51143741d0bbbf63 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 1 Oct 2024 12:15:43 +0100 Subject: [PATCH 28/58] refac: modify npm install script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fa1efcb..127a5b6 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "migrate-dojo": "cd contracts/${npm_config_name} && sozo migrate apply", "devnet": "sh ./devnet/start.sh", "start": "cd frontend && npm run dev", - "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} --starkli ${npm_config_starkli_version} --starknet-foundry ${npm_config_starknet_foundry_version} --foundry ${npm_config_foundry_version} --dojo ${npm_config_dojo_version} && npm run install-tools && cd ../frontend && npm install --legacy-peer-deps", + "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} --starkli ${npm_config_starkli_version} --starknet-foundry ${npm_config_starknet_foundry_version} --foundry ${npm_config_foundry_version} --dojo ${npm_config_dojo_version} && cd ../frontend && npm install --legacy-peer-deps", "install-tools": "snfoundryup && foundryup", "build-ui": "cd frontend && npm run build", "initialize-kakarot": "rm -rf contracts && mkdir contracts && cd contracts && git clone https://github.com/kkrt-labs/build-on-kakarot.git && cp -r build-on-kakarot/. ./ && rm -rf .github && rm -rf .trunk && rm -rf build-on-kakarot && git init", From 98868966a9c450d004695981f00a47387c9447f6 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 1 Oct 2024 12:16:48 +0100 Subject: [PATCH 29/58] feat: include setup-kakarot script in bin/cli.mjs --- bin/cli.mjs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/cli.mjs b/bin/cli.mjs index 0691256..d07d657 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -156,6 +156,8 @@ const installPackage = async () => { } else if (packageType == "kakarot") { await exec("npm run initialize-kakarot"); + await exec("npm run setup-kakarot"); + const tool_versions = await getVersionsFromToolFile( path.join(projectPath, "/contracts/cairo_contracts/.tool-versions") ); @@ -163,6 +165,8 @@ const installPackage = async () => { await exec( `npm run install --scarb-version=${tool_versions.scarb} --legacy-peer-deps` ); + + await exec("npm run install-tools"); } else if (packageType !== "contract_only") { await exec("npm run install --legacy-peer-deps"); } @@ -171,7 +175,12 @@ const installPackage = async () => { console.log("The installation is done!"); console.log("You can now run the scaffold with:"); console.log(` cd ${packageName}`); - console.log(` npm run start`); + + if (packageType == "kakarot") { + console.log(` npm run start-kakarot`); + } else { + console.log(` npm run start`); + } } catch (err) { // clean up in case of error, so the user does not have to do it manually fs.rmSync(projectPath, { recursive: true, force: true }); From f0adb00fcaf04391ec65c7c7baa8cdd2b7b1164b Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 1 Oct 2024 12:31:18 +0100 Subject: [PATCH 30/58] feat: remove starkli installation --- scripts/install_tools.sh | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index ba621e2..5553620 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -23,16 +23,6 @@ install_scarb() { fi } -# Install Starkli -install_starkli() { - if command_exists starkliup; then - echo "Starkli is already installed." - else - echo "Installing Starkli..." - curl https://get.starkli.sh | sh - fi -} - # Install Starknet-Foundry install_starknet_foundry() { if command_exists snforge; then @@ -75,7 +65,6 @@ install_dojo() { main() { # Default versions (empty means latest) local scarb_version="" - local starkli_version="" local starknet_foundry_version="" local dojo_version="" local foundry_version="" @@ -88,11 +77,6 @@ main() { scarb_version=$1 shift ;; - --starkli) - shift - starkli_version=$1 - shift - ;; --starknet-foundry) shift starknet_foundry_version=$1 @@ -118,7 +102,6 @@ main() { # Install all packages, using the specified version or default to latest install_scarb "$scarb_version" - install_starkli "$starkli_version" install_starknet_foundry "$starknet_foundry_version" install_dojo "$dojo_version" install_foundry "$foundry_version" From 3811bf0740b8843f5c982103fe68975c01c61369 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 1 Oct 2024 12:59:01 +0100 Subject: [PATCH 31/58] fix: fix npm install script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 127a5b6..83b64e6 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "migrate-dojo": "cd contracts/${npm_config_name} && sozo migrate apply", "devnet": "sh ./devnet/start.sh", "start": "cd frontend && npm run dev", - "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} --starkli ${npm_config_starkli_version} --starknet-foundry ${npm_config_starknet_foundry_version} --foundry ${npm_config_foundry_version} --dojo ${npm_config_dojo_version} && cd ../frontend && npm install --legacy-peer-deps", + "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} --starknet-foundry ${npm_config_starknet_foundry_version} --foundry ${npm_config_foundry_version} --dojo ${npm_config_dojo_version} && cd ../frontend && npm install --legacy-peer-deps", "install-tools": "snfoundryup && foundryup", "build-ui": "cd frontend && npm run build", "initialize-kakarot": "rm -rf contracts && mkdir contracts && cd contracts && git clone https://github.com/kkrt-labs/build-on-kakarot.git && cp -r build-on-kakarot/. ./ && rm -rf .github && rm -rf .trunk && rm -rf build-on-kakarot && git init", From f13375a2943c5410ee5535bb48227a83023a1b9a Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 1 Oct 2024 13:49:10 +0100 Subject: [PATCH 32/58] refac: modify install script --- scripts/install_tools.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index 5553620..6ba7b3e 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -103,8 +103,8 @@ main() { # Install all packages, using the specified version or default to latest install_scarb "$scarb_version" install_starknet_foundry "$starknet_foundry_version" - install_dojo "$dojo_version" install_foundry "$foundry_version" + install_dojo "$dojo_version" echo "Installation complete!" } From 66545f43595ffa7d40290ed752d21b9860c8c9c9 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 1 Oct 2024 14:06:25 +0100 Subject: [PATCH 33/58] refac: modify npm install-tools script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 83b64e6..e26d0c9 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "devnet": "sh ./devnet/start.sh", "start": "cd frontend && npm run dev", "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} --starknet-foundry ${npm_config_starknet_foundry_version} --foundry ${npm_config_foundry_version} --dojo ${npm_config_dojo_version} && cd ../frontend && npm install --legacy-peer-deps", - "install-tools": "snfoundryup && foundryup", + "install-tools": "snfoundryup", "build-ui": "cd frontend && npm run build", "initialize-kakarot": "rm -rf contracts && mkdir contracts && cd contracts && git clone https://github.com/kkrt-labs/build-on-kakarot.git && cp -r build-on-kakarot/. ./ && rm -rf .github && rm -rf .trunk && rm -rf build-on-kakarot && git init", "setup-kakarot": "cd contracts && make setup", From f3f11c65723d19b2d8e95649b030b5d2f9d2ec20 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 1 Oct 2024 14:47:01 +0100 Subject: [PATCH 34/58] fix: fix npm install script --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e26d0c9..bb5305b 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,8 @@ "migrate-dojo": "cd contracts/${npm_config_name} && sozo migrate apply", "devnet": "sh ./devnet/start.sh", "start": "cd frontend && npm run dev", - "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version} --starknet-foundry ${npm_config_starknet_foundry_version} --foundry ${npm_config_foundry_version} --dojo ${npm_config_dojo_version} && cd ../frontend && npm install --legacy-peer-deps", - "install-tools": "snfoundryup", + "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version:-''} --starknet-foundry ${npm_config_starknet_foundry_version:-''} --foundry ${npm_config_foundry_version:-''} --dojo ${npm_config_dojo_version:-''} && cd ../frontend && npm install --legacy-peer-deps", + "install-tools": "snfoundryup && foundryup", "build-ui": "cd frontend && npm run build", "initialize-kakarot": "rm -rf contracts && mkdir contracts && cd contracts && git clone https://github.com/kkrt-labs/build-on-kakarot.git && cp -r build-on-kakarot/. ./ && rm -rf .github && rm -rf .trunk && rm -rf build-on-kakarot && git init", "setup-kakarot": "cd contracts && make setup", From c50a44e6ce5122bf8eecccb0d9fe30a93158dbe6 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 1 Oct 2024 14:58:22 +0100 Subject: [PATCH 35/58] feat: modify install script --- bin/cli.mjs | 2 +- scripts/install_tools.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/cli.mjs b/bin/cli.mjs index d07d657..070a1a1 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -166,7 +166,7 @@ const installPackage = async () => { `npm run install --scarb-version=${tool_versions.scarb} --legacy-peer-deps` ); - await exec("npm run install-tools"); + // await exec("npm run install-tools"); } else if (packageType !== "contract_only") { await exec("npm run install --legacy-peer-deps"); } diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index 6ba7b3e..5ad8655 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -30,6 +30,7 @@ install_starknet_foundry() { else echo "Installing Starknet-Foundry..." curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh + snfoundryup fi } @@ -41,6 +42,7 @@ install_foundry() { else echo "Installing Foundry..." curl -L https://foundry.paradigm.xyz | sh + foundryup fi } From cb5aa178848d869698dc44049f0b4573159b0480 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Mon, 7 Oct 2024 11:27:43 +0100 Subject: [PATCH 36/58] feat: modify foundry install fn --- scripts/install_tools.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index 5ad8655..9be258e 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -41,7 +41,7 @@ install_foundry() { echo "Foundry is already installed." else echo "Installing Foundry..." - curl -L https://foundry.paradigm.xyz | sh + curl -L https://foundry.paradigm.xyz | bash foundryup fi From a79317234f491cc07c6e0e52f3f54740965397c8 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Mon, 7 Oct 2024 11:39:45 +0100 Subject: [PATCH 37/58] refac: change github repo --- bin/cli.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cli.mjs b/bin/cli.mjs index 070a1a1..b7d5c7e 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -6,7 +6,7 @@ import fs from "fs"; import path from "path"; import ora from "ora"; -const git_repo = "https://github.com/EjembiEmmanuel/Starknet-Scaffold.git"; +const git_repo = "https://github.com/horuslabsio/Starknet-Scaffold.git"; // convert libs to promises const exec = promisify(cp.exec); From 0208cbd395d4096537c3bb125322f6ff4de14dd3 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Mon, 7 Oct 2024 17:35:30 +0100 Subject: [PATCH 38/58] refac: change github link --- bin/cli.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cli.mjs b/bin/cli.mjs index b7d5c7e..070a1a1 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -6,7 +6,7 @@ import fs from "fs"; import path from "path"; import ora from "ora"; -const git_repo = "https://github.com/horuslabsio/Starknet-Scaffold.git"; +const git_repo = "https://github.com/EjembiEmmanuel/Starknet-Scaffold.git"; // convert libs to promises const exec = promisify(cp.exec); From d2c6dc53fc141cc297435d45ae110d562dabea34 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Mon, 7 Oct 2024 18:35:33 +0100 Subject: [PATCH 39/58] feat: modify scripts --- bin/cli.mjs | 2 +- package.json | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bin/cli.mjs b/bin/cli.mjs index 070a1a1..e77cb04 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -159,7 +159,7 @@ const installPackage = async () => { await exec("npm run setup-kakarot"); const tool_versions = await getVersionsFromToolFile( - path.join(projectPath, "/contracts/cairo_contracts/.tool-versions") + path.join(projectPath, "/contracts/.tool-versions") ); await exec( diff --git a/package.json b/package.json index bb5305b..0ea1d29 100644 --- a/package.json +++ b/package.json @@ -24,12 +24,11 @@ "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version:-''} --starknet-foundry ${npm_config_starknet_foundry_version:-''} --foundry ${npm_config_foundry_version:-''} --dojo ${npm_config_dojo_version:-''} && cd ../frontend && npm install --legacy-peer-deps", "install-tools": "snfoundryup && foundryup", "build-ui": "cd frontend && npm run build", - "initialize-kakarot": "rm -rf contracts && mkdir contracts && cd contracts && git clone https://github.com/kkrt-labs/build-on-kakarot.git && cp -r build-on-kakarot/. ./ && rm -rf .github && rm -rf .trunk && rm -rf build-on-kakarot && git init", - "setup-kakarot": "cd contracts && make setup", - "start-kakarot": "cd contracts && make start", - "deploy-kakarot-l1-messaging-contracts": "cd contracts && make deploy-l1", - "deploy-kakarot-evm-contract": "cd contracts && forge create ${npm_config_contract_path} --rpc-url ${npm_config_rpc_url} --private-key ${npm_config_private_key}", - "build-kakarot-cairo-contracts": "cd contracts/cairo_contracts && scarb build" + "initialize-kakarot": "git clone https://github.com/kkrt-labs/build-on-kakarot.git && rm -rf contracts && mkdir contracts && mv -r build-on-kakarot/cairo_contracts ./contracts && mkdir kakarot && mv -r build-on-kakarot/. ./kakarot && cd kakarot && rm -rf .github && rm -rf .trunk && git init && cd .. && rm -rf build-on-kakarot", + "setup-kakarot": "cd kakarot && make setup", + "start-kakarot": "cd kakarot && make start", + "deploy-kakarot-l1-messaging-contracts": "cd kakarot && make deploy-l1", + "deploy-kakarot-evm-contract": "cd kakarot && forge create ${npm_config_contract_path} --rpc-url ${npm_config_rpc_url} --private-key ${npm_config_private_key}" }, "repository": { "type": "git", From c8c262d8907b20ac3d96ae6da27e270709fd5cdb Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Mon, 7 Oct 2024 18:38:17 +0100 Subject: [PATCH 40/58] fix: fix initialize-kakarot script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0ea1d29..6c37bf8 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version:-''} --starknet-foundry ${npm_config_starknet_foundry_version:-''} --foundry ${npm_config_foundry_version:-''} --dojo ${npm_config_dojo_version:-''} && cd ../frontend && npm install --legacy-peer-deps", "install-tools": "snfoundryup && foundryup", "build-ui": "cd frontend && npm run build", - "initialize-kakarot": "git clone https://github.com/kkrt-labs/build-on-kakarot.git && rm -rf contracts && mkdir contracts && mv -r build-on-kakarot/cairo_contracts ./contracts && mkdir kakarot && mv -r build-on-kakarot/. ./kakarot && cd kakarot && rm -rf .github && rm -rf .trunk && git init && cd .. && rm -rf build-on-kakarot", + "initialize-kakarot": "git clone https://github.com/kkrt-labs/build-on-kakarot.git && rm -rf contracts && mkdir contracts && mv build-on-kakarot/cairo_contracts ./contracts && mkdir kakarot && mv build-on-kakarot/. ./kakarot && cd kakarot && rm -rf .github && rm -rf .trunk && git init && cd .. && rm -rf build-on-kakarot", "setup-kakarot": "cd kakarot && make setup", "start-kakarot": "cd kakarot && make start", "deploy-kakarot-l1-messaging-contracts": "cd kakarot && make deploy-l1", From b508ebe3eeb96aa223f3cc5d2a17216b933635c1 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Mon, 7 Oct 2024 18:40:10 +0100 Subject: [PATCH 41/58] fix: fix intialize-kakarot script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6c37bf8..388f77d 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version:-''} --starknet-foundry ${npm_config_starknet_foundry_version:-''} --foundry ${npm_config_foundry_version:-''} --dojo ${npm_config_dojo_version:-''} && cd ../frontend && npm install --legacy-peer-deps", "install-tools": "snfoundryup && foundryup", "build-ui": "cd frontend && npm run build", - "initialize-kakarot": "git clone https://github.com/kkrt-labs/build-on-kakarot.git && rm -rf contracts && mkdir contracts && mv build-on-kakarot/cairo_contracts ./contracts && mkdir kakarot && mv build-on-kakarot/. ./kakarot && cd kakarot && rm -rf .github && rm -rf .trunk && git init && cd .. && rm -rf build-on-kakarot", + "initialize-kakarot": "git clone https://github.com/kkrt-labs/build-on-kakarot.git && rm -rf contracts && mkdir contracts && cp -r build-on-kakarot/cairo_contracts ./contracts && mkdir kakarot && cp -r build-on-kakarot/. ./kakarot && cd kakarot && rm -rf cairo_contracts && rm -rf .github && rm -rf .trunk && git init && cd .. && rm -rf build-on-kakarot", "setup-kakarot": "cd kakarot && make setup", "start-kakarot": "cd kakarot && make start", "deploy-kakarot-l1-messaging-contracts": "cd kakarot && make deploy-l1", From f672a28aba3a8d8b0f1633d69f3e5b664883cd5d Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Mon, 7 Oct 2024 18:42:35 +0100 Subject: [PATCH 42/58] fix: fix initialize-kakarot script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 388f77d..fc42723 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version:-''} --starknet-foundry ${npm_config_starknet_foundry_version:-''} --foundry ${npm_config_foundry_version:-''} --dojo ${npm_config_dojo_version:-''} && cd ../frontend && npm install --legacy-peer-deps", "install-tools": "snfoundryup && foundryup", "build-ui": "cd frontend && npm run build", - "initialize-kakarot": "git clone https://github.com/kkrt-labs/build-on-kakarot.git && rm -rf contracts && mkdir contracts && cp -r build-on-kakarot/cairo_contracts ./contracts && mkdir kakarot && cp -r build-on-kakarot/. ./kakarot && cd kakarot && rm -rf cairo_contracts && rm -rf .github && rm -rf .trunk && git init && cd .. && rm -rf build-on-kakarot", + "initialize-kakarot": "git clone https://github.com/kkrt-labs/build-on-kakarot.git && rm -rf contracts && mkdir contracts && cp -r build-on-kakarot/cairo_contracts/. ./contracts && mkdir kakarot && cp -r build-on-kakarot/. ./kakarot && cd kakarot && rm -rf cairo_contracts && rm -rf .github && rm -rf .trunk && git init && cd .. && rm -rf build-on-kakarot", "setup-kakarot": "cd kakarot && make setup", "start-kakarot": "cd kakarot && make start", "deploy-kakarot-l1-messaging-contracts": "cd kakarot && make deploy-l1", From a50c9eaad8484b155f3234bcf3e47b86ff6f3f98 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Mon, 7 Oct 2024 23:00:09 +0100 Subject: [PATCH 43/58] feat: add version support for dojo installation --- bin/cli.mjs | 38 +++++++++++++++++++++++++++++++++++++- package.json | 2 +- scripts/install_tools.sh | 25 ++++++++++++++----------- 3 files changed, 52 insertions(+), 13 deletions(-) diff --git a/bin/cli.mjs b/bin/cli.mjs index e77cb04..7903fe2 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -7,6 +7,7 @@ import path from "path"; import ora from "ora"; const git_repo = "https://github.com/EjembiEmmanuel/Starknet-Scaffold.git"; +const dojo_starter = "https://github.com/dojoengine/dojo-starter.git"; // convert libs to promises const exec = promisify(cp.exec); @@ -151,8 +152,21 @@ const installPackage = async () => { const npmSpinner = ora("Installing dependencies...").start(); if (packageType == "dojo") { await exec( - "npm run install --legacy-peer-deps && npm run initialize-dojo" + `git clone --depth 1 ${dojo_starter} ${projectPath}/dojo-starter --quiet` ); + + const dojo_version = getDojoVersion( + path.join(projectPath, "/dojo-starter/Scarb.toml") + ); + + await exec( + `npm run install --dojo-version=${dojo_version} --legacy-peer-deps && npm run initialize-dojo` + ); + + fs.rmSync(path.join(projectPath, "/dojo-starter"), { + recursive: true, + force: true, + }); } else if (packageType == "kakarot") { await exec("npm run initialize-kakarot"); @@ -219,4 +233,26 @@ function getVersionsFromToolFile(filePath) { }); } +/** + * Reads the Scarb.toml file and returns the versions of dojo + * @param {string} filePath - The path to the Scarb.toml file. + * @returns {string} - A string corresponding to the dojo version. + */ +function getDojoVersion(filePath) { + const tomlContent = fs.readFileSync(filePath, "utf-8"); + + // Use a regular expression to match the Dojo version tag + const dojoVersionMatch = tomlContent.match( + /dojo\s*=\s*{[^}]*tag\s*=\s*"v([\d\w\.\-]+)"/ + ); + + // Check if the match was found and return the version with 'v' prefix + if (dojoVersionMatch && dojoVersionMatch[1]) { + return dojoVersionMatch[1]; + } + + // Return null if no version found + return null; +} + installPackage(); diff --git a/package.json b/package.json index fc42723..0c3841b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "create-starknet-app", + "name": "test-create-starknet-app", "version": "0.5.0", "description": "An open-source starknet development stack", "bin": "./bin/cli.mjs", diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index 9be258e..7ca6b91 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -49,17 +49,20 @@ install_foundry() { # Install Dojo install_dojo() { - if command_exists dojoup; then - echo "Dojo is already installed." - else - echo "Installing Dojo..." - git clone https://github.com/dojoengine/dojo - cd dojo - echo "Installing Sozo..." - cargo install --path ./bin/sozo --locked --force - echo "Installing Katana..." - cargo install --path ./bin/katana --locked --force - cd .. && rm -rf dojo + local version=$1 + + curl -L https://install.dojoengine.org | bash + + if [ -n "$version" ]; then + echo "Installing Dojo $version..." + dojoup --version $version + else + if command_exists dojoup; then + echo "Dojo is already installed." + else + echo "Installing Dojo latest..." + dojoup --version $version + fi fi } From 4e7d29538726db6edd005728968c5b0abb8b10a6 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 8 Oct 2024 09:20:20 +0100 Subject: [PATCH 44/58] feat: modify install scripts --- bin/cli.mjs | 4 +++- scripts/install_tools.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/cli.mjs b/bin/cli.mjs index 7903fe2..c84fcc5 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -160,9 +160,11 @@ const installPackage = async () => { ); await exec( - `npm run install --dojo-version=${dojo_version} --legacy-peer-deps && npm run initialize-dojo` + `npm run install --dojo-version=${dojo_version} --legacy-peer-deps` ); + await exec("npm run initialize-dojo"); + fs.rmSync(path.join(projectPath, "/dojo-starter"), { recursive: true, force: true, diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index 7ca6b91..2d47c32 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -61,7 +61,7 @@ install_dojo() { echo "Dojo is already installed." else echo "Installing Dojo latest..." - dojoup --version $version + dojoup fi fi } From e827426f77df85df82cfde2a3e68e0016d99e541 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 8 Oct 2024 09:40:24 +0100 Subject: [PATCH 45/58] fix: fix dojoup command not found --- scripts/install_tools.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index 2d47c32..4ffa036 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -50,9 +50,12 @@ install_foundry() { # Install Dojo install_dojo() { local version=$1 + local dojo_install_dir="$HOME/.dojo/bin" curl -L https://install.dojoengine.org | bash + export PATH="$PATH:$dojo_install_dir" + if [ -n "$version" ]; then echo "Installing Dojo $version..." dojoup --version $version From 066cc7bffe988f569d2035de775474963e6add18 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 8 Oct 2024 10:00:23 +0100 Subject: [PATCH 46/58] fix: fix foundryup command not found --- scripts/install_tools.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index 4ffa036..f33f665 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -37,11 +37,14 @@ install_starknet_foundry() { # Install Foundry install_foundry() { + local foundry_install_dir="$HOME/.foundry/bin" + if command_exists forge; then echo "Foundry is already installed." else echo "Installing Foundry..." curl -L https://foundry.paradigm.xyz | bash + export PATH="$PATH:$foundry_install_dir" foundryup fi From bd078e91776eba28b32bcebc2013d2ff8b519ae1 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 8 Oct 2024 10:16:21 +0100 Subject: [PATCH 47/58] chore: revert package name and github link --- bin/cli.mjs | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cli.mjs b/bin/cli.mjs index c84fcc5..23b87be 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -6,7 +6,7 @@ import fs from "fs"; import path from "path"; import ora from "ora"; -const git_repo = "https://github.com/EjembiEmmanuel/Starknet-Scaffold.git"; +const git_repo = "https://github.com/horuslabsio/Starknet-Scaffold.git"; const dojo_starter = "https://github.com/dojoengine/dojo-starter.git"; // convert libs to promises diff --git a/package.json b/package.json index 0c3841b..fc42723 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "test-create-starknet-app", + "name": "create-starknet-app", "version": "0.5.0", "description": "An open-source starknet development stack", "bin": "./bin/cli.mjs", From 5cdd0cc5c3357f935e41dd9eb62acc2a71c7a5e6 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 8 Oct 2024 14:01:56 +0100 Subject: [PATCH 48/58] feat: add version support for starknet-foundry installation --- scripts/install_tools.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index f33f665..61b8a21 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -25,14 +25,21 @@ install_scarb() { # Install Starknet-Foundry install_starknet_foundry() { - if command_exists snforge; then - echo "Starknet-Foundry is already installed." - else - echo "Installing Starknet-Foundry..." - curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh - snfoundryup - fi + local version=$1 + curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh + + if [ -n "$version" ]; then + echo "Installing Starknet-Foundry $version..." + snfoundryup --version $version + else + if command_exists snfoundryup; then + echo "Starknet-Foundry is already installed." + else + echo "Installing Starknet-Foundry latest..." + snfoundryup + fi + fi } # Install Foundry From 13cc5dc2c9bd6add5d6db02c4a9cb38d46cf79a9 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 8 Oct 2024 14:04:56 +0100 Subject: [PATCH 49/58] refac: modify foundry install script --- scripts/install_tools.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index 61b8a21..b4acdb8 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -46,15 +46,20 @@ install_starknet_foundry() { install_foundry() { local foundry_install_dir="$HOME/.foundry/bin" - if command_exists forge; then - echo "Foundry is already installed." - else - echo "Installing Foundry..." - curl -L https://foundry.paradigm.xyz | bash - export PATH="$PATH:$foundry_install_dir" - foundryup - fi + curl -L https://foundry.paradigm.xyz | bash + export PATH="$PATH:$foundry_install_dir" + if [ -n "$version" ]; then + echo "Installing Foundry $version..." + foundryup --version $version + else + if command_exists forge; then + echo "Foundry is already installed." + else + echo "Installing Foundry latest..." + foundryup + fi + fi } # Install Dojo From 17c14d67efb6c90fb7ee2e87d0d62a2804d4c804 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Tue, 8 Oct 2024 14:10:39 +0100 Subject: [PATCH 50/58] refac: modify starknet-foundry install script --- scripts/install_tools.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index b4acdb8..7b345f9 100644 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -33,7 +33,7 @@ install_starknet_foundry() { echo "Installing Starknet-Foundry $version..." snfoundryup --version $version else - if command_exists snfoundryup; then + if command_exists sncast && command_exists snforge; then echo "Starknet-Foundry is already installed." else echo "Installing Starknet-Foundry latest..." From 04e907775bfb5cf6f613574c8bb8ff0bb25d8c79 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Fri, 11 Oct 2024 07:50:36 +0100 Subject: [PATCH 51/58] refac: modify scripts --- package.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index fc42723..0558856 100644 --- a/package.json +++ b/package.json @@ -1,34 +1,34 @@ { - "name": "create-starknet-app", - "version": "0.5.0", + "name": "test-create-starknet-app", + "version": "0.5.3", "description": "An open-source starknet development stack", "bin": "./bin/cli.mjs", "scripts": { "build-contracts": "cd contracts && scarb build", "test-contracts": "cd contracts && snforge test", "format-contracts": "cd contracts && scarb fmt", - "verify-contracts": "cd contracts && sncast verify --contract-address ${npm_config_contract-address} --contract-name ${npm_config_contract-name} --verifier walnut --network ${npm_config-network}", + "verify-contracts": "cd contracts && sncast verify --contract-address ${npm_config_contract_address} --contract-name ${npm_config_contract_name} --verifier walnut --network ${npm_config_network}", "contract-scripts": "cd contracts/scripts && sncast script run ${npm_config_script} --url ${npm_config_url}", "generate-interface": "cd contracts && src5_rs parse", "prepare-account": "cd contracts && sncast account create --url ${npm_config_url} --name ${npm_config_name} --add-profile", - "deploy-account": "cd contracts && sncast --profile ${npm_config_profile} account deploy --name ${npm_config_name} --fee-token ${npm_config_feetoken} --max-fee ${npm_config_maxfee}", - "delete-account": "cd contracts && sncast --profile ${npm_config_profile} --accounts-file ${npm_config_accountfile} account delete --name ${npm_config_name} --network ${npm_config_network}", - "declare-contract": "cd contracts && sncast --profile ${npm_config_profile} declare --contract-name ${npm_config_contract} --fee-token ${npm_config_feetoken}", - "deploy-contract": "cd contracts && sncast --profile ${npm_config_profile} deploy --fee-token ${npm_config_feetoken} --class-hash ${npm_config_class}", + "deploy-account": "cd contracts && sncast --profile ${npm_config_profile} account deploy --name ${npm_config_name} --fee-token ${npm_config_fee_token} --max-fee ${npm_config_max_fee}", + "delete-account": "cd contracts && sncast --profile ${npm_config_profile} --accounts-file ${npm_config_accounts_file} account delete --name ${npm_config_name} --network ${npm_config_network}", + "declare-contract": "cd contracts && sncast $(test -n \"$npm_config_profile\" && echo --profile $npm_config_profile) $(test -n \"$npm_config_keystore\" && echo --keystore $npm_config_keystore) $(test -n \"$npm_config_account\" && echo --account $npm_config_account) declare --contract-name ${npm_config_contract_name} $(test -n \"$npm_config_url\" && echo --url $npm_config_url) --fee-token ${npm_config_fee_token}", + "deploy-contract": "cd contracts && sncast $(test -n \"$npm_config_profile\" && echo --profile $npm_config_profile) $(test -n \"$npm_config_keystore\" && echo --keystore $npm_config_keystore) $(test -n \"$npm_config_account\" && echo --account $npm_config_account) deploy --fee-token ${npm_config_fee_token} --class-hash ${npm_config_class_hash}", "initialize-dojo": "rm -rf contracts && mkdir contracts && cd contracts && sozo init ${npm_config_name}", "build-dojo": "cd contracts/${npm_config_name} && sozo build", "deploy-dojo-katana": "cd contracts/${npm_config_name} && katana --disable-fee --allowed-origins \"*\"", "migrate-dojo": "cd contracts/${npm_config_name} && sozo migrate apply", "devnet": "sh ./devnet/start.sh", "start": "cd frontend && npm run dev", - "install": "cd scripts && bash install_tools.sh --scarb ${npm_config_scarb_version:-''} --starknet-foundry ${npm_config_starknet_foundry_version:-''} --foundry ${npm_config_foundry_version:-''} --dojo ${npm_config_dojo_version:-''} && cd ../frontend && npm install --legacy-peer-deps", + "install": "cd scripts && bash install_tools.sh $(test -n \"$npm_config_scarb_version\" && echo --scarb $npm_config_scarb_version) $(test -n \"$npm_config_starknet_foundry_version\" && echo --starknet-foundry $npm_config_starknet_foundry_version) $(test -n \"$npm_config_foundry_version\" && echo --foundry $npm_config_foundry_version) $(test -n \"$npm_config_dojo_version\" && echo --dojo $npm_config_dojo_version) && cd ../frontend && npm install --legacy-peer-deps", "install-tools": "snfoundryup && foundryup", "build-ui": "cd frontend && npm run build", - "initialize-kakarot": "git clone https://github.com/kkrt-labs/build-on-kakarot.git && rm -rf contracts && mkdir contracts && cp -r build-on-kakarot/cairo_contracts/. ./contracts && mkdir kakarot && cp -r build-on-kakarot/. ./kakarot && cd kakarot && rm -rf cairo_contracts && rm -rf .github && rm -rf .trunk && git init && cd .. && rm -rf build-on-kakarot", - "setup-kakarot": "cd kakarot && make setup", + "initialize-kakarot": "git clone https://github.com/kkrt-labs/build-on-kakarot.git && rm -rf contracts && mkdir contracts && cp -r build-on-kakarot/cairo_contracts/. ./contracts && cp -r build-on-kakarot/katana.account.json ./contracts && cp -r build-on-kakarot/katana.key.json ./contracts && mkdir kakarot && cp -r build-on-kakarot/. ./kakarot && cd kakarot && rm -rf cairo_contracts && rm -rf .github && rm -rf .trunk && git init && cd .. && rm -rf build-on-kakarot", + "setup-kakarot": "cd kakarot && make setup", "start-kakarot": "cd kakarot && make start", "deploy-kakarot-l1-messaging-contracts": "cd kakarot && make deploy-l1", - "deploy-kakarot-evm-contract": "cd kakarot && forge create ${npm_config_contract_path} --rpc-url ${npm_config_rpc_url} --private-key ${npm_config_private_key}" + "deploy-kakarot-evm-contract": "cd kakarot && forge create ${npm_config_contract_path} $(test -n \"$npm_config_constructor_args\" && echo --constructor-args $npm_config_constructor_args) --rpc-url ${npm_config_rpc_url:-'http://127.0.0.1:3030'} --private-key ${npm_config_private_key}" }, "repository": { "type": "git", From b22d866cdde4585f391466588bdeaa3b0370db31 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Fri, 11 Oct 2024 08:11:08 +0100 Subject: [PATCH 52/58] feat: update docs --- docs/src/chapter_5.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/src/chapter_5.md b/docs/src/chapter_5.md index 8bf433d..d4ea4a9 100644 --- a/docs/src/chapter_5.md +++ b/docs/src/chapter_5.md @@ -53,28 +53,32 @@ generates a profile which is added to scarb.toml and can be passed to other comm ### Deploy Account To deploy an account: ``` -npm run deploy-account --profile= --name= --feetoken= --maxfee= +npm run deploy-account --profile= --name= --fee-token= --max-fee= ``` where the profile is gotten from `snfoundry.toml`, name is the prepared account and maxfee is the specified max fee. ### Delete Account To delete an account: ``` -npm run delete-account --profile= --accountfile= --name= --network= +npm run delete-account --profile= --account-file= --name= --network= ``` ### Declare Contract To declare a Starknet contract: ``` -npm run declare-contract --profile= --contract= --feetoken= +npm run declare-contract --profile= --keystore= --account= --contract-name= --url= --fee-token= ``` +when `profile` is specified, `keystore`, `account` and `url` are not needed. But when `profile` is not specified, all three of them need to be provided. + ### Deploy Contract To deploy a contract: ``` -npm run deploy-contract --profile= --feetoken= --class= +npm run deploy-contract --profile= --keystore= --account= --feetoken= --class= --url= ``` +when `profile` is specified, `keystore`, `account` and `url` are not needed. But when `profile` is not specified, all three of them need to be provided. + ### Starknet-Devnet Confirm that Docker is installed and running to use starknet-devnet. To run devnet: ``` From 8cc5d0dcbe97d15fe63fe892a721cd0bf8e9f055 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Fri, 11 Oct 2024 08:17:42 +0100 Subject: [PATCH 53/58] feat: update deploy-contract script --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 0558856..497bc26 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "test-create-starknet-app", - "version": "0.5.3", + "name": "create-starknet-app", + "version": "0.5.0", "description": "An open-source starknet development stack", "bin": "./bin/cli.mjs", "scripts": { @@ -14,7 +14,7 @@ "deploy-account": "cd contracts && sncast --profile ${npm_config_profile} account deploy --name ${npm_config_name} --fee-token ${npm_config_fee_token} --max-fee ${npm_config_max_fee}", "delete-account": "cd contracts && sncast --profile ${npm_config_profile} --accounts-file ${npm_config_accounts_file} account delete --name ${npm_config_name} --network ${npm_config_network}", "declare-contract": "cd contracts && sncast $(test -n \"$npm_config_profile\" && echo --profile $npm_config_profile) $(test -n \"$npm_config_keystore\" && echo --keystore $npm_config_keystore) $(test -n \"$npm_config_account\" && echo --account $npm_config_account) declare --contract-name ${npm_config_contract_name} $(test -n \"$npm_config_url\" && echo --url $npm_config_url) --fee-token ${npm_config_fee_token}", - "deploy-contract": "cd contracts && sncast $(test -n \"$npm_config_profile\" && echo --profile $npm_config_profile) $(test -n \"$npm_config_keystore\" && echo --keystore $npm_config_keystore) $(test -n \"$npm_config_account\" && echo --account $npm_config_account) deploy --fee-token ${npm_config_fee_token} --class-hash ${npm_config_class_hash}", + "deploy-contract": "cd contracts && sncast $(test -n \"$npm_config_profile\" && echo --profile $npm_config_profile) $(test -n \"$npm_config_keystore\" && echo --keystore $npm_config_keystore) $(test -n \"$npm_config_account\" && echo --account $npm_config_account) deploy $(test -n \"$npm_config_url\" && echo --url $npm_config_url) --fee-token ${npm_config_fee_token} --class-hash ${npm_config_class_hash}", "initialize-dojo": "rm -rf contracts && mkdir contracts && cd contracts && sozo init ${npm_config_name}", "build-dojo": "cd contracts/${npm_config_name} && sozo build", "deploy-dojo-katana": "cd contracts/${npm_config_name} && katana --disable-fee --allowed-origins \"*\"", From ff6125b09e74a5d29dbadfae629306b8f027bf3f Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Fri, 11 Oct 2024 16:03:05 +0100 Subject: [PATCH 54/58] feat: update kakarot scripts --- package.json | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 497bc26..fb88c96 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "prepare-account": "cd contracts && sncast account create --url ${npm_config_url} --name ${npm_config_name} --add-profile", "deploy-account": "cd contracts && sncast --profile ${npm_config_profile} account deploy --name ${npm_config_name} --fee-token ${npm_config_fee_token} --max-fee ${npm_config_max_fee}", "delete-account": "cd contracts && sncast --profile ${npm_config_profile} --accounts-file ${npm_config_accounts_file} account delete --name ${npm_config_name} --network ${npm_config_network}", - "declare-contract": "cd contracts && sncast $(test -n \"$npm_config_profile\" && echo --profile $npm_config_profile) $(test -n \"$npm_config_keystore\" && echo --keystore $npm_config_keystore) $(test -n \"$npm_config_account\" && echo --account $npm_config_account) declare --contract-name ${npm_config_contract_name} $(test -n \"$npm_config_url\" && echo --url $npm_config_url) --fee-token ${npm_config_fee_token}", - "deploy-contract": "cd contracts && sncast $(test -n \"$npm_config_profile\" && echo --profile $npm_config_profile) $(test -n \"$npm_config_keystore\" && echo --keystore $npm_config_keystore) $(test -n \"$npm_config_account\" && echo --account $npm_config_account) deploy $(test -n \"$npm_config_url\" && echo --url $npm_config_url) --fee-token ${npm_config_fee_token} --class-hash ${npm_config_class_hash}", + "declare-contract": "cd contracts && sncast --profile ${npm_config_profile} declare --contract-name ${npm_config_contract_name} --fee-token ${npm_config_fee_token}", + "deploy-contract": "cd contracts && sncast --profile ${npm_config_profile} deploy --fee-token ${npm_config_fee_token} --class-hash ${npm_config_class_hash}", "initialize-dojo": "rm -rf contracts && mkdir contracts && cd contracts && sozo init ${npm_config_name}", "build-dojo": "cd contracts/${npm_config_name} && sozo build", "deploy-dojo-katana": "cd contracts/${npm_config_name} && katana --disable-fee --allowed-origins \"*\"", @@ -27,8 +27,10 @@ "initialize-kakarot": "git clone https://github.com/kkrt-labs/build-on-kakarot.git && rm -rf contracts && mkdir contracts && cp -r build-on-kakarot/cairo_contracts/. ./contracts && cp -r build-on-kakarot/katana.account.json ./contracts && cp -r build-on-kakarot/katana.key.json ./contracts && mkdir kakarot && cp -r build-on-kakarot/. ./kakarot && cd kakarot && rm -rf cairo_contracts && rm -rf .github && rm -rf .trunk && git init && cd .. && rm -rf build-on-kakarot", "setup-kakarot": "cd kakarot && make setup", "start-kakarot": "cd kakarot && make start", - "deploy-kakarot-l1-messaging-contracts": "cd kakarot && make deploy-l1", - "deploy-kakarot-evm-contract": "cd kakarot && forge create ${npm_config_contract_path} $(test -n \"$npm_config_constructor_args\" && echo --constructor-args $npm_config_constructor_args) --rpc-url ${npm_config_rpc_url:-'http://127.0.0.1:3030'} --private-key ${npm_config_private_key}" + "deploy-kakarot-l1-messaging-contracts-local": "cd kakarot && make deploy-l1", + "deploy-kakarot-evm-contract": "cd kakarot && forge create ${npm_config_contract_path} $(test -n \"$npm_config_constructor_args\" && echo --constructor-args $npm_config_constructor_args) --rpc-url ${npm_config_rpc_url} --private-key ${npm_config_private_key}", + "keystore-declare-contract": "cd contracts && sncast --keystore ${npm_config_keystore} --account ${npm_config_account} declare --contract-name ${npm_config_contract_name} --url ${npm_config_url} --fee-token ${npm_config_fee_token}", + "keystore-deploy-contract": "cd contracts && sncast --keystore ${npm_config_keystore} --account ${npm_config_account} deploy --url ${npm_config_url} --fee-token ${npm_config_fee_token} --class-hash ${npm_config_class_hash}" }, "repository": { "type": "git", From 44361bd1f744d5f8dd50eddf0533e9d3dad03e85 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Fri, 11 Oct 2024 16:03:30 +0100 Subject: [PATCH 55/58] feat: add kakarot support to docs --- docs/src/chapter_5.md | 51 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/docs/src/chapter_5.md b/docs/src/chapter_5.md index d4ea4a9..c4c796b 100644 --- a/docs/src/chapter_5.md +++ b/docs/src/chapter_5.md @@ -66,26 +66,21 @@ npm run delete-account --profile= --account-file= --keystore= --account= --contract-name= --url= --fee-token= +npm run declare-contract --profile= --contract-name= --url= --fee-token= ``` -when `profile` is specified, `keystore`, `account` and `url` are not needed. But when `profile` is not specified, all three of them need to be provided. - ### Deploy Contract To deploy a contract: ``` -npm run deploy-contract --profile= --keystore= --account= --feetoken= --class= --url= +npm run deploy-contract --profile= --feetoken= --class= --url= ``` -when `profile` is specified, `keystore`, `account` and `url` are not needed. But when `profile` is not specified, all three of them need to be provided. - ### Starknet-Devnet Confirm that Docker is installed and running to use starknet-devnet. To run devnet: ``` npm run devnet ``` - ## Dojo Scripts The `contracts` folder contains all the tools needed to write, build, test and deploy dojo projects. It is built with sozo and katana. Here are common operations you can perform on your dojo contracts. @@ -113,6 +108,48 @@ To migrate your dojo project, from the base repository run: npm run migrate-dojo --name= ``` +## Kakarot Scripts +Below are npm scripts provided by `Starknet-Scaffold` for your Kakarot development. + +### Setup Kakarot +To setup Kakarot, from the base repository run: +``` +npm run setup-kakarot +``` + +### Start Kakarot +To start Kakarot, from the base repository run: +``` +npm run start-kakarot +``` + +### Deploy Kakarot L1 Messaging Contracts to Local RPC +To deploy Kakarot l1 messaging contracts locally, from the base repository run: +``` +npm run deploy-kakarot-l1-messaging-contracts-local +``` + +### Deploy Kakarot EVM Contract +To deploy a Kakarot EVM contract, from the base repository run: +``` +npm run deploy-kakarot-evm-contract --contract-path= --rpc-url= --private-key= +``` +If you need to specify constructor args, run: +``` +npm run deploy-kakarot-evm-contract --contract-path= --constructor-args= --rpc-url= --private-key= +``` + +### Declare Cairo Contract Using Keystore +To declare a Cairo contract using keystore, from the base repository run: +``` +npm run keystore-declare-contract --keystore= --account= --contract-name= --url= --fee-token= +``` + +### Deploy Cairo Contract Using Keystore +To deploy a Cairo contract using keystore, from the base repository run: +``` +npm run keystore-deploy-contract --keystore= --account= --url= --fee-token= --class-hash= +``` ## User Interface Scripts From dd30f6de69472679de394926cdfc1444b1bd00b1 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Mon, 14 Oct 2024 06:20:23 +0100 Subject: [PATCH 56/58] feat: add whitelist-contract script --- frontend/package-lock.json | 2 -- package-lock.json | 10 +++++----- package.json | 7 ++++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index e9eaadc..8a02c45 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -825,8 +825,6 @@ }, "node_modules/@parcel/watcher-wasm/node_modules/napi-wasm": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/napi-wasm/-/napi-wasm-1.1.0.tgz", - "integrity": "sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==", "inBundle": true, "license": "MIT" }, diff --git a/package-lock.json b/package-lock.json index b1795f0..b234108 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,19 @@ { - "name": "create-starknet-app", - "version": "0.3.6", + "name": "test-create-starknet-app", + "version": "0.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "create-starknet-app", - "version": "0.3.6", + "name": "test-create-starknet-app", + "version": "0.5.0", "hasInstallScript": true, "license": "ISC", "dependencies": { "ora": "^8.0.1" }, "bin": { - "create-starknet-app": "bin/cli.mjs" + "test-create-starknet-app": "bin/cli.mjs" } }, "node_modules/ansi-regex": { diff --git a/package.json b/package.json index fb88c96..6e70447 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "create-starknet-app", - "version": "0.5.0", + "name": "test-create-starknet-app", + "version": "0.5.5", "description": "An open-source starknet development stack", "bin": "./bin/cli.mjs", "scripts": { @@ -30,7 +30,8 @@ "deploy-kakarot-l1-messaging-contracts-local": "cd kakarot && make deploy-l1", "deploy-kakarot-evm-contract": "cd kakarot && forge create ${npm_config_contract_path} $(test -n \"$npm_config_constructor_args\" && echo --constructor-args $npm_config_constructor_args) --rpc-url ${npm_config_rpc_url} --private-key ${npm_config_private_key}", "keystore-declare-contract": "cd contracts && sncast --keystore ${npm_config_keystore} --account ${npm_config_account} declare --contract-name ${npm_config_contract_name} --url ${npm_config_url} --fee-token ${npm_config_fee_token}", - "keystore-deploy-contract": "cd contracts && sncast --keystore ${npm_config_keystore} --account ${npm_config_account} deploy --url ${npm_config_url} --fee-token ${npm_config_fee_token} --class-hash ${npm_config_class_hash}" + "keystore-deploy-contract": "cd contracts && sncast --keystore ${npm_config_keystore} --account ${npm_config_account} deploy --url ${npm_config_url} --fee-token ${npm_config_fee_token} --class-hash ${npm_config_class_hash}", + "whitelist-contract": "cd kakarot && make whitelist-contract CONTRACT_ADDRESS=${npm_config_contract_address}" }, "repository": { "type": "git", From 30a9de1d668fd2e0412bc9dca770417960db498a Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Mon, 14 Oct 2024 06:25:07 +0100 Subject: [PATCH 57/58] Revert "feat: add whitelist-contract script" This reverts commit dd30f6de69472679de394926cdfc1444b1bd00b1. --- frontend/package-lock.json | 2 ++ package-lock.json | 10 +++++----- package.json | 7 +++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 8a02c45..e9eaadc 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -825,6 +825,8 @@ }, "node_modules/@parcel/watcher-wasm/node_modules/napi-wasm": { "version": "1.1.0", + "resolved": "https://registry.npmjs.org/napi-wasm/-/napi-wasm-1.1.0.tgz", + "integrity": "sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==", "inBundle": true, "license": "MIT" }, diff --git a/package-lock.json b/package-lock.json index b234108..b1795f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,19 @@ { - "name": "test-create-starknet-app", - "version": "0.5.0", + "name": "create-starknet-app", + "version": "0.3.6", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "test-create-starknet-app", - "version": "0.5.0", + "name": "create-starknet-app", + "version": "0.3.6", "hasInstallScript": true, "license": "ISC", "dependencies": { "ora": "^8.0.1" }, "bin": { - "test-create-starknet-app": "bin/cli.mjs" + "create-starknet-app": "bin/cli.mjs" } }, "node_modules/ansi-regex": { diff --git a/package.json b/package.json index 6e70447..fb88c96 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "test-create-starknet-app", - "version": "0.5.5", + "name": "create-starknet-app", + "version": "0.5.0", "description": "An open-source starknet development stack", "bin": "./bin/cli.mjs", "scripts": { @@ -30,8 +30,7 @@ "deploy-kakarot-l1-messaging-contracts-local": "cd kakarot && make deploy-l1", "deploy-kakarot-evm-contract": "cd kakarot && forge create ${npm_config_contract_path} $(test -n \"$npm_config_constructor_args\" && echo --constructor-args $npm_config_constructor_args) --rpc-url ${npm_config_rpc_url} --private-key ${npm_config_private_key}", "keystore-declare-contract": "cd contracts && sncast --keystore ${npm_config_keystore} --account ${npm_config_account} declare --contract-name ${npm_config_contract_name} --url ${npm_config_url} --fee-token ${npm_config_fee_token}", - "keystore-deploy-contract": "cd contracts && sncast --keystore ${npm_config_keystore} --account ${npm_config_account} deploy --url ${npm_config_url} --fee-token ${npm_config_fee_token} --class-hash ${npm_config_class_hash}", - "whitelist-contract": "cd kakarot && make whitelist-contract CONTRACT_ADDRESS=${npm_config_contract_address}" + "keystore-deploy-contract": "cd contracts && sncast --keystore ${npm_config_keystore} --account ${npm_config_account} deploy --url ${npm_config_url} --fee-token ${npm_config_fee_token} --class-hash ${npm_config_class_hash}" }, "repository": { "type": "git", From 4f1c6fab3986885e87657a08c069a7e6e9d25053 Mon Sep 17 00:00:00 2001 From: EjembiEmmanuel Date: Mon, 14 Oct 2024 06:27:10 +0100 Subject: [PATCH 58/58] feat: add whitelist-contract script --- docs/src/chapter_5.md | 6 ++++++ package.json | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/src/chapter_5.md b/docs/src/chapter_5.md index c4c796b..803e0dc 100644 --- a/docs/src/chapter_5.md +++ b/docs/src/chapter_5.md @@ -151,6 +151,12 @@ To deploy a Cairo contract using keystore, from the base repository run: npm run keystore-deploy-contract --keystore= --account= --url= --fee-token= --class-hash= ``` +### Whitelist Contract +To whitelist a contract, from the base repository run: +``` +npm run whitelist-contract --contract-address= +``` + ## User Interface Scripts The following are scripts from `Starknet-Scaffold` for handling the user interface. diff --git a/package.json b/package.json index fb88c96..7df2362 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,8 @@ "deploy-kakarot-l1-messaging-contracts-local": "cd kakarot && make deploy-l1", "deploy-kakarot-evm-contract": "cd kakarot && forge create ${npm_config_contract_path} $(test -n \"$npm_config_constructor_args\" && echo --constructor-args $npm_config_constructor_args) --rpc-url ${npm_config_rpc_url} --private-key ${npm_config_private_key}", "keystore-declare-contract": "cd contracts && sncast --keystore ${npm_config_keystore} --account ${npm_config_account} declare --contract-name ${npm_config_contract_name} --url ${npm_config_url} --fee-token ${npm_config_fee_token}", - "keystore-deploy-contract": "cd contracts && sncast --keystore ${npm_config_keystore} --account ${npm_config_account} deploy --url ${npm_config_url} --fee-token ${npm_config_fee_token} --class-hash ${npm_config_class_hash}" + "keystore-deploy-contract": "cd contracts && sncast --keystore ${npm_config_keystore} --account ${npm_config_account} deploy --url ${npm_config_url} --fee-token ${npm_config_fee_token} --class-hash ${npm_config_class_hash}", + "whitelist-contract": "cd kakarot && make whitelist-contract CONTRACT_ADDRESS=${npm_config_contract_address}" }, "repository": { "type": "git",