# @gimmixorg/use-wallet

> An easy-to-integrate React hook for connecting and interacting with a Web 3 wallet.

Latest version **0.0.31** (published 2021-12-28) · 0 weekly downloads

## Install

```sh
npm install @gimmixorg/use-wallet
pnpm add @gimmixorg/use-wallet
yarn add @gimmixorg/use-wallet
bun add @gimmixorg/use-wallet
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.31 |
| Published | 2021-12-28 |
| First published | 2021-07-28 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 208.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | shahruz |

## Links

- npm: https://www.npmjs.com/package/@gimmixorg/use-wallet
- npm.io page: https://npm.io/package/@gimmixorg/use-wallet

## Dependencies (3)

- [zustand](https://npm.io/package/zustand.md) ^3.5.5
- [web3modal](https://npm.io/package/web3modal.md) ^1.9.3
- [@ethersproject/providers](https://npm.io/package/@ethersproject/providers.md) ^5.4.1

## Recent versions

- 0.0.31 (latest) — 2021-12-28
- 0.0.30 — 2021-11-03
- 0.0.28 — 2021-10-25
- 0.0.27 — 2021-10-25
- 0.0.26 — 2021-10-25
- 0.0.25 — 2021-07-28

## README

# ✵ useWallet ✵

An easy-to-integrate React hook for connecting and interacting with a Web 3 wallet.

Uses [Web3Modal](https://github.com/Web3Modal/web3modal) and [Zustand](https://github.com/pmndrs/zustand).

### Example Connect / Disconnect button

```
const ConnectWalletButton = () => {
  const { account, connect, disconnect } = useWallet();
  return <>
      {!account ? (
        <button onClick={() => connect()}>Connect Wallet</button>
      ) : (
        <button onClick={() => disconnect()}>Disconnect Wallet</button>
      )}
    </>;
}
```

The `connect` function passes along an optional config to a [Web3Modal instance for additional customization](https://github.com/Web3Modal/web3modal#usage).

You can use the account information from useWallet anywhere inside your React app, without any extra set up.

```
const UserAddress = () => {
  const { account } = useWallet();
  if (!account) return null;
  return <>{account}</>;
}

```

To run a transaction or sign a message, use the `provider` object returned by the hook for connected wallets. This is a standard [Ethers.js Provider](https://docs.ethers.io/v5/api/providers/provider/).

```
const SignMessageButton = () => {
  const { account, provider } = useWallet();
  if (!account) return null;
  const signMessage = async () => {
    const signature = await provider.getSigner().signMessage("Hello!");
    console.log(signature);
  }
  return <button onClick={signMessage}>Sign Message</>;
}

```

---
_Source: https://npm.io/package/@gimmixorg/use-wallet · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
