Skip to content

Commit

Permalink
chore: up viem
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm committed Sep 11, 2023
1 parent 59db684 commit 804d4db
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 80 deletions.
2 changes: 0 additions & 2 deletions docs/.vitepress/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export function getSidebar() {
},
],
},
{ text: 'Constants 🚧', link: '/react/api/constants' },
{
text: 'Hooks 🚧',
collapsed: true,
Expand Down Expand Up @@ -424,7 +423,6 @@ export function getSidebar() {
},
],
},
{ text: 'Constants 🚧', link: '/react/api/constants' },
{ text: 'Errors', link: '/core/api/errors' },
{
text: 'Utilities',
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"rimraf": "^4.4.1",
"simple-git-hooks": "^2.8.1",
"typescript": "5.1.6",
"viem": "0.0.0-alpha-20230908171049",
"viem": "0.0.0-alpha-20230911171150",
"vite": "^4.3.9",
"vitest": "^0.34.1"
},
Expand All @@ -58,7 +58,7 @@
"overrides": {
"@wagmi/connectors": "workspace:*",
"@wagmi/core": "workspace:*",
"viem": "0.0.0-alpha-20230908171049"
"viem": "0.0.0-alpha-20230911171150"
},
"peerDependencyRules": {
"ignoreMissing": [
Expand Down
4 changes: 2 additions & 2 deletions packages/connectors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@
"@safe-global/safe-apps-provider": "^0.18.0",
"@safe-global/safe-apps-sdk": "^8.1.0",
"@walletconnect/ethereum-provider": "^2.10.0",
"@walletconnect/modal": "^2.6.1"
"@walletconnect/modal": "^2.6.2"
},
"devDependencies": {
"@wagmi/core": "workspace:*",
"lokijs": "^1.5.12",
"msw": "^1.2.1"
"msw": "^1.3.0"
},
"contributors": ["jxom.eth <[email protected]>", "awkweb.eth <[email protected]>"],
"funding": [
Expand Down
26 changes: 13 additions & 13 deletions packages/core/src/createConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
type Address,
type Chain,
type Client,
type ClientConfig,
type ClientConfig as viem_ClientConfig,
type Transport,
createClient,
} from 'viem'
Expand All @@ -16,10 +16,14 @@ import {
import { Emitter, type EventData, createEmitter } from './createEmitter.js'
import { type Storage, createStorage, noopStorage } from './createStorage.js'
import { ChainNotConfiguredError } from './errors/config.js'
import type { MultichainValue } from './types/chain.js'
import type { Evaluate, ExactPartial, OneOf } from './types/utils.js'
import type { Evaluate, ExactPartial, Omit, OneOf } from './types/utils.js'
import { uid } from './utils/uid.js'

type ClientConfig = Omit<
viem_ClientConfig,
'account' | 'chain' | 'key' | 'name' | 'transport' | 'type'
>

export type CreateConfigParameters<
chains extends readonly [Chain, ...Chain[]],
transports extends Record<chains[number]['id'], Transport>,
Expand All @@ -31,16 +35,12 @@ export type CreateConfigParameters<
storage?: Storage | null | undefined
syncConnectedChain?: boolean | undefined
} & OneOf<
| {
batch?: MultichainValue<chains, ClientConfig['batch']> | undefined
cacheTime?:
| MultichainValue<chains, ClientConfig['cacheTime']>
| ({ transports: transports } & {
[key in keyof ClientConfig]?:
| ClientConfig[key]
| { [_ in chains[number]['id']]?: ClientConfig[key] | undefined }
| undefined
pollingInterval?:
| MultichainValue<chains, ClientConfig['pollingInterval']>
| undefined
transports: transports
}
})
| {
client(parameters: { chain: chains[number] }): Client<
transports[chains[number]['id']],
Expand Down Expand Up @@ -168,7 +168,7 @@ export function createConfig<
const chainId = chain.id as chains[number]['id']
const getValue = (value: any) =>
typeof value === 'object' ? value[chainId] : value
const batch: ClientConfig['batch'] = rest.batch
const batch = rest.batch
? rest.batch[chainId as keyof typeof rest.batch]
: { multicall: true }
client = createClient({
Expand Down
5 changes: 0 additions & 5 deletions packages/core/src/types/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,3 @@ type HasFormatter<chains extends readonly Chain[]> = chains extends readonly [
? true
: HasFormatter<tail>
: false

export type MultichainValue<
chains extends readonly [Chain, ...Chain[]],
value,
> = value | { [_ in chains[number]['id']]?: value | undefined }
110 changes: 54 additions & 56 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit 804d4db

@vercel
Copy link

@vercel vercel bot commented on 804d4db Sep 11, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

wagmi-v2 – ./docs

wagmi-v2-git-alpha-wagmi-dev.vercel.app
alpha.wagmi.sh
wagmi-v2.vercel.app
wagmi-v2-wagmi-dev.vercel.app

Please sign in to comment.