cardano-api
Promise wrapper for the Cardano API.
const { cardano } = require('cardano-api')
const address = 'DdzFFzCqrht8iQ2utWYssBnfGvSqkGfM7fxHXZWoB57ormT17td1CY4Eye7bADF6HpeGC57vwV5ZPzmVjiZRQEkAD9Rc4P8LDF7FfYne'
cardano.address({address})
.then(data => console.log('promise', data))
.catch(err => console.log('err', err))
const myCardanoFunc = async address => {
try {
const data = await cardano.address(address)
console.log('async/await', data)
}
catch(err) { console.log(err) }
}
myCardanoFunc({address})
Endpoints
const query = {
address: 'Ae2tdP...fQwGpm'
}
cardano.address(query)
.then(data => console.log('address', data))
const query = {
hash: '52659d...195a70'
}
cardano.block(query)
.then(data => console.log('block', data))
const query = {
hash: '52659d...195a70',
limit: 10,
offset: 2
}
cardano.blockTransaction(query)
.then(data => console.log('block', data))
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 = {
epoch: 3,
slot: 24
}
cardano.epoch(query)
.then(data => console.log('epoch', data))
const query = {
txid: 'f3d468...3ac99b'
}
cardano.transaction(query)
.then(data => console.log('transaction', data))
cardano.transactionLast() - /api/txs/last
cardano.transactionLast()
.then(data => console.log('transactionLast', data))
Issues
Something not working? Please open an issue
Test
npm test
Cardano tips
DdzFFzCqrht8iQ2utWYssBnfGvSqkGfM7fxHXZWoB57ormT17td1CY4Eye7bADF6HpeGC57vwV5ZPzmVjiZRQEkAD9Rc4P8LDF7FfYne
Thank You