Skip to content

Commit e97b025

Browse files
committed
Update to protos with signed int support
1 parent 9bee2f6 commit e97b025

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

aptos-indexer-processors-sdk/Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aptos-indexer-processors-sdk/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ sample = { path = "sample" }
2727

2828
ahash = { version = "0.8.7", features = ["serde"] }
2929
anyhow = "1.0.98"
30-
aptos-protos = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "2c0d9dd8fd1c27c10bc264a66917d86e8b0467b5" }
31-
aptos-system-utils = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "2c0d9dd8fd1c27c10bc264a66917d86e8b0467b5" }
32-
aptos-transaction-filter = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "2c0d9dd8fd1c27c10bc264a66917d86e8b0467b5" }
30+
aptos-protos = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "e42fe0034c33da113817f53b49c634af7cb32dec" }
31+
aptos-system-utils = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "e42fe0034c33da113817f53b49c634af7cb32dec" }
32+
aptos-transaction-filter = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "e42fe0034c33da113817f53b49c634af7cb32dec" }
3333
async-trait = "0.1.80"
3434
autometrics = { version = "1.0.1", features = ["prometheus-exporter"] }
3535
axum = "0.7.5"

aptos-indexer-processors-sdk/sdk/src/utils/convert.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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> {
138147
pub 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()),

examples/Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)