Skip to content

Commit

Permalink
Release 0.59.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankC01 committed Apr 28, 2024
1 parent c7a50af commit 72c6b52
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 82 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pgql_s_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
74 changes: 0 additions & 74 deletions pysui/sui/sui_pgql/pgql_sync_txn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
*,
Expand Down
12 changes: 6 additions & 6 deletions pysui/sui/sui_pgql/pgql_txn_argb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)):
Expand All @@ -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 = []
Expand Down

0 comments on commit 72c6b52

Please sign in to comment.