From 3bd9710c248e627ba16469d4c7dae69a75957956 Mon Sep 17 00:00:00 2001 From: Noah Saso Date: Sat, 30 Sep 2023 01:59:26 -0700 Subject: [PATCH] Fix bank balance bigint decoding failure. --- src/scripts/export/handlers/bank.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/scripts/export/handlers/bank.ts b/src/scripts/export/handlers/bank.ts index 9aeef9f5..0955834d 100644 --- a/src/scripts/export/handlers/bank.ts +++ b/src/scripts/export/handlers/bank.ts @@ -114,9 +114,13 @@ export const bank: HandlerMaker = async ({ // Ignore decoding errors. } - // Try to decode as legacy Coin protobuf. + // Try to decode as legacy Coin protobuf, and ensure amount can be parsed + // as a bigint. Otherwise, ignore. The protobuf will decode (and not + // error) if the value is another protobuf, but `amount` will likely + // contain other data instead of a number. There's no way to ensure it's + // actually a coin protobuf, so this is the best we can do. try { - balance = Coin.decode(valueData).amount + balance = BigInt(Coin.decode(valueData).amount).toString() } catch { // Ignore decoding errors. }