# @safe-global/safe-ethers-adapters

> Safe Ethers Adapters

Latest version **0.1.0-alpha.19** (published 2023-08-17) · MIT license · 0 weekly downloads

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

## Install

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

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.0-alpha.19 |
| Published | 2023-08-17 |
| First published | 2022-11-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 65.7 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 324 |
| Author | Safe |
| Maintainers | germartinez, dasanra |
| Keywords | Ethereum, Safe, Ethers |

## Links

- npm: https://www.npmjs.com/package/@safe-global/safe-ethers-adapters
- 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-adapters

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) ^0.27.2
- [@safe-global/safe-core-sdk](https://npm.io/package/@safe-global/safe-core-sdk.md) ^3.3.5
- [@safe-global/safe-deployments](https://npm.io/package/@safe-global/safe-deployments.md) ^1.25.0
- [@safe-global/safe-core-sdk-types](https://npm.io/package/@safe-global/safe-core-sdk-types.md) ^1.9.2

## Recent versions

- 0.1.0-alpha.19 (latest) — 2023-08-17
- 0.2.0-alpha.0 — 2023-05-04
- 0.1.0-alpha.17 — 2023-04-26
- 0.1.0-alpha.16 — 2023-01-23
- 0.1.0-alpha.15 — 2022-12-20
- 0.1.0-alpha.14 — 2022-12-14
- 0.1.0-alpha.13 — 2022-11-28

## README

# Safe Ethers Adapters

[![NPM Version](https://badge.fury.io/js/%40safe-global%2Fsafe-ethers-adapters.svg)](https://badge.fury.io/js/%40safe-global%2Fsafe-ethers-adapters)
[![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](https://docs.ethers.io/v5/single-page/) adapter that facilitates the interaction with the [Safe Services](https://github.com/safe-global/safe-transaction-service)

## Getting Started

The only adapter currently provided is the `SafeEthersSigner` which implements the [`Signer` interface](https://docs.ethers.io/v5/api/signer/#Signer) from Ethers.

The `SafeEthersSigner` can be used with [Ethers Contracts](https://docs.ethers.io/v5/getting-started/#getting-started--contracts) to deploy and interact with them. Each of these interactions will create a Safe transaction that is published to the [Safe transaction service](https://docs.gnosis.io/safe/docs/services_transactions/). 

For this to work it is required to initialize the `SafeEthersSigner` with an account that is either an owner of the specified Safe or a [delegate](https://docs.gnosis.io/safe/docs/tutorial_tx_service_set_delegate/) of one of the owners.

An example for such an account would be the private key of one of the owners that is used with an [Ethers Wallet](https://docs.ethers.io/v5/api/signer/#Wallet)

```js
const signer = new Wallet("some_private_key", ethereumProvider)
```

It is also necessary to specify a service instance that should be used to publish the Safe transactions. An example for this would be the Mainnet instance of the [Safe Transaction Service](https://safe-transaction-mainnet.safe.global/): `https://safe-transaction-mainnet.safe.global/`

```js
const service = new SafeService("some_service_url")
```

A Safe instance must also be created before obtaining the signer.
It may be obtained with:

```js
import { ethers } from "ethers"
import Safe from "@safe-global/safe-core-sdk"
import EthersAdapter from "@safe-global/safe-ethers-lib"

const safe = await Safe.create({
  ethAdapter: new EthersAdapter({ ethers, signerOrProvider }),
  safeAddress: "some_safe_address"
})
```

Using these components it is possible to create an instance of the `SafeEthersSigner`

```js
const safeSigner = new SafeEthersSigner(safe, service, provider)
```

See [examples](/packages/safe-ethers-adapters/examples) for more information.

## Installation

Select correct nvm version:

```bash
nvm use
```

Install the package with yarn or npm:

```bash
yarn install
npm install
```

## Build

Build the package with yarn or npm:

```bash
yarn build
npm build
```

## License

This library is released under MIT.

## Contributors

- Richard Meisser ([rmeissner](https://github.com/rmeissner))
- Germán Martínez ([germartinez](https://github.com/germartinez))

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