Skip to content

Commit 64eeb22

Browse files
chore: sync files from scaffold-stark-2
1 parent 7703926 commit 64eeb22

70 files changed

Lines changed: 2793 additions & 1735 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- develop
1212
paths:
1313
- "packages/nextjs/**"
14-
- "packages/snfoundry/contracts/**"
14+
- "packages/snfoundry/**"
1515

1616
jobs:
1717
ci:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ package-lock.json
1313
.eslintcache
1414
.DS_Store
1515
.vercel
16+
17+
**/.env*
18+
!**/.env.example

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
scarb 2.11.4
2-
starknet-foundry 0.45.0
2+
starknet-foundry 0.46.0
33
starknet-devnet 0.4.3

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ss-2",
3-
"version": "1.0.16",
3+
"version": "1.1.0",
44
"author": "Q3 Labs",
55
"license": "MIT",
66
"private": true,

packages/nextjs/.env.example

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
NEXT_PUBLIC_PROVIDER_URL=http://127.0.0.1:5050
2-
31
# URL Devnet
42
NEXT_PUBLIC_DEVNET_PROVIDER_URL=http://127.0.0.1:5050
53

64
# URL Sepolia
7-
# NEXT_PUBLIC_SEPOLIA_PROVIDER_URL=https://starknet-sepolia.blastapi.io/64168c77-3fa5-4e1e-9fe4-41675d212522/rpc/v0_8
5+
NEXT_PUBLIC_SEPOLIA_PROVIDER_URL=https://starknet-sepolia.blastapi.io/64168c77-3fa5-4e1e-9fe4-41675d212522/rpc/v0_8
86

97
# URL Mainnet
10-
# NEXT_PUBLIC_MAINNET_PROVIDER_URL=https://starknet-mainnet.blastapi.io/64168c77-3fa5-4e1e-9fe4-41675d212522/rpc/v0_8
8+
NEXT_PUBLIC_MAINNET_PROVIDER_URL=https://starknet-mainnet.blastapi.io/64168c77-3fa5-4e1e-9fe4-41675d212522/rpc/v0_8
119

1210

packages/nextjs/app/configure/_components/DownloadContracts.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import configExternalContracts from "~~/contracts/configExternalContracts";
77
import { deepMergeContracts } from "~~/utils/scaffold-stark/contract";
88
import { ArrowDownTrayIcon } from "@heroicons/react/24/outline";
99
import Link from "next/link";
10-
import prettier from "prettier/standalone";
11-
import parserTypescript from "prettier/plugins/typescript";
12-
import prettierPluginEstree from "prettier/plugins/estree";
10+
// Prettier imports moved to lazy loading for better performance
1311

