cardano-ogmios-client
v1.0.1
Published
TypeScript Client for Ogmios blockchain bridge
Readme
TypeScript Client for Ogmios blockchain bridge
Automatically generated Openapi-fetch (Axios) client for Ogmios.
Installation
To install the client with Yarn, run:
yarn add cardano-ogmios-clientTo install the client with NPM, run:
npm i cardano-ogmios-clientUsage
import OgmiosClient from "cardano-ogmios-client"
const client = OgmiosClient("https://graph.xray.app/output/services/ogmios/mainnet/api/v1")
const app = async () => {
const tip = await client.GET("/health")
if (tip.data) {
console.log(tip.data?.lastKnownTip?.height)
}
if (tip.error) {
console.error(tip.error)
}
}
app()Advanced Usage
import OgmiosClient from "cardano-koios-client"
const baseUrl = "https://graph.xray.app/output/services/ogmios/mainnet/api/v1"
const headers = {} // rest headers
const client = OgmiosClient(baseUrl, headers)
const app = async () => {
const health = await client.GET("/health", {
headers: { "Content-Type": "application/json" }, // one shot headers
})
console.log(health.data)
}
app()import OgmiosClient from "cardano-ogmios-client"
const client = OgmiosClient("https://graph.xray.app/output/services/koios/mainnet/api/v1")
const app = async () => {
const abortController = new AbortController()
setTimeout(() => {
abortController.abort() // cancel request
console.log('Aborted!')
}, 200)
const tip = await client.GET("/health", {
signal: abortController.signal,
})
}
app()Run schema update:
yarn schemaPlayground
- XRAY/Graph Ogmios — https://graph.xray.app/output/services/ogmios/mainnet/api/v1/
API URLs
Managed by XRAY/Network (XRAY/Graph, Cloudflare WAF & Load Balancer)
https://graph.xray.app/output/services/ogmios/mainnet/api/v1https://graph.xray.app/output/services/ogmios/preprod/api/v1https://graph.xray.app/output/services/ogmios/preview/api/v1