Skip to content

Commit

Permalink
chore: update viem
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Dec 6, 2023
1 parent faa7b39 commit 3d80bef
Show file tree
Hide file tree
Showing 28 changed files with 63 additions and 56 deletions.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"abitype": "*",
"react": "^18.2.0",
"unocss": "^0.53.6",
"viem": "2.0.0-beta.6",
"viem": "2.0.0-beta.9",
"vite": "^4.4.9",
"vitepress": "1.0.0-rc.20",
"vitepress-plugin-shiki-twoslash": "^0.0.6",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"rimraf": "^4.4.1",
"simple-git-hooks": "^2.9.0",
"typescript": "5.1.6",
"viem": "2.0.0-beta.6",
"viem": "2.0.0-beta.9",
"vitest": "^0.34.5"
},
"packageManager": "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"pathe": "^1.1.1",
"picocolors": "^1.0.0",
"prettier": "^3.0.3",
"viem": "2.0.0-beta.6",
"viem": "2.0.0-beta.9",
"zod": "^3.22.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"peerDependencies": {
"@wagmi/core": "workspace:*",
"typescript": ">=5.0.4",
"viem": "2.0.0-beta.6"
"viem": "2.0.0-beta.9"
},
"peerDependenciesMeta": {
"typescript": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"peerDependencies": {
"@tanstack/query-core": ">=5.0.0",
"typescript": ">=5.0.4",
"viem": "2.0.0-beta.6"
"viem": "2.0.0-beta.9"
},
"peerDependenciesMeta": {
"@tanstack/query-core": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/connect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test('behavior: user rejected request', async () => {
[UserRejectedRequestError: User rejected the request.
Details: Failed to connect.
Version: [email protected].6]
Version: [email protected].9]
`)
})

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/estimateGas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type EstimateGasParameters<
chains extends readonly Chain[] = SelectChains<config, chainId>,
> = {
[key in keyof chains]: UnionEvaluate<
UnionLooseOmit<viem_EstimateGasParameters<chains[key], Account>, 'chain'> &
UnionLooseOmit<viem_EstimateGasParameters<chains[key]>, 'chain'> &
ChainIdParameter<config, chainId> &
ConnectorParameter
>
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/actions/getBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { type Config } from '../createConfig.js'
import type { SelectChains } from '../types/chain.js'
import { type ChainIdParameter } from '../types/properties.js'
import { type Evaluate } from '../types/utils.js'
import { type Evaluate, type IsNarrowable } from '../types/utils.js'

export type GetBlockParameters<
includeTransactions extends boolean = false,
Expand All @@ -32,7 +32,7 @@ export type GetBlockReturnType<
> = Evaluate<
{
[key in keyof chains]: viem_GetBlockReturnType<
chains[key],
IsNarrowable<chains[key], Chain> extends true ? chains[key] : undefined,
includeTransactions,
blockTag
>
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getToken.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ test('behavior: bogus token', async () => {
function: decimals()
Docs: https://viem.sh/docs/contract/multicall.html
Version: [email protected].6"
Version: [email protected].9"
`)
})
6 changes: 4 additions & 2 deletions packages/core/src/actions/getTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { type Config } from '../createConfig.js'
import type { SelectChains } from '../types/chain.js'
import { type ChainIdParameter } from '../types/properties.js'
import { type Evaluate } from '../types/utils.js'
import { type Evaluate, type IsNarrowable } from '../types/utils.js'

export type GetTransactionParameters<
config extends Config = Config,
Expand All @@ -23,7 +23,9 @@ export type GetTransactionReturnType<
chains extends readonly Chain[] = SelectChains<config, chainId>,
> = Evaluate<
{
[key in keyof chains]: viem_GetTransactionReturnType<chains[key]>
[key in keyof chains]: viem_GetTransactionReturnType<
IsNarrowable<chains[key], Chain> extends true ? chains[key] : undefined
>
}[number]
>

