Creator Algorand Foundation
A modern TypeScript-based smart contract template for the Algorand blockchain. This template showcases how to develop, test, and deploy smart contracts using Algorand Typescript, featuring type-safe contract development, automated testing, and deployment utilities. Ideal for developers who prefer TypeScript's strong typing and modern development features while building Algorand smart contracts.
This project has been generated using AlgoKit. See below for default getting started instructions.
For interactive tour over the codebase, download vsls-contrib.codetour extension for VS Code, then open the
.codetour.json
file in code tour extension.
Start by cloning this repository to your local machine.
Ensure the following pre-requisites are installed and properly configured:
algokit --version
, expecting 2.5.0
or later.pipx install puyapy
. Verify installation with puyapy --version
, expecting 4.1.1
or later.Run the following commands within the project folder:
algokit project bootstrap all
to install dependencies and setup npm dependencies.algokit generate env-file -a target_network localnet
to create a .env.localnet
file with default configuration for localnet
.algokit localnet start
to initiate a local Algorand network.Directly manage and interact with your project using AlgoKit commands:
algokit project run build
compiles all smart contracts. You can also specify a specific contract by passing the name of the contract folder as an extra argument.
For example: algokit project run build -- hello_world
will only build the hello_world
contract.algokit project deploy localnet
to deploy contracts to the local network. You can also specify a specific contract by passing the name of the contract folder as an extra argument.
For example: algokit project deploy localnet -- hello_world
will only deploy the hello_world
contract.For a seamless experience with breakpoint debugging and other features:
F5
to start debugging.While primarily optimized for VS Code, JetBrains IDEs are supported:
Shift+F10
or Ctrl+R
to start debugging. Note: Windows users may encounter issues with pre-launch tasks due to a known bug. See JetBrains forums for workarounds.This project supports both standalone and monorepo setups through AlgoKit workspaces. Leverage algokit project run
commands for efficient monorepo project orchestration and management across multiple projects within a workspace.
This template provides a set of algokit generators that allow you to further modify the project instantiated from the template to fit your needs, as well as giving you a base to build your own extensions to invoke via the algokit generate
command.
By default the template creates a single HelloWorld
contract under hello_world folder in the smart_contracts
directory. To add a new contract:
../
) execute algokit generate smart-contract
. This will create a new starter smart contract and deployment configuration file under {your_contract_name}
subfolder in the smart_contracts
directory.deploy-config.ts
file.index.ts
file. However, by default, index.ts
will auto import all TypeScript deployment files under smart_contracts
directory. If you want to manually import specific contracts, modify the default code provided by the template in index.ts
file.Please note, above is just a suggested convention tailored for the base configuration and structure of this template. The default code supplied by the template in the
index.ts
file is tailored for the suggested convention. You are free to modify the structure and naming conventions as you see fit.
By default the template instance does not contain any env files to deploy to different networks. Using algokit project deploy
against localnet
| testnet
| mainnet
will use default values for algod
and indexer
unless overwritten via .env
or .env.{target_network}
.
To generate a new .env
or .env.{target_network}
file, run algokit generate env-file
This project is optimized to work with AlgoKit AVM Debugger extension. To activate it:
Refer to the commented header in the index.ts
file in the smart_contracts
folder.Since you have opted in to include VSCode launch configurations in your project, you can also use the Debug TEAL via AlgoKit AVM Debugger
launch configuration to interactively select an available trace file and launch the debug session for your smart contract.
For information on using and setting up the AlgoKit AVM Debugger
VSCode extension refer here. To install the extension from the VSCode Marketplace, use the following link: AlgoKit AVM Debugger extension.
This project makes use of Algorand TypeScript to build Algorand smart contracts. The following tools are in use:
It has also been configured to have a productive dev experience out of the box in VS Code, see the .vscode folder.