@@ -125,8 +125,17 @@ pub fn convert_bcs_hex(typ: String, value: String) -> Option<String> {
125125 match typ. as_str ( ) {
126126 "0x1::string::String" => bcs:: from_bytes :: < String > ( decoded. as_slice ( ) ) ,
127127 "u8" => bcs:: from_bytes :: < u8 > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
128+ "u16" => bcs:: from_bytes :: < u16 > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
129+ "u32" => bcs:: from_bytes :: < u32 > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
128130 "u64" => bcs:: from_bytes :: < u64 > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
129131 "u128" => bcs:: from_bytes :: < u128 > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
132+ "u256" => bcs:: from_bytes :: < BigDecimal > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
133+ "i8" => bcs:: from_bytes :: < i8 > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
134+ "i16" => bcs:: from_bytes :: < i16 > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
135+ "i32" => bcs:: from_bytes :: < i32 > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
136+ "i64" => bcs:: from_bytes :: < i64 > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
137+ "i128" => bcs:: from_bytes :: < i128 > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
138+ "i256" => bcs:: from_bytes :: < BigDecimal > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
130139 "bool" => bcs:: from_bytes :: < bool > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
131140 "address" => bcs:: from_bytes :: < String > ( decoded. as_slice ( ) ) . map ( |e| format ! ( "0x{e}" ) ) ,
132141 _ => Ok ( value) ,
@@ -138,6 +147,8 @@ pub fn convert_bcs_hex(typ: String, value: String) -> Option<String> {
138147pub fn convert_bcs_hex_new ( typ : u8 , value : String ) -> Option < String > {
139148 let decoded = hex:: decode ( value. strip_prefix ( "0x" ) . unwrap_or ( & * value) ) . ok ( ) ?;
140149
150+ // Signed integers are not supported in token v2 property maps right now:
151+ // https://github.com/aptos-labs/aptos-core/blob/5f5d138562dd0732e14c3e4265d3aa1218144145/aptos-move/framework/aptos-token-objects/sources/property_map.move#L37
141152 match typ {
142153 0 /* bool */ => bcs:: from_bytes :: < bool > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
143154 1 /* u8 */ => bcs:: from_bytes :: < u8 > ( decoded. as_slice ( ) ) . map ( |e| e. to_string ( ) ) ,
0 commit comments