From b2e498266719f8a3c27f870637db56c863e5fb86 Mon Sep 17 00:00:00 2001 From: JamesDev292 Date: Fri, 19 Sep 2025 14:00:41 +0200 Subject: [PATCH 01/15] Revise README with project details and instructions Updated README to include detailed project information, configuration, installation instructions, and guidelines for adding tokens. --- README.md | 271 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 270 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 69cee5ae9..d716255f4 100644 --- a/README.md +++ b/README.md @@ -1 +1,270 @@ -# TrustSwap \ No newline at end of file +# TrustSwap (Uniswap V2 fork) + +Uniswap V2–style DEX with **native tTRUST** + **wrapped WTTRUST**, Router V2, StakingRewards, and a Vite + React + wagmi + viem frontend. + +- Native coin: `tTRUST` (gas) + +- Wrapped ERC-20: `WTTRUST` (used in pairs) + +- Rewards token: `TSWP` + + +> ⚠️ **No `.env` files** in the frontend anymore. All config lives in plain TypeScript. + +---------- + +## Monorepo layout + +``` +. +├─ contracts/ # Hardhat (core V2, router, scripts) +└─ front/ # Vite + React + wagmi + viem + +``` + +---------- + +## Configuration (no `.env`) + +All frontend config lives in `front/src/config/protocol.ts`. + +```ts +// front/src/config/protocol.ts +import type { Address } from 'viem' + +export const RPC_URL = 'https://testnet.rpc.intuition.systems/http' +export const CHAIN_ID = 13579 + +export const FACTORY_ADDRESS = '0xd103E057242881214793d5A1A7c2A5B84731c75c' as Address +export const ROUTER_ADDRESS = '0xA90f2DC77650941a53F5e4f2F345D84f5c0dc2dd' as Address +export const WNATIVE_ADDRESS = '0xc82d6A5e0Da8Ce7B37330C4D44E9f069269546E6' as Address +export const TSWP_ADDRESS = '0x7da120065e104C085fAc6f800d257a6296549cF3' as Address + +export const NATIVE_SYMBOL = 'tTRUST' +export const WRAPPED_SYMBOL = 'WTTRUST' +export const SHOW_WRAPPED_SYMBOL = false + +// Gas (optional) +export const FORCE_LEGACY_GAS = true +export const GAS_PRICE_GWEI = 0.2 +export const GAS_LIMIT = 1_200_000n +export const GAS_LIMIT_CREATE_PAIR = 3_000_000n + +// Hide token addresses in UI (e.g., old tests) +export const HIDE_TOKENS: Address[] = [ + // '0xDeadBeef...', +] + +``` + +> If you redeploy Factory/Router/WNATIVE/TSWP, update addresses here. +> The frontend no longer reads `import.meta.env.*`. + +---------- + +## Install & run + +### Prereqs + +- Node 18+ (or 20+) + +- pnpm 8+ + + +### Install deps + +```bash +pnpm i -w + +``` + +### Run frontend (dev) + +```bash +cd front +pnpm dev + +``` + +### Build contracts + +```bash +cd contracts +pnpm compile + +``` + +> Hardhat scripts (deploy, feeTo toggle, etc.) live in `contracts/scripts/*`. + +---------- + +## Add a token via Pull Request (PR) + +We accept token additions via PR if they meet simple safety/compat criteria. +Listing a token is just adding an entry to `front/src/tokens/intuit.ts`. + +### 1) Fork & branch + +```bash +git checkout -b feat/list- + +``` + +### 2) Edit `front/src/tokens/intuit.ts` + +```ts +import type { Address } from 'viem' +import { WNATIVE_ADDRESS, TSWP_ADDRESS } from '../config/protocol' + +export type Currency = { + symbol: string + name: string + decimals: number + isNative?: boolean + address?: Address + wrapped?: Address + logoURI?: string +} + +export const TOKENS: Currency[] = [ + { + symbol: 'tTRUST', + name: 'Intuition Native', + decimals: 18, + isNative: true, + wrapped: WNATIVE_ADDRESS, + logoURI: '', + }, + { + symbol: 'WTTRUST', + name: 'Wrapped tTRUST', + decimals: 18, + address: WNATIVE_ADDRESS, + logoURI: '', + }, + { + symbol: 'TSWP', + name: 'TrustSwap Token', + decimals: 18, + address: TSWP_ADDRESS, + logoURI: '', + }, + + // 👉 Add your token here: + { + symbol: 'MYT', + name: 'MyToken', + decimals: 18, + address: '0xYourErc20AddressHere' as Address, + logoURI: 'https://…/mytoken.png', // optional + }, +] + +``` + +**Rules:** + +- Use a **checksummed** address (EIP-55). + +- **Correct `decimals`** (verify on-chain). + +- Short `symbol` (≤ 10 chars), clear `name`. + +- `logoURI` optional (HTTPS). You can also submit a logo to `front/public/logos/` and reference it. + + +### 3) ⚠️ Important: Listing in UI does **not** create liquidity + +Adding a token to `TOKENS` only makes it **selectable** in the app. +To **swap** this token with another, there **must be a Uniswap V2 pair with liquidity**. + +- If a **direct pair** exists (e.g., `MYT/WTTRUST`) **and has liquidity**, swaps will work. + +- If not, you must **create the pair and seed liquidity**: + + 1. Go to **Add Liquidity** in the app (or call Factory + Router directly). + + 2. Select your token and the counter-token (e.g., `WTTRUST`). + + 3. Provide both assets at the current price ratio and **Supply**. + + 4. Once liquidity exists, quotes (`getAmountsOut`) and swaps will work. + +- You can also allow routing via a common intermediate (e.g., `MYT → WTTRUST → TSWP`) by ensuring those pairs have liquidity. + + +### 4) Local checks + +```bash +pnpm -w -C front typecheck +pnpm -w -C front build + +``` + +### 5) Open the PR + +Include: + +- Contract address (explorer link) + +- `decimals`, `symbol`, `name` + +- If possible: verified contract on explorer, and notes about special behaviors (fee-on-transfer, blacklist, pausable, etc.) + + +### 6) Review criteria (summary) + +We approve if: + +- ERC-20 standard (at least `decimals`, `symbol`, `balanceOf`, `allowance`, `transferFrom`). + +- No obvious malicious patterns (honeypot, arbitrary blacklists, unlimited mint without governance, etc.). + +- No known incompatibilities with Uniswap V2 (fee-on-transfer tokens may need “SupportingFeeOnTransfer” swap routes; listing is still fine). + + +---------- + +## UI notes + +- **TokenSelector** also supports **import by address** (stored in localStorage). + Tokens in `intuit.ts` are “referenced” and shown by default. + +- **PoolsList** auto-discovers pairs from the **Factory**. + Use `HIDE_TOKENS` in `config/protocol.ts` to hide old test pairs by token address. + + +---------- + +## Admin (protocol fees) + +- Uniswap V2 “protocol fees” (LP fee mint 0.05% when `feeTo` is set) are controlled on **Factory** by **`feeToSetter`**: + + - `feeToSetter` may call `factory.setFeeTo()` (enable) or `factory.setFeeTo(0x0)` (disable). + + - Scripts: `contracts/scripts/20_set_fee_to.ts` & `21_unset_fee_to.ts`. + + +---------- + +## Deployments + +Active deployment addresses are centralized in `front/src/config/protocol.ts`. +Update them there if you redeploy Factory/Router/WNATIVE/TSWP. + +---------- + +## Troubleshooting + +- **No quote (getAmountsOut revert)**: pair missing / zero liquidity / wrong path. Check `Factory.getPair()` and addresses. + +- **“Invalid opcode” on `readContract`**: ensure the address is an **ERC-20 contract**, not an EOA or unrelated contract. + +- **Swap blocked by “approve first”**: approve the input token with the **Approve** button. + + +---------- + +## License + +MIT (or your preferred license). From 21f9f9952535763a65597041a2e547a104db2be2 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 19 Sep 2025 14:11:47 +0200 Subject: [PATCH 02/15] add deploy --- .github/deploy.yml | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/deploy.yml diff --git a/.github/deploy.yml b/.github/deploy.yml new file mode 100644 index 000000000..11da9e1b7 --- /dev/null +++ b/.github/deploy.yml @@ -0,0 +1,72 @@ +name: Deploy Dapp to GitHub Pages + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + env: + CI: true + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' # no built-in cache here + + - name: Enable Corepack & pnpm + run: | + corepack enable + corepack prepare pnpm@9 --activate + pnpm --version + pnpm config set store-dir ~/.pnpm-store + + - name: Cache pnpm store + uses: actions/cache@v4 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('apps/web/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Setup Pages + uses: actions/configure-pages@v4 + + - name: Install dependencies + working-directory: apps/web + run: pnpm install --frozen-lockfile + + - name: Build with Vite + working-directory: apps/web + run: pnpm run build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: apps/web/dist + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file From 327ceea19a149e25e9977def9dde1fe1a608b5e4 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 19 Sep 2025 14:30:24 +0200 Subject: [PATCH 03/15] folder workflows --- .github/{ => workflows}/deploy.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => workflows}/deploy.yml (100%) diff --git a/.github/deploy.yml b/.github/workflows/deploy.yml similarity index 100% rename from .github/deploy.yml rename to .github/workflows/deploy.yml From 0deb1ff93c93e21212e9e610c0f3f15e3682d416 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 19 Sep 2025 14:36:40 +0200 Subject: [PATCH 04/15] files deploy error --- .github/workflows/deploy.yml | 21 +++++++++++++-------- apps/web/package.json | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 11da9e1b7..d2162737b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,7 +27,8 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' # no built-in cache here + node-version: '20' + cache: 'pnpm' - name: Enable Corepack & pnpm run: | @@ -40,20 +41,24 @@ jobs: uses: actions/cache@v4 with: path: ~/.pnpm-store - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('apps/web/pnpm-lock.yaml') }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - name: Setup Pages uses: actions/configure-pages@v4 - - name: Install dependencies - working-directory: apps/web + # IMPORTANT: install at repo root so workspace links are created + - name: Install workspace deps run: pnpm install --frozen-lockfile - - name: Build with Vite - working-directory: apps/web - run: pnpm run build + # Build local SDK first so apps/web can import @trustswap/sdk + - name: Build SDK + run: pnpm -w --filter "@trustswap/sdk" build + + # Build the web app + - name: Build web (Vite) + run: pnpm -w --filter "./apps/web" run build - name: Upload artifact uses: actions/upload-pages-artifact@v3 @@ -69,4 +74,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file + uses: actions/deploy-pages@v4 diff --git a/apps/web/package.json b/apps/web/package.json index 83290f8c8..87d941ad2 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -6,6 +6,7 @@ "scripts": { "dev": "vite", "build": "tsc -b && vite build", + "typecheck": "tsc -b", "lint": "eslint .", "preview": "vite preview" }, From 15e805e40e9f030e011345ed954713e873df0f1f Mon Sep 17 00:00:00 2001 From: James Date: Fri, 19 Sep 2025 14:39:08 +0200 Subject: [PATCH 05/15] files deploy error --- .github/workflows/deploy.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d2162737b..87266ebd5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -18,8 +18,6 @@ concurrency: jobs: build: runs-on: ubuntu-latest - env: - CI: true steps: - name: Checkout uses: actions/checkout@v4 @@ -27,15 +25,17 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: 20 cache: 'pnpm' - - name: Enable Corepack & pnpm + - name: Enable Corepack (for pnpm) run: | corepack enable corepack prepare pnpm@9 --activate pnpm --version - pnpm config set store-dir ~/.pnpm-store + + - name: Install deps (root, workspace) + run: pnpm install --frozen-lockfile - name: Cache pnpm store uses: actions/cache@v4 From 40307829619dca1eddb92698e082e3438a7985d6 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 19 Sep 2025 14:41:13 +0200 Subject: [PATCH 06/15] files deploy error --- .github/workflows/deploy.yml | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 87266ebd5..061846abe 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -18,6 +18,8 @@ concurrency: jobs: build: runs-on: ubuntu-latest + env: + CI: true steps: - name: Checkout uses: actions/checkout@v4 @@ -28,36 +30,30 @@ jobs: node-version: 20 cache: 'pnpm' - - name: Enable Corepack (for pnpm) - run: | - corepack enable - corepack prepare pnpm@9 --activate - pnpm --version - - - name: Install deps (root, workspace) - run: pnpm install --frozen-lockfile - - - name: Cache pnpm store - uses: actions/cache@v4 + - name: Install pnpm + uses: pnpm/action-setup@v4 with: - path: ~/.pnpm-store - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + version: 9 + run_install: false + + - name: Show versions + run: | + node -v + pnpm -v - name: Setup Pages uses: actions/configure-pages@v4 - # IMPORTANT: install at repo root so workspace links are created - - name: Install workspace deps + # Install deps at repo root so workspace links are created + - name: Install deps (workspace) run: pnpm install --frozen-lockfile - # Build local SDK first so apps/web can import @trustswap/sdk + # Build local SDK first so apps/web can import it - name: Build SDK run: pnpm -w --filter "@trustswap/sdk" build - # Build the web app - - name: Build web (Vite) + # Build the web app (vite) + - name: Build web run: pnpm -w --filter "./apps/web" run build - name: Upload artifact From 76b4821bc80ce8a53174da41bdd74bc8bb3ec8bb Mon Sep 17 00:00:00 2001 From: James Date: Fri, 19 Sep 2025 14:44:37 +0200 Subject: [PATCH 07/15] files deploy error --- .github/workflows/deploy.yml | 44 +++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 061846abe..75db52096 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,34 +27,42 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: '20' cache: 'pnpm' - - name: Install pnpm - uses: pnpm/action-setup@v4 + - name: Enable Corepack & pnpm + run: | + corepack enable + corepack prepare pnpm@9 --activate + pnpm --version + pnpm config set store-dir ~/.pnpm-store + + - name: Cache pnpm store + uses: actions/cache@v4 with: - version: 9 - run_install: false + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('apps/web/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- - - name: Show versions - run: | - node -v - pnpm -v + - name: Cache pnpm store + uses: actions/cache@v4 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('packages/sdk/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- - name: Setup Pages uses: actions/configure-pages@v4 - # Install deps at repo root so workspace links are created - - name: Install deps (workspace) + - name: Install dependencies + working-directory: apps/web run: pnpm install --frozen-lockfile - # Build local SDK first so apps/web can import it - - name: Build SDK - run: pnpm -w --filter "@trustswap/sdk" build - - # Build the web app (vite) - - name: Build web - run: pnpm -w --filter "./apps/web" run build + - name: Build with Vite + working-directory: apps/web + run: pnpm run build - name: Upload artifact uses: actions/upload-pages-artifact@v3 From 540bd542c6bbc9a85f1b562054c2dbc494475424 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 19 Sep 2025 14:51:09 +0200 Subject: [PATCH 08/15] files deploy error --- .github/workflows/deploy.yml | 47 +++++++++++++++++++----------------- apps/web/package.json | 2 +- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 75db52096..b0966428f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,42 +27,45 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: 20 cache: 'pnpm' - - name: Enable Corepack & pnpm - run: | - corepack enable - corepack prepare pnpm@9 --activate - pnpm --version - pnpm config set store-dir ~/.pnpm-store - - - name: Cache pnpm store - uses: actions/cache@v4 + # Install pnpm (no Corepack required) + - name: Install pnpm + uses: pnpm/action-setup@v4 with: - path: ~/.pnpm-store - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('apps/web/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + version: 9 + run_install: false + + - name: Show versions + run: | + node -v + pnpm -v - name: Cache pnpm store uses: actions/cache@v4 with: path: ~/.pnpm-store - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('packages/sdk/pnpm-lock.yaml') }} + key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} restore-keys: | - ${{ runner.os }}-pnpm-store- + ${{ runner.os }}-pnpm- - name: Setup Pages uses: actions/configure-pages@v4 - - name: Install dependencies - working-directory: apps/web - run: pnpm install --frozen-lockfile + # Install deps at workspace root so pnpm links packages/* and apps/* + - name: Install dependencies (workspace) + run: | + pnpm config set store-dir ~/.pnpm-store + pnpm install --frozen-lockfile + + # Build SDK first so it's available for web + - name: Build SDK + run: pnpm -w --filter "@trustswap/sdk" build - - name: Build with Vite - working-directory: apps/web - run: pnpm run build + # Build the web app (vite) + - name: Build web + run: pnpm -w --filter "./apps/web" run build - name: Upload artifact uses: actions/upload-pages-artifact@v3 diff --git a/apps/web/package.json b/apps/web/package.json index 87d941ad2..d61001e18 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "tsc -b && vite build", + "build": "vite build", "typecheck": "tsc -b", "lint": "eslint .", "preview": "vite preview" From cc288eea90f7b2c5de088285fa1a167de5c91a6f Mon Sep 17 00:00:00 2001 From: James Date: Fri, 19 Sep 2025 14:53:10 +0200 Subject: [PATCH 09/15] files deploy error --- .github/workflows/deploy.yml | 42 +++++++++++++----------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b0966428f..11da9e1b7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,45 +27,33 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 - cache: 'pnpm' + node-version: '20' # no built-in cache here - # Install pnpm (no Corepack required) - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: 9 - run_install: false - - - name: Show versions + - name: Enable Corepack & pnpm run: | - node -v - pnpm -v + corepack enable + corepack prepare pnpm@9 --activate + pnpm --version + pnpm config set store-dir ~/.pnpm-store - name: Cache pnpm store uses: actions/cache@v4 with: path: ~/.pnpm-store - key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('apps/web/pnpm-lock.yaml') }} restore-keys: | - ${{ runner.os }}-pnpm- + ${{ runner.os }}-pnpm-store- - name: Setup Pages uses: actions/configure-pages@v4 - # Install deps at workspace root so pnpm links packages/* and apps/* - - name: Install dependencies (workspace) - run: | - pnpm config set store-dir ~/.pnpm-store - pnpm install --frozen-lockfile - - # Build SDK first so it's available for web - - name: Build SDK - run: pnpm -w --filter "@trustswap/sdk" build + - name: Install dependencies + working-directory: apps/web + run: pnpm install --frozen-lockfile - # Build the web app (vite) - - name: Build web - run: pnpm -w --filter "./apps/web" run build + - name: Build with Vite + working-directory: apps/web + run: pnpm run build - name: Upload artifact uses: actions/upload-pages-artifact@v3 @@ -81,4 +69,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@v4 \ No newline at end of file From aac6b0b0d874607f14af21c66717cb45569be754 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 19 Sep 2025 14:57:49 +0200 Subject: [PATCH 10/15] files deploy error --- .github/workflows/deploy.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 11da9e1b7..f297d43cf 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,7 +27,8 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' # no built-in cache here + node-version: '20' # keep your choice + cache: 'pnpm' # enable built-in pnpm cache - name: Enable Corepack & pnpm run: | @@ -40,20 +41,24 @@ jobs: uses: actions/cache@v4 with: path: ~/.pnpm-store - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('apps/web/pnpm-lock.yaml') }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - name: Setup Pages uses: actions/configure-pages@v4 - - name: Install dependencies - working-directory: apps/web + # ⬇️ INSTALL AU ROOT (workspace), PAS dans apps/web + - name: Install dependencies (workspace root) run: pnpm install --frozen-lockfile - - name: Build with Vite - working-directory: apps/web - run: pnpm run build + # ⬇️ BUILDER LE SDK AVANT LE WEB + - name: Build SDK + run: pnpm -w --filter "@trustswap/sdk" run build + + # ⬇️ BUILDER L’APP WEB + - name: Build with Vite (web) + run: pnpm -w --filter "./apps/web" run build - name: Upload artifact uses: actions/upload-pages-artifact@v3 @@ -69,4 +74,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file + uses: actions/deploy-pages@v4 From 87029a6b5daef5414a2bfa6aa08d6255d3ca4337 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 19 Sep 2025 14:59:07 +0200 Subject: [PATCH 11/15] files deploy error --- .github/workflows/deploy.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f297d43cf..f0041cb2d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -28,7 +28,6 @@ jobs: uses: actions/setup-node@v4 with: node-version: '20' # keep your choice - cache: 'pnpm' # enable built-in pnpm cache - name: Enable Corepack & pnpm run: | @@ -48,15 +47,12 @@ jobs: - name: Setup Pages uses: actions/configure-pages@v4 - # ⬇️ INSTALL AU ROOT (workspace), PAS dans apps/web - name: Install dependencies (workspace root) run: pnpm install --frozen-lockfile - # ⬇️ BUILDER LE SDK AVANT LE WEB - name: Build SDK run: pnpm -w --filter "@trustswap/sdk" run build - # ⬇️ BUILDER L’APP WEB - name: Build with Vite (web) run: pnpm -w --filter "./apps/web" run build From 2b3f128716401b9dfa0ffdce626bc312aa3e3328 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 19 Sep 2025 15:23:08 +0200 Subject: [PATCH 12/15] files deploy error --- .github/workflows/deploy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f0041cb2d..b5b60fd2f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -20,6 +20,9 @@ jobs: runs-on: ubuntu-latest env: CI: true + VITE_DYNAMIC_ENV_ID: ${{ secrets.DYNAMIC_ENV_ID }} + VITE_RPC_URL: ${{ secrets.RPC_URL }} + VITE_CHAIN_ID: ${{ secrets.CHAIN_ID }} steps: - name: Checkout uses: actions/checkout@v4 From f2039c42fdb5b6edf9b9916269a6e17f9fc66fb0 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 19 Sep 2025 15:32:01 +0200 Subject: [PATCH 13/15] files deploy error --- apps/web/vite.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index a2c35bfd3..cae473542 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -4,6 +4,7 @@ import path from "path"; // https://vite.dev/config/ export default defineConfig({ + base: '/TrustSwap-Hackaton/', plugins: [react()], resolve: { alias: { From 7e5f53c7ee80e0f985abb838910cfe8858249c3b Mon Sep 17 00:00:00 2001 From: James Date: Fri, 19 Sep 2025 15:38:02 +0200 Subject: [PATCH 14/15] files deploy error --- .github/workflows/deploy.yml | 3 --- apps/web/vite.config.ts | 1 - 2 files changed, 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b5b60fd2f..f0041cb2d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -20,9 +20,6 @@ jobs: runs-on: ubuntu-latest env: CI: true - VITE_DYNAMIC_ENV_ID: ${{ secrets.DYNAMIC_ENV_ID }} - VITE_RPC_URL: ${{ secrets.RPC_URL }} - VITE_CHAIN_ID: ${{ secrets.CHAIN_ID }} steps: - name: Checkout uses: actions/checkout@v4 diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index cae473542..a2c35bfd3 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -4,7 +4,6 @@ import path from "path"; // https://vite.dev/config/ export default defineConfig({ - base: '/TrustSwap-Hackaton/', plugins: [react()], resolve: { alias: { From 70d99ec8cb185e09735a06b991be1b84d5a2785a Mon Sep 17 00:00:00 2001 From: James Date: Fri, 19 Sep 2025 15:46:23 +0200 Subject: [PATCH 15/15] files deploy error --- apps/web/src/lib/dynamic.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/web/src/lib/dynamic.tsx b/apps/web/src/lib/dynamic.tsx index 076aed7ec..b424a5154 100644 --- a/apps/web/src/lib/dynamic.tsx +++ b/apps/web/src/lib/dynamic.tsx @@ -20,25 +20,31 @@ function toDynamicEvmNetwork() { rpcUrls: INTUITION.rpcUrls.default.http.slice(), blockExplorerUrls: [INTUITION.blockExplorers?.default?.url].filter(Boolean) as string[], nativeCurrency: INTUITION.nativeCurrency, - testnet: true, - iconUrls: [], + testnet: true, + iconUrls: [], } } export function RootProviders({ children }: PropsWithChildren) { + // Prefer env var, fallback to hard-coded id + const envId = (import.meta.env.VITE_DYNAMIC_ENV_ID as string | undefined) ?? "78601171-b1f9-42d1-b651-b76f97becab7" + + if (!envId) { + console.error("Missing Dynamic environmentId") + return
Wallet connect disabled: missing Dynamic environmentId.
+ } + return ( - - {children} - + {children}