MCPcopy Create free account
hub / github.com/ccxt/ccxt / TupleDecoder

Class TupleDecoder

python/ccxt/static_dependencies/ethereum/abi/decoding.py:153–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151
152
153class TupleDecoder(BaseDecoder):
154 decoders = None
155
156 def __init__(self, **kwargs):
157 super().__init__(**kwargs)
158
159 self.decoders = tuple(
160 HeadTailDecoder(tail_decoder=d) if getattr(d, "is_dynamic", False) else d
161 for d in self.decoders
162 )
163
164 self.is_dynamic = any(getattr(d, "is_dynamic", False) for d in self.decoders)
165
166 def validate(self):
167 super().validate()
168
169 if self.decoders is None:
170 raise ValueError("No `decoders` set")
171
172 @to_tuple
173 def decode(self, stream):
174 for decoder in self.decoders:
175 yield decoder(stream)
176
177 @parse_tuple_type_str
178 def from_type_str(cls, abi_type, registry):
179 decoders = tuple(
180 registry.get_decoder(c.to_type_str()) for c in abi_type.components
181 )
182
183 return cls(decoders=decoders)
184
185
186class SingleDecoder(BaseDecoder):

Callers 1

decodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…