WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fifty-brooms-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wagmi/core": minor
---

fix bigint serialization error in query keys
4 changes: 3 additions & 1 deletion packages/core/src/query/infiniteReadContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type {
ScopeKeyParameter,
} from '../types/properties.js'
import type { StrictOmit } from '../types/utils.js'
import { serialize } from '../utils/serialize.js'
import type { InfiniteQueryOptions } from './types.js'
import { filterQueryOptions } from './utils.js'

Expand Down Expand Up @@ -109,7 +110,8 @@ export function infiniteReadContractsQueryKey<
RequiredPageParamsParameters<contracts, allowFailure, pageParam>,
) {
const { contracts: _, query: _q, ...parameters } = options
return ['infiniteReadContracts', filterQueryOptions(parameters)] as const
const serialized = JSON.parse(serialize(parameters))
return ['infiniteReadContracts', filterQueryOptions(serialized)] as const
}

export type InfiniteReadContractsQueryKey<
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/query/readContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import type { Config } from '../createConfig.js'
import type { ScopeKeyParameter } from '../types/properties.js'
import type { UnionExactPartial } from '../types/utils.js'
import { serialize } from '../utils/serialize.js'
import { filterQueryOptions } from './utils.js'

export type ReadContractOptions<
Expand Down Expand Up @@ -82,7 +83,8 @@ export function readContractQueryKey<
args extends ContractFunctionArgs<abi, 'pure' | 'view', functionName>,
>(options: ReadContractOptions<abi, functionName, args, config> = {} as any) {
const { abi: _, ...rest } = options
return ['readContract', filterQueryOptions(rest)] as const
const serialized = JSON.parse(serialize(rest))
return ['readContract', filterQueryOptions(serialized)] as const
}

export type ReadContractQueryKey<
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/query/readContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {
ScopeKeyParameter,
} from '../types/properties.js'
import type { ExactPartial } from '../types/utils.js'
import { serialize } from '../utils/serialize.js'
import { filterQueryOptions } from './utils.js'

export type ReadContractsOptions<
Expand Down Expand Up @@ -85,7 +86,10 @@ export function readContractsQueryKey<
for (const contract of (options.contracts ??
[]) as (ContractFunctionParameters & { chainId: number })[]) {
const { abi: _, ...rest } = contract
contracts.push({ ...rest, chainId: rest.chainId ?? options.chainId })
const serialized = JSON.parse(
serialize({ ...rest, chainId: rest.chainId ?? options.chainId }),
)
contracts.push(serialized)
}
return [
'readContracts',
Expand Down