Skip to content

Commit

Permalink
Release 0.61.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankC01 committed May 28, 2024
1 parent cf1e36e commit db7c69e
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 7 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.61.0] - Unpublished
## [0.61.0] - 2024-05-28

### Added

Expand All @@ -31,7 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Document updates
- Document updates (added graphql transaction builder samples)
- Bumped dataclasses-json to 0.6.6
- Sui binary support range 1.20.x -> 1.27.x

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ See [CHANGELOG](https://github.com/FrankC01/pysui/blob/main/CHANGELOG.md)

## PyPi current

**Release-0.60.0 - Released 2024-05-15**
**Release-0.61.0 - Released 2024-05-28**

- Supports _SUI 1.26.x RPC API_
- Backwards compatable to _Sui 1.18.x RPC API_
- Supports _SUI 1.27.x RPC API_
- Backwards compatable to _Sui 1.20.x RPC API_

- [Latest PyPi Version](https://pypi.org/project/pysui/)

Expand All @@ -39,7 +39,7 @@ MystenLabs announcement can be found [Here](https://github.com/mystenLabs/sui/is
from JSON RPC to GraphQL RPC.

Note: MystenLabs/Sui GraphQL RPC is available on devnet, testnet and mainnet. Note that devnet beta is still quite fragile and
we recommend using testnet beta.
we recommend using testnet beta. We are tracking a few failures we are monitoring [Isssues](https://github.com/FrankC01/pysui/issues?q=is%3Aissue+is%3Aopen++Sui+GraphQL+RPC).

### Sui GraphQL IDEs

Expand Down
92 changes: 91 additions & 1 deletion doc/source/graphql_prog_txn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Legacy
)
New
------
---

.. code-block:: python
:linenos:
Expand All @@ -91,3 +91,93 @@ New
"0x2::sui::SUI",
],
)
===================
DryRun Transaction
===================

Before executing a transaction for debugging and general insight into how the transaction may perform, you
can execute a DryRun:

DryRun Lite
-----------
A lite weight dryrun just uses the TransactionKind (transaction before all gas is reconcilled). The query node to
use in this case is ``DryRunTransactionKind``. If no options are provided, Sui will provide defautls. See the
DryRunTransactionKind documentation.

.. code-block:: python
:linenos:
def dry_run_kind(txn:SuiTransaction):
"""Uses defaults for DryRunTransactionKind."""
raw_kind = txer.raw_kind()
raw_kind_ser = base64.b64encode(raw_kind.serialize().decode())
# Print the TransactionType BCS (pre-serialized) structure
# print(raw_kind.to_json(indent=2))
# print(raw_kind_ser)
# Execute the dry run for kind
result = txer.client.execute_query_node(
with_node=qn.DryRunTransactionKind(tx_bytestr=raw_kind_ser)
)
if result.is_ok():
print(result.result_data.to_json(indent=2))
else:
print(result.result_string)
DryRun Full
-----------
The full dryrun is basiscally a fully built transaction without signatures, but
is dryrun for inspection

.. code-block:: python
:linenos:
def dry_run(txn:SuiTransaction):
"""Uses fully built TransactionData for DryRunTransaction"""
raw_kind = txer.raw_kind()
# Print the TransactionData BCS (pre-serialized) structure
# print(raw_kind.to_json(indent=2))
# Execute the dry run
result =
txn.client.execute_query_node(
with_node=qn.DryRunTransaction(tx_bytestr=txn.build())
)
if result.is_ok():
print(result.result_data.to_json(indent=2))
else:
print(result.result_string)
===================
Execute Transaction
===================

When it comes time to execute a transaction, both the bytecode of the transaction and signatures are
required:

.. code-block:: python
:linenos:
def transaction_execute(txn: SuiTransaction):
"""Uses fully built and serialized TransactionData for ExecuteTransaction."""
raw_kind = txn.raw_kind()
# Print the TransactionData BCS (pre-serialized) structure
# print(raw_kind.to_json(indent=2))
# Build and sign to get the base64 transaction bytes and list of signatures
tx_b64, sig_array = txer.build_and_sign()
# Execute the transaction
result = txer.client.execute_query_node(
with_node=qn.ExecuteTransaction(tx_bytestr=tx_b64, sig_array=sig_array))
if result.is_ok():
# Unlike JSON RPC, the GraphRPC transaction execution just returns
# Status and the transaction digest. You can then take the transaction digest
# and then execute the GetTx for details.
print(result.result_data.to_json(indent=2))
else:
print(result.result_string)

0 comments on commit db7c69e

Please sign in to comment.