@@ -100,19 +100,19 @@ pub struct ParamsOfDecodeMessage {
100100 /// Function name or function id if is known in advance
101101 pub function_name : Option < String > ,
102102
103- // For external (inbound and outbound) messages data_layout parameter is ignored.
104- // For internal: by default SDK tries to decode as output and then if decode is not successfull - tries as input.
105- // If explicitly specified then tries only the specified layout.
103+ // For external (inbound and outbound) messages data_layout parameter is ignored.
104+ // For internal: by default SDK tries to decode as output and then if decode is not successfull - tries as input.
105+ // If explicitly specified then tries only the specified layout.
106106 pub data_layout : Option < DataLayout > ,
107107}
108108
109109/// Decodes message body using provided message BOC and ABI.
110110#[ api_function]
111- pub async fn decode_message (
111+ pub fn decode_message (
112112 context : Arc < ClientContext > ,
113113 params : ParamsOfDecodeMessage ,
114114) -> ClientResult < DecodedMessageBody > {
115- let ( abi, message) = prepare_decode ( & context, & params) . await ?;
115+ let ( abi, message) = prepare_decode ( & context, & params) ?;
116116 if let Some ( body) = message. body ( ) {
117117 let data_layout = match message. header ( ) {
118118 ton_block:: CommonMsgInfo :: ExtInMsgInfo ( _) => Some ( DataLayout :: Input ) ,
@@ -151,29 +151,28 @@ pub struct ParamsOfDecodeMessageBody {
151151 pub function_name : Option < String > ,
152152
153153 // By default SDK tries to decode as output and then if decode is not successfull - tries as input.
154- // If explicitly specified then tries only the specified layout.
154+ // If explicitly specified then tries only the specified layout.
155155 pub data_layout : Option < DataLayout > ,
156156}
157157
158158/// Decodes message body using provided body BOC and ABI.
159159#[ api_function]
160- pub async fn decode_message_body (
160+ pub fn decode_message_body (
161161 context : Arc < ClientContext > ,
162162 params : ParamsOfDecodeMessageBody ,
163163) -> ClientResult < DecodedMessageBody > {
164164 let abi = params. abi . abi ( ) ?;
165- let ( _, body) = deserialize_cell_from_boc ( & context, & params. body , "message body" ) . await ?;
165+ let ( _, body) = deserialize_cell_from_boc ( & context, & params. body , "message body" ) ?;
166166 let body = slice_from_cell ( body) ?;
167167 decode_body ( abi, body, params. is_internal , params. allow_partial , params. function_name , params. data_layout )
168168}
169169
170- async fn prepare_decode (
170+ fn prepare_decode (
171171 context : & ClientContext ,
172172 params : & ParamsOfDecodeMessage ,
173173) -> ClientResult < ( AbiContract , ton_block:: Message ) > {
174174 let abi = params. abi . abi ( ) ?;
175175 let message = deserialize_object_from_boc ( context, & params. message , "message" )
176- . await
177176 . map_err ( |x| Error :: invalid_message_for_decode ( x) ) ?;
178177 Ok ( ( abi, message. object ) )
179178}
@@ -300,7 +299,7 @@ fn decode_with_function(
300299 function_name,
301300 tokens : decoded,
302301 } ;
303- DecodedMessageBody :: new ( MessageBodyType :: Event , decoded, None )
302+ DecodedMessageBody :: new ( MessageBodyType :: Event , decoded, None )
304303 }
305304 }
306305}
@@ -358,7 +357,7 @@ pub async fn get_signature_data(
358357 params : ParamsOfGetSignatureData ,
359358) -> ClientResult < ResultOfGetSignatureData > {
360359 let abi = params. abi . abi ( ) ?;
361- let message: ton_block:: Message = deserialize_object_from_boc ( & context, & params. message , "message" ) . await ?. object ;
360+ let message: ton_block:: Message = deserialize_object_from_boc ( & context, & params. message , "message" ) ?. object ;
362361 if let Some ( body) = message. body ( ) {
363362 let address = message. dst ( )
364363 . ok_or_else ( || Error :: invalid_message_for_decode (
@@ -367,13 +366,13 @@ pub async fn get_signature_data(
367366 let ( signature, hash) = abi. get_signature_data ( body, Some ( address) )
368367 . map_err ( |err| Error :: invalid_message_for_decode ( err) ) ?;
369368 let unsigned = extend_data_to_sign ( & context, params. signature_id , Some ( hash) ) . await ?;
370- Ok ( ResultOfGetSignatureData {
371- signature : hex:: encode ( & signature) ,
369+ Ok ( ResultOfGetSignatureData {
370+ signature : hex:: encode ( & signature) ,
372371 unsigned : base64:: encode ( & unsigned. unwrap ( ) ) ,
373372 } )
374373 } else {
375374 Err ( Error :: invalid_message_for_decode (
376375 "The message body is empty" ,
377376 ) )
378377 }
379- }
378+ }
0 commit comments