Skip to content

Commit

Permalink
Merge pull request #1636 from y0rgos/master
Browse files Browse the repository at this point in the history
execute transactions silently
  • Loading branch information
iamdefinitelyahuman authored Jan 29, 2024
2 parents c3229ab + b926d83 commit 3def266
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions brownie/network/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ def __repr__(self) -> str:
return f"<{type(self).__name__} '{self._name}.constructor({_inputs(self.abi)})'>"

def __call__(
self, *args: Tuple, publish_source: bool = False
self, *args: Tuple, publish_source: bool = False, silent: bool = False
) -> Union["Contract", TransactionReceiptType]:
"""Deploys a contract.
Expand Down Expand Up @@ -562,6 +562,7 @@ def __call__(
required_confs=tx["required_confs"],
allow_revert=tx.get("allow_revert"),
publish_source=publish_source,
silent=silent
)

@staticmethod
Expand Down Expand Up @@ -1715,7 +1716,7 @@ def call(
raise ValueError("No data was returned - the call likely reverted")
return self.decode_output(data)

def transact(self, *args: Tuple) -> TransactionReceiptType:
def transact(self, silent: bool = False, *args: Tuple) -> TransactionReceiptType:
"""
Broadcast a transaction that calls this contract method.
Expand Down Expand Up @@ -1750,6 +1751,7 @@ def transact(self, *args: Tuple) -> TransactionReceiptType:
required_confs=tx["required_confs"],
data=self.encode_input(*args),
allow_revert=tx["allow_revert"],
silent=silent
)

def decode_input(self, hexstr: str) -> List:
Expand Down Expand Up @@ -1849,7 +1851,7 @@ class ContractTx(_ContractMethod):
Bytes4 method signature.
"""

def __call__(self, *args: Tuple) -> TransactionReceiptType:
def __call__(self, *args: Tuple, silent: bool = False) -> TransactionReceiptType:
"""
Broadcast a transaction that calls this contract method.
Expand All @@ -1865,7 +1867,7 @@ def __call__(self, *args: Tuple) -> TransactionReceiptType:
Object representing the broadcasted transaction.
"""

return self.transact(*args)
return self.transact(silent, *args)


class ContractCall(_ContractMethod):
Expand Down

0 comments on commit 3def266

Please sign in to comment.