React Components and hooks for interacting with metamask. Built with metamask-ts
@raydeck/usemetamask - v1.2.0
- MetamaskConnected
- MetamaskDisconnected
- MetamaskInstalled
- MetamaskNotInstalled
- MetamaskProvider
- MetamaskWrongChain
▸ useAccount(): string
Returns the current account
Example
import { useAccount } from "@raydeck/usemetamask";
const account = useAccount();
Export
string
string
▸ useAccounts(): string
[]
Returns the current accounts
Example
import { useAccounts } from "@raydeck/usemetamask";
const accounts = useAccounts();
Export
string
[]
string[]
▸ useChainId(): string
Example
import { useChainId } from "@raydeck/usemetamask";
const chainId = useChainId();
Export
string
The current chain ID.
▸ useConnected(): boolean
Returns whether the wallet is connected to this site.
Example
import { useConnected } from "@raydeck/usemetamask";
const connected = useConnected();
Export
boolean
boolean.
▸ useMessage(): ProviderMessage
Returns the current message
Example
import { useMessage } from "@raydeck/usemetamask";
const message = useMessage();
Export
ProviderMessage
ProviderMessage
▸ useReloadOnChainChange(): void
Trigger a window reload when the chain changes. (best practice)
Export
Example
import { useChainChanged } from "@raydeck/usemetamask";
useChainChanged();
void
▸ MetamaskConnected(props
, context?
): null
| ReactElement
<any
, any
>
Name | Type |
---|---|
props |
Object |
props.chainIds? |
string [] |
props.children |
ReactNode |
props.unconnected? |
ReactNode |
context? |
any |
null
| ReactElement
<any
, any
>
▸ MetamaskDisconnected(props
, context?
): null
| ReactElement
<any
, any
>
Name | Type |
---|---|
props |
Object |
props.chainId? |
string |
props.children |
ReactNode |
props.connected? |
ReactNode |
context? |
any |
null
| ReactElement
<any
, any
>
▸ MetamaskInstalled(props
, context?
): null
| ReactElement
<any
, any
>
Name | Type |
---|---|
props |
Object |
props.children |
ReactNode |
context? |
any |
null
| ReactElement
<any
, any
>
▸ MetamaskNotInstalled(props
, context?
): null
| ReactElement
<any
, any
>
Name | Type |
---|---|
props |
Object |
props.children |
ReactNode |
context? |
any |
null
| ReactElement
<any
, any
>
▸ MetamaskProvider(props
, context?
): null
| ReactElement
<any
, any
>
Name | Type |
---|---|
props |
Object |
props.children |
ReactNode |
context? |
any |
null
| ReactElement
<any
, any
>
▸ MetamaskWrongChain(props
, context?
): null
| ReactElement
<any
, any
>
Name | Type |
---|---|
props |
Object |
props.chainIds? |
string [] |
props.children |
ReactNode |
props.unconnected? |
ReactNode |
context? |
any |
null
| ReactElement
<any
, any
>