Skip to content

Commit bcc2c92

Browse files
committed
Project initialised with AlgoKit CLI using template: https://github.com/algorandfoundation/algokit-python-template.git
0 parents  commit bcc2c92

Some content is hidden

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

45 files changed

+2787
-0
lines changed

.algokit.toml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[algokit]
2+
min_version = "v1.12.1"
3+
4+
[project]
5+
type = 'workspace'
6+
projects_root_path = 'projects'

.devcontainer.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"forwardPorts": [4001, 4002, 8980, 5173],
3+
"portsAttributes": {
4+
"4001": {
5+
"label": "algod"
6+
},
7+
"4002": {
8+
"label": "kmd"
9+
},
10+
"8980": {
11+
"label": "indexer"
12+
},
13+
"5173": {
14+
"label": "vite"
15+
}
16+
},
17+
"postCreateCommand": "mkdir -p ~/.config/algokit && pipx install algokit && sudo chown -R codespace:codespace ~/.config/algokit",
18+
"postStartCommand": "for i in {1..5}; do algokit localnet status > /dev/null 2>&1 && break || sleep 30; algokit localnet reset; done"
19+
}

.editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[*]
2+
charset = utf-8
3+
insert_final_newline = true
4+
end_of_line = lf
5+
indent_style = space
6+
indent_size = 2
7+
tab_width = 2
8+
max_line_length = 140
9+
trim_trailing_whitespace = true
10+
single_quote = true

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.gitignore

+170
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
112+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113+
__pypackages__/
114+
115+
# Celery stuff
116+
celerybeat-schedule
117+
celerybeat.pid
118+
119+
# SageMath parsed files
120+
*.sage.py
121+
122+
# Environments
123+
.env
124+
.venv
125+
env/
126+
venv/
127+
ENV/
128+
env.bak/
129+
venv.bak/
130+
131+
# Spyder project settings
132+
.spyderproject
133+
.spyproject
134+
135+
# Rope project settings
136+
.ropeproject
137+
138+
# mkdocs documentation
139+
/site
140+
141+
# mypy
142+
.mypy_cache/
143+
.dmypy.json
144+
dmypy.json
145+
146+
# Pyre type checker
147+
.pyre/
148+
149+
# pytype static type analyzer
150+
.pytype/
151+
152+
# Ruff (linter)
153+
.ruff_cache/
154+
155+
# Cython debug symbols
156+
cython_debug/
157+
158+
# PyCharm
159+
.idea/
160+
!.idea/runConfigurations
161+
162+
# macOS
163+
.DS_Store
164+
165+
# Received approval test files
166+
*.received.*
167+
168+
# NPM
169+
node_modules
170+

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
// Disabled due to matangover.mypy extension not supporting monorepos
3+
// To be addressed as part of https://github.com/matangover/mypy-vscode/issues/82
4+
"mypy.enabled": false
5+
}

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# blockchain-valley-session-2
2+
3+
Welcome to your new AlgoKit project!
4+
5+
This is your workspace root. A `workspace` in AlgoKit is an orchestrated collection of standalone projects (backends, smart contracts, frontend apps and etc).
6+
7+
By default, `projects_root_path` parameter is set to `projects`. Which instructs AlgoKit CLI to create a new directory under `projects` directory when new project is instantiated via `algokit init` at the root of the workspace.
8+
9+
## Getting Started
10+
11+
To get started refer to `README.md` files in respective sub-projects in the `projects` directory.
12+
13+
To learn more about algokit, visit [documentation](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/algokit.md).
14+
15+
### GitHub Codespaces
16+
17+
If executing this repository in GitHub Codespaces, the container will automatically cleanup templatized content and pre-install `algokit` for you. To get started execute:
18+
19+
- `algokit init` - to invoke interactive wizard to guide you through the process of creating a new AlgoKit project
20+
21+
Powered by [Copier templates](https://copier.readthedocs.io/en/stable/).
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"folders": [
3+
{
4+
"path": "./",
5+
"name": "ROOT"
6+
},
7+
{
8+
"path": "projects/blockchain-valley-session-2"
9+
}
10+
],
11+
"settings": {
12+
"files.exclude": {
13+
"projects/": true
14+
},
15+
"jest.disabledWorkspaceFolders": [
16+
"ROOT",
17+
"projects"
18+
]
19+
},
20+
"extensions": {
21+
"recommendations": [
22+
"joshx.workspace-terminals"
23+
]
24+
},
25+
"tasks": {
26+
"version": "2.0.0",
27+
"tasks": []
28+
},
29+
"launch": {
30+
"configurations": []
31+
}
32+
}

