A Framework for building PyTeal Applications
Project description
Beaker
Beaker is a smart contract development framework for PyTeal.
With Beaker, we build a class that represents our entire application including state and routing.
WARNING
:warning: Mostly Untested - Expect Breaking Changes :warning:
Please file issues or prs and get any contracts audited
Hello, Beaker
from pyteal import *
from beaker import *
hello_app = Application("HelloBeaker")
@hello_app.external
def hello(name: abi.String, *, output: abi.String) -> Expr:
# Set output to the result of `Hello, `+name
return output.set(Concat(Bytes("Hello, "), name.get()))
# Create an Application client
app_client = client.ApplicationClient(
# Get sandbox algod client
client=sandbox.get_algod_client(),
# Pass instance of app to client
app=hello_app,
# Get acct from sandbox and pass the signer
signer=sandbox.get_accounts().pop().signer,
)
# Deploy the app on-chain
app_id, app_addr, txid = app_client.create()
print(
f"""Deployed app in txid {txid}
App ID: {app_id}
Address: {app_addr}
"""
)
# Call the `hello` method
result = app_client.call(hello, name="Beaker")
print(result.return_value) # "Hello, Beaker"
Install
Beaker currently requires Python >= 3.10
You can install from pip:
pip install beaker-pyteal==1.0.0b1
Or from github directly (no promises on stability):
pip install git+https://github.com/algorand-devrel/beaker
Dev Environment
Requires a local sandbox with latest stable tag minimum.
$ git clone git@github.com:algorand/sandbox.git
$ cd sandbox
$ sandbox up source
Front End
See Beaker TS to generate a front end client for a Beaker App.
Testing
You can run tests from the root of the project using pytest
Use
Please feel free to file issues/prs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for beaker_pyteal-1.0.0b2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adb297bf3db3756a84bc9e17ef18f41f99e53ce7ae1f8bf040bc722871da5831 |
|
MD5 | bfe0132ae111933d0191d757e569bf42 |
|
BLAKE2b-256 | df5fc71575af727a3af40a8987cb744f9899187f198ce2a0427132abe8a35087 |