1.0.2 • Published 14 days ago

cardano-nftcdn-client v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

Cardano NFTCDN TypeScript Client

!NOTE Automatically generated Openapi-fetch (Axios) client for XRAY/Graph NFTCDN API based on schema.yaml OpenAPI schema. Cardano native tokens metadata/datums indexer/explorer and images CDN. IPFS gateway included

Installation

To install the client with Yarn, run:

yarn install cardano-nftcdn-client

To install the client with NPM, run:

npm i cardano-nftcdn-client

Usage

import NftcdnClient from "cardano-nftcdn-client"

const client = NftcdnClient("https://graph.xray.app/output/nftcdn/mainnet/api/v1")

const app = async () => {
  const metadata = await client.GET("/metadata/{fingerprint}", {
    params: {
      path: {
        fingerprint: "asset1zwa4chw9xm7xwk7g46ef94qsj28hmnd7qffhgx",
      },
    },
  })

  if (metadata.data) {
    console.log(tip.data)
  }
  if (metadata.error) {
    console.error(tip.error)
  }
}

app()

Advanced Usage

import NftcdnClient from "cardano-nftcdn-client"

const client = NftcdnClient("https://graph.xray.app/output/nftcdn/mainnet/api/v1")

const app = async () => {
  const abortController = new AbortController()

  setTimeout(() => {
    abortController.abort() // cancel request
    console.log('Aborted!')
  }, 200)

  const assets = await client.GET("/assets", {
    signal: abortController.signl,
  })

  if (assets.data) {
    console.log(tip.data?.[0]?.block_no)
  }
  if (assets.error) {
    console.error(tip.error)
  }
}

app()

Endpoints

API URLs

Managed by XRAY/Network (XRAY/Graph, Cloudflare WAF & Load Balancer)

https://graph.xray.app/output/nftcdn/mainnet/api/v1
https://graph.xray.app/output/nftcdn/preprod/api/v1
https://graph.xray.app/output/nftcdn/preview/api/v1
1.0.2

14 days ago

1.0.1

14 days ago

1.0.0

15 days ago