diff --git a/frontend/src/lib/utils/sns-aggregator-converters.utils.ts b/frontend/src/lib/utils/sns-aggregator-converters.utils.ts index b10f0c01be5..a57bd810716 100644 --- a/frontend/src/lib/utils/sns-aggregator-converters.utils.ts +++ b/frontend/src/lib/utils/sns-aggregator-converters.utils.ts @@ -279,15 +279,25 @@ const convertDerived = ({ ), }); +const arrayToBigInt = (array: number[]): bigint => { + let result = 0n; + let d = 1n; + for (const num of array) { + result += d * BigInt(num); + d *= 2n ** 32n; + } + return result; +}; + export const convertIcrc1Metadata = ( icrc1Metadata: CachedSnsTokenMetadataDto ): IcrcTokenMetadataResponse => { return icrc1Metadata.map(([key, value]) => { if ("Int" in value) { - return [key, { Int: BigInt(value.Int[0]) }]; + return [key, { Int: arrayToBigInt(value.Int) }]; } if ("Nat" in value) { - return [key, { Nat: BigInt(value.Nat[0]) }]; + return [key, { Nat: arrayToBigInt(value.Nat) }]; } return [key, value]; }); diff --git a/rs/sns_aggregator/src/state.rs b/rs/sns_aggregator/src/state.rs index 4621dc3810f..0da97eaebad 100644 --- a/rs/sns_aggregator/src/state.rs +++ b/rs/sns_aggregator/src/state.rs @@ -182,8 +182,13 @@ impl State { } // Adds an http path for just this SNS. { + ic_cdk::println!("root_canister_str: {root_canister_str}"); let slow_data = SlowSnsData::from(upstream_data); let json_data = serde_json::to_string(&slow_data)?; + if root_canister_str.as_str() == "njmfy-reaaa-aaaaa-qabna-cai" { + ic_cdk::println!("slow_data: {:?}", slow_data); + ic_cdk::println!("json_data: {json_data}"); + } let path = format!("{prefix}/sns/root/{root_canister_str}/slow.json"); let asset = Asset { headers: Vec::new(),