From 4e9aeff558a4709d696a451a66965471186368e8 Mon Sep 17 00:00:00 2001 From: dckc Date: Tue, 4 Jun 2024 21:28:11 +0000 Subject: [PATCH 1/5] build: default IDX nix config --- .idx/dev.nix | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .idx/dev.nix diff --git a/.idx/dev.nix b/.idx/dev.nix new file mode 100644 index 0000000..2ce0434 --- /dev/null +++ b/.idx/dev.nix @@ -0,0 +1,55 @@ +# To learn more about how to use Nix to configure your environment +# see: https://developers.google.com/idx/guides/customize-idx-env +{ pkgs, ... }: { + # Which nixpkgs channel to use. + channel = "stable-23.11"; # or "unstable" + + # Use https://search.nixos.org/packages to find packages + packages = [ + # pkgs.go + # pkgs.python311 + # pkgs.python311Packages.pip + # pkgs.nodejs_20 + # pkgs.nodePackages.nodemon + ]; + + # Sets environment variables in the workspace + env = {}; + idx = { + # Search for the extensions you want on https://open-vsx.org/ and use "publisher.id" + extensions = [ + # "vscodevim.vim" + ]; + + # Enable previews + previews = { + enable = true; + previews = { + # web = { + # # Example: run "npm run dev" with PORT set to IDX's defined port for previews, + # # and show it in IDX's web preview panel + # command = ["npm" "run" "dev"]; + # manager = "web"; + # env = { + # # Environment variables to set for your server + # PORT = "$PORT"; + # }; + # }; + }; + }; + + # Workspace lifecycle hooks + workspace = { + # Runs when a workspace is first created + onCreate = { + # Example: install JS dependencies from NPM + # npm-install = "npm install"; + }; + # Runs when the workspace is (re)started + onStart = { + # Example: start a background task to watch and re-build backend code + # watch-backend = "npm run watch-backend"; + }; + }; + }; +} From 8a8ce36cf9dc65c08ca316ed6990afcea423e859 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Tue, 4 Jun 2024 16:33:22 -0500 Subject: [PATCH 2/5] build: IDX config customization - nodejs, yarn - docker --- .idx/dev.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.idx/dev.nix b/.idx/dev.nix index 2ce0434..e2b4bd0 100644 --- a/.idx/dev.nix +++ b/.idx/dev.nix @@ -9,10 +9,12 @@ # pkgs.go # pkgs.python311 # pkgs.python311Packages.pip - # pkgs.nodejs_20 - # pkgs.nodePackages.nodemon + pkgs.nodejs_20 + pkgs.nodePackages.yarn ]; + services.docker.enable = true; + # Sets environment variables in the workspace env = {}; idx = { @@ -43,7 +45,7 @@ # Runs when a workspace is first created onCreate = { # Example: install JS dependencies from NPM - # npm-install = "npm install"; + npm-install = "yarn install"; }; # Runs when the workspace is (re)started onStart = { From bed673f5be3128b162b03615da377a9c650f0d81 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Tue, 4 Jun 2024 16:35:09 -0500 Subject: [PATCH 3/5] docs: Try in IDX button --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index fcdc763..2709b1f 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,10 @@ Offer Up is a simple Dapp for the [Agoric smart contract platform](https://docs. ## Getting started + + Try in IDX + + Detailed instructions regarding setting up the environment with a video walkthrough is available at [Your First Agoric Dapp](https://docs.agoric.com/guides/getting-started/) tutorial. But if you have the environment set, i.e., have correct version of node, yarn, docker, and Keplr wallet installed, here are the steps that you need to follow: - run the `yarn install` command to install any solution dependencies. *Downloading all the required dependencies may take several minutes. The UI depends on the React framework, and the contract depends on the Agoric framework. The packages in this project also have development dependencies for testing, code formatting, and static analysis.* - start a local Agoric blockchain using the `yarn start:docker` command. From a5689ec2a8338a35b054eb59501c2ac4105c814b Mon Sep 17 00:00:00 2001 From: dckc Date: Tue, 4 Jun 2024 22:25:14 +0000 Subject: [PATCH 4/5] build(idx): pull docker image onCreate --- .idx/dev.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/.idx/dev.nix b/.idx/dev.nix index e2b4bd0..337c558 100644 --- a/.idx/dev.nix +++ b/.idx/dev.nix @@ -46,6 +46,7 @@ onCreate = { # Example: install JS dependencies from NPM npm-install = "yarn install"; + docker-pull = "docker compose pull"; }; # Runs when the workspace is (re)started onStart = { From 91c38b884e5caf7d997479a3fe415e6a95131745 Mon Sep 17 00:00:00 2001 From: dckc Date: Tue, 4 Jun 2024 22:27:56 +0000 Subject: [PATCH 5/5] ui: get network-config from WEB_HOST (WIP) --- ui/package.json | 1 + ui/src/App.tsx | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/package.json b/ui/package.json index 664db26..e182459 100644 --- a/ui/package.json +++ b/ui/package.json @@ -6,6 +6,7 @@ "scripts": { "dev": "vite", "build": "tsc && vite build", + "build:idx": "echo '{\"chainName\": \"agoriclocal\", \"rpcAddrs\": [\"https://26657-'${WEB_HOST}'\"]}' >public/network-config.json", "test": "vitest spec", "test:e2e": "SKIP_EXTENSION_SETUP=true EXTENSION=keplr synpress run --configFile=test/e2e/synpress.config.cjs", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", diff --git a/ui/src/App.tsx b/ui/src/App.tsx index d62c47a..ad5be57 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -59,7 +59,10 @@ const setup = async () => { }; const connectWallet = async () => { - await suggestChain('https://local.agoric.net/network-config'); + const networkConfig = process.env.WEB_HOST ? '/network-config.json' : 'https://local.agoric.net/network-config'; + console.log({ networkConfig }); + await suggestChain(networkConfig); + const wallet = await makeAgoricWalletConnection(watcher, ENDPOINTS.RPC); useAppStore.setState({ wallet }); const { pursesNotifier } = wallet;