From 72c6b52b751ce22fde261385bb67630c1a1790c1 Mon Sep 17 00:00:00 2001 From: "Frank V. Castellucci" Date: Sun, 28 Apr 2024 06:18:20 -0400 Subject: [PATCH] Release 0.59.0 --- CHANGELOG.md | 2 + pgql_s_example.py | 4 +- pysui/sui/sui_pgql/pgql_sync_txn.py | 74 ----------------------------- pysui/sui/sui_pgql/pgql_txn_argb.py | 12 ++--- 4 files changed, 10 insertions(+), 82 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 517a631f..ed62060c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed +- `split_coin_and_return` from GraphQL SuiTransaction. Less costly to just split and transfer + ## [0.58.0] - - 2024-04-22 ### Added diff --git a/pgql_s_example.py b/pgql_s_example.py index c5f4f2b8..cbfd727c 100644 --- a/pgql_s_example.py +++ b/pgql_s_example.py @@ -630,7 +630,7 @@ def split_1_half(client: SuiGQLClient): # do_all_gas(client_init) # do_gas_ids(client_init) # do_sysstate(client_init) - do_all_balances(client_init) + # do_all_balances(client_init) # do_object(client_init) # do_objects(client_init) # do_past_object(client_init) @@ -657,7 +657,7 @@ def split_1_half(client: SuiGQLClient): # do_module(client_init) # do_package(client_init) # do_dry_run(client_init) - # do_dry_run_new(client_init) + do_dry_run_new(client_init) # do_dry_run_kind_new(client_init) # do_dry_run_kind(client_init) # do_execute(client_init) diff --git a/pysui/sui/sui_pgql/pgql_sync_txn.py b/pysui/sui/sui_pgql/pgql_sync_txn.py index b1b86f7a..93b8f673 100644 --- a/pysui/sui/sui_pgql/pgql_sync_txn.py +++ b/pysui/sui/sui_pgql/pgql_sync_txn.py @@ -368,80 +368,6 @@ def split_coin_equal( res_count=retcount, ) - def split_coin_and_return( - self, - *, - coin: Union[str, pgql_type.ObjectReadGQL, bcs.Argument], - split_count: int, - coin_type: Optional[str] = "0x2::sui::SUI", - ) -> bcs.Argument: - """split_coin_and_return Splits a Sui coin into equal parts and returns array of split_count-1 for user to transfer. - - :param coin: The coin to split - :type coin: Union[str, ObjectID, ObjectRead, SuiCoinObject, bcs.Argument] - :param split_count: The number of parts to split coin into - :type split_count: Union[int, SuiInteger] - :param coin_type: The coin type, defaults to a Sui coin type - :type coin_type: Optional[str], optional - :return: The command result which is a vector of coins split out and may be used in subsequent commands. - :rtype: bcs.Argument - """ - package, package_module, package_function, retcount, ars = ( - self._SPLIT_AND_RETURN_TUPLE - ) - parms = ab.build_args(self.client, [coin, split_count], ars) - type_arguments = [bcs.TypeTag.type_tag_from(coin_type)] - result_vector = self.builder.move_call( - target=package, - arguments=parms, - type_arguments=type_arguments, - module=package_module, - function=package_function, - res_count=retcount, - ) - # Adjust type if needed - if coin_type.count("<") == 0: - type_arguments = [ - bcs.TypeTag.type_tag_from(f"0x2::coin::Coin<{coin_type}>") - ] - # We only want the new coins - package, package_module, package_function = ( - tv.TypeValidator.check_target_triplet(self._VECTOR_REMOVE_INDEX) - ) - package = bcs.Address.from_str(package) - - nreslist: list[bcs.Argument] = [] - for nrindex in range(split_count - 1): - nreslist.append( - self.builder.move_call( - target=package, - arguments=[ - result_vector, - PureInput.as_input(SuiU64(0)), - ], - type_arguments=type_arguments, - module=package_module, - function=package_function, - res_count=1, - ) - ) - package, package_module, package_function = ( - tv.TypeValidator.check_target_triplet(self._VECTOR_DESTROY_EMPTY) - ) - package = bcs.Address.from_str(package) - self.builder.move_call( - target=package, - arguments=[ - result_vector, - ], - type_arguments=type_arguments, - module=package_module, - function=package_function, - res_count=1, - ) - - return nreslist - def transfer_objects( self, *, diff --git a/pysui/sui/sui_pgql/pgql_txn_argb.py b/pysui/sui/sui_pgql/pgql_txn_argb.py index 0c214e57..08fd307c 100644 --- a/pysui/sui/sui_pgql/pgql_txn_argb.py +++ b/pysui/sui/sui_pgql/pgql_txn_argb.py @@ -137,10 +137,10 @@ def _scalar_argument( match expected_type.scalar_type: case "address" | "signature": - print(f"{expected_type.scalar_type} = {arg}") + # print(f"{expected_type.scalar_type} = {arg}") return bcs.Address.from_str, tx_builder.PureInput.as_input case "digest": - print(f"{expected_type.scalar_type} = {arg}") + # print(f"{expected_type.scalar_type} = {arg}") return bcs.Digest.from_str, tx_builder.PureInput.as_input case _: # if not isinstance(arg, (str, int)): @@ -166,16 +166,16 @@ def _argument_validate(expected_type: Any, arg: Any) -> Union[None, tuple[Any, A if isinstance(arg, bcs.Argument): return None if isinstance(expected_type, pgql_type.MoveScalarArg): - print("Scalar") + # print("Scalar") return _scalar_argument(expected_type, arg) if isinstance(expected_type, pgql_type.MoveWitnessArg): - print("WitnessArg") + # print("WitnessArg") return _object_argument(expected_type, arg) elif isinstance(expected_type, pgql_type.MoveObjectRefArg): - print("ObjectRef") + # print("ObjectRef") return _object_argument(expected_type, arg) if isinstance(expected_type, (pgql_type.MoveVectorArg, pgql_type.MoveListArg)): - print("Vector or List") + # print("Vector or List") if not isinstance(arg, list): raise ValueError("Vector or List...Oops") some_list = []