-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4897c15
Showing
38 changed files
with
10,377 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## Issue Overview | ||
|
||
Provide a brief summary of the issue, including the motivation for addressing it, the problems it presents, and any features required to resolve it. | ||
|
||
## Proposed Solutions or Ideas | ||
|
||
Outline your proposed solution or share any ideas you have for discussing or resolving the issue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Task name here | ||
|
||
Fixes #relevant-issue-here | ||
|
||
## Types of change | ||
|
||
- [ ] Feature | ||
- [ ] Bug | ||
- [ ] Enhancement | ||
|
||
## Comments (optional) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Next.js CI | ||
|
||
on: | ||
push: | ||
paths: | ||
- "packages/nextjs/**" | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "packages/nextjs/**" | ||
|
||
jobs: | ||
ci: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
node: [lts/*] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
|
||
- name: Setup node env | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: "yarn" | ||
#cache-dependency-path: packages/nextjs/yarn.lock | ||
|
||
- name: Install dependencies (Next.js) | ||
run: yarn install --immutable | ||
working-directory: ./packages/nextjs | ||
|
||
- name: Install scarb | ||
run: curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 2.5.4 | ||
|
||
- name: Check Code Format | ||
run: npm run format:check | ||
|
||
- name: Run Next.js lint | ||
run: yarn next:lint --max-warnings=0 | ||
working-directory: ./packages/nextjs | ||
|
||
- name: Check typings on Next.js | ||
run: yarn next:check-types | ||
working-directory: ./packages/nextjs | ||
|
||
- name: Build Next.js project | ||
run: yarn build | ||
working-directory: ./packages/nextjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
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.5.4 | ||
|
||
- 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.25.0 | ||
|
||
- name: Run snforge tests | ||
run: snforge test | ||
working-directory: ./packages/snfoundry/contracts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.vscode/** | ||
node_modules | ||
local-devnet | ||
package-lock.json | ||
.idea | ||
|
||
# yarn / eslint | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
.eslintcache | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[submodule "packages/snfoundry/local-devnet"] | ||
path = packages/snfoundry/local-devnet | ||
url = https://github.com/0xSpaceShard/starknet-devnet-rs | ||
branch = json-rpc-v0.5.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
DESIRED_COMMIT="46e0ec032956f0e7cbe0330f32b6b31eff824087" | ||
|
||
cd packages/snfoundry/local-devnet | ||
|
||
LAST_COMMIT=$(git log -1 --format="%H") | ||
|
||
if [ "$LAST_COMMIT" != "$DESIRED_COMMIT" ]; then | ||
echo "FAIL: Last local-devnet commit ($LAST_COMMIT) is not the desired ($DESIRED_COMMIT)." | ||
exit 1 | ||
fi | ||
|
||
cd - | ||
|
||
npm run format:check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/dist/esm/useLocalStorage/useLocalStorage.js b/dist/esm/useLocalStorage/useLocalStorage.js | ||
index b0d584d4df29953551dfcf8febac002f89fa7acd..920ae5c52d28af73e3a892bdb935a7805a0f8224 100644 | ||
--- a/dist/esm/useLocalStorage/useLocalStorage.js | ||
+++ b/dist/esm/useLocalStorage/useLocalStorage.js | ||
@@ -14,7 +14,7 @@ function useLocalStorage(key, initialValue) { | ||
return initialValue; | ||
} | ||
}, [initialValue, key]); | ||
- const [storedValue, setStoredValue] = useState(readValue); | ||
+ const [storedValue, setStoredValue] = useState(initialValue); | ||
const setValue = useEventCallback(value => { | ||
if (typeof window === 'undefined') { | ||
console.warn(`Tried setting localStorage key “${key}” even though environment is not a client`); |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
enableColors: true | ||
|
||
nmHoistingLimits: workspaces | ||
|
||
nodeLinker: node-modules | ||
|
||
plugins: | ||
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs | ||
spec: "@yarnpkg/plugin-typescript" | ||
|
||
yarnPath: .yarn/releases/yarn-3.2.3.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Contributing to Scaffold-Stark | ||
|
||
Thank you for your interest in contributing to Scaffold-Stark! Your support enhances this StarkNet-focused framework that bridges smart contract integration with web applications. | ||
|
||
## About the Project | ||
|
||
**Scaffold-Stark** provides a full DApp development template, offering seamless integration of StarkNet smart contracts with web applications. **SpeedrunStark.com** offers interactive challenges that serve to practice your Cairo and StarkNet skills, learn how to use the provided hooks, and launch your applications swiftly with potential rewards. | ||
|
||
## Project Vision | ||
|
||
Our goal is to simplify the DApp development and learning process, enabling developers to launch applications efficiently while understanding the intricacies of StarkNet. | ||
|
||
## How to Get Involved | ||
|
||
1. **Understand the Code**: Begin by familiarizing yourself with the architecture and flow by reading through the documentation provided in the README.md. | ||
2. **Check Issues and Discussions**: Look through existing issues and discussions to understand ongoing problems or feature requests. | ||
3. **Start Contributing**: | ||
- **Fix Issues**: Choose an existing issue and work towards a solution. | ||
- **Enhance Documentation**: Improve instructions, examples, or explanations. | ||
- **Develop New Features**: Contribute new features that align with our project's goals. | ||
|
||
## Making Changes | ||
|
||
- **Branch Out**: Always work in a separate branch to avoid conflicts. | ||
- **Coding Standards**: Follow the coding conventions and maintain the code quality as described in our documentation. | ||
- **Commit Messages**: Write clear, concise commit messages that describe your changes and their impact. | ||
|
||
## Submitting Contributions | ||
|
||
1. **Pull Requests**: Submit a PR to the main repository with a detailed description of your changes. | ||
2. **Review Process**: Engage with any feedback from maintainers to refine your PR. | ||
3. **Tests**: Ensure all tests pass and, if necessary, add new tests relevant to your changes. | ||
|
||
## Documentation | ||
|
||
If your changes involve updates to how users interact with Scaffold-Stark or SpeedrunStark, update the relevant sections of the documentation to reflect these changes. | ||
|
||
## Need Help? | ||
|
||
Reach out via our community channels if you encounter issues or need clarification on contributing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
# 🏗 Scaffold-Stark 2 | ||
|
||
<h4 align="center"> | ||
<a href="https://www.docs.scaffoldstark.com/">Documentation</a> | | ||
<a href="https://www.scaffoldstark.com/">Website</a> | ||
</h4> | ||
|
||
🧪 An open-source, up-to-date toolkit for building decentralized applications (dapps) on Starknet blockchain. It's designed to make it easier for developers to create and deploy smart contracts and build user interfaces that interact with those contracts. | ||
|
||
⚙️ Built using NextJS, Starknet.js, Scarb, Starknet-React, Starknet Foundry and Typescript. | ||
|
||
- ✅ **Contract Fast Reload**: Your frontend auto-adapts to your smart contracts as you deploy them. | ||
- 🪝 [**Custom hooks**](https://www.docs.scaffoldstark.com/hooks/): Collection of React hooks wrapper around [starknet-react](https://starknet-react.com/) to simplify interactions with smart contracts with typescript autocompletion. | ||
- 🧱 [**Components**](https://www.docs.scaffoldstark.com/components): Collection of common web3 components to quickly build your frontend. | ||
- 🔥 **Burner Wallet & Prefunded Account**: Quickly test your application with a burner wallet and prefunded accounts. | ||
- 🔐 **Integration with Wallet Providers**: Connect to different wallet providers and interact with Starknet network. | ||
|
||
![Debug Contracts tab](./assests/debug-contracts.png) | ||
|
||
## Requirements | ||
|
||
Before you begin, you need to install the following tools: | ||
|
||
- [Node (>= v18.17)](https://nodejs.org/en/download/) | ||
- Yarn ([v1](https://classic.yarnpkg.com/en/docs/install/) or [v2+](https://yarnpkg.com/getting-started/install)) | ||
- [Git](https://git-scm.com/downloads) | ||
|
||
### Scarb version | ||
|
||
To ensure the proper functioning of scaffold-stark, your local `Scarb` version must be `2.5.4`. To accomplish this, first check your local Scarb version: | ||
|
||
```sh | ||
scarb --version | ||
``` | ||
|
||
If your local Scarb version is not `2.5.4`, you need to install it. | ||
|
||
<details> | ||
<summary><b>Scarb Installation Process</b></summary> | ||
|
||
To install Scarb, please refer to the [installation instructions](https://docs.swmansion.com/scarb/download). | ||
We strongly recommend that you install | ||
Scarb via [asdf](https://docs.swmansion.com/scarb/download.html#install-via-asdf), a CLI tool that can manage | ||
multiple language runtime versions on a per-project basis. | ||
This will ensure that the version of Scarb you use to work on a project always matches the one defined in the | ||
project settings, avoiding problems related to version mismatches. | ||
|
||
Please refer to the [asdf documentation](https://asdf-vm.com/guide/getting-started.html) to install all | ||
prerequisites. | ||
|
||
Once you have `asdf` installed locally, you can download Scarb plugin with the following command: | ||
|
||
```bash | ||
asdf plugin add scarb | ||
``` | ||
|
||
This will allow you to download specific versions. You can choose the same version as the Dojo's Cairo version, for example, 2.5.4, with the following command: | ||
|
||
```bash | ||
asdf install scarb 2.5.4 | ||
``` | ||
|
||
and set a global version: | ||
|
||
```bash | ||
asdf global scarb 2.5.4 | ||
``` | ||
|
||
Otherwise, you can simply run the following command in your terminal, and follow the onscreen instructions. This | ||
will install the version `2.5.4` of Scarb. | ||
|
||
```bash | ||
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 2.5.4 | ||
``` | ||
|
||
</details> | ||
|
||
### Starknet Foundry version | ||
|
||
To ensure the proper functioning of the tests on scaffold-stark, your Starknet Foundry version must be 0.25.0. To accomplish this, first check your Starknet Foundry version: | ||
|
||
```sh | ||
snforge --version | ||
``` | ||
|
||
If your Starknet Foundry version is not `0.25.0`, you need to install it. | ||
|
||
- [Starknet Foundry](https://foundry-rs.github.io/starknet-foundry/getting-started/installation.html) | ||
|
||
## Compatible versions | ||
|
||
- Scarb - v2.5.4 | ||
- Snforge - v0.23 | ||
- Cairo - v2.5.4 | ||
- Rpc - v0.5.1 | ||
|
||
## Quickstart | ||
|
||
To get started with Scaffold-Stark 2, follow the steps below: | ||
|
||
1. Clone this repo and install dependencies | ||
|
||
```bash | ||
git clone https://github.com/Quantum3-Labs/scaffold-stark-2 --recurse-submodules | ||
cd scaffold-stark-2 | ||
yarn install | ||
``` | ||
|
||
2. Prepare your environment variables. | ||
|
||
By default Scaffold-Stark 2 takes the first prefunded account from `starknet-devnet` as a deployer address, thus **you can skip this step!**. But if you want use the .env file anyway, you can fill the envs related to devnet with any other predeployed contract address and private key from starknet-devnet. | ||
|
||
**Note:** In case you want to deploy on Sepolia, you need to fill the envs related to sepolia testnet with your own contract address and private key. | ||
|
||
```bash | ||
cp packages/snfoundry/.env.example packages/snfoundry/.env | ||
``` | ||
|
||
3. Run a local network in the first terminal. | ||
|
||
**Note:** You can skip this step if you want to use Sepolia Testnet. | ||
|
||
```bash | ||
yarn chain | ||
``` | ||
|
||
This command starts a local Starknet network using Devnet. The network runs on your local machine and can be used for testing and development. You can customize the network configuration in `scaffold.config.ts` for your nextjs app. | ||
|
||
**Note:** If you are on sepolia or mainnet, for a better user experience on your app, you can get a dedicated RPC from [Infura dashboard](https://www.infura.io/). A default is provided [here](https://github.com/Quantum3-Labs/scaffold-stark-2/tree/main/packages/nextjs/.env.example), in order to use this, you have to run `cp packages/nextjs/.env.example packages/nextjs/.env.local` | ||
|
||
|
||
4. On a second terminal, deploy the sample contract: | ||
|
||
``` | ||
yarn deploy --network {NETWORK_NAME} // when NETWORK_NAME is not specified, it defaults to "devnet" | ||
``` | ||
|
||
**Note:** To use sepolia tesnet, you have to set {NETWORK_NAME} to `sepolia`. | ||
|
||
|
||
This command deploys a sample smart contract to the local network. The contract is located in `packages/snfoundry/contracts/src` and can be modified to suit your needs. The `yarn deploy` command uses the deploy script located in `packages/snfoundry/scripts-ts/deploy.ts` to deploy the contract to the network. You can also customize the deploy script. | ||
|
||
5. On a third terminal, start your NextJS app: | ||
|
||
``` | ||
yarn start | ||
``` | ||
|
||
Visit your app on: `http://localhost:3000`. You can interact with your smart contract using the `Debug Contracts` page. You can tweak the app config in `packages/nextjs/scaffold.config.ts`. | ||
|
||
**What's next**: | ||
|
||
- Edit your smart contract `YourContract.cairo` in `packages/snfoundry/contracts/src` | ||
- Edit your frontend homepage at `packages/nextjs/app/page.tsx`. For guidance on [routing](https://nextjs.org/docs/app/building-your-application/routing/defining-routes) and configuring [pages/layouts](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts) checkout the Next.js documentation. | ||
- Edit your deployment scripts in `packages/snfoundry/script-ts/deploy.ts` | ||
- Edit your smart contract tests in `packages/snfoundry/contracts/src/test`. To run tests use `yarn test` | ||
|
||
## Documentation | ||
|
||
Visit our [docs](https://www.docs.scaffoldstark.com/) to learn how to start building with Scaffold-Stark 2. | ||
|
||
To know more about its features, check out our [website](https://scaffoldstark.com) | ||
|
||
## Contributing to Scaffold-Stark 2 | ||
|
||
We welcome contributions to Scaffold-Stark 2! | ||
|
||
Please see [CONTRIBUTING.MD](https://github.com/Quantum3-Labs/scaffold-stark-2/blob/main/CONTRIBUTING.md) for more information and guidelines for contributing to Scaffold-Stark 2. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.