Skip to content

Commit 9fb3d52

Browse files
Merge pull request #47 from blocknative/fix/case-no-abi
Fix parsing when no abi is present
2 parents b750e05 + 3e7e778 commit 9fb3d52

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

blocknative/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.2.7'
1+
__version__ = '0.2.8'

blocknative/stream.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def subscribe_address(
125125
address: str,
126126
callback: Callback,
127127
filters: List[dict] = None,
128-
abi: List[dict] = None,
128+
abi: Union[List[dict], str] = None,
129129
):
130130
"""Subscribes to an address to listen to any incoming and
131131
outgoing transactions that occur on that address.
@@ -140,10 +140,13 @@ def subscribe_address(
140140
if self.blockchain == BN_ETHEREUM:
141141
address = address.lower()
142142

143+
if isinstance(abi, str):
144+
abi = json.loads(abi)
145+
143146
# Add this subscription to the registry
144147
self._subscription_registry[address] = Subscription(
145148
callback,
146-
{"filters": filters, "abi": json.loads(abi)},
149+
{"filters": filters, "abi": abi},
147150
SubscriptionType.ADDRESS,
148151
)
149152

0 commit comments

Comments
 (0)