|
21 | 21 | from algokit_utils.applications.app_spec.arc56 import Arc56Contract, Network
|
22 | 22 | from algokit_utils.errors.logic_error import LogicError
|
23 | 23 | from algokit_utils.models.account import SigningAccount
|
24 |
| -from algokit_utils.models.amount import AlgoAmount |
| 24 | +from algokit_utils.models.amount import AlgoAmount, micro_algo |
25 | 25 | from algokit_utils.models.state import BoxReference
|
26 |
| -from algokit_utils.transactions.transaction_composer import AppCreateParams, PaymentParams |
| 26 | +from algokit_utils.transactions.transaction_composer import AppCallMethodCallParams, AppCreateParams, PaymentParams |
27 | 27 |
|
28 | 28 |
|
29 | 29 | @pytest.fixture
|
@@ -279,6 +279,48 @@ def test_clone_inheriting_app_name_based_on_default_handling(
|
279 | 279 | assert cloned_app_client.app_name == hello_world_arc32_app_spec.contract.name == app_client.app_name
|
280 | 280 |
|
281 | 281 |
|
| 282 | +def test_group_simulate_matches_send( |
| 283 | + funded_account: SigningAccount, |
| 284 | + test_app_client: AppClient, |
| 285 | +) -> None: |
| 286 | + app_call1_params = AppCallMethodCallParams( |
| 287 | + sender=funded_account.address, |
| 288 | + app_id=test_app_client.app_id, |
| 289 | + method=algosdk.abi.Method.from_signature("set_global(uint64,uint64,string,byte[4])void"), |
| 290 | + args=[1, 2, "asdf", bytes([1, 2, 3, 4])], |
| 291 | + ) |
| 292 | + payment_params = PaymentParams( |
| 293 | + sender=funded_account.address, receiver=funded_account.address, amount=micro_algo(10000) |
| 294 | + ) |
| 295 | + app_call2_params = AppCallMethodCallParams( |
| 296 | + sender=funded_account.address, |
| 297 | + app_id=test_app_client.app_id, |
| 298 | + method=algosdk.abi.Method.from_signature("call_abi(string)string"), |
| 299 | + args=["test"], |
| 300 | + ) |
| 301 | + |
| 302 | + simulate_result = ( |
| 303 | + test_app_client.algorand.new_group() |
| 304 | + .add_app_call_method_call(app_call1_params) |
| 305 | + .add_payment(payment_params) |
| 306 | + .add_app_call_method_call(app_call2_params) |
| 307 | + .simulate(skip_signatures=True) |
| 308 | + ) |
| 309 | + |
| 310 | + send_result = ( |
| 311 | + test_app_client.algorand.new_group() |
| 312 | + .add_app_call_method_call(app_call1_params) |
| 313 | + .add_payment(payment_params) |
| 314 | + .add_app_call_method_call(app_call2_params) |
| 315 | + .send() |
| 316 | + ) |
| 317 | + |
| 318 | + assert len(simulate_result.transactions) == len(send_result.transactions) |
| 319 | + assert len(simulate_result.returns) == len(send_result.returns) |
| 320 | + assert simulate_result.returns[0].value == send_result.returns[0].value |
| 321 | + assert simulate_result.returns[1].value == send_result.returns[1].value |
| 322 | + |
| 323 | + |
282 | 324 | def test_normalise_app_spec(
|
283 | 325 | raw_hello_world_arc32_app_spec: str,
|
284 | 326 | hello_world_arc32_app_spec: ApplicationSpecification,
|
|
0 commit comments