Skip to content

Commit e9325ba

Browse files
committed
Add is_dynamic property
1 parent 86f18db commit e9325ba

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

web3/_utils/abi.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ class AcceptsHexStrMixin(encoding.BaseEncoder):
161161
def __init__(self, subencoder):
162162
self.subencoder = subencoder
163163

164+
@property
165+
def is_dynamic(self):
166+
return self.subencoder.is_dynamic
167+
164168
@classmethod
165169
def from_type_str(cls, abi_type, registry):
166170
subencoder_cls = cls.get_subencoder_class()
@@ -183,8 +187,7 @@ def encode(self, value):
183187
return self.subencoder.encode(normalized_value)
184188

185189
def validate_and_normalize(self, value):
186-
# call this raw value
187-
original_value = value
190+
raw_value = value
188191
if is_text(value):
189192
try:
190193
value = decode_hex(value)
@@ -194,13 +197,13 @@ def validate_and_normalize(self, value):
194197
msg=f'{value} is an invalid hex string',
195198
)
196199
else:
197-
if original_value[:2] != '0x':
200+
if raw_value[:2] != '0x':
198201
if self.is_strict:
199202
self.invalidate_value(
200-
original_value,
203+
raw_value,
201204
msg='hex string must be prefixed with 0x'
202205
)
203-
elif original_value[:2] != '0x':
206+
elif raw_value[:2] != '0x':
204207
warnings.warn(
205208
'in v6 it will be invalid to pass a hex string without the "0x" prefix',
206209
category=DeprecationWarning

0 commit comments

Comments
 (0)