Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: estimate_gas interface with drip unit gas price. Resolves #36 #42

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.2.3
current_version = 1.2.4
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-(?P<stage>[^.]*)\.(?P<devnum>\d+))?
Expand Down
4 changes: 4 additions & 0 deletions conflux_web3/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ def estimate_gas_and_collateral_munger(
) -> Tuple[TxParam, Optional[EpochNumberParam]]:
if "from" not in transaction and self.default_account:
transaction = assoc(transaction, "from", self.default_account)
if 'value' in transaction:
transaction['value'] = to_int_if_drip_units(transaction['value'])
if 'gasPrice' in transaction:
transaction['gasPrice'] = to_int_if_drip_units(transaction['gasPrice'])

if block_identifier is None:
params = (transaction, self._default_block)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
setup,
)

VERSION = "1.2.3"
VERSION = "1.2.4"
DESCRIPTION = 'Python SDK for Conflux network'
with open('./README.md') as readme:
long_description = readme.read()
Expand Down
2 changes: 1 addition & 1 deletion tests/base_features/test_api.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
def test_api_version(w3):
assert w3.api.startswith("1.2.3")
assert w3.api.startswith("1.2.4")
3 changes: 2 additions & 1 deletion tests/transaction/test_base_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def test_basetx_estimate(w3: Web3, address: Base32Address):
tx = {
"from": address,
"to": w3.account.create().address,
"value": 100
"value": 100,
"gasPrice": w3.cfx.gas_price
}

estimate = w3.cfx.estimate_gas_and_collateral(tx, w3.cfx.epoch_number-5)
Expand Down
Loading