Deserialize from a hex string representation (e.g. from RPC) Note that there is no complementary helper like e.g. `to_hex` for the inverse operation. To serialize a message object to a hex string, simply use obj.serialize().hex()
(obj, hex_string)
| 194 | |
| 195 | |
| 196 | def from_hex(obj, hex_string): |
| 197 | """Deserialize from a hex string representation (e.g. from RPC) |
| 198 | |
| 199 | Note that there is no complementary helper like e.g. `to_hex` for the |
| 200 | inverse operation. To serialize a message object to a hex string, simply |
| 201 | use obj.serialize().hex()""" |
| 202 | obj.deserialize(BytesIO(bytes.fromhex(hex_string))) |
| 203 | return obj |
| 204 | |
| 205 | |
| 206 | def tx_from_hex(hex_string): |