projects/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[algokit]
2+
min_version = "v2.0.0"
3+
4+
[generate.smart_contract]
5+
description = "Adds new smart contract to existing project"
6+
path = ".algokit/generators/create_contract"
7+
8+
[project]
9+
type = 'contract'
10+
name = 'blockchain-valley-session-2'
11+
artifacts = 'smart_contracts/artifacts'
12+
13+
[project.deploy]
14+
command = "npm run deploy:ci"
15+
environment_secrets = [
16+
"DEPLOYER_MNEMONIC",
17+
]
18+
19+
[project.deploy.localnet]
20+
environment_secrets = []
21+
22+
[project.run]
23+
# Commands intented for use locally and in CI
24+
build = { commands = [
25+
'poetry run python -m smart_contracts build',
26+
], description = 'Build all smart contracts in the project' }
27+
lint = { commands = [
28+
], description = 'Perform linting' }
29+
audit-teal = { commands = [
30+
# 🚨 IMPORTANT 🚨: For strict TEAL validation, remove --exclude statements. The default starter contract is not for production. Ensure thorough testing and adherence to best practices in smart contract development. This is not a replacement for a professional audit.
31+
'algokit task analyze smart_contracts/artifacts --recursive --force --exclude rekey-to --exclude is-updatable --exclude missing-fee-check --exclude is-deletable --exclude can-close-asset --exclude can-close-account --exclude unprotected-deletable --exclude unprotected-updatable',
32+
], description = 'Audit TEAL files' }
33+
34+
# Commands intented for CI only, prefixed with `ci-` by convention
35+
ci-teal-diff = { commands = [
36+
'git add -N ./smart_contracts/artifacts',
37+
'git diff --exit-code --minimal ./smart_contracts/artifacts',
38+
], description = 'Check TEAL files for differences' }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
_tasks:
2+
- "echo '==== Successfully initialized new smart contract 🚀 ===='"
3+
4+
contract_name:
5+
type: str
6+
help: Name of your new contract.
7+
placeholder: "my-new-contract"
8+
default: "my-new-contract"
9+
10+
_templates_suffix: ".j2"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# pyright: reportMissingModuleSource=false
2+
from algopy import ARC4Contract, arc4
3+
4+
5+
class {{ contract_name.split('_')|map('capitalize')|join }}(ARC4Contract):
6+
@arc4.abimethod()
7+
def hello(self, name: arc4.String) -> arc4.String:
8+
return "Hello, " + name
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import * as algokit from '@algorandfoundation/algokit-utils'
2+
import { NftMarketplaceClient } from '../artifacts/nft_marketplace/client'
3+
4+
// Below is a showcase of various deployment options you can use in TypeScript Client
5+
export async function deploy() {
6+
console.log('=== Deploying NftMarketplace ===')
7+
8+
const algod = algokit.getAlgoClient()
9+
const indexer = algokit.getAlgoIndexerClient()
10+
const deployer = await algokit.mnemonicAccountFromEnvironment({ name: 'DEPLOYER', fundWith: algokit.algos(3) }, algod)
11+
await algokit.ensureFunded(
12+
{
13+
accountToFund: deployer,
14+
minSpendingBalance: algokit.algos(2),
15+
minFundingIncrement: algokit.algos(2),
16+
},
17+
algod,
18+
)
19+
const appClient = new NftMarketplaceClient(
20+
{
21+
resolveBy: 'creatorAndName',
22+
findExistingUsing: indexer,
23+
sender: deployer,
24+
creatorAddress: deployer.addr,
25+
},
26+
algod,
27+
)
28+
29+
const app = await appClient.deploy({
30+
onSchemaBreak: 'append',
31+
onUpdate: 'append',
32+
})
33+
34+
35+
// If app was just created fund the app account
36+
if (['create', 'replace'].includes(app.operationPerformed)) {
37+
algokit.transferAlgos(
38+
{
39+
amount: algokit.algos(1),
40+
from: deployer,
41+
to: app.appAddress,
42+
},
43+
algod,
44+
)
45+
}
46+
47+
const method = 'hello'
48+
const response = await appClient.hello({ name: 'world' })
49+
console.log(`Called ${method} on ${app.name} (${app.appId}) with name = world, received: ${response.return}`)
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2+
_commit: 1.0.7
3+
_src_path: gh:algorandfoundation/algokit-python-template
4+
author_email: [email protected]
5+
author_name: iskysun96
6+
contract_name: nft_marketplace
7+
deployment_language: typescript
8+
preset_name: starter
9+
project_name: blockchain-valley-session-2
10+

0 commit comments

Comments
 (0)