[](https://www.npmjs.com/package/@safe-global/safe-gateway-typescript-sdk)
npm install @safe-global/safe-gateway-typescript-sdk
A TypeScript SDK for the Safe Client Gateway
📖 Type reference  |  CGW Swagger
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.
Install:
``shell`
yarn add @safe-global/safe-gateway-typescript-sdk
Import:
`ts`
import { getChainsConfig, type ChainListResponse } from '@safe-global/safe-gateway-typescript-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 '@safe-global/safe-gateway-typescript-sdk'
// Switch the SDK to dev mode
setBaseUrl('https://safe-client.staging.5afe.dev')
`
The full SDK reference can be found here.
Endpoint types are defined in src/types/gateway.ts.
Each endpoint consists of:
- a function defined in src/index.ts (e.g. getBalances)'/chains/{chainId}/safes/{address}/balances/{currency}/'
- a path definition (e.g. )safes_balances_list
- operation definition (e.g. )
- response definition
To add a new endpoint, follow the pattern set by the existing endpoints.
This command will run before every commit:
`shell`
yarn eslint:fix
To run the unit and e2e tests locally:
`shell``
yarn test
N.B.: the e2e tests make actual API calls on staging.