telescope
telescope copied to clipboard
Invalid string format. Only non-negative integers in decimal representation supported.
Dear Telescope team,
I have the following definition in a proto file:
message QueryOpenEstResponse {
string weight_balance_ratio = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}
The issue that I'm having is that such field can be a negative number as it's allowed in CosmosSDK but since it's decoded using Decimal.fromAtomics after running yarn codegen
:
case 2:
message.weightBalanceRatio = Decimal.fromAtomics(reader.string(), 18).toString();
I get an error trying to decode its value:
Error: Invalid string format. Only non-negative integers in decimal representation supported.
at new Decimal (decimal.js:103:1)
at Decimal.fromAtomics (decimal.js:59:1)
at Object.decode (query.ts:2215:48)
at eval (query.rpc.Query.ts:119:54)
Do you guys have any alternative for this? Thank you