How to update application in Beaker program - General - Algorand

How to update application in Beaker program

post by tonycode on Feb 24, 2024

How can I update application written in Beaker? For example here is an official example:

import pyteal as pt
from beaker import (
    Application,
    client,
    localnet,
)
hello_app = Application(“HelloBeaker”)
@hello_app.external
def hello(name: pt.abi.String, *, output: pt.abi.String) → pt.Expr:
    # Set output to the result of `Hello,`+name
    return output.set(pt.Concat(pt.Bytes("Hello, "), name.get()))

def demo() → None:
    # Create an Application client
    app_client = client.ApplicationClient(
        # Get localnet algod client
        client=localnet.get_algod_client(),
        # Pass instance of app to client
        app=hello_app,
        # Get acct from localnet and pass the signer
        signer=localnet.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"

if name == "main": demo()

I change the “hello” function last line to "return output.set(pt.Concat(pt.Bytes("Hello world, “), name.get()))", and I failed to update with UpdateApplicationTxn transaction or beaker ApplicationClient update function. So what should I do?

post by vidhyanand on Feb 24, 2024

The right place to get an answer is discord.