# @canvas-js/chain-ethereum-viem

> The Viem Ethereum signer takes a Viem `WalletClient`, or generates a random WalletClient, and uses it to sign a SIWE message authenticating a new session.

Latest version **0.13.14** (published 2025-01-29) · 0 weekly downloads

## Install

```sh
npm install @canvas-js/chain-ethereum-viem
pnpm add @canvas-js/chain-ethereum-viem
yarn add @canvas-js/chain-ethereum-viem
bun add @canvas-js/chain-ethereum-viem
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.13.14 |
| Published | 2025-01-29 |
| First published | 2023-12-19 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 8 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Canvas Technologies, Inc. |
| Maintainers | joelg, raykyri, rjwebb |

## Links

- npm: https://www.npmjs.com/package/@canvas-js/chain-ethereum-viem
- npm.io page: https://npm.io/package/@canvas-js/chain-ethereum-viem

## Dependencies (8)

- [siwe](https://npm.io/package/siwe.md) ^2.3.2
- [viem](https://npm.io/package/viem.md) ^2.15.1
- [multiformats](https://npm.io/package/multiformats.md) ^13.3.1
- [@ipld/dag-json](https://npm.io/package/@ipld/dag-json.md) ^10.2.3
- [@libp2p/logger](https://npm.io/package/@libp2p/logger.md) ^5.1.0
- [@canvas-js/utils](https://npm.io/package/@canvas-js/utils.md) 0.13.14
- [@canvas-js/interfaces](https://npm.io/package/@canvas-js/interfaces.md) 0.13.14
- [@canvas-js/signatures](https://npm.io/package/@canvas-js/signatures.md) 0.13.14

## Recent versions

- 0.13.14 (latest) — 2025-01-29
- 0.14.0-next.2 (next) — 2025-04-09
- 0.10.0-beta.3 (beta) — 2024-06-27
- 0.10.0-alpha.1 (alpha) — 2024-05-21
- 0.8.26-main-488c798d (main) — 2024-02-15
- 0.13.13 — 2025-01-29
- 0.14.0-next.1 — 2025-01-29
- 0.13.12 — 2025-01-23
- 0.13.11 — 2025-01-22
- 0.14.0-next.0 — 2025-01-16
- 0.13.10 — 2025-01-09
- 0.13.9 — 2024-12-17
- 0.13.8-next.1 — 2024-12-14
- 0.13.8-next.0 — 2024-12-13
- 0.13.7 — 2024-12-12
- … 93 more at https://npm.io/package/@canvas-js/chain-ethereum-viem/versions

## README

# @canvas-js/chain-ethereum-viem

The Viem Ethereum signer takes a Viem `WalletClient`, or generates a random WalletClient,
and uses it to sign a SIWE message authenticating a new session.

It also handles verification of messages matching this standard, and can be used in
conjuction with `@canvas-js/chain-ethereum`.

## Table of Contents

- [Installation](#installation)
- [API](#api)

## Installation

```
npm i @canvas-js/chain-ethereum-viem
```

## API

```ts
import { WalletClient } from "viem"
import type { Signature, SessionSigner, Action, Message, Session } from "@canvas-js/interfaces"
import type { SIWESessionData } from "./types.js"
export interface SIWESignerViemInit {
  chainId?: number
  signer?: WalletClient
  sessionDuration?: number
}
export declare class SIWESignerViem implements SessionSigner<SIWESessionData> {
  constructor(init?: SIWESignerViemInit)
  readonly match: (address: string) => boolean
  verifySession(topic: string, session: Session<SIWESessionData>): Promise<void>
  getSession(
    topic: string,
    options?: {
      timestamp?: number
      fromCache?: boolean
    },
  ): Promise<Session<SIWESessionData>>
  sign(message: Message<Action | Session>): Signature
  clear(topic: string): Promise<void>
}
```

---
_Source: https://npm.io/package/@canvas-js/chain-ethereum-viem · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
