Skip to content

Commit

Permalink
chore: fixing default signer assignment in app factory
Browse files Browse the repository at this point in the history
  • Loading branch information
aorumbayev committed Dec 18, 2024
1 parent 100d0a2 commit c9655c0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/algokit_utils/applications/app_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ def create(self, params: AppFactoryCreateParams | None = None) -> AppCreateParam
"local_ints": self._factory._app_spec.state.schemas["local"]["ints"],
},
sender=self._factory._get_sender(base_params.sender),
signer=self._factory._get_signer(base_params.sender, base_params.signer),
on_complete=base_params.on_complete or OnComplete.NoOpOC,
extra_program_pages=base_params.extra_program_pages,
)
Expand All @@ -267,7 +268,7 @@ def deploy_update(self, params: AppClientBareCallParams | None = None) -> AppUpd
clear_state_program="",
sender=self._factory._get_sender(params.sender if params else None),
on_complete=OnComplete.UpdateApplicationOC,
signer=params.signer if params else None,
signer=self._factory._get_signer(params.sender if params else None, params.signer if params else None),
note=params.note if params else None,
lease=params.lease if params else None,
rekey_to=params.rekey_to if params else None,
Expand All @@ -281,8 +282,8 @@ def deploy_delete(self, params: AppClientBareCallParams | None = None) -> AppDel
return AppDeleteParams(
app_id=0,
sender=self._factory._get_sender(params.sender if params else None),
signer=self._factory._get_signer(params.sender if params else None, params.signer if params else None),
on_complete=OnComplete.DeleteApplicationOC,
signer=params.signer if params else None,
note=params.note if params else None,
lease=params.lease if params else None,
rekey_to=params.rekey_to if params else None,
Expand Down Expand Up @@ -317,6 +318,7 @@ def create(self, params: AppFactoryCreateMethodCallParams) -> AppCreateMethodCal
"local_ints": self._factory._app_spec.state.schemas["local"]["ints"],
},
sender=self._factory._get_sender(params.sender),
signer=self._factory._get_signer(params.sender if params else None, params.signer if params else None),
method=get_arc56_method(params.method, self._factory._app_spec),
args=self._factory._get_create_abi_args_with_default_values(params.method, params.args),
on_complete=params.on_complete or OnComplete.NoOpOC,
Expand All @@ -331,6 +333,7 @@ def deploy_update(self, params: AppClientMethodCallParams) -> AppUpdateMethodCal
approval_program="",
clear_state_program="",
sender=self._factory._get_sender(params.sender),
signer=self._factory._get_signer(params.sender if params else None, params.signer if params else None),
method=get_arc56_method(params.method, self._factory._app_spec),
args=self._factory._get_create_abi_args_with_default_values(params.method, params.args),
on_complete=OnComplete.UpdateApplicationOC,
Expand All @@ -343,6 +346,7 @@ def deploy_delete(self, params: AppClientMethodCallParams) -> AppDeleteMethodCal
return AppDeleteMethodCallParams(
app_id=0,
sender=self._factory._get_sender(params.sender),
signer=self._factory._get_signer(params.sender if params else None, params.signer if params else None),
method=get_arc56_method(params.method, self._factory._app_spec),
args=self._factory._get_create_abi_args_with_default_values(params.method, params.args),
on_complete=OnComplete.DeleteApplicationOC,
Expand Down Expand Up @@ -753,6 +757,9 @@ def _get_sender(self, sender: str | bytes | None) -> str:
)
return str(sender or self._default_sender)

def _get_signer(self, sender: str | None, signer: TransactionSigner | None) -> TransactionSigner | None:
return signer or (self._default_signer if not sender or sender == self._default_sender else None)

def _handle_call_errors(self, call: Callable[[], T]) -> T:
try:
return call()
Expand Down

0 comments on commit c9655c0

Please sign in to comment.