Skip to content

Commit

Permalink
Update ch-base (#105)
Browse files Browse the repository at this point in the history
Co-authored-by: Nadai <[email protected]>
  • Loading branch information
gianalarcon and Nadai2010 authored Aug 13, 2024
1 parent 3fd17ef commit 0262c90
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 165 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/deploy.yml

This file was deleted.

20 changes: 19 additions & 1 deletion .github/workflows/lint.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -44,4 +62,4 @@ jobs:

- name: Build Next.js project
run: yarn build
working-directory: ./packages/nextjs
working-directory: ./packages/nextjs
29 changes: 0 additions & 29 deletions .github/workflows/test_contract.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ cd <challenge_folder_name>
yarn start
```

📱 Open http://localhost:3000 to see the app.
📱 Open <http://localhost:3000> 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.
Expand All @@ -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)
> 💬 Problems, questions, comments on the stack? Post them to the [🏗 Scaffold-Stark developers chat](https://t.me/+wO3PtlRAreo4MDI9)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ss-2",
"version": "0.2.6",
"version": "0.2.10",
"author": "Q3 Labs",
"license": "MIT",
"private": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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,
});
Expand All @@ -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 (
<div className="flex flex-col gap-3 py-5 first:pt-0 last:pb-1">
Expand Down
10 changes: 0 additions & 10 deletions packages/nextjs/app/debug/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ const Debug: NextPage = () => {
return (
<>
<DebugContracts />
{/* <div className="text-center mt-8 bg-secondary p-10">
<h1 className="text-4xl my-0">Debug Contracts</h1>
<p className="text-neutral">
You can debug & interact with your deployed contracts here.
<br /> Check{" "}
<code className="italic bg-base-300 text-base font-bold [word-spacing:-0.5rem] px-1">
packages / nextjs / app / debug / page.tsx
</code>{" "}
</p>
</div> */}
</>
);
};
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useAccount } from "@starknet-react/core";

const Home: NextPage = () => {
const connectedAddress = useAccount();

return (
<>
<div className="flex items-center flex-col flex-grow pt-10">
Expand Down
27 changes: 1 addition & 26 deletions packages/nextjs/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,32 +66,7 @@ export const Footer = () => {
Fork me
</a>
</div>
<span>·</span>
{/* <div className="flex justify-center items-center gap-2">
<p className="m-0 text-center">
Built with <HeartIcon className="inline-block h-4 w-4" /> by
</p>
<a
className="flex justify-center items-center gap-1"
href="https://quantum3labs.com/"
target="_blank"
rel="noreferrer"
>
<BuidlGuidlLogo className="w-3 h-5 pb-1" />
<span className="link">Q3 Labs</span>
</a>
<p className="m-0 text-center">at</p>
<a
className="flex justify-center items-center gap-1"
href="https://buidlguidl.com/"
target="_blank"
rel="noreferrer"
>
<BuidlGuidlLogo className="w-3 h-5 pb-1" />
<span className="link">BuidlGuidl</span>
</a>
</div>
<span>·</span> */}

<div className="text-center">
<a
href="https://t.me/+wO3PtlRAreo4MDI9"
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const Header = () => {
alt="SE2 logo"
className="cursor-pointer"
fill
src="/challenge-icon-starknet.svg"
src="/logo.svg"
/>
</div>
<div className="flex flex-col">
Expand Down
7 changes: 0 additions & 7 deletions packages/nextjs/components/SwitchTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ export const SwitchTheme = ({ className }: { className?: string }) => {
<div
className={`flex space-x-2 h-5 items-center justify-center text-sm border-l border-neutral px-4 ${className}`}
>
{/* <input
id="theme-toggle"
type="checkbox"
className="toggle toggle-primary bg-primary hover:bg-primary border-primary"
onChange={handleToggle}
checked={isDarkMode}
/> */}
{
<label
htmlFor="theme-toggle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { useDisconnect, useNetwork, useConnect } from "@starknet-react/core";
import { getStarknetPFPIfExists } from "~~/utils/profile";
import useConditionalStarkProfile from "~~/hooks/useConditionalStarkProfile";
import { useTheme } from "next-themes";
import { useEffect } from "react";

const allowedNetworks = getTargetNetworks();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const CustomConnectButton = () => {
const { theme } = useTheme();
const networkColor = useNetworkColor();
const { targetNetwork } = useTargetNetwork();
const { address, status, chainId, ...props } = useAccount();
const { address, status, chainId } = useAccount();
const { chain } = useNetwork();
const [modalOpen, setModalOpen] = useState(false);

Expand Down
10 changes: 3 additions & 7 deletions packages/nextjs/hooks/scaffold-stark/useScaffoldReadContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,11 @@ export const useScaffoldReadContract = <
address: deployedContract?.address,
abi: deployedContract?.abi,
watch: true,
args,
enabled: !Array.isArray(args) || !args.some((arg) => arg === undefined),
args: args ?? [],
enabled: true,
blockIdentifier: "pending" as BlockNumber,
...(readConfig as any),
}) as Omit<ReturnType<typeof useContractRead>, "data" | "refetch"> & {
}) as Omit<ReturnType<typeof useContractRead>, "data"> & {
data: AbiFunctionOutputs<ContractAbi, TFunctionName> | undefined;
// refetch: (options?: {
// throwOnError: boolean;
// cancelRefetch: boolean;
// }) => Promise<AbiFunctionOutputs<ContractAbi, TFunctionName>>;
};
};
48 changes: 0 additions & 48 deletions packages/nextjs/public/challenge-icon-starknet.svg

This file was deleted.

0 comments on commit 0262c90

Please sign in to comment.