cardano-nftcdn-client
v1.0.4
Published
TypeScript client for XRAY/Graph NFTCDN API
Downloads
9
Readme
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
- Check OpenAPI fetch documentations for available endpoint parameters: https://openapi-ts.pages.dev/openapi-fetch/
- The client uses OpenAPI definitions from the NFTCDN API configuration: schema.yaml
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