-
Notifications
You must be signed in to change notification settings - Fork 44
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
Native support for data type of BigInt
#90
Comments
Note that true |
Yeah, I'm a bit hessitent to enforce BigInt just yet. There's good but not enough support for all users, yet. We use JSBI to represent BigInt in our dApps, which I think would be a great middle ground. |
Available in the latest release! |
@ardatan Is there some way to disable this? We don't use native bigint for a few reasons, one being that we aren't able to serialize it, and do a lot of SSR. We use JSBI in our SDKs also to provide maximum browser coverage. This is a bit of a pain for us atm and preventing updating. |
Worked around for now, but would be nice if we were able to transform BigInt & BigDecimal ourselves, depending on needs. |
@matthewlilley Graph Client uses |
@ardatan I'm unable to build with type safety enabled now. If I cast to BigInt, like so Error: Do not know how to serialize a BigInt |
I think it's bad to assume and even worse enforce that everyone would like native bigint support based on the schema, since the majority of subgraphs written use BigInt for convininance within mappings, not because they want to be parsed as that on the client. And in a case like this it makes even less sense, because it's a timestamp which will never be BigInt, it's a unsigned 32-bit integer... Just for context, this totally breaks Next.js, it makes caching impossible because it expects serializability via JSON.stringify.... this should be opt-in/out, I expect many other frameworks and libraries will suffer from issues with this too. I'm forced to // @ts-ignore in many places or unable to compile. Maybe type BigIntIsh = bigint | number | string makes more sense? It's parsing ERC20 decimals as BigInt too, this is a unsigned 8 bit integer, it makes no sense to ever be represented as a BigInt. This update was also a breaking change, but wasn't versioned this way. |
Agree with @matthewlilley, often users will use BigInt simply for convenience / as a default, and users don't expect the native type |
To contiue this conversation, we plan to eventually migrate to native bigint, but given the speed at which we can iterate subgraphs this would need to happen over a long time period, so support for incremental adoption of native bigint , or other transforms is critical. |
No description provided.
The text was updated successfully, but these errors were encountered: