@@ -5,7 +5,7 @@ use std::convert::TryFrom;
55use crate :: {
66 error:: RadError ,
77 hash_functions:: { self , RadonHashFunctions } ,
8- operators,
8+ operators:: decode_single_arg ,
99 types:: {
1010RadonType ,
1111 bytes:: { RadonBytes , RadonBytesEncoding , RadonBytesEndianness } ,
@@ -86,10 +86,8 @@ pub fn slice(input: &RadonBytes, args: &[Value]) -> Result<RadonBytes, RadError>
8686}
8787
8888pub fn to_integer ( input : & RadonBytes , args : & Option < Vec < Value > > ) ->Result < RadonInteger , RadError > {
89- let endianness = operators:: decode_single_arg :: < RadonBytes , u8 , RadonBytesEndianness , _ , _ > (
90- args,
91- "ToInteger" ,
92- ) ?;
89+ let endianness =
90+ decode_single_arg :: < RadonBytes , u8 , RadonBytesEndianness , _ , _ > ( args, 0 , "ToInteger" ) ?;
9391
9492match input. value ( ) . len ( ) {
9593// There is nothing to decode if the input is empty
@@ -122,11 +120,13 @@ pub fn to_string_legacy(input: &RadonBytes) -> Result<RadonString, RadError> {
122120
123121pub fn to_string ( input : & RadonBytes , args : & Option < Vec < Value > > ) ->Result < RadonString , RadError > {
124122let bytes_encoding =
125- operators :: decode_single_arg :: < RadonBytes , u8 , RadonBytesEncoding , _ , _ > ( args, "ToString" ) ?;
123+ decode_single_arg :: < RadonBytes , u8 , RadonBytesEncoding , _ , _ > ( args, 0 , "ToString" ) ?;
126124
127125match bytes_encoding{
128126RadonBytesEncoding :: Hex =>RadonString :: try_from ( Value :: Text ( hex:: encode ( input. value ( ) ) ) ) ,
129- RadonBytesEncoding :: Base58 =>RadonString :: try_from ( Value :: Text ( bs58:: encode ( input. value ( ) ) . into_string ( ) ) ) ,
127+ RadonBytesEncoding :: Base58 =>{
128+ RadonString :: try_from ( Value :: Text ( bs58:: encode ( input. value ( ) ) . into_string ( ) ) )
129+ }
130130RadonBytesEncoding :: Base64 =>RadonString :: try_from ( Value :: Text (
131131 base64:: engine:: general_purpose:: STANDARD . encode ( input. value ( ) ) ,
132132) ) ,