@radixdlt/alphanet-gateway-api-v0-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

Alphanet Gateway v0 SDK

This SDK is a thin wrapper around the Babylon V0 Gateway API, detailed in the Open API schema.

Usage

Behind the scenes, this library uses the fetch API.

If in an environment where this is not available, a polyfill must be used.

An example using this with node is provided here in the github repo.

import "./node-fetch-polyfill" // Polyfill for fetch required if running in node-js
import { TransactionApi, StateApi } from "@radixdlt/alphanet-gateway-api-v0-sdk";

const transactionApi = new TransactionApi();
const stateApi = new StateApi();

async function getEpoch() {
    let response = await stateApi.stateEpochPost();
    return response.epoch;
}

async function getTransactionStatus(transactionIntentHashHex: string) {
    let response = await transactionApi.transactionStatusPost({
        v0TransactionStatusRequest: {
            intent_hash: transactionIntentHashHex
        }
    });
    return response.intent_status;
}

Readme

Keywords

none

Package Sidebar

Install

npm i @radixdlt/alphanet-gateway-api-v0-sdk

Weekly Downloads

0

Version

0.1.5

License

Apache-2.0

Unpacked Size

255 kB

Total Files

92

Last publish

Collaborators

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