@@ -5,7 +5,7 @@ use alloy_primitives::{Signed, U256};
55use anyhow:: { Context , Result } ;
66use hypersync_client:: { format, format:: Hex , net_types, simple_types} ;
77use num_bigint:: { BigInt , BigUint } ;
8- use pyo3:: { pyclass, IntoPy , PyObject , Python } ;
8+ use pyo3:: { pyclass, IntoPyObject , PyObject , Python } ;
99use serde:: { Deserialize , Serialize } ;
1010
1111/// Data relating to a single event (log)
@@ -222,35 +222,77 @@ impl Clone for DecodedSolValue {
222222impl DecodedSolValue {
223223 pub fn new ( py : Python , val : DynSolValue , checksummed_addresses : bool ) -> Self {
224224 let val = match val {
225- DynSolValue :: Bool ( b) => b. into_py ( py) ,
226- DynSolValue :: Int ( v, _) => convert_bigint_signed ( v) . into_py ( py) ,
227- DynSolValue :: Uint ( v, _) => convert_bigint_unsigned ( v) . into_py ( py) ,
228- DynSolValue :: FixedBytes ( bytes, _) => encode_prefix_hex ( bytes. as_slice ( ) ) . into_py ( py) ,
225+ DynSolValue :: Bool ( b) => b
226+ . into_pyobject ( py)
227+ . unwrap ( )
228+ . to_owned ( )
229+ . into_any ( )
230+ . unbind ( ) ,
231+ DynSolValue :: Int ( v, _) => convert_bigint_signed ( v)
232+ . into_pyobject ( py)
233+ . unwrap ( )
234+ . into_any ( )
235+ . unbind ( ) ,
236+ DynSolValue :: Uint ( v, _) => convert_bigint_unsigned ( v)
237+ . into_pyobject ( py)
238+ . unwrap ( )
239+ . into_any ( )
240+ . unbind ( ) ,
241+ DynSolValue :: FixedBytes ( bytes, _) => encode_prefix_hex ( bytes. as_slice ( ) )
242+ . into_pyobject ( py)
243+ . unwrap ( )
244+ . into_any ( )
245+ . unbind ( ) ,
229246 DynSolValue :: Address ( addr) => {
230247 if !checksummed_addresses {
231- encode_prefix_hex ( addr. as_slice ( ) ) . into_py ( py)
248+ encode_prefix_hex ( addr. as_slice ( ) )
249+ . into_pyobject ( py)
250+ . unwrap ( )
251+ . into_any ( )
252+ . unbind ( )
232253 } else {
233- addr. to_checksum ( None ) . into_py ( py)
254+ addr. to_checksum ( None )
255+ . into_pyobject ( py)
256+ . unwrap ( )
257+ . into_any ( )
258+ . unbind ( )
234259 }
235260 }
236- DynSolValue :: Function ( bytes) => encode_prefix_hex ( bytes. as_slice ( ) ) . into_py ( py) ,
237- DynSolValue :: Bytes ( bytes) => encode_prefix_hex ( bytes. as_slice ( ) ) . into_py ( py) ,
238- DynSolValue :: String ( s) => s. into_py ( py) ,
261+ DynSolValue :: Function ( bytes) => encode_prefix_hex ( bytes. as_slice ( ) )
262+ . into_pyobject ( py)
263+ . unwrap ( )
264+ . into_any ( )
265+ . unbind ( ) ,
266+ DynSolValue :: Bytes ( bytes) => encode_prefix_hex ( bytes. as_slice ( ) )
267+ . into_pyobject ( py)
268+ . unwrap ( )
269+ . into_any ( )
270+ . unbind ( ) ,
271+ DynSolValue :: String ( s) => s. into_pyobject ( py) . unwrap ( ) . into_any ( ) . unbind ( ) ,
239272 DynSolValue :: Array ( vals) => vals
240273 . into_iter ( )
241274 . map ( |v| DecodedSolValue :: new ( py, v, checksummed_addresses) )
242275 . collect :: < Vec < _ > > ( )
243- . into_py ( py) ,
276+ . into_pyobject ( py)
277+ . unwrap ( )
278+ . into_any ( )
279+ . unbind ( ) ,
244280 DynSolValue :: FixedArray ( vals) => vals
245281 . into_iter ( )
246282 . map ( |v| DecodedSolValue :: new ( py, v, checksummed_addresses) )
247283 . collect :: < Vec < _ > > ( )
248- . into_py ( py) ,
284+ . into_pyobject ( py)
285+ . unwrap ( )
286+ . into_any ( )
287+ . unbind ( ) ,
249288 DynSolValue :: Tuple ( vals) => vals
250289 . into_iter ( )
251290 . map ( |v| DecodedSolValue :: new ( py, v, checksummed_addresses) )
252291 . collect :: < Vec < _ > > ( )
253- . into_py ( py) ,
292+ . into_pyobject ( py)
293+ . unwrap ( )
294+ . into_any ( )
295+ . unbind ( ) ,
254296 } ;
255297
256298 Self { val }
0 commit comments