This repository has been archived by the owner on May 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #165 from unicape/1.x
chore: Update dependencies
- Loading branch information
Showing
8 changed files
with
68 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"use-wagmi": patch | ||
--- | ||
|
||
Update dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use client' | ||
|
||
import { | ||
type Config, | ||
type GetChainsReturnType, | ||
type ResolvedRegister, | ||
getChains, | ||
} from '@wagmi/core' | ||
import { watchChains } from '@wagmi/core/internal' | ||
import { type Ref, ref } from 'vue-demi' | ||
|
||
import type { ConfigParameter, MaybeRefDeep } from '../types.js' | ||
import { useConfig } from './useConfig.js' | ||
|
||
export type UseChainsParameters<config extends Config = Config> = MaybeRefDeep< | ||
ConfigParameter<config> | ||
> | ||
|
||
export type UseChainsReturnType<config extends Config = Config> = Ref< | ||
GetChainsReturnType<config> | ||
> | ||
/** https://wagmi.sh/react/api/hooks/useChains */ | ||
export function useChains<config extends Config = ResolvedRegister['config']>( | ||
parameters: UseChainsParameters<config> = {}, | ||
): UseChainsReturnType<config> { | ||
const config = useConfig(parameters) | ||
const chains = ref(getChains(config)) | ||
|
||
watchChains(config, { | ||
onChange () { | ||
chains.value = getChains(config) | ||
} | ||
}) | ||
|
||
return chains | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.