# @safe-global/safe-apps-provider

> A provider wrapper of Safe Apps SDK

Latest version **0.18.6** (published 2025-03-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @safe-global/safe-apps-provider
pnpm add @safe-global/safe-apps-provider
yarn add @safe-global/safe-apps-provider
bun add @safe-global/safe-apps-provider
```

## Health

**Score 50/100 (C)** — status: stable.

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

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

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.18.6 |
| Published | 2025-03-26 |
| First published | 2023-01-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 45.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 332 |
| Author | Safe |
| Maintainers | dasanra, germartinez, yagopv, daniel.somoza, iamacook |

## Links

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

## Dependencies (2)

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

## Recent versions

- 0.18.6 (latest) — 2025-03-26
- 0.18.1-next.0 (next) — 2023-08-25
- 0.18.5 — 2024-12-02
- 0.18.4 — 2024-11-06
- 0.18.3 — 2024-06-12
- 0.18.2 — 2024-01-09
- 0.18.1 — 2023-12-11
- 0.18.0 — 2023-08-10
- 0.17.1 — 2023-06-23
- 0.17.0 — 2023-05-04
- 0.16.0 — 2023-02-14
- 0.15.2 — 2023-01-26

## README

# Safe Apps Provider

[![npm](https://img.shields.io/npm/v/@safe-global/safe-apps-provider)](https://www.npmjs.com/package/@safe-global/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 @safe-global/safe-apps-provider

npm i @safe-global/safe-apps-provider
```

### SafeAppProvider

The provider can be used with the [safe-apps-react-sdk](https://github.com/safe-global/safe-apps-sdk/tree/main/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 '@safe-global/safe-apps-react-sdk';
import { SafeAppProvider } from '@safe-global/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 '@safe-global/safe-apps-react-sdk';
import { SafeAppProvider } from '@safe-global/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/safe-global/safe-apps-sdk/) documentation

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