Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiP: Dogmi fee demo #5313

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions frontend/src/lib/utils/sns-aggregator-converters.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
});
Expand Down
5 changes: 5 additions & 0 deletions rs/sns_aggregator/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Loading