Skip to content

feat(graphql): parameterize BigInt on inner type - #298

Open
amnn wants to merge 1 commit into
masterfrom
amnn/bigint
Open

feat(graphql): parameterize BigInt on inner type#298
amnn wants to merge 1 commit into
masterfrom
amnn/bigint

Conversation

@amnn

@amnn amnn commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Description

Previously the SDK assumed all GraphQL BigInt values could fit inside a u64, but this is not the case. GraphQL uses BigInt to represent any integer value that couldn't fit in 53 bits (so doesn't get represented as a JSON number), which means it could be used to represent a u128 or i128 (as in the case of a balance change).

This change parameterizes BigInt with a sealed inner numeric type that defaults to u64 for backwards compatibility.

Test plan

$ cargo nextest run -p sui-graphql -- scalars

## Description

Previously the SDK assumed all GraphQL `BigInt` values could fit inside
a `u64`, but this is not the case. GraphQL uses `BigInt` to represent
any integer value that couldn't fit in 53 bits (so doesn't get
represented as a JSON number), which means it could be used to represent
a `u128` or `i128` (as in the case of a balance change).

This change parameterizes `BigInt` with a sealed inner numeric type that
defaults to `u64` for backwards compatibility.

## Test plan

```
$ cargo nextest run -p sui-graphql -- scalars
```
@amnn amnn self-assigned this Aug 14, 2026
@amnn
amnn requested a review from bmwill as a code owner August 14, 2026 10:54
@amnn
amnn requested a review from tpham-mysten August 14, 2026 10:55

@tpham-mysten tpham-mysten left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @amnn!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants