generated from algorandfoundation/algokit-beaker-default-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: updating ts deployer to use v8 utils; updating py to support v3…
… utils-py (#94) * refactor: updating ts deployer to use v8 utils; updating py to support v3 utils-py * refactor: further polishing * refactor: remove black/flake-8 from root setup * chore: addressing pr comments * chore: enable auto import completions in pylance * chore: tweak ts utils dependencies * chore: bump to prod versions --------- Co-authored-by: Neil Campbell <neil.campbell@makerx.com.au>
- Loading branch information
1 parent
e33861d
commit ef72612
Showing
95 changed files
with
1,997 additions
and
2,646 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 27 additions & 18 deletions
45
...lgokit/generators/create_contract/smart_contracts/{{ contract_name }}/deploy_config.py.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,44 @@ | ||
import logging | ||
|
||
import algokit_utils | ||
from algosdk.v2client.algod import AlgodClient | ||
from algosdk.v2client.indexer import IndexerClient | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
# define deployment behaviour based on supplied app spec | ||
def deploy( | ||
algod_client: AlgodClient, | ||
indexer_client: IndexerClient, | ||
app_spec: algokit_utils.ApplicationSpecification, | ||
deployer: algokit_utils.Account, | ||
) -> None: | ||
def deploy() -> None: | ||
from smart_contracts.artifacts.{{ contract_name }}.{{ contract_name }}_client import ( | ||
{{ contract_name.split('_')|map('capitalize')|join }}Client, | ||
{{ contract_name.split('_')|map('capitalize')|join }}Factory, | ||
HelloArgs, | ||
) | ||
|
||
app_client = {{ contract_name.split('_')|map('capitalize')|join }}Client( | ||
algod_client, | ||
creator=deployer, | ||
indexer_client=indexer_client, | ||
algorand = algokit_utils.AlgorandClient.from_environment() | ||
deployer_ = algorand.account.from_environment("DEPLOYER") | ||
|
||
factory = algorand.client.get_typed_app_factory( | ||
{{ contract_name.split('_')|map('capitalize')|join }}Factory, default_sender=deployer_.address | ||
) | ||
app_client.deploy( | ||
on_schema_break=algokit_utils.OnSchemaBreak.AppendApp, | ||
|
||
app_client, result = factory.deploy( | ||
on_update=algokit_utils.OnUpdate.AppendApp, | ||
on_schema_break=algokit_utils.OnSchemaBreak.AppendApp, | ||
) | ||
|
||
if result.operation_performed in [ | ||
algokit_utils.OperationPerformed.Create, | ||
algokit_utils.OperationPerformed.Replace, | ||
]: | ||
algorand.send.payment( | ||
algokit_utils.PaymentParams( | ||
amount=algokit_utils.AlgoAmount(algo=1), | ||
sender=deployer_.address, | ||
receiver=app_client.app_address, | ||
) | ||
) | ||
|
||
name = "world" | ||
response = app_client.hello(name=name) | ||
response = app_client.send.hello(args=HelloArgs(name=name)) | ||
logger.info( | ||
f"Called hello on {app_spec.contract.name} ({app_client.app_id}) " | ||
f"with name={name}, received: {response.return_value}" | ||
f"Called hello on {app_client.app_name} ({app_client.app_id}) " | ||
f"with name={name}, received: {response.abi_return}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.