# @gnosis.pm/safe-apps-provider

> A provider wrapper of Safe Apps SDK

Latest version **0.15.1** (published 2022-12-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gnosis.pm/safe-apps-provider
pnpm add @gnosis.pm/safe-apps-provider
yarn add @gnosis.pm/safe-apps-provider
bun add @gnosis.pm/safe-apps-provider
```

## Health

**Score 35/100 (D)** — status: abandoned.

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.15.1 |
| Published | 2022-12-02 |
| First published | 2021-03-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 29.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 328 |
| Author | Gnosis |
| Maintainers | mikheevm, katspaugh, dasanra, germartinez |

## Links

- npm: https://www.npmjs.com/package/@gnosis.pm/safe-apps-provider
- Repository: https://github.com/gnosis/safe-apps-sdk
- Homepage: https://github.com/gnosis/safe-apps-sdk#readme
- Issues: https://github.com/gnosis/safe-apps-sdk/issues
- npm.io page: https://npm.io/package/@gnosis.pm/safe-apps-provider

## Dependencies (2)

- [events](https://npm.io/package/events.md) ^3.3.0
- [@gnosis.pm/safe-apps-sdk](https://npm.io/package/@gnosis.pm/safe-apps-sdk.md) 7.8.0

## Recent versions

- 0.15.1 (latest) — 2022-12-02
- 0.8.1-next.1 (next) — 2021-10-22
- 0.15.0 — 2022-11-30
- 0.14.0 — 2022-10-10
- 0.13.2 — 2022-09-16
- 0.13.1 — 2022-09-01
- 0.13.0 — 2022-08-25
- 0.12.0 — 2022-07-28
- 0.11.3 — 2022-07-06
- 0.11.2 — 2022-06-30
- 0.11.1 — 2022-06-20
- 0.11.0 — 2022-03-14
- 0.10.3 — 2022-03-08
- 0.10.2 — 2022-03-07
- 0.10.1 — 2022-02-11
- … 26 more at https://npm.io/package/@gnosis.pm/safe-apps-provider/versions

## README

# Safe Apps Provider

[![npm](https://img.shields.io/npm/v/@gnosis.pm/safe-apps-provider)](https://www.npmjs.com/package/@gnosis.pm/safe-apps-provider)

This is a provider that follows common standards (e.g. [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193)) and can be used with various Web3 libraries (e.g. web3.js or Ethers)

### How to use

- Add npm package

```bash
yarn add @gnosis.pm/safe-apps-provider

npm i @gnosis.pm/safe-apps-provider
```

### SafeAppProvider

The provider can be used with the [safe-apps-react-sdk](https://github.com/gnosis/safe-apps-sdk/tree/master/packages/safe-apps-react-sdk) and common web3 libraries.

#### With Ethers.js

- [Ethers.js](https://docs.ethers.io/v5/api/providers/other/#Web3Provider)

```js
import React, { useMemo } from 'react';
import { ethers } from 'ethers';
import { useSafeAppsSDK } from '@gnosis.pm/safe-apps-react-sdk';
import { SafeAppProvider } from '@gnosis.pm/safe-apps-provider';

const App = () => {
  const { sdk, safe } = useSafeAppsSDK();
  const web3Provider = useMemo(() => new ethers.providers.Web3Provider(new SafeAppProvider(safe, sdk)), [sdk, safe]);

  // use provider with contracts

  return;
};

export default App;
```

#### With web3.js

- [web3.js](https://web3js.readthedocs.io/en/v1.5.2/web3.html)

```js
import React, { useMemo } from 'react';
import Web3 from 'web3';
import { useSafeAppsSDK } from '@gnosis.pm/safe-apps-react-sdk';
import { SafeAppProvider } from '@gnosis.pm/safe-apps-provider';

const App = () => {
  const { sdk, safe } = useSafeAppsSDK();
  const web3Provider = useMemo(() => new Web3(new SafeAppProvider(safe, sdk)), [sdk, safe]);

  // use provider with contracts

  return;
};

export default App;
```

### A note on gas limit
The ethereum transaction gas limit passed to the safe-apps-provider will be treated as safeTxGas, which is an equivalent of the ethereum transaction gas limit in the Safe context. To learn more about the safe transaction gas, read here:  
https://github.com/safe-global/safe-contracts/blob/c36bcab46578a442862d043e12a83fec41143dec/docs/safe_tx_gas.md  

If you don't want to pass a calculation and leave it to the Safe, pass 0 as the gas limit.

### More scenarios

For the SDK overview documentation, please refer to the [safe-apps-sdk](https://github.com/gnosis/safe-apps-sdk/) documentation

---
_Source: https://npm.io/package/@gnosis.pm/safe-apps-provider · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
