Cardano Pricing TypeScript Client
[!WARNING]
XRAY/Graph Pricing API and client are in active development, stay tuned to https://twitter.com/xray_network for updates.
[!NOTE]
Automatically generated Openapi-fetch (Axios) client for XRAY/Graph Pricing API based on schema.yaml OpenAPI schema. DEX price tracking for any Cardano token
Installation
To install the client with Yarn, run:
yarn install cardano-pricing-client
To install the client with NPM, run:
npm i cardano-pricing-client
Usage
import PricingClient from "cardano-pricing-client"
const client = PricingClient("https://graph.xray.app/output/pricing/mainnet/api/v1")
const app = async () => {
const orders = await client.GET("/orders")
if (orders.data) {
console.log(tip.data)
}
if (orders.error) {
console.error(tip.error)
}
}
app()
Advanced Usage
Request Cancellation (AbortSignal)
import PricingClient from "cardano-pricing-client"
const client = PricingClient("https://graph.xray.app/output/pricing/mainnet/api/v1")
const app = async () => {
const abortController = new AbortController()
setTimeout(() => {
abortController.abort()
console.log('Aborted!')
}, 200)
const orders = await client.GET("/orders", {
signal: abortController.signl,
})
if (orders.data) {
console.log(tip.data?.[0]?.block_no)
}
if (orders.error) {
console.error(tip.error)
}
}
app()
Endpoints
API URLs
Managed by XRAY/Network (XRAY/Graph, Cloudflare WAF & Load Balancer)
https://graph.xray.app/output/pricing/mainnet/api/v1
https://graph.xray.app/output/pricing/preprod/api/v1
https://graph.xray.app/output/pricing/preview/api/v1