# @wen-tools/actions

> The engine behind all the wen tools

Latest version **1.1.0** (published 2022-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wen-tools/actions
pnpm add @wen-tools/actions
yarn add @wen-tools/actions
bun add @wen-tools/actions
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2022-08-09 |
| First published | 2022-08-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 83.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Gui Bibeau |
| Maintainers | gbibeaulaviolette |
| Keywords | react, typescript, rollup, metamask |

## Links

- npm: https://www.npmjs.com/package/@wen-tools/actions
- npm.io page: https://npm.io/package/@wen-tools/actions

## Dependencies (1)

- [valtio](https://npm.io/package/valtio.md) ^1.6.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2022-08-09
- 1.10.0-beta.2 — 2022-08-08
- 1.10.0-beta.1 — 2022-08-08
- 1.10.0-beta.0 — 2022-08-08

## README

# Wen Actions

**Wen Tools are under heavy development**

Straight forward, batteries includes utilities to build dapps.

_For turnkey connect component see: [Wen React](/packages/@wen-tools/react)_

## Getting started

Wen Actions depends on no other libraries to get started. It can completely be used as a standalone library but it works well with ethers.jsx

```sh
npm i @wen-tools/actions
# or
yarn add @wen-tools/actions
# or
pnpm i @wen-tools/actions
```

## Interacting with a user's wallet

All functions are asynchronous.

```jsx
import { connectWallet, changeChain } from "@wen-tools/actions";

// request a connection
connectWallet();
// request the user to change to ethereum
changeChain("0x1");
```

## Reading data from the user's wallet

Wen Actions support both vanilla js and react.

### JS/TS

A readonly proxy object is exposed to work.

```ts
import { state } from "@wen-tools/actions";

// state is an instance of State
type State = {
  metamaskPresent: Promise<boolean>;
  address: string | null;
  balance: string | null;
  connected: boolean;
  chainId: string | null;
  // anytime the state is waiting on an updte from metamask, requesting is true
  requesting: boolean;
};
```

### React

For reactive updates use the React hook. It exposes the same state as the vanilla js/ts proxy object.

```tsx
import { useWen } from "@wen-tools/react";

export default function Home() {
  // anytime the state is waiting on an updte from metamask, requesting is true
  const { address, balance, connected, chainId, requesting } = useWen();
  return <div>{address}</div>;
}
```

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