-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use-wallet v4 support; regenerating against latest python templa…
…te with utils v3 and v2 (#40) * fix: support use wallet v4 * chore: regen examples
- Loading branch information
1 parent
230a15b
commit c0c2605
Showing
76 changed files
with
703 additions
and
735 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
2 changes: 1 addition & 1 deletion
2
...tion_python_react/projects/production_python_react-contracts/.algokit/.copier-answers.yml
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
Empty file.
Oops, something went wrong.