Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions limit_order/.algokit.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[algokit]
min_version = "v2.0.0"

[project]
type = 'workspace'
projects_root_path = 'projects'

[project.run]
build = ['limit_order-contracts', 'limit_order-frontend']
10 changes: 10 additions & 0 deletions limit_order/.algokit/.copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 2.0.12
_src_path: gh:algorandfoundation/algokit-fullstack-template
author_email: [email protected]
author_name: John Doe
contract_name: limit_order
deployment_language: python
preset_name: starter
project_name: limit_order

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_tasks:
- "echo '==== Successfully generated new .devcontainer.json file 🚀 ===='"

_templates_suffix: ".j2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"forwardPorts": [4001, 4002, 8980, 5173],
"portsAttributes": {
"4001": {
"label": "algod"
},
"4002": {
"label": "kmd"
},
"8980": {
"label": "indexer"
},
"5173": {
"label": "vite"
}
},
"postCreateCommand": "mkdir -p ~/.config/algokit && pipx install algokit && sudo chown -R codespace:codespace ~/.config/algokit",
"postStartCommand": "for i in {1..5}; do algokit localnet status > /dev/null 2>&1 && break || sleep 30; algokit localnet reset; done"
}
10 changes: 10 additions & 0 deletions limit_order/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[*]
charset = utf-8
insert_final_newline = true
end_of_line = lf
indent_style = space
indent_size = 2
tab_width = 2
max_line_length = 140
trim_trailing_whitespace = true
single_quote = true
1 change: 1 addition & 0 deletions limit_order/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
170 changes: 170 additions & 0 deletions limit_order/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Ruff (linter)
.ruff_cache/

# Cython debug symbols
cython_debug/

# PyCharm
.idea/
!.idea/runConfigurations

# macOS
.DS_Store

# Received approval test files
*.received.*

# NPM
node_modules

7 changes: 7 additions & 0 deletions limit_order/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}
5 changes: 5 additions & 0 deletions limit_order/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
// Disabled due to matangover.mypy extension not supporting monorepos
// To be addressed as part of https://github.com/matangover/mypy-vscode/issues/82
"mypy.enabled": false
}
45 changes: 45 additions & 0 deletions limit_order/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# limit_order

This starter full stack project has been generated using AlgoKit. See below for default getting started instructions.

## Setup

### Initial setup
1. Clone this repository to your local machine.
2. Ensure [Docker](https://www.docker.com/) is installed and operational. Then, install `AlgoKit` following this [guide](https://github.com/algorandfoundation/algokit-cli#install).
3. Run `algokit project bootstrap all` in the project directory. This command sets up your environment by installing necessary dependencies, setting up a Python virtual environment, and preparing your `.env` file.
4. In the case of a smart contract project, execute `algokit generate env-file -a target_network localnet` from the `limit_order-contracts` directory to create a `.env.localnet` file with default configuration for `localnet`.
5. To build your project, execute `algokit project run build`. This compiles your project and prepares it for running.
6. For project-specific instructions, refer to the READMEs of the child projects:
- Smart Contracts: [limit_order-contracts](projects/limit_order-contracts/README.md)
- Frontend Application: [limit_order-frontend](projects/limit_order-frontend/README.md)

> This project is structured as a monorepo, refer to the [documentation](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/features/project/run.md) to learn more about custom command orchestration via `algokit project run`.

### Subsequently

1. If you update to the latest source code and there are new dependencies, you will need to run `algokit project bootstrap all` again.
2. Follow step 3 above.

## Tools

This project makes use of Python and React to build Algorand smart contracts and to provide a base project configuration to develop frontends for your Algorand dApps and interactions with smart contracts. The following tools are in use:

- Algorand, AlgoKit, and AlgoKit Utils
- Python dependencies including Poetry, Black, Ruff or Flake8, mypy, pytest, and pip-audit
- React and related dependencies including AlgoKit Utils, Tailwind CSS, daisyUI, use-wallet, npm, jest, playwright, Prettier, ESLint, and Github Actions workflows for build validation

### VS Code

It has also been configured to have a productive dev experience out of the box in [VS Code](https://code.visualstudio.com/), see the [backend .vscode](./backend/.vscode) and [frontend .vscode](./frontend/.vscode) folders for more details.

## Integrating with smart contracts and application clients

Refer to the [limit_order-contracts](projects/limit_order-contracts/README.md) folder for overview of working with smart contracts, [projects/limit_order-frontend](projects/limit_order-frontend/README.md) for overview of the React project and the [projects/limit_order-frontend/contracts](projects/limit_order-frontend/src/contracts/README.md) folder for README on adding new smart contracts from backend as application clients on your frontend. The templates provided in these folders will help you get started.
When you compile and generate smart contract artifacts, your frontend component will automatically generate typescript application clients from smart contract artifacts and move them to `frontend/src/contracts` folder, see [`generate:app-clients` in package.json](projects/limit_order-frontend/package.json). Afterwards, you are free to import and use them in your frontend application.

The frontend starter also provides an example of interactions with your LimitOrderClient in [`AppCalls.tsx`](projects/limit_order-frontend/src/components/AppCalls.tsx) component by default.

## Next Steps

You can take this project and customize it to build your own decentralized applications on Algorand. Make sure to understand how to use AlgoKit and how to write smart contracts for Algorand before you start.
96 changes: 96 additions & 0 deletions limit_order/limit_order.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"folders": [
{
"path": "./",
"name": "ROOT"
},
{
"path": "./projects/limit_order-contracts"
},
{
"path": "./projects/limit_order-frontend"
},
{
"path": "."
},
{
"path": "projects/limit_order-frontend"
},
{
"path": "projects/limit_order-contracts"
},
{
"path": "."
}
],
"settings": {
"files.exclude": {
"projects/": true
},
"jest.disabledWorkspaceFolders": [
"ROOT",
"projects"
],
"dotenv.enableAutocloaking": false
},
"extensions": {
"recommendations": [
"joshx.workspace-terminals"
]
},
"tasks": {
"version": "2.0.0",
"tasks": [
{
"label": "Build artifacts (+ LocalNet)",
"command": "algokit",
"args": [
"project",
"run",
"build"
],
"options": {
"cwd": "${workspaceFolder}"
},
"dependsOn": "Start AlgoKit LocalNet",
"problemMatcher": []
},
{
"label": "Start AlgoKit LocalNet",
"command": "algokit",
"args": [
"localnet",
"start"
],
"type": "shell",
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
}
]
},
"launch": {
"configurations": [],
"compounds": [
{
"preLaunchTask": "Build artifacts (+ LocalNet)",
"name": "Run Frontend (+ LocalNet and Smart Contract)",
"configurations": [
{
"name": "Deploy contracts",
"folder": "limit_order-contracts"
},
{
"name": "Run dApp",
"folder": "limit_order-frontend"
}
],
"presentation": {
"hidden": false,
"group": "0. Run workspace"
}
}
]
}
}
Empty file added limit_order/projects/.gitkeep
Empty file.
Loading