Expand Down
16 changes: 8 additions & 8 deletions packages/core/src/actions/readContracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ test('throws if allowFailure=false & a contract method fails', async () => {
args: (0xA0Cf798816D4b9b9866b5330EEa46a18382f251e, 69420)
Docs: https://viem.sh/docs/contract/readContract.html
Version: [email protected].6"
Version: [email protected].9"
`,
)
})
Expand Down Expand Up @@ -450,7 +450,7 @@ test('allowFailure=true & a contract method fails', async () => {
args: (0xA0Cf798816D4b9b9866b5330EEa46a18382f251e, 69420)
Docs: https://viem.sh/docs/contract/readContract.html
Version: [email protected].6],
Version: [email protected].9],
"result": undefined,
"status": "failure",
},
Expand All @@ -464,7 +464,7 @@ test('allowFailure=true & a contract method fails', async () => {
args: (0xA0Cf798816D4b9b9866b5330EEa46a18382f251e, 69421)
Docs: https://viem.sh/docs/contract/readContract.html
Version: [email protected].6],
Version: [email protected].9],
"result": undefined,
"status": "failure",
},
Expand Down Expand Up @@ -502,7 +502,7 @@ test('throws if allowFailure=false & encoding contract function data fails', asy
args: (1e+31)
Docs: https://viem.sh/docs/contract/readContract.html
Version: [email protected].6"
Version: [email protected].9"
`,
)
})
Expand Down Expand Up @@ -561,7 +561,7 @@ test('allowFailure=true & encoding contract function data fails', async () => {
args: (1e+31)
Docs: https://viem.sh/docs/contract/readContract.html
Version: [email protected].6],
Version: [email protected].9],
"result": undefined,
"status": "failure",
},
Expand All @@ -579,7 +579,7 @@ test('allowFailure=true & encoding contract function data fails', async () => {
args: (1e+31)
Docs: https://viem.sh/docs/contract/readContract.html
Version: [email protected].6],
Version: [email protected].9],
"result": undefined,
"status": "failure",
},
Expand Down Expand Up @@ -617,7 +617,7 @@ test('should throw if allowFailure=false & a contract has no response', async ()
args: (0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC)
Docs: https://viem.sh/docs/contract/readContract.html
Version: [email protected].6"
Version: [email protected].9"
`,
)
})
Expand Down Expand Up @@ -669,7 +669,7 @@ test('allowFailure=true & a contract has no response', async () => {
args: (0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC)
Docs: https://viem.sh/docs/contract/readContract.html
Version: [email protected].6],
Version: [email protected].9],
"result": undefined,
"status": "failure",
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/signMessage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test('behavior: user rejected request', async () => {
[UserRejectedRequestError: User rejected the request.
Details: Failed to sign message.
Version: [email protected].6]
Version: [email protected].9]
`)
await disconnect(config, { connector: connector_ })
})
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/signTypedData.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test('behavior: user rejected request', async () => {
[UserRejectedRequestError: User rejected the request.
Details: Failed to sign typed data.
Version: [email protected].6]
Version: [email protected].9]
`)
await disconnect(config, { connector: connector_ })
})
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/switchChain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test('behavior: user rejected request', async () => {
[UserRejectedRequestError: User rejected the request.
Details: Failed to switch chain.
Version: [email protected].6]
Version: [email protected].9]
`)
await disconnect(config, { connector: connector_ })
})
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/actions/waitForTransactionReceipt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { type Config } from '../createConfig.js'
import type { SelectChains } from '../types/chain.js'
import { type ChainIdParameter } from '../types/properties.js'
import { type Evaluate } from '../types/utils.js'
import { type Evaluate, type IsNarrowable } from '../types/utils.js'

