diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml
index 6a6c51f63..ff3fd038c 100644
--- a/.github/workflows/promote.yml
+++ b/.github/workflows/promote.yml
@@ -11,7 +11,7 @@ jobs:
# Skip any pushes from the act CLI
# Comment out for testing
- if: ${{ github.actor != 'nektos/act' }}
+ if: ${{ github.actor != "nektos/act" }}
steps:
- uses: actions/checkout@v3
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index 44c799977..57882d047 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -14,10 +14,15 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- - name: Check out the repo
+ - name: Checkout the repo with submodules
uses: actions/checkout@v3
with:
- submodules: 'recursive'
+ submodules: "recursive"
+
+ - name: Setup Node.js LTS
+ uses: actions/setup-node@v4
+ with:
+ node-version: "lts/*"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
@@ -28,8 +33,6 @@ jobs:
- name: Install and build all package dependencies
run: npm ci
- env:
- PUBLIC_STAGE: ${{ env.STAGE }}
- name: Test cdk deployment
run: npm run test:cdk
\ No newline at end of file
diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml
index cd3b91586..581886f0e 100644
--- a/.github/workflows/push.yml
+++ b/.github/workflows/push.yml
@@ -13,19 +13,20 @@ jobs:
name: Deploy
runs-on: ubuntu-latest
- # Skip any pushes with commit flag '(skip deploy)'
+ # Skip any pushes with commit flag "(skip deploy)"
# Comment out for testing
- if: ${{ !contains(github.event.head_commit.message, '(skip deploy)') }}
+ if: ${{ !contains(github.event.head_commit.message, "(skip deploy)") }}
steps:
- - name: Check out the repo
+ - name: Checkout the repo with submodules
uses: actions/checkout@v3
with:
- submodules: 'recursive'
-
- - name: Install action dependencies
- run: |
- curl -sSf https://atlasgo.sh | sh
+ submodules: "recursive"
+
+ - name: Setup Node.js LTS
+ uses: actions/setup-node@v4
+ with:
+ node-version: "lts/*"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
@@ -33,11 +34,13 @@ jobs:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
+
+ - name: Install action dependencies
+ run: |
+ curl -sSf https://atlasgo.sh | sh
- name: Install and build all package dependencies
run: npm ci
- env:
- PUBLIC_STAGE: ${{ env.STAGE }}
- name: Deploy cdk infrastructure
run: npm run deploy:cdk
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 910b62f3d..17c9b8359 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -14,10 +14,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- - name: Check out the repo
+ - name: Checkout the repo with submodules
uses: actions/checkout@v3
with:
- submodules: 'recursive'
+ submodules: "recursive"
+
+ - name: Setup Node.js LTS
+ uses: actions/setup-node@v4
+ with:
+ node-version: "lts/*"
- name: Get the tag name
run: |
@@ -30,18 +35,20 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
+ # - name: Install action dependencies
+ # run: |
+ # curl -sSf https://atlasgo.sh | sh
+
- name: Install and build all package dependencies
run: npm ci
- env:
- PUBLIC_STAGE: ${{ env.STAGE }}
- - name: Deploy cdk infrastructure
+ - name: Deploy CDK infrastructure
run: npm run deploy:cdk
# - name: Migrate users database
# run: npm run migrations:users
- - name: Check out develop
+ - name: Checkout develop
uses: actions/checkout@v3
with:
ref: develop
@@ -52,7 +59,7 @@ jobs:
git fetch origin master:master
git reset --hard master
- - name: Create Pull Request
+ - name: Create a pull request
uses: peter-evans/create-pull-request@v3
with:
base: develop
diff --git a/.github/workflows/sandbox.yml b/.github/workflows/sandbox.yml
index 41a478351..9c8c19c24 100644
--- a/.github/workflows/sandbox.yml
+++ b/.github/workflows/sandbox.yml
@@ -16,19 +16,20 @@ jobs:
name: Deploy
runs-on: ubuntu-latest
- # Skip any pushes with commit flag '(skip deploy)'
+ # Skip any pushes with commit flag "(skip deploy)"
# Comment out for testing
- if: ${{ !contains(github.event.head_commit.message, '(skip deploy)') }}
+ if: ${{ !contains(github.event.head_commit.message, "(skip deploy)") }}
steps:
- - name: Check out the repo
+ - name: Checkout the repo with submodules
uses: actions/checkout@v3
with:
- submodules: 'recursive'
+ submodules: "recursive"
- - name: Install action dependencies
- run: |
- curl -sSf https://atlasgo.sh | sh
+ - name: Setup Node.js LTS
+ uses: actions/setup-node@v4
+ with:
+ node-version: "lts/*"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
@@ -37,12 +38,16 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
+ - name: Install action dependencies
+ run: |
+ curl -sSf https://atlasgo.sh | sh
+
- name: Install and build all package dependencies
run: npm ci
env:
PUBLIC_STAGE: ${{ env.STAGE }}
- - name: Deploy cdk infrastructure
+ - name: Deploy CDK infrastructure
run: npm run deploy:cdk
- name: Migrate users database
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 025d86f9c..dd8391181 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,7 +1,7 @@
{
"css.lint.unknownAtRules": "ignore",
"editor.codeActionsOnSave": {
- "source.fixAll.eslint": true
+ "source.fixAll.eslint": "explicit"
},
"eslint.validate": [
"vue",
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e0db364a5..294d07d25 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -173,7 +173,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Add initial Ethereum service notes and config [`#251`](https://github.com/consensusnetworks/casimir/pull/251)
- Add chart component prototypes [`#249`](https://github.com/consensusnetworks/casimir/pull/249)
- Revert "Feature/chart components" [`#248`](https://github.com/consensusnetworks/casimir/pull/248)
-- Add polyfill for node stream to @casimir/web [`#242`](https://github.com/consensusnetworks/casimir/pull/242)
+- Add polyfill for node stream to @casimir/app [`#242`](https://github.com/consensusnetworks/casimir/pull/242)
- Promote develop to master [`#241`](https://github.com/consensusnetworks/casimir/pull/241)
- Resovle issues [`7303036`](https://github.com/consensusnetworks/casimir/commit/73030369693d066f0f270242f195ddf95f59b6c3)
- Mock up Analytics component [`ba085a0`](https://github.com/consensusnetworks/casimir/commit/ba085a0cad75a0c5a53db0bcc3bbc3611025ae85)
diff --git a/README.md b/README.md
index 5b3dc434a..d82d5cdf6 100644
--- a/README.md
+++ b/README.md
@@ -16,8 +16,8 @@
- [Configure](#configure)
- [Environment Variables](#environment-variables)
- [Apps](#apps)
- - [@casimir/web](#casimirweb)
- - [@casimir/landing](#casimirlanding)
+ - [@casimir/app](#casimirapp)
+ - [@casimir/www](#casimirwww)
- [Contracts](#contracts)
- [@casimir/ethereum](#casimirethereum)
- [Common](#common)
@@ -37,77 +37,81 @@ Get started contributing to Casimir's codebase.
### Prerequisites
-Configure the following prerequisite global dependency versions.
+Configure the following prerequisite global dependency versions:
-1. [Docker (v24.x)](https://docs.docker.com/engine/install/).
+1. [Git (v2.x)](https://git-scm.com/downloads).
-2. [Go (v1.18.x)](https://golang.org/doc/install).
+ > ๐ฉ **GitHub submodule support:** You also need to make sure to have at least one SSH authentication key on your GitHub account (for the git cloning of submodules within submodules). See [Adding a new SSH key to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).
-3. [Node.js (v18.x)](https://nodejs.org/en/download/).
+2. [Docker (v24.x)](https://docs.docker.com/engine/install).
-4. [Optional: AWS CLI (v2.x)](https://aws.amazon.com/cli/)
+3. [Go (v1.20.x)](https://golang.org/doc/install).
+
+4. [Node.js (LTS)](https://nodejs.org/en/download).
+
+ > ๐ฉ **Using NVM**: Install [NVM](https://github.com/nvm-sh/nvm?tab=readme-ov-file#installing-and-updating) and run `nvm install --lts && nvm alias default lts/*` to set the default version to the latest LTS. You will need to rerun this command whenever the latest LTS changes.
+
+5. [AWS CLI (v2.x)](https://aws.amazon.com/cli).
> ๐ฉ **Consensus Networks team only**: Create an [AWS profile](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) named `consensus-networks-dev`.
### Setup
-Clone the repository and checkout a new branch from develop.
+Clone the repository and checkout a new branch from develop:
-```zsh
-git clone https://github.com/consensusnetworks/casimir.git
-cd casimir
-git checkout -b <"feature || bug || enhancement">/<"your-branch-name" develop
-```
+ ```zsh
+ git clone https://github.com/consensusnetworks/casimir.git
+ cd casimir
+ git checkout -b <"feature || bug || enhancement">/<"your-branch-name" develop
+ ```
We are using [npm workspaces](https://docs.npmjs.com/cli/v8/using-npm/workspaces) to simplify monorepo development workflows while keeping project-wide resources accessible. The core commands are below.
-Install all repository dependencies and build necessary types.
+Install all repository dependencies and build necessary types:
-```zsh
-npm install
-```
+ ```zsh
+ npm install
+ ```
- > ๐ฉ To see output from a npm preinstall or postinstall script on `npm i`, run `npm i --foreground-scripts`.
+Clean all repository dependencies and reinstall:
-Clean all repository dependencies and reinstall.
+ ```zsh
+ npm run clean
+ ```
-```zsh
-npm run clean
-```
-
-Install a dev dependency to the root.
+Install a dev dependency to the root:
-```zsh
-npm install -D some-dev-dependency
-```
+ ```zsh
+ npm install -D some-dev-dependency
+ ```
-Install a dependency or dev dependency to a specific workspace.
+Install a dependency or dev dependency to a specific workspace:
-```zsh
-# dependency
-npm install some-dependency --workspace @casimir/<"workspace-name">
+ ```zsh
+ # dependency
+ npm install some-dependency --workspace @casimir/<"workspace-name">
-# dev dependency
-npm install -D some-dev-dependency --workspace @casimir/<"workspace-name">
-```
+ # dev dependency
+ npm install -D some-dev-dependency --workspace @casimir/<"workspace-name">
+ ```
### Configure
Customize and override the development environment configuration by creating a [.env](.env) file in the root directory.
-**If you are on the Consensus Networks organization**, make sure your AWS CLI and profile are configured correctly. By default, the scripts look for the `consensus-networks-dev` named profile, but you can override the `AWS_PROFILE` name to be used in the [.env](.env) file. Regardless, the profile must have access to the `consensus-networks-dev` account resources.
+**If you are on the Consensus Networks organization**, make sure your AWS CLI and profile are configured correctly. By default, the scripts look for the `consensus-networks-dev` named profile, but you can override the `AWS_PROFILE` name to be used in the [.env](.env) file. Optionally, override the `AWS_PROFILE` name in your [.env](.env) file:
-```zsh
-# From the root directory
-echo "AWS_PROFILE=<"your-aws-profile-name">" > .env
-```
+ ```zsh
+ # From the root directory
+ echo "AWS_PROFILE=<"your-aws-profile-name">" > .env
+ ```
-**If you are outside of the Consensus Networks organization**, make sure to set `USE_SECRETS` to `false`.
+**If you are outside of the Consensus Networks organization**, set `USE_SECRETS` to `false` in your [.env](.env) file:
-```zsh
-# From the root directory
-echo "USE_SECRETS=false" > .env
-```
+ ```zsh
+ # From the root directory
+ echo "USE_SECRETS=false" > .env
+ ```
#### Environment Variables
@@ -131,27 +135,27 @@ echo "USE_SECRETS=false" > .env
The apps packages provide a UI to end-users.
-#### @casimir/web
+#### @casimir/app
-Run the web app with an integrated development environment, including local contracts and services.
+Run the main web app with an integrated development environment, including local contracts and services:
-```zsh
-# From the root directory
-npm run dev
-```
+ ```zsh
+ # From the root directory
+ npm run dev
+ ```
-See the [@casimir/web README.md](apps/web/README.md) for detailed documentation.
+See the [@casimir/app README.md](apps/app/README.md) for detailed documentation.
-#### @casimir/landing
+#### @casimir/www
-Run the landing app.
+Run the landing page app:
-```zsh
-# From the root directory
-npm run dev:landing
-```
+ ```zsh
+ # From the root directory
+ npm run dev:www
+ ```
-See the [@casimir/landing README.md](apps/landing/README.md) for detailed documentation.
+See the [@casimir/www README.md](apps/www/README.md) for detailed documentation.
### Contracts
@@ -159,19 +163,12 @@ The contracts packages provide the smart contracts for the project.
#### @casimir/ethereum
-Test the Ethereum contracts.
+Test the Ethereum contracts:
-```zsh
-# From the root directory
-npm run test --workspace @casimir/ethereum
-```
-
-Fork the Ethereum contracts to local network and simulate events and oracle handling.
-
-```zsh
-# From the root directory
-npm run dev --workspace @casimir/ethereum
-```
+ ```zsh
+ # From the root directory
+ npm run test --workspace @casimir/ethereum
+ ```
See the [@casimir/ethereum README.md](contracts/ethereum/README.md) for detailed documentation.
@@ -194,12 +191,12 @@ The infrastructure packages provide the infrastructure as code for the project.
#### @casimir/cdk
-Test the CDK infrastructure.
+Test the CDK infrastructure:
-```zsh
-# From the root directory
-npm run test:cdk
-```
+ ```zsh
+ # From the root directory
+ npm run test:cdk
+ ```
See the [@casimir/cdk README.md](infrastructure/cdk/README.md) for detailed documentation.
@@ -221,8 +218,8 @@ Code is organized into work directories (apps, common, contracts, infrastructure
โโโ .github/ (workflows and issue templates)
| โโโ workflows/ (gh actions workflows)
โโโ apps/ (frontend apps)
-| |โโ landing/ (landing page app)
-| โโโ web/ (main web app)
+| |โโ www/ (landing page app)
+| โโโ app/ (main web app)
โโโ common/ (shared code)
| โโโ data/ (data schemas and operational workflows)
| โโโ helpers/ (general utilities)
diff --git a/apps/app/.eslintrc b/apps/app/.eslintrc
new file mode 100644
index 000000000..e49767aa2
--- /dev/null
+++ b/apps/app/.eslintrc
@@ -0,0 +1,43 @@
+{
+ "env": {
+ "browser": true,
+ "es2021": true,
+ "node": true
+ },
+ "extends": [
+ "eslint:recommended",
+ "plugin:vue/recommended",
+ "plugin:@typescript-eslint/recommended",
+ "@vue/eslint-config-typescript"
+ ],
+ "parser": "vue-eslint-parser",
+ "parserOptions": {
+ "ecmaVersion": "latest",
+ "parser": "@typescript-eslint/parser",
+ "sourceType": "module"
+ },
+ "plugins": [
+ "vue",
+ "@typescript-eslint"
+ ],
+ "rules": {
+ "max-len": [
+ "error",
+ {
+ "code": 200,
+ "ignoreStrings": true,
+ "comments": 300,
+ "ignoreTemplateLiterals": true
+ }
+ ],
+ "vue/multi-word-component-names": "off",
+ "vue/no-multiple-template-root": "off"
+ },
+ "ignorePatterns": [
+ "**/node_modules/**",
+ "**/build/**",
+ "**/dist/**",
+ "**/lib/**",
+ "cdk.out"
+ ]
+}
\ No newline at end of file
diff --git a/apps/landing/.gitignore b/apps/app/.gitignore
similarity index 100%
rename from apps/landing/.gitignore
rename to apps/app/.gitignore
diff --git a/apps/web/README.md b/apps/app/README.md
similarity index 100%
rename from apps/web/README.md
rename to apps/app/README.md
diff --git a/apps/app/index.html b/apps/app/index.html
new file mode 100644
index 000000000..dde16aaf3
--- /dev/null
+++ b/apps/app/index.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ Vite + Vue + TS
+
+
+
+
+
+
diff --git a/apps/app/package.json b/apps/app/package.json
new file mode 100644
index 000000000..7154ebdd8
--- /dev/null
+++ b/apps/app/package.json
@@ -0,0 +1,22 @@
+{
+ "name": "@casimir/app",
+ "description": "The Casimir self-custodial, configurable staking and analytics web app",
+ "type": "module",
+ "private": true,
+ "scripts": {
+ "dev": "vite",
+ "build": "vue-tsc --noEmit && vite build",
+ "preview": "vite preview"
+ },
+ "dependencies": {
+ "vue": "^3.3.8"
+ },
+ "devDependencies": {
+ "@rollup/plugin-node-resolve": "^15.2.3",
+ "@vitejs/plugin-vue": "^4.5.0",
+ "rollup-plugin-polyfill-node": "^0.13.0",
+ "typescript": "^5.2.2",
+ "vite": "^5.0.0",
+ "vue-tsc": "^1.8.22"
+ }
+}
diff --git a/apps/app/public/vite.svg b/apps/app/public/vite.svg
new file mode 100644
index 000000000..e7b8dfb1b
--- /dev/null
+++ b/apps/app/public/vite.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/apps/app/src/App.vue b/apps/app/src/App.vue
new file mode 100644
index 000000000..72e21d7e1
--- /dev/null
+++ b/apps/app/src/App.vue
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
diff --git a/apps/app/src/assets/vue.svg b/apps/app/src/assets/vue.svg
new file mode 100644
index 000000000..770e9d333
--- /dev/null
+++ b/apps/app/src/assets/vue.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/apps/app/src/components/HelloWorld.vue b/apps/app/src/components/HelloWorld.vue
new file mode 100644
index 000000000..5df44669a
--- /dev/null
+++ b/apps/app/src/components/HelloWorld.vue
@@ -0,0 +1,49 @@
+
+
+
+ {{ msg }}
+
+
+
+
+ Edit
+ components/HelloWorld.vue
to test HMR
+
+
+
+
+ Check out
+ create-vue, the official Vue + Vite starter
+
+
+ Install
+ Volar
+ in your IDE for a better DX
+
+
+ Click on the Vite and Vue logos to learn more
+
+
+
+
diff --git a/apps/app/src/main.ts b/apps/app/src/main.ts
new file mode 100644
index 000000000..8a1724e0a
--- /dev/null
+++ b/apps/app/src/main.ts
@@ -0,0 +1,5 @@
+import { createApp } from "vue"
+import "./style.css"
+import App from "./App.vue"
+
+createApp(App).mount("#app")
diff --git a/apps/app/src/style.css b/apps/app/src/style.css
new file mode 100644
index 000000000..bb131d6b8
--- /dev/null
+++ b/apps/app/src/style.css
@@ -0,0 +1,79 @@
+:root {
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
+ line-height: 1.5;
+ font-weight: 400;
+
+ color-scheme: light dark;
+ color: rgba(255, 255, 255, 0.87);
+ background-color: #242424;
+
+ font-synthesis: none;
+ text-rendering: optimizeLegibility;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+a {
+ font-weight: 500;
+ color: #646cff;
+ text-decoration: inherit;
+}
+a:hover {
+ color: #535bf2;
+}
+
+body {
+ margin: 0;
+ display: flex;
+ place-items: center;
+ min-width: 320px;
+ min-height: 100vh;
+}
+
+h1 {
+ font-size: 3.2em;
+ line-height: 1.1;
+}
+
+button {
+ border-radius: 8px;
+ border: 1px solid transparent;
+ padding: 0.6em 1.2em;
+ font-size: 1em;
+ font-weight: 500;
+ font-family: inherit;
+ background-color: #1a1a1a;
+ cursor: pointer;
+ transition: border-color 0.25s;
+}
+button:hover {
+ border-color: #646cff;
+}
+button:focus,
+button:focus-visible {
+ outline: 4px auto -webkit-focus-ring-color;
+}
+
+.card {
+ padding: 2em;
+}
+
+#app {
+ max-width: 1280px;
+ margin: 0 auto;
+ padding: 2rem;
+ text-align: center;
+}
+
+@media (prefers-color-scheme: light) {
+ :root {
+ color: #213547;
+ background-color: #ffffff;
+ }
+ a:hover {
+ color: #747bff;
+ }
+ button {
+ background-color: #f9f9f9;
+ }
+}
diff --git a/apps/app/src/vite-env.d.ts b/apps/app/src/vite-env.d.ts
new file mode 100644
index 000000000..11f02fe2a
--- /dev/null
+++ b/apps/app/src/vite-env.d.ts
@@ -0,0 +1 @@
+///
diff --git a/apps/app/tsconfig.json b/apps/app/tsconfig.json
new file mode 100644
index 000000000..064a9591a
--- /dev/null
+++ b/apps/app/tsconfig.json
@@ -0,0 +1,25 @@
+{
+ "compilerOptions": {
+ "target": "esnext",
+ "module": "esnext",
+ "moduleResolution": "node",
+ "strict": true,
+ "jsx": "preserve",
+ "sourceMap": true,
+ "resolveJsonModule": true,
+ "esModuleInterop": true,
+ "lib": [
+ "esnext",
+ "dom"
+ ],
+ "skipLibCheck": true,
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"],
+ },
+ "typeRoots": [
+ "./node_modules/@types"
+ ]
+ },
+ "include": ["./src/**/*.ts", "./src/**/*.vue", "../../common/types/src/interfaces/BrowserProviders.ts", "../../common/types/src/interfaces/EthersProvider.ts", "../../common/types/src/interfaces/MessageInit.ts", "../../common/types/src/interfaces/TransactionInit.ts", "../../common/types/src/interfaces/UserWithProviders.ts"]
+}
\ No newline at end of file
diff --git a/apps/app/tsconfig.node.json b/apps/app/tsconfig.node.json
new file mode 100644
index 000000000..42872c59f
--- /dev/null
+++ b/apps/app/tsconfig.node.json
@@ -0,0 +1,10 @@
+{
+ "compilerOptions": {
+ "composite": true,
+ "skipLibCheck": true,
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "allowSyntheticDefaultImports": true
+ },
+ "include": ["vite.config.ts"]
+}
diff --git a/apps/web/vite.config.ts b/apps/app/vite.config.ts
similarity index 100%
rename from apps/web/vite.config.ts
rename to apps/app/vite.config.ts
diff --git a/apps/landing/README.md b/apps/landing/README.md
deleted file mode 100644
index a5c94c9c2..000000000
--- a/apps/landing/README.md
+++ /dev/null
@@ -1 +0,0 @@
-# Casimir Landing App
diff --git a/apps/web/.eslintrc b/apps/mvp/.eslintrc
similarity index 100%
rename from apps/web/.eslintrc
rename to apps/mvp/.eslintrc
diff --git a/apps/web/.gitignore b/apps/mvp/.gitignore
similarity index 100%
rename from apps/web/.gitignore
rename to apps/mvp/.gitignore
diff --git a/apps/mvp/README.md b/apps/mvp/README.md
new file mode 100644
index 000000000..20fbcb963
--- /dev/null
+++ b/apps/mvp/README.md
@@ -0,0 +1 @@
+# Casimir Web App
diff --git a/apps/web/index.html b/apps/mvp/index.html
similarity index 100%
rename from apps/web/index.html
rename to apps/mvp/index.html
diff --git a/apps/web/package.json b/apps/mvp/package.json
similarity index 97%
rename from apps/web/package.json
rename to apps/mvp/package.json
index 30f684ffa..602b27e98 100644
--- a/apps/web/package.json
+++ b/apps/mvp/package.json
@@ -1,5 +1,5 @@
{
- "name": "@casimir/web",
+ "name": "@casimir/mvp",
"description": "Casimir web app",
"private": true,
"scripts": {
diff --git a/apps/landing/postcss.config.js b/apps/mvp/postcss.config.js
similarity index 100%
rename from apps/landing/postcss.config.js
rename to apps/mvp/postcss.config.js
diff --git a/apps/web/public/Avatar.svg b/apps/mvp/public/Avatar.svg
similarity index 100%
rename from apps/web/public/Avatar.svg
rename to apps/mvp/public/Avatar.svg
diff --git a/apps/web/public/ETH.svg b/apps/mvp/public/ETH.svg
similarity index 100%
rename from apps/web/public/ETH.svg
rename to apps/mvp/public/ETH.svg
diff --git a/apps/web/public/Mastercard.svg b/apps/mvp/public/Mastercard.svg
similarity index 100%
rename from apps/web/public/Mastercard.svg
rename to apps/mvp/public/Mastercard.svg
diff --git a/apps/web/public/Staking-Icon.svg b/apps/mvp/public/Staking-Icon.svg
similarity index 100%
rename from apps/web/public/Staking-Icon.svg
rename to apps/mvp/public/Staking-Icon.svg
diff --git a/apps/web/public/accumulate.svg b/apps/mvp/public/accumulate.svg
similarity index 100%
rename from apps/web/public/accumulate.svg
rename to apps/mvp/public/accumulate.svg
diff --git a/apps/landing/public/casimir.svg b/apps/mvp/public/casimir.svg
similarity index 100%
rename from apps/landing/public/casimir.svg
rename to apps/mvp/public/casimir.svg
diff --git a/apps/web/public/coinbase.svg b/apps/mvp/public/coinbase.svg
similarity index 100%
rename from apps/web/public/coinbase.svg
rename to apps/mvp/public/coinbase.svg
diff --git a/apps/web/public/coinbasewallet.svg b/apps/mvp/public/coinbasewallet.svg
similarity index 100%
rename from apps/web/public/coinbasewallet.svg
rename to apps/mvp/public/coinbasewallet.svg
diff --git a/apps/web/public/cosmos.svg b/apps/mvp/public/cosmos.svg
similarity index 100%
rename from apps/web/public/cosmos.svg
rename to apps/mvp/public/cosmos.svg
diff --git a/apps/web/public/eigen-with-color.png b/apps/mvp/public/eigen-with-color.png
similarity index 100%
rename from apps/web/public/eigen-with-color.png
rename to apps/mvp/public/eigen-with-color.png
diff --git a/apps/web/public/eigen.svg b/apps/mvp/public/eigen.svg
similarity index 100%
rename from apps/web/public/eigen.svg
rename to apps/mvp/public/eigen.svg
diff --git a/apps/landing/public/favicon.ico b/apps/mvp/public/favicon.ico
similarity index 100%
rename from apps/landing/public/favicon.ico
rename to apps/mvp/public/favicon.ico
diff --git a/apps/web/public/iopay.svg b/apps/mvp/public/iopay.svg
similarity index 100%
rename from apps/web/public/iopay.svg
rename to apps/mvp/public/iopay.svg
diff --git a/apps/web/public/keplr.svg b/apps/mvp/public/keplr.svg
similarity index 100%
rename from apps/web/public/keplr.svg
rename to apps/mvp/public/keplr.svg
diff --git a/apps/web/public/ledger.svg b/apps/mvp/public/ledger.svg
similarity index 100%
rename from apps/web/public/ledger.svg
rename to apps/mvp/public/ledger.svg
diff --git a/apps/web/public/livepeer.svg b/apps/mvp/public/livepeer.svg
similarity index 100%
rename from apps/web/public/livepeer.svg
rename to apps/mvp/public/livepeer.svg
diff --git a/apps/web/public/metamask.svg b/apps/mvp/public/metamask.svg
similarity index 100%
rename from apps/web/public/metamask.svg
rename to apps/mvp/public/metamask.svg
diff --git a/apps/web/public/phantom.svg b/apps/mvp/public/phantom.svg
similarity index 100%
rename from apps/web/public/phantom.svg
rename to apps/mvp/public/phantom.svg
diff --git a/apps/web/public/solana.svg b/apps/mvp/public/solana.svg
similarity index 100%
rename from apps/web/public/solana.svg
rename to apps/mvp/public/solana.svg
diff --git a/apps/web/public/staking-icon-black.svg b/apps/mvp/public/staking-icon-black.svg
similarity index 100%
rename from apps/web/public/staking-icon-black.svg
rename to apps/mvp/public/staking-icon-black.svg
diff --git a/apps/web/public/trezor.svg b/apps/mvp/public/trezor.svg
similarity index 100%
rename from apps/web/public/trezor.svg
rename to apps/mvp/public/trezor.svg
diff --git a/apps/web/public/trustwallet.svg b/apps/mvp/public/trustwallet.svg
similarity index 100%
rename from apps/web/public/trustwallet.svg
rename to apps/mvp/public/trustwallet.svg
diff --git a/apps/web/public/walletconnect.svg b/apps/mvp/public/walletconnect.svg
similarity index 100%
rename from apps/web/public/walletconnect.svg
rename to apps/mvp/public/walletconnect.svg
diff --git a/apps/web/src/@types/index.d.ts b/apps/mvp/src/@types/index.d.ts
similarity index 100%
rename from apps/web/src/@types/index.d.ts
rename to apps/mvp/src/@types/index.d.ts
diff --git a/apps/web/src/App.vue b/apps/mvp/src/App.vue
similarity index 100%
rename from apps/web/src/App.vue
rename to apps/mvp/src/App.vue
diff --git a/apps/web/src/components/Carousel.vue b/apps/mvp/src/components/Carousel.vue
similarity index 100%
rename from apps/web/src/components/Carousel.vue
rename to apps/mvp/src/components/Carousel.vue
diff --git a/apps/web/src/components/ConnectWalletsFlow.vue b/apps/mvp/src/components/ConnectWalletsFlow.vue
similarity index 82%
rename from apps/web/src/components/ConnectWalletsFlow.vue
rename to apps/mvp/src/components/ConnectWalletsFlow.vue
index 45e331ddc..827190376 100644
--- a/apps/web/src/components/ConnectWalletsFlow.vue
+++ b/apps/mvp/src/components/ConnectWalletsFlow.vue
@@ -10,10 +10,17 @@ import useLedger from "@/composables/ledger"
import useTrezor from "@/composables/trezor"
import useUser from "@/composables/user"
import useWallets from "@/composables/wallets"
-import useWalletConnect from "@/composables/walletConnectV2"
+import useWalletConnect from "@/composables/walletConnect"
// import useWallets from '@/composables/wallets'
-type UserAuthFlowState = "select_provider" | "select_address" | "loading" | "success" | "add_account" | "confirm_signage_with_existing_secondary" | "connection_failed"
+type UserAuthFlowState =
+ "select_provider"
+ | "select_address"
+ | "loading"
+ | "success"
+ | "add_account"
+ | "confirm_signage_with_existing_secondary"
+ | "connection_failed"
const supportedWalletProviders = [
"MetaMask",
@@ -29,11 +36,11 @@ const { login, loginWithSecondaryAddress } = useAuth()
const { requiredNetwork } = useEnvironment()
const { browserProvidersList, getEthersAddressesWithBalances } = useEthers()
const { convertString, formatEthersCasimir, trimAndLowercaseAddress } = useFormat()
-const { getLedgerAddress } = useLedger()
-const { getTrezorAddress } = useTrezor()
+const { getEthersLedgerAddresses } = useLedger()
+const { getEthersTrezorAddresses } = useTrezor()
const { user } = useUser()
const { detectActiveNetwork, switchEthersNetwork } = useWallets()
-const { connectWalletConnectV2 } = useWalletConnect()
+const { connectWalletConnect, walletConnectSelectedAccount } = useWalletConnect()
// const { installedWallets, detectInstalledWalletProviders } = useWallets()
// eslint-disable-next-line no-undef
@@ -50,7 +57,7 @@ const props = defineProps({
const flowState = ref("select_provider")
const errorMessage = ref(false)
-const errorMassageText = ref("Something went wrong, please try again later.")
+const errorMessageText = ref("Something went wrong, please try again later.")
const walletProviderAddresses = ref([] as CryptoAddress[])
const selectProviderLoading = ref(false)
const selectedProvider = ref(null as ProviderString | null)
@@ -78,7 +85,7 @@ async function handleConfirmCreateAccountWithExistingSecondary() {
} else if (response === "Selected address is not active address in wallet") {
flowState.value = "select_address"
errorMessage.value = true
- errorMassageText.value = "Address selected is not active."
+ errorMessageText.value = "Address selected is not active."
} else if (response === "Error in userAuthState") {
flowState.value = "connection_failed"
setTimeout(() => {
@@ -87,7 +94,7 @@ async function handleConfirmCreateAccountWithExistingSecondary() {
}, 1000)
} else {
errorMessage.value = true
- errorMassageText.value = "Something went wrong, please try again later."
+ errorMessageText.value = "Something went wrong, please try again later."
}
}
@@ -95,10 +102,13 @@ async function handleConfirmCreateAccountWithExistingSecondary() {
* Checks if user is adding an account or logging in
* @param address
*/
-async function selectAddress(address: string, pathIndex: number): Promise {
+async function selectAddress(address: string, pathIndex?: number): Promise {
selectedAddress.value = address
flowState.value = "loading"
- const loginCredentials: LoginCredentials = { provider: selectedProvider.value as ProviderString, address, currency: "ETH", pathIndex }
+ const loginCredentials: LoginCredentials =
+ pathIndex !== undefined ?
+ { provider: selectedProvider.value as ProviderString, address, currency: "ETH", pathIndex } :
+ { provider: selectedProvider.value as ProviderString, address, currency: "ETH" }
const response = await login(loginCredentials)
if (response === "Successfully logged in" || response === "Successfully added account to user") {
flowState.value = "success"
@@ -109,7 +119,7 @@ async function selectAddress(address: string, pathIndex: number): Promise
} else if (response === "Address already exists on this account") {
flowState.value = "select_address"
errorMessage.value = true
- errorMassageText.value = "Address selected is already connected to your account."
+ errorMessageText.value = "Address selected is already connected to your account."
} else if (
response === "Address already exists as a primary address on another account" ||
response === "Address already exists as a secondary address on another account"
@@ -118,7 +128,7 @@ async function selectAddress(address: string, pathIndex: number): Promise
} else if (response === "Selected address is not active address in wallet") {
flowState.value = "select_address"
errorMessage.value = true
- errorMassageText.value = "Address selected is not active."
+ errorMessageText.value = "Address selected is not active."
} else if (response === "Error in userAuthState") {
flowState.value = "connection_failed"
setTimeout(() => {
@@ -127,7 +137,7 @@ async function selectAddress(address: string, pathIndex: number): Promise
}, 1500)
} else {
errorMessage.value = true
- errorMassageText.value = "Something went wrong, please try again later."
+ errorMessageText.value = "Something went wrong, please try again later."
}
}
@@ -136,7 +146,7 @@ async function selectAddress(address: string, pathIndex: number): Promise
* @param provider
* @param currency
*/
-async function selectProvider(provider: ProviderString, currency: Currency = "ETH"): Promise {
+async function selectProvider(provider: ProviderString): Promise {
console.clear()
try {
selectedProvider.value = provider
@@ -144,31 +154,56 @@ async function selectProvider(provider: ProviderString, currency: Currency = "ET
// Hard Goerli Check
// TODO: Make this dynamic
- const activeNetwork = await detectActiveNetwork(selectedProvider.value as ProviderString)
- if (activeNetwork !== 5) {
- await switchEthersNetwork(selectedProvider.value, "0x5")
- return window.location.reload()
+ if (provider !== "WalletConnect") {
+ const activeNetwork = await detectActiveNetwork(selectedProvider.value as ProviderString)
+ if (activeNetwork !== 5) {
+ await switchEthersNetwork(selectedProvider.value, "0x5")
+ return window.location.reload()
+ }
}
if (provider === "WalletConnect") {
// TODO: @@cali1 - pass in the network id dynamically
- walletProviderAddresses.value = await connectWalletConnectV2(requiredNetwork) as CryptoAddress[]
+ walletProviderAddresses.value = await connectWalletConnect(requiredNetwork) as CryptoAddress[]
} else if (browserProvidersList.includes(provider)) {
walletProviderAddresses.value = await getEthersAddressesWithBalances(provider) as CryptoAddress[]
} else if (provider === "Ledger") {
- walletProviderAddresses.value = await getLedgerAddress[currency]() as CryptoAddress[]
+ walletProviderAddresses.value = await getEthersLedgerAddresses() as CryptoAddress[]
} else if (provider === "Trezor") {
- walletProviderAddresses.value = await getTrezorAddress[currency]() as CryptoAddress[]
+ walletProviderAddresses.value = await getEthersTrezorAddresses() as CryptoAddress[]
} else {
throw new Error("Provider not supported")
}
+ errorMessage.value = false
+ errorMessageText.value = ""
selectProviderLoading.value = false
flowState.value = "select_address"
} catch (error: any) {
errorMessage.value = true
- errorMassageText.value = "Something went wrong, please try again later."
- selectProviderLoading.value = false
- throw new Error(`Error selecting provider: ${error.message}`)
+ if (provider === "Ledger") {
+ const { message, name, statusCode } = error
+ if (
+ message === "Ledger device: UNKNOWN_ERROR (0x6511)"
+ && name === "TransportStatusError"
+ && statusCode === 25873
+ ) {
+ errorMessageText.value = "Unlock your Ledger and open Ethereum Goerli app."
+ selectProviderLoading.value = false
+ }
+ } else if (provider === "Trezor") {
+ if (error.message.includes("Trezor Suite is not open")) {
+ errorMessageText.value = "Open your Trezor Suite desktop app."
+ selectProviderLoading.value = false
+ } else {
+ console.log("Error in selectProvider :>> ", error)
+ errorMessageText.value = "Something went wrong with your Trezor connection, please try again later."
+ selectProviderLoading.value = false
+ }
+ } else {
+ console.log("error in selectProvider in ConnectWalletsFlow.vue :>> ", error)
+ errorMessageText.value = "Something went wrong, please try again later."
+ selectProviderLoading.value = false
+ }
}
}
@@ -191,6 +226,12 @@ onUnmounted(() => {
flowState.value = "select_provider"
}
})
+
+watch(walletConnectSelectedAccount, () => {
+ if (selectedProvider.value === "WalletConnect") {
+ walletProviderAddresses.value = walletConnectSelectedAccount.value as CryptoAddress[]
+ }
+})
@@ -230,7 +271,7 @@ onUnmounted(() => {