Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
Add events support to custom contracts (#141)
Browse files Browse the repository at this point in the history
Add events suport to custom contracts
  • Loading branch information
adam-maj authored Aug 2, 2023
1 parent ff5c047 commit a062087
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ packages = [
{include = "thirdweb"},
]
readme = "README.md"
version = "3.1.0"
version = "3.1.1"

[tool.poetry.dependencies]
python = ">=3.7.1"
Expand Down
4 changes: 4 additions & 0 deletions thirdweb/contracts/custom.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Any, Final, Optional, cast
from eth_typing import Address
from thirdweb.core.classes.contract_events import ContractEvents

from web3 import Web3
from web3.contract import ContractFunctions, ContractFunction
Expand Down Expand Up @@ -74,6 +75,7 @@ class CustomContract(BaseContract[Any]):
contract_type: Final[ContractType] = ContractType.CUSTOM

functions: ContractFunctions
events: ContractEvents

def __init__(
self,
Expand Down Expand Up @@ -105,6 +107,8 @@ def __init__(
self.erc721 = self._detect_erc_721()
self.erc1155 = self._detect_erc_1155()

self.events = ContractEvents(contract_wrapper)

def call(self, fn: str, *args) -> Any:
func = cast(ContractFunction, getattr(self.functions, fn, None))
if func is None:
Expand Down

0 comments on commit a062087

Please sign in to comment.