export type WaitForTransactionReceiptParameters<
config extends Config = Config,
Expand All @@ -28,7 +28,9 @@ export type WaitForTransactionReceiptReturnType<
chains extends readonly Chain[] = SelectChains<config, chainId>,
> = Evaluate<
{
[key in keyof chains]: viem_WaitForTransactionReceiptReturnType<chains[key]>
[key in keyof chains]: viem_WaitForTransactionReceiptReturnType<
IsNarrowable<chains[key], Chain> extends true ? chains[key] : undefined
>
}[number]
>

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/actions/watchBlocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
ChainIdParameter,
SyncConnectedChainParameter,
} from '../types/properties.js'
import type { UnionEvaluate } from '../types/utils.js'
import type { IsNarrowable, UnionEvaluate } from '../types/utils.js'

export type WatchBlocksParameters<
includeTransactions extends boolean = false,
Expand All @@ -28,7 +28,7 @@ export type WatchBlocksParameters<
? WebSocketTransport
: transport
: WebSocketTransport,
chains[key],
IsNarrowable<chains[key], Chain> extends true ? chains[key] : undefined,
includeTransactions,
blockTag
> &
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/actions/writeContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
} from './getConnectorClient.js'
import {
type SimulateContractErrorType,
type SimulateContractParameters,
simulateContract,
} from './simulateContract.js'

Expand Down Expand Up @@ -106,7 +105,7 @@ export async function writeContract<
else {
const { request: simulateRequest } = await simulateContract(
config,
rest as SimulateContractParameters,
rest as any,
)
request = simulateRequest
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/query/getBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function getBlockQueryOptions<
async queryFn({ queryKey }) {
const { scopeKey: _, ...parameters } = queryKey[1]
const block = await getBlock(config, parameters)
return block ?? null
return (block ?? null) as any
},
queryKey: getBlockQueryKey(options),
} as const satisfies QueryOptions<
Expand Down
2 changes: 1 addition & 1 deletion packages/create-wagmi/templates/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"next": "13.5.3",
"viem": "2.0.0-beta.6",
"viem": "2.0.0-beta.9",
"wagmi": "2.0.0-beta.5"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-wagmi/templates/vite-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@tanstack/react-query": "5.0.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"viem": "2.0.0-beta.6",
"viem": "2.0.0-beta.9",
"wagmi": "2.0.0-beta.5"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-wagmi/templates/vite-vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@wagmi/core": "2.0.0-beta.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"viem": "2.0.0-beta.6"
"viem": "2.0.0-beta.9"
},
"devDependencies": {
"buffer": "^6.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@tanstack/react-query": ">=5.0.0",
"react": ">=18",
"typescript": ">=5.0.4",
"viem": "2.0.0-beta.6"
"viem": "2.0.0-beta.9"
},
"peerDependenciesMeta": {
"typescript": {
Expand Down
2 changes: 1 addition & 1 deletion packages/register-tests/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dependencies": {
"@tanstack/react-query": "5.0.5",
"react": "^18.2.0",
"viem": "2.0.0-beta.6",
"viem": "2.0.0-beta.9",
"wagmi": "workspace:*"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"react": ">=18",
"react-dom": ">=18",
"typescript": ">=5.0.4",
"viem": "2.0.0-beta.6",
"viem": "2.0.0-beta.9",
"wagmi": "workspace:*"
},
"peerDependenciesMeta": {
Expand Down
2 changes: 1 addition & 1 deletion playgrounds/vite-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@wagmi/core": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"viem": "2.0.0-beta.6"
"viem": "2.0.0-beta.9"
},
"devDependencies": {
"@types/react": "^18.2.23",
Expand Down
2 changes: 1 addition & 1 deletion playgrounds/vite-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"idb-keyval": "^6.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"viem": "2.0.0-beta.6",
"viem": "2.0.0-beta.9",
"wagmi": "workspace:*"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion playgrounds/vite-ssr-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"react-dom": "^18.2.0",
"sirv": "^2.0.3",
"ts-node": "^10.9.1",
"viem": "2.0.0-beta.6",
"viem": "2.0.0-beta.9",
"vike": "^0.4.142",
"vite": "^4.4.9",
"wagmi": "workspace:*"
Expand Down
Loading

0 comments on commit 3d80bef

Please sign in to comment.