1412
export default function DownloadContracts() {
1513
const { provider } = useProvider();
@@ -49,17 +47,25 @@ export default function DownloadContracts() {
4947

5048
const generateContractsFile = async (contractsData: Object) => {
5149
const generatedContractComment = `/**
52-
* This file is autogenerated by Scaffold-Stark.
53-
* You should not edit it manually or your changes might be overwritten.
54-
*/`;
50+
* This file is autogenerated by Scaffold-Stark.
51+
* You should not edit it manually or your changes might be overwritten.
52+
*/`;
5553

56-
const configExternalContracts = await prettier.format(
54+
// Lazy load prettier and plugins only when needed
55+
const [prettier, parserTypescript, prettierPluginEstree] =
56+
await Promise.all([
57+
import("prettier/standalone"),
58+
import("prettier/plugins/typescript"),
59+
import("prettier/plugins/estree"),
60+
]);
61+
62+
const configExternalContracts = await prettier.default.format(
5763
`${generatedContractComment}\n\nconst configExternalContracts = ${JSON.stringify(
5864
contractsData,
5965
)} as const;\n\nexport default configExternalContracts;`,
6066
{
6167
parser: "typescript",
62-
plugins: [parserTypescript, prettierPluginEstree],
68+
plugins: [parserTypescript.default, prettierPluginEstree.default],
6369
},
6470
);
6571
const blob = new Blob([configExternalContracts], {
@@ -130,7 +136,7 @@ export default function DownloadContracts() {
130136
value={contractName}
131137
onChange={(e) => setContractName(e.target.value)}
132138
list="symbols"
133-
className="input bg-input input-ghost rounded-none focus-within:border-transparent focus:outline-none h-[2.2rem] min-h-[2.2rem] px-4 border w-full text-sm placeholder:text-[#9596BF] text-neutral"
139+
className="input bg-input input-ghost rounded-none focus-within:border-transparent focus:outline-hidden h-[2.2rem] min-h-[2.2rem] px-4 border w-full text-sm placeholder:text-[#9596BF] text-neutral"
134140
placeholder="Enter contract name"
135141
/>
136142
</div>
@@ -140,15 +146,15 @@ export default function DownloadContracts() {
140146
</div>
141147
<div className="flex flex-1 gap-4">
142148
<input
143-
className="input bg-input input-ghost rounded-none focus-within:border-transparent focus:outline-none h-[2.2rem] min-h-[2.2rem] px-4 border w-full text-sm placeholder:text-[#9596BF] text-neutral"
149+
className="input bg-input input-ghost rounded-none focus-within:border-transparent focus:outline-hidden h-[2.2rem] min-h-[2.2rem] px-4 border w-full text-sm placeholder:text-[#9596BF] text-neutral"
144150
type="text"
145151
placeholder="Enter contract address"
146152
value={address}
147153
onChange={(e) => setAddress(e.target.value)}
148154
/>
149155
</div>
150156
<button
151-
className="btn btn-sm mt-12 max-w-56 bg-gradient-nav !text-white shadow-md flex gap-2"
157+
className="btn btn-sm mt-12 border-none! max-w-56 bg-gradient-nav text-white! shadow-md flex gap-2"
152158
onClick={handleDownload}
153159
>
154160
Download Contract File

packages/nextjs/app/debug/_components/DebugContracts.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22

33
import { useEffect } from "react";
44
import { useLocalStorage } from "usehooks-ts";
5-
import { ContractUI } from "~~/app/debug/_components/contract";
5+
import dynamic from "next/dynamic";
6+
7+
const ContractUI = dynamic(
8+
() =>
9+
import("~~/app/debug/_components/contract/ContractUI").then(
10+
(mod) => mod.ContractUI,
11+
),
12+
{ ssr: false },
13+
);
14+
615
import { ContractName } from "~~/utils/scaffold-stark/contract";
716
import { getAllContracts } from "~~/utils/scaffold-stark/contractsData";
817

packages/nextjs/app/debug/_components/contract/Array.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ export const ArrayInput = ({
5353

5454
return (
5555
<div>
56-
<div className="collapse bg-base-200 pl-4 pt-1.5 pb-2 border-2 border-secondary custom-after">
56+
<div className="collapse bg-base-200 pl-4 pt-1.5 border-2 border-secondary custom-after">
5757
<input type="checkbox" className="min-h-fit peer" />
5858
<div className="collapse-title p-0 min-h-fit peer-checked:mb-2 text-primary-content/50">
5959
<p className="m-0 p-0 text-[1rem]">array (length: {arrLength + 1})</p>
6060
</div>
61-
<div className="ml-3 flex-col space-y-4 border-secondary/80 border-l-2 pl-4 collapse-content">
61+
<div className="ml-3 flex-col space-y-4 border-secondary/80 peer-checked:mb-3 border-l-2 pl-4 collapse-content">
6262
{/* do note here that the "index" are basically array keys */}
6363
{Object.keys(inputArr).map((index) => {
6464
return (

packages/nextjs/app/debug/_components/contract/ContractUI.tsx

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
"use client";
2-
31
// @refresh reset
4-
import { useReducer, useState } from "react";
2+
import { useMemo, useReducer, useState } from "react";
53
import dynamic from "next/dynamic";
6-
import { ContractReadMethods } from "./ContractReadMethods";
74
import { Address, Balance } from "~~/components/scaffold-stark";
85
import {
96
useDeployedContractInfo,
@@ -17,12 +14,12 @@ import {
1714
import { ContractVariables } from "./ContractVariables";
1815
import { ClassHash } from "~~/components/scaffold-stark/ClassHash";
1916

20-
const ContractWriteMethods = dynamic(
21-
() =>
22-
import("./ContractWriteMethods").then((mod) => mod.ContractWriteMethods),
23-
{
24-
loading: () => <p>Loading Write Methods...</p>,
25-
},
17+
const ContractWriteMethods = dynamic(() =>
18+
import("./ContractWriteMethods").then((mod) => mod.ContractWriteMethods),
19+
);
20+
21+
const ContractReadMethods = dynamic(() =>
22+
import("./ContractReadMethods").then((mod) => mod.ContractReadMethods),
2623
);
2724

2825
type ContractUIProps = {
@@ -54,6 +51,17 @@ export const ContractUI = ({
5451
{ id: "write", label: "Write" },
5552
];
5653

54+
const tabContent = useMemo(() => {
55+
return activeTab === "write" ? (
56+
<ContractWriteMethods
57+
deployedContractData={deployedContractData}
58+
onChange={triggerRefreshDisplayVariables}
59+
/>
60+
) : (
61+
<ContractReadMethods deployedContractData={deployedContractData} />
62+
);
63+
}, [activeTab, deployedContractData, triggerRefreshDisplayVariables]);
64+
5765
if (status === ContractCodeStatus.NOT_FOUND) {
5866
return (
5967
<p className="text-3xl mt-14">
@@ -81,7 +89,7 @@ export const ContractUI = ({
8189
<span className="font-bold text-sm">Balance:</span>
8290
<Balance
8391
address={deployedContractData.address}
84-
className="px-0 h-1.5 min-h-[0.375rem] text-network"
92+
className="px-0 h-1.5 min-h-1.5 text-network"
8593
/>
8694
</div>
8795
</div>
@@ -102,13 +110,13 @@ export const ContractUI = ({
102110
</div>
103111

104112
<div className="col-span-1 lg:col-span-2 flex flex-col gap-6">
105-
<div className="tabs tabs-boxed border border-[#8A45FC] rounded-[5px] bg-transparent">
113+
<div className="tabs tabs-box border border-[#8A45FC] rounded-[5px] bg-transparent">
106114
{tabs.map((tab) => (
107115
<a
108116
key={tab.id}
109-
className={`tab h-10 ${
117+
className={`tab h-10 w-1/2 ${
110118
activeTab === tab.id
111-
? "tab-active !bg-[#8A45FC] !rounded-[5px] !text-white"
119+
? "tab-active bg-[#8A45FC]! rounded-[5px]! text-white! w-1/2"
112120
: ""
113121
}`}
114122
onClick={() => setActiveTab(tab.id)}
@@ -119,19 +127,7 @@ export const ContractUI = ({
119127
</div>
120128
<div className="z-10">
121129
<div className="rounded-[5px] border border-[#8A45FC] flex flex-col relative bg-component">
122-
<div className="p-5 divide-y divide-secondary">
123-
{activeTab === "read" && (
124-
<ContractReadMethods
125-
deployedContractData={deployedContractData}
126-
/>
127-
)}
128-
{activeTab === "write" && (
129-
<ContractWriteMethods
130-
deployedContractData={deployedContractData}
131-
onChange={triggerRefreshDisplayVariables}
132-
/>
133-
)}
134-
</div>
130+
<div className="p-5 divide-y divide-secondary">{tabContent}</div>
135131
{deployedContractLoading && (
136132
<div className="absolute inset-0 rounded-[5px] bg-white/20 z-10">
137133
<div className="animate-spin h-4 w-4 border-2 border-purple-500 border-t-transparent rounded-full absolute top-4 right-4" />

packages/nextjs/app/debug/_components/contract/DisplayVariable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const DisplayVariable = ({
147147
<div>
148148
<div
149149
className={`break-all block transition bg-transparent ${
150-
showAnimation ? "bg-warning rounded-sm animate-pulse-fast" : ""
150+
showAnimation ? "bg-warning rounded-xs animate-pulse-fast" : ""
151151
}`}
152152
>
153153
{decodeContractResponse({

0 commit comments

Comments
 (0)