From 4e40c132848d8fddc16f2150fcc62cc76fcde80b Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Fri, 5 Jul 2024 12:05:23 +0000 Subject: [PATCH 01/30] public-ports-fix-hostname --- contract/tools/ui-kit-goals/makeHttpClient.js | 1 + ui/package.json | 2 +- ui/set.hostname.sh | 26 +++++++++++++++++++ ui/src/App.tsx | 4 +-- 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100755 ui/set.hostname.sh diff --git a/contract/tools/ui-kit-goals/makeHttpClient.js b/contract/tools/ui-kit-goals/makeHttpClient.js index 7033d83c..4228d74e 100644 --- a/contract/tools/ui-kit-goals/makeHttpClient.js +++ b/contract/tools/ui-kit-goals/makeHttpClient.js @@ -45,6 +45,7 @@ export const makeHttpClient = (url, fetch) => { execute: async request => { const settings = { method: 'POST', + mode: 'no-cors', body: request ? JSON.stringify(request) : undefined, headers: { ...jsonType, ...headers }, }; diff --git a/ui/package.json b/ui/package.json index 98532397..8b2dce7d 100644 --- a/ui/package.json +++ b/ui/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "type": "module", "scripts": { - "dev": "vite", + "dev": "./set.hostname.sh && vite", "build": "tsc && NODE_OPTIONS=--max-old-space-size=4096 vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint:fix": "yarn lint --fix", diff --git a/ui/set.hostname.sh b/ui/set.hostname.sh new file mode 100755 index 00000000..cfac8e2a --- /dev/null +++ b/ui/set.hostname.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Step 1: Read the environment variable CODESPACE_NAME +CODESPACE_NAME="${CODESPACE_NAME}" + +# Check if the environment variable is set +if [ -z "$CODESPACE_NAME" ]; then + echo "CODESPACE_NAME is not set." + exit 1 +fi + +# Step 2: Define the file name +FILE="src/App.tsx" + +# Check if the file exists +if [ ! -f "$FILE" ]; then + echo "File $FILE does not exist." + exit 1 +fi + +# Step 3: Search and replace the string in the file using a regular expression +sed -i "s|https://.*-1317\.app\.github\.dev/|https://${CODESPACE_NAME}-1317.app.github.dev/|g" "$FILE" +sed -i "s|https://.*-26657\.app\.github\.dev/|https://${CODESPACE_NAME}-26657.app.github.dev/|g" "$FILE" + +# Step 4: Notify the user of completion +echo "Replaced matching URLs with https://${CODESPACE_NAME}-1317.app.github.dev/ in $FILE" diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 84f3db63..487e2be0 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -22,8 +22,8 @@ function App() { iconUrl: 'agoric.svg', // Optional icon for dropdown display }, apis: { - rest: ['http://localhost:1317'], - rpc: ['http://localhost:26657'], + rest: [`https://solid-enigma-4vjj94wjqrxc7xrg-1317.app.github.dev/`], + rpc: [`https://solid-enigma-4vjj94wjqrxc7xrg-26657.app.github.dev/`], }, }, ]} From 7ecdcacc9c5d1cc4d5af766c4e3594eddaffd7b6 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Fri, 5 Jul 2024 17:59:56 +0500 Subject: [PATCH 02/30] Update set.hostname.sh --- ui/set.hostname.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/ui/set.hostname.sh b/ui/set.hostname.sh index cfac8e2a..e4a908ce 100755 --- a/ui/set.hostname.sh +++ b/ui/set.hostname.sh @@ -3,14 +3,8 @@ # Step 1: Read the environment variable CODESPACE_NAME CODESPACE_NAME="${CODESPACE_NAME}" -# Check if the environment variable is set -if [ -z "$CODESPACE_NAME" ]; then - echo "CODESPACE_NAME is not set." - exit 1 -fi - # Step 2: Define the file name -FILE="src/App.tsx" +FILE="App.tsx" # Check if the file exists if [ ! -f "$FILE" ]; then @@ -18,9 +12,17 @@ if [ ! -f "$FILE" ]; then exit 1 fi -# Step 3: Search and replace the string in the file using a regular expression -sed -i "s|https://.*-1317\.app\.github\.dev/|https://${CODESPACE_NAME}-1317.app.github.dev/|g" "$FILE" -sed -i "s|https://.*-26657\.app\.github\.dev/|https://${CODESPACE_NAME}-26657.app.github.dev/|g" "$FILE" +# Step 3: Check if the environment variable is set and replace accordingly +if [ -z "$CODESPACE_NAME" ]; then + echo "CODESPACE_NAME is not set. Setting host with http://localhost" + sed -i "s|https://.*-1317\.app\.github\.dev/|http://localhost:1317|g" "$FILE" + sed -i "s|https://.*-26657\.app\.github\.dev/|http://localhost:26657|g" "$FILE" +else + echo "CODESPACE_NAME is set to $CODESPACE_NAME. Setting host with https://${CODESPACE_NAME}-1317.app.github.dev/" + sed -i "s|https://.*-1317\.app\.github\.dev/|https://${CODESPACE_NAME}-1317.app.github.dev/|g" "$FILE" + echo "CODESPACE_NAME is set to $CODESPACE_NAME. Setting host with https://${CODESPACE_NAME}-26675.app.github.dev/" + sed -i "s|https://.*-26657\.app\.github\.dev/|https://${CODESPACE_NAME}-26657.app.github.dev/|g" "$FILE" +fi # Step 4: Notify the user of completion -echo "Replaced matching URLs with https://${CODESPACE_NAME}-1317.app.github.dev/ in $FILE" +echo "Replacement complete in $FILE" From a598cc433cf5f913b072f092148b5257f3f6a23c Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:07:07 +0000 Subject: [PATCH 03/30] fix: Updating hostname script to accomodate localhost case --- ui/set.hostname.sh | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/ui/set.hostname.sh b/ui/set.hostname.sh index e4a908ce..cfac8e2a 100755 --- a/ui/set.hostname.sh +++ b/ui/set.hostname.sh @@ -3,8 +3,14 @@ # Step 1: Read the environment variable CODESPACE_NAME CODESPACE_NAME="${CODESPACE_NAME}" +# Check if the environment variable is set +if [ -z "$CODESPACE_NAME" ]; then + echo "CODESPACE_NAME is not set." + exit 1 +fi + # Step 2: Define the file name -FILE="App.tsx" +FILE="src/App.tsx" # Check if the file exists if [ ! -f "$FILE" ]; then @@ -12,17 +18,9 @@ if [ ! -f "$FILE" ]; then exit 1 fi -# Step 3: Check if the environment variable is set and replace accordingly -if [ -z "$CODESPACE_NAME" ]; then - echo "CODESPACE_NAME is not set. Setting host with http://localhost" - sed -i "s|https://.*-1317\.app\.github\.dev/|http://localhost:1317|g" "$FILE" - sed -i "s|https://.*-26657\.app\.github\.dev/|http://localhost:26657|g" "$FILE" -else - echo "CODESPACE_NAME is set to $CODESPACE_NAME. Setting host with https://${CODESPACE_NAME}-1317.app.github.dev/" - sed -i "s|https://.*-1317\.app\.github\.dev/|https://${CODESPACE_NAME}-1317.app.github.dev/|g" "$FILE" - echo "CODESPACE_NAME is set to $CODESPACE_NAME. Setting host with https://${CODESPACE_NAME}-26675.app.github.dev/" - sed -i "s|https://.*-26657\.app\.github\.dev/|https://${CODESPACE_NAME}-26657.app.github.dev/|g" "$FILE" -fi +# Step 3: Search and replace the string in the file using a regular expression +sed -i "s|https://.*-1317\.app\.github\.dev/|https://${CODESPACE_NAME}-1317.app.github.dev/|g" "$FILE" +sed -i "s|https://.*-26657\.app\.github\.dev/|https://${CODESPACE_NAME}-26657.app.github.dev/|g" "$FILE" # Step 4: Notify the user of completion -echo "Replacement complete in $FILE" +echo "Replaced matching URLs with https://${CODESPACE_NAME}-1317.app.github.dev/ in $FILE" From 3ffdb937747d315a10f3fdfaa7f9d3ccdc6e825e Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:10:47 +0000 Subject: [PATCH 04/30] fix: hostname script works on localhost --- ui/set.hostname.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ui/set.hostname.sh b/ui/set.hostname.sh index cfac8e2a..c37fd3b7 100755 --- a/ui/set.hostname.sh +++ b/ui/set.hostname.sh @@ -3,12 +3,6 @@ # Step 1: Read the environment variable CODESPACE_NAME CODESPACE_NAME="${CODESPACE_NAME}" -# Check if the environment variable is set -if [ -z "$CODESPACE_NAME" ]; then - echo "CODESPACE_NAME is not set." - exit 1 -fi - # Step 2: Define the file name FILE="src/App.tsx" @@ -18,9 +12,17 @@ if [ ! -f "$FILE" ]; then exit 1 fi -# Step 3: Search and replace the string in the file using a regular expression -sed -i "s|https://.*-1317\.app\.github\.dev/|https://${CODESPACE_NAME}-1317.app.github.dev/|g" "$FILE" -sed -i "s|https://.*-26657\.app\.github\.dev/|https://${CODESPACE_NAME}-26657.app.github.dev/|g" "$FILE" +# Step 3: Check if the environment variable is set and replace accordingly +if [ -z "$CODESPACE_NAME" ]; then + echo "CODESPACE_NAME is not set. Setting host with http://localhost" + sed -i "s|https://.*-1317\.app\.github\.dev/|http://localhost:1317|g" "$FILE" + sed -i "s|https://.*-26657\.app\.github\.dev/|http://localhost:26657|g" "$FILE" +else + echo "CODESPACE_NAME is set to $CODESPACE_NAME. Setting host with https://${CODESPACE_NAME}-1317.app.github.dev/" + sed -i "s|https://.*-1317\.app\.github\.dev/|https://${CODESPACE_NAME}-1317.app.github.dev/|g" "$FILE" + echo "CODESPACE_NAME is set to $CODESPACE_NAME. Setting host with https://${CODESPACE_NAME}-26675.app.github.dev/" + sed -i "s|https://.*-26657\.app\.github\.dev/|https://${CODESPACE_NAME}-26657.app.github.dev/|g" "$FILE" +fi # Step 4: Notify the user of completion -echo "Replaced matching URLs with https://${CODESPACE_NAME}-1317.app.github.dev/ in $FILE" +echo "Replacement complete in $FILE" \ No newline at end of file From 67250594d4aa83156fda9e6e2ae40b4ea83a5675 Mon Sep 17 00:00:00 2001 From: Touseef Liaqat Date: Fri, 5 Jul 2024 18:21:42 -0700 Subject: [PATCH 05/30] Add devcontainer.json with public ports --- .devcontainer.json | 22 ++++++++++++++++++++++ make_ports_public.sh | 19 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 .devcontainer.json create mode 100755 make_ports_public.sh diff --git a/.devcontainer.json b/.devcontainer.json new file mode 100644 index 00000000..5d24c42a --- /dev/null +++ b/.devcontainer.json @@ -0,0 +1,22 @@ +{ + "forwardPorts": [5173, 1317, 26657, 26656], + "portsAttributes": { + "5173": { + "label": "UI", + "onAutoForward": "openBrowser" + }, + "1317": { + "label": "API", + "onAutoForward": "silent" + }, + "26657": { + "label": "RPC", + "onAutoForward": "silent" + }, + "26656": { + "label": "P2P", + "onAutoForward": "silent" + } + }, + "postStartCommand": "/bin/bash ./make_ports_public.sh 5173 1317 26657" +} diff --git a/make_ports_public.sh b/make_ports_public.sh new file mode 100755 index 00000000..f8f49caa --- /dev/null +++ b/make_ports_public.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -x + +# Function to change port visibility to public +change_port_visibility() { + local port=$1 + gh codespace ports visibility $port:public -c $CODESPACE_NAME +} + +# Check if at least one port is provided +if [ $# -eq 0 ]; then + echo "Usage: $0 [port2 ... portN]" + exit 1 +fi + +# Loop through each provided port and change its visibility to public +for port in "$@"; do + change_port_visibility $port +done From fcc492c75c56c4ab73a4e7535efa5afb031cb1b2 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Sat, 6 Jul 2024 13:13:41 +0500 Subject: [PATCH 06/30] Update App.tsx hostname placeholder --- ui/src/App.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 487e2be0..62f7bcbf 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -22,8 +22,8 @@ function App() { iconUrl: 'agoric.svg', // Optional icon for dropdown display }, apis: { - rest: [`https://solid-enigma-4vjj94wjqrxc7xrg-1317.app.github.dev/`], - rpc: [`https://solid-enigma-4vjj94wjqrxc7xrg-26657.app.github.dev/`], + rest: [`https://hostname-1317.app.github.dev/`], + rpc: [`https://hostname-26657.app.github.dev/`], }, }, ]} From 1f80eab396a5f035fba42bd6822deb01128dafe3 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Sun, 7 Jul 2024 08:19:28 +0000 Subject: [PATCH 07/30] feat: nvm command in .devcontainer --- .devcontainer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.devcontainer.json b/.devcontainer.json index 5d24c42a..d5d301ae 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -18,5 +18,6 @@ "onAutoForward": "silent" } }, + "postCreateCommand": ["nvm install 18.20.2", "nvm use 18.20.2"], "postStartCommand": "/bin/bash ./make_ports_public.sh 5173 1317 26657" } From af16635bb7890553541d43e96a0ad957a0e93293 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Sun, 7 Jul 2024 13:24:54 +0000 Subject: [PATCH 08/30] fix: node version --- .devcontainer.json | 1 - .devcontainer/devcontainer.json | 26 ++++++++++++++++++++++++++ .github/dependabot.yml | 12 ++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/dependabot.yml diff --git a/.devcontainer.json b/.devcontainer.json index d5d301ae..5d24c42a 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -18,6 +18,5 @@ "onAutoForward": "silent" } }, - "postCreateCommand": ["nvm install 18.20.2", "nvm use 18.20.2"], "postStartCommand": "/bin/bash ./make_ports_public.sh 5173 1317 26657" } diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..a566d24a --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,26 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node +{ + "name": "Node.js", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/javascript-node:1-18-buster", + "features": { + "ghcr.io/devcontainers-contrib/features/jshint:2": {}, + "ghcr.io/nikiforovall/devcontainer-features/dotnet-aspire:1": {} + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "yarn install && yarn start:docker" + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..f33a02cd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly From c85bab1bb7b267db9a7d814a48abf8229b1eefdb Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Sun, 7 Jul 2024 14:09:27 +0000 Subject: [PATCH 09/30] fix: nvm not working in .devcontainer so remving for now --- .devcontainer/devcontainer.json | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index a566d24a..00000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,26 +0,0 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node -{ - "name": "Node.js", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/javascript-node:1-18-buster", - "features": { - "ghcr.io/devcontainers-contrib/features/jshint:2": {}, - "ghcr.io/nikiforovall/devcontainer-features/dotnet-aspire:1": {} - }, - - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "yarn install && yarn start:docker" - - // Configure tool-specific properties. - // "customizations": {}, - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" -} From cbc1754e7f73acc0da798988e7bcd1c40063cc0b Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Mon, 8 Jul 2024 07:15:46 +0000 Subject: [PATCH 10/30] feat: Hostname Update with ENV Only - Removed script --- package.json | 2 +- ui/set.hostname.sh | 28 ---------------------------- ui/src/App.tsx | 10 ++++++++-- 3 files changed, 9 insertions(+), 31 deletions(-) delete mode 100755 ui/set.hostname.sh diff --git a/package.json b/package.json index 7078a974..1143ba28 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "docker:make": "cd contract; docker compose exec agd make -C /workspace/contract", "make:help": "make -C contract list", "start:contract": "cd contract && yarn start", - "start:ui": "cd ui && yarn dev", + "start:ui": "export VITE_HOSTNAME=$CODESPACE_NAME && cd ui && yarn dev", "lint": "yarn workspaces run lint", "lint:fix": "yarn workspaces run lint:fix", "test": "yarn workspaces run test", diff --git a/ui/set.hostname.sh b/ui/set.hostname.sh deleted file mode 100755 index c37fd3b7..00000000 --- a/ui/set.hostname.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# Step 1: Read the environment variable CODESPACE_NAME -CODESPACE_NAME="${CODESPACE_NAME}" - -# Step 2: Define the file name -FILE="src/App.tsx" - -# Check if the file exists -if [ ! -f "$FILE" ]; then - echo "File $FILE does not exist." - exit 1 -fi - -# Step 3: Check if the environment variable is set and replace accordingly -if [ -z "$CODESPACE_NAME" ]; then - echo "CODESPACE_NAME is not set. Setting host with http://localhost" - sed -i "s|https://.*-1317\.app\.github\.dev/|http://localhost:1317|g" "$FILE" - sed -i "s|https://.*-26657\.app\.github\.dev/|http://localhost:26657|g" "$FILE" -else - echo "CODESPACE_NAME is set to $CODESPACE_NAME. Setting host with https://${CODESPACE_NAME}-1317.app.github.dev/" - sed -i "s|https://.*-1317\.app\.github\.dev/|https://${CODESPACE_NAME}-1317.app.github.dev/|g" "$FILE" - echo "CODESPACE_NAME is set to $CODESPACE_NAME. Setting host with https://${CODESPACE_NAME}-26675.app.github.dev/" - sed -i "s|https://.*-26657\.app\.github\.dev/|https://${CODESPACE_NAME}-26657.app.github.dev/|g" "$FILE" -fi - -# Step 4: Notify the user of completion -echo "Replacement complete in $FILE" \ No newline at end of file diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 62f7bcbf..4a4ac748 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -8,6 +8,12 @@ import '@agoric/react-components/dist/style.css'; function App() { const { themeClass } = useTheme(); + let REST_HOSTNAME = 'http://localhost:1317' + let RPC_HOSTNAME = 'http://localhost:26657' + if (import.meta.env.VITE_HOSTNAME ) { + REST_HOSTNAME = `https://solid-enigma-4vjj94wjqrxc7xrg-1317.app.github.dev/`; + RPC_HOSTNAME = `https://solid-enigma-4vjj94wjqrxc7xrg-26657.app.github.dev/`; + } return ( @@ -22,8 +28,8 @@ function App() { iconUrl: 'agoric.svg', // Optional icon for dropdown display }, apis: { - rest: [`https://hostname-1317.app.github.dev/`], - rpc: [`https://hostname-26657.app.github.dev/`], + rest: [REST_HOSTNAME], + rpc: [RPC_HOSTNAME], }, }, ]} From 611e29de52871c55f64b7179b48b9964b50604c6 Mon Sep 17 00:00:00 2001 From: rabi-siddique Date: Mon, 8 Jul 2024 13:35:07 +0500 Subject: [PATCH 11/30] chore: make the api and rpc endpoints dynamic --- ui/src/App.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 4a4ac748..55426516 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -8,11 +8,14 @@ import '@agoric/react-components/dist/style.css'; function App() { const { themeClass } = useTheme(); - let REST_HOSTNAME = 'http://localhost:1317' - let RPC_HOSTNAME = 'http://localhost:26657' - if (import.meta.env.VITE_HOSTNAME ) { - REST_HOSTNAME = `https://solid-enigma-4vjj94wjqrxc7xrg-1317.app.github.dev/`; - RPC_HOSTNAME = `https://solid-enigma-4vjj94wjqrxc7xrg-26657.app.github.dev/`; + let REST_HOSTNAME = 'http://localhost:1317'; + let RPC_HOSTNAME = 'http://localhost:26657'; + + let codeSpaceHostName = import.meta.env.VITE_HOSTNAME; + + if (codeSpaceHostName) { + REST_HOSTNAME = `https://${codeSpaceHostName}-1317.app.github.dev/`; + RPC_HOSTNAME = `https://${codeSpaceHostName}-26657.app.github.dev/`; } return ( From 20b9b0ece238674c45b4386db8aa1f9d5b2e2eb4 Mon Sep 17 00:00:00 2001 From: rabi-siddique Date: Mon, 8 Jul 2024 13:37:41 +0500 Subject: [PATCH 12/30] chore: update dev script in package.json --- ui/package.json | 2 +- ui/src/App.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/package.json b/ui/package.json index 8b2dce7d..98532397 100644 --- a/ui/package.json +++ b/ui/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "type": "module", "scripts": { - "dev": "./set.hostname.sh && vite", + "dev": "vite", "build": "tsc && NODE_OPTIONS=--max-old-space-size=4096 vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint:fix": "yarn lint --fix", diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 55426516..0f08aa69 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -11,7 +11,7 @@ function App() { let REST_HOSTNAME = 'http://localhost:1317'; let RPC_HOSTNAME = 'http://localhost:26657'; - let codeSpaceHostName = import.meta.env.VITE_HOSTNAME; + const codeSpaceHostName = import.meta.env.VITE_HOSTNAME; if (codeSpaceHostName) { REST_HOSTNAME = `https://${codeSpaceHostName}-1317.app.github.dev/`; From ea3e9854d5d5a0d245bee042ffb3a8c146ea6249 Mon Sep 17 00:00:00 2001 From: Rabi Siddique <60459172+rabi-siddique@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:14:29 +0000 Subject: [PATCH 13/30] chore: use node version 18.20 for the dev container --- .devcontainer.json | 2 +- .github/dependabot.yml | 12 ------------ contract/tools/ui-kit-goals/makeHttpClient.js | 1 - 3 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 .github/dependabot.yml diff --git a/.devcontainer.json b/.devcontainer.json index 5d24c42a..a716070e 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -18,5 +18,5 @@ "onAutoForward": "silent" } }, - "postStartCommand": "/bin/bash ./make_ports_public.sh 5173 1317 26657" + "postStartCommand": "bash -i -c 'nvm install 18.20 && nvm alias default 18.20' && bash ./make_ports_public.sh 5173 1317 26657" } diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index f33a02cd..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,12 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for more information: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates -# https://containers.dev/guide/dependabot - -version: 2 -updates: - - package-ecosystem: "devcontainers" - directory: "/" - schedule: - interval: weekly diff --git a/contract/tools/ui-kit-goals/makeHttpClient.js b/contract/tools/ui-kit-goals/makeHttpClient.js index 4228d74e..7033d83c 100644 --- a/contract/tools/ui-kit-goals/makeHttpClient.js +++ b/contract/tools/ui-kit-goals/makeHttpClient.js @@ -45,7 +45,6 @@ export const makeHttpClient = (url, fetch) => { execute: async request => { const settings = { method: 'POST', - mode: 'no-cors', body: request ? JSON.stringify(request) : undefined, headers: { ...jsonType, ...headers }, }; From dd791bc0ec1da76a64028e7538778fb8bc39e44d Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Tue, 9 Jul 2024 17:17:47 +0500 Subject: [PATCH 14/30] Update App.tsx hostname placeholder Removed '/' at the end of the address. --- ui/src/App.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 0f08aa69..6dce4c16 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -14,8 +14,8 @@ function App() { const codeSpaceHostName = import.meta.env.VITE_HOSTNAME; if (codeSpaceHostName) { - REST_HOSTNAME = `https://${codeSpaceHostName}-1317.app.github.dev/`; - RPC_HOSTNAME = `https://${codeSpaceHostName}-26657.app.github.dev/`; + REST_HOSTNAME = `https://${codeSpaceHostName}-1317.app.github.dev`; + RPC_HOSTNAME = `https://${codeSpaceHostName}-26657.app.github.dev`; } return ( From f7efe5dfff8d491ae02fdcd6b2a34f512909ef6f Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Fri, 12 Jul 2024 15:03:57 +0000 Subject: [PATCH 15/30] fix: (probably temporary) added cors header in requests --- contract/tools/ui-kit-goals/makeHttpClient.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contract/tools/ui-kit-goals/makeHttpClient.js b/contract/tools/ui-kit-goals/makeHttpClient.js index 7033d83c..15756eba 100644 --- a/contract/tools/ui-kit-goals/makeHttpClient.js +++ b/contract/tools/ui-kit-goals/makeHttpClient.js @@ -29,7 +29,8 @@ const filterBadStatus = res => { * @returns {import('@cosmjs/tendermint-rpc').RpcClient} */ export const makeHttpClient = (url, fetch) => { - const headers = {}; // XXX needed? + const headers = {'Access-Control-Allow-Origin': '*' + }; // XXX needed? // based on cosmjs 0.30.1: // https://github.com/cosmos/cosmjs/blob/33271bc51cdc865cadb647a1b7ab55d873637f39/packages/tendermint-rpc/src/rpcclients/http.ts#L37 @@ -80,6 +81,7 @@ export const makeAPI = (apiAddress, { fetch }) => { keepalive: true, headers: { 'Content-Type': 'application/json', + 'Access-Control-Allow-Origin': '*', ...options.headers, }, }; From 6eba185848276eae2ad99e866be8af6aaa168193 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir Date: Thu, 18 Jul 2024 09:19:58 +0500 Subject: [PATCH 16/30] fix: comment out ports visibility command in devcontainer --- .devcontainer.json | 2 +- .setup/setup.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100755 .setup/setup.sh diff --git a/.devcontainer.json b/.devcontainer.json index a716070e..b5cf5576 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -18,5 +18,5 @@ "onAutoForward": "silent" } }, - "postStartCommand": "bash -i -c 'nvm install 18.20 && nvm alias default 18.20' && bash ./make_ports_public.sh 5173 1317 26657" + // "postStartCommand": "bash -i -c 'nvm install 18.20 && nvm alias default 18.20' && bash ./make_ports_public.sh 5173 1317 26657" } diff --git a/.setup/setup.sh b/.setup/setup.sh new file mode 100755 index 00000000..57f3ebfc --- /dev/null +++ b/.setup/setup.sh @@ -0,0 +1,2 @@ +./make_ports_public.sh 5173 1317 26657 + From 813a518ce8375f532fba641d9e5e887961924c9b Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Thu, 18 Jul 2024 04:39:12 +0000 Subject: [PATCH 17/30] chore: use env for codespace domain instead of hardcoded string --- ui/src/App.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 6dce4c16..bbbc2a68 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -12,10 +12,11 @@ function App() { let RPC_HOSTNAME = 'http://localhost:26657'; const codeSpaceHostName = import.meta.env.VITE_HOSTNAME; + const codeSpaceDomain = import.meta.env.VITE_GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN; if (codeSpaceHostName) { - REST_HOSTNAME = `https://${codeSpaceHostName}-1317.app.github.dev`; - RPC_HOSTNAME = `https://${codeSpaceHostName}-26657.app.github.dev`; + REST_HOSTNAME = `https://${codeSpaceHostName}-1317.${codeSpaceDomain}`; + RPC_HOSTNAME = `https://${codeSpaceHostName}-26657.${codeSpaceDomain}`; } return ( From b56db1f38fa358d7e552c519702e22ea00786e29 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Thu, 18 Jul 2024 04:58:46 +0000 Subject: [PATCH 18/30] feat: alternate solution for CORS with GH-token --- contract/tools/ui-kit-goals/makeHttpClient.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contract/tools/ui-kit-goals/makeHttpClient.js b/contract/tools/ui-kit-goals/makeHttpClient.js index 15756eba..041ff44e 100644 --- a/contract/tools/ui-kit-goals/makeHttpClient.js +++ b/contract/tools/ui-kit-goals/makeHttpClient.js @@ -29,7 +29,8 @@ const filterBadStatus = res => { * @returns {import('@cosmjs/tendermint-rpc').RpcClient} */ export const makeHttpClient = (url, fetch) => { - const headers = {'Access-Control-Allow-Origin': '*' + const headers = { // 'Access-Control-Allow-Origin': '*', + 'X-Github-Token: TOKEN': import.meta.env.VITE_GITHUB_TOKEN }; // XXX needed? // based on cosmjs 0.30.1: @@ -81,7 +82,8 @@ export const makeAPI = (apiAddress, { fetch }) => { keepalive: true, headers: { 'Content-Type': 'application/json', - 'Access-Control-Allow-Origin': '*', + // 'Access-Control-Allow-Origin': '*', + 'X-Github-Token: TOKEN': import.meta.env.VITE_GITHUB_TOKEN, ...options.headers, }, }; From 0103bcb5a617acad243afd74f6292161b3ea0aba Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Thu, 18 Jul 2024 06:21:15 +0000 Subject: [PATCH 19/30] fix: env variable for GH token --- .devcontainer.json | 2 +- .setup/setup.sh | 2 +- contract/tools/ui-kit-goals/makeHttpClient.js | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.devcontainer.json b/.devcontainer.json index b5cf5576..a900611c 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -17,6 +17,6 @@ "label": "P2P", "onAutoForward": "silent" } - }, + } // "postStartCommand": "bash -i -c 'nvm install 18.20 && nvm alias default 18.20' && bash ./make_ports_public.sh 5173 1317 26657" } diff --git a/.setup/setup.sh b/.setup/setup.sh index 57f3ebfc..96def143 100755 --- a/.setup/setup.sh +++ b/.setup/setup.sh @@ -1,2 +1,2 @@ -./make_ports_public.sh 5173 1317 26657 +../make_ports_public.sh 5173 1317 26657 diff --git a/contract/tools/ui-kit-goals/makeHttpClient.js b/contract/tools/ui-kit-goals/makeHttpClient.js index 041ff44e..5547c039 100644 --- a/contract/tools/ui-kit-goals/makeHttpClient.js +++ b/contract/tools/ui-kit-goals/makeHttpClient.js @@ -29,8 +29,9 @@ const filterBadStatus = res => { * @returns {import('@cosmjs/tendermint-rpc').RpcClient} */ export const makeHttpClient = (url, fetch) => { + const GITHUB_TOKEN = process.env.GITHUB_TOKEN; const headers = { // 'Access-Control-Allow-Origin': '*', - 'X-Github-Token: TOKEN': import.meta.env.VITE_GITHUB_TOKEN + 'X-Github-Token': GITHUB_TOKEN }; // XXX needed? // based on cosmjs 0.30.1: @@ -78,12 +79,13 @@ export const makeAPI = (apiAddress, { fetch }) => { * @param {Record} [options.headers] */ const getJSON = (href, options = {}) => { + const GITHUB_TOKEN = process.env.GITHUB_TOKEN; const opts = { keepalive: true, headers: { 'Content-Type': 'application/json', // 'Access-Control-Allow-Origin': '*', - 'X-Github-Token: TOKEN': import.meta.env.VITE_GITHUB_TOKEN, + 'X-Github-Token': GITHUB_TOKEN, ...options.headers, }, }; From be3f7720a4a2f9a3a67ef08e0b833542fdf02901 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Thu, 18 Jul 2024 09:35:53 +0000 Subject: [PATCH 20/30] fix: devcontainer for ports --- .devcontainer.json | 22 ------------------- .devcontainer/devcontainer.json | 39 +++++++++++++++++++++++++++++++++ .github/dependabot.yml | 12 ++++++++++ 3 files changed, 51 insertions(+), 22 deletions(-) delete mode 100644 .devcontainer.json create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/dependabot.yml diff --git a/.devcontainer.json b/.devcontainer.json deleted file mode 100644 index a900611c..00000000 --- a/.devcontainer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "forwardPorts": [5173, 1317, 26657, 26656], - "portsAttributes": { - "5173": { - "label": "UI", - "onAutoForward": "openBrowser" - }, - "1317": { - "label": "API", - "onAutoForward": "silent" - }, - "26657": { - "label": "RPC", - "onAutoForward": "silent" - }, - "26656": { - "label": "P2P", - "onAutoForward": "silent" - } - } - // "postStartCommand": "bash -i -c 'nvm install 18.20 && nvm alias default 18.20' && bash ./make_ports_public.sh 5173 1317 26657" -} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..6716c49f --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,39 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node +{ + "name": "Node.js", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/javascript-node:1-18-bookworm", + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [5173, 1317, 26657, 26656], + "portsAttributes": { + "5173": { + "label": "UI", + "onAutoForward": "openBrowser" + }, + "1317": { + "label": "API", + "onAutoForward": "silent" + }, + "26657": { + "label": "RPC", + "onAutoForward": "silent" + }, + "26656": { + "label": "P2P", + "onAutoForward": "silent" + } + }, + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "bash ./make_ports_public.sh 5173 1317 26657 && yarn install" + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..f33a02cd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly From de4dc069f8dd90252fc4a9acaac1587d6bb21747 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Thu, 18 Jul 2024 09:43:11 +0000 Subject: [PATCH 21/30] fix: add docker to features --- .devcontainer/devcontainer.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6716c49f..04257976 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -29,7 +29,11 @@ } }, // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "bash ./make_ports_public.sh 5173 1317 26657 && yarn install" + "postCreateCommand": "bash ./make_ports_public.sh 5173 1317 26657 && yarn install", +"postStartCommand": "bash ./make_ports_public.sh 5173 1317 26657 && yarn install", +"features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": {} +} // Configure tool-specific properties. // "customizations": {}, From d7b10ad03b28a17f63424cb876f26c844c91fffe Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Thu, 18 Jul 2024 09:49:35 +0000 Subject: [PATCH 22/30] fix: port opening --- .devcontainer/devcontainer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 04257976..d154900e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -29,8 +29,8 @@ } }, // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "bash ./make_ports_public.sh 5173 1317 26657 && yarn install", -"postStartCommand": "bash ./make_ports_public.sh 5173 1317 26657 && yarn install", + "postCreateCommand": "bash /workspaces/dapp-agoric-basics/make_ports_public.sh 26657 5173 1317", +"postStartCommand": "/workspaces/dapp-agoric-basics/make_ports_public.sh 26656 5173 1317 26657 && yarn install", "features": { "ghcr.io/devcontainers/features/docker-in-docker:2": {} } From c89fb32b597c716c1966c82da1f236d37e5a63d4 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Thu, 18 Jul 2024 09:55:44 +0000 Subject: [PATCH 23/30] fix: add gh CLI to features --- .devcontainer/devcontainer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d154900e..a214f92f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -32,7 +32,8 @@ "postCreateCommand": "bash /workspaces/dapp-agoric-basics/make_ports_public.sh 26657 5173 1317", "postStartCommand": "/workspaces/dapp-agoric-basics/make_ports_public.sh 26656 5173 1317 26657 && yarn install", "features": { - "ghcr.io/devcontainers/features/docker-in-docker:2": {} + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/devcontainers/features/github-cli:1": {} } // Configure tool-specific properties. From 3eeb173057957b931b453d3846e8f2817518460d Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Thu, 18 Jul 2024 10:30:29 +0000 Subject: [PATCH 24/30] fix: revert to access-control in header --- contract/tools/ui-kit-goals/makeHttpClient.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/contract/tools/ui-kit-goals/makeHttpClient.js b/contract/tools/ui-kit-goals/makeHttpClient.js index 5547c039..ee846045 100644 --- a/contract/tools/ui-kit-goals/makeHttpClient.js +++ b/contract/tools/ui-kit-goals/makeHttpClient.js @@ -29,9 +29,7 @@ const filterBadStatus = res => { * @returns {import('@cosmjs/tendermint-rpc').RpcClient} */ export const makeHttpClient = (url, fetch) => { - const GITHUB_TOKEN = process.env.GITHUB_TOKEN; - const headers = { // 'Access-Control-Allow-Origin': '*', - 'X-Github-Token': GITHUB_TOKEN + const headers = { 'Access-Control-Allow-Origin': '*' }; // XXX needed? // based on cosmjs 0.30.1: @@ -79,13 +77,11 @@ export const makeAPI = (apiAddress, { fetch }) => { * @param {Record} [options.headers] */ const getJSON = (href, options = {}) => { - const GITHUB_TOKEN = process.env.GITHUB_TOKEN; const opts = { keepalive: true, headers: { 'Content-Type': 'application/json', - // 'Access-Control-Allow-Origin': '*', - 'X-Github-Token': GITHUB_TOKEN, + 'Access-Control-Allow-Origin': '*', ...options.headers, }, }; From 3392cca994b029e1466493848cd5201d519a610f Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir Date: Thu, 18 Jul 2024 16:25:31 +0500 Subject: [PATCH 25/30] chore: delete setup not needed anymore --- .setup/setup.sh | 2 -- 1 file changed, 2 deletions(-) delete mode 100755 .setup/setup.sh diff --git a/.setup/setup.sh b/.setup/setup.sh deleted file mode 100755 index 96def143..00000000 --- a/.setup/setup.sh +++ /dev/null @@ -1,2 +0,0 @@ -../make_ports_public.sh 5173 1317 26657 - From 7fd9e20292d7cfd1deefa8f73ec887a52b9a765b Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir Date: Thu, 18 Jul 2024 16:28:07 +0500 Subject: [PATCH 26/30] fix: export GHCS domain name --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1143ba28..3db6cb45 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "docker:make": "cd contract; docker compose exec agd make -C /workspace/contract", "make:help": "make -C contract list", "start:contract": "cd contract && yarn start", - "start:ui": "export VITE_HOSTNAME=$CODESPACE_NAME && cd ui && yarn dev", + "start:ui": "export VITE_HOSTNAME=$CODESPACE_NAME && export VITE_GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN=$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN && cd ui && yarn dev", "lint": "yarn workspaces run lint", "lint:fix": "yarn workspaces run lint:fix", "test": "yarn workspaces run test", From a467f844ecfaff20bc9f6ca0662e605200a67a5e Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir Date: Thu, 18 Jul 2024 16:29:47 +0500 Subject: [PATCH 27/30] chore: clean devcontainer file --- .devcontainer/devcontainer.json | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a214f92f..e18340b2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,9 +5,6 @@ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile "image": "mcr.microsoft.com/devcontainers/javascript-node:1-18-bookworm", - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - // Use 'forwardPorts' to make a list of ports inside the container available locally. "forwardPorts": [5173, 1317, 26657, 26656], "portsAttributes": { @@ -30,15 +27,9 @@ }, // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": "bash /workspaces/dapp-agoric-basics/make_ports_public.sh 26657 5173 1317", -"postStartCommand": "/workspaces/dapp-agoric-basics/make_ports_public.sh 26656 5173 1317 26657 && yarn install", -"features": { - "ghcr.io/devcontainers/features/docker-in-docker:2": {}, - "ghcr.io/devcontainers/features/github-cli:1": {} -} - - // Configure tool-specific properties. - // "customizations": {}, - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" + "postStartCommand": "/workspaces/dapp-agoric-basics/make_ports_public.sh 26656 5173 1317 26657 && yarn install", + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/devcontainers/features/github-cli:1": {} + } } From f0749ab321f2c140860e80d1f88d455f25b4aad7 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir <53943791+amessbee@users.noreply.github.com> Date: Thu, 18 Jul 2024 11:47:58 +0000 Subject: [PATCH 28/30] chore: yarn install in postStartCommand --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e18340b2..18e4d42e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -27,7 +27,7 @@ }, // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": "bash /workspaces/dapp-agoric-basics/make_ports_public.sh 26657 5173 1317", - "postStartCommand": "/workspaces/dapp-agoric-basics/make_ports_public.sh 26656 5173 1317 26657 && yarn install", + "postStartCommand": "yarn install", "features": { "ghcr.io/devcontainers/features/docker-in-docker:2": {}, "ghcr.io/devcontainers/features/github-cli:1": {} From 9047c52b15edabf5c45577e622b59e8be72d4584 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir Date: Thu, 18 Jul 2024 17:15:23 +0500 Subject: [PATCH 29/30] chore: readme for ghcs --- README-code-space.md | 14 ++++++++++++++ README.md | 1 + 2 files changed, 15 insertions(+) create mode 100644 README-code-space.md diff --git a/README-code-space.md b/README-code-space.md new file mode 100644 index 00000000..dece3284 --- /dev/null +++ b/README-code-space.md @@ -0,0 +1,14 @@ +# Instructions to run `dapp-agoric-basic` in GHCS + +Here are the step-by-step instructions to run/work on `dapp-agoric-basic` in github codespaces: + +1. Go to repo here: [https://github.com/Agoric/dapp-agoric-basics/](https://github.com/Agoric/dapp-agoric-basics/) +2. Click on ![Green `<> Code` button](https://docs.github.com/assets/cb-13128/mw-1440/images/help/repository/code-button.webp) +3. Click on `Codespaces` tab and create a new Codespace. If you are already using Codespaces on current repo then click the "+" button on top right of the `Codespaces` tab to create a new one. +4. You should see a VSCode environment load in your browser followed by a setup. This should take a few minutes. +5. Once it's done do `yarn install` in the terminal. +6. Do `yarn start:docker` followed by `yarn docker:logs` - kill it after you see `begin`/`commit`. +7. Do `yarn start:contract`. +8. Do `yarn start:ui` - a pop-up should appear in bottom right. Click open in browser if needed. +9. DApp should be load in your browser. +10. Connect your Wallet and interact with DApp as usual. \ No newline at end of file diff --git a/README.md b/README.md index 4db5ef53..a793c421 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Agoric Dapp Starter: Agoric Basics This is a basic Agoric Dapp that contains three smart contracts `postal-service`, `sell-concert-tickets`, and `swaparoo` demonstrating different scenarios which can be implemented easily using Agoric SDK. There is also a UI for `sell-concert-tickets` contract that a user can use to buy three different types of concert tickets and pay through a wallet extension in the browser. +The following instrucions provide a guide to setup an environment to try `dapp-agoric-basics` on your local machine. If you want to try it in cloud environment without any installations or downloads, you can [try it in github codespaces](README-code-space.md). ## Getting started From fdfe3e7b156ee63685f3c1e2e1e20cfcbcf6b051 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir Date: Thu, 18 Jul 2024 17:17:46 +0500 Subject: [PATCH 30/30] fix: readme links --- README-code-space.md | 14 -------------- README.md | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 15 deletions(-) delete mode 100644 README-code-space.md diff --git a/README-code-space.md b/README-code-space.md deleted file mode 100644 index dece3284..00000000 --- a/README-code-space.md +++ /dev/null @@ -1,14 +0,0 @@ -# Instructions to run `dapp-agoric-basic` in GHCS - -Here are the step-by-step instructions to run/work on `dapp-agoric-basic` in github codespaces: - -1. Go to repo here: [https://github.com/Agoric/dapp-agoric-basics/](https://github.com/Agoric/dapp-agoric-basics/) -2. Click on ![Green `<> Code` button](https://docs.github.com/assets/cb-13128/mw-1440/images/help/repository/code-button.webp) -3. Click on `Codespaces` tab and create a new Codespace. If you are already using Codespaces on current repo then click the "+" button on top right of the `Codespaces` tab to create a new one. -4. You should see a VSCode environment load in your browser followed by a setup. This should take a few minutes. -5. Once it's done do `yarn install` in the terminal. -6. Do `yarn start:docker` followed by `yarn docker:logs` - kill it after you see `begin`/`commit`. -7. Do `yarn start:contract`. -8. Do `yarn start:ui` - a pop-up should appear in bottom right. Click open in browser if needed. -9. DApp should be load in your browser. -10. Connect your Wallet and interact with DApp as usual. \ No newline at end of file diff --git a/README.md b/README.md index a793c421..ecb4b6f9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Agoric Dapp Starter: Agoric Basics This is a basic Agoric Dapp that contains three smart contracts `postal-service`, `sell-concert-tickets`, and `swaparoo` demonstrating different scenarios which can be implemented easily using Agoric SDK. There is also a UI for `sell-concert-tickets` contract that a user can use to buy three different types of concert tickets and pay through a wallet extension in the browser. -The following instrucions provide a guide to setup an environment to try `dapp-agoric-basics` on your local machine. If you want to try it in cloud environment without any installations or downloads, you can [try it in github codespaces](README-code-space.md). +The following instrucions provide a guide to setup an environment to try `dapp-agoric-basics` on your local machine. If you want to try it in cloud environment without any installations or downloads, you can [try it in github codespaces](#instructions-to-run-dapp-agoric-basic-in-ghcs). ## Getting started @@ -30,5 +30,20 @@ To perform unit tests: To perform end to end test -run the command `yarn test:e2e` in the root directory. +## Instructions to run `dapp-agoric-basic` in GHCS + +Here are the step-by-step instructions to run/work on `dapp-agoric-basic` in github codespaces: + +1. Go to repo here: [https://github.com/Agoric/dapp-agoric-basics/](https://github.com/Agoric/dapp-agoric-basics/) +2. Click on ![Green `<> Code` button](https://docs.github.com/assets/cb-13128/mw-1440/images/help/repository/code-button.webp) +3. Click on `Codespaces` tab and create a new Codespace. If you are already using Codespaces on current repo then click the "+" button on top right of the `Codespaces` tab to create a new one. +4. You should see a VSCode environment load in your browser followed by a setup. This should take a few minutes. +5. Once it's done do `yarn install` in the terminal. +6. Do `yarn start:docker` followed by `yarn docker:logs` - kill it after you see `begin`/`commit`. +7. Do `yarn start:contract`. +8. Do `yarn start:ui` - a pop-up should appear in bottom right. Click open in browser if needed. +9. DApp should be load in your browser. +10. Connect your Wallet and interact with DApp as usual. + ## Contributing See [CONTRIBUTING](./CONTRIBUTING.md) for more on contributions.