Skip to content

Commit

Permalink
Closes #131
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankC01 committed Jul 7, 2023
1 parent e3e7d29 commit e03b198
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ 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.29.1] - Unpublished

### Added

### Fixed

### Changed

- [change](https://github.com/FrankC01/pysui/issues/131) - improve SuiTransaction constructor performance

### Removed

## [0.29.0] - 2023-07-07

### Added
Expand Down
30 changes: 9 additions & 21 deletions pysui/sui/sui_clients/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import base64
import os
import time

This comment has been minimized.

Copy link
@nathan-kairon

nathan-kairon Jul 7, 2023

I think this was pushed accidentally


# import asyncio
from pathlib import Path
Expand Down Expand Up @@ -692,19 +693,18 @@ def _compile_source(
class SuiTransactionAsync(_SuiTransactionBase):
"""."""

@versionchanged(
version="0.29.1", reason="Eliminated redundant gas price RPC call"
)
def __init__(
self,
client: AsyncClient,
merge_gas_budget: bool = False,
initial_sender: Union[SuiAddress, SigningMultiSig] = False,
) -> None:
"""Transaction initializer."""
assert client.is_synchronous is False, "Requires asynch SuiClient"
super().__init__(client, merge_gas_budget, initial_sender)
s_client = SyncClient(client.config)
self._current_gas_price = handle_result(
s_client.execute(GetReferenceGasPrice())
)
self._current_gas_price = client.current_gas_price

@versionchanged(version="0.17.0", reason="Only used internally.")
@versionchanged(
Expand Down Expand Up @@ -1875,6 +1875,9 @@ class SuiTransaction(_SuiTransactionBase):
@versionchanged(
version="0.21.1", reason="Takes a 'initial_sender' as option."
)
@versionchanged(
version="0.29.1", reason="Eliminated redundant gas price RPC call"
)
def __init__(
self,
client: SyncClient,
Expand All @@ -1883,22 +1886,7 @@ def __init__(
) -> None:
"""Transaction initializer."""
super().__init__(client, merge_gas_budget, initial_sender)
self._current_gas_price = handle_result(
self.client.execute(GetReferenceGasPrice())
)

# def _reset_gas(self, for_owner: Union[SuiAddress, MultiSig]) -> list:
# """_reset_gas Returns gas objects imbued with owners."""
# coin_objects = handle_result(self.client.get_gas(for_owner)).data
# out_list = []
# for coin_object in coin_objects:
# setattr(coin_object, "owner", for_owner)
# out_list.append(coin_object)
# return out_list

# def _gas_price(self) -> int:
# """Retrieve the current gas price from the chain during initialization."""
# return handle_result(self.client.execute(GetReferenceGasPrice()))
self._current_gas_price = client.current_gas_price

@versionchanged(
version="0.16.1",
Expand Down
2 changes: 1 addition & 1 deletion pysui/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# -*- coding: utf-8 -*-

"""Pysui Version."""
__version__ = "0.29.0"
__version__ = "0.29.1"

0 comments on commit e03b198

Please sign in to comment.