cardano-api
Promise wrapper for the Cardano API.
This is not quite finished :/
const { cardano } = require('cardano-api')
const query = {
path: 'Ae2tdPwU...fQwGpm'
}
cardano.address(query)
.then(data => console.log('address', data))
.catch(err => console.log('err', err))
const myCardanoFunc = async () => {
try {
const data = await cardano.address(query)
console.log(data)
}
catch(err) { console.log(err) }
}
myCardanoFunc()
Supported Endpoints
const query = {
path: 'Ae2tdPwU...fQwGpm'
}
cardano.address(query)
.then(data => console.log('address', data))
const query = {
path: 'Ae2tdPwU...fQwGpm'
}
cardano.block(query)
.then(data => console.log('block', data))
Get the list of total pages
const query = {
pageSize: 3
}
cardano.pagesTotal(query)
.then(data => console.log('blockTotal', data))
const query = {
page: 1,
pageSize: 3,
redeemed: true
}
cardano.genesisAddress(query)
.then(data => console.log('genesisAddress', data))
const query = {
pageSize: 3,
redeemed: true
}
cardano.genesisPagesTotal(query)
.then(data => console.log('genesisPagesTotal', data))
cardano.genesisSummary()
.then(data => console.log('genesisSummary', data))
const query = {
path: 3,
slot: 24
}
cardano.epoch(query)
.then(data => console.log('epoch', data))
const query = {
path: 'Ae2tdPwU...fQwGpm'
}
cardano.transaction(query)
.then(data => console.log('transaction', data))
cardano.transactionLast() - /api/txs/last
cardano.transactionLast()
.then(data => console.log('transactionLast', data))
- A couple of the endpoints are represented with breaking changes in the official documentation, assume that more could change in the future
test
npm test