Skip to content

Commit c52283e

Browse files
Merge pull request #10 from rsksmart/fix/bigint-decoding
Fix BigInt Serialization in Attestation Decoding
2 parents 37c1b87 + 61dafe4 commit c52283e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:18-alpine
1+
FROM node:20-alpine
22
WORKDIR /app
33
ENV NODE_ENV=production
44

utils.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,10 @@ export async function getFormattedAttestationFromLog(
424424
}
425425

426426
const schemaEncoder = new SchemaEncoder(schema.schema);
427-
decodedDataJson = JSON.stringify(schemaEncoder.decodeData(data));
427+
decodedDataJson = JSON.stringify(schemaEncoder.decodeData(data), (_, value) =>
428+
typeof value === "bigint" ? value.toString() : value
429+
);
430+
428431
} catch (error) {
429432
console.log("Error decoding data 53432", error);
430433
}
@@ -876,7 +879,10 @@ export async function updateDbFromEthTransaction(txId: string) {
876879
}
877880

878881
const schemaEncoder = new SchemaEncoder(schema.schema);
879-
decodedDataJson = JSON.stringify(schemaEncoder.decodeData(pkg.sig.message.data));
882+
decodedDataJson = JSON.stringify(schemaEncoder.decodeData(pkg.sig.message.data), (_, value) =>
883+
typeof value === "bigint" ? value.toString() : value
884+
);
885+
880886
} catch (error) {
881887
throw new Error("Error decoding offchain attestation data: " + error);
882888
}

0 commit comments

Comments
 (0)