1212from algosdk .transaction import OnComplete , Transaction
1313
1414from algokit_utils ._legacy_v2 .application_specification import ApplicationSpecification
15- from algokit_utils .applications .app_manager import BoxABIValue , BoxName , BoxValue
1615from algokit_utils .applications .utils import (
1716 get_abi_decoded_value ,
1817 get_abi_encoded_value ,
1918 get_abi_tuple_from_abi_struct ,
2019 get_arc56_method ,
2120)
2221from algokit_utils .errors .logic_error import LogicError , parse_logic_error
22+ from algokit_utils .models .abi import BoxABIValue
2323from algokit_utils .models .application import (
24+ AppClientCompilationParams ,
25+ AppClientCompilationResult ,
26+ AppClientParams ,
27+ AppSourceMaps ,
2428 AppState ,
2529 Arc56Contract ,
26- CompiledTeal ,
2730 ProgramSourceInfo ,
2831 SourceInfoDetail ,
2932 StorageKey ,
3033 StorageMap ,
3134)
32- from algokit_utils .models .transaction import SendParams
35+ from algokit_utils .models .state import BoxName , BoxValue
36+ from algokit_utils .models .transaction import (
37+ SendAppTransactionResult ,
38+ SendAppUpdateTransactionResult ,
39+ SendParams ,
40+ SendSingleTransactionResult ,
41+ )
3342from algokit_utils .transactions .transaction_composer import (
34- AppCallMethodCall ,
43+ AppCallMethodCallParams ,
3544 AppCallParams ,
36- AppDeleteMethodCall ,
45+ AppDeleteMethodCallParams ,
3746 AppMethodCallTransactionArgument ,
38- AppUpdateMethodCall ,
47+ AppUpdateMethodCallParams ,
3948 AppUpdateParams ,
4049 BuiltTransactions ,
4150 PaymentParams ,
4251)
43- from algokit_utils .transactions .transaction_sender import SendAppTransactionResult , SendSingleTransactionResult
4452
4553if TYPE_CHECKING :
4654 from collections .abc import Callable
4755
4856 from algosdk .atomic_transaction_composer import TransactionSigner
4957
50- from algokit_utils .applications .app_manager import (
51- AppManager ,
52- BoxIdentifier ,
53- BoxReference ,
54- TealTemplateParams ,
55- )
58+ from algokit_utils .applications .app_manager import AppManager
5659 from algokit_utils .models .abi import ABIStruct , ABIType , ABIValue
5760 from algokit_utils .models .amount import AlgoAmount
61+ from algokit_utils .models .state import BoxIdentifier , BoxReference , TealTemplateParams
5862 from algokit_utils .protocols .application import AlgorandClientProtocol
5963 from algokit_utils .transactions .transaction_composer import TransactionComposer
6064
@@ -127,13 +131,6 @@ def get_constant_block_offset(program: bytes) -> int: # noqa: C901
127131 return max (bytecblock_offset or 0 , intcblock_offset or 0 )
128132
129133
130- @dataclass (kw_only = True , frozen = True )
131- class AppClientCompilationParams :
132- deploy_time_params : TealTemplateParams | None = None
133- updatable : bool | None = None
134- deletable : bool | None = None
135-
136-
137134@dataclass (kw_only = True , frozen = True )
138135class ExposedLogicErrorDetails :
139136 is_clear_state_program : bool = False
@@ -145,31 +142,7 @@ class ExposedLogicErrorDetails:
145142
146143
147144@dataclass (kw_only = True , frozen = True )
148- class AppClientParams :
149- """Full parameters for creating an app client"""
150-
151- app_spec : (
152- Arc56Contract | ApplicationSpecification | str
153- ) # Using string quotes since these types may be defined elsewhere
154- algorand : AlgorandClientProtocol # Using string quotes since this type may be defined elsewhere
155- app_id : int
156- app_name : str | None = None
157- default_sender : str | bytes | None = None # Address can be string or bytes
158- default_signer : TransactionSigner | None = None
159- approval_source_map : SourceMap | None = None
160- clear_source_map : SourceMap | None = None
161-
162-
163- @dataclass (kw_only = True , frozen = True )
164- class AppClientCompilationResult :
165- approval_program : bytes
166- clear_state_program : bytes
167- compiled_approval : CompiledTeal | None = None
168- compiled_clear : CompiledTeal | None = None
169-
170-
171- @dataclass (kw_only = True , frozen = True )
172- class CommonTxnParams :
145+ class _CommonTxnParams :
173146 sender : str
174147 signer : TransactionSigner | None = None
175148 rekey_to : str | None = None
@@ -313,12 +286,6 @@ class ResolveAppClientByNetwork:
313286 clear_source_map : SourceMap | None = None
314287
315288
316- @dataclass (kw_only = True , frozen = True )
317- class AppSourceMaps :
318- approval_source_map : SourceMap | None = None
319- clear_source_map : SourceMap | None = None
320-
321-
322289class _AppClientStateMethodsProtocol (Protocol ):
323290 def get_all (self ) -> dict [str , Any ]: ...
324291
@@ -558,23 +525,23 @@ def random_note() -> bytes:
558525 close_remainder_to = params .close_remainder_to ,
559526 )
560527
561- def opt_in (self , params : AppClientMethodCallParams ) -> AppCallMethodCall :
528+ def opt_in (self , params : AppClientMethodCallParams ) -> AppCallMethodCallParams :
562529 input_params = self ._get_abi_params (params .__dict__ , on_complete = algosdk .transaction .OnComplete .OptInOC )
563- return AppCallMethodCall (** input_params )
530+ return AppCallMethodCallParams (** input_params )
564531
565- def call (self , params : AppClientMethodCallParams ) -> AppCallMethodCall :
532+ def call (self , params : AppClientMethodCallParams ) -> AppCallMethodCallParams :
566533 input_params = self ._get_abi_params (params .__dict__ , on_complete = algosdk .transaction .OnComplete .NoOpOC )
567- return AppCallMethodCall (** input_params )
534+ return AppCallMethodCallParams (** input_params )
568535
569- def delete (self , params : AppClientMethodCallParams ) -> AppDeleteMethodCall :
536+ def delete (self , params : AppClientMethodCallParams ) -> AppDeleteMethodCallParams :
570537 input_params = self ._get_abi_params (
571538 params .__dict__ , on_complete = algosdk .transaction .OnComplete .DeleteApplicationOC
572539 )
573- return AppDeleteMethodCall (** input_params )
540+ return AppDeleteMethodCallParams (** input_params )
574541
575542 def update (
576543 self , params : AppClientMethodCallParams | AppClientMethodCallWithCompilationAndSendParams
577- ) -> AppUpdateMethodCall :
544+ ) -> AppUpdateMethodCallParams :
578545 compile_params = (
579546 self ._client .compile (
580547 app_spec = self ._client .app_spec ,
@@ -591,14 +558,14 @@ def update(
591558 ** self ._get_abi_params (params .__dict__ , on_complete = algosdk .transaction .OnComplete .UpdateApplicationOC ),
592559 ** compile_params ,
593560 }
594- # Filter input_params to include only fields valid for AppUpdateMethodCall
595- app_update_method_call_fields = {field .name for field in fields (AppUpdateMethodCall )}
561+ # Filter input_params to include only fields valid for AppUpdateMethodCallParams
562+ app_update_method_call_fields = {field .name for field in fields (AppUpdateMethodCallParams )}
596563 filtered_input_params = {k : v for k , v in input_params .items () if k in app_update_method_call_fields }
597- return AppUpdateMethodCall (** filtered_input_params )
564+ return AppUpdateMethodCallParams (** filtered_input_params )
598565
599- def close_out (self , params : AppClientMethodCallParams ) -> AppCallMethodCall :
566+ def close_out (self , params : AppClientMethodCallParams ) -> AppCallMethodCallParams :
600567 input_params = self ._get_abi_params (params .__dict__ , on_complete = algosdk .transaction .OnComplete .CloseOutOC )
601- return AppCallMethodCall (** input_params )
568+ return AppCallMethodCallParams (** input_params )
602569
603570 def _get_abi_params (self , params : dict [str , Any ], on_complete : algosdk .transaction .OnComplete ) -> dict [str , Any ]:
604571 input_params = copy .deepcopy (params )
@@ -761,7 +728,7 @@ def delete(self, params: AppClientMethodCallWithSendParams) -> SendAppTransactio
761728 lambda : self ._algorand .send .app_delete_method_call (self ._client .params .delete (params ))
762729 )
763730
764- def update (self , params : AppClientMethodCallWithCompilationAndSendParams ) -> SendAppTransactionResult :
731+ def update (self , params : AppClientMethodCallWithCompilationAndSendParams ) -> SendAppUpdateTransactionResult :
765732 return self ._client ._handle_call_errors ( # type: ignore[no-any-return]
766733 lambda : self ._algorand .send .app_update_method_call (self ._client .params .update (params ))
767734 )
@@ -790,7 +757,6 @@ def call(self, params: AppClientMethodCallWithSendParams) -> SendAppTransactionR
790757 extra_opcode_budget = None ,
791758 exec_trace_config = None ,
792759 round = None ,
793- fix_signers = None , # TODO: double check on whether algosdk py even has this param
794760 )
795761 )
796762
@@ -802,7 +768,7 @@ def call(self, params: AppClientMethodCallWithSendParams) -> SendAppTransactionR
802768 confirmations = simulate_response .confirmations ,
803769 group_id = simulate_response .group_id or "" ,
804770 returns = simulate_response .returns ,
805- return_value = simulate_response .returns [- 1 ],
771+ abi_return = simulate_response .returns [- 1 ],
806772 )
807773
808774 return self ._client ._handle_call_errors (
@@ -1320,28 +1286,28 @@ def _get_abi_args_with_default_values( # noqa: C901, PLR0912
13201286 default_method = get_arc56_method (default_value .data , self ._app_spec )
13211287 empty_args = [None ] * len (default_method .args )
13221288 call_result = self ._algorand .send .app_call_method_call (
1323- AppCallMethodCall (
1289+ AppCallMethodCallParams (
13241290 app_id = self ._app_id ,
13251291 method = algosdk .abi .Method .from_signature (default_value .data ),
13261292 args = empty_args ,
13271293 sender = sender ,
13281294 )
13291295 )
13301296
1331- if not call_result .return_value :
1297+ if not call_result .abi_return :
13321298 raise ValueError ("Default value method call did not return a value" )
13331299
1334- if isinstance (call_result .return_value , dict ):
1300+ if isinstance (call_result .abi_return , dict ):
13351301 # Convert struct return value to tuple
13361302 result .append (
13371303 get_abi_tuple_from_abi_struct (
1338- call_result .return_value ,
1304+ call_result .abi_return ,
13391305 self ._app_spec .structs [str (default_method .arc56_returns .type )],
13401306 self ._app_spec .structs ,
13411307 )
13421308 )
1343- else :
1344- result .append (call_result .return_value . return_value )
1309+ elif call_result . abi_return . value :
1310+ result .append (call_result .abi_return . value )
13451311
13461312 case "local" | "global" :
13471313 # Get state value
0 commit comments