TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

Gateway API SDK

This SDK is a thin wrapper around the Babylon Gateway API. It enables clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers. For simple use cases, you can typically use the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up.


The Gateway API SDK code is released under an Apache 2.0 license. The executable components are licensed under the Radix Software EULA.


There are four sub APIs available in the Gateway API:

  • Status - For status and configuration details for the Gateway / Network.
  • Transaction - For transaction construction, preview, submission, and monitoring the status of an individual transaction.
  • Stream - For reading committed transactions.
  • State - For reading the current or past ledger state of the network.

All APIs generated from OpenAPI specification are available after initialization through innerClient object on corresponding sub-api. See examples in Low Level APIs section. On top of that, this package provides high-level counterparts for each sub api.


All developers looking for an RCnet V3 compatible API should install versions which have -rc.3.X suffix. We'll be publishing internal versions with different suffixes which might not work well with publicly available network. All availble versions are published to NPM repository


Calling static intialize method from GatewayApiClient class will instantiate all low-level APIs together with their high-level equivalents and return them as a single object.

applicationName is required purely for statictis purposes and will be added as a request header. Additional fields you can set up are applicationVersion and applicationDappDefinitionAddress

import { GatewayApiClient } from '@radixdlt/babylon-gateway-api-sdk'

const gatewayApi = GatewayApiClient.initialize({
  basePath: 'https://mainnet.radixdlt.com',
  applicationName: 'Your dApp Name',
const { status, transaction, stream, state } = gatewayApi

High Level APIs

High Level APIs will grow over time as we start encountering repeating patterns when dealing with low level APIs. They are supposed to help with most commonly performed tasks and standardize ways of working with Gateway API and Typescript.


  • getEntityDetailsVaultAggregated(entities: string | string[]) - detailed information about entities
  • getAllEntityMetadata(entity: string) - get all metadata about given entity
  • getEntityMetadata(entity: string, cursor?: string) - get paged metadata about given entity
  • getValidators(cursor?: string) - get paged validators
  • getAllValidators() - get all validators
  • getNonFungibleLocation(resource: string, ids: string[]) - get list of NFT location for given resource and ids
  • getNonFungibleIds(address:string, ledgerState, cursor?: string) - get paged non fungible ids for given address
  • getAllNonFungibleIds(address: string) - get all non fungible ids for given address
  • getNonFungibleData(address: string, ids: string | string[]) - get non fungible data


  • getCurrent() - Gateway API version and current ledger state
  • getNetworkConfiguration() - network identifier, network name and well-known network addresses


  • getStatus(txID: string) - transaction status for given transaction id (the intent hash)
  • getCommittedDetails(txID: string, options) - transaction details for given transaction id (the intent hash)


  • getTransactionsList(affectedEntities?: string[], cursor?: string) - get transaction list for given list of entities


  • getValidatorsUptimeFromTo(addresses: string[], from, to) - get uptime statistics for validators for given period
  • getValidatorsUptime(addresses: string[]) - get uptime statistics for validators

Low Level APIs

Low level APIs are generated automatically based on OpenAPI spec. You can get a good sense of available methods by looking at Swagger. In order to access automatically generated methods you have two options:

Using generated APIs through innerClient

async function getTransactionStatus(transactionIntentHash: string) {
  let response = await gatewayApi.transaction.innerClient.transactionStatus({
    transactionStatusRequest: {
      intent_hash: transactionIntentHash,
  return response.status
  await getTransactionStatus(

Using generated APIs manually

You can always opt-out of using aggregated gateway client and instantiate sub-apis manually

import { Configuration, StateApi } from '@radixdlt/babylon-gateway-api-sdk'
const config = new Configuration({ basePath: 'https://mainnet.radixdlt.com' })
const stateApi = new StateApi(config)
const response = await stateApi.nonFungibleData({
  stateNonFungibleDataRequest: {
    resource_address: address,
    non_fungible_ids: [id],

Fetch polyfill

Behind the scenes, this library uses the fetch API. If in an environment where fetch is not available, a polyfill must be used (see eg node-fetch). Pass your own fetch implementation to initialize parameter.

Starting from NodeJS 16 fetch is available as experimental API. You can e.g. check Gateway API status by using following snippet.

const { GatewayApiClient } = require('@radixdlt/babylon-gateway-api-sdk')

const gateway = GatewayApiClient.initialize({
  basePath: 'https://mainnet.radixdlt.com',

Save this as index.js and use by calling node --experimental-fetch index.js. This will enable experimental fetch and let code work without additional configuration. In NodeJS 18.x environment fetch API is enabled by default. Users of previous node versions will need to provide their own fetch implementation through configuration object.




Package Sidebar


npm i @radixdlt/babylon-gateway-api-sdk

Weekly Downloads






Unpacked Size

1.88 MB

Total Files


Last publish


  • javier-rdx
  • rdxrussell
  • bryanrdxworks
  • radixpublishing-owner
  • alex-rdx
  • aleworm