From 0262c9054bfb5331e93f011a1e32aeb3c9d14efe Mon Sep 17 00:00:00 2001 From: GianMarco Date: Tue, 13 Aug 2024 23:25:10 +0700 Subject: [PATCH] Update ch-base (#105) Co-authored-by: Nadai <112663528+Nadai2010@users.noreply.github.com> --- .github/workflows/deploy.yml | 27 ----------- .github/workflows/{lint.yml => main.yml} | 20 +++++++- .github/workflows/test_contract.yml | 29 ----------- README.md | 4 +- package.json | 2 +- .../contract/ReadOnlyFunctionForm.tsx | 8 ++-- packages/nextjs/app/debug/page.tsx | 10 ---- packages/nextjs/app/page.tsx | 1 + packages/nextjs/components/Footer.tsx | 27 +---------- packages/nextjs/components/Header.tsx | 2 +- packages/nextjs/components/SwitchTheme.tsx | 7 --- .../AddressInfoDropdown.tsx | 1 - .../CustomConnectButton/index.tsx | 2 +- .../scaffold-stark/useScaffoldReadContract.ts | 10 ++-- .../nextjs/public/challenge-icon-starknet.svg | 48 ------------------- 15 files changed, 33 insertions(+), 165 deletions(-) delete mode 100644 .github/workflows/deploy.yml rename .github/workflows/{lint.yml => main.yml} (59%) delete mode 100644 .github/workflows/test_contract.yml delete mode 100644 packages/nextjs/public/challenge-icon-starknet.svg diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 82c37397..00000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Build and Deploy to Droplet - -on: - push: - branches: - - main - -jobs: - deploy: - runs-on: ubuntu-latest - - steps: - - name: Build and deploy app on server - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.DROPLET_IP }} - username: ${{ secrets.DROPLET_USER }} - key: ${{ secrets.SSH_PRIVATE_KEY }} - script: | - cd /var/www/speedrunstark - git pull origin main - pm2 stop speedrunstark - yarn install - cd packages/nextjs - yarn build - pm2 restart speedrunstark - pm2 save \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/main.yml similarity index 59% rename from .github/workflows/lint.yml rename to .github/workflows/main.yml index 7c61cee6..a12d3537 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/main.yml @@ -3,12 +3,14 @@ name: Next.js CI on: push: paths: + - "packages/snfoundry/contracts/**" - "packages/nextjs/**" pull_request: branches: - main paths: - "packages/nextjs/**" + - "packages/snfoundry/contracts/**" jobs: ci: @@ -23,6 +25,19 @@ jobs: - name: Checkout uses: actions/checkout@master + - name: Install scarb + run: curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 2.6.5 + + - name: Install snfoundryup + run: curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh + + - name: Install snforge + run: snfoundryup -v 0.27.0 + + - name: Run snforge tests + run: snforge test + working-directory: ./packages/snfoundry/contracts + - name: Setup node env uses: actions/setup-node@v3 with: @@ -34,6 +49,9 @@ jobs: run: yarn install --immutable working-directory: ./packages/nextjs + - name: Check Code Format + run: yarn format:check + - name: Run Next.js lint run: yarn next:lint --max-warnings=0 working-directory: ./packages/nextjs @@ -44,4 +62,4 @@ jobs: - name: Build Next.js project run: yarn build - working-directory: ./packages/nextjs \ No newline at end of file + working-directory: ./packages/nextjs diff --git a/.github/workflows/test_contract.yml b/.github/workflows/test_contract.yml deleted file mode 100644 index 3424b5ed..00000000 --- a/.github/workflows/test_contract.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Next.js CI - -on: - push: - paths: - - "packages/snfoundry/contracts/**" - pull_request: - paths: - - "packages/snfoundry/contracts/**" - -jobs: - snfoundry: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@master - - - name: Install scarb - run: curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 2.6.5 - - - name: Install snfoundryup - run: curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh - - - name: Install snforge - run: snfoundryup -v 0.27.0 - - - name: Run snforge tests - run: snforge test - working-directory: ./packages/snfoundry/contracts diff --git a/README.md b/README.md index 99e34b4b..6b922f29 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ cd yarn start ``` -๐Ÿ“ฑ Open http://localhost:3000 to see the app. +๐Ÿ“ฑ Open to see the app. > ๐Ÿ‘ฉโ€๐Ÿ’ป Rerun `yarn deploy --reset` whenever you want to deploy new contracts to the frontend, update your current contracts with changes, or re-deploy it to get a fresh contract address. @@ -70,4 +70,4 @@ _To finish your README, can add these links_ > ๐Ÿƒ Head to your next challenge [here](https://speedrunstark.com/). -> ๐Ÿ’ฌ Problems, questions, comments on the stack? Post them to the [๐Ÿ— Scaffold-Stark developers chat](https://t.me/+wO3PtlRAreo4MDI9) \ No newline at end of file +> ๐Ÿ’ฌ Problems, questions, comments on the stack? Post them to the [๐Ÿ— Scaffold-Stark developers chat](https://t.me/+wO3PtlRAreo4MDI9) diff --git a/package.json b/package.json index bfc7b50a..c0b68886 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ss-2", - "version": "0.2.6", + "version": "0.2.10", "author": "Q3 Labs", "license": "MIT", "private": true, diff --git a/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx b/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx index c2c013f5..3990bdc6 100644 --- a/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx +++ b/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState, useRef, useEffect } from "react"; +import { useState, useRef, useEffect, useCallback } from "react"; import { Abi } from "abi-wan-kanabi"; import { Address } from "@starknet-react/chains"; import { @@ -38,7 +38,7 @@ export const ReadOnlyFunctionForm = ({ functionName: abiFunction.name, abi: [...abi], args: inputValue ? inputValue.flat(Infinity) : [], - enabled: false, + enabled: Boolean(inputValue), parseArgs: false, blockIdentifier: "pending" as BlockNumber, }); @@ -59,14 +59,14 @@ export const ReadOnlyFunctionForm = ({ ); }); - const handleRead = () => { + const handleRead = useCallback(() => { const newInputValue = getParsedContractFunctionArgs(form, false); if (JSON.stringify(form) !== JSON.stringify(lastForm.current)) { setInputValue(newInputValue); lastForm.current = form; } refetch(); - }; + }, [form, refetch]); return (
diff --git a/packages/nextjs/app/debug/page.tsx b/packages/nextjs/app/debug/page.tsx index 8e24da57..eb2beb58 100644 --- a/packages/nextjs/app/debug/page.tsx +++ b/packages/nextjs/app/debug/page.tsx @@ -12,16 +12,6 @@ const Debug: NextPage = () => { return ( <> - {/*
-

Debug Contracts

-

- You can debug & interact with your deployed contracts here. -
Check{" "} - - packages / nextjs / app / debug / page.tsx - {" "} -

-
*/} ); }; diff --git a/packages/nextjs/app/page.tsx b/packages/nextjs/app/page.tsx index 477e4111..14a6f002 100644 --- a/packages/nextjs/app/page.tsx +++ b/packages/nextjs/app/page.tsx @@ -5,6 +5,7 @@ import { useAccount } from "@starknet-react/core"; const Home: NextPage = () => { const connectedAddress = useAccount(); + return ( <>
diff --git a/packages/nextjs/components/Footer.tsx b/packages/nextjs/components/Footer.tsx index 2b1d5990..a4b95b6d 100644 --- a/packages/nextjs/components/Footer.tsx +++ b/packages/nextjs/components/Footer.tsx @@ -66,32 +66,7 @@ export const Footer = () => { Fork me
- ยท - {/*
-

- Built with by -

- - - Q3 Labs - -

at

- - - BuidlGuidl - -
- ยท */} +
diff --git a/packages/nextjs/components/SwitchTheme.tsx b/packages/nextjs/components/SwitchTheme.tsx index ff2c993c..1e080ea3 100644 --- a/packages/nextjs/components/SwitchTheme.tsx +++ b/packages/nextjs/components/SwitchTheme.tsx @@ -28,13 +28,6 @@ export const SwitchTheme = ({ className }: { className?: string }) => {
- {/* */} {