Skip to content

Commit ea4f023

Browse files
committed
refactor: change arc56 method to abi method
Renames `get_arc56_method` to `get_abi_method` for clarity and consistency across the codebase, reflecting the shift towards using ABI method specifications. Also, replace calls to transaction.tx_id with transaction.tx_id() to align with ts
1 parent 50fcad7 commit ea4f023

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

src/algokit_abi/arc56.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ def to_json(self, indent: int | None = None) -> str:
737737
def dictify(self) -> dict:
738738
return to_wire(self)
739739

740-
def get_arc56_method(self, method_name_or_signature: str) -> Method:
740+
def get_abi_method(self, method_name_or_signature: str) -> Method:
741741
if "(" in method_name_or_signature:
742742
methods = [m for m in self.methods if m.signature == method_name_or_signature]
743743
else:

src/algokit_transact/models/transaction.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ class Transaction:
8181
default=None, metadata=flatten(StateProofTransactionFields, present_if=lambda p: _get_tx_type(p) == "stpf")
8282
)
8383

84-
@property
8584
def tx_id(self) -> str:
8685
"""Return the transaction ID."""
8786
from algokit_transact.ops.ids import get_transaction_id

src/algokit_utils/applications/app_client.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ def _get_abi_params(self, params: dict[str, Any], on_complete: OnApplicationComp
753753
input_params["signer"] = self._client._get_signer(params["sender"], params["signer"])
754754

755755
if params.get("method"):
756-
input_params["method"] = self._app_spec.get_arc56_method(params["method"])
756+
input_params["method"] = self._app_spec.get_abi_method(params["method"])
757757
input_params["args"] = self._client._get_abi_args_with_default_values(
758758
method_name_or_signature=params["method"],
759759
args=params.get("args"),
@@ -1098,7 +1098,7 @@ def opt_in(
10981098
return self._client._handle_call_errors(
10991099
lambda: self._client._process_method_call_return(
11001100
lambda: self._algorand.send.app_call_method_call(self._client.params.opt_in(params), send_params),
1101-
self._app_spec.get_arc56_method(params.method),
1101+
self._app_spec.get_abi_method(params.method),
11021102
)
11031103
)
11041104

@@ -1116,7 +1116,7 @@ def delete(
11161116
return self._client._handle_call_errors(
11171117
lambda: self._client._process_method_call_return(
11181118
lambda: self._algorand.send.app_delete_method_call(self._client.params.delete(params), send_params),
1119-
self._app_spec.get_arc56_method(params.method),
1119+
self._app_spec.get_abi_method(params.method),
11201120
)
11211121
)
11221122

@@ -1140,7 +1140,7 @@ def update(
11401140
lambda: self._algorand.send.app_update_method_call(
11411141
self._client.params.update(params, compilation_params), send_params
11421142
),
1143-
self._app_spec.get_arc56_method(params.method),
1143+
self._app_spec.get_abi_method(params.method),
11441144
)
11451145
)
11461146
assert isinstance(result, SendAppUpdateTransactionResult)
@@ -1160,7 +1160,7 @@ def close_out(
11601160
return self._client._handle_call_errors(
11611161
lambda: self._client._process_method_call_return(
11621162
lambda: self._algorand.send.app_call_method_call(self._client.params.close_out(params), send_params),
1163-
self._app_spec.get_arc56_method(params.method),
1163+
self._app_spec.get_abi_method(params.method),
11641164
)
11651165
)
11661166

@@ -1178,7 +1178,7 @@ def call(
11781178
"""
11791179
is_read_only_call = (
11801180
params.on_complete == OnApplicationComplete.NoOp or params.on_complete is None
1181-
) and self._app_spec.get_arc56_method(params.method).readonly
1181+
) and self._app_spec.get_abi_method(params.method).readonly
11821182

11831183
if is_read_only_call:
11841184
readonly_params = params
@@ -1242,7 +1242,7 @@ def run_simulate() -> SendTransactionComposerResults:
12421242
return self._client._handle_call_errors(
12431243
lambda: self._client._process_method_call_return(
12441244
lambda: self._algorand.send.app_call_method_call(self._client.params.call(params), send_params),
1245-
self._app_spec.get_arc56_method(params.method),
1245+
self._app_spec.get_abi_method(params.method),
12461246
)
12471247
)
12481248

@@ -2053,7 +2053,7 @@ def _get_abi_args_with_default_values(
20532053
args: Sequence[ABIValue | ABIStruct | AppMethodCallTransactionArgument | None] | None,
20542054
sender: str,
20552055
) -> list[Any]:
2056-
method = self._app_spec.get_arc56_method(method_name_or_signature)
2056+
method = self._app_spec.get_abi_method(method_name_or_signature)
20572057
result = list[ABIValue | ABIStruct | AppMethodCallTransactionArgument | None]()
20582058

20592059
if args and len(method.args) < len(args):
@@ -2095,7 +2095,7 @@ def _get_abi_arg_default_value(
20952095
return get_abi_decoded_value(value_raw, value_type)
20962096

20972097
case "method":
2098-
default_method = self._app_spec.get_arc56_method(default_value.data)
2098+
default_method = self._app_spec.get_abi_method(default_value.data)
20992099
empty_args = [None] * len(default_method.args)
21002100
call_result = self.send.call(
21012101
AppClientMethodCallParams(
@@ -2157,7 +2157,7 @@ def _get_storage_value(
21572157

21582158
def _get_abi_params(self, params: dict[str, Any], on_complete: OnApplicationComplete) -> dict[str, Any]:
21592159
sender = self._get_sender(params.get("sender"))
2160-
method = self._app_spec.get_arc56_method(params["method"])
2160+
method = self._app_spec.get_abi_method(params["method"])
21612161
args = self._get_abi_args_with_default_values(
21622162
method_name_or_signature=params["method"], args=params.get("args"), sender=sender
21632163
)

src/algokit_utils/applications/app_factory.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def create(
354354
"signer": self._factory._get_signer(
355355
params.sender if params else None, params.signer if params else None
356356
),
357-
"method": self._factory._app_spec.get_arc56_method(params.method),
357+
"method": self._factory._app_spec.get_abi_method(params.method),
358358
"args": self._factory._get_create_abi_args_with_default_values(params.method, params.args),
359359
"on_complete": params.on_complete or OnApplicationComplete.NoOp,
360360
}
@@ -381,7 +381,7 @@ def deploy_update(self, params: AppClientMethodCallParams) -> AppUpdateMethodCal
381381
"signer": self._factory._get_signer(
382382
params.sender if params else None, params.signer if params else None
383383
),
384-
"method": self._factory._app_spec.get_arc56_method(params.method),
384+
"method": self._factory._app_spec.get_abi_method(params.method),
385385
"args": self._factory._get_create_abi_args_with_default_values(params.method, params.args),
386386
"on_complete": OnApplicationComplete.UpdateApplication,
387387
}
@@ -406,7 +406,7 @@ def deploy_delete(self, params: AppClientMethodCallParams) -> AppDeleteMethodCal
406406
"signer": self._factory._get_signer(
407407
params.sender if params else None, params.signer if params else None
408408
),
409-
"method": self._factory.app_spec.get_arc56_method(params.method),
409+
"method": self._factory.app_spec.get_abi_method(params.method),
410410
"args": self._factory._get_create_abi_args_with_default_values(params.method, params.args),
411411
"on_complete": OnApplicationComplete.DeleteApplication,
412412
}
@@ -589,7 +589,7 @@ def create(
589589
lambda: self._algorand.send.app_create_method_call(
590590
self._factory.params.create(params, compilation_params), send_params
591591
),
592-
self._factory._app_spec.get_arc56_method(params.method),
592+
self._factory._app_spec.get_abi_method(params.method),
593593
)
594594
)
595595

@@ -1106,7 +1106,7 @@ def _get_create_abi_args_with_default_values(
11061106
Builds a list of ABI argument values for creation calls, applying default
11071107
argument values when not provided.
11081108
"""
1109-
method = self._app_spec.get_arc56_method(method_name_or_signature)
1109+
method = self._app_spec.get_abi_method(method_name_or_signature)
11101110

11111111
results: list[Any] = []
11121112

src/algokit_utils/transactions/transaction_sender.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@ def payment(self, params: PaymentParams, send_params: SendParams | None = None)
368368
return self._send(
369369
lambda c: c.add_payment,
370370
pre_log=lambda params, transaction: (
371-
f"Sending {params.amount} from {params.sender} to {params.receiver} via transaction {transaction.tx_id}"
371+
f"Sending {params.amount} from {params.sender} to {params.receiver} "
372+
f"via transaction {transaction.tx_id()}"
372373
),
373374
)(params, send_params)
374375

@@ -481,7 +482,7 @@ def asset_config(
481482
return self._send(
482483
lambda c: c.add_asset_config,
483484
pre_log=lambda params, transaction: (
484-
f"Configuring asset with ID {params.asset_id} via transaction {transaction.tx_id}"
485+
f"Configuring asset with ID {params.asset_id} via transaction {transaction.tx_id()}"
485486
),
486487
)(params, send_params)
487488

@@ -530,7 +531,7 @@ def asset_freeze(
530531
return self._send(
531532
lambda c: c.add_asset_freeze,
532533
pre_log=lambda params, transaction: (
533-
f"Freezing asset with ID {params.asset_id} via transaction {transaction.tx_id}"
534+
f"Freezing asset with ID {params.asset_id} via transaction {transaction.tx_id()}"
534535
),
535536
)(params, send_params)
536537

@@ -575,7 +576,7 @@ def asset_destroy(
575576
return self._send(
576577
lambda c: c.add_asset_destroy,
577578
pre_log=lambda params, transaction: (
578-
f"Destroying asset with ID {params.asset_id} via transaction {transaction.tx_id}"
579+
f"Destroying asset with ID {params.asset_id} via transaction {transaction.tx_id()}"
579580
),
580581
)(params, send_params)
581582

@@ -628,7 +629,7 @@ def asset_transfer(
628629
lambda c: c.add_asset_transfer,
629630
pre_log=lambda params, transaction: (
630631
f"Transferring {params.amount} units of asset with ID {params.asset_id} from "
631-
f"{params.sender} to {params.receiver} via transaction {transaction.tx_id}"
632+
f"{params.sender} to {params.receiver} via transaction {transaction.tx_id()}"
632633
),
633634
)(params, send_params)
634635

@@ -673,7 +674,7 @@ def asset_opt_in(
673674
return self._send(
674675
lambda c: c.add_asset_opt_in,
675676
pre_log=lambda params, transaction: (
676-
f"Opting in {params.sender} to asset with ID {params.asset_id} via transaction {transaction.tx_id}"
677+
f"Opting in {params.sender} to asset with ID {params.asset_id} via transaction {transaction.tx_id()}"
677678
),
678679
)(params, send_params)
679680

@@ -751,7 +752,7 @@ def asset_opt_out(
751752
lambda c: c.add_asset_opt_out,
752753
pre_log=lambda params, transaction: (
753754
f"Opting {params.sender} out of asset with ID {params.asset_id} to creator "
754-
f"{creator} via transaction {transaction.tx_id}"
755+
f"{creator} via transaction {transaction.tx_id()}"
755756
),
756757
)(params, send_params)
757758

@@ -1200,7 +1201,7 @@ def online_key_registration(
12001201
return self._send(
12011202
lambda c: c.add_online_key_registration,
12021203
pre_log=lambda params, transaction: (
1203-
f"Registering online key for {params.sender} via transaction {transaction.tx_id}"
1204+
f"Registering online key for {params.sender} via transaction {transaction.tx_id()}"
12041205
),
12051206
)(params, send_params)
12061207

@@ -1234,6 +1235,6 @@ def offline_key_registration(
12341235
return self._send(
12351236
lambda c: c.add_offline_key_registration,
12361237
pre_log=lambda params, transaction: (
1237-
f"Registering offline key for {params.sender} via transaction {transaction.tx_id}"
1238+
f"Registering offline key for {params.sender} via transaction {transaction.tx_id()}"
12381239
),
12391240
)(params, send_params)

tests/applications/test_app_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def test_construct_transaction_with_abi_encoding_including_transaction(
408408

409409
assert result.confirmation
410410
assert len(result.transactions) == 2
411-
response = AppManager.get_abi_return(result.confirmation, test_app_client.app_spec.get_arc56_method("call_abi_txn"))
411+
response = AppManager.get_abi_return(result.confirmation, test_app_client.app_spec.get_abi_method("call_abi_txn"))
412412
expected_return = f"Sent {amount.micro_algo}. test"
413413
assert result.abi_return == expected_return
414414
assert response
@@ -500,7 +500,7 @@ def test_construct_transaction_with_abi_encoding_including_foreign_references_no
500500

501501
# Assuming the method returns a string matching the format below
502502
expected_return = AppManager.get_abi_return(
503-
result.confirmations[0], test_app_client.app_spec.get_arc56_method("call_abi_foreign_refs")
503+
result.confirmations[0], test_app_client.app_spec.get_abi_method("call_abi_foreign_refs")
504504
)
505505
assert result.abi_return
506506
assert str(result.abi_return).startswith("App: 345, Asset: 567, Account: ")

0 commit comments

Comments
 (0)