# @safe-global/safe-ethers-lib

> Ethers library adapter to be used by Safe Core SDK

Latest version **1.9.4** (published 2023-07-03) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @safe-global/safe-ethers-lib
pnpm add @safe-global/safe-ethers-lib
yarn add @safe-global/safe-ethers-lib
bun add @safe-global/safe-ethers-lib
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.9.4 |
| Published | 2023-07-03 |
| First published | 2022-11-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 748.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 323 |
| Author | Safe |
| Maintainers | germartinez, dasanra |
| Keywords | Ethereum, Safe, SDK, Ethers |

## Links

- npm: https://www.npmjs.com/package/@safe-global/safe-ethers-lib
- Repository: https://github.com/safe-global/safe-core-sdk
- Homepage: https://github.com/safe-global/safe-core-sdk#readme
- Issues: https://github.com/safe-global/safe-core-sdk/issues
- npm.io page: https://npm.io/package/@safe-global/safe-ethers-lib

## Dependencies (3)

- [ethers](https://npm.io/package/ethers.md) 5.7.2
- [@safe-global/safe-core-sdk-types](https://npm.io/package/@safe-global/safe-core-sdk-types.md) ^1.9.2
- [@safe-global/safe-core-sdk-utils](https://npm.io/package/@safe-global/safe-core-sdk-utils.md) ^1.7.4

## Recent versions

- 1.9.4 (latest) — 2023-07-03
- 1.9.3 — 2023-04-26
- 1.9.2 — 2023-02-23
- 1.9.1 — 2023-01-26
- 1.9.0 — 2023-01-23
- 1.8.0 — 2022-12-20
- 1.7.0 — 2022-11-28

## README

# Safe Ethers Lib

[![NPM Version](https://badge.fury.io/js/%40safe-global%2Fsafe-ethers-lib.svg)](https://badge.fury.io/js/%40safe-global%2Fsafe-ethers-lib)
[![GitHub Release](https://img.shields.io/github/release/safe-global/safe-core-sdk.svg?style=flat)](https://github.com/safe-global/safe-core-sdk/releases)
[![GitHub](https://img.shields.io/github/license/safe-global/safe-core-sdk)](https://github.com/safe-global/safe-core-sdk/blob/main/LICENSE.md)

Ethers.js wrapper that contains some utilities and the Safe contracts types (generated with typechain ethers-v5). It is used to initialize the [Safe Core SDK](https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-core-sdk).

## Table of contents
* [Installation](#installation)
* [Build](#build)
* [Initialization](#initialization)
* [License](#license)
* [Contributors](#contributors)

## <a name="installation">Installation</a>

Install the package with yarn or npm:

```bash
yarn install
npm install
```

## <a name="build">Build</a>

Build the package with yarn or npm:

```bash
yarn build
npm build
```

## <a name="initialization">Initialization</a>

If the app integrating the SDK is using `Ethers` `v5`, create an instance of the `EthersAdapter`, where `signer` is the Ethereum account we are connecting and the one who will sign the transactions.

```js
import { ethers } from 'ethers'
import EthersAdapter from '@safe-global/safe-ethers-lib'

const web3Provider = // ...
const provider = new ethers.providers.Web3Provider(web3Provider)
const safeOwner = provider.getSigner(0)

const ethAdapter = new EthersAdapter({
  ethers,
  signerOrProvider: safeOwner
})
```

Depending on whether the `ethAdapter` instance is used to sign/execute transactions or just call read-only methods, the `signerOrProvider` property can be a `Signer` or a `Provider`.

## <a name="license">License</a>

This library is released under MIT.

## <a name="contributors">Contributors</a>

- Germán Martínez ([germartinez](https://github.com/germartinez))

---
_Source: https://npm.io/package/@safe-global/safe-ethers-lib · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
