# @gnosis.pm/safe-react-gateway-sdk

> [![npm](https://img.shields.io/npm/v/@gnosis.pm/safe-react-gateway-sdk?label=%40gnosis.pm%2Fsafe-react-gateway-sdk)](https://www.npmjs.com/package/@gnosis.pm/safe-react-gateway-sdk)

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

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

## Install

```sh
npm install @gnosis.pm/safe-react-gateway-sdk
pnpm add @gnosis.pm/safe-react-gateway-sdk
yarn add @gnosis.pm/safe-react-gateway-sdk
bun add @gnosis.pm/safe-react-gateway-sdk
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.5.2 |
| Published | 2022-12-02 |
| First published | 2021-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 77.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 23 |
| Author | katspaugh |
| Maintainers | mikheevm, katspaugh, dasanra, germartinez |

## Links

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

## Dependencies (1)

- [cross-fetch](https://npm.io/package/cross-fetch.md) ^3.1.5

## Recent versions

- 3.5.2 (latest) — 2022-12-02
- 3.5.1 — 2022-11-29
- 3.5.0 — 2022-11-24
- 3.4.6 — 2022-11-23
- 3.4.5 — 2022-11-02
- 3.4.4 — 2022-11-02
- 3.4.3 — 2022-10-25
- 3.4.2 — 2022-10-14
- 3.4.1 — 2022-09-15
- 3.4.0 — 2022-08-30
- 3.3.5 — 2022-08-08
- 3.3.4 — 2022-08-04
- 3.2.4 — 2022-07-28
- 3.2.3 — 2022-07-26
- 3.2.1 — 2022-07-18
- … 47 more at https://npm.io/package/@gnosis.pm/safe-react-gateway-sdk/versions

## README

# Safe Gateway TypeScript SDK

[![npm](https://img.shields.io/npm/v/@gnosis.pm/safe-react-gateway-sdk?label=%40gnosis.pm%2Fsafe-react-gateway-sdk)](https://www.npmjs.com/package/@gnosis.pm/safe-react-gateway-sdk)

A TypeScript SDK for the [Safe Client Gateway](https://github.com/safe-global/safe-client-gateway)

📖 [API reference](https://safe.global/safe-gateway-typescript-sdk/modules.html)

## Usage policy

NB: Safe Client Gateway isn't meant for public use.
Please _do not_ use this SDK if you're building, e.g., a Safe App.

## Using the SDK

Install:

```shell
yarn add @gnosis.pm/safe-react-gateway-sdk
```

Import:

```ts
import { getChainsConfig, type ChainListResponse } from '@gnosis.pm/safe-react-gateway-sdk'
```

Use:

```ts
const chains = await getChainsConfig()
```

The SDK needs no initialization unless you want to override the base URL. You can set an alternative base URL like so:

```ts
import { setBaseUrl } from '@gnosis.pm/safe-react-gateway-sdk'

// Switch the SDK to dev mode
setBaseUrl('https://safe-client.staging.5afe.dev')
```

The full SDK reference can be found [here](https://safe.global/safe-gateway-typescript-sdk/modules.html).

## Adding an endpoint

Endpoint types are defined in `src/types/gateway.ts`.

Each endpoint consists of:

- a function defined in `src/index.ts` (e.g. `getBalances`)
- a path definition (e.g. `'/chains/{chainId}/safes/{address}/balances/{currency}/'`)
- operation definition (e.g. `safes_balances_list`)
- response definition

To add a new endpoint, follow the pattern set by the existing endpoints.

## Eslint & prettier

This command will run before every commit:

```shell
yarn eslint:fix
```

## Tests

To run the unit and e2e tests locally:

```shell
yarn test
```

N.B.: the e2e tests make actual API calls on staging.

## Gateway API docs

The TypeScript types in this SDK are based on [Rust types](https://safe-global.github.io/safe-client-gateway/docs/routes/index.html) from the Gateway API.

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