You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the osmojs library parses a date object to a timestamp on the accountLockedPastTimeDenom rpc method, an error is generated within a osmojs helper function due to a floating point number being passed to a BigInt().
Test case
Here is a simple testcase equating to the following osmoisd call
RangeError: The number 1691405445.575 cannot be converted to a BigInt because it is not an integer
at BigInt (<anonymous>)
at numberToLong (/node_modules/osmojs/src/codegen/helpers.ts:256:10)
at toTimestamp (/node_modules/osmojs/src/codegen/helpers.ts:215:19)
at Object.encode (/node_modules/osmojs/src/codegen/osmosis/lockup/query.ts:1827:35)
at QueryClientImpl.accountLockedPastTimeDenom (/node_modules/osmojs/src/codegen/osmosis/lockup/query.rpc.Query.ts:123:52)
at Object.accountLockedPastTimeDenom (/node_modules/osmojs/src/codegen/osmosis/lockup/query.rpc.Query.ts:212:27)
at main (/src/bug.ts:14:47)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
The argument to the numberToLong function divides date.getTime() by 1_000 and eventually passing this to BigInt() causes an error. This can also be seen in the console
let d = new Date();
d.getTime();
1691405875895
d.getTime() / 1_000
1691405875.895
BigInt(d.getTime()) // works
1691405875895n
BigInt(d.getTime() / 1_000) // fails
Uncaught RangeError: 1691405875.895 can't be converted to BigInt because it isn't an integer
I think the helpers file is generated by https://github.com/cosmology-tech/telescope but I am unfamiliar with this project. If you can suggest where to find the generated function I can draft a PR if this is a valid issue.
The text was updated successfully, but these errors were encountered:
When the
osmojs
library parses a date object to a timestamp on theaccountLockedPastTimeDenom
rpc method, an error is generated within a osmojs helper function due to a floating point number being passed to aBigInt()
.Test case
Here is a simple testcase equating to the following
osmoisd
callI think the issue is in this function
The argument to the
numberToLong
function dividesdate.getTime()
by1_000
and eventually passing this to BigInt() causes an error. This can also be seen in the consoleI think the helpers file is generated by https://github.com/cosmology-tech/telescope but I am unfamiliar with this project. If you can suggest where to find the generated function I can draft a PR if this is a valid issue.
The text was updated successfully, but these errors were encountered: