Skip to content

Commit

Permalink
Added possibility to set custom gas price in the BlockchainProvider (#23
Browse files Browse the repository at this point in the history
)
  • Loading branch information
u-hubar authored Feb 27, 2024
2 parents 4b5d095 + 8a253c7 commit e0fd904
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dkg/providers/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(
blockchain_id: str,
rpc_uri: URI | None = None,
private_key: DataHexStr | None = None,
gas_price: Wei | None = None,
verify: bool = True,
):
if environment not in BLOCKCHAINS.keys():
Expand Down Expand Up @@ -82,6 +83,7 @@ def __init__(
f"Network with blockchain ID {self.blockchain_id} isn't supported!"
)

self.gas_price = gas_price
self.gas_price_oracle = BLOCKCHAINS[self.environment][self.blockchain_id].get(
"gas_price_oracle",
None,
Expand Down Expand Up @@ -161,7 +163,7 @@ def call_function(
)

nonce = self.w3.eth.get_transaction_count(self.w3.eth.default_account)
gas_price = gas_price or self._get_network_gas_price()
gas_price = self.gas_price or gas_price or self._get_network_gas_price()

options = {
"nonce": nonce,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dkg"
version = "0.1.0-beta.4"
version = "0.1.0-beta.5"
description = "Python library for interacting with the OriginTrail Decentralized Knowledge Graph"
authors = ["Uladzislau Hubar <[email protected]>"]
license = "Apache-2.0"
Expand Down

0 comments on commit e0fd904

Please sign in to comment.