Socket
Socket
Sign inDemoInstall

@safe-global/safe-gateway-typescript-sdk

Package Overview
Dependencies
0
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @safe-global/safe-gateway-typescript-sdk

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


Version published
Maintainers
2
Install size
121 kB
Created

Readme

Source

Safe Gateway TypeScript SDK

npm

A TypeScript SDK for the Safe Client Gateway

📖 Type reference   |   Swagger CGW Swagger

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:

yarn add @safe-global/safe-gateway-typescript-sdk

Import:

import { getChainsConfig, type ChainListResponse } from '@safe-global/safe-gateway-typescript-sdk'

Use:

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:

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.

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:

yarn eslint:fix

Tests

To run the unit and e2e tests locally:

yarn test

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

FAQs

Last updated on 